00001
00002
00003
00004
00005 #include <assert.h>
00006 #include <TObjArray.h>
00007 #include <StMessMgr.h>
00008 #include <TH2.h>
00009 #include <TList.h>
00010 #include <TLine.h>
00011 #include <TMath.h>
00012
00013 #include <StMuDSTMaker/COMMON/StMuTrack.h>
00014
00015
00016
00017
00018 #include "WtpcFilter.h"
00019 #include "WanaConst.h"
00020
00021
00022
00023 WtpcFilter::WtpcFilter() {
00024 secID=0;
00025 HList=0;
00026 name="fixMe";
00027 par_nFitPts=-1;
00028 }
00029
00030
00031
00032
00033 void
00034 WtpcFilter::init(const char *core, int sec, TObjArray *HListX) {
00035 HList=HListX;
00036 secID=sec;
00037 name=core; name+=secID; name+="_";
00038 assert(HList);
00039 assert(secID);
00040 assert(par_nFitPts>0);
00041
00042 LOG_INFO<<Form("::InitTPC filter (sec=%d) done, name=%s= nFit>%d, hitFrac>%.2f Rin<%.1fcm, Rout>%.1fcm",secID,name.Data(),par_nFitPts, par_nHitFrac, par_Rmin, par_Rmax)<<endm;
00043
00044 initHistos();
00045 }
00046
00047
00048
00049 bool
00050 WtpcFilter::accept( const StMuTrack *prTr){
00051
00052 hA[0]->Fill("inp",1.);
00053
00054 hA[2]->Fill(prTr->nHitsFit());
00055 if(prTr->nHitsFit()<=par_nFitPts) return false;
00056
00057 hA[0]->Fill("nHit",1.);
00058 float hitFrac=1.*prTr->nHitsFit()/prTr->nHitsPoss();
00059 hA[3]->Fill(hitFrac);
00060 if(hitFrac<par_nHitFrac) return false;
00061
00062 hA[0]->Fill("Hfrac",1.);
00063 StThreeVectorF ri=prTr->globalTrack()->firstPoint();
00064 hA[4]->Fill(ri.perp());
00065 if(ri.perp()>par_Rmin) return false;
00066
00067 hA[0]->Fill("Rin",1.);
00068 StThreeVectorF ro=prTr->globalTrack()->lastPoint();
00069 hA[5]->Fill(ro.perp());
00070 if(ro.perp()<par_Rmax) return false;
00071
00072
00073
00074 hA[0]->Fill("Rout",1.);
00075 hA[1]->Fill(ro.pseudoRapidity(),ro.phi());
00076 float dedx=prTr->dEdx()*1e6;
00077 hA[6]->Fill(prTr->p().mag(),dedx);
00078 return true;
00079 }
00080
00081
00082
00083
00084 int
00085 WtpcFilter::getTpcSec(float phiRad, float etaDet){
00086 const float PI=TMath::Pi();
00087 int sec=0;
00088 float phi=phiRad/PI*180;
00089 if (etaDet>0) {
00090 float x=75-phi;
00091 while(x<0) x+=360;
00092 sec=1+(int)( x/30.);
00093 } else {
00094 float x=phi-105;
00095 while(x<0) x+=360;
00096 sec=13+(int)( x/30.);
00097 }
00098
00099 assert(sec>0);
00100 assert(sec<=mxTpcSec);
00101 return sec;
00102 }
00103
00104
00105
00106
00107 void
00108 WtpcFilter::initHistos() {
00109 int myCol=2+ secID%6;
00110
00111
00112 memset(hA,0,sizeof(hA));
00113 TList *Lx; TLine *ln;TH1 *h;
00114
00115 TString sufix=", TPC sec="; sufix+=secID;
00116 int nCase=6;
00117 hA[0]=h=new TH1F(name+"Stat","track counter"+sufix+"; Cases",nCase,0,nCase);
00118 h->SetLineColor(myCol );
00119
00120 hA[1]=h=new TH2F(name+"Tr2D1","lastHit, accepted"+sufix+"; detector eta ; detector phi (rad)",100,-1.1,1.1,200,-3.2,3.2);
00121 h->SetLineColor(myCol );
00122
00123 hA[2]=h=new TH1F(name+"TrNfit","prim tr nFitP"+sufix+"; nFitPoints",50,0,50);
00124 Lx=h->GetListOfFunctions();
00125 ln=new TLine(par_nFitPts,0,par_nFitPts,1.e6); ln->SetLineColor(kRed); Lx->Add(ln);
00126
00127
00128 hA[3]=h=new TH1F(name+"TrFitFrac","prim tr nFitFrac"+sufix+"; nFit/nPoss ",50,0,1.1);
00129 Lx=h->GetListOfFunctions();
00130 ln=new TLine(par_nHitFrac,0,par_nHitFrac,1.e6); ln->SetLineColor(kRed); Lx->Add(ln);
00131
00132 hA[4]=h=new TH1F(name+"TrRxyIn","prim tr 1st hit filter"+sufix+"; Rxy (cm)",60,50,170.);
00133 Lx=h->GetListOfFunctions();
00134 ln=new TLine(par_Rmin,0,par_Rmin,1.e6); ln->SetLineColor(kRed); Lx->Add(ln);
00135
00136 hA[5]=h=new TH1F(name+"TrRxyOut","prim tr last hit filter"+sufix+"; Rxy (cm)",60,100,220.);
00137 Lx=h->GetListOfFunctions();
00138 ln=new TLine(par_Rmax,0,par_Rmax,1.e6); ln->SetLineColor(kRed); Lx->Add(ln);
00139
00140
00141 hA[6]=h=new TH2F(name+"TrdEdX"," dEdX vs. P, accpted "+sufix+"; track P (GeV); dE/dx (keV)",20,0,10,100,0,10);
00142
00143
00144
00145 for(int i=0;i<mxHA;i++) {
00146 if( hA[i]==0) continue;
00147 HList->Add( hA[i]);
00148 }
00149
00150
00151
00152
00153 }