]>
Commit | Line | Data |
---|---|---|
c0d7adf8 | 1 | #if !defined(__CINT__) || defined(__MAKECINT__) |
2 | ||
e9f11028 | 3 | #include <TSystem.h> |
4 | #include <TFile.h> | |
5 | #include <TTree.h> | |
6 | #include <TButton.h> | |
7 | #include <TCanvas.h> | |
8 | #include <TClonesArray.h> | |
9 | #include <TParticle.h> | |
10 | #include <TRandom.h> | |
11 | #include <TLatex.h> | |
12 | #include <TLegend.h> | |
13 | #include <TPolyMarker.h> | |
14 | #include <TBox.h> | |
15 | #include <AliESD.h> | |
16 | #include <AliCDBManager.h> | |
17 | #include <AliCDBEntry.h> | |
18 | #include "AliHMPIDHit.h" | |
19 | #include "AliHMPIDv2.h" | |
20 | #include "AliHMPIDReconstructor.h" | |
21 | #include "AliHMPIDRecon.h" | |
22 | #include "AliHMPIDParam.h" | |
23 | #include "AliHMPIDCluster.h" | |
24 | #include <TChain.h> | |
126b3e0e | 25 | |
c0d7adf8 | 26 | #endif |
27 | ||
e9f11028 | 28 | TCanvas *fCanvas=0; Int_t fType=3; Int_t fEvt=0; Int_t fNevt=0; |
29 | TFile *fHitFile; TTree *fHitTree; TClonesArray *fHitLst; TPolyMarker *fRenMip[7]; TPolyMarker *fRenCko[7]; TPolyMarker *fRenFee[7]; | |
30 | TClonesArray *fSdiLst; | |
31 | TFile *fDigFile; TTree *fDigTree; TObjArray *fDigLst; TPolyMarker *fRenDig[7]; | |
32 | TFile *fCluFile; TTree *fCluTree; TObjArray *fCluLst; TPolyMarker *fRenClu[7]; | |
33 | TFile *fEsdFile; TTree *fEsdTree; AliESD *fEsd; TPolyMarker *fRenTxC[7]; TPolyMarker *fRenRin[7]; | |
34 | TFile *fCosFile; TTree *fCosTree; | |
8282f9d0 | 35 | |
e9f11028 | 36 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
37 | void CreateContainers() | |
38 | {//to create all containers | |
39 | fHitLst=new TClonesArray("AliHMPIDHit"); | |
40 | fSdiLst=new TClonesArray("AliHMPIDDigit"); | |
41 | fDigLst=new TObjArray(7); for(Int_t i=0;i<7;i++) fDigLst->AddAt(new TClonesArray("AliHMPIDDigit"),i); fDigLst->SetOwner(kTRUE); | |
42 | fCluLst=new TObjArray(7); for(Int_t i=0;i<7;i++) fCluLst->AddAt(new TClonesArray("AliHMPIDCluster"),i); fCluLst->SetOwner(kTRUE); | |
43 | fEsd =new AliESD; | |
126b3e0e | 44 | } |
126b3e0e | 45 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
e9f11028 | 46 | void CreateRenders() |
47 | { | |
48 | for(Int_t ch=0;ch<7;ch++){ | |
49 | fRenMip[ch]=new TPolyMarker; fRenMip[ch]->SetMarkerStyle(kOpenTriangleUp); fRenMip[ch]->SetMarkerColor(kRed); | |
50 | fRenCko[ch]=new TPolyMarker; fRenCko[ch]->SetMarkerStyle(kOpenCircle); fRenCko[ch]->SetMarkerColor(kRed); | |
51 | fRenFee[ch]=new TPolyMarker; fRenFee[ch]->SetMarkerStyle(kOpenDiamond); fRenFee[ch]->SetMarkerColor(kRed); | |
52 | fRenDig[ch]=new TPolyMarker; fRenDig[ch]->SetMarkerStyle(kOpenSquare); fRenDig[ch]->SetMarkerColor(kGreen); | |
53 | fRenClu[ch]=new TPolyMarker; fRenClu[ch]->SetMarkerStyle(kStar); fRenClu[ch]->SetMarkerColor(kBlue); | |
54 | fRenTxC[ch]=new TPolyMarker; fRenTxC[ch]->SetMarkerStyle(kPlus); fRenTxC[ch]->SetMarkerColor(kRed); fRenTxC[ch]->SetMarkerSize(3); | |
55 | fRenRin[ch]=new TPolyMarker; fRenRin[ch]->SetMarkerStyle(kFullDotSmall); fRenRin[ch]->SetMarkerColor(kMagenta); | |
56 | } | |
57 | }//CreateRenders() | |
58 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
59 | void ClearRenders() | |
60 | { | |
61 | for(Int_t ch=0;ch<7;ch++){ | |
62 | fRenTxC[ch]->SetPolyMarker(0); | |
63 | fRenRin[ch]->SetPolyMarker(0); | |
64 | fRenMip[ch]->SetPolyMarker(0); | |
65 | fRenCko[ch]->SetPolyMarker(0); | |
66 | fRenFee[ch]->SetPolyMarker(0); | |
67 | fRenDig[ch]->SetPolyMarker(0); | |
68 | fRenClu[ch]->SetPolyMarker(0); | |
69 | } | |
70 | }//ClearRenders() | |
71 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
72 | void PrintHits() | |
73 | { | |
74 | //Prints a list of HMPID hits for a given event. Default is event number 0. | |
75 | if(!fHitTree) return; | |
76 | Printf("List of HMPID hits for event %i",fEvt); | |
77 | Int_t iTot=0; | |
78 | for(Int_t iEnt=0;iEnt<fHitTree->GetEntries();iEnt++){//entries loop | |
79 | fHitTree->GetEntry(iEnt); | |
80 | fHitLst->Print(); | |
81 | iTot+=fHitLst->GetEntries(); | |
82 | } | |
83 | Printf("totally %i hits for event %i",iTot,fEvt); | |
84 | }//PrintHits(); | |
85 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
86 | void PrintSdis() | |
87 | {//prints a list of HMPID sdigits for a given event | |
88 | Printf("List of HMPID sdigits for event %i",fEvt); | |
89 | fSdiLst->Print(); | |
90 | Printf("totally %i sdigits for event %i",fSdiLst->GetEntries(),fEvt); | |
91 | }//PrintSdis() | |
92 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
93 | void PrintDigs() | |
94 | {//prints a list of HMPID digits | |
95 | Printf("List of HMPID digits for event %i",fEvt); | |
96 | fDigLst->Print(); | |
97 | Int_t iTot=0; for(Int_t i=0;i<7;i++) {iTot+=((TClonesArray*)fDigLst->At(i))->GetEntries();} | |
98 | Printf("totally %i digits for event %i",iTot,fEvt); | |
8282f9d0 | 99 | } |
100 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
e9f11028 | 101 | void PrintClus() |
102 | {//prints a list of HMPID clusters for a given event | |
103 | Printf("List of HMPID clusters for event %i",fEvt); | |
8282f9d0 | 104 | |
e9f11028 | 105 | fCluLst->Print(); |
106 | Int_t iTot=0; for(Int_t iCh=0;iCh<7;iCh++) iTot+=((TClonesArray*)fCluLst->At(iCh))->GetEntries(); | |
107 | ||
108 | Printf("totally %i clusters for event %i",iTot,fEvt); | |
8282f9d0 | 109 | } |
110 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
e9f11028 | 111 | void PrintEsd() |
112 | {//prints a list of HMPID Esd for a given event | |
113 | Printf("List of HMPID ESD summary for event %i",fEvt); | |
114 | for(Int_t iTrk=0;iTrk<fEsd->GetNumberOfTracks();iTrk++){ | |
115 | AliESDtrack *pTrk = fEsd->GetTrack(iTrk); | |
116 | Float_t x,y;Int_t q,nacc; pTrk->GetHMPIDmip(x,y,q,nacc); | |
117 | Printf("Track %02i with p %7.2f with ThetaCer %5.3f with %i photons",iTrk,pTrk->GetP(),pTrk->GetHMPIDsignal(),nacc); | |
118 | } | |
119 | }//PrintEsd() | |
120 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
121 | void DrawChamber(Int_t iCh) | |
122 | {//used by Draw() to Draw() chamber structure | |
ae5a42aa | 123 | gPad->Range(-10,-10,AliHMPIDParam::SizeAllX()+5,AliHMPIDParam::SizeAllY()+5); |
e9f11028 | 124 | if(iCh>=0){TLatex txt; txt.SetTextSize(0.1); txt.DrawLatex(-5,-5,Form("%i",iCh));} |
125 | ||
ae5a42aa | 126 | for(Int_t iPc=AliHMPIDParam::kMinPc;iPc<=AliHMPIDParam::kMaxPc;iPc++){ |
127 | TBox *pBox=new TBox(AliHMPIDParam::MinPcX(iPc),AliHMPIDParam::MinPcY(iPc), | |
128 | AliHMPIDParam::MaxPcX(iPc),AliHMPIDParam::MaxPcY(iPc)); | |
e9f11028 | 129 | pBox->SetFillStyle(0); pBox->Draw(); |
130 | }//PC loop | |
131 | }//DrawChamber() | |
132 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
133 | void DrawLegend() | |
134 | {//used by Draw() to draw legend | |
135 | Int_t nTxC=0,nMip=0,nCko=0,nFee=0,nDig=0,nClu=0; | |
136 | for(Int_t ch=0;ch<7;ch++){ | |
137 | nTxC+=fRenTxC[ch]->GetN(); | |
138 | nMip+=fRenMip[ch]->GetN(); | |
139 | nCko+=fRenCko[ch]->GetN(); | |
140 | nFee+=fRenFee[ch]->GetN(); | |
141 | nDig+=fRenDig[ch]->GetN(); | |
142 | nClu+=fRenClu[ch]->GetN(); | |
143 | } | |
144 | TLegend *pLeg=new TLegend(0.2,0.2,0.8,0.8); | |
145 | pLeg->SetHeader(Form("Event %i Total %i",fEvt,fNevt)); | |
146 | pLeg->AddEntry(fRenTxC[0],Form("TRKxPC %i" ,nTxC),"p"); | |
147 | pLeg->AddEntry(fRenMip[0],Form("Mip hits %i" ,nMip),"p"); | |
148 | pLeg->AddEntry(fRenCko[0],Form("Ckov hits %i" ,nCko),"p"); | |
149 | pLeg->AddEntry(fRenFee[0],Form("Feed hits %i" ,nFee),"p"); | |
150 | pLeg->AddEntry(fRenDig[0],Form("Digs %i" ,nDig),"p"); | |
151 | pLeg->AddEntry(fRenClu[0],Form("Clus %i" ,nClu),"p"); | |
152 | pLeg->Draw(); | |
153 | }//DrawLegend() | |
154 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
155 | void Draw() | |
156 | {//draws all the objects of current event in given canvas | |
157 | for(Int_t iCh=0;iCh<7;iCh++){//chambers loop | |
158 | switch(iCh){ | |
159 | case 6: fCanvas->cd(1); break; case 5: fCanvas->cd(2); break; | |
160 | case 4: fCanvas->cd(4); break; case 3: fCanvas->cd(5); break; case 2: fCanvas->cd(6); break; | |
161 | case 1: fCanvas->cd(8); break; case 0: fCanvas->cd(9); break; | |
162 | } | |
163 | gPad->SetEditable(kTRUE); gPad->Clear(); DrawChamber(iCh); | |
164 | fRenTxC[iCh]->Draw(); | |
165 | fRenMip[iCh]->Draw(); | |
166 | fRenFee[iCh]->Draw(); | |
167 | fRenCko[iCh]->Draw(); | |
168 | fRenRin[iCh]->Draw("CLP"); | |
169 | fRenDig[iCh]->Draw(); | |
170 | fRenClu[iCh]->Draw(); | |
171 | gPad->SetEditable(kFALSE); | |
172 | }//chambers loop | |
8282f9d0 | 173 | |
e9f11028 | 174 | fCanvas->cd(3); gPad->Clear(); DrawLegend(); |
175 | }//Draw() | |
176 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
177 | void RenderHit(TClonesArray *pHitLst) | |
178 | {//used by ReadEvent() and SimulateEvent() to render hits to polymarker structures, one per chamber | |
179 | for(Int_t iHit=0;iHit<pHitLst->GetEntries();iHit++){ //hits loop | |
180 | AliHMPIDHit *pHit = (AliHMPIDHit*)pHitLst->At(iHit); Int_t ch=pHit->Ch(); Float_t x=pHit->LorsX(); Float_t y=pHit->LorsY(); //get current hit | |
181 | switch(pHit->Pid()){ | |
182 | case 50000050: fRenCko[ch]->SetNextPoint(x,y);break; | |
183 | case 50000051: fRenFee[ch]->SetNextPoint(x,y);break; | |
184 | default: fRenMip[ch]->SetNextPoint(x,y);break; | |
185 | }//switch hit PID | |
186 | }//hits loop for this entry | |
187 | }//RenderHits() | |
188 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
189 | void RenderClu(TObjArray *pClus,TPolyMarker **pMark) | |
190 | {//used by ReadEvent() and SimulateEvent() to render clusters to polymarker structures, one per chamber | |
191 | for(Int_t iCh=0;iCh<=6;iCh++){ //chambers loop | |
192 | TClonesArray *pClusCham=(TClonesArray*)pClus->At(iCh); //get clusters list for this chamber | |
193 | for(Int_t iClu=0;iClu<pClusCham->GetEntries();iClu++){ //clusters loop | |
194 | AliHMPIDCluster *pClu = (AliHMPIDCluster*)pClusCham->At(iClu); //get current cluster | |
195 | pMark[iCh]->SetNextPoint(pClu->X(),pClu->Y()); | |
196 | }//switch hit PID | |
197 | }//hits loop for this entry | |
198 | }//RenderClus() | |
199 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
200 | void RenderEsd(AliESD *pEsd) | |
201 | {//used by ReadEvent() or SimulateEvent() to render ESD to polymarker structures for rings and intersections one per chamber | |
202 | AliHMPIDRecon rec; | |
203 | for(Int_t iTrk=0;iTrk<pEsd->GetNumberOfTracks();iTrk++){//tracks loop to collect cerenkov rings and intersection points | |
204 | AliESDtrack *pTrk=pEsd->GetTrack(iTrk); Int_t ch=pTrk->GetHMPIDcluIdx(); //get track and chamber intersected by it | |
205 | if(ch<0) continue; //this track does not intersect any chamber | |
206 | Float_t thRa,phRa,xRa,yRa; pTrk->GetHMPIDtrk(xRa,yRa,thRa,phRa); //get info on current track | |
207 | ch/=1000000; //actual chamber number | |
208 | Float_t xPc=0,yPc=0; AliHMPIDTracker::IntTrkCha(pTrk,xPc,yPc); //find again intersection of track with PC--> it is not stored in ESD! | |
209 | fRenTxC[ch]->SetNextPoint(xPc,yPc); //add this intersection point | |
210 | Float_t ckov=pTrk->GetHMPIDsignal(); //get ckov angle stored for this track | |
211 | if(ckov>0){ | |
212 | rec.SetTrack(xRa,yRa,thRa,phRa); | |
213 | for(Int_t j=0;j<100;j++){ | |
214 | TVector2 pos; pos=rec.TracePhot(ckov,j*0.0628); | |
ae5a42aa | 215 | if(!AliHMPIDParam::IsInDead(pos.X(),pos.Y())) fRenRin[ch]->SetNextPoint(pos.X(),pos.Y()); |
e9f11028 | 216 | } |
217 | }//if ckov is valid | |
218 | }//tracks loop | |
219 | }//RenEsd() | |
a1d55ff3 | 220 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
e9f11028 | 221 | void SimulateEsd(AliESD *pEsd) |
a1d55ff3 | 222 | { |
223 | TParticle part; TLorentzVector mom; | |
50e69536 | 224 | for(Int_t iTrk=0;iTrk<100;iTrk++){//stack loop |
a1d55ff3 | 225 | part.SetPdgCode(kProton); |
50e69536 | 226 | part.SetProductionVertex(0,0,0,0); |
227 | Double_t eta= -0.2+gRandom->Rndm()*0.4; //rapidity is random [-0.2,+0.2] | |
228 | Double_t phi= gRandom->Rndm()*60.*TMath::DegToRad(); //phi is random [ 0 , 60 ] degrees | |
229 | mom.SetPtEtaPhiM(5,eta,phi,part.GetMass()); | |
a1d55ff3 | 230 | part.SetMomentum(mom); |
231 | AliESDtrack trk(&part); | |
232 | pEsd->AddTrack(&trk); | |
233 | }//stack loop | |
234 | }//EsdFromStack() | |
235 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
e9f11028 | 236 | void SimulateHits(AliESD *pEsd, TClonesArray *pHits) |
237 | {//used by SimulateEvent to simulate hits out from provided ESD | |
50e69536 | 238 | const Int_t kCerenkov=50000050; |
239 | const Int_t kFeedback=50000051; | |
f3bae3e2 | 240 | |
a1d55ff3 | 241 | AliHMPIDRecon rec; |
e9f11028 | 242 | Float_t eMip=200e-9,ePho=7.5e-9; |
a591e55f | 243 | Int_t hc=0; |
a1d55ff3 | 244 | for(Int_t iTrk=0;iTrk<pEsd->GetNumberOfTracks();iTrk++){//tracks loop |
245 | AliESDtrack *pTrk=pEsd->GetTrack(iTrk); | |
e9f11028 | 246 | Float_t xRa,yRa; |
247 | Int_t ch=AliHMPIDTracker::IntTrkCha(pTrk,xRa,yRa); | |
a1d55ff3 | 248 | if(ch<0) continue; //this track does not hit HMPID |
50e69536 | 249 | Float_t beta = pTrk->GetP()/(TMath::Sqrt(pTrk->GetP()*pTrk->GetP()+0.938*0.938)); |
250 | Float_t ckov=TMath::ACos(1./(beta*1.292)); | |
a1d55ff3 | 251 | |
e9f11028 | 252 | Float_t theta,phi,xPc,yPc,; pTrk->GetHMPIDtrk(xPc,yPc,theta,phi); rec.SetTrack(xRa,yRa,theta,phi); |
a1d55ff3 | 253 | |
ae5a42aa | 254 | if(!AliHMPIDParam::IsInDead(xPc,yPc)) new((*pHits)[hc++]) AliHMPIDHit(ch,eMip,kProton ,iTrk,xPc,yPc); //mip hit |
50e69536 | 255 | Int_t nPhots = (Int_t)(20.*TMath::Power(TMath::Sin(ckov),2)/TMath::Power(TMath::Sin(TMath::ACos(1./1.292)),2)); |
256 | for(int i=0;i<nPhots;i++){ | |
a591e55f | 257 | TVector2 pos; |
258 | pos=rec.TracePhot(ckov,gRandom->Rndm()*TMath::TwoPi()); | |
ae5a42aa | 259 | if(!AliHMPIDParam::IsInDead(pos.X(),pos.Y())) new((*pHits)[hc++]) AliHMPIDHit(ch,ePho,kCerenkov,iTrk,pos.X(),pos.Y()); |
a1d55ff3 | 260 | } //photon hits |
e9f11028 | 261 | for(int i=0;i<3;i++){//feedback photons |
262 | Float_t x=gRandom->Rndm()*160; Float_t y=gRandom->Rndm()*150; | |
ae5a42aa | 263 | if(!AliHMPIDParam::IsInDead(x,y)) new((*pHits)[hc++]) AliHMPIDHit(ch,ePho,kFeedback,iTrk,x,y); //feedback hits |
e9f11028 | 264 | }//photon hits loop |
a1d55ff3 | 265 | }//tracks loop |
e9f11028 | 266 | }//SimulateHits() |
a1d55ff3 | 267 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
e9f11028 | 268 | void DoZoom(Int_t evt, Int_t px, Int_t py, TObject *) |
a1d55ff3 | 269 | { |
8282f9d0 | 270 | if(evt!=5 && evt!=6) return; //5- zoom in 6-zoom out |
271 | const Int_t minZoom=64; | |
272 | const Int_t maxZoom=2; | |
273 | static Int_t zoom=minZoom; //zoom level | |
274 | if(evt==5&&zoom==maxZoom) return; | |
275 | if(evt==6&&zoom==minZoom) return; | |
276 | ||
d73ece6a | 277 | // if(!obj->IsA()->InheritsFrom("TPad")) return; //current object is not pad |
50e69536 | 278 | TVirtualPad *pPad=gPad->GetSelectedPad(); |
8282f9d0 | 279 | if(pPad->GetNumber()==3 || pPad->GetNumber()==7) return; //current pad is wrong |
280 | ||
281 | // Printf("evt=%i (%i,%i) %s",evt,px,py,obj->GetName()); | |
282 | ||
283 | Float_t x=pPad->AbsPixeltoX(px); Float_t y=pPad->AbsPixeltoY(py); | |
6ed6a312 | 284 | |
285 | if(evt==5){ zoom=zoom/2; pPad->Range(x-zoom*2,y-zoom*2,x+zoom*2,y+zoom*2);} //zoom in | |
286 | else { zoom=zoom*2; pPad->Range(x-zoom*2,y-zoom*2,x+zoom*2,y+zoom*2);} //zoom out | |
ae5a42aa | 287 | if(zoom==minZoom) pPad->Range(-10,-10,AliHMPIDParam::SizeAllX()+5,AliHMPIDParam::SizeAllY()+5); |
8282f9d0 | 288 | ((TCanvas *)gTQSender)->SetTitle(Form("zoom x%i",minZoom/zoom)); |
289 | pPad->Modified(); | |
290 | pPad->Update(); | |
a1d55ff3 | 291 | } |
8282f9d0 | 292 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
e9f11028 | 293 | void ReadEvent() |
294 | {//used by NextEvent() to read curent event and construct all render elements | |
295 | if(fNevt && fEvt>=fNevt) fEvt=0; //loop over max event | |
d73ece6a | 296 | |
e9f11028 | 297 | if(fHitFile){ |
298 | if(fHitTree) delete fHitTree; fHitTree=(TTree*)fHitFile->Get(Form("Event%i/TreeH",fEvt)); | |
299 | ||
300 | fHitTree->SetBranchAddress("HMPID",&fHitLst); | |
301 | for(Int_t iEnt=0;iEnt<fHitTree->GetEntries();iEnt++){ | |
302 | fHitTree->GetEntry(iEnt); | |
303 | RenderHit(fHitLst); | |
304 | }//prim loop | |
305 | }//if hits file | |
306 | ||
307 | if(fCluFile){ | |
308 | if(fCluTree) delete fCluTree; fCluTree=(TTree*)fCluFile->Get(Form("Event%i/TreeR",fEvt)); | |
ae5a42aa | 309 | for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) fCluTree->SetBranchAddress(Form("HMPID%i",iCh),&(*fCluLst)[iCh]); |
e9f11028 | 310 | fCluTree->GetEntry(0); |
311 | RenderClu(fCluLst,fRenClu); | |
312 | }//if clus file | |
313 | ||
314 | if(fEsdFile){//if ESD file open | |
315 | fEsdTree->GetEntry(fEvt); | |
316 | RenderEsd(fEsd); | |
317 | }//if ESD file | |
318 | }//ReadEvent() | |
d73ece6a | 319 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
e9f11028 | 320 | void SimulateEvent() |
321 | {// used by NextEvent() to simulate all info | |
322 | AliCDBManager* pCDB = AliCDBManager::Instance(); pCDB->SetDefaultStorage("local://$HOME"); pCDB->SetRun(0); | |
323 | AliCDBEntry *pNmeanEnt=pCDB->Get("HMPID/Calib/Nmean"); | |
324 | ||
325 | SimulateEsd(fEsd); | |
326 | SimulateHits(fEsd,fHitLst); | |
327 | AliHMPIDv2::Hit2Sdi(fHitLst,fSdiLst); | |
328 | AliHMPIDDigitizer::Sdi2Dig(fSdiLst,fDigLst); | |
329 | AliHMPIDReconstructor::Dig2Clu(fDigLst,fCluLst); | |
330 | AliHMPIDTracker::Recon(fEsd,fCluLst,(TObjArray*)pNmeanEnt->GetObject()); | |
331 | ||
332 | RenderHit(fHitLst); | |
333 | RenderClu(fCluLst,fRenClu); | |
334 | RenderEsd(fEsd); | |
335 | }//SimulateEvent() | |
d73ece6a | 336 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
e9f11028 | 337 | void NextEvent() |
d73ece6a | 338 | { |
e9f11028 | 339 | fEvt++; |
340 | ClearRenders(); | |
341 | switch(fType){ | |
342 | case 1: ReadEvent();break; | |
343 | // case 2: ReadCosmic(); break; | |
344 | case 3: SimulateEvent(); break; | |
345 | default: return; | |
346 | } | |
347 | Draw(); | |
d73ece6a | 348 | } |
349 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
e9f11028 | 350 | void Hdisp() |
351 | {//display events from files if any in current directory or simulated events | |
b6eacec7 | 352 | AliHMPIDParam::Instance(); // first invocation of AliHMPIDParam to initialize geometry... |
e9f11028 | 353 | CreateContainers(); |
354 | CreateRenders(); | |
d73ece6a | 355 | |
e9f11028 | 356 | TString title="Session with"; |
357 | if(gSystem->IsFileInIncludePath("HMPID.Hits.root")){// tries to open hits | |
358 | fHitFile=TFile::Open("HMPID.Hits.root"); fNevt=fHitFile->GetNkeys(); fType=1; title+=Form(" HITS-%i ",fNevt); | |
359 | } | |
6b155609 | 360 | |
e9f11028 | 361 | if(gSystem->IsFileInIncludePath("HMPID.Digits.root")){// tries to open clusters |
362 | fDigFile=TFile::Open("HMPID.Digits.root"); fNevt=fDigFile->GetNkeys(); fType=1; title+=Form(" DIGITS-%i ",fNevt); | |
6b155609 | 363 | } |
364 | ||
e9f11028 | 365 | if(gSystem->IsFileInIncludePath("HMPID.RecPoints.root")){// tries to open clusters |
366 | fCluFile=TFile::Open("HMPID.RecPoints.root"); fNevt=fCluFile->GetNkeys(); fType=1; title+=Form(" CLUSTERS-%i ",fNevt); | |
367 | } | |
50e69536 | 368 | |
e9f11028 | 369 | if(gSystem->IsFileInIncludePath("AliESDs.root")){ |
370 | fEsdFile=TFile::Open("AliESDs.root"); fEsdTree=(TTree*)fEsdFile->Get("esdTree"); fNevt=fEsdTree->GetEntries(); fType=1; title+=Form(" ESD-%i ",fNevt); | |
371 | fEsdTree->SetBranchAddress("ESD", &fEsd); | |
372 | } | |
373 | ||
374 | if(gSystem->IsFileInIncludePath("cosmic.root")){ //clm: Check if cosmic file is in the folder | |
375 | fCosFile=TFile::Open("cosmic.root"); fCosTree=(TTree*)fCosFile->Get("cosmic"); fNevt=fCosTree->GetEntries(); fType=2; | |
376 | fCosTree->SetBranchAddress("Digs",&fDigLst); fCosTree->SetBranchAddress("Clus",&fCluLst); | |
377 | } | |
378 | ||
379 | fCanvas=new TCanvas("all","",600,400); fCanvas->Divide(3,3,0,0);// pAll->ToggleEditor(); | |
380 | fCanvas->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",0,0,"DoZoom(Int_t,Int_t,Int_t,TObject*)"); | |
381 | fCanvas->cd(7); | |
382 | switch(fType){ | |
383 | case 1: fCanvas->SetTitle(title.Data()); | |
384 | TButton *pNxtBtn=new TButton("Next" ,"NextEvent()",0.0,0.0,0.3,0.1); pNxtBtn->Draw(); | |
385 | if(fHitFile){TButton *pHitBtn=new TButton("Print hits","PrintHits()",0.0,0.2,0.3,0.3); pHitBtn->Draw();} | |
386 | if(fDigFile){TButton *pDigBtn=new TButton("Print digs","PrintDigs()",0.0,0.4,0.3,0.5); pDigBtn->Draw();} | |
387 | if(fCluFile){TButton *pCluBtn=new TButton("Print clus","PrintClus()",0.0,0.6,0.3,0.7); pCluBtn->Draw();} | |
388 | if(fEsdFile){TButton *pEsdBtn=new TButton("Print ESD" ,"PrintEsd()" ,0.0,0.8,0.3,0.9); pEsdBtn->Draw();} | |
389 | ||
390 | break; | |
391 | case 2: fCanvas->SetTitle("COSMIC"); | |
392 | TButton *pCosBtn=new TButton("Next" ,"NextEvent()",0.0,0.0,0.3,0.1); pCosBtn->Draw(); | |
393 | ||
394 | break; | |
395 | case 3: fCanvas->SetTitle("SIMULATION"); | |
396 | TButton *pSimBtn=new TButton("Simulate" ,"NextEvent()",0.0,0.0,0.3,0.1); pSimBtn->Draw(); | |
397 | TButton *pHitBtn=new TButton("Print hits","PrintHits()",0.0,0.2,0.3,0.3); pHitBtn->Draw(); | |
398 | TButton *pDigBtn=new TButton("Print digs","PrintDigs()",0.0,0.4,0.3,0.5); pDigBtn->Draw(); | |
399 | TButton *pCluBtn=new TButton("Print clus","PrintClus()",0.0,0.6,0.3,0.7); pCluBtn->Draw(); | |
400 | TButton *pEsdBtn=new TButton("Print ESD" ,"PrintEsd()" ,0.0,0.8,0.3,0.9); pEsdBtn->Draw(); | |
401 | break; | |
402 | } | |
403 | ||
404 | ||
0112d781 | 405 | NextEvent(); |
50e69536 | 406 | |
e9f11028 | 407 | |
408 | }//Hdisp() | |
409 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |