]>
Commit | Line | Data |
---|---|---|
59280a5a | 1 | AliRun *a; AliRunLoader *al; TGeoManager *g; //globals for easy manual manipulations |
2 | AliHMPID *h; AliLoader *hl; AliHMPIDParam *hp; | |
594d861b | 3 | Bool_t isGeomType=kFALSE; |
4 | ||
5 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
6 | void GetParam() | |
7 | { | |
8 | isGeomType=!isGeomType; | |
59280a5a | 9 | if(g) delete g; if(hp) delete hp; //delete current TGeoManager and AliHMPIDParam |
594d861b | 10 | if(isGeomType) g=TGeoManager::Import("geometry.root"); |
11 | else g=TGeoManager::Import("misaligned_geometry.root"); | |
59280a5a | 12 | hp=AliHMPIDParam::Instance(); |
d1bf51e1 | 13 | }//GetParam() |
594d861b | 14 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
15 | void Hmenu() | |
16 | { | |
17 | TString status="Status: "; | |
18 | if(gSystem->IsFileInIncludePath("galice.root")){ | |
19 | status+="galice.root found"; | |
20 | al=AliRunLoader::Open(); //try to open galice.root from current dir | |
21 | if(gAlice) delete gAlice; //in case we execute this in aliroot delete default AliRun object | |
22 | al->LoadgAlice(); a=al->GetAliRun(); //take new AliRun object from galice.root | |
59280a5a | 23 | hl=al->GetDetectorLoader("HMPID"); h=(AliHMPID*)a->GetDetector("HMPID"); //get HMPID object from galice.root |
594d861b | 24 | |
59280a5a | 25 | status+=Form(" with %i event(s)",al->GetNumberOfEvents()); status+=(h)? " with HMPID": " without HMPID"; |
594d861b | 26 | }else |
27 | status+="No galice.root"; | |
28 | ||
29 | GetParam(); | |
30 | ||
31 | TControlBar *pMenu = new TControlBar("horizontal",status.Data(),0,0); | |
32 | pMenu->AddButton(" ","",""); | |
d1bf51e1 | 33 | pMenu->AddButton(" General ","General()" ,"general items which do not depend on any files"); |
594d861b | 34 | pMenu->AddButton(" ","" ,""); |
d1bf51e1 | 35 | pMenu->AddButton(" Sim data ","SimData()" ,"items which expect to have simulated files" ); |
594d861b | 36 | pMenu->AddButton(" ","" ,""); |
d1bf51e1 | 37 | pMenu->AddButton(" Raw data ","RawData()" ,"items which expect to have raw files" ); |
594d861b | 38 | pMenu->AddButton(" ","print()" ,""); |
d1bf51e1 | 39 | pMenu->AddButton(" Test ","Test()" ,"all test utilities"); |
594d861b | 40 | pMenu->AddButton(" ","GetParam()" ,""); |
d1bf51e1 | 41 | pMenu->AddButton(" Quit ",".q" ,"close session" ); |
594d861b | 42 | pMenu->Show(); |
d1bf51e1 | 43 | }//Menu() |
594d861b | 44 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
45 | void General() | |
46 | { | |
d1bf51e1 | 47 | TControlBar *pMenu = new TControlBar("vertical","General purpose",100,50); |
59280a5a | 48 | pMenu->AddButton("Debug ON","don();" ,"Switch debug on-off" ); |
49 | pMenu->AddButton("Debug OFF","doff();" ,"Switch debug on-off" ); | |
50 | pMenu->AddButton("Geo GUI","geo();" ,"Shows geometry" ); | |
51 | pMenu->AddButton("Browser","new TBrowser;" ,"Start ROOT TBrowser" ); | |
594d861b | 52 | pMenu->Show(); |
d1bf51e1 | 53 | }//General() |
594d861b | 54 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
55 | void SimData() | |
56 | { | |
59280a5a | 57 | TControlBar *pMenu = new TControlBar("vertical","Sim data",310,50); |
1aac6f06 | 58 | pMenu->AddButton("Display ","hed();" ,"Display Fast"); |
59280a5a | 59 | pMenu->AddButton("HITS QA" ,"hqa()" ,"QA plots for hits: hqa()"); |
60 | pMenu->AddButton("Print stack" ,"stack();" ,"To print hits: hp(evt)"); | |
61 | pMenu->AddButton("Print hits" ,"hp();" ,"To print hits: hp(evt)"); | |
62 | pMenu->AddButton("Print sdigits" ,"sp();" ,"To print sdigits: sp(evt)"); | |
63 | pMenu->AddButton("Print digits" ,"dp();" ,"To print digits: dp(evt)"); | |
64 | pMenu->AddButton("Print clusters" ,"cp();" ,"To print clusters: cp(evt)"); | |
594d861b | 65 | pMenu->Show(); |
d1bf51e1 | 66 | }//SimData() |
594d861b | 67 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
68 | void RawData() | |
69 | { | |
d1bf51e1 | 70 | TControlBar *pMenu = new TControlBar("vertical","Raw data",580,50); |
594d861b | 71 | pMenu->AddButton("ESD print" ,"ep();" ,"To print ESD info: ep()" ); |
72 | pMenu->AddButton("ESD QA" ,"eq();" ,"To draw ESD hists: eq()" ); | |
73 | pMenu->AddButton("Clusters print" ,"cp();" ,"To print clusters: cp()" ); | |
74 | pMenu->AddButton("Clusters QA" ,"cq();" ,"To draw clusters hists: cq()" ); | |
75 | pMenu->AddButton("Print Matrix" ,"mp();" ,"To print prob matrix: mp()" ); | |
76 | pMenu->AddButton("Print occupancy" ,"r->OccupancyPrint(-1);" ,"To print occupancy" ); | |
77 | pMenu->AddButton("Print event summary " ,"r->SummaryOfEvent();" ,"To print a summary of the event" ); | |
78 | pMenu->Show(); | |
d1bf51e1 | 79 | }//RawData() |
594d861b | 80 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
81 | void Test() | |
82 | { | |
d1bf51e1 | 83 | TControlBar *pMenu = new TControlBar("vertical","Test",820,50); |
1aac6f06 | 84 | pMenu->AddButton("TEST Display " ,"sed();" ,"Display Fast"); |
594d861b | 85 | pMenu->AddButton("Hits->Digits" ,"thd();" ,"test hits->sdigits->digits" ); |
86 | pMenu->AddButton("Segmentation" ,"ts()" ,"test segmentation methods" ); | |
87 | pMenu->AddButton("Test response" ,"AliHMPIDParam::TestResp();","Test AliHMPIDParam response methods" ); | |
88 | pMenu->AddButton("Print map" ,"PrintMap();" ,"Test AliHMPIDParam transformation methods" ); | |
89 | pMenu->AddButton("Test Recon" ,"rec();" ,"Test AliHMPIDRecon" ); | |
90 | pMenu->Show(); | |
91 | }//Test() | |
92 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
93 | ||
94 | ||
95 | void doff(){ Printf("DebugOFF"); AliLog::SetGlobalDebugLevel(0);} | |
96 | void don() { Printf("DebugON"); AliLog::SetGlobalDebugLevel(AliLog::kDebug);} | |
97 | ||
98 | void geo ( ) {gGeoManager->GetTopVolume()->Draw("ogl");} | |
99 | ||
59280a5a | 100 | void du ( ) {h->Dump ( );} //utility display |
594d861b | 101 | |
59280a5a | 102 | void hp (Int_t evt=0 ) {h->HitPrint (evt);} //print hits for requested event |
103 | void hq ( ) {h->HitQA ( );} //hits QA plots for all events | |
104 | void sp (Int_t evt=0 ) {h->SdiPrint (evt);} //print sdigits for requested event | |
105 | void sq (Int_t evt=0 ) {h->SdiPrint (evt);} //print sdigits for requested event | |
106 | void dp (Int_t evt=0 ) {h->DigPrint (evt);} //print digits for requested event | |
594d861b | 107 | void dq ( ) {AliHMPIDReconstructor::DigQA (al );} //digits QA plots for all events |
59280a5a | 108 | void cp (Int_t evt=0 ) {h->CluPrint (evt); } //print clusters for requested event |
594d861b | 109 | void cq ( ) {AliHMPIDReconstructor::CluQA (al );} //clusters QA plots for all events |
110 | ||
111 | void ep ( ) {AliHMPIDTracker::EsdQA(1); } | |
112 | void eq ( ) {AliHMPIDTracker::EsdQA(); } | |
113 | void mp (Double_t probCut=0.7 ) {AliHMPIDTracker::MatrixPrint(probCut);} | |
114 | ||
115 | ||
d1bf51e1 | 116 | void stack( ) {AliHMPIDParam::Stack();} |
117 | void tid (Int_t tid,Int_t evt=0) {AliHMPIDParam::Stack(evt,tid);} | |
594d861b | 118 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
d1bf51e1 | 119 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
594d861b | 120 | void PrintMap() |
121 | { | |
122 | ||
123 | Double_t r2d=TMath::RadToDeg(); | |
124 | ||
125 | Double_t x=AliHMPIDDigit::SizeAllX(),y=AliHMPIDDigit::SizeAllY(); | |
126 | ||
127 | Printf("\n\n\n"); | |
128 | ||
129 | for(int ch=6;ch>=0;ch--){ | |
130 | AliHMPIDDigit dL(ch,0,1,0,0),dR(ch,0,1,67,0); | |
131 | TVector3 lt=rp->Lors2Mars(ch,0,y); TVector3 rt=rp->Lors2Mars(ch,x,y); | |
132 | TVector3 ce=rp->Lors2Mars(ch,x/2,y/2); | |
133 | TVector3 lb=rp->Lors2Mars(ch,0,0); TVector3 rb=rp->Lors2Mars(ch,x,0); | |
134 | ||
135 | Printf(" ____________________________"); | |
136 | Printf("|%6.2fcm %6.2fcm|" ,lt.Mag() , rt.Mag() ); | |
137 | Printf("|%6.2fde %6.2fde|" ,lt.Theta()*r2d , rt.Theta()*r2d ); | |
138 | Printf("|%6.2fde %6.2fde|" ,lt.Phi()*r2d , rt.Phi()*r2d ); | |
139 | Printf("| |" ); | |
140 | Printf("|DDL %2i %7.2fcm DDL %2i|" ,dL.DdlIdx() , ce.Mag() , dR.DdlIdx() ); | |
141 | Printf("| 0x%x %7.2fdeg 0x%x|" ,dL.DdlId() , ce.Theta()*r2d , dR.DdlId() ); | |
142 | Printf("| %7.2fdeg |" , ce.Phi()*r2d ); | |
143 | Printf("| |"); | |
144 | Printf("|%6.2fcm %6.2fcm|" ,lb.Mag() , rb.Mag() ); | |
145 | Printf("|%6.2fde %6.2fde|" ,lb.Theta()*r2d , rb.Theta()*r2d ); | |
146 | Printf("|%6.2fde Ch%i %6.2fde|" ,lb.Phi()*r2d , ch , rb.Phi()*r2d ); | |
147 | Printf(" ----------------------------"); | |
148 | } | |
149 | ||
150 | Double_t m[3]; | |
151 | for(int i=0;i<1000;i++){ | |
152 | Float_t xout=0,xin=gRandom->Rndm()*130.60; | |
153 | Float_t yout=0,yin=gRandom->Rndm()*126.16; | |
154 | Int_t c=gRandom->Rndm()*6; | |
155 | rp->Lors2Mars(c,xin,yin,m); | |
156 | rp->Mars2Lors(c,m,xout,yout); | |
157 | if( (xin-xout) != 0) Printf("Problem in X"); | |
158 | if( (yin-yout) != 0) Printf("Problem in Y"); | |
159 | } | |
160 | ||
161 | Int_t ddl,r,d,a,ch,raw,pc,px,py; AliHMPIDDigit dd; | |
162 | ||
163 | ddl=0;raw=0x2214000;r= 8;d=8;a=20; | |
164 | ddl=1;raw=0x2214000;r= 8;d=8;a=20; | |
165 | ||
166 | ||
167 | ddl=2;raw=0x08d6000;r= 2;d=3;a=22; | |
168 | ddl=3;raw=0x08d6000;r= 2;d=3;a=22; | |
169 | ||
170 | ||
171 | ddl=6;raw=0x592e000;r=22;d=4;a=46;ch=3;pc=4;px=55;py=5;dd.Raw(ddl,raw); | |
172 | Printf("(ch=%i,pc=%i,x=%2i,y=%2i) ddl=%i raw=0x%h (r=%2i,d=%2i,a=%2i)", | |
173 | ch, pc, px, py, ddl, raw, r, d, a); dd.Print(); | |
174 | ddl=7;raw=0x592e000;r=22;d=4;a=46;ch=3;pc=1; | |
175 | ||
176 | ||
177 | }//PrintMap() | |
d1bf51e1 | 178 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
594d861b | 179 | void HitQA(Double_t cut,Double_t cutele,Double_t cutR) |
180 | { | |
181 | // Provides a set of control plots intended primarily for charged particle flux analisys | |
182 | // Arguments: cut (GeV) - cut on momentum of any charged particles but electrons, | |
183 | // cetele (GeV) - the same for electrons-positrons | |
184 | // cutR (cm) - cut on production vertex radius (cylindrical system) | |
185 | gBenchmark->Start("HitsAna"); | |
186 | ||
187 | Double_t cutPantiproton =cut; | |
188 | Double_t cutPkaonminus =cut; | |
189 | Double_t cutPpionminus =cut; | |
190 | Double_t cutPmuonminus =cut; | |
191 | Double_t cutPpositron =cutele; | |
192 | ||
193 | Double_t cutPelectron =cutele; | |
194 | Double_t cutPmuonplus =cut; | |
195 | Double_t cutPpionplus =cut; | |
196 | Double_t cutPkaonplus =cut; | |
197 | Double_t cutPproton =cut; | |
198 | ||
199 | ||
d1bf51e1 | 200 | TH2F *pEleHitRZ =new TH2F("EleHitRZ" ,Form("e^{+} e^{-} hit %s;z[cm];R[cm]" ,GetName()) , 400,-300,300 ,400,-500,500); //R-z |
201 | TH2F *pEleHitRP =new TH2F("EleHitRP" ,Form("e^{+} e^{-} hit %s;p[GeV];R[cm]",GetName()) ,1000,-1 ,1 ,400, 0,550); //R-p | |
594d861b | 202 | TH1F *pEleAllP =new TH1F("EleAllP" , "e^{+} e^{-} all;p[GeV]" ,1000,-1 ,1 ); |
203 | TH1F *pEleHitP =new TH1F("EleHitP" ,Form("e^{+} e^{-} hit %s;p[GeV]" ,GetName()) ,1000,-1 ,1 ); | |
204 | TH1F *pMuoHitP =new TH1F("MuoHitP" ,Form("#mu^{-} #mu^{+} hit %s;p[GeV]" ,GetName()) ,1000,-4 ,4 ); | |
205 | TH1F *pPioHitP =new TH1F("PioHitP" ,Form("#pi^{-} #pi^{+} hit %s;p[GeV]" ,GetName()) ,1000,-4 ,4 ); | |
206 | TH1F *pKaoHitP =new TH1F("KaoHitP" ,Form("K^{-} K^{+} hit %s;p[GeV]" ,GetName()) ,1000,-4 ,4 ); | |
207 | TH1F *pProHitP =new TH1F("ProHitP" ,Form("p^{-} p^{+} hit %s;p[GeV]" ,GetName()) ,1000,-4 ,4 ); | |
208 | TH2F *pFlux =new TH2F("flux" ,Form("%s flux with Rvertex<%.1fcm" ,GetName(),cutR),10 ,-5 ,5 , 10,0 ,10); //special text hist | |
209 | TH2F *pVertex =new TH2F("vertex" ,Form("%s 2D vertex of HMPID hit;x;y" ,GetName()) ,120 ,0 ,600 ,120,0 ,600); //special text hist | |
210 | TH1F *pRho =new TH1F("rho" ,Form("%s r of HMPID hit" ,GetName()) ,600 ,0 ,600); //special text hist | |
211 | pFlux->SetStats(0); | |
212 | pFlux->GetXaxis()->SetBinLabel(1 ,Form("p^{-}>%.3fGeV/c" ,cutPantiproton)); | |
213 | pFlux->GetXaxis()->SetBinLabel(2 ,Form("K^{-}>%.3fGeV/c" ,cutPkaonminus )); | |
214 | pFlux->GetXaxis()->SetBinLabel(3 ,Form("#pi^{-}>%.3fGeV/c" ,cutPpionminus )); | |
215 | pFlux->GetXaxis()->SetBinLabel(4 ,Form("#mu^{-}>%.3fGeV/c" ,cutPmuonminus )); | |
216 | pFlux->GetXaxis()->SetBinLabel(5 ,Form("e^{+}>%.3fGeV/c" ,cutPpositron )); | |
217 | ||
218 | pFlux->GetXaxis()->SetBinLabel(6 ,Form("e^{-}>%.3fGeV/c" ,cutPelectron )); | |
219 | pFlux->GetXaxis()->SetBinLabel(7 ,Form("#mu^{+}>%.3fGeV/c" ,cutPmuonplus )); | |
220 | pFlux->GetXaxis()->SetBinLabel(8 ,Form("#pi^{+}>%.3fGeV/c" ,cutPpionplus )); | |
221 | pFlux->GetXaxis()->SetBinLabel(9 ,Form("K^{+}>%.3fGeV/c" ,cutPkaonplus )); | |
222 | pFlux->GetXaxis()->SetBinLabel(10,Form("p^{+}>%.3fGeV/c" ,cutPproton )); | |
223 | ||
224 | pFlux->GetYaxis()->SetBinLabel(1,"sum"); | |
225 | pFlux->GetYaxis()->SetBinLabel(2,"ch1"); | |
226 | pFlux->GetYaxis()->SetBinLabel(3,"ch2"); | |
227 | pFlux->GetYaxis()->SetBinLabel(4,"ch3"); | |
228 | pFlux->GetYaxis()->SetBinLabel(5,"ch4"); | |
229 | pFlux->GetYaxis()->SetBinLabel(6,"ch5"); | |
230 | pFlux->GetYaxis()->SetBinLabel(7,"ch6"); | |
231 | pFlux->GetYaxis()->SetBinLabel(8,"ch7"); | |
232 | pFlux->GetYaxis()->SetBinLabel(9,"prim"); | |
233 | pFlux->GetYaxis()->SetBinLabel(10,"tot"); | |
234 | ||
235 | //end of hists definition | |
236 | ||
237 | Int_t iNevents=fLoader->GetRunLoader()->GetAliRun()->GetEventsPerRun(),iCntPrimParts=0,iCntTotParts=0; | |
238 | //load all needed trees | |
239 | fLoader->LoadHits(); | |
240 | fLoader->GetRunLoader()->LoadHeader(); | |
241 | fLoader->GetRunLoader()->LoadKinematics(); | |
242 | ||
243 | for(Int_t iEvtN=0;iEvtN < iNevents;iEvtN++){//events loop | |
244 | fLoader->GetRunLoader()->GetEvent(iEvtN); | |
245 | AliInfo(Form(" %i event processes",fLoader->GetRunLoader()->GetEventNumber())); | |
246 | AliStack *pStack= fLoader->GetRunLoader()->Stack(); | |
247 | ||
248 | for(Int_t iParticleN=0;iParticleN<pStack->GetNtrack();iParticleN++){//stack loop | |
249 | TParticle *pPart=pStack->Particle(iParticleN); | |
250 | ||
251 | if(iParticleN%10000==0) AliInfo(Form(" %i particles read",iParticleN)); | |
252 | ||
253 | switch(pPart->GetPdgCode()){ | |
254 | case kProtonBar: pFlux->Fill(-4.5,9); if(pPart->Rho()<0.01) pFlux->Fill(-4.5,8); break; | |
255 | case kKMinus: pFlux->Fill(-3.5,9); if(pPart->Rho()<0.01) pFlux->Fill(-3.5,8); break; | |
256 | case kPiMinus: pFlux->Fill(-2.5,9); if(pPart->Rho()<0.01) pFlux->Fill(-2.5,8); break; | |
257 | case kMuonMinus: pFlux->Fill(-1.5,9); if(pPart->Rho()<0.01) pFlux->Fill(-1.5,8); break; | |
258 | case kPositron: pFlux->Fill(-0.5,9); if(pPart->Rho()<0.01) pFlux->Fill(-0.5,8); pEleAllP->Fill(-pPart->P()); break; | |
259 | ||
260 | case kElectron: pFlux->Fill( 0.5,9); if(pPart->Rho()<0.01) pFlux->Fill( 0.5,8); pEleAllP->Fill( pPart->P()); break; | |
261 | case kMuonPlus: pFlux->Fill( 1.5,9); if(pPart->Rho()<0.01) pFlux->Fill( 1.5,8); break; | |
262 | case kPiPlus: pFlux->Fill( 2.5,9); if(pPart->Rho()<0.01) pFlux->Fill( 2.5,8); break; | |
263 | case kKPlus: pFlux->Fill( 3.5,9); if(pPart->Rho()<0.01) pFlux->Fill( 3.5,8); break; | |
264 | case kProton: pFlux->Fill( 4.5,9); if(pPart->Rho()<0.01) pFlux->Fill( 4.5,8); break; | |
265 | }//switch | |
266 | }//stack loop | |
267 | //now hits analiser | |
268 | for(Int_t iEntryN=0;iEntryN < fLoader->TreeH()->GetEntries();iEntryN++){//TreeH loop | |
269 | fLoader->TreeH()->GetEntry(iEntryN); //get current entry (prim) | |
270 | for(Int_t iHitN=0;iHitN < Hits()->GetEntries();iHitN++){//hits loop | |
271 | AliHMPIDHit *pHit = (AliHMPIDHit*)Hits()->At(iHitN); //get current hit | |
272 | TParticle *pPart=pStack->Particle(pHit->GetTrack()); //get stack particle which produced the current hit | |
273 | ||
274 | if(pPart->GetPDG()->Charge()!=0&&pPart->Rho()>0.1) pVertex->Fill(pPart->Vx(),pPart->Vy()); //safe margin for sec. | |
275 | if(pPart->GetPDG()->Charge()!=0) pRho->Fill(pPart->Rho()); //safe margin for sec. | |
276 | if(pPart->R()>cutR) continue; //cut on production radius (cylindrical system) | |
277 | ||
278 | switch(pPart->GetPdgCode()){ | |
279 | case kProtonBar: if(pPart->P()>cutPantiproton) {pProHitP->Fill(-pPart->P()); pFlux->Fill(-4.5,pHit->Ch());}break; | |
280 | case kKMinus : if(pPart->P()>cutPkaonminus) {pKaoHitP->Fill(-pPart->P()); pFlux->Fill(-3.5,pHit->Ch());}break; | |
281 | case kPiMinus : if(pPart->P()>cutPpionminus) {pPioHitP->Fill(-pPart->P()); pFlux->Fill(-2.5,pHit->Ch());}break; | |
282 | case kMuonMinus: if(pPart->P()>cutPmuonminus) {pMuoHitP->Fill(-pPart->P()); pFlux->Fill(-1.5,pHit->Ch());}break; | |
283 | case kPositron : if(pPart->P()>cutPpositron) {pEleHitP->Fill(-pPart->P()); pFlux->Fill(-0.5,pHit->Ch()); | |
284 | pEleHitRP->Fill(-pPart->P(),pPart->R()); pEleHitRZ->Fill(pPart->Vz(),pPart->R()); }break; | |
285 | ||
286 | case kElectron : if(pPart->P()>cutPelectron) {pEleHitP->Fill( pPart->P()); pFlux->Fill( 0.5,pHit->Ch()); | |
287 | pEleHitRP->Fill( pPart->P(),pPart->R()); pEleHitRZ->Fill(pPart->Vz(),pPart->R()); }break; | |
288 | case kMuonPlus : if(pPart->P()>cutPmuonplus) {pMuoHitP->Fill( pPart->P()); pFlux->Fill( 1.5,pHit->Ch());}break; | |
289 | case kPiPlus : if(pPart->P()>cutPpionplus) {pPioHitP->Fill( pPart->P()); pFlux->Fill( 2.5,pHit->Ch());}break; | |
290 | case kKPlus : if(pPart->P()>cutPkaonplus) {pKaoHitP->Fill( pPart->P()); pFlux->Fill( 3.5,pHit->Ch());}break; | |
291 | case kProton : if(pPart->P()>cutPproton) {pProHitP->Fill( pPart->P()); pFlux->Fill( 4.5,pHit->Ch());}break; | |
292 | } | |
293 | }//hits loop | |
294 | }//TreeH loop | |
295 | iCntPrimParts +=pStack->GetNprimary(); | |
296 | iCntTotParts +=pStack->GetNtrack(); | |
297 | }//events loop | |
298 | //unload all loaded staff | |
299 | fLoader->UnloadHits(); | |
300 | fLoader->GetRunLoader()->UnloadHeader(); | |
301 | fLoader->GetRunLoader()->UnloadKinematics(); | |
302 | //Calculater some sums | |
303 | Stat_t sum=0; | |
304 | //sum row, sum over rows | |
305 | for(Int_t i=1;i<=pFlux->GetNbinsX();i++){ | |
306 | sum=0; for(Int_t j=2;j<=8;j++) sum+=pFlux->GetBinContent(i,j); | |
307 | pFlux->SetBinContent(i,1,sum); | |
308 | } | |
309 | ||
310 | //display everything | |
311 | new TCanvas("canvas1",Form("Events %i Nprims=%i Nparticles=%i",iNevents,iCntPrimParts,iCntTotParts),1000,900); pFlux->Draw("text"); gPad->SetGrid(); | |
312 | //total prims and particles | |
313 | TLatex latex; latex.SetTextSize(0.02); | |
314 | sum=0; for(Int_t i=1;i<=pFlux->GetNbinsX();i++) sum+=pFlux->GetBinContent(i,10); latex.DrawLatex(5.1,9.5,Form("%.0f",sum)); | |
315 | sum=0; for(Int_t i=1;i<=pFlux->GetNbinsX();i++) sum+=pFlux->GetBinContent(i,9); latex.DrawLatex(5.1,8.5,Form("%.0f",sum)); | |
316 | for(Int_t iCh=0;iCh<7;iCh++) { | |
317 | sum=0; for(Int_t i=1;i<=pFlux->GetNbinsX();i++) sum+=pFlux->GetBinContent(i,iCh+2);latex.DrawLatex(5.1,iCh+1.5,Form("%.0f",sum)); | |
318 | } | |
319 | sum=0; for(Int_t i=1;i<=pFlux->GetNbinsX();i++) sum+=pFlux->GetBinContent(i,1); latex.DrawLatex(5.1,0.5,Form("%.0f",sum)); | |
320 | ||
321 | new TCanvas("cEleAllP" ,"e" ,200,100); pEleAllP->Draw(); | |
322 | new TCanvas("cEleHitRP" ,"e" ,200,100); pEleHitRP->Draw(); | |
323 | new TCanvas("cEleHitRZ" ,"e" ,200,100); pEleHitRZ->Draw(); | |
324 | new TCanvas("cEleHitP" ,"e" ,200,100); pEleHitP->Draw(); | |
325 | new TCanvas("cMuoHitP" ,"mu",200,100); pMuoHitP->Draw(); | |
326 | new TCanvas("cPioHitP" ,"pi",200,100); pPioHitP->Draw(); | |
327 | new TCanvas("cKaoHitP" ,"K" ,200,100); pKaoHitP->Draw(); | |
328 | new TCanvas("cProHitP" ,"p" ,200,100); pProHitP->Draw(); | |
329 | new TCanvas("cVertex" ,"2d vertex" ,200,100); pVertex->Draw(); | |
330 | new TCanvas("cRho" ,"Rho of sec" ,200,100); pRho->Draw(); | |
331 | ||
332 | gBenchmark->Show("HitsPlots"); | |
333 | }//HitQA() | |
d1bf51e1 | 334 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
d1bf51e1 | 335 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
336 | void CluQA(AliRunLoader *pAL) | |
594d861b | 337 | { |
338 | // Quality assesment plots for clusters. | |
339 | // This methode takes list of digits and form list of clusters again in order to | |
340 | // calculate cluster shape and cluster particle mixture | |
341 | AliLoader *pRL=pAL->GetDetectorLoader("HMPID"); AliHMPID *pRich=(AliHMPID*)pAL->GetAliRun()->GetDetector("HMPID");//get pointers for HMPID and HMPID loader | |
342 | Int_t iNevt=pAL->GetNumberOfEvents(); if(iNevt==0) {AliInfoClass("No events");return;} | |
343 | if(pRL->LoadDigits()) {AliInfoClass("No digits file");return;} | |
344 | pAL->LoadHeader(); | |
345 | pAL->LoadKinematics(); | |
346 | // AliStack *pStack=pAL->Stack(); | |
347 | TH1::AddDirectory(kFALSE); | |
348 | ||
349 | ||
d1bf51e1 | 350 | TH1F* pQ=new TH1F("HmpAllQ" ,"Charge All" ,4000 ,0 ,4000);// Q hists |
351 | TH1F* pCerQ=new TH1F("HmpCerQ" ,"Charge Ckov" ,4000 ,0 ,4000); | |
352 | TH1F* pMipQ=new TH1F("HmpMipQ" ,"Charge MIP" ,4000 ,0 ,4000); | |
594d861b | 353 | |
d1bf51e1 | 354 | TH1F* pS=new TH1F("HmpCluSize" ,"Cluster size;size" ,100 ,0 ,100 );// size hists |
355 | TH1F* pCerS=new TH1F("HmpCluCerSize" ,"Ckov size;size" ,100 ,0 ,100 ); | |
356 | TH1F* pMipS=new TH1F("HmpCluMipSize" ,"MIP size;size" ,100 ,0 ,100 ); | |
594d861b | 357 | |
d1bf51e1 | 358 | TH2F* pM=new TH2F("HmpCluMap" ,"Cluster map;x [cm];y [cm]" ,1000 ,0 ,AliHMPIDDigit::SizeAllX(),1000,0,AliHMPIDDigit::SizeAllY()); // maps |
359 | TH2F* pMipM=new TH2F("HmpCluMipMap" ,"MIP map;x [cm];y [cm]" ,1000 ,0 ,AliHMPIDDigit::SizeAllX(),1000,0,AliHMPIDDigit::SizeAllY()); | |
360 | TH2F* pCerM=new TH2F("HmpCluCerMap" ,"Ckov map;x [cm];y [cm]" ,1000 ,0 ,AliHMPIDDigit::SizeAllX(),1000,0,AliHMPIDDigit::SizeAllY()); | |
594d861b | 361 | |
362 | ||
363 | ||
364 | for(Int_t iEvt=0;iEvt<iNevt;iEvt++){ | |
365 | pAL->GetEvent(iEvt); | |
366 | pRL->TreeD()->GetEntry(0); | |
367 | TClonesArray *pCluLst=new TClonesArray("AliHMPIDCluster");//tmp list of clusters for this event | |
368 | ||
d1bf51e1 | 369 | for(Int_t iCh=0;iCh<7;iCh++) AliHMPIDReconstructor::Dig2Clu(pRich->DigLst(iCh),pCluLst,kFALSE);//cluster finder for all chamber if any digits present |
594d861b | 370 | |
371 | for(Int_t iClu=0;iClu<pCluLst->GetEntriesFast();iClu++){ | |
372 | AliHMPIDCluster *pClu = (AliHMPIDCluster*)pCluLst->At(iClu); | |
373 | Int_t cfm=0; for(Int_t iDig=0;iDig<pClu->Size();iDig++) cfm+=pClu->Dig(iDig)->Ch(); //collect ckov-fee-mip structure of current cluster ????? | |
374 | Int_t iNckov=cfm/1000000; Int_t iNfee =cfm%1000000/1000; Int_t iNmip =cfm%1000000%1000; | |
375 | ||
d1bf51e1 | 376 | pQ ->Fill(pClu->Q()) ; pS ->Fill(pClu->Size()) ; pM ->Fill(pClu->X(),pClu->Y()); //all clusters |
594d861b | 377 | if(iNckov!=0 && iNfee==0 && iNmip==0) {pCerQ->Fill(pClu->Q()) ; pCerS->Fill(pClu->Size()) ; pCerM ->Fill(pClu->X(),pClu->Y());}//ckov only cluster |
378 | if(iNckov==0 && iNfee==0 && iNmip!=0) {pMipQ->Fill(pClu->Q()) ; pMipS->Fill(pClu->Size()) ; pMipM ->Fill(pClu->X(),pClu->Y());}//mip only cluster | |
379 | ||
380 | }//clusters loop | |
381 | pCluLst->Clear();delete pCluLst; | |
382 | }//events loop | |
383 | ||
384 | pRL->UnloadDigits(); pAL->UnloadKinematics(); pAL->UnloadHeader(); | |
385 | TCanvas *pC=new TCanvas("RichCluQA",Form("QA for cluster from %i events",iNevt),1000,900); pC->Divide(3,3); | |
386 | pC->cd(1); pM->Draw(); pC->cd(2); pQ->Draw(); pC->cd(3); pS->Draw(); | |
387 | pC->cd(4); pMipM->Draw(); pC->cd(5); pMipQ->Draw(); pC->cd(6); pMipS->Draw(); | |
388 | pC->cd(7); pCerM->Draw(); pC->cd(8); pCerQ->Draw(); pC->cd(9); pCerS->Draw(); | |
389 | }//CluQA() | |
d1bf51e1 | 390 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
391 | void OccupancyPrint(Int_t iEvtNreq) | |
594d861b | 392 | { |
393 | //prints occupancy for each chamber in a given event | |
394 | Int_t iEvtNmin,iEvtNmax; | |
395 | if(iEvtNreq==-1){ | |
396 | iEvtNmin=0; | |
397 | iEvtNmax=gAlice->GetEventsPerRun(); | |
398 | } else { | |
399 | iEvtNmin=iEvtNreq;iEvtNmax=iEvtNreq+1; | |
400 | } | |
401 | ||
402 | if(GetLoader()->GetRunLoader()->LoadHeader()) return; | |
403 | if(GetLoader()->GetRunLoader()->LoadKinematics()) return; | |
404 | ||
405 | // Info("Occupancy","for event %i",iEvtN); | |
406 | if(GetLoader()->LoadHits()) return; | |
407 | if(GetLoader()->LoadDigits()) return; | |
408 | ||
409 | ||
410 | for(Int_t iEvtN=iEvtNmin;iEvtN<iEvtNmax;iEvtN++){ | |
411 | Int_t nDigCh[7]={0,0,0,0,0,0,0}; | |
412 | Int_t iChHits[7]={0,0,0,0,0,0,0}; | |
413 | Int_t nPrim[7]={0,0,0,0,0,0,0}; | |
414 | Int_t nSec[7]={0,0,0,0,0,0,0}; | |
415 | AliInfo(Form("events processed %i",iEvtN)); | |
416 | if(GetLoader()->GetRunLoader()->GetEvent(iEvtN)) return; | |
417 | AliStack *pStack = GetLoader()->GetRunLoader()->Stack(); | |
418 | for(Int_t iPrimN=0;iPrimN<GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop | |
419 | GetLoader()->TreeH()->GetEntry(iPrimN); | |
420 | for(Int_t iHitN=0;iHitN<Hits()->GetEntries();iHitN++){ | |
421 | AliHMPIDHit *pHit = (AliHMPIDHit*)Hits()->At(iHitN); | |
422 | if(pHit->E()>0){ | |
423 | iChHits[pHit->Ch()]++; | |
424 | if(pStack->Particle(pHit->GetTrack())->Rho()<0.01) nPrim[pHit->Ch()]++;else nSec[pHit->Ch()]++; | |
425 | } | |
426 | } | |
427 | } | |
428 | ||
429 | GetLoader()->TreeD()->GetEntry(0); | |
430 | for(Int_t iCh=0;iCh<7;iCh++){ | |
431 | for(Int_t iDig=0;iDig<DigLst(iCh)->GetEntries();iDig++){ | |
432 | AliHMPIDDigit *pDig=(AliHMPIDDigit*)DigLst(iCh)->At(iDig); | |
433 | nDigCh[pDig->Ch()]++; | |
434 | } | |
435 | Printf("Occupancy for chamber %i = %4.2f %% and charged prim tracks %i and sec. tracks %i with total %i", | |
436 | iCh,Float_t(nDigCh[iCh])*100/AliHMPIDDigit::kPadAll,nPrim[iCh],nSec[iCh],iChHits[iCh]); | |
437 | } | |
438 | ||
439 | ||
440 | }//events loop | |
441 | GetLoader()->UnloadHits(); | |
442 | GetLoader()->UnloadDigits(); | |
443 | GetLoader()->GetRunLoader()->UnloadHeader(); | |
444 | GetLoader()->GetRunLoader()->UnloadKinematics(); | |
d1bf51e1 | 445 | }//OccupancyPrint() |
594d861b | 446 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
447 | void AliHMPID::SummaryOfEvent(Int_t iEvtN) const | |
448 | { | |
449 | //prints a summary for a given event | |
450 | AliInfo(Form("Summary of event %i",iEvtN)); | |
451 | GetLoader()->GetRunLoader()->GetEvent(iEvtN); | |
452 | if(GetLoader()->GetRunLoader()->LoadHeader()) return; | |
453 | if(GetLoader()->GetRunLoader()->LoadKinematics()) return; | |
454 | AliStack *pStack=GetLoader()->GetRunLoader()->Stack(); | |
455 | ||
456 | AliGenEventHeader* pGenHeader = gAlice->GetHeader()->GenEventHeader(); | |
457 | if(pGenHeader->InheritsFrom("AliGenHijingEventHeader")) { | |
458 | AliInfo(Form(" Hijing event with impact parameter b = %.2f (fm)",((AliGenHijingEventHeader*) pGenHeader)->ImpactParameter())); | |
459 | } | |
460 | Int_t nChargedPrimaries=0; | |
461 | for(Int_t i=0;i<pStack->GetNtrack();i++) { | |
462 | TParticle *pParticle = pStack->Particle(i); | |
463 | if(pParticle->IsPrimary()&&pParticle->GetPDG()->Charge()!=0) nChargedPrimaries++; | |
464 | } | |
465 | AliInfo(Form("Total number of primaries %i",pStack->GetNprimary())); | |
466 | AliInfo(Form("Total number of charged primaries %i",nChargedPrimaries)); | |
467 | AliInfo(Form("Total n. of tracks in stack(+sec) %i",pStack->GetNtrack())); | |
468 | GetLoader()->GetRunLoader()->UnloadHeader(); | |
469 | GetLoader()->GetRunLoader()->UnloadKinematics(); | |
d1bf51e1 | 470 | }//SummaryOfEvent() |
594d861b | 471 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
d1bf51e1 | 472 | void DrawZoom() |
473 | { | |
474 | // Show info about current cursur position in status bar of the canvas | |
475 | // Arguments: none | |
476 | // Returns: none | |
477 | TCanvas *pC=(TCanvas*)gPad; | |
478 | TRootCanvas *pRC= (TRootCanvas*)pC->GetCanvasImp(); | |
479 | TGStatusBar *pBar=pRC->GetStatusBar(); | |
480 | pBar->SetParts(5); | |
481 | Float_t x=gPad->AbsPixeltoX(gPad->GetEventX()); | |
482 | Float_t y=gPad->AbsPixeltoY(gPad->GetEventY()); | |
483 | AliHMPIDDigit dig;dig.Manual1(1,x,y); UInt_t w32=0; | |
484 | if(IsInDead(x,y)) | |
485 | pBar->SetText("Out of sensitive area",4); | |
486 | else{ | |
487 | Int_t ddl=dig.Raw(w32); | |
488 | pBar->SetText(Form("(p%i,x%i,y%i) ddl=%i 0x%x (r%i,d%i,a%i) (%.2f,%.2f)", | |
489 | dig.Pc(),dig.PadPcX(),dig.PadPcY(), | |
490 | ddl,w32, | |
491 | dig.Row(),dig.Dilogic(),dig.Addr(), | |
492 | dig.LorsX(),dig.LorsY() ),4); | |
493 | } | |
494 | if(gPad->GetEvent()==1){ | |
495 | new TCanvas("zoom",Form("Row %i DILOGIC %i",dig.Row(),dig.Dilogic())); | |
496 | } | |
497 | }//DrawZoom() | |
498 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
499 | void DrawPc(Bool_t isFill) | |
500 | { | |
501 | // Utility methode draws HMPID chamber PCs on event display. | |
502 | // Arguments: none | |
503 | // Returns: none | |
504 | // y6 ---------- ---------- | |
505 | // | | | | | |
506 | // | 4 | | 5 | | |
507 | // y5 ---------- ---------- | |
508 | // | |
509 | // y4 ---------- ---------- | |
510 | // | | | | | |
511 | // | 2 | | 3 | view from electronics side | |
512 | // y3 ---------- ---------- | |
513 | // | |
514 | // y2 ---------- ---------- | |
515 | // | | | | | |
516 | // | 0 | | 1 | | |
517 | // y1 ---------- ---------- | |
518 | // x1 x2 x3 x4 | |
519 | gPad->Range(-10,-10,AliHMPIDDigit::SizeAllX()+5,AliHMPIDDigit::SizeAllY()+5); | |
520 | Float_t x1=0, | |
521 | x2=AliHMPIDDigit::SizePcX(), | |
522 | x3=AliHMPIDDigit::SizePcX()+AliHMPIDDigit::SizeDead(), | |
523 | x4=AliHMPIDDigit::SizeAllX(); | |
524 | Float_t y1=0, | |
525 | y2= AliHMPIDDigit::SizePcY(), | |
526 | y3= AliHMPIDDigit::SizePcY()+AliHMPIDDigit::SizeDead(), | |
527 | y4=2*AliHMPIDDigit::SizePcY()+AliHMPIDDigit::SizeDead(), | |
528 | y5= AliHMPIDDigit::SizeAllY()-AliHMPIDDigit::SizePcY(), | |
529 | y6= AliHMPIDDigit::SizeAllY(); | |
530 | ||
531 | Float_t xL[5]={x1,x1,x2,x2,x1}; //clockwise | |
532 | Float_t xR[5]={x3,x3,x4,x4,x3}; | |
533 | Float_t yD[5]={y1,y2,y2,y1,y1}; | |
534 | Float_t yC[5]={y3,y4,y4,y3,y3}; | |
535 | Float_t yU[5]={y5,y6,y6,y5,y5}; | |
536 | ||
537 | Float_t dX2=0.5*AliHMPIDDigit::SizePadX(), | |
538 | dY2=0.5*AliHMPIDDigit::SizePadY() ; | |
539 | ||
540 | TLatex txt; txt.SetTextSize(0.01); | |
541 | Int_t iColLeft=29,iColRight=41; | |
542 | TPolyLine *pc=0; TLine *pL; | |
543 | AliHMPIDDigit dig; | |
544 | for(Int_t iPc=0;iPc<AliHMPIDDigit::kPcAll;iPc++){ | |
545 | if(iPc==4) pc=new TPolyLine(5,xL,yU); if(iPc==5) pc=new TPolyLine(5,xR,yU); //draw PCs | |
546 | if(iPc==2) pc=new TPolyLine(5,xL,yC); if(iPc==3) pc=new TPolyLine(5,xR,yC); | |
547 | if(iPc==0) pc=new TPolyLine(5,xL,yD); if(iPc==1) pc=new TPolyLine(5,xR,yD); | |
548 | (iPc%2)? pc->SetFillColor(iColLeft): pc->SetFillColor(iColRight); | |
549 | if(!isFill){ pc->Draw();continue;} | |
550 | ||
551 | pc->Draw("f"); | |
552 | if(iPc%2) {dig.Manual2(0,iPc,79,25); txt.DrawText(dig.LorsX()+2,dig.LorsY(),Form("PC%i",dig.Pc()));}//print PC# | |
553 | ||
554 | txt.SetTextAlign(32); | |
555 | for(Int_t iRow=0;iRow<8 ;iRow++){//draw row lines (horizontal) | |
556 | dig.Manual2(0,iPc,0,iRow*6); //set digit to the left-down pad of this row | |
557 | if(iPc%2) txt.DrawText(dig.LorsX()-1 ,dig.LorsY(),Form("%i",dig.PadPcY())); //print PadY# | |
558 | txt.DrawText(dig.LorsX()-1+(iPc%2)*67,dig.LorsY()+2,Form("r%i",dig.Row())); //print Row# | |
559 | pL=new TLine(dig.LorsX()-dX2,dig.LorsY()-dY2,dig.LorsX()+AliHMPIDDigit::SizePcX()-dX2,dig.LorsY()-dY2);//draw horizontal line | |
560 | if(iRow!=0) pL->Draw(); | |
561 | }//row loop | |
562 | ||
563 | txt.SetTextAlign(13); | |
564 | for(Int_t iDil=0;iDil<10;iDil++){//draw dilogic lines (vertical) | |
565 | dig.Manual2(0,iPc,iDil*8,0); //set this digit to the left-down pad of this dilogic | |
566 | txt.DrawText(dig.LorsX() ,dig.LorsY()-1,Form("%i",dig.PadPcX())); //print PadX# | |
567 | if(iPc==4 || iPc==5) txt.DrawText(dig.LorsX()+2,dig.LorsY()+42,Form("d%i",dig.Dilogic())); //print Dilogic# | |
568 | pL=new TLine(dig.LorsX()-dX2,dig.LorsY()-dY2,dig.LorsX()-dX2,dig.LorsY()+AliHMPIDDigit::SizePcY()-dY2); //draw vertical line | |
569 | if(iDil!=0)pL->Draw(); | |
570 | }//dilogic loop | |
571 | }//PC loop | |
572 | }//DrawPc() | |
573 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
59280a5a | 574 | void hed() |
575 | {//event display from files | |
576 | static TCanvas *pC=0; | |
577 | static Int_t iEvt=0; | |
578 | static Int_t iEvtTot=0; | |
579 | static TFile *pEsdFl=0; | |
580 | static TTree *pEsdTr=0; | |
581 | static AliESD *pEsd=0; | |
582 | ||
583 | if(!pC){ | |
584 | if(hl==0) {Printf("hed: no HMPID loader");return;} | |
585 | Printf("Opening session"); | |
586 | pEsdFl=TFile::Open("AliESDs.root"); if(!pEsdFl || !pEsdFl->IsOpen()) return;//open AliESDs.root | |
587 | pEsdTr=(TTree*) pEsdFl->Get("esdTree"); if(!pEsdTr) return;//get ESD tree | |
588 | pEsdTr->SetBranchAddress("ESD", &pEsd); | |
589 | hl->LoadDigits(); hl->LoadRecPoints(); | |
590 | iEvtTot=pEsdTr->GetEntries(); | |
591 | pC=new TCanvas("hed","View from electronics side, IP is behind the picture.",1000,900); pC->ToggleEventStatus(); pC->Divide(3,3); | |
592 | pC->cd(7); TButton *pBtn=new TButton("Next","hed()",0,0,0.2,0.1); pBtn->Draw(); | |
593 | } | |
594 | ||
595 | if(iEvt<iEvtTot){ | |
596 | pEsdTr->GetEntry(iEvt); al->GetEvent(iEvt); hl->TreeD()->GetEntry(0); hl->TreeR()->GetEntry(0); | |
597 | TLatex txt; pC->cd(3); txt.DrawLatex(0.2,0.2,Form("Event %i Total %i",iEvt,iEvtTot)); | |
598 | DrawEvt(pC,h->DigLst(),h->CluLst(),pEsd); | |
599 | iEvt++; | |
600 | }else{ | |
601 | Printf("Last event"); | |
602 | pC->Clear(); | |
1aac6f06 | 603 | delete pC;pC=0x0; |
59280a5a | 604 | } |
605 | } | |
606 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
607 | void sed() | |
d1bf51e1 | 608 | { |
59280a5a | 609 | |
1aac6f06 | 610 | static TCanvas *pC1=0; |
d1bf51e1 | 611 | |
1aac6f06 | 612 | if(!pC1){ |
613 | pC1=new TCanvas("hed","Simulated evets-View from electronics side, IP is behind the picture.",1000,900); pC1->Divide(3,3); | |
614 | pC1->cd(7); TButton *pBtn=new TButton("Next","sed()",0,0,0.2,0.1); pBtn->Draw(); | |
59280a5a | 615 | } |
616 | ||
617 | ||
618 | ||
619 | AliHMPIDRecon rec; | |
620 | ||
621 | TClonesArray lh("AliHMPIDHit"); | |
622 | TClonesArray ls("AliHMPIDDigit"); | |
623 | TObjArray ld(7); for(Int_t i=0;i<7;i++) ld.AddAt(new TClonesArray("AliHMPIDDigit"),i); | |
624 | TObjArray lc(7); for(Int_t i=0;i<7;i++) lc.AddAt(new TClonesArray("AliHMPIDCluster"),i); | |
625 | AliESD esd; | |
626 | ||
627 | ||
628 | EsdFromStack(&esd); | |
629 | HitsFromEsd(&esd,&lh); | |
630 | ||
631 | ||
632 | ||
633 | ||
634 | AliHMPIDv1::Hit2Sdi(&lh,&ls); | |
635 | AliHMPIDDigitizer::Sdi2Dig(&ls,&ld); | |
636 | AliHMPIDReconstructor::Dig2Clu(&ld,&lc); | |
637 | // AliHMPIDTracker::Recon(&esd,&cl); | |
638 | ||
1aac6f06 | 639 | DrawEvt(pC1,&ld,&lc,&esd); |
59280a5a | 640 | }//SimEvt() |
641 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
642 | void DrawEvt(TCanvas *pC,TObjArray *pDigLst,TObjArray *pCluLst,AliESD *pEsd) | |
643 | {//draws all the objects of current event | |
644 | ||
645 | AliHMPIDRecon rec; | |
646 | TPolyMarker *pTxC[7]; TPolyMarker *pRin[7]; //intesections and rings | |
647 | for(Int_t ch=0;ch<7;ch++){ | |
648 | pTxC[ch]=new TPolyMarker; pTxC[ch]->SetMarkerStyle(2); pTxC[ch]->SetMarkerColor(kRed); pTxC[ch]->SetMarkerSize(3); | |
649 | pRin[ch]=new TPolyMarker; pRin[ch]->SetMarkerStyle(6); pRin[ch]->SetMarkerColor(kMagenta); | |
650 | } | |
651 | ||
652 | ||
653 | for(Int_t iTrk=0;iTrk<pEsd->GetNumberOfTracks();iTrk++){//tracks loop to collect cerenkov rings and intersection points | |
654 | AliESDtrack *pTrk=pEsd->GetTrack(iTrk); | |
655 | Int_t ch=pTrk->GetHMPIDcluIdx(); | |
656 | if(ch<0) continue; //this track does not hit HMPID | |
657 | ch/=1000000; | |
658 | Float_t th,ph,xPc,yPc; pTrk->GetHMPIDtrk(xPc,yPc,th,ph); //get info on current track | |
659 | pTxC[ch]->SetNextPoint(xPc,yPc); //add new intersection point | |
d1bf51e1 | 660 | |
59280a5a | 661 | Float_t ckov=pTrk->GetHMPIDsignal(); Float_t err=TMath::Sqrt(pTrk->GetHMPIDchi2()); |
d1bf51e1 | 662 | |
59280a5a | 663 | if(ckov>0){ |
664 | rec.SetTrack(xPc,yPc,th,ph); | |
665 | TVector2 pos; for(int j=0;j<100;j++){rec.TracePhot(ckov,j*0.0628,pos); pRin[ch]->SetNextPoint(pos.X(),pos.Y());} | |
666 | } | |
667 | }//tracks loop | |
668 | ||
669 | for(Int_t iCh=0;iCh<7;iCh++){//chambers loop | |
670 | switch(iCh){ | |
671 | case 6: pC->cd(1); break; case 5: pC->cd(2); break; | |
672 | case 4: pC->cd(4); break; case 3: pC->cd(5); break; case 2: pC->cd(6); break; | |
673 | case 1: pC->cd(8); break; case 0: pC->cd(9); break; | |
674 | } | |
675 | gPad->SetEditable(kTRUE); gPad->Clear(); | |
676 | DrawPc(0); | |
677 | ((TClonesArray*)pDigLst->At(iCh))->Draw(); //draw digits | |
678 | ((TClonesArray*)pCluLst->At(iCh))->Draw(); //draw clusters | |
679 | pTxC[iCh]->Draw(); //draw intersections | |
680 | pRin[iCh]->Draw(); //draw rings | |
681 | gPad->SetEditable(kFALSE); | |
682 | }//chambers loop | |
683 | // TLatex txt; txt.SetTextSize(0.02); | |
684 | // txt.DrawLatex(20,-5,Form("#theta=%.4f#pm%.5f with %2i #check{C}" ,simCkov,simErr,simN)); | |
685 | // txt.DrawLatex(25,-5,Form("#theta=%.4f#pm%.5f with %2i #check{C}" ,recCkov,recErr,recN)); | |
686 | // txt.DrawLatex(0 ,127,Form("#theta=%.2f#circ #phi=%.2f#circ @(%.2f,%.2f) ",th*TMath::RadToDeg(),ph*TMath::RadToDeg(),radx,rady)); | |
687 | // Printf("DIG------DIG---------DIG--------DIG------DIG------DIG");pDigLst->Print();Printf(""); | |
688 | }//DrawEvt() | |
d1bf51e1 | 689 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
690 | void t1(Int_t case=1) | |
691 | { | |
692 | AliHMPIDDigit *d[10]; for(Int_t i=0;i<10;i++) d[i]=new AliHMPIDDigit; | |
693 | ||
694 | ||
695 | Int_t iNdig; | |
696 | ||
697 | if(case==1){ | |
698 | iNdig=9; | |
699 | ||
700 | d[0]->Manual2(1,2,67,26, 33); | |
701 | d[1]->Manual2(1,2,66,25,431); d[2]->Manual2(1,2,67,25, 21); | |
702 | d[3]->Manual2(1,2,65,24,127); d[4]->Manual2(1,2,66,24, 54); d[5]->Manual2(1,2,67,24, 5); | |
703 | d[6]->Manual2(1,2,65,23, 20); d[7]->Manual2(1,2,66,23, 5); d[8]->Manual2(1,2,67,23, 6); | |
704 | }else if(case==2){ | |
705 | iNdig=3; | |
706 | d[0]->Manual2(0,0,36,14, 8); | |
707 | d[1]->Manual2(0,0,36,13, 33); d[2]->Manual2(0,0,37,13, 22); | |
708 | } | |
709 | ||
710 | AliHMPIDCluster c; | |
711 | for(int i=0;i<iNdig;i++) c.DigAdd(d[i]); c.Print(); | |
712 | ||
713 | ||
714 | TClonesArray *cl=new TClonesArray("AliHMPIDCluster"); | |
715 | ||
716 | c.Solve(cl,kTRUE); | |
717 | Printf(""); | |
718 | ||
719 | cl->Print(); | |
720 | }//t1() | |
721 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
59280a5a | 722 | void EsdFromStack(AliESD *pEsd) |
723 | { | |
724 | al->LoadHeader();al->LoadKinematics(); | |
725 | AliStack *pStk=al->Stack(); | |
726 | ||
727 | for(Int_t iTrk=0;iTrk<pStk->GetNtrack();iTrk++){//stack loop | |
728 | TParticle *pPart=pStk->Particle(iTrk); | |
729 | if(pPart->GetPDG()->Charge()==0) continue; //neutral particles are not reconstructed | |
730 | if(pPart->GetFirstMother()>0) continue; //do not consider secondaries | |
731 | AliESDtrack trk(pPart); | |
732 | pEsd->AddTrack(&trk); | |
733 | }//stack loop | |
734 | }//EsdFromStack() | |
735 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
736 | void HitsFromEsd(AliESD *pEsd, TClonesArray *pHitLst) | |
737 | { | |
738 | AliHMPIDRecon rec; | |
739 | const Int_t kCerenkov=50000050,kFeedback=50000051; | |
740 | Int_t hc=0; TVector2 pos; | |
741 | for(Int_t iTrk=0;iTrk<pEsd->GetNumberOfTracks();iTrk++){//tracks loop | |
742 | AliESDtrack *pTrk=pEsd->GetTrack(iTrk); | |
743 | Float_t xRa,yRa; | |
744 | Int_t ch=AliHMPIDTracker::IntTrkCha(pTrk,xRa,yRa); | |
745 | if(ch<0) continue; //this track does not hit HMPID | |
746 | Float_t ckov=0.63; | |
d1bf51e1 | 747 | |
59280a5a | 748 | Float_t th,ph,xPc,yPc,; pTrk->GetHMPIDtrk(xPc,yPc,th,ph); |
749 | new((*pHitLst)[hc++]) AliHMPIDHit(ch,200e-9,kProton ,iTrk,xPc ,yPc); //mip hit | |
750 | for(int i=0;i<4;i++) new((*pHitLst)[hc++]) AliHMPIDHit(ch,7.5e-9,kFeedback,iTrk,gRandom->Rndm()*130,gRandom->Rndm()*126); //bkg hits 4 per track | |
751 | for(int i=0;i<16;i++){ | |
752 | rec.TracePhot(ckov,gRandom->Rndm()*TMath::TwoPi(),pos); | |
753 | new((*pHitLst)[hc++]) AliHMPIDHit(ch,7.5e-9,kCerenkov,iTrk,pos.X(),pos.Y());} //photon hits | |
754 | }//tracks loop | |
755 | } | |
756 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |