]>
Commit | Line | Data |
---|---|---|
c0d7adf8 | 1 | #if !defined(__CINT__) || defined(__MAKECINT__) |
2 | ||
e9f11028 | 3 | #include <TSystem.h> |
4 | #include <TFile.h> | |
06a9f120 | 5 | #include <TVirtualX.h> |
e9f11028 | 6 | #include <TTree.h> |
7 | #include <TButton.h> | |
8 | #include <TCanvas.h> | |
66298970 | 9 | #include <TCanvasImp.h> |
06a9f120 | 10 | #include <TStyle.h> |
45b05be5 | 11 | #include <TString.h> |
e9f11028 | 12 | #include <TClonesArray.h> |
13 | #include <TParticle.h> | |
14 | #include <TRandom.h> | |
15 | #include <TLatex.h> | |
45b05be5 | 16 | #include <TPDGCode.h> |
e9f11028 | 17 | #include <TLegend.h> |
18 | #include <TPolyMarker.h> | |
19 | #include <TBox.h> | |
6e06db1d | 20 | #include <AliESDEvent.h> |
e9f11028 | 21 | #include <AliCDBManager.h> |
22 | #include <AliCDBEntry.h> | |
23 | #include "AliHMPIDHit.h" | |
24 | #include "AliHMPIDv2.h" | |
25 | #include "AliHMPIDReconstructor.h" | |
26 | #include "AliHMPIDRecon.h" | |
27 | #include "AliHMPIDParam.h" | |
28 | #include "AliHMPIDCluster.h" | |
e4290ede | 29 | #include "AliTracker.h" |
3e0a2e14 | 30 | #include "AliStack.h" |
e4290ede | 31 | |
c0d7adf8 | 32 | #endif |
33 | ||
66298970 | 34 | AliHMPIDParam *fParam; |
64d57cb0 | 35 | TDatabasePDG *fPdg; |
66298970 | 36 | |
d5fc04a5 | 37 | TCanvas *fCanvas=0; Int_t fType=1; Int_t fEvt=-1; Int_t fNevt=0; |
66298970 | 38 | TCanvasImp *fCanvasImp; |
e9f11028 | 39 | TFile *fHitFile; TTree *fHitTree; TClonesArray *fHitLst; TPolyMarker *fRenMip[7]; TPolyMarker *fRenCko[7]; TPolyMarker *fRenFee[7]; |
40 | TClonesArray *fSdiLst; | |
06a9f120 | 41 | TFile *fDigFile; TTree *fDigTree; TObjArray *fDigLst; TBox *fRenDig[7][160*144]; TBox *fBox[7][160*144]; |
64d57cb0 | 42 | TFile *fCluFile; TTree *fCluTree; TObjArray *fCluLst; TPolyMarker *fRenClu[7]; |
45b05be5 | 43 | TFile *fEsdFile; TTree *fEsdTree; AliESDEvent *fEsd; TPolyMarker *fRenTxC[7]; TPolyMarker *fRenRin[7]; |
e9f11028 | 44 | TFile *fCosFile; TTree *fCosTree; |
45b05be5 | 45 | |
46 | TButton *fHitMipBok,*fHitCkoBok,*fHitFeeBok,*fDigBok,*fCluBok,*fEsdBok; | |
47 | ||
48 | TString fStHitMip = "ON"; | |
49 | TString fStHitCko = "ON"; | |
50 | TString fStHitFee = "ON"; | |
51 | TString fStDig = "ON"; | |
52 | TString fStClu = "ON"; | |
53 | TString fStEsd = "ON"; | |
54 | ||
55 | Int_t fTimeArrow = 1; | |
56 | ||
06a9f120 | 57 | Int_t fMaxCharge = 200; //maximum charge to saturate color to red |
58 | ||
66298970 | 59 | Int_t fChamN[9]={6,5,-1,4,3,2,-1,1,0}; |
60 | ||
61 | Int_t fTotPads[7],fTotClus[7]; | |
62 | ||
d5fc04a5 | 63 | Int_t qSigmaCut=0; |
64 | ||
65 | Int_t trigType=0; | |
66 | ||
e4290ede | 67 | AliRunLoader *gAL=0; |
d5fc04a5 | 68 | AliLoader *gDL=0; // detector loader (needed to get Digits and Clusters) |
8282f9d0 | 69 | |
06a9f120 | 70 | Int_t nDigs[7]; |
64d57cb0 | 71 | |
b735cc6c | 72 | enum EObjectType {kHitMip=kOpenTriangleUp,kHitCko=kOpenCircle,kHitFee=kOpenDiamond,kCluster=kStar,kTrack=kPlus,kRing=kFullDotSmall}; |
73 | // kOpenTriangleUp Hit Mip | |
74 | // kOpenCircle Hit Ckov | |
75 | // kOpenDiamond Hit Feedback | |
76 | // kStar Cluster | |
77 | // kPlus Track | |
78 | // kFullDotSmall Ring | |
79 | ||
e9f11028 | 80 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
81 | void CreateContainers() | |
82 | {//to create all containers | |
83 | fHitLst=new TClonesArray("AliHMPIDHit"); | |
84 | fSdiLst=new TClonesArray("AliHMPIDDigit"); | |
85 | fDigLst=new TObjArray(7); for(Int_t i=0;i<7;i++) fDigLst->AddAt(new TClonesArray("AliHMPIDDigit"),i); fDigLst->SetOwner(kTRUE); | |
86 | fCluLst=new TObjArray(7); for(Int_t i=0;i<7;i++) fCluLst->AddAt(new TClonesArray("AliHMPIDCluster"),i); fCluLst->SetOwner(kTRUE); | |
6e06db1d | 87 | fEsd =new AliESDEvent; |
126b3e0e | 88 | } |
126b3e0e | 89 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
e9f11028 | 90 | void CreateRenders() |
91 | { | |
92 | for(Int_t ch=0;ch<7;ch++){ | |
b735cc6c | 93 | fRenMip[ch]=new TPolyMarker; fRenMip[ch]->SetMarkerStyle(kOpenTriangleUp);fRenMip[ch]->SetMarkerColor(kBlack) ; |
94 | fRenCko[ch]=new TPolyMarker; fRenCko[ch]->SetMarkerStyle(kOpenCircle); fRenCko[ch]->SetMarkerColor(kBlack) ; | |
95 | fRenFee[ch]=new TPolyMarker; fRenFee[ch]->SetMarkerStyle(kOpenDiamond); fRenFee[ch]->SetMarkerColor(kBlack) ; | |
96 | fRenClu[ch]=new TPolyMarker; fRenClu[ch]->SetMarkerStyle(kStar); fRenClu[ch]->SetMarkerColor(kMagenta); | |
97 | fRenTxC[ch]=new TPolyMarker; fRenTxC[ch]->SetMarkerStyle(kPlus); fRenTxC[ch]->SetMarkerColor(kRed) ; | |
64d57cb0 | 98 | fRenTxC[ch]->SetMarkerSize(3); |
b735cc6c | 99 | fRenRin[ch]=new TPolyMarker; fRenRin[ch]->SetMarkerStyle(kFullDotSmall); fRenRin[ch]->SetMarkerColor(kMagenta); |
64d57cb0 | 100 | |
06a9f120 | 101 | for(Int_t iDig=0;iDig<160*144;iDig++) { |
102 | fRenDig[ch][iDig] = new TBox; | |
103 | fRenDig[ch][iDig]->SetFillStyle(1); | |
104 | fBox[ch][iDig] = new TBox; | |
105 | fBox[ch][iDig]->SetFillStyle(0); | |
106 | } | |
e9f11028 | 107 | } |
108 | }//CreateRenders() | |
109 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
110 | void ClearRenders() | |
111 | { | |
112 | for(Int_t ch=0;ch<7;ch++){ | |
113 | fRenTxC[ch]->SetPolyMarker(0); | |
114 | fRenRin[ch]->SetPolyMarker(0); | |
115 | fRenMip[ch]->SetPolyMarker(0); | |
116 | fRenCko[ch]->SetPolyMarker(0); | |
117 | fRenFee[ch]->SetPolyMarker(0); | |
06a9f120 | 118 | nDigs[ch] = 0; |
e9f11028 | 119 | fRenClu[ch]->SetPolyMarker(0); |
120 | } | |
121 | }//ClearRenders() | |
122 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
123 | void PrintHits() | |
124 | { | |
125 | //Prints a list of HMPID hits for a given event. Default is event number 0. | |
126 | if(!fHitTree) return; | |
127 | Printf("List of HMPID hits for event %i",fEvt); | |
128 | Int_t iTot=0; | |
129 | for(Int_t iEnt=0;iEnt<fHitTree->GetEntries();iEnt++){//entries loop | |
130 | fHitTree->GetEntry(iEnt); | |
131 | fHitLst->Print(); | |
132 | iTot+=fHitLst->GetEntries(); | |
133 | } | |
134 | Printf("totally %i hits for event %i",iTot,fEvt); | |
135 | }//PrintHits(); | |
136 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
137 | void PrintSdis() | |
138 | {//prints a list of HMPID sdigits for a given event | |
139 | Printf("List of HMPID sdigits for event %i",fEvt); | |
140 | fSdiLst->Print(); | |
141 | Printf("totally %i sdigits for event %i",fSdiLst->GetEntries(),fEvt); | |
142 | }//PrintSdis() | |
143 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
144 | void PrintDigs() | |
145 | {//prints a list of HMPID digits | |
146 | Printf("List of HMPID digits for event %i",fEvt); | |
147 | fDigLst->Print(); | |
148 | Int_t iTot=0; for(Int_t i=0;i<7;i++) {iTot+=((TClonesArray*)fDigLst->At(i))->GetEntries();} | |
149 | Printf("totally %i digits for event %i",iTot,fEvt); | |
8282f9d0 | 150 | } |
151 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
e9f11028 | 152 | void PrintClus() |
153 | {//prints a list of HMPID clusters for a given event | |
154 | Printf("List of HMPID clusters for event %i",fEvt); | |
8282f9d0 | 155 | |
e9f11028 | 156 | fCluLst->Print(); |
157 | Int_t iTot=0; for(Int_t iCh=0;iCh<7;iCh++) iTot+=((TClonesArray*)fCluLst->At(iCh))->GetEntries(); | |
158 | ||
159 | Printf("totally %i clusters for event %i",iTot,fEvt); | |
8282f9d0 | 160 | } |
161 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
e9f11028 | 162 | void PrintEsd() |
163 | {//prints a list of HMPID Esd for a given event | |
164 | Printf("List of HMPID ESD summary for event %i",fEvt); | |
165 | for(Int_t iTrk=0;iTrk<fEsd->GetNumberOfTracks();iTrk++){ | |
166 | AliESDtrack *pTrk = fEsd->GetTrack(iTrk); | |
e31c5618 | 167 | |
168 | Double_t xout[3],pout[3]; | |
169 | ||
170 | pTrk->GetOuterPxPyPz(pout); | |
171 | Double_t pMomOut = TMath::Sqrt(pout[0]*pout[0]+pout[1]*pout[1]+pout[2]*pout[2]); | |
172 | ||
e9f11028 | 173 | Float_t x,y;Int_t q,nacc; pTrk->GetHMPIDmip(x,y,q,nacc); |
e31c5618 | 174 | Int_t ch,idx,size; |
175 | Int_t word = pTrk->GetHMPIDcluIdx(); | |
176 | ch = word/1000000; | |
177 | word = word%1000000; | |
178 | size = word/1000; | |
179 | idx = word%1000; | |
180 | Printf("Track %02i Ch. %2i with pOuter %7.2f with ThetaCer %7.3f with %3i photons with MIP Q %4i size %2i (idx %3i)",iTrk,ch,pMomOut, | |
181 | pTrk->GetHMPIDsignal(),nacc,q,size,idx); | |
e9f11028 | 182 | } |
183 | }//PrintEsd() | |
184 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
185 | void DrawChamber(Int_t iCh) | |
186 | {//used by Draw() to Draw() chamber structure | |
45b05be5 | 187 | gPad->Range(-10,-10,AliHMPIDParam::SizeAllX()+5,AliHMPIDParam::SizeAllY()+5); |
040e03e9 | 188 | if(iCh>=0){TLatex txt; txt.SetTextSize(0.06); txt.DrawLatex(55,-9,Form("RICH %i",iCh));} |
e9f11028 | 189 | |
ae5a42aa | 190 | for(Int_t iPc=AliHMPIDParam::kMinPc;iPc<=AliHMPIDParam::kMaxPc;iPc++){ |
191 | TBox *pBox=new TBox(AliHMPIDParam::MinPcX(iPc),AliHMPIDParam::MinPcY(iPc), | |
192 | AliHMPIDParam::MaxPcX(iPc),AliHMPIDParam::MaxPcY(iPc)); | |
e9f11028 | 193 | pBox->SetFillStyle(0); pBox->Draw(); |
194 | }//PC loop | |
195 | }//DrawChamber() | |
196 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
197 | void DrawLegend() | |
198 | {//used by Draw() to draw legend | |
199 | Int_t nTxC=0,nMip=0,nCko=0,nFee=0,nDig=0,nClu=0; | |
200 | for(Int_t ch=0;ch<7;ch++){ | |
64d57cb0 | 201 | nTxC+=fRenTxC[ch]->Size(); |
202 | nMip+=fRenMip[ch]->Size(); | |
203 | nCko+=fRenCko[ch]->Size(); | |
204 | nFee+=fRenFee[ch]->Size(); | |
205 | nClu+=fRenClu[ch]->Size(); | |
06a9f120 | 206 | nDig+=nDigs[ch]; |
e9f11028 | 207 | } |
040e03e9 | 208 | TLegend *pLeg=new TLegend(0.15,0.3,0.85,0.98); |
e9f11028 | 209 | pLeg->SetHeader(Form("Event %i Total %i",fEvt,fNevt)); |
040e03e9 | 210 | pLeg->AddEntry(fRenTxC[0], Form("TRKxPC %i" ,nTxC),"p"); |
211 | pLeg->AddEntry(fRenMip[0], Form("Mip hits %i" ,nMip),"p"); | |
06a9f120 | 212 | pLeg->AddEntry(fRenCko[0], Form("Ckov hits %i" ,nCko),"p"); |
213 | pLeg->AddEntry(fRenFee[0], Form("Feed hits %i" ,nFee),"p"); | |
040e03e9 | 214 | pLeg->AddEntry(fRenDig[0][0],Form("Digs %i" ,nDig),"p"); |
215 | pLeg->AddEntry(fRenClu[0], Form("Clus %i" ,nClu),"p"); | |
e9f11028 | 216 | pLeg->Draw(); |
040e03e9 | 217 | |
218 | /* TLegend *pLeg2 = new TLegend(0.4,0.087,0.8,0.97); | |
219 | pLeg2->SetHeader(""); | |
220 | pLeg2->AddEntry(fRenMip[0],Form("Mip hits %i" ,nMip),"p"); | |
221 | pLeg2->Draw();*/ | |
222 | ||
d5fc04a5 | 223 | TBox *pBox = new TBox(0.012,0.01,0.97,0.28); |
040e03e9 | 224 | pBox->Draw("l"); |
225 | ||
226 | TText *pText = new TText(0.35,0.21, "ddl = (0....13)"); | |
d5fc04a5 | 227 | pText->SetTextSize(0.06); |
040e03e9 | 228 | pText->Draw(); |
229 | ||
d5fc04a5 | 230 | TText *pText2 = new TText(0.09,0.15,"RICH n ---> ddl 2n (left) & 2n+1 (right)"); |
231 | pText2->SetTextSize(0.06); | |
040e03e9 | 232 | pText2->Draw(); |
233 | ||
d5fc04a5 | 234 | TText *pText3 = new TText(0.1,0.09, "phcat (0,2,4) left, phcat (1,3,5) right"); |
235 | pText3->SetTextSize(0.06); | |
040e03e9 | 236 | pText3->Draw(); |
237 | ||
d5fc04a5 | 238 | TText *pText4 = new TText(0.35,0.03, Form("sigma cut = %i",qSigmaCut)); |
239 | pText4->SetTextSize(0.06); | |
240 | pText4->Draw(); | |
241 | ||
e9f11028 | 242 | }//DrawLegend() |
243 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
244 | void Draw() | |
245 | {//draws all the objects of current event in given canvas | |
45b05be5 | 246 | Int_t iPadN[7]={9,8,6,5,4,2,1}; |
06a9f120 | 247 | Int_t sampleCol = fMaxCharge/gStyle->GetNumberOfColors(); |
e9f11028 | 248 | for(Int_t iCh=0;iCh<7;iCh++){//chambers loop |
45b05be5 | 249 | fCanvas->cd(iPadN[iCh]); |
e9f11028 | 250 | gPad->SetEditable(kTRUE); gPad->Clear(); DrawChamber(iCh); |
06a9f120 | 251 | |
64d57cb0 | 252 | if(fDigFile){ |
253 | if(fStDig =="ON") { | |
254 | for(Int_t iDig=0;iDig<nDigs[iCh];iDig++) { | |
255 | Int_t charge = fRenDig[iCh][iDig]->GetUniqueID(); | |
256 | Int_t color = charge/sampleCol;if(color>=gStyle->GetNumberOfColors()) color = gStyle->GetNumberOfColors()-1; | |
257 | fRenDig[iCh][iDig]->SetFillColor(gStyle->GetColorPalette(color)); | |
258 | fRenDig[iCh][iDig]->Draw(); | |
259 | fBox[iCh][iDig]->Draw(); | |
260 | } | |
06a9f120 | 261 | } |
262 | } | |
64d57cb0 | 263 | |
264 | if(fEsdFile){if(fStEsd =="ON") fRenTxC[iCh]->Draw();} | |
265 | ||
266 | if(fHitFile){ | |
267 | if(fStHitMip=="ON") fRenMip[iCh]->Draw(); | |
268 | if(fStHitFee=="ON") fRenFee[iCh]->Draw(); | |
269 | if(fStHitCko=="ON") fRenCko[iCh]->Draw(); | |
270 | } | |
271 | ||
272 | if(fEsdFile){if(fStEsd =="ON") fRenRin[iCh]->Draw();} | |
273 | if(fCluFile){if(fStClu =="ON") fRenClu[iCh]->Draw();} | |
e9f11028 | 274 | gPad->SetEditable(kFALSE); |
275 | }//chambers loop | |
64d57cb0 | 276 | |
e9f11028 | 277 | fCanvas->cd(3); gPad->Clear(); DrawLegend(); |
45b05be5 | 278 | |
279 | fCanvas->cd(7); | |
280 | ||
64d57cb0 | 281 | if(fHitFile){ |
282 | fHitMipBok->SetTitle(Form("Mips %s",fStHitMip.Data())); fHitMipBok->Modified(); | |
283 | fHitCkoBok->SetTitle(Form("Ckov %s",fStHitCko.Data())); fHitCkoBok->Modified(); | |
284 | fHitFeeBok->SetTitle(Form("Fdbk %s",fStHitFee.Data())); fHitFeeBok->Modified(); | |
285 | } | |
45b05be5 | 286 | if(fDigFile){fDigBok->SetTitle(fStDig); fDigBok->Modified();} |
287 | if(fCluFile){fCluBok->SetTitle(fStClu); fCluBok->Modified();} | |
288 | if(fEsdFile){fEsdBok->SetTitle(fStEsd); fEsdBok->Modified();} | |
289 | ||
e9f11028 | 290 | }//Draw() |
291 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
292 | void RenderHit(TClonesArray *pHitLst) | |
d5fc04a5 | 293 | {//used by ReadEvent() to render hits to polymarker structures, one per chamber |
e9f11028 | 294 | for(Int_t iHit=0;iHit<pHitLst->GetEntries();iHit++){ //hits loop |
295 | AliHMPIDHit *pHit = (AliHMPIDHit*)pHitLst->At(iHit); Int_t ch=pHit->Ch(); Float_t x=pHit->LorsX(); Float_t y=pHit->LorsY(); //get current hit | |
296 | switch(pHit->Pid()){ | |
297 | case 50000050: fRenCko[ch]->SetNextPoint(x,y);break; | |
298 | case 50000051: fRenFee[ch]->SetNextPoint(x,y);break; | |
299 | default: fRenMip[ch]->SetNextPoint(x,y);break; | |
300 | }//switch hit PID | |
64d57cb0 | 301 | // Printf("----------ihit %i ch %i chhit %i MIP %i CKO %i FEE %i",iHit,ch,pHit->Pid()); |
e9f11028 | 302 | }//hits loop for this entry |
303 | }//RenderHits() | |
304 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
e4290ede | 305 | void RenderDig(TObjArray *pDigLst) |
d5fc04a5 | 306 | {//used by ReadEvent() to render digs to Tbox structures, one per chamber |
307 | ||
e4290ede | 308 | for(Int_t iCh=0;iCh<=6;iCh++){ //chambers loop |
309 | TClonesArray *pDigCham=(TClonesArray*)pDigLst->At(iCh); //get digs list for this chamber | |
06a9f120 | 310 | nDigs[iCh] = 0; |
66298970 | 311 | fTotPads[iCh] = pDigCham->GetEntries(); |
d5fc04a5 | 312 | Int_t iDigEff=0; |
e4290ede | 313 | for(Int_t iDig=0;iDig<pDigCham->GetEntries();iDig++){ //digs loop |
314 | AliHMPIDDigit *pDig = (AliHMPIDDigit*)pDigCham->At(iDig); Float_t x=pDig->LorsX(); Float_t y=pDig->LorsY(); //get current hit | |
d5fc04a5 | 315 | if((Int_t)pDig->Q()<=qSigmaCut) continue; |
316 | fRenDig[iCh][iDigEff]->SetX1(x-0.5*AliHMPIDParam::SizePadX()); | |
317 | fRenDig[iCh][iDigEff]->SetX2(x+0.5*AliHMPIDParam::SizePadX()); | |
318 | fRenDig[iCh][iDigEff]->SetY1(y-0.5*AliHMPIDParam::SizePadY()); | |
319 | fRenDig[iCh][iDigEff]->SetY2(y+0.5*AliHMPIDParam::SizePadY()); | |
320 | fRenDig[iCh][iDigEff]->SetUniqueID((Int_t)pDig->Q()); | |
321 | fBox[iCh][iDigEff]->SetX1(x-0.5*AliHMPIDParam::SizePadX()); | |
322 | fBox[iCh][iDigEff]->SetX2(x+0.5*AliHMPIDParam::SizePadX()); | |
323 | fBox[iCh][iDigEff]->SetY1(y-0.5*AliHMPIDParam::SizePadY()); | |
324 | fBox[iCh][iDigEff]->SetY2(y+0.5*AliHMPIDParam::SizePadY()); | |
325 | iDigEff++; | |
06a9f120 | 326 | nDigs[iCh]++; |
45b05be5 | 327 | }//Digit loop |
e4290ede | 328 | }//hits loop for this entry |
329 | }//RenderHits() | |
330 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
331 | void RenderClu(TObjArray *pClus) | |
d5fc04a5 | 332 | {//used by ReadEvent() to render clusters to polymarker structures, one per chamber |
e9f11028 | 333 | for(Int_t iCh=0;iCh<=6;iCh++){ //chambers loop |
334 | TClonesArray *pClusCham=(TClonesArray*)pClus->At(iCh); //get clusters list for this chamber | |
66298970 | 335 | fTotClus[iCh] = pClusCham->GetEntries(); |
e9f11028 | 336 | for(Int_t iClu=0;iClu<pClusCham->GetEntries();iClu++){ //clusters loop |
337 | AliHMPIDCluster *pClu = (AliHMPIDCluster*)pClusCham->At(iClu); //get current cluster | |
64d57cb0 | 338 | fRenClu[iCh]->SetNextPoint(pClu->X(),pClu->Y()); |
45b05be5 | 339 | // Printf("RenderClu: ch %i x %f y %f",iCh,pClu->X(),pClu->Y()); |
340 | }//cluster loop | |
341 | }//chamber loop for this entry | |
e9f11028 | 342 | }//RenderClus() |
343 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
6e06db1d | 344 | void RenderEsd(AliESDEvent *pEsd) |
d5fc04a5 | 345 | {//used by ReadEvent() to render ESD to polymarker structures for rings and intersections one per chamber |
e9f11028 | 346 | AliHMPIDRecon rec; |
347 | for(Int_t iTrk=0;iTrk<pEsd->GetNumberOfTracks();iTrk++){//tracks loop to collect cerenkov rings and intersection points | |
348 | AliESDtrack *pTrk=pEsd->GetTrack(iTrk); Int_t ch=pTrk->GetHMPIDcluIdx(); //get track and chamber intersected by it | |
39cd22e6 | 349 | ch/=1000000; |
39cd22e6 | 350 | Float_t xPc,yPc,xRa,yRa,thRa,phRa; |
d5fc04a5 | 351 | pTrk->GetHMPIDtrk(xRa,yRa,thRa,phRa);; |
352 | if(ch<AliHMPIDParam::AliHMPIDParam::kMinCh||ch>AliHMPIDParam::kMaxCh) continue;//this track does not intersect any chamber | |
353 | Int_t npTrk = fRenTxC[ch]->SetNextPoint(xRa,yRa); //add this intersection point | |
e9f11028 | 354 | Float_t ckov=pTrk->GetHMPIDsignal(); //get ckov angle stored for this track |
355 | if(ckov>0){ | |
356 | rec.SetTrack(xRa,yRa,thRa,phRa); | |
3278403b | 357 | fRenRin[ch]->SetUniqueID(npTrk); |
06a9f120 | 358 | for(Int_t j=0;j<500;j++){ |
359 | TVector2 pos; pos=rec.TracePhot(ckov,j*6.28/500.); | |
ae5a42aa | 360 | if(!AliHMPIDParam::IsInDead(pos.X(),pos.Y())) fRenRin[ch]->SetNextPoint(pos.X(),pos.Y()); |
e9f11028 | 361 | } |
362 | }//if ckov is valid | |
363 | }//tracks loop | |
364 | }//RenEsd() | |
a1d55ff3 | 365 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
3e0a2e14 | 366 | TString Stack(Int_t evt,Int_t tid) |
367 | { | |
368 | // Prints some useful info from stack | |
369 | // Arguments: evt - event number. if not -1 print info only for that event | |
370 | // tid - track id. if not -1 then print it and all it's mothers if any | |
371 | // Returns: mother tid of the given tid if any | |
372 | if(gAL->LoadHeader()) return -1; | |
373 | if(gAL->LoadKinematics()) return -1; | |
374 | ||
375 | gAL->GetEvent(evt); | |
376 | AliStack *pStack=gAL->Stack(); | |
377 | TParticle *pTrack=pStack->Particle(tid); | |
378 | // Int_t mtid=pTrack->GetFirstMother(); | |
379 | TString str; | |
380 | str.Append(Form("with P = %7.4f (%7.4f,%7.4f,%7.4f) GeV/c ",pTrack->P(),pTrack->Px(),pTrack->Py(),pTrack->Pz())); | |
381 | gAL->UnloadHeader(); gAL->UnloadKinematics(); | |
382 | return str; | |
383 | } | |
384 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
c56e0a52 | 385 | void DispTB(TString t0,TString t1,TString t2,TString t3) |
386 | { | |
387 | fCanvasImp->SetStatusText(t0,0); | |
388 | fCanvasImp->SetStatusText(t1,1); | |
389 | fCanvasImp->SetStatusText(t2,2); | |
390 | fCanvasImp->SetStatusText(t3,3); | |
391 | } | |
392 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
b8329f55 | 393 | Bool_t FindPos(TVector3 xyz,Int_t &cham,Int_t §,Int_t &gap,Int_t &padX,Int_t &padY) |
394 | { | |
395 | // It finds the chamber parameters for a given point | |
396 | // Arguments: xyz coordinates of a given point in MARS | |
397 | // Returns: cham chamber ID ( 0-6 ) | |
398 | // sect sector ID ( 0-5 ) | |
399 | // padX X (integer) of the pad in X in the given sector (1-80) | |
400 | // padY Y (integer) of the pad in Y in the given sector (1-48) | |
401 | cham = -1; | |
402 | TGeoNode *node = gGeoManager->FindNode(xyz.X(),xyz.Y(),xyz.Z()); | |
403 | if(!node) return kFALSE; | |
404 | TGeoVolume *vol = node->GetVolume(); | |
405 | if(!vol) return kFALSE; | |
406 | TGeoManager *geo = vol->GetGeoManager(); | |
407 | if(!geo) return kFALSE; | |
408 | Int_t i=0; | |
409 | while(geo->GetMother(i)) { | |
410 | TString s = geo->GetMother(i)->GetName(); | |
411 | // if(s.Contains("Hcel_")) padX=(Int_t)(s.Remove(0,5)).Atof(); | |
412 | // if(s.Contains("Hrow_")) padY=(Int_t)(s.Remove(0,5)).Atof(); | |
413 | // if(s.Contains("Hsec_")) sect=(Int_t)(s.Remove(0,5)).Atof(); | |
414 | // if(s.Contains("Hmp_")) cham=(Int_t)(s.Remove(0,4)).Atof(); | |
415 | if(s.Contains("Hcel_")) padX=geo->GetMother(i)->GetNumber(); | |
416 | if(s.Contains("Hrow_")) padY=geo->GetMother(i)->GetNumber(); | |
417 | if(s.Contains("Hsec_")) sect=geo->GetMother(i)->GetNumber(); | |
418 | if(s.Contains("Hmp_")) cham=geo->GetMother(i)->GetNumber(); | |
419 | i++; | |
420 | } | |
421 | return (cham==-1) ? kFALSE : kTRUE; | |
422 | } | |
423 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
b735cc6c | 424 | void DisplayInfo(Int_t evt,Int_t px, Int_t py) |
66298970 | 425 | { |
c56e0a52 | 426 | if(!gPad) return; |
64d57cb0 | 427 | TVirtualPad *pPad=gPad->GetSelectedPad(); |
428 | Int_t padN = pPad->GetNumber()-1; | |
429 | if(padN<0 || padN>8) return; | |
430 | Int_t ch,pc,padX,padY; | |
431 | ch = fChamN[padN]; | |
432 | if(ch<0) return; | |
433 | TString text0,text1,text2,text3; | |
434 | ||
435 | Float_t x=pPad->AbsPixeltoX(px); Float_t y=pPad->AbsPixeltoY(py); | |
436 | fParam->Lors2Pad(x,y,pc,padX,padY); | |
437 | TVector3 xyz=fParam->Lors2Mars(ch,x,y); | |
438 | ||
439 | if(padX>=0&&padY>=0) { | |
d5fc04a5 | 440 | text0.Append(Form("Pad(%i,%i)-LORS(%6.2f,%6.2f)-MARS(%7.2f,%7.2f,%7.2f) A(%6.2f,%6.2f)",padX,padY,x,y,xyz.X(),xyz.Y(),xyz.Z(), |
441 | xyz.Theta()*TMath::RadToDeg(),xyz.Phi()*TMath::RadToDeg())); | |
64d57cb0 | 442 | text1.Append(Form("Module %i Sector %i",ch,pc)); |
c56e0a52 | 443 | text2=""; |
3278403b | 444 | text3.Append(Form("Pads = %i - Clusters = %i - Occupancy %5.2f%%",fTotPads[ch],fTotClus[ch],100.*fTotPads[ch]/(144.*160.))); |
64d57cb0 | 445 | } |
446 | ||
66298970 | 447 | TObject *obj = fCanvas->GetSelected(); |
448 | TString name = obj->GetName(); | |
b735cc6c | 449 | |
450 | // Find object DIGIT | |
c56e0a52 | 451 | |
b735cc6c | 452 | if(name=="") {DispTB(text0,text1,text2,text3);return;} // TLatex not interesting |
c56e0a52 | 453 | |
66298970 | 454 | if(name.Contains("TBox")) { |
64d57cb0 | 455 | TBox *box = (TBox*)obj; |
456 | if(box->GetUniqueID()==0) return; // just black frame hit! | |
457 | text2.Append(Form("charge = %i ADC",box->GetUniqueID())); | |
b735cc6c | 458 | DispTB(text0,text1,text2,text3); |
459 | return; | |
460 | } | |
64d57cb0 | 461 | // |
b735cc6c | 462 | // Find object HITs CLUSTER TRACK and RING (based on TPolyMarker and symbol) |
64d57cb0 | 463 | // |
b735cc6c | 464 | TPolyMarker *b = (TPolyMarker*)obj; |
64d57cb0 | 465 | |
b735cc6c | 466 | const Int_t big = 9999; |
64d57cb0 | 467 | |
b735cc6c | 468 | // check if point is near one of the points |
469 | Int_t distance = big; | |
470 | Int_t index=0; | |
64d57cb0 | 471 | |
b735cc6c | 472 | Double_t *xPol = b->GetX(); |
473 | Double_t *yPol = b->GetY(); | |
64d57cb0 | 474 | |
b735cc6c | 475 | for(Int_t i=0;i<b->Size();i++) { |
476 | Int_t pxp = pPad->XtoAbsPixel(pPad->XtoPad(xPol[i])); | |
477 | Int_t pyp = pPad->YtoAbsPixel(pPad->YtoPad(yPol[i])); | |
478 | Int_t d = TMath::Abs(pxp-px) + TMath::Abs(pyp-py); | |
479 | if (d < distance) {distance = d; index=i;} | |
480 | } | |
64d57cb0 | 481 | |
b735cc6c | 482 | Int_t symbol = b->GetMarkerStyle(); |
483 | ||
484 | // kOpenTriangleUp Hit Mip | |
485 | // kOpenCircle Hit Ckov | |
486 | // kOpenDiamond Hit Feedback | |
487 | // kStar Cluster | |
488 | // kPlus Track | |
489 | // kFullDotSmall Ring | |
490 | ||
491 | // Case Hit Mip of Hit Ckov or Hit Feedback | |
492 | if(symbol==kHitMip || symbol==kHitCko || symbol==kHitFee) { | |
493 | if(evt!=kButton1Down) return; | |
c56e0a52 | 494 | TString nameHit; |
495 | Int_t iCko[7]={0,0,0,0,0,0,0}; | |
496 | Int_t iFee[7]={0,0,0,0,0,0,0}; | |
497 | Int_t iMip[7]={0,0,0,0,0,0,0}; | |
498 | Int_t iHit; | |
499 | Int_t chHit; | |
500 | Int_t indHit=0; | |
501 | ||
b735cc6c | 502 | Int_t indTrk = b->GetUniqueID(); // track index |
503 | for(Int_t iEnt=0;iEnt<fHitTree->GetEntries();iEnt++){//entries loop | |
504 | fHitTree->GetEntry(iEnt); | |
505 | for(iHit=0;iHit<fHitLst->GetEntries();iHit++) { //hits loop | |
506 | AliHMPIDHit *pHit = (AliHMPIDHit*)fHitLst->At(iHit); | |
507 | chHit = pHit->Ch(); | |
508 | Int_t pid = pHit->Pid(); | |
509 | if(pid==50000050) iCko[chHit]++; | |
510 | else if(pid==50000051) iFee[chHit]++; | |
511 | else iMip[chHit]++; | |
512 | ||
513 | if(symbol==kHitMip && ch==chHit && index==iMip[chHit]-1) {indTrk=iEnt;indHit = iHit;break;} | |
514 | if(symbol==kHitCko && ch==chHit && index==iCko[chHit]-1) {indTrk=iEnt;indHit = iHit;break;} | |
515 | if(symbol==kHitFee && ch==chHit && index==iFee[chHit]-1) {indTrk=iEnt;indHit = iHit;break;} | |
516 | } | |
517 | } | |
b8329f55 | 518 | fHitTree->GetEntry(indTrk); |
b735cc6c | 519 | AliHMPIDHit *pHit = (AliHMPIDHit*)fHitLst->At(indHit); |
520 | ||
3e0a2e14 | 521 | Int_t tid = pHit->Tid(); |
522 | ||
523 | TString str = Stack(fEvt,tid); | |
b8329f55 | 524 | |
b735cc6c | 525 | Float_t x=pHit->LorsX(); |
526 | Float_t y=pHit->LorsY(); | |
527 | Float_t charge = pHit->Q(); | |
b8329f55 | 528 | |
529 | TVector3 v = fParam->Lors2Mars(pHit->Ch(),pHit->LorsX(),pHit->LorsY()); | |
530 | Int_t cham,sect,gap,padX,padY; | |
531 | FindPos(v,cham,sect,gap,padX,padY); | |
532 | ||
b735cc6c | 533 | if(pHit->Pid()==50000050) {nameHit = " Cherenkov Photon ";} |
534 | else if(pHit->Pid()==50000051) {nameHit = " Feedback Photon ";} | |
535 | else if(fPdg->GetParticle(pHit->Pid())) nameHit = fPdg->GetParticle(pHit->Pid())->GetName(); | |
b8329f55 | 536 | nameHit.Append(Form(" (tid %i)",tid)); |
537 | text0="";text0.Append(Form("Hit(%5.2f,%6.2f) LORS - Pad Volume(%i,%i) - hit %i/%i",x,y,padX,padY,indHit+1,fHitLst->GetEntries())); | |
b735cc6c | 538 | text2="";text2.Append(Form("Q = %7.2f ADC",charge)); |
3e0a2e14 | 539 | text3="";text3="Particle: "+ nameHit +" "+ str; |
b735cc6c | 540 | } // Hit |
541 | else if (symbol==kCluster) { | |
542 | TClonesArray *pClusCham=(TClonesArray*)fCluLst->At(ch); //get clusters list for this chamber | |
543 | AliHMPIDCluster *pClu = (AliHMPIDCluster*)pClusCham->At(index); //get current cluster | |
544 | text0="";text0.Append(Form("CLUSTER: x %6.2f y %6.2f",pClu->X(),pClu->Y())); | |
545 | text2="";text2.Append(Form("charge = %i ADC",(Int_t)pClu->Q())); | |
64d57cb0 | 546 | } |
3278403b | 547 | else if (symbol==kTrack || symbol==kRing) { |
548 | if(symbol==kRing) index = b->GetUniqueID(); | |
b735cc6c | 549 | AliESDtrack *pTrk=fEsd->GetTrack(index); |
39cd22e6 | 550 | Float_t xPc,yPc,thRa,phRa,xRa,yRa; |
551 | Int_t ch = AliHMPIDTracker::IntTrkCha(pTrk,xPc,yPc,xRa,yRa,thRa,phRa); | |
552 | text0="";text0.Append(Form("TRACK n.%d: x %6.2f y %6.2f at PC plane in chamber %i",index,xPc,yPc,ch)); | |
b735cc6c | 553 | text2="";text2.Append(Form("p = %7.2f GeV/c",pTrk->GetP())); |
554 | Float_t ckov=pTrk->GetHMPIDsignal(); | |
3278403b | 555 | Double_t prob[5]; |
556 | pTrk->GetHMPIDpid(prob); | |
b735cc6c | 557 | if(ckov>0){ |
558 | Float_t x,y;Int_t q,nacc; pTrk->GetHMPIDmip(x,y,q,nacc); | |
ac66a50d | 559 | text3="";text3.Append(Form("Theta Cherenkov %5.3f with %i photons | e %5.1f%% | u %5.1f%% | pi %5.1f%% | K %5.1f%% | p %5.1f%%", |
3278403b | 560 | pTrk->GetHMPIDsignal(),nacc,prob[0]*100,prob[1]*100,prob[2]*100,prob[3]*100,prob[4]*100)); |
b735cc6c | 561 | } |
66298970 | 562 | } |
64d57cb0 | 563 | //Update toolbar status |
c56e0a52 | 564 | |
565 | DispTB(text0,text1,text2,text3); | |
66298970 | 566 | } |
567 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
568 | void CloseInfo() | |
569 | { | |
570 | } | |
571 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
e9f11028 | 572 | void DoZoom(Int_t evt, Int_t px, Int_t py, TObject *) |
a1d55ff3 | 573 | { |
66298970 | 574 | // Printf(" px %i py%i event %i",px,py,evt); |
82692b45 | 575 | |
576 | if(evt== 1) evt = 5; //for laptop with touchpad: zoom in with left button | |
577 | if(evt== 2) evt = 6; //for laptop with touchpad: zoom out with both buttons | |
578 | ||
b735cc6c | 579 | if(evt==kMouseMotion||evt==kButton1Down) DisplayInfo(evt,px,py); |
82692b45 | 580 | // if(evt==11) CloseInfo(); |
64d57cb0 | 581 | if(evt!=5 && evt!=6) return; //5- zoom in 6-zoom out |
8282f9d0 | 582 | const Int_t minZoom=64; |
583 | const Int_t maxZoom=2; | |
06a9f120 | 584 | static Int_t zoom[7]={64,64,64,64,64,64,64}; //zoom level |
8282f9d0 | 585 | |
d73ece6a | 586 | // if(!obj->IsA()->InheritsFrom("TPad")) return; //current object is not pad |
50e69536 | 587 | TVirtualPad *pPad=gPad->GetSelectedPad(); |
06a9f120 | 588 | Int_t padN = pPad->GetNumber()-1; |
589 | if(padN<0 || padN>8) return; | |
590 | ||
66298970 | 591 | Int_t iCh = fChamN[padN]; |
06a9f120 | 592 | if(iCh < 0) return; |
593 | ||
594 | if(evt==5&&zoom[iCh]==maxZoom) return; | |
595 | if(evt==6&&zoom[iCh]==minZoom) return; | |
8282f9d0 | 596 | |
597 | Float_t x=pPad->AbsPixeltoX(px); Float_t y=pPad->AbsPixeltoY(py); | |
6ed6a312 | 598 | |
06a9f120 | 599 | if(evt==5){ zoom[iCh]=zoom[iCh]/2; pPad->Range(x-zoom[iCh]*2,y-zoom[iCh]*2,x+zoom[iCh]*2,y+zoom[iCh]*2);} //zoom in |
66298970 | 600 | if(evt==6){ zoom[iCh]=zoom[iCh]*2; pPad->Range(x-zoom[iCh]*2,y-zoom[iCh]*2,x+zoom[iCh]*2,y+zoom[iCh]*2);} //zoom out |
06a9f120 | 601 | if(zoom[iCh]==minZoom) pPad->Range(-10,-10,AliHMPIDParam::SizeAllX()+5,AliHMPIDParam::SizeAllY()+5); |
602 | ((TCanvas *)gTQSender)->SetTitle(Form("zoom x%i",minZoom/zoom[iCh])); | |
8282f9d0 | 603 | pPad->Modified(); |
604 | pPad->Update(); | |
a1d55ff3 | 605 | } |
8282f9d0 | 606 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
66298970 | 607 | void CheckStatus() |
608 | { | |
64d57cb0 | 609 | if(fHitFile){ |
610 | if(fStHitMip=="OFF") {fHitMipBok->SetFillColor(kRed);} else {fHitMipBok->SetFillColor(18);} | |
611 | if(fStHitCko=="OFF") {fHitCkoBok->SetFillColor(kRed);} else {fHitCkoBok->SetFillColor(18);} | |
612 | if(fStHitFee=="OFF") {fHitFeeBok->SetFillColor(kRed);} else {fHitFeeBok->SetFillColor(18);} | |
613 | } | |
614 | if(fDigFile){if(fStDig =="OFF") {fDigBok->SetFillColor(kRed);} else {fDigBok->SetFillColor(18);}} | |
615 | if(fCluFile){if(fStClu =="OFF") {fCluBok->SetFillColor(kRed);} else {fCluBok->SetFillColor(18);}} | |
616 | if(fEsdFile){if(fStEsd =="OFF") {fEsdBok->SetFillColor(kRed);} else {fEsdBok->SetFillColor(18);}} | |
66298970 | 617 | } |
618 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
45b05be5 | 619 | void GetEvent() |
d73ece6a | 620 | { |
e9f11028 | 621 | ClearRenders(); |
d5fc04a5 | 622 | |
d5fc04a5 | 623 | ReadEvent(); |
624 | ||
625 | while(!Trigger()) { | |
626 | Printf(" trigger %i for event %i",Trigger(),fEvt); | |
627 | fEvt+=fTimeArrow; | |
628 | ClearRenders(); | |
629 | ReadEvent(); | |
630 | } | |
631 | ||
06a9f120 | 632 | CheckStatus(); |
e9f11028 | 633 | Draw(); |
d73ece6a | 634 | } |
635 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
45b05be5 | 636 | void NextEvent() |
637 | { | |
638 | fTimeArrow = 1; | |
639 | fEvt+=fTimeArrow; | |
640 | GetEvent(); | |
641 | } | |
642 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
643 | void PrevEvent() | |
644 | { | |
645 | fTimeArrow = -1; | |
646 | fEvt+=fTimeArrow; | |
647 | GetEvent(); | |
648 | } | |
649 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
650 | void End() | |
651 | { | |
652 | gSystem->Exit(0); | |
653 | } | |
654 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
e9f11028 | 655 | void Hdisp() |
656 | {//display events from files if any in current directory or simulated events | |
64d57cb0 | 657 | |
66298970 | 658 | fParam=AliHMPIDParam::Instance(); // first invocation of AliHMPIDParam to initialize geometry... |
64d57cb0 | 659 | fPdg = TDatabasePDG::Instance(); // first invocation of TDatabasePDG to retrieve particle infos... |
660 | ||
e9f11028 | 661 | CreateContainers(); |
662 | CreateRenders(); | |
d73ece6a | 663 | |
e9f11028 | 664 | TString title="Session with"; |
d5fc04a5 | 665 | |
666 | LoadRunLoader(); | |
667 | ||
e9f11028 | 668 | if(gSystem->IsFileInIncludePath("HMPID.Hits.root")){// tries to open hits |
669 | fHitFile=TFile::Open("HMPID.Hits.root"); fNevt=fHitFile->GetNkeys(); fType=1; title+=Form(" HITS-%i ",fNevt); | |
670 | } | |
6b155609 | 671 | |
e9f11028 | 672 | if(gSystem->IsFileInIncludePath("HMPID.Digits.root")){// tries to open clusters |
e4290ede | 673 | fDigFile=TFile::Open("HMPID.Digits.root"); fNevt=fDigFile->GetNkeys(); fType=1; title+=Form(" DIGITS-%i ",fNevt); |
674 | } | |
6b155609 | 675 | |
e9f11028 | 676 | if(gSystem->IsFileInIncludePath("HMPID.RecPoints.root")){// tries to open clusters |
677 | fCluFile=TFile::Open("HMPID.RecPoints.root"); fNevt=fCluFile->GetNkeys(); fType=1; title+=Form(" CLUSTERS-%i ",fNevt); | |
e4290ede | 678 | } |
d5fc04a5 | 679 | |
680 | if(gSystem->IsFileInIncludePath("cosmic.root")){ //clm: Check if cosmic file is in the folder | |
681 | fCosFile=TFile::Open("cosmic.root"); fCosTree=(TTree*)fCosFile->Get("cosmic"); fNevt=fCosTree->GetEntries(); fType=2; | |
682 | fCosTree->SetBranchAddress("Digs",&fDigLst); fCosTree->SetBranchAddress("Clus",&fCluLst); | |
683 | } | |
684 | ||
e9f11028 | 685 | if(gSystem->IsFileInIncludePath("AliESDs.root")){ |
566300ac | 686 | fEsdFile=TFile::Open("AliESDs.root"); |
687 | if(fEsdFile) { | |
688 | fEsdTree=(TTree*)fEsdFile->Get("esdTree"); | |
689 | fEsd->ReadFromTree(fEsdTree); fEsd->GetStdContent(); //clm: new ESD schema: see Task Force meeting 20th June, 2007 | |
942536d9 | 690 | if(fEsdTree) { |
691 | fNevt=fEsdTree->GetEntries(); fType=1; title+=Form(" ESD-%i ",fNevt); | |
692 | } else {delete fEsdFile;fEsdFile=0x0;} | |
566300ac | 693 | } else {delete fEsdFile; delete fEsdTree;} |
e9f11028 | 694 | } |
d5fc04a5 | 695 | |
c56e0a52 | 696 | fCanvas=new TCanvas("all","",-1024,768);fCanvas->SetWindowSize(1024,768); |
66298970 | 697 | fCanvasImp = fCanvas->GetCanvasImp(); |
698 | fCanvasImp->ShowStatusBar(); | |
45b05be5 | 699 | fCanvas->Divide(3,3,0,0);// pAll->ToggleEditor(); |
e9f11028 | 700 | fCanvas->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",0,0,"DoZoom(Int_t,Int_t,Int_t,TObject*)"); |
701 | fCanvas->cd(7); | |
06a9f120 | 702 | gStyle->SetPalette(1,0); |
e9f11028 | 703 | switch(fType){ |
704 | case 1: fCanvas->SetTitle(title.Data()); | |
45b05be5 | 705 | TButton *pNxtBtn = new TButton("Next" ,"NextEvent()" ,0.0,0.0,0.3,0.1); pNxtBtn->Draw(); |
706 | TButton *pPrvBtn = new TButton("Previous" ,"PrevEvent()" ,0.3,0.0,0.6,0.1); pPrvBtn->Draw(); | |
707 | if(fHitFile){TButton *pHitBtn = new TButton("Print hits","PrintHits()" ,0.0,0.2,0.3,0.3); pHitBtn->Draw();} | |
708 | if(fDigFile){TButton *pDigBtn = new TButton("Print digs","PrintDigs()" ,0.0,0.4,0.3,0.5); pDigBtn->Draw();} | |
709 | if(fCluFile){TButton *pCluBtn = new TButton("Print clus","PrintClus()" ,0.0,0.6,0.3,0.7); pCluBtn->Draw();} | |
710 | if(fEsdFile){TButton *pEsdBtn = new TButton("Print ESD ","PrintEsd()" ,0.0,0.8,0.3,0.9); pEsdBtn->Draw();} | |
06a9f120 | 711 | if(fHitFile){ fHitMipBok = new TButton(Form("Mip %s",fStHitMip.Data()),"SwitchHitMip()",0.3,0.16,0.6,0.22); fHitMipBok->Draw();} |
45b05be5 | 712 | if(fHitFile){ fHitCkoBok = new TButton(Form("Ckov %s",fStHitCko.Data()),"SwitchHitCko()",0.3,0.22,0.6,0.28); fHitCkoBok->Draw();} |
713 | if(fHitFile){ fHitFeeBok = new TButton(Form("Fdbk %s",fStHitFee.Data()),"SwitchHitFee()",0.3,0.28,0.6,0.34); fHitFeeBok->Draw();} | |
714 | if(fDigFile){ fDigBok = new TButton(fStDig ,"SwitchDigs()" ,0.3,0.4,0.6,0.5); fDigBok->Draw();} | |
715 | if(fCluFile){ fCluBok = new TButton(fStClu ,"SwitchClus()" ,0.3,0.6,0.6,0.7); fCluBok->Draw();} | |
716 | if(fEsdFile){ fEsdBok = new TButton(fStEsd ,"SwitchEsd()" ,0.3,0.8,0.6,0.9); fEsdBok->Draw();} | |
06a9f120 | 717 | |
718 | if(fHitFile){TButton *fHitMipOnly = new TButton(" Only ","OnlyHitMip()",0.6,0.16,0.9,0.22); fHitMipOnly->Draw();} | |
719 | if(fHitFile){TButton *fHitCkoOnly = new TButton(" Only ","OnlyHitCko()",0.6,0.22,0.9,0.28); fHitCkoOnly->Draw();} | |
720 | if(fHitFile){TButton *fHitFeeOnly = new TButton(" Only ","OnlyHitFee()",0.6,0.28,0.9,0.34); fHitFeeOnly->Draw();} | |
721 | if(fDigFile){TButton *fDigOnly = new TButton(" Only ","OnlyDigs()" ,0.6,0.40,0.9,0.50); fDigOnly->Draw();} | |
722 | if(fCluFile){TButton *fCluOnly = new TButton(" Only ","OnlyClus()" ,0.6,0.60,0.9,0.70); fCluOnly->Draw();} | |
723 | if(fEsdFile){TButton *fEsdOnly = new TButton(" Only ","OnlyEsd()" ,0.6,0.80,0.9,0.90); fEsdOnly->Draw();} | |
66298970 | 724 | TButton *pAll = new TButton(" ALL ","All()" ,0.5,0.90,0.7,1.00); pAll->Draw(); |
06a9f120 | 725 | |
726 | TButton *pEnd = new TButton("Quit" ,"End()" ,0.6,0.0,0.9,0.1); pEnd->Draw(); | |
e9f11028 | 727 | break; |
728 | case 2: fCanvas->SetTitle("COSMIC"); | |
45b05be5 | 729 | TButton *pCosBtn = new TButton("Next" ,"NextEvent()",0.0,0.0,0.3,0.1); pCosBtn->Draw(); |
e9f11028 | 730 | |
731 | break; | |
732 | case 3: fCanvas->SetTitle("SIMULATION"); | |
45b05be5 | 733 | TButton *pSimBtn = new TButton("Simulate" ,"NextEvent()",0.0,0.0,0.3,0.1); pSimBtn->Draw(); |
734 | TButton *pHitBtn = new TButton("Print hits","PrintHits()",0.0,0.2,0.3,0.3); pHitBtn->Draw(); | |
735 | TButton *pDigBtn = new TButton("Print digs","PrintDigs()",0.0,0.4,0.3,0.5); pDigBtn->Draw(); | |
736 | TButton *pCluBtn = new TButton("Print clus","PrintClus()",0.0,0.6,0.3,0.7); pCluBtn->Draw(); | |
737 | TButton *pEsdBtn = new TButton("Print ESD" ,"PrintEsd()" ,0.0,0.8,0.3,0.9); pEsdBtn->Draw(); | |
738 | if(fHitFile){ fHitMipBok = new TButton(Form("Mips %s",fStHitMip.Data()),"SwitchHitMip()",0.3,0.16,0.6,0.22); fHitMipBok->Draw();} | |
739 | if(fHitFile){ fHitCkoBok = new TButton(Form("Ckov %s",fStHitCko.Data()),"SwitchHitCko()",0.3,0.22,0.6,0.28); fHitCkoBok->Draw();} | |
740 | if(fHitFile){ fHitFeeBok = new TButton(Form("Fdbk %s",fStHitFee.Data()),"SwitchHitFee()",0.3,0.28,0.6,0.34); fHitFeeBok->Draw();} | |
741 | if(fDigFile){ fDigBok = new TButton(fStDig ,"SwitchDigs()" ,0.3,0.4,0.6,0.5); fDigBok->Draw();} | |
742 | if(fCluFile){ fCluBok = new TButton(fStClu ,"SwitchClus()" ,0.3,0.6,0.6,0.7); fCluBok->Draw();} | |
743 | if(fEsdFile){ fEsdBok = new TButton(fStEsd ,"SwitchEsd()" ,0.3,0.8,0.6,0.9); fEsdBok->Draw();} | |
06a9f120 | 744 | |
745 | if(fHitFile){TButton *fHitMipOnly = new TButton(" Only ","OnlyHitMip()",0.6,0.16,0.9,0.22); fHitMipOnly->Draw();} | |
746 | if(fHitFile){TButton *fHitCkoOnly = new TButton(" Only ","OnlyHitCko()",0.6,0.22,0.9,0.28); fHitCkoOnly->Draw();} | |
747 | if(fHitFile){TButton *fHitFeeOnly = new TButton(" Only ","OnlyHitFee()",0.6,0.28,0.9,0.34); fHitFeeOnly->Draw();} | |
748 | if(fDigFile){TButton *fDigOnly = new TButton(" Only ","OnlyDigs()" ,0.6,0.40,0.9,0.50); fDigOnly->Draw();} | |
749 | if(fCluFile){TButton *fCluOnly = new TButton(" Only ","OnlyClus()" ,0.6,0.60,0.9,0.70); fCluOnly->Draw();} | |
750 | if(fEsdFile){TButton *fEsdOnly = new TButton(" Only ","OnlyEsd()" ,0.6,0.80,0.9,0.90); fEsdOnly->Draw();} | |
66298970 | 751 | TButton *pSimAll = new TButton(" ALL ","All()" ,0.5,0.90,0.7,1.00); pSimAll->Draw(); |
e9f11028 | 752 | break; |
753 | } | |
754 | ||
0112d781 | 755 | NextEvent(); |
e9f11028 | 756 | |
757 | }//Hdisp() | |
758 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
45b05be5 | 759 | void SwitchHitMip() |
760 | { | |
761 | fStHitMip=(fStHitMip=="OFF")? "ON":"OFF"; | |
762 | GetEvent(); | |
763 | } | |
764 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
765 | void SwitchHitCko() | |
766 | { | |
767 | fStHitCko=(fStHitCko=="OFF")? "ON":"OFF"; | |
768 | GetEvent(); | |
769 | } | |
770 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
771 | void SwitchHitFee() | |
772 | { | |
773 | fStHitFee=(fStHitFee=="OFF")? "ON":"OFF"; | |
774 | GetEvent(); | |
775 | } | |
776 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
777 | void SwitchDigs() | |
778 | { | |
779 | fStDig=(fStDig=="OFF")? "ON":"OFF"; | |
780 | GetEvent(); | |
781 | } | |
782 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
783 | void SwitchClus() | |
784 | { | |
785 | fStClu=(fStClu=="OFF")? "ON":"OFF"; | |
786 | GetEvent(); | |
787 | } | |
788 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
789 | void SwitchEsd() | |
790 | { | |
791 | fStEsd=(fStEsd=="OFF")? "ON":"OFF"; | |
06a9f120 | 792 | GetEvent(); |
793 | } | |
794 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
795 | void AllNo() | |
796 | { | |
64d57cb0 | 797 | if(fHitFile) { |
798 | fStHitMip = "OFF"; | |
799 | fStHitCko = "OFF"; | |
800 | fStHitFee = "OFF"; | |
801 | } | |
802 | if(fDigFile) fStDig = "OFF"; | |
803 | if(fCluFile) fStClu = "OFF"; | |
804 | if(fEsdFile) fStEsd = "OFF"; | |
06a9f120 | 805 | } |
806 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
807 | void AllYes() | |
808 | { | |
64d57cb0 | 809 | if(fHitFile) { |
810 | fStHitMip = "ON"; | |
811 | fStHitCko = "ON"; | |
812 | fStHitFee = "ON"; | |
813 | } | |
06a9f120 | 814 | if(fDigFile) fStDig = "ON"; |
815 | if(fCluFile) fStClu = "ON"; | |
816 | if(fEsdFile) fStEsd = "ON"; | |
817 | } | |
818 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
819 | void All() | |
820 | { | |
821 | AllYes(); | |
45b05be5 | 822 | GetEvent(); |
823 | } | |
824 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
06a9f120 | 825 | void OnlyHitMip() |
826 | { | |
827 | AllNo(); | |
828 | fStHitMip = "ON"; | |
829 | GetEvent(); | |
830 | } | |
831 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
832 | void OnlyHitCko() | |
833 | { | |
834 | AllNo(); | |
835 | fStHitCko = "ON"; | |
836 | GetEvent(); | |
837 | } | |
838 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
839 | void OnlyHitFee() | |
840 | { | |
841 | AllNo(); | |
842 | fStHitFee = "ON"; | |
843 | GetEvent(); | |
844 | } | |
845 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
846 | void OnlyDigs() | |
847 | { | |
848 | AllNo(); | |
849 | fStDig = "ON"; | |
850 | GetEvent(); | |
851 | } | |
852 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
853 | void OnlyClus() | |
854 | { | |
855 | AllNo(); | |
856 | fStClu = "ON"; | |
857 | GetEvent(); | |
858 | } | |
859 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
860 | void OnlyEsd() | |
861 | { | |
862 | AllNo(); | |
863 | fStEsd = "ON"; | |
864 | GetEvent(); | |
865 | } | |
b8329f55 | 866 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
d5fc04a5 | 867 | void LoadRunLoader(){ |
868 | if(!gSystem->IsFileInIncludePath("galice.root")) { | |
869 | Printf("\n\n galice.root not in path: please check! \n\n"); | |
870 | return; | |
871 | } | |
872 | if(gAlice) gAlice=0x0; | |
873 | gAL=AliRunLoader::Open(); | |
874 | gAL->LoadHeader(); | |
875 | gAL->LoadHits("HMPID"); | |
876 | gAL->LoadDigits("HMPID"); | |
877 | gAL->LoadRecPoints("HMPID"); | |
878 | gDL = gAL->GetDetectorLoader("HMPID"); | |
879 | if(!gDL){ | |
880 | Printf("\n\n no AliLoader present: please check! \n\n"); | |
881 | return; | |
882 | } | |
883 | fNevt= gAL->GetNumberOfEvents(); | |
884 | } | |
885 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
886 | void ReadEvent(){ | |
887 | //used by NextEvent() to read curent event and construct all render elements | |
888 | if(fNevt && fEvt>=fNevt) fEvt=0; //loop over max event | |
889 | if(fNevt && fEvt<0) fEvt=fNevt-1; //loop over max event | |
890 | ||
82692b45 | 891 | // Printf("getting event %i out of %i",fEvt,fNevt); |
d5fc04a5 | 892 | |
893 | if(gDL) { | |
894 | ||
895 | gAL->GetEvent(fEvt); | |
896 | ||
897 | //-------- HITS | |
898 | ||
899 | fHitTree=gDL->TreeH(); | |
900 | ||
901 | if(fHitTree) { | |
902 | ||
903 | fHitTree->SetBranchAddress("HMPID",&fHitLst); | |
904 | ||
905 | for(Int_t iEnt=0;iEnt<fHitTree->GetEntries();iEnt++){ | |
906 | fHitTree->GetEntry(iEnt); | |
907 | RenderHit(fHitLst); | |
908 | }//prim loop | |
909 | }//if hits tree | |
910 | ||
911 | //-------- DIGITS | |
912 | ||
913 | fDigTree=gDL->TreeD(); | |
914 | ||
915 | if(fDigTree){ | |
916 | for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) fDigTree->SetBranchAddress(Form("HMPID%i",iCh),&(*fDigLst)[iCh]); | |
917 | // fDigTree->GetEvent(fEvt); | |
918 | fDigTree->GetEntry(0); | |
919 | RenderDig(fDigLst); | |
920 | //cout << "pointer to the dig list " << fDigLst << endl; | |
921 | } | |
922 | ||
923 | //-------- CLUSTERS | |
924 | ||
925 | fCluTree= gDL->TreeR(); | |
926 | ||
927 | if(fCluTree) { | |
928 | for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) fCluTree->SetBranchAddress(Form("HMPID%i",iCh),&(*fCluLst)[iCh]); | |
929 | fCluTree->GetEntry(0); | |
930 | RenderClu(fCluLst); | |
931 | } | |
932 | } | |
933 | ||
934 | //-------- ESD | |
935 | ||
936 | if(fEsdFile){//if ESD file open | |
937 | fEsdTree->GetEntry(fEvt); | |
938 | RenderEsd(fEsd); | |
939 | }//if ESD file | |
940 | ||
941 | } | |
942 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
943 | void SetEvent(Int_t ev) | |
944 | { | |
945 | fEvt=ev; | |
946 | GetEvent(); | |
947 | } | |
948 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
949 | void SetSigmaCut(Int_t sig=0) | |
950 | { | |
951 | qSigmaCut = sig; | |
952 | } | |
953 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
954 | void SetField() | |
955 | { | |
956 | gROOT->LoadMacro("Field.C"); | |
957 | ||
958 | AliMagF * b = Field(); | |
959 | ||
960 | AliHMPIDTracker::SetFieldMap(b,kTRUE); | |
961 | } | |
962 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
963 | void SetTrigger(Int_t type=0) | |
964 | { | |
965 | trigType = type; | |
966 | if(type==1) Printf(" Trigger 1 selected: at least ONE track in HMPID."); | |
967 | } | |
968 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
969 | Bool_t Trigger() | |
970 | { | |
971 | if(trigType==0) return kTRUE; | |
972 | if(trigType==1) { | |
973 | if(fEsd->GetNumberOfTracks()>0) { | |
974 | PrintEsd(); | |
975 | return kTRUE; | |
976 | } else return kFALSE; | |
977 | } | |
978 | return kTRUE; | |
979 | } |