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 hA[0]->Fill("inp",1.);
00052
00053 hA[2]->Fill(prTr->nHitsFit());
00054 if(prTr->nHitsFit()<=par_nFitPts) return false;
00055
00056 hA[0]->Fill("nHit",1.);
00057 float hitFrac=1.*prTr->nHitsFit()/prTr->nHitsPoss();
00058 hA[3]->Fill(hitFrac);
00059 if(hitFrac<par_nHitFrac) return false;
00060
00061 hA[0]->Fill("Hfrac",1.);
00062 StThreeVectorF ri=prTr->globalTrack()->firstPoint();
00063 hA[4]->Fill(ri.perp());
00064 if(ri.perp()>par_Rmin) return false;
00065
00066 hA[0]->Fill("Rin",1.);
00067 StThreeVectorF ro=prTr->globalTrack()->lastPoint();
00068 hA[5]->Fill(ro.perp());
00069 if(ro.perp()<par_Rmax) return false;
00070
00071
00072
00073 hA[0]->Fill("Rout",1.);
00074 hA[1]->Fill(ro.pseudoRapidity(),ro.phi());
00075 float dedx=prTr->dEdx()*1e6;
00076 hA[6]->Fill(prTr->p().mag(),dedx);
00077 return true;
00078 }
00079
00080
00081
00082
00083 int
00084 WtpcFilter::getTpcSec(float phiRad, float etaDet){
00085 const float PI=TMath::Pi();
00086 int sec=0;
00087 float phi=phiRad/PI*180;
00088 if (etaDet>0) {
00089 float x=75-phi;
00090 while(x<0) x+=360;
00091 sec=1+(int)( x/30.);
00092 } else {
00093 float x=phi-105;
00094 while(x<0) x+=360;
00095 sec=13+(int)( x/30.);
00096 }
00097
00098 assert(sec>0);
00099 assert(sec<=mxTpcSec);
00100 return sec;
00101 }
00102
00103
00104
00105
00106 void
00107 WtpcFilter::initHistos() {
00108 int myCol=2+ secID%6;
00109
00110
00111 memset(hA,0,sizeof(hA));
00112 TList *Lx; TLine *ln;TH1 *h;
00113
00114 TString sufix=", TPC sec="; sufix+=secID;
00115 int nCase=6;
00116 hA[0]=h=new TH1F(name+"Stat","track counter"+sufix+"; Cases",nCase,0,nCase);
00117 h->SetLineColor(myCol );
00118
00119 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);
00120 h->SetLineColor(myCol );
00121
00122 hA[2]=h=new TH1F(name+"TrNfit","prim tr nFitP"+sufix+"; nFitPoints",50,0,50);
00123 Lx=h->GetListOfFunctions();
00124 ln=new TLine(par_nFitPts,0,par_nFitPts,1.e6); ln->SetLineColor(kRed); Lx->Add(ln);
00125
00126
00127 hA[3]=h=new TH1F(name+"TrFitFrac","prim tr nFitFrac"+sufix+"; nFit/nPoss ",50,0,1.1);
00128 Lx=h->GetListOfFunctions();
00129 ln=new TLine(par_nHitFrac,0,par_nHitFrac,1.e6); ln->SetLineColor(kRed); Lx->Add(ln);
00130
00131 hA[4]=h=new TH1F(name+"TrRxyIn","prim tr 1st hit filter"+sufix+"; Rxy (cm)",60,50,170.);
00132 Lx=h->GetListOfFunctions();
00133 ln=new TLine(par_Rmin,0,par_Rmin,1.e6); ln->SetLineColor(kRed); Lx->Add(ln);
00134
00135 hA[5]=h=new TH1F(name+"TrRxyOut","prim tr last hit filter"+sufix+"; Rxy (cm)",60,100,220.);
00136 Lx=h->GetListOfFunctions();
00137 ln=new TLine(par_Rmax,0,par_Rmax,1.e6); ln->SetLineColor(kRed); Lx->Add(ln);
00138
00139
00140 hA[6]=h=new TH2F(name+"TrdEdX"," dEdX vs. P, accpted "+sufix+"; track P (GeV); dE/dx (keV)",20,0,10,100,0,10);
00141
00142
00143
00144 for(int i=0;i<mxHA;i++) {
00145 if( hA[i]==0) continue;
00146 HList->Add( hA[i]);
00147 }
00148
00149
00150
00151
00152 }