1 AliRun *a; AliRunLoader *al; TGeoManager *g; //globals for easy manual manipulations
2 AliHMPID *r; AliLoader *rl; AliHMPIDParam *rp;
3 Bool_t isGeomType=kFALSE;
5 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8 isGeomType=!isGeomType;
9 if(g) delete g; if(rp) delete rp; //delete current TGeoManager and AliHMPIDParam
10 if(isGeomType) g=TGeoManager::Import("geometry.root");
11 else g=TGeoManager::Import("misaligned_geometry.root");
12 rp=AliHMPIDParam::Instance();
14 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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
23 rl=al->GetDetectorLoader("HMPID"); r=(AliHMPID*)a->GetDetector("HMPID"); //get HMPID object from galice.root
25 status+=Form(" with %i event(s)",al->GetNumberOfEvents()); status+=(r)? " with HMPID": " without HMPID";
27 status+="No galice.root";
31 TControlBar *pMenu = new TControlBar("horizontal",status.Data(),0,0);
32 pMenu->AddButton(" ","","");
33 pMenu->AddButton(" General ","General()" ,"general items which do not depend on any files");
34 pMenu->AddButton(" ","" ,"");
35 pMenu->AddButton(" Sim data ","SimData()" ,"items which expect to have simulated files" );
36 pMenu->AddButton(" ","" ,"");
37 pMenu->AddButton(" Raw data ","RawData()" ,"items which expect to have raw files" );
38 pMenu->AddButton(" ","print()" ,"");
39 pMenu->AddButton(" Test ","Test()" ,"all test utilities");
40 pMenu->AddButton(" ","GetParam()" ,"");
41 pMenu->AddButton(" Quit ",".q" ,"close session" );
44 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
47 TControlBar *pMenu = new TControlBar("vertical","General purpose",100,50);
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" );
54 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
57 TControlBar *pMenu = new TControlBar("vertical","Sim data",340,50);
58 pMenu->AddButton("Display ALL chambers ","ed();" ,"Display Fast");
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)");
67 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
70 TControlBar *pMenu = new TControlBar("vertical","Raw data",580,50);
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" );
80 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
83 TControlBar *pMenu = new TControlBar("vertical","Test",820,50);
84 pMenu->AddButton("Hits->Digits" ,"thd();" ,"test hits->sdigits->digits" );
85 pMenu->AddButton("Segmentation" ,"ts()" ,"test segmentation methods" );
86 pMenu->AddButton("Test response" ,"AliHMPIDParam::TestResp();","Test AliHMPIDParam response methods" );
87 pMenu->AddButton("Print map" ,"PrintMap();" ,"Test AliHMPIDParam transformation methods" );
88 pMenu->AddButton("Test Recon" ,"rec();" ,"Test AliHMPIDRecon" );
91 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
94 void doff(){ Printf("DebugOFF"); AliLog::SetGlobalDebugLevel(0);}
95 void don() { Printf("DebugON"); AliLog::SetGlobalDebugLevel(AliLog::kDebug);}
97 void geo ( ) {gGeoManager->GetTopVolume()->Draw("ogl");}
99 void du ( ) {r->Dump ( );} //utility display
101 void hp (Int_t evt=0 ) {r->HitPrint (evt);} //print hits for requested event
102 void hq ( ) {r->HitQA ( );} //hits QA plots for all events
103 void sp (Int_t evt=0 ) {r->SdiPrint (evt);} //print sdigits for requested event
104 void sq (Int_t evt=0 ) {r->SdiPrint (evt);} //print sdigits for requested event
105 void dp (Int_t evt=0 ) {r->DigPrint (evt);} //print digits for requested event
106 void dq ( ) {AliHMPIDReconstructor::DigQA (al );} //digits QA plots for all events
107 void cp (Int_t evt=0 ) {r->CluPrint (evt); } //print clusters for requested event
108 void cq ( ) {AliHMPIDReconstructor::CluQA (al );} //clusters QA plots for all events
110 void ep ( ) {AliHMPIDTracker::EsdQA(1); }
111 void eq ( ) {AliHMPIDTracker::EsdQA(); }
112 void mp (Double_t probCut=0.7 ) {AliHMPIDTracker::MatrixPrint(probCut);}
115 void stack( ) {AliHMPIDParam::Stack();}
116 void tid (Int_t tid,Int_t evt=0) {AliHMPIDParam::Stack(evt,tid);}
117 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
120 TCanvas *pC=new TCanvas("pads","View from electronics side, IP is behind the picture.",1000,900); pC->ToggleEventStatus();
123 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
128 Float_t th=8*TMath::DegToRad();
129 Float_t ph=gRandom->Rndm()*TMath::TwoPi();
130 Float_t radx=gRandom->Rndm()*AliHMPIDDigit::SizeAllX();
131 Float_t rady=gRandom->Rndm()*AliHMPIDDigit::SizeAllY();
132 Float_t simCkov=0.63,simErr=0; Int_t simN=8,recN=0;
134 AliHMPIDRecon rec; rec.SetTrack(th,ph,radx,rady);
135 //sample list of hits
136 TClonesArray hl("AliHMPIDHit"); Int_t hc=0;
137 TVector2 pc;//tmp position
139 Int_t kCerenkov=50000050,kFeedback=50000051;
141 new(hl[hc++]) AliHMPIDHit(ch,200e-9,kProton ,tn++,radx ,rady ); //mip hit
142 for(int i=0;i<simN;i++){rec.TracePhot(simCkov,gRandom->Rndm()*TMath::TwoPi(),pc);new(hl[hc++]) AliHMPIDHit(ch,7.5e-9,kCerenkov,tn++,pc.X(),pc.Y());} //photon hits
143 for(int i=0;i<10;i++) { Float_t x=gRandom->Rndm()*130,y=gRandom->Rndm()*126; new(hl[hc++]) AliHMPIDHit(ch,7.5e-9,kFeedback,tn++, x , y );} //bkg hits
145 TClonesArray sl("AliHMPIDDigit"); AliHMPIDv1::Hit2Sdi(&hl,&sl);
146 TObjArray dl(7); for(Int_t i=0;i<7;i++) dl.AddAt(new TClonesArray("AliHMPIDDigit"),i); AliHMPIDDigitizer::Sdi2Dig(&sl,&dl);
147 TObjArray cl(7); for(Int_t i=0;i<7;i++) cl.AddAt(new TClonesArray("AliHMPIDCluster"),i); AliHMPIDReconstructor::Dig2Clu(&dl,&cl);
150 TClonesArray* pDigLst=(TClonesArray*)dl.At(ch);
151 TClonesArray* pCluLst=(TClonesArray*)cl.At(ch);
153 Int_t recN=0; Float_t recCkov=rec.CkovAngle(pCluLst,recN); //reconstruct the ring
155 AliESDtrack trk; trk.SetHMPIDtrk(radx,rady,th,ph); trk.SetHMPIDmip(radx,rady,340,recN); trk.SetHMPIDsignal(recCkov); trk.SetHMPIDchi2(rec.CkovSigma2());
157 Printf("Start of EVENT\n");
158 Printf("SDI------SDI---------SDI--------SDI------SDI------SDI");sl.Print();Printf("");
159 Printf("DIG------DIG---------DIG--------DIG------DIG------DIG");dl.Print();Printf("");
160 Printf("HIT------HIT---------HIT--------HIT------HIT------HIT");hl.Print();Printf("");
161 Printf("CLU------CLU---------CLU--------CLU------CLU------CLU");cl.Print();Printf("");
162 Printf("End of EVENT\n");
165 DrawEvt(&hl,pDigLst,pCluLst,&trk);
167 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
168 void DrawEvt(TClonesArray *pHitLst,TClonesArray *pDigLst,TClonesArray *pCluLst,AliESDtrack *pTrk)
171 TPolyLine *pRing =new TPolyLine; pRing->SetLineColor(kMagenta);
173 Float_t recCkov=pTrk->GetHMPIDsignal(); Float_t recErr=TMath::Sqrt(pTrk->GetHMPIDchi2());
175 Float_t trkTh,trkPh,trkX,trkY,mipX,mipY; pTrk->GetHMPIDtrk(trkX,trkY,trkTh,trkPh); Int_t mipQ,recN; pTrk->GetHMPIDmip(mipX,mipY,mipQ,recN);
176 AliHMPIDRecon rec; rec.SetTrack(trkTh,trkPh,trkX,trkY);
178 TVector2 pos; for(int j=0;j<100;j++){rec.TracePhot(recCkov,j*0.0628,pos); pRing->SetNextPoint(pos.X(),pos.Y());}
180 gPad->Clear(); TButton *pBtn=new TButton("Next","SimEvt()",0,0,0.07,0.05); pBtn->Draw(); DrawPc(0);
186 TLatex txt; txt.SetTextSize(0.02);
187 // txt.DrawLatex(20,-5,Form("#theta=%.4f#pm%.5f with %2i #check{C}" ,simCkov,simErr,simN));
188 txt.DrawLatex(25,-5,Form("#theta=%.4f#pm%.5f with %2i #check{C}" ,recCkov,recErr,recN));
189 // txt.DrawLatex(0 ,127,Form("#theta=%.2f#circ #phi=%.2f#circ @(%.2f,%.2f) ",th*TMath::RadToDeg(),ph*TMath::RadToDeg(),radx,rady));
191 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
195 Double_t r2d=TMath::RadToDeg();
197 Double_t x=AliHMPIDDigit::SizeAllX(),y=AliHMPIDDigit::SizeAllY();
201 for(int ch=6;ch>=0;ch--){
202 AliHMPIDDigit dL(ch,0,1,0,0),dR(ch,0,1,67,0);
203 TVector3 lt=rp->Lors2Mars(ch,0,y); TVector3 rt=rp->Lors2Mars(ch,x,y);
204 TVector3 ce=rp->Lors2Mars(ch,x/2,y/2);
205 TVector3 lb=rp->Lors2Mars(ch,0,0); TVector3 rb=rp->Lors2Mars(ch,x,0);
207 Printf(" ____________________________");
208 Printf("|%6.2fcm %6.2fcm|" ,lt.Mag() , rt.Mag() );
209 Printf("|%6.2fde %6.2fde|" ,lt.Theta()*r2d , rt.Theta()*r2d );
210 Printf("|%6.2fde %6.2fde|" ,lt.Phi()*r2d , rt.Phi()*r2d );
212 Printf("|DDL %2i %7.2fcm DDL %2i|" ,dL.DdlIdx() , ce.Mag() , dR.DdlIdx() );
213 Printf("| 0x%x %7.2fdeg 0x%x|" ,dL.DdlId() , ce.Theta()*r2d , dR.DdlId() );
214 Printf("| %7.2fdeg |" , ce.Phi()*r2d );
216 Printf("|%6.2fcm %6.2fcm|" ,lb.Mag() , rb.Mag() );
217 Printf("|%6.2fde %6.2fde|" ,lb.Theta()*r2d , rb.Theta()*r2d );
218 Printf("|%6.2fde Ch%i %6.2fde|" ,lb.Phi()*r2d , ch , rb.Phi()*r2d );
219 Printf(" ----------------------------");
223 for(int i=0;i<1000;i++){
224 Float_t xout=0,xin=gRandom->Rndm()*130.60;
225 Float_t yout=0,yin=gRandom->Rndm()*126.16;
226 Int_t c=gRandom->Rndm()*6;
227 rp->Lors2Mars(c,xin,yin,m);
228 rp->Mars2Lors(c,m,xout,yout);
229 if( (xin-xout) != 0) Printf("Problem in X");
230 if( (yin-yout) != 0) Printf("Problem in Y");
233 Int_t ddl,r,d,a,ch,raw,pc,px,py; AliHMPIDDigit dd;
235 ddl=0;raw=0x2214000;r= 8;d=8;a=20;
236 ddl=1;raw=0x2214000;r= 8;d=8;a=20;
239 ddl=2;raw=0x08d6000;r= 2;d=3;a=22;
240 ddl=3;raw=0x08d6000;r= 2;d=3;a=22;
243 ddl=6;raw=0x592e000;r=22;d=4;a=46;ch=3;pc=4;px=55;py=5;dd.Raw(ddl,raw);
244 Printf("(ch=%i,pc=%i,x=%2i,y=%2i) ddl=%i raw=0x%h (r=%2i,d=%2i,a=%2i)",
245 ch, pc, px, py, ddl, raw, r, d, a); dd.Print();
246 ddl=7;raw=0x592e000;r=22;d=4;a=46;ch=3;pc=1;
250 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
251 void HitQA(Double_t cut,Double_t cutele,Double_t cutR)
253 // Provides a set of control plots intended primarily for charged particle flux analisys
254 // Arguments: cut (GeV) - cut on momentum of any charged particles but electrons,
255 // cetele (GeV) - the same for electrons-positrons
256 // cutR (cm) - cut on production vertex radius (cylindrical system)
257 gBenchmark->Start("HitsAna");
259 Double_t cutPantiproton =cut;
260 Double_t cutPkaonminus =cut;
261 Double_t cutPpionminus =cut;
262 Double_t cutPmuonminus =cut;
263 Double_t cutPpositron =cutele;
265 Double_t cutPelectron =cutele;
266 Double_t cutPmuonplus =cut;
267 Double_t cutPpionplus =cut;
268 Double_t cutPkaonplus =cut;
269 Double_t cutPproton =cut;
272 TH2F *pEleHitRZ =new TH2F("EleHitRZ" ,Form("e^{+} e^{-} hit %s;z[cm];R[cm]" ,GetName()) , 400,-300,300 ,400,-500,500); //R-z
273 TH2F *pEleHitRP =new TH2F("EleHitRP" ,Form("e^{+} e^{-} hit %s;p[GeV];R[cm]",GetName()) ,1000,-1 ,1 ,400, 0,550); //R-p
274 TH1F *pEleAllP =new TH1F("EleAllP" , "e^{+} e^{-} all;p[GeV]" ,1000,-1 ,1 );
275 TH1F *pEleHitP =new TH1F("EleHitP" ,Form("e^{+} e^{-} hit %s;p[GeV]" ,GetName()) ,1000,-1 ,1 );
276 TH1F *pMuoHitP =new TH1F("MuoHitP" ,Form("#mu^{-} #mu^{+} hit %s;p[GeV]" ,GetName()) ,1000,-4 ,4 );
277 TH1F *pPioHitP =new TH1F("PioHitP" ,Form("#pi^{-} #pi^{+} hit %s;p[GeV]" ,GetName()) ,1000,-4 ,4 );
278 TH1F *pKaoHitP =new TH1F("KaoHitP" ,Form("K^{-} K^{+} hit %s;p[GeV]" ,GetName()) ,1000,-4 ,4 );
279 TH1F *pProHitP =new TH1F("ProHitP" ,Form("p^{-} p^{+} hit %s;p[GeV]" ,GetName()) ,1000,-4 ,4 );
280 TH2F *pFlux =new TH2F("flux" ,Form("%s flux with Rvertex<%.1fcm" ,GetName(),cutR),10 ,-5 ,5 , 10,0 ,10); //special text hist
281 TH2F *pVertex =new TH2F("vertex" ,Form("%s 2D vertex of HMPID hit;x;y" ,GetName()) ,120 ,0 ,600 ,120,0 ,600); //special text hist
282 TH1F *pRho =new TH1F("rho" ,Form("%s r of HMPID hit" ,GetName()) ,600 ,0 ,600); //special text hist
284 pFlux->GetXaxis()->SetBinLabel(1 ,Form("p^{-}>%.3fGeV/c" ,cutPantiproton));
285 pFlux->GetXaxis()->SetBinLabel(2 ,Form("K^{-}>%.3fGeV/c" ,cutPkaonminus ));
286 pFlux->GetXaxis()->SetBinLabel(3 ,Form("#pi^{-}>%.3fGeV/c" ,cutPpionminus ));
287 pFlux->GetXaxis()->SetBinLabel(4 ,Form("#mu^{-}>%.3fGeV/c" ,cutPmuonminus ));
288 pFlux->GetXaxis()->SetBinLabel(5 ,Form("e^{+}>%.3fGeV/c" ,cutPpositron ));
290 pFlux->GetXaxis()->SetBinLabel(6 ,Form("e^{-}>%.3fGeV/c" ,cutPelectron ));
291 pFlux->GetXaxis()->SetBinLabel(7 ,Form("#mu^{+}>%.3fGeV/c" ,cutPmuonplus ));
292 pFlux->GetXaxis()->SetBinLabel(8 ,Form("#pi^{+}>%.3fGeV/c" ,cutPpionplus ));
293 pFlux->GetXaxis()->SetBinLabel(9 ,Form("K^{+}>%.3fGeV/c" ,cutPkaonplus ));
294 pFlux->GetXaxis()->SetBinLabel(10,Form("p^{+}>%.3fGeV/c" ,cutPproton ));
296 pFlux->GetYaxis()->SetBinLabel(1,"sum");
297 pFlux->GetYaxis()->SetBinLabel(2,"ch1");
298 pFlux->GetYaxis()->SetBinLabel(3,"ch2");
299 pFlux->GetYaxis()->SetBinLabel(4,"ch3");
300 pFlux->GetYaxis()->SetBinLabel(5,"ch4");
301 pFlux->GetYaxis()->SetBinLabel(6,"ch5");
302 pFlux->GetYaxis()->SetBinLabel(7,"ch6");
303 pFlux->GetYaxis()->SetBinLabel(8,"ch7");
304 pFlux->GetYaxis()->SetBinLabel(9,"prim");
305 pFlux->GetYaxis()->SetBinLabel(10,"tot");
307 //end of hists definition
309 Int_t iNevents=fLoader->GetRunLoader()->GetAliRun()->GetEventsPerRun(),iCntPrimParts=0,iCntTotParts=0;
310 //load all needed trees
312 fLoader->GetRunLoader()->LoadHeader();
313 fLoader->GetRunLoader()->LoadKinematics();
315 for(Int_t iEvtN=0;iEvtN < iNevents;iEvtN++){//events loop
316 fLoader->GetRunLoader()->GetEvent(iEvtN);
317 AliInfo(Form(" %i event processes",fLoader->GetRunLoader()->GetEventNumber()));
318 AliStack *pStack= fLoader->GetRunLoader()->Stack();
320 for(Int_t iParticleN=0;iParticleN<pStack->GetNtrack();iParticleN++){//stack loop
321 TParticle *pPart=pStack->Particle(iParticleN);
323 if(iParticleN%10000==0) AliInfo(Form(" %i particles read",iParticleN));
325 switch(pPart->GetPdgCode()){
326 case kProtonBar: pFlux->Fill(-4.5,9); if(pPart->Rho()<0.01) pFlux->Fill(-4.5,8); break;
327 case kKMinus: pFlux->Fill(-3.5,9); if(pPart->Rho()<0.01) pFlux->Fill(-3.5,8); break;
328 case kPiMinus: pFlux->Fill(-2.5,9); if(pPart->Rho()<0.01) pFlux->Fill(-2.5,8); break;
329 case kMuonMinus: pFlux->Fill(-1.5,9); if(pPart->Rho()<0.01) pFlux->Fill(-1.5,8); break;
330 case kPositron: pFlux->Fill(-0.5,9); if(pPart->Rho()<0.01) pFlux->Fill(-0.5,8); pEleAllP->Fill(-pPart->P()); break;
332 case kElectron: pFlux->Fill( 0.5,9); if(pPart->Rho()<0.01) pFlux->Fill( 0.5,8); pEleAllP->Fill( pPart->P()); break;
333 case kMuonPlus: pFlux->Fill( 1.5,9); if(pPart->Rho()<0.01) pFlux->Fill( 1.5,8); break;
334 case kPiPlus: pFlux->Fill( 2.5,9); if(pPart->Rho()<0.01) pFlux->Fill( 2.5,8); break;
335 case kKPlus: pFlux->Fill( 3.5,9); if(pPart->Rho()<0.01) pFlux->Fill( 3.5,8); break;
336 case kProton: pFlux->Fill( 4.5,9); if(pPart->Rho()<0.01) pFlux->Fill( 4.5,8); break;
340 for(Int_t iEntryN=0;iEntryN < fLoader->TreeH()->GetEntries();iEntryN++){//TreeH loop
341 fLoader->TreeH()->GetEntry(iEntryN); //get current entry (prim)
342 for(Int_t iHitN=0;iHitN < Hits()->GetEntries();iHitN++){//hits loop
343 AliHMPIDHit *pHit = (AliHMPIDHit*)Hits()->At(iHitN); //get current hit
344 TParticle *pPart=pStack->Particle(pHit->GetTrack()); //get stack particle which produced the current hit
346 if(pPart->GetPDG()->Charge()!=0&&pPart->Rho()>0.1) pVertex->Fill(pPart->Vx(),pPart->Vy()); //safe margin for sec.
347 if(pPart->GetPDG()->Charge()!=0) pRho->Fill(pPart->Rho()); //safe margin for sec.
348 if(pPart->R()>cutR) continue; //cut on production radius (cylindrical system)
350 switch(pPart->GetPdgCode()){
351 case kProtonBar: if(pPart->P()>cutPantiproton) {pProHitP->Fill(-pPart->P()); pFlux->Fill(-4.5,pHit->Ch());}break;
352 case kKMinus : if(pPart->P()>cutPkaonminus) {pKaoHitP->Fill(-pPart->P()); pFlux->Fill(-3.5,pHit->Ch());}break;
353 case kPiMinus : if(pPart->P()>cutPpionminus) {pPioHitP->Fill(-pPart->P()); pFlux->Fill(-2.5,pHit->Ch());}break;
354 case kMuonMinus: if(pPart->P()>cutPmuonminus) {pMuoHitP->Fill(-pPart->P()); pFlux->Fill(-1.5,pHit->Ch());}break;
355 case kPositron : if(pPart->P()>cutPpositron) {pEleHitP->Fill(-pPart->P()); pFlux->Fill(-0.5,pHit->Ch());
356 pEleHitRP->Fill(-pPart->P(),pPart->R()); pEleHitRZ->Fill(pPart->Vz(),pPart->R()); }break;
358 case kElectron : if(pPart->P()>cutPelectron) {pEleHitP->Fill( pPart->P()); pFlux->Fill( 0.5,pHit->Ch());
359 pEleHitRP->Fill( pPart->P(),pPart->R()); pEleHitRZ->Fill(pPart->Vz(),pPart->R()); }break;
360 case kMuonPlus : if(pPart->P()>cutPmuonplus) {pMuoHitP->Fill( pPart->P()); pFlux->Fill( 1.5,pHit->Ch());}break;
361 case kPiPlus : if(pPart->P()>cutPpionplus) {pPioHitP->Fill( pPart->P()); pFlux->Fill( 2.5,pHit->Ch());}break;
362 case kKPlus : if(pPart->P()>cutPkaonplus) {pKaoHitP->Fill( pPart->P()); pFlux->Fill( 3.5,pHit->Ch());}break;
363 case kProton : if(pPart->P()>cutPproton) {pProHitP->Fill( pPart->P()); pFlux->Fill( 4.5,pHit->Ch());}break;
367 iCntPrimParts +=pStack->GetNprimary();
368 iCntTotParts +=pStack->GetNtrack();
370 //unload all loaded staff
371 fLoader->UnloadHits();
372 fLoader->GetRunLoader()->UnloadHeader();
373 fLoader->GetRunLoader()->UnloadKinematics();
374 //Calculater some sums
376 //sum row, sum over rows
377 for(Int_t i=1;i<=pFlux->GetNbinsX();i++){
378 sum=0; for(Int_t j=2;j<=8;j++) sum+=pFlux->GetBinContent(i,j);
379 pFlux->SetBinContent(i,1,sum);
383 new TCanvas("canvas1",Form("Events %i Nprims=%i Nparticles=%i",iNevents,iCntPrimParts,iCntTotParts),1000,900); pFlux->Draw("text"); gPad->SetGrid();
384 //total prims and particles
385 TLatex latex; latex.SetTextSize(0.02);
386 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));
387 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));
388 for(Int_t iCh=0;iCh<7;iCh++) {
389 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));
391 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));
393 new TCanvas("cEleAllP" ,"e" ,200,100); pEleAllP->Draw();
394 new TCanvas("cEleHitRP" ,"e" ,200,100); pEleHitRP->Draw();
395 new TCanvas("cEleHitRZ" ,"e" ,200,100); pEleHitRZ->Draw();
396 new TCanvas("cEleHitP" ,"e" ,200,100); pEleHitP->Draw();
397 new TCanvas("cMuoHitP" ,"mu",200,100); pMuoHitP->Draw();
398 new TCanvas("cPioHitP" ,"pi",200,100); pPioHitP->Draw();
399 new TCanvas("cKaoHitP" ,"K" ,200,100); pKaoHitP->Draw();
400 new TCanvas("cProHitP" ,"p" ,200,100); pProHitP->Draw();
401 new TCanvas("cVertex" ,"2d vertex" ,200,100); pVertex->Draw();
402 new TCanvas("cRho" ,"Rho of sec" ,200,100); pRho->Draw();
404 gBenchmark->Show("HitsPlots");
406 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
409 al->LoadHeader();al->LoadKinematics();
410 AliStack *pStk=al->Stack();
412 AliESD *pEsd=new AliESD;
413 for(Int_t iTrk=0;iTrk<pStk->GetNtrack();iTrk++){//stack loop
414 TParticle *pPart=pStk->Particle(iTrk);
415 if(pPart->GetPDG()->Charge()==0) continue; //neutral particles are not reconstructed
416 pEsd->AddTrack(new AliESDtrack(pPart));
420 AliTracker::SetFieldMap(new AliMagF,1);
423 t.LoadClusters(rl->TreeR());
424 t.PropagateBack(pEsd);
425 rl->UnloadRecPoints();
427 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
428 void CluQA(AliRunLoader *pAL)
430 // Quality assesment plots for clusters.
431 // This methode takes list of digits and form list of clusters again in order to
432 // calculate cluster shape and cluster particle mixture
433 AliLoader *pRL=pAL->GetDetectorLoader("HMPID"); AliHMPID *pRich=(AliHMPID*)pAL->GetAliRun()->GetDetector("HMPID");//get pointers for HMPID and HMPID loader
434 Int_t iNevt=pAL->GetNumberOfEvents(); if(iNevt==0) {AliInfoClass("No events");return;}
435 if(pRL->LoadDigits()) {AliInfoClass("No digits file");return;}
437 pAL->LoadKinematics();
438 // AliStack *pStack=pAL->Stack();
439 TH1::AddDirectory(kFALSE);
442 TH1F* pQ=new TH1F("HmpAllQ" ,"Charge All" ,4000 ,0 ,4000);// Q hists
443 TH1F* pCerQ=new TH1F("HmpCerQ" ,"Charge Ckov" ,4000 ,0 ,4000);
444 TH1F* pMipQ=new TH1F("HmpMipQ" ,"Charge MIP" ,4000 ,0 ,4000);
446 TH1F* pS=new TH1F("HmpCluSize" ,"Cluster size;size" ,100 ,0 ,100 );// size hists
447 TH1F* pCerS=new TH1F("HmpCluCerSize" ,"Ckov size;size" ,100 ,0 ,100 );
448 TH1F* pMipS=new TH1F("HmpCluMipSize" ,"MIP size;size" ,100 ,0 ,100 );
450 TH2F* pM=new TH2F("HmpCluMap" ,"Cluster map;x [cm];y [cm]" ,1000 ,0 ,AliHMPIDDigit::SizeAllX(),1000,0,AliHMPIDDigit::SizeAllY()); // maps
451 TH2F* pMipM=new TH2F("HmpCluMipMap" ,"MIP map;x [cm];y [cm]" ,1000 ,0 ,AliHMPIDDigit::SizeAllX(),1000,0,AliHMPIDDigit::SizeAllY());
452 TH2F* pCerM=new TH2F("HmpCluCerMap" ,"Ckov map;x [cm];y [cm]" ,1000 ,0 ,AliHMPIDDigit::SizeAllX(),1000,0,AliHMPIDDigit::SizeAllY());
456 for(Int_t iEvt=0;iEvt<iNevt;iEvt++){
458 pRL->TreeD()->GetEntry(0);
459 TClonesArray *pCluLst=new TClonesArray("AliHMPIDCluster");//tmp list of clusters for this event
461 for(Int_t iCh=0;iCh<7;iCh++) AliHMPIDReconstructor::Dig2Clu(pRich->DigLst(iCh),pCluLst,kFALSE);//cluster finder for all chamber if any digits present
463 for(Int_t iClu=0;iClu<pCluLst->GetEntriesFast();iClu++){
464 AliHMPIDCluster *pClu = (AliHMPIDCluster*)pCluLst->At(iClu);
465 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 ?????
466 Int_t iNckov=cfm/1000000; Int_t iNfee =cfm%1000000/1000; Int_t iNmip =cfm%1000000%1000;
468 pQ ->Fill(pClu->Q()) ; pS ->Fill(pClu->Size()) ; pM ->Fill(pClu->X(),pClu->Y()); //all clusters
469 if(iNckov!=0 && iNfee==0 && iNmip==0) {pCerQ->Fill(pClu->Q()) ; pCerS->Fill(pClu->Size()) ; pCerM ->Fill(pClu->X(),pClu->Y());}//ckov only cluster
470 if(iNckov==0 && iNfee==0 && iNmip!=0) {pMipQ->Fill(pClu->Q()) ; pMipS->Fill(pClu->Size()) ; pMipM ->Fill(pClu->X(),pClu->Y());}//mip only cluster
473 pCluLst->Clear();delete pCluLst;
476 pRL->UnloadDigits(); pAL->UnloadKinematics(); pAL->UnloadHeader();
477 TCanvas *pC=new TCanvas("RichCluQA",Form("QA for cluster from %i events",iNevt),1000,900); pC->Divide(3,3);
478 pC->cd(1); pM->Draw(); pC->cd(2); pQ->Draw(); pC->cd(3); pS->Draw();
479 pC->cd(4); pMipM->Draw(); pC->cd(5); pMipQ->Draw(); pC->cd(6); pMipS->Draw();
480 pC->cd(7); pCerM->Draw(); pC->cd(8); pCerQ->Draw(); pC->cd(9); pCerS->Draw();
482 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
483 void OccupancyPrint(Int_t iEvtNreq)
485 //prints occupancy for each chamber in a given event
486 Int_t iEvtNmin,iEvtNmax;
489 iEvtNmax=gAlice->GetEventsPerRun();
491 iEvtNmin=iEvtNreq;iEvtNmax=iEvtNreq+1;
494 if(GetLoader()->GetRunLoader()->LoadHeader()) return;
495 if(GetLoader()->GetRunLoader()->LoadKinematics()) return;
497 // Info("Occupancy","for event %i",iEvtN);
498 if(GetLoader()->LoadHits()) return;
499 if(GetLoader()->LoadDigits()) return;
502 for(Int_t iEvtN=iEvtNmin;iEvtN<iEvtNmax;iEvtN++){
503 Int_t nDigCh[7]={0,0,0,0,0,0,0};
504 Int_t iChHits[7]={0,0,0,0,0,0,0};
505 Int_t nPrim[7]={0,0,0,0,0,0,0};
506 Int_t nSec[7]={0,0,0,0,0,0,0};
507 AliInfo(Form("events processed %i",iEvtN));
508 if(GetLoader()->GetRunLoader()->GetEvent(iEvtN)) return;
509 AliStack *pStack = GetLoader()->GetRunLoader()->Stack();
510 for(Int_t iPrimN=0;iPrimN<GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop
511 GetLoader()->TreeH()->GetEntry(iPrimN);
512 for(Int_t iHitN=0;iHitN<Hits()->GetEntries();iHitN++){
513 AliHMPIDHit *pHit = (AliHMPIDHit*)Hits()->At(iHitN);
515 iChHits[pHit->Ch()]++;
516 if(pStack->Particle(pHit->GetTrack())->Rho()<0.01) nPrim[pHit->Ch()]++;else nSec[pHit->Ch()]++;
521 GetLoader()->TreeD()->GetEntry(0);
522 for(Int_t iCh=0;iCh<7;iCh++){
523 for(Int_t iDig=0;iDig<DigLst(iCh)->GetEntries();iDig++){
524 AliHMPIDDigit *pDig=(AliHMPIDDigit*)DigLst(iCh)->At(iDig);
525 nDigCh[pDig->Ch()]++;
527 Printf("Occupancy for chamber %i = %4.2f %% and charged prim tracks %i and sec. tracks %i with total %i",
528 iCh,Float_t(nDigCh[iCh])*100/AliHMPIDDigit::kPadAll,nPrim[iCh],nSec[iCh],iChHits[iCh]);
533 GetLoader()->UnloadHits();
534 GetLoader()->UnloadDigits();
535 GetLoader()->GetRunLoader()->UnloadHeader();
536 GetLoader()->GetRunLoader()->UnloadKinematics();
538 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
539 void AliHMPID::SummaryOfEvent(Int_t iEvtN) const
541 //prints a summary for a given event
542 AliInfo(Form("Summary of event %i",iEvtN));
543 GetLoader()->GetRunLoader()->GetEvent(iEvtN);
544 if(GetLoader()->GetRunLoader()->LoadHeader()) return;
545 if(GetLoader()->GetRunLoader()->LoadKinematics()) return;
546 AliStack *pStack=GetLoader()->GetRunLoader()->Stack();
548 AliGenEventHeader* pGenHeader = gAlice->GetHeader()->GenEventHeader();
549 if(pGenHeader->InheritsFrom("AliGenHijingEventHeader")) {
550 AliInfo(Form(" Hijing event with impact parameter b = %.2f (fm)",((AliGenHijingEventHeader*) pGenHeader)->ImpactParameter()));
552 Int_t nChargedPrimaries=0;
553 for(Int_t i=0;i<pStack->GetNtrack();i++) {
554 TParticle *pParticle = pStack->Particle(i);
555 if(pParticle->IsPrimary()&&pParticle->GetPDG()->Charge()!=0) nChargedPrimaries++;
557 AliInfo(Form("Total number of primaries %i",pStack->GetNprimary()));
558 AliInfo(Form("Total number of charged primaries %i",nChargedPrimaries));
559 AliInfo(Form("Total n. of tracks in stack(+sec) %i",pStack->GetNtrack()));
560 GetLoader()->GetRunLoader()->UnloadHeader();
561 GetLoader()->GetRunLoader()->UnloadKinematics();
563 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
566 // Show info about current cursur position in status bar of the canvas
569 TCanvas *pC=(TCanvas*)gPad;
570 TRootCanvas *pRC= (TRootCanvas*)pC->GetCanvasImp();
571 TGStatusBar *pBar=pRC->GetStatusBar();
573 Float_t x=gPad->AbsPixeltoX(gPad->GetEventX());
574 Float_t y=gPad->AbsPixeltoY(gPad->GetEventY());
575 AliHMPIDDigit dig;dig.Manual1(1,x,y); UInt_t w32=0;
577 pBar->SetText("Out of sensitive area",4);
579 Int_t ddl=dig.Raw(w32);
580 pBar->SetText(Form("(p%i,x%i,y%i) ddl=%i 0x%x (r%i,d%i,a%i) (%.2f,%.2f)",
581 dig.Pc(),dig.PadPcX(),dig.PadPcY(),
583 dig.Row(),dig.Dilogic(),dig.Addr(),
584 dig.LorsX(),dig.LorsY() ),4);
586 if(gPad->GetEvent()==1){
587 new TCanvas("zoom",Form("Row %i DILOGIC %i",dig.Row(),dig.Dilogic()));
590 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
591 void DrawPc(Bool_t isFill)
593 // Utility methode draws HMPID chamber PCs on event display.
596 // y6 ---------- ----------
599 // y5 ---------- ----------
601 // y4 ---------- ----------
603 // | 2 | | 3 | view from electronics side
604 // y3 ---------- ----------
606 // y2 ---------- ----------
609 // y1 ---------- ----------
611 gPad->Range(-10,-10,AliHMPIDDigit::SizeAllX()+5,AliHMPIDDigit::SizeAllY()+5);
613 x2=AliHMPIDDigit::SizePcX(),
614 x3=AliHMPIDDigit::SizePcX()+AliHMPIDDigit::SizeDead(),
615 x4=AliHMPIDDigit::SizeAllX();
617 y2= AliHMPIDDigit::SizePcY(),
618 y3= AliHMPIDDigit::SizePcY()+AliHMPIDDigit::SizeDead(),
619 y4=2*AliHMPIDDigit::SizePcY()+AliHMPIDDigit::SizeDead(),
620 y5= AliHMPIDDigit::SizeAllY()-AliHMPIDDigit::SizePcY(),
621 y6= AliHMPIDDigit::SizeAllY();
623 Float_t xL[5]={x1,x1,x2,x2,x1}; //clockwise
624 Float_t xR[5]={x3,x3,x4,x4,x3};
625 Float_t yD[5]={y1,y2,y2,y1,y1};
626 Float_t yC[5]={y3,y4,y4,y3,y3};
627 Float_t yU[5]={y5,y6,y6,y5,y5};
629 Float_t dX2=0.5*AliHMPIDDigit::SizePadX(),
630 dY2=0.5*AliHMPIDDigit::SizePadY() ;
632 TLatex txt; txt.SetTextSize(0.01);
633 Int_t iColLeft=29,iColRight=41;
634 TPolyLine *pc=0; TLine *pL;
636 for(Int_t iPc=0;iPc<AliHMPIDDigit::kPcAll;iPc++){
637 if(iPc==4) pc=new TPolyLine(5,xL,yU); if(iPc==5) pc=new TPolyLine(5,xR,yU); //draw PCs
638 if(iPc==2) pc=new TPolyLine(5,xL,yC); if(iPc==3) pc=new TPolyLine(5,xR,yC);
639 if(iPc==0) pc=new TPolyLine(5,xL,yD); if(iPc==1) pc=new TPolyLine(5,xR,yD);
640 (iPc%2)? pc->SetFillColor(iColLeft): pc->SetFillColor(iColRight);
641 if(!isFill){ pc->Draw();continue;}
644 if(iPc%2) {dig.Manual2(0,iPc,79,25); txt.DrawText(dig.LorsX()+2,dig.LorsY(),Form("PC%i",dig.Pc()));}//print PC#
646 txt.SetTextAlign(32);
647 for(Int_t iRow=0;iRow<8 ;iRow++){//draw row lines (horizontal)
648 dig.Manual2(0,iPc,0,iRow*6); //set digit to the left-down pad of this row
649 if(iPc%2) txt.DrawText(dig.LorsX()-1 ,dig.LorsY(),Form("%i",dig.PadPcY())); //print PadY#
650 txt.DrawText(dig.LorsX()-1+(iPc%2)*67,dig.LorsY()+2,Form("r%i",dig.Row())); //print Row#
651 pL=new TLine(dig.LorsX()-dX2,dig.LorsY()-dY2,dig.LorsX()+AliHMPIDDigit::SizePcX()-dX2,dig.LorsY()-dY2);//draw horizontal line
652 if(iRow!=0) pL->Draw();
655 txt.SetTextAlign(13);
656 for(Int_t iDil=0;iDil<10;iDil++){//draw dilogic lines (vertical)
657 dig.Manual2(0,iPc,iDil*8,0); //set this digit to the left-down pad of this dilogic
658 txt.DrawText(dig.LorsX() ,dig.LorsY()-1,Form("%i",dig.PadPcX())); //print PadX#
659 if(iPc==4 || iPc==5) txt.DrawText(dig.LorsX()+2,dig.LorsY()+42,Form("d%i",dig.Dilogic())); //print Dilogic#
660 pL=new TLine(dig.LorsX()-dX2,dig.LorsY()-dY2,dig.LorsX()-dX2,dig.LorsY()+AliHMPIDDigit::SizePcY()-dY2); //draw vertical line
661 if(iDil!=0)pL->Draw();
665 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
668 // Display digits, reconstructed tracks intersections and HMPID rings if available
671 TFile *pEsdFl=TFile::Open("AliESDs.root"); if(!pEsdFl || !pEsdFl->IsOpen()) return;//open AliESDs.root
672 TTree *pEsdTr=(TTree*) pEsdFl->Get("esdTree"); if(!pEsdTr) return;//get ESD tree
674 AliESD *pEsd=0; pEsdTr->SetBranchAddress("ESD", &pEsd);
676 for(Int_t iEvt=0;iEvt<pEsdTr->GetEntries();iEvt++) { //events loop
680 pEsdTr->GetEntry(iEvt); //get ESD for this event
681 for(Int_t iTrk=0;iTrk<pEsd->GetNumberOfTracks();iTrk++){//ESD tracks loop
682 AliESDtrack *pTrk = pEsd->GetTrack(iTrk); //
685 al->GetEvent(iEvt); rl->TreeD()->GetEntry(0); //get digits list
689 delete pEsd; pEsdFl->Close();//close AliESDs.root
690 // rl->UnloadDigits();
692 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
693 void t1(Int_t case=1)
695 AliHMPIDDigit *d[10]; for(Int_t i=0;i<10;i++) d[i]=new AliHMPIDDigit;
703 d[0]->Manual2(1,2,67,26, 33);
704 d[1]->Manual2(1,2,66,25,431); d[2]->Manual2(1,2,67,25, 21);
705 d[3]->Manual2(1,2,65,24,127); d[4]->Manual2(1,2,66,24, 54); d[5]->Manual2(1,2,67,24, 5);
706 d[6]->Manual2(1,2,65,23, 20); d[7]->Manual2(1,2,66,23, 5); d[8]->Manual2(1,2,67,23, 6);
709 d[0]->Manual2(0,0,36,14, 8);
710 d[1]->Manual2(0,0,36,13, 33); d[2]->Manual2(0,0,37,13, 22);
714 for(int i=0;i<iNdig;i++) c.DigAdd(d[i]); c.Print();
717 TClonesArray *cl=new TClonesArray("AliHMPIDCluster");
724 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++