Classes for Quality Assurance. Presently only SDD is monitored. (Cerello, Ferrarese...
[u/mrichter/AliRoot.git] / HMPID / Hdisp.C
CommitLineData
c0d7adf8 1#if !defined(__CINT__) || defined(__MAKECINT__)
2
b735cc6c 3//#include <Buttons.h>
e9f11028 4#include <TSystem.h>
5#include <TFile.h>
06a9f120 6#include <TVirtualX.h>
e9f11028 7#include <TTree.h>
8#include <TButton.h>
9#include <TCanvas.h>
66298970 10#include <TCanvasImp.h>
06a9f120 11#include <TStyle.h>
45b05be5 12#include <TString.h>
e9f11028 13#include <TClonesArray.h>
14#include <TParticle.h>
15#include <TRandom.h>
16#include <TLatex.h>
45b05be5 17#include <TPDGCode.h>
e9f11028 18#include <TLegend.h>
19#include <TPolyMarker.h>
20#include <TBox.h>
6e06db1d 21#include <AliESDEvent.h>
e9f11028 22#include <AliCDBManager.h>
23#include <AliCDBEntry.h>
24#include "AliHMPIDHit.h"
25#include "AliHMPIDv2.h"
26#include "AliHMPIDReconstructor.h"
27#include "AliHMPIDRecon.h"
28#include "AliHMPIDParam.h"
29#include "AliHMPIDCluster.h"
e4290ede 30#include "AliTracker.h"
31
c0d7adf8 32#endif
33
66298970 34AliHMPIDParam *fParam;
64d57cb0 35TDatabasePDG *fPdg;
66298970 36
45b05be5 37TCanvas *fCanvas=0; Int_t fType=3; Int_t fEvt=-1; Int_t fNevt=0;
66298970 38TCanvasImp *fCanvasImp;
e9f11028 39TFile *fHitFile; TTree *fHitTree; TClonesArray *fHitLst; TPolyMarker *fRenMip[7]; TPolyMarker *fRenCko[7]; TPolyMarker *fRenFee[7];
40 TClonesArray *fSdiLst;
06a9f120 41TFile *fDigFile; TTree *fDigTree; TObjArray *fDigLst; TBox *fRenDig[7][160*144]; TBox *fBox[7][160*144];
64d57cb0 42TFile *fCluFile; TTree *fCluTree; TObjArray *fCluLst; TPolyMarker *fRenClu[7];
45b05be5 43TFile *fEsdFile; TTree *fEsdTree; AliESDEvent *fEsd; TPolyMarker *fRenTxC[7]; TPolyMarker *fRenRin[7];
e9f11028 44TFile *fCosFile; TTree *fCosTree;
45b05be5 45
46TButton *fHitMipBok,*fHitCkoBok,*fHitFeeBok,*fDigBok,*fCluBok,*fEsdBok;
47
48TString fStHitMip = "ON";
49TString fStHitCko = "ON";
50TString fStHitFee = "ON";
51TString fStDig = "ON";
52TString fStClu = "ON";
53TString fStEsd = "ON";
54
55Int_t fTimeArrow = 1;
56
06a9f120 57Int_t fMaxCharge = 200; //maximum charge to saturate color to red
58
66298970 59Int_t fChamN[9]={6,5,-1,4,3,2,-1,1,0};
60
61Int_t fTotPads[7],fTotClus[7];
62
e4290ede 63AliRunLoader *gAL=0;
8282f9d0 64
06a9f120 65Int_t nDigs[7];
64d57cb0 66
b735cc6c 67enum EObjectType {kHitMip=kOpenTriangleUp,kHitCko=kOpenCircle,kHitFee=kOpenDiamond,kCluster=kStar,kTrack=kPlus,kRing=kFullDotSmall};
68 // kOpenTriangleUp Hit Mip
69 // kOpenCircle Hit Ckov
70 // kOpenDiamond Hit Feedback
71 // kStar Cluster
72 // kPlus Track
73 // kFullDotSmall Ring
74
e9f11028 75//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
76void CreateContainers()
77{//to create all containers
78 fHitLst=new TClonesArray("AliHMPIDHit");
79 fSdiLst=new TClonesArray("AliHMPIDDigit");
80 fDigLst=new TObjArray(7); for(Int_t i=0;i<7;i++) fDigLst->AddAt(new TClonesArray("AliHMPIDDigit"),i); fDigLst->SetOwner(kTRUE);
81 fCluLst=new TObjArray(7); for(Int_t i=0;i<7;i++) fCluLst->AddAt(new TClonesArray("AliHMPIDCluster"),i); fCluLst->SetOwner(kTRUE);
6e06db1d 82 fEsd =new AliESDEvent;
126b3e0e 83}
126b3e0e 84//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
e9f11028 85void CreateRenders()
86{
87 for(Int_t ch=0;ch<7;ch++){
b735cc6c 88 fRenMip[ch]=new TPolyMarker; fRenMip[ch]->SetMarkerStyle(kOpenTriangleUp);fRenMip[ch]->SetMarkerColor(kBlack) ;
89 fRenCko[ch]=new TPolyMarker; fRenCko[ch]->SetMarkerStyle(kOpenCircle); fRenCko[ch]->SetMarkerColor(kBlack) ;
90 fRenFee[ch]=new TPolyMarker; fRenFee[ch]->SetMarkerStyle(kOpenDiamond); fRenFee[ch]->SetMarkerColor(kBlack) ;
91 fRenClu[ch]=new TPolyMarker; fRenClu[ch]->SetMarkerStyle(kStar); fRenClu[ch]->SetMarkerColor(kMagenta);
92 fRenTxC[ch]=new TPolyMarker; fRenTxC[ch]->SetMarkerStyle(kPlus); fRenTxC[ch]->SetMarkerColor(kRed) ;
64d57cb0 93 fRenTxC[ch]->SetMarkerSize(3);
b735cc6c 94 fRenRin[ch]=new TPolyMarker; fRenRin[ch]->SetMarkerStyle(kFullDotSmall); fRenRin[ch]->SetMarkerColor(kMagenta);
64d57cb0 95
06a9f120 96 for(Int_t iDig=0;iDig<160*144;iDig++) {
97 fRenDig[ch][iDig] = new TBox;
98 fRenDig[ch][iDig]->SetFillStyle(1);
99 fBox[ch][iDig] = new TBox;
100 fBox[ch][iDig]->SetFillStyle(0);
101 }
e9f11028 102 }
103}//CreateRenders()
104//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
105void ClearRenders()
106{
107 for(Int_t ch=0;ch<7;ch++){
108 fRenTxC[ch]->SetPolyMarker(0);
109 fRenRin[ch]->SetPolyMarker(0);
110 fRenMip[ch]->SetPolyMarker(0);
111 fRenCko[ch]->SetPolyMarker(0);
112 fRenFee[ch]->SetPolyMarker(0);
06a9f120 113 nDigs[ch] = 0;
e9f11028 114 fRenClu[ch]->SetPolyMarker(0);
115 }
116}//ClearRenders()
117//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
118void PrintHits()
119{
120//Prints a list of HMPID hits for a given event. Default is event number 0.
121 if(!fHitTree) return;
122 Printf("List of HMPID hits for event %i",fEvt);
123 Int_t iTot=0;
124 for(Int_t iEnt=0;iEnt<fHitTree->GetEntries();iEnt++){//entries loop
125 fHitTree->GetEntry(iEnt);
126 fHitLst->Print();
127 iTot+=fHitLst->GetEntries();
128 }
129 Printf("totally %i hits for event %i",iTot,fEvt);
130}//PrintHits();
131//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
132void PrintSdis()
133{//prints a list of HMPID sdigits for a given event
134 Printf("List of HMPID sdigits for event %i",fEvt);
135 fSdiLst->Print();
136 Printf("totally %i sdigits for event %i",fSdiLst->GetEntries(),fEvt);
137}//PrintSdis()
138//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
139void PrintDigs()
140{//prints a list of HMPID digits
141 Printf("List of HMPID digits for event %i",fEvt);
142 fDigLst->Print();
143 Int_t iTot=0; for(Int_t i=0;i<7;i++) {iTot+=((TClonesArray*)fDigLst->At(i))->GetEntries();}
144 Printf("totally %i digits for event %i",iTot,fEvt);
8282f9d0 145}
146//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
e9f11028 147void PrintClus()
148{//prints a list of HMPID clusters for a given event
149 Printf("List of HMPID clusters for event %i",fEvt);
8282f9d0 150
e9f11028 151 fCluLst->Print();
152 Int_t iTot=0; for(Int_t iCh=0;iCh<7;iCh++) iTot+=((TClonesArray*)fCluLst->At(iCh))->GetEntries();
153
154 Printf("totally %i clusters for event %i",iTot,fEvt);
8282f9d0 155}
156//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
e9f11028 157void PrintEsd()
158{//prints a list of HMPID Esd for a given event
159 Printf("List of HMPID ESD summary for event %i",fEvt);
160 for(Int_t iTrk=0;iTrk<fEsd->GetNumberOfTracks();iTrk++){
161 AliESDtrack *pTrk = fEsd->GetTrack(iTrk);
162 Float_t x,y;Int_t q,nacc; pTrk->GetHMPIDmip(x,y,q,nacc);
163 Printf("Track %02i with p %7.2f with ThetaCer %5.3f with %i photons",iTrk,pTrk->GetP(),pTrk->GetHMPIDsignal(),nacc);
164 }
165}//PrintEsd()
166//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
167void DrawChamber(Int_t iCh)
168{//used by Draw() to Draw() chamber structure
45b05be5 169 gPad->Range(-10,-10,AliHMPIDParam::SizeAllX()+5,AliHMPIDParam::SizeAllY()+5);
e9f11028 170 if(iCh>=0){TLatex txt; txt.SetTextSize(0.1); txt.DrawLatex(-5,-5,Form("%i",iCh));}
171
ae5a42aa 172 for(Int_t iPc=AliHMPIDParam::kMinPc;iPc<=AliHMPIDParam::kMaxPc;iPc++){
173 TBox *pBox=new TBox(AliHMPIDParam::MinPcX(iPc),AliHMPIDParam::MinPcY(iPc),
174 AliHMPIDParam::MaxPcX(iPc),AliHMPIDParam::MaxPcY(iPc));
e9f11028 175 pBox->SetFillStyle(0); pBox->Draw();
176 }//PC loop
177}//DrawChamber()
178//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
179void DrawLegend()
180{//used by Draw() to draw legend
181 Int_t nTxC=0,nMip=0,nCko=0,nFee=0,nDig=0,nClu=0;
182 for(Int_t ch=0;ch<7;ch++){
64d57cb0 183 nTxC+=fRenTxC[ch]->Size();
184 nMip+=fRenMip[ch]->Size();
185 nCko+=fRenCko[ch]->Size();
186 nFee+=fRenFee[ch]->Size();
187 nClu+=fRenClu[ch]->Size();
06a9f120 188 nDig+=nDigs[ch];
e9f11028 189 }
190 TLegend *pLeg=new TLegend(0.2,0.2,0.8,0.8);
191 pLeg->SetHeader(Form("Event %i Total %i",fEvt,fNevt));
06a9f120 192 pLeg->AddEntry(fRenTxC[0], Form("TRKxPC %i" ,nTxC),"p");
193 pLeg->AddEntry(fRenMip[0], Form("Mip hits %i" ,nMip),"p");
194 pLeg->AddEntry(fRenCko[0], Form("Ckov hits %i" ,nCko),"p");
195 pLeg->AddEntry(fRenFee[0], Form("Feed hits %i" ,nFee),"p");
196 pLeg->AddEntry(fRenDig[0][0],Form("Digs %i" ,nDig),"p");
197 pLeg->AddEntry(fRenClu[0], Form("Clus %i" ,nClu),"p");
e9f11028 198 pLeg->Draw();
199}//DrawLegend()
200//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
201void Draw()
202{//draws all the objects of current event in given canvas
45b05be5 203 Int_t iPadN[7]={9,8,6,5,4,2,1};
06a9f120 204 Int_t sampleCol = fMaxCharge/gStyle->GetNumberOfColors();
e9f11028 205 for(Int_t iCh=0;iCh<7;iCh++){//chambers loop
45b05be5 206 fCanvas->cd(iPadN[iCh]);
e9f11028 207 gPad->SetEditable(kTRUE); gPad->Clear(); DrawChamber(iCh);
06a9f120 208
64d57cb0 209 if(fDigFile){
210 if(fStDig =="ON") {
211 for(Int_t iDig=0;iDig<nDigs[iCh];iDig++) {
212 Int_t charge = fRenDig[iCh][iDig]->GetUniqueID();
213 Int_t color = charge/sampleCol;if(color>=gStyle->GetNumberOfColors()) color = gStyle->GetNumberOfColors()-1;
214 fRenDig[iCh][iDig]->SetFillColor(gStyle->GetColorPalette(color));
215 fRenDig[iCh][iDig]->Draw();
216 fBox[iCh][iDig]->Draw();
217 }
06a9f120 218 }
219 }
64d57cb0 220
221 if(fEsdFile){if(fStEsd =="ON") fRenTxC[iCh]->Draw();}
222
223 if(fHitFile){
224 if(fStHitMip=="ON") fRenMip[iCh]->Draw();
225 if(fStHitFee=="ON") fRenFee[iCh]->Draw();
226 if(fStHitCko=="ON") fRenCko[iCh]->Draw();
227 }
228
229 if(fEsdFile){if(fStEsd =="ON") fRenRin[iCh]->Draw();}
230 if(fCluFile){if(fStClu =="ON") fRenClu[iCh]->Draw();}
e9f11028 231 gPad->SetEditable(kFALSE);
232 }//chambers loop
64d57cb0 233
e9f11028 234 fCanvas->cd(3); gPad->Clear(); DrawLegend();
45b05be5 235
236 fCanvas->cd(7);
237
64d57cb0 238 if(fHitFile){
239 fHitMipBok->SetTitle(Form("Mips %s",fStHitMip.Data())); fHitMipBok->Modified();
240 fHitCkoBok->SetTitle(Form("Ckov %s",fStHitCko.Data())); fHitCkoBok->Modified();
241 fHitFeeBok->SetTitle(Form("Fdbk %s",fStHitFee.Data())); fHitFeeBok->Modified();
242 }
45b05be5 243 if(fDigFile){fDigBok->SetTitle(fStDig); fDigBok->Modified();}
244 if(fCluFile){fCluBok->SetTitle(fStClu); fCluBok->Modified();}
245 if(fEsdFile){fEsdBok->SetTitle(fStEsd); fEsdBok->Modified();}
246
e9f11028 247}//Draw()
248//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
249void RenderHit(TClonesArray *pHitLst)
250{//used by ReadEvent() and SimulateEvent() to render hits to polymarker structures, one per chamber
b735cc6c 251 if(pHitLst->GetEntries()!=116) return;
e9f11028 252 for(Int_t iHit=0;iHit<pHitLst->GetEntries();iHit++){ //hits loop
253 AliHMPIDHit *pHit = (AliHMPIDHit*)pHitLst->At(iHit); Int_t ch=pHit->Ch(); Float_t x=pHit->LorsX(); Float_t y=pHit->LorsY(); //get current hit
254 switch(pHit->Pid()){
255 case 50000050: fRenCko[ch]->SetNextPoint(x,y);break;
256 case 50000051: fRenFee[ch]->SetNextPoint(x,y);break;
257 default: fRenMip[ch]->SetNextPoint(x,y);break;
258 }//switch hit PID
64d57cb0 259// Printf("----------ihit %i ch %i chhit %i MIP %i CKO %i FEE %i",iHit,ch,pHit->Pid());
e9f11028 260 }//hits loop for this entry
261}//RenderHits()
262//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
e4290ede 263void RenderDig(TObjArray *pDigLst)
264{//used by ReadEvent() and SimulateEvent() to render digs to Tbox structures, one per chamber
265 for(Int_t iCh=0;iCh<=6;iCh++){ //chambers loop
266 TClonesArray *pDigCham=(TClonesArray*)pDigLst->At(iCh); //get digs list for this chamber
06a9f120 267 nDigs[iCh] = 0;
66298970 268 fTotPads[iCh] = pDigCham->GetEntries();
e4290ede 269 for(Int_t iDig=0;iDig<pDigCham->GetEntries();iDig++){ //digs loop
270 AliHMPIDDigit *pDig = (AliHMPIDDigit*)pDigCham->At(iDig); Float_t x=pDig->LorsX(); Float_t y=pDig->LorsY(); //get current hit
06a9f120 271 fRenDig[iCh][iDig]->SetX1(x-0.5*AliHMPIDParam::SizePadX());
272 fRenDig[iCh][iDig]->SetX2(x+0.5*AliHMPIDParam::SizePadX());
273 fRenDig[iCh][iDig]->SetY1(y-0.5*AliHMPIDParam::SizePadY());
274 fRenDig[iCh][iDig]->SetY2(y+0.5*AliHMPIDParam::SizePadY());
275 fRenDig[iCh][iDig]->SetUniqueID((Int_t)pDig->Q());
276 fBox[iCh][iDig]->SetX1(x-0.5*AliHMPIDParam::SizePadX());
277 fBox[iCh][iDig]->SetX2(x+0.5*AliHMPIDParam::SizePadX());
278 fBox[iCh][iDig]->SetY1(y-0.5*AliHMPIDParam::SizePadY());
279 fBox[iCh][iDig]->SetY2(y+0.5*AliHMPIDParam::SizePadY());
280 nDigs[iCh]++;
45b05be5 281 }//Digit loop
e4290ede 282 }//hits loop for this entry
283}//RenderHits()
284//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
285void RenderClu(TObjArray *pClus)
e9f11028 286{//used by ReadEvent() and SimulateEvent() to render clusters to polymarker structures, one per chamber
287 for(Int_t iCh=0;iCh<=6;iCh++){ //chambers loop
288 TClonesArray *pClusCham=(TClonesArray*)pClus->At(iCh); //get clusters list for this chamber
66298970 289 fTotClus[iCh] = pClusCham->GetEntries();
e9f11028 290 for(Int_t iClu=0;iClu<pClusCham->GetEntries();iClu++){ //clusters loop
291 AliHMPIDCluster *pClu = (AliHMPIDCluster*)pClusCham->At(iClu); //get current cluster
64d57cb0 292 fRenClu[iCh]->SetNextPoint(pClu->X(),pClu->Y());
45b05be5 293// Printf("RenderClu: ch %i x %f y %f",iCh,pClu->X(),pClu->Y());
294 }//cluster loop
295 }//chamber loop for this entry
e9f11028 296}//RenderClus()
297//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6e06db1d 298void RenderEsd(AliESDEvent *pEsd)
e9f11028 299{//used by ReadEvent() or SimulateEvent() to render ESD to polymarker structures for rings and intersections one per chamber
300 AliHMPIDRecon rec;
301 for(Int_t iTrk=0;iTrk<pEsd->GetNumberOfTracks();iTrk++){//tracks loop to collect cerenkov rings and intersection points
302 AliESDtrack *pTrk=pEsd->GetTrack(iTrk); Int_t ch=pTrk->GetHMPIDcluIdx(); //get track and chamber intersected by it
303 if(ch<0) continue; //this track does not intersect any chamber
304 Float_t thRa,phRa,xRa,yRa; pTrk->GetHMPIDtrk(xRa,yRa,thRa,phRa); //get info on current track
e4290ede 305 ch/=1000000;
e9f11028 306 Float_t xPc=0,yPc=0; AliHMPIDTracker::IntTrkCha(pTrk,xPc,yPc); //find again intersection of track with PC--> it is not stored in ESD!
64d57cb0 307 fRenTxC[ch]->SetNextPoint(xPc,yPc); //add this intersection point
e9f11028 308 Float_t ckov=pTrk->GetHMPIDsignal(); //get ckov angle stored for this track
309 if(ckov>0){
310 rec.SetTrack(xRa,yRa,thRa,phRa);
06a9f120 311 for(Int_t j=0;j<500;j++){
312 TVector2 pos; pos=rec.TracePhot(ckov,j*6.28/500.);
ae5a42aa 313 if(!AliHMPIDParam::IsInDead(pos.X(),pos.Y())) fRenRin[ch]->SetNextPoint(pos.X(),pos.Y());
e9f11028 314 }
315 }//if ckov is valid
316 }//tracks loop
317}//RenEsd()
a1d55ff3 318//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6e06db1d 319void SimulateEsd(AliESDEvent *pEsd)
a1d55ff3 320{
321 TParticle part; TLorentzVector mom;
50e69536 322 for(Int_t iTrk=0;iTrk<100;iTrk++){//stack loop
45b05be5 323 Printf("SimulateEsd: kProton %i",kProton);
a1d55ff3 324 part.SetPdgCode(kProton);
50e69536 325 part.SetProductionVertex(0,0,0,0);
326 Double_t eta= -0.2+gRandom->Rndm()*0.4; //rapidity is random [-0.2,+0.2]
327 Double_t phi= gRandom->Rndm()*60.*TMath::DegToRad(); //phi is random [ 0 , 60 ] degrees
328 mom.SetPtEtaPhiM(5,eta,phi,part.GetMass());
a1d55ff3 329 part.SetMomentum(mom);
330 AliESDtrack trk(&part);
331 pEsd->AddTrack(&trk);
332 }//stack loop
333}//EsdFromStack()
334//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6e06db1d 335void SimulateHits(AliESDEvent *pEsd, TClonesArray *pHits)
e9f11028 336{//used by SimulateEvent to simulate hits out from provided ESD
50e69536 337 const Int_t kCerenkov=50000050;
338 const Int_t kFeedback=50000051;
f3bae3e2 339
a1d55ff3 340 AliHMPIDRecon rec;
e9f11028 341 Float_t eMip=200e-9,ePho=7.5e-9;
a591e55f 342 Int_t hc=0;
a1d55ff3 343 for(Int_t iTrk=0;iTrk<pEsd->GetNumberOfTracks();iTrk++){//tracks loop
344 AliESDtrack *pTrk=pEsd->GetTrack(iTrk);
e9f11028 345 Float_t xRa,yRa;
346 Int_t ch=AliHMPIDTracker::IntTrkCha(pTrk,xRa,yRa);
a1d55ff3 347 if(ch<0) continue; //this track does not hit HMPID
50e69536 348 Float_t beta = pTrk->GetP()/(TMath::Sqrt(pTrk->GetP()*pTrk->GetP()+0.938*0.938));
349 Float_t ckov=TMath::ACos(1./(beta*1.292));
a1d55ff3 350
e9f11028 351 Float_t theta,phi,xPc,yPc,; pTrk->GetHMPIDtrk(xPc,yPc,theta,phi); rec.SetTrack(xRa,yRa,theta,phi);
a1d55ff3 352
ae5a42aa 353 if(!AliHMPIDParam::IsInDead(xPc,yPc)) new((*pHits)[hc++]) AliHMPIDHit(ch,eMip,kProton ,iTrk,xPc,yPc); //mip hit
50e69536 354 Int_t nPhots = (Int_t)(20.*TMath::Power(TMath::Sin(ckov),2)/TMath::Power(TMath::Sin(TMath::ACos(1./1.292)),2));
355 for(int i=0;i<nPhots;i++){
a591e55f 356 TVector2 pos;
357 pos=rec.TracePhot(ckov,gRandom->Rndm()*TMath::TwoPi());
ae5a42aa 358 if(!AliHMPIDParam::IsInDead(pos.X(),pos.Y())) new((*pHits)[hc++]) AliHMPIDHit(ch,ePho,kCerenkov,iTrk,pos.X(),pos.Y());
a1d55ff3 359 } //photon hits
e9f11028 360 for(int i=0;i<3;i++){//feedback photons
361 Float_t x=gRandom->Rndm()*160; Float_t y=gRandom->Rndm()*150;
ae5a42aa 362 if(!AliHMPIDParam::IsInDead(x,y)) new((*pHits)[hc++]) AliHMPIDHit(ch,ePho,kFeedback,iTrk,x,y); //feedback hits
e9f11028 363 }//photon hits loop
a1d55ff3 364 }//tracks loop
e9f11028 365}//SimulateHits()
a1d55ff3 366//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
c56e0a52 367void DispTB(TString t0,TString t1,TString t2,TString t3)
368{
369 fCanvasImp->SetStatusText(t0,0);
370 fCanvasImp->SetStatusText(t1,1);
371 fCanvasImp->SetStatusText(t2,2);
372 fCanvasImp->SetStatusText(t3,3);
373}
374//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
b735cc6c 375void DisplayInfo(Int_t evt,Int_t px, Int_t py)
66298970 376{
c56e0a52 377 if(!gPad) return;
64d57cb0 378 TVirtualPad *pPad=gPad->GetSelectedPad();
379 Int_t padN = pPad->GetNumber()-1;
380 if(padN<0 || padN>8) return;
381 Int_t ch,pc,padX,padY;
382 ch = fChamN[padN];
383 if(ch<0) return;
384 TString text0,text1,text2,text3;
385
386 Float_t x=pPad->AbsPixeltoX(px); Float_t y=pPad->AbsPixeltoY(py);
387 fParam->Lors2Pad(x,y,pc,padX,padY);
388 TVector3 xyz=fParam->Lors2Mars(ch,x,y);
389
390 if(padX>=0&&padY>=0) {
391 text0.Append(Form("Pad(%i,%i)-LORS(%6.2f,%6.2f)-MARS(%7.2f,%7.2f,%7.2f)",padX,padY,x,y,xyz.X(),xyz.Y(),xyz.Z()));
392 text1.Append(Form("Module %i Sector %i",ch,pc));
c56e0a52 393 text2="";
64d57cb0 394 text3.Append(Form("Pads = %i - Clusters = %i - Multiplicity %5.2f%%",fTotPads[ch],fTotClus[ch],100.*fTotPads[ch]/(144.*160.)));
395 }
396
66298970 397 TObject *obj = fCanvas->GetSelected();
398 TString name = obj->GetName();
b735cc6c 399
400// Find object DIGIT
c56e0a52 401
b735cc6c 402 if(name=="") {DispTB(text0,text1,text2,text3);return;} // TLatex not interesting
c56e0a52 403
66298970 404 if(name.Contains("TBox")) {
64d57cb0 405 TBox *box = (TBox*)obj;
406 if(box->GetUniqueID()==0) return; // just black frame hit!
407 text2.Append(Form("charge = %i ADC",box->GetUniqueID()));
b735cc6c 408 DispTB(text0,text1,text2,text3);
409 return;
410 }
64d57cb0 411//
b735cc6c 412// Find object HITs CLUSTER TRACK and RING (based on TPolyMarker and symbol)
64d57cb0 413//
b735cc6c 414 TPolyMarker *b = (TPolyMarker*)obj;
64d57cb0 415
b735cc6c 416 const Int_t big = 9999;
64d57cb0 417
b735cc6c 418 // check if point is near one of the points
419 Int_t distance = big;
420 Int_t index=0;
64d57cb0 421
b735cc6c 422 Double_t *xPol = b->GetX();
423 Double_t *yPol = b->GetY();
64d57cb0 424
b735cc6c 425 for(Int_t i=0;i<b->Size();i++) {
426 Int_t pxp = pPad->XtoAbsPixel(pPad->XtoPad(xPol[i]));
427 Int_t pyp = pPad->YtoAbsPixel(pPad->YtoPad(yPol[i]));
428 Int_t d = TMath::Abs(pxp-px) + TMath::Abs(pyp-py);
429 if (d < distance) {distance = d; index=i;}
430 }
64d57cb0 431
b735cc6c 432 Int_t symbol = b->GetMarkerStyle();
433
434 // kOpenTriangleUp Hit Mip
435 // kOpenCircle Hit Ckov
436 // kOpenDiamond Hit Feedback
437 // kStar Cluster
438 // kPlus Track
439 // kFullDotSmall Ring
440
441 // Case Hit Mip of Hit Ckov or Hit Feedback
442 if(symbol==kHitMip || symbol==kHitCko || symbol==kHitFee) {
443 if(evt!=kButton1Down) return;
c56e0a52 444 TString nameHit;
445 Int_t iCko[7]={0,0,0,0,0,0,0};
446 Int_t iFee[7]={0,0,0,0,0,0,0};
447 Int_t iMip[7]={0,0,0,0,0,0,0};
448 Int_t iHit;
449 Int_t chHit;
450 Int_t indHit=0;
451
b735cc6c 452 Int_t indTrk = b->GetUniqueID(); // track index
453 for(Int_t iEnt=0;iEnt<fHitTree->GetEntries();iEnt++){//entries loop
454 fHitTree->GetEntry(iEnt);
455 for(iHit=0;iHit<fHitLst->GetEntries();iHit++) { //hits loop
456 AliHMPIDHit *pHit = (AliHMPIDHit*)fHitLst->At(iHit);
457 chHit = pHit->Ch();
458 Int_t pid = pHit->Pid();
459 if(pid==50000050) iCko[chHit]++;
460 else if(pid==50000051) iFee[chHit]++;
461 else iMip[chHit]++;
462
463 if(symbol==kHitMip && ch==chHit && index==iMip[chHit]-1) {indTrk=iEnt;indHit = iHit;break;}
464 if(symbol==kHitCko && ch==chHit && index==iCko[chHit]-1) {indTrk=iEnt;indHit = iHit;break;}
465 if(symbol==kHitFee && ch==chHit && index==iFee[chHit]-1) {indTrk=iEnt;indHit = iHit;break;}
466 }
467 }
468 fHitTree->GetEntry(indTrk);
469 AliHMPIDHit *pHit = (AliHMPIDHit*)fHitLst->At(indHit);
470
471 Float_t x=pHit->LorsX();
472 Float_t y=pHit->LorsY();
473 Float_t charge = pHit->Q();
474 if(pHit->Pid()==50000050) {nameHit = " Cherenkov Photon ";}
475 else if(pHit->Pid()==50000051) {nameHit = " Feedback Photon ";}
476 else if(fPdg->GetParticle(pHit->Pid())) nameHit = fPdg->GetParticle(pHit->Pid())->GetName();
477 text0="";text0.Append(Form("Hit x %6.2f y %6.2f",x,y));
478 text2="";text2.Append(Form("Q = %7.2f ADC",charge));
479 text3="";text3="Particle: "+ nameHit;
480 } // Hit
481 else if (symbol==kCluster) {
482 TClonesArray *pClusCham=(TClonesArray*)fCluLst->At(ch); //get clusters list for this chamber
483 AliHMPIDCluster *pClu = (AliHMPIDCluster*)pClusCham->At(index); //get current cluster
484 text0="";text0.Append(Form("CLUSTER: x %6.2f y %6.2f",pClu->X(),pClu->Y()));
485 text2="";text2.Append(Form("charge = %i ADC",(Int_t)pClu->Q()));
64d57cb0 486 }
b735cc6c 487 else if (symbol==kTrack) {
488 AliESDtrack *pTrk=fEsd->GetTrack(index);
489 Float_t thRa,phRa,xRa,yRa; pTrk->GetHMPIDtrk(xRa,yRa,thRa,phRa);
490 Float_t xPc,yPc; AliHMPIDTracker::IntTrkCha(pTrk,xPc,yPc);
491 text0="";text0.Append(Form("TRACK: x %6.2f y %6.2f at PC plane",xPc,yPc));
492 text2="";text2.Append(Form("p = %7.2f GeV/c",pTrk->GetP()));
493 Float_t ckov=pTrk->GetHMPIDsignal();
494 if(ckov>0){
495 Float_t x,y;Int_t q,nacc; pTrk->GetHMPIDmip(x,y,q,nacc);
496 text3="";text3.Append(Form("Theta Cherenkov %5.3f with %i photons",pTrk->GetHMPIDsignal(),nacc));
497 }
66298970 498 }
64d57cb0 499//Update toolbar status
c56e0a52 500
501 DispTB(text0,text1,text2,text3);
66298970 502}
503//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
504void CloseInfo()
505{
506}
507//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
e9f11028 508void DoZoom(Int_t evt, Int_t px, Int_t py, TObject *)
a1d55ff3 509{
66298970 510// Printf(" px %i py%i event %i",px,py,evt);
b735cc6c 511 if(evt==kMouseMotion||evt==kButton1Down) DisplayInfo(evt,px,py);
66298970 512 if(evt==11) CloseInfo();
64d57cb0 513 if(evt!=5 && evt!=6) return; //5- zoom in 6-zoom out
8282f9d0 514 const Int_t minZoom=64;
515 const Int_t maxZoom=2;
06a9f120 516 static Int_t zoom[7]={64,64,64,64,64,64,64}; //zoom level
8282f9d0 517
d73ece6a 518 // if(!obj->IsA()->InheritsFrom("TPad")) return; //current object is not pad
50e69536 519 TVirtualPad *pPad=gPad->GetSelectedPad();
06a9f120 520 Int_t padN = pPad->GetNumber()-1;
521 if(padN<0 || padN>8) return;
522
66298970 523 Int_t iCh = fChamN[padN];
06a9f120 524 if(iCh < 0) return;
525
526 if(evt==5&&zoom[iCh]==maxZoom) return;
527 if(evt==6&&zoom[iCh]==minZoom) return;
8282f9d0 528
529 Float_t x=pPad->AbsPixeltoX(px); Float_t y=pPad->AbsPixeltoY(py);
6ed6a312 530
06a9f120 531 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 532 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 533 if(zoom[iCh]==minZoom) pPad->Range(-10,-10,AliHMPIDParam::SizeAllX()+5,AliHMPIDParam::SizeAllY()+5);
534 ((TCanvas *)gTQSender)->SetTitle(Form("zoom x%i",minZoom/zoom[iCh]));
8282f9d0 535 pPad->Modified();
536 pPad->Update();
a1d55ff3 537}
8282f9d0 538//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
e9f11028 539void ReadEvent()
540{//used by NextEvent() to read curent event and construct all render elements
541 if(fNevt && fEvt>=fNevt) fEvt=0; //loop over max event
45b05be5 542 if(fNevt && fEvt<0) fEvt=fNevt-1; //loop over max event
d73ece6a 543
e9f11028 544 if(fHitFile){
545 if(fHitTree) delete fHitTree; fHitTree=(TTree*)fHitFile->Get(Form("Event%i/TreeH",fEvt));
546
547 fHitTree->SetBranchAddress("HMPID",&fHitLst);
548 for(Int_t iEnt=0;iEnt<fHitTree->GetEntries();iEnt++){
b735cc6c 549 fHitTree->GetEntry(iEnt);
e9f11028 550 RenderHit(fHitLst);
551 }//prim loop
552 }//if hits file
e4290ede 553
554 if(fDigFile){
555 if(fDigTree) delete fDigTree; fDigTree=(TTree*)fDigFile->Get(Form("Event%i/TreeD",fEvt));
556 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) fDigTree->SetBranchAddress(Form("HMPID%i",iCh),&(*fDigLst)[iCh]);
557 fDigTree->GetEntry(0);
558 RenderDig(fDigLst);
559 }//if digs file
560
e9f11028 561 if(fCluFile){
562 if(fCluTree) delete fCluTree; fCluTree=(TTree*)fCluFile->Get(Form("Event%i/TreeR",fEvt));
ae5a42aa 563 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) fCluTree->SetBranchAddress(Form("HMPID%i",iCh),&(*fCluLst)[iCh]);
e9f11028 564 fCluTree->GetEntry(0);
e4290ede 565 RenderClu(fCluLst);
e9f11028 566 }//if clus file
567
568 if(fEsdFile){//if ESD file open
569 fEsdTree->GetEntry(fEvt);
570 RenderEsd(fEsd);
571 }//if ESD file
572}//ReadEvent()
d73ece6a 573//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
e9f11028 574void SimulateEvent()
575{// used by NextEvent() to simulate all info
576 AliCDBManager* pCDB = AliCDBManager::Instance(); pCDB->SetDefaultStorage("local://$HOME"); pCDB->SetRun(0);
577 AliCDBEntry *pNmeanEnt=pCDB->Get("HMPID/Calib/Nmean");
578
579 SimulateEsd(fEsd);
580 SimulateHits(fEsd,fHitLst);
45b05be5 581 AliHMPIDv2::Hit2Sdi(fHitLst,fSdiLst);
e9f11028 582 AliHMPIDDigitizer::Sdi2Dig(fSdiLst,fDigLst);
583 AliHMPIDReconstructor::Dig2Clu(fDigLst,fCluLst);
584 AliHMPIDTracker::Recon(fEsd,fCluLst,(TObjArray*)pNmeanEnt->GetObject());
585
586 RenderHit(fHitLst);
e4290ede 587 RenderClu(fCluLst);
e9f11028 588 RenderEsd(fEsd);
589}//SimulateEvent()
d73ece6a 590//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
66298970 591void CheckStatus()
592{
64d57cb0 593 if(fHitFile){
594 if(fStHitMip=="OFF") {fHitMipBok->SetFillColor(kRed);} else {fHitMipBok->SetFillColor(18);}
595 if(fStHitCko=="OFF") {fHitCkoBok->SetFillColor(kRed);} else {fHitCkoBok->SetFillColor(18);}
596 if(fStHitFee=="OFF") {fHitFeeBok->SetFillColor(kRed);} else {fHitFeeBok->SetFillColor(18);}
597 }
598 if(fDigFile){if(fStDig =="OFF") {fDigBok->SetFillColor(kRed);} else {fDigBok->SetFillColor(18);}}
599 if(fCluFile){if(fStClu =="OFF") {fCluBok->SetFillColor(kRed);} else {fCluBok->SetFillColor(18);}}
600 if(fEsdFile){if(fStEsd =="OFF") {fEsdBok->SetFillColor(kRed);} else {fEsdBok->SetFillColor(18);}}
66298970 601}
602//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
45b05be5 603void GetEvent()
d73ece6a 604{
e9f11028 605 ClearRenders();
06a9f120 606 CheckStatus();
e9f11028 607 switch(fType){
608 case 1: ReadEvent();break;
609// case 2: ReadCosmic(); break;
610 case 3: SimulateEvent(); break;
611 default: return;
612 }
613 Draw();
d73ece6a 614}
615//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
45b05be5 616void NextEvent()
617{
618 fTimeArrow = 1;
619 fEvt+=fTimeArrow;
620 GetEvent();
621}
622//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
623void PrevEvent()
624{
625 fTimeArrow = -1;
626 fEvt+=fTimeArrow;
627 GetEvent();
628}
629//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
630void End()
631{
632 gSystem->Exit(0);
633}
634//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
e9f11028 635void Hdisp()
636{//display events from files if any in current directory or simulated events
64d57cb0 637
66298970 638 fParam=AliHMPIDParam::Instance(); // first invocation of AliHMPIDParam to initialize geometry...
64d57cb0 639 fPdg = TDatabasePDG::Instance(); // first invocation of TDatabasePDG to retrieve particle infos...
640
e9f11028 641 CreateContainers();
642 CreateRenders();
d73ece6a 643
e9f11028 644 TString title="Session with";
645 if(gSystem->IsFileInIncludePath("HMPID.Hits.root")){// tries to open hits
646 fHitFile=TFile::Open("HMPID.Hits.root"); fNevt=fHitFile->GetNkeys(); fType=1; title+=Form(" HITS-%i ",fNevt);
647 }
6b155609 648
e9f11028 649 if(gSystem->IsFileInIncludePath("HMPID.Digits.root")){// tries to open clusters
e4290ede 650 fDigFile=TFile::Open("HMPID.Digits.root"); fNevt=fDigFile->GetNkeys(); fType=1; title+=Form(" DIGITS-%i ",fNevt);
651 }
6b155609 652
e9f11028 653 if(gSystem->IsFileInIncludePath("HMPID.RecPoints.root")){// tries to open clusters
654 fCluFile=TFile::Open("HMPID.RecPoints.root"); fNevt=fCluFile->GetNkeys(); fType=1; title+=Form(" CLUSTERS-%i ",fNevt);
e4290ede 655 }
50e69536 656
e9f11028 657 if(gSystem->IsFileInIncludePath("AliESDs.root")){
e4290ede 658 fEsdFile=TFile::Open("AliESDs.root");
659 fEsdTree=(TTree*)fEsdFile->Get("esdTree");
660 fEsd->ReadFromTree(fEsdTree); fEsd->GetStdContent(); //clm: new ESD schema: see Task Force meeting 20th June, 2007
661 fNevt=fEsdTree->GetEntries(); fType=1; title+=Form(" ESD-%i ",fNevt);
662
663 //clm: we need to set the magnetic field
664 if(gSystem->IsFileInIncludePath("galice.root")){
665 if(gAlice) delete gAlice;
666 gAL=AliRunLoader::Open();
667 gAL->LoadgAlice();
668 AliHMPIDTracker::SetFieldMap(gAL->GetAliRun()->Field(),kTRUE);
669 }else{
670 Printf("=============== NO galice file! Magnetic field for ESD tracking is: %f ===============",AliTracker::GetBz());
671 }
672
e9f11028 673 }
674
675 if(gSystem->IsFileInIncludePath("cosmic.root")){ //clm: Check if cosmic file is in the folder
676 fCosFile=TFile::Open("cosmic.root"); fCosTree=(TTree*)fCosFile->Get("cosmic"); fNevt=fCosTree->GetEntries(); fType=2;
677 fCosTree->SetBranchAddress("Digs",&fDigLst); fCosTree->SetBranchAddress("Clus",&fCluLst);
678 }
679
c56e0a52 680 fCanvas=new TCanvas("all","",-1024,768);fCanvas->SetWindowSize(1024,768);
66298970 681 fCanvasImp = fCanvas->GetCanvasImp();
682 fCanvasImp->ShowStatusBar();
45b05be5 683 fCanvas->Divide(3,3,0,0);// pAll->ToggleEditor();
e9f11028 684 fCanvas->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",0,0,"DoZoom(Int_t,Int_t,Int_t,TObject*)");
685 fCanvas->cd(7);
06a9f120 686 gStyle->SetPalette(1,0);
e9f11028 687 switch(fType){
688 case 1: fCanvas->SetTitle(title.Data());
45b05be5 689 TButton *pNxtBtn = new TButton("Next" ,"NextEvent()" ,0.0,0.0,0.3,0.1); pNxtBtn->Draw();
690 TButton *pPrvBtn = new TButton("Previous" ,"PrevEvent()" ,0.3,0.0,0.6,0.1); pPrvBtn->Draw();
691 if(fHitFile){TButton *pHitBtn = new TButton("Print hits","PrintHits()" ,0.0,0.2,0.3,0.3); pHitBtn->Draw();}
692 if(fDigFile){TButton *pDigBtn = new TButton("Print digs","PrintDigs()" ,0.0,0.4,0.3,0.5); pDigBtn->Draw();}
693 if(fCluFile){TButton *pCluBtn = new TButton("Print clus","PrintClus()" ,0.0,0.6,0.3,0.7); pCluBtn->Draw();}
694 if(fEsdFile){TButton *pEsdBtn = new TButton("Print ESD ","PrintEsd()" ,0.0,0.8,0.3,0.9); pEsdBtn->Draw();}
06a9f120 695 if(fHitFile){ fHitMipBok = new TButton(Form("Mip %s",fStHitMip.Data()),"SwitchHitMip()",0.3,0.16,0.6,0.22); fHitMipBok->Draw();}
45b05be5 696 if(fHitFile){ fHitCkoBok = new TButton(Form("Ckov %s",fStHitCko.Data()),"SwitchHitCko()",0.3,0.22,0.6,0.28); fHitCkoBok->Draw();}
697 if(fHitFile){ fHitFeeBok = new TButton(Form("Fdbk %s",fStHitFee.Data()),"SwitchHitFee()",0.3,0.28,0.6,0.34); fHitFeeBok->Draw();}
698 if(fDigFile){ fDigBok = new TButton(fStDig ,"SwitchDigs()" ,0.3,0.4,0.6,0.5); fDigBok->Draw();}
699 if(fCluFile){ fCluBok = new TButton(fStClu ,"SwitchClus()" ,0.3,0.6,0.6,0.7); fCluBok->Draw();}
700 if(fEsdFile){ fEsdBok = new TButton(fStEsd ,"SwitchEsd()" ,0.3,0.8,0.6,0.9); fEsdBok->Draw();}
06a9f120 701
702 if(fHitFile){TButton *fHitMipOnly = new TButton(" Only ","OnlyHitMip()",0.6,0.16,0.9,0.22); fHitMipOnly->Draw();}
703 if(fHitFile){TButton *fHitCkoOnly = new TButton(" Only ","OnlyHitCko()",0.6,0.22,0.9,0.28); fHitCkoOnly->Draw();}
704 if(fHitFile){TButton *fHitFeeOnly = new TButton(" Only ","OnlyHitFee()",0.6,0.28,0.9,0.34); fHitFeeOnly->Draw();}
705 if(fDigFile){TButton *fDigOnly = new TButton(" Only ","OnlyDigs()" ,0.6,0.40,0.9,0.50); fDigOnly->Draw();}
706 if(fCluFile){TButton *fCluOnly = new TButton(" Only ","OnlyClus()" ,0.6,0.60,0.9,0.70); fCluOnly->Draw();}
707 if(fEsdFile){TButton *fEsdOnly = new TButton(" Only ","OnlyEsd()" ,0.6,0.80,0.9,0.90); fEsdOnly->Draw();}
66298970 708 TButton *pAll = new TButton(" ALL ","All()" ,0.5,0.90,0.7,1.00); pAll->Draw();
06a9f120 709
710 TButton *pEnd = new TButton("Quit" ,"End()" ,0.6,0.0,0.9,0.1); pEnd->Draw();
e9f11028 711 break;
712 case 2: fCanvas->SetTitle("COSMIC");
45b05be5 713 TButton *pCosBtn = new TButton("Next" ,"NextEvent()",0.0,0.0,0.3,0.1); pCosBtn->Draw();
e9f11028 714
715 break;
716 case 3: fCanvas->SetTitle("SIMULATION");
45b05be5 717 TButton *pSimBtn = new TButton("Simulate" ,"NextEvent()",0.0,0.0,0.3,0.1); pSimBtn->Draw();
718 TButton *pHitBtn = new TButton("Print hits","PrintHits()",0.0,0.2,0.3,0.3); pHitBtn->Draw();
719 TButton *pDigBtn = new TButton("Print digs","PrintDigs()",0.0,0.4,0.3,0.5); pDigBtn->Draw();
720 TButton *pCluBtn = new TButton("Print clus","PrintClus()",0.0,0.6,0.3,0.7); pCluBtn->Draw();
721 TButton *pEsdBtn = new TButton("Print ESD" ,"PrintEsd()" ,0.0,0.8,0.3,0.9); pEsdBtn->Draw();
722 if(fHitFile){ fHitMipBok = new TButton(Form("Mips %s",fStHitMip.Data()),"SwitchHitMip()",0.3,0.16,0.6,0.22); fHitMipBok->Draw();}
723 if(fHitFile){ fHitCkoBok = new TButton(Form("Ckov %s",fStHitCko.Data()),"SwitchHitCko()",0.3,0.22,0.6,0.28); fHitCkoBok->Draw();}
724 if(fHitFile){ fHitFeeBok = new TButton(Form("Fdbk %s",fStHitFee.Data()),"SwitchHitFee()",0.3,0.28,0.6,0.34); fHitFeeBok->Draw();}
725 if(fDigFile){ fDigBok = new TButton(fStDig ,"SwitchDigs()" ,0.3,0.4,0.6,0.5); fDigBok->Draw();}
726 if(fCluFile){ fCluBok = new TButton(fStClu ,"SwitchClus()" ,0.3,0.6,0.6,0.7); fCluBok->Draw();}
727 if(fEsdFile){ fEsdBok = new TButton(fStEsd ,"SwitchEsd()" ,0.3,0.8,0.6,0.9); fEsdBok->Draw();}
06a9f120 728
729 if(fHitFile){TButton *fHitMipOnly = new TButton(" Only ","OnlyHitMip()",0.6,0.16,0.9,0.22); fHitMipOnly->Draw();}
730 if(fHitFile){TButton *fHitCkoOnly = new TButton(" Only ","OnlyHitCko()",0.6,0.22,0.9,0.28); fHitCkoOnly->Draw();}
731 if(fHitFile){TButton *fHitFeeOnly = new TButton(" Only ","OnlyHitFee()",0.6,0.28,0.9,0.34); fHitFeeOnly->Draw();}
732 if(fDigFile){TButton *fDigOnly = new TButton(" Only ","OnlyDigs()" ,0.6,0.40,0.9,0.50); fDigOnly->Draw();}
733 if(fCluFile){TButton *fCluOnly = new TButton(" Only ","OnlyClus()" ,0.6,0.60,0.9,0.70); fCluOnly->Draw();}
734 if(fEsdFile){TButton *fEsdOnly = new TButton(" Only ","OnlyEsd()" ,0.6,0.80,0.9,0.90); fEsdOnly->Draw();}
66298970 735 TButton *pSimAll = new TButton(" ALL ","All()" ,0.5,0.90,0.7,1.00); pSimAll->Draw();
e9f11028 736 break;
737 }
738
0112d781 739 NextEvent();
e9f11028 740
741}//Hdisp()
742//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
45b05be5 743void SwitchHitMip()
744{
745 fStHitMip=(fStHitMip=="OFF")? "ON":"OFF";
746 GetEvent();
747}
748//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
749void SwitchHitCko()
750{
751 fStHitCko=(fStHitCko=="OFF")? "ON":"OFF";
752 GetEvent();
753}
754//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
755void SwitchHitFee()
756{
757 fStHitFee=(fStHitFee=="OFF")? "ON":"OFF";
758 GetEvent();
759}
760//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
761void SwitchDigs()
762{
763 fStDig=(fStDig=="OFF")? "ON":"OFF";
764 GetEvent();
765}
766//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
767void SwitchClus()
768{
769 fStClu=(fStClu=="OFF")? "ON":"OFF";
770 GetEvent();
771}
772//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
773void SwitchEsd()
774{
775 fStEsd=(fStEsd=="OFF")? "ON":"OFF";
06a9f120 776 GetEvent();
777}
778//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
779void AllNo()
780{
64d57cb0 781 if(fHitFile) {
782 fStHitMip = "OFF";
783 fStHitCko = "OFF";
784 fStHitFee = "OFF";
785 }
786 if(fDigFile) fStDig = "OFF";
787 if(fCluFile) fStClu = "OFF";
788 if(fEsdFile) fStEsd = "OFF";
06a9f120 789}
790//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
791void AllYes()
792{
64d57cb0 793 if(fHitFile) {
794 fStHitMip = "ON";
795 fStHitCko = "ON";
796 fStHitFee = "ON";
797 }
06a9f120 798 if(fDigFile) fStDig = "ON";
799 if(fCluFile) fStClu = "ON";
800 if(fEsdFile) fStEsd = "ON";
801}
802//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
803void All()
804{
805 AllYes();
45b05be5 806 GetEvent();
807}
808//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
06a9f120 809void OnlyHitMip()
810{
811 AllNo();
812 fStHitMip = "ON";
813 GetEvent();
814}
815//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
816void OnlyHitCko()
817{
818 AllNo();
819 fStHitCko = "ON";
820 GetEvent();
821}
822//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
823void OnlyHitFee()
824{
825 AllNo();
826 fStHitFee = "ON";
827 GetEvent();
828}
829//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
830void OnlyDigs()
831{
832 AllNo();
833 fStDig = "ON";
834 GetEvent();
835}
836//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
837void OnlyClus()
838{
839 AllNo();
840 fStClu = "ON";
841 GetEvent();
842}
843//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
844void OnlyEsd()
845{
846 AllNo();
847 fStEsd = "ON";
848 GetEvent();
849}
850//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++