]>
Commit | Line | Data |
---|---|---|
86594bfc | 1 | //__________________________________________________________________________________________________ |
2 | void H_SD() | |
3 | { | |
4 | Info("H_SD","Start."); | |
5 | ||
6 | for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop | |
7 | al->GetEvent(iEventN); | |
8 | ||
9 | if(!rl->TreeH()) rl->LoadHits(); al->LoadHeader(); al->LoadKinematics();//from | |
10 | if(!rl->TreeS()) rl->MakeTree("S"); r->MakeBranch("S");//to | |
11 | ||
12 | for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop | |
13 | rl->TreeH()->GetEntry(iPrimN); | |
14 | for(Int_t iHitN=0;iHitN<r->Hits()->GetEntries();iHitN++){//hits loop ??? | |
15 | AliRICHhit *pHit=r->Hits()->At(iHitN); | |
16 | ||
17 | TVector2 x2 = r->Param()->ShiftToWirePos(r->C(pHit->C())->Glob2Loc(pHit->OutX3())); | |
18 | ||
19 | Int_t iTotQdc=r->Param()->TotQdc(x2,pHit->Eloss()); | |
20 | ||
21 | Int_t iPadXmin,iPadXmax,iPadYmin,iPadYmax; | |
22 | r->Param()->Loc2Area(x2,iPadXmin,iPadYmin,iPadXmax,iPadYmax); | |
23 | cout<<"left-down=("<<iPadXmin<<","<<iPadYmin<<") right-up=("<<iPadXmax<<','<<iPadYmax<<')'<<endl; | |
24 | for(Int_t iPadY=iPadYmin;iPadY<=iPadYmax;iPadY++) | |
25 | for(Int_t iPadX=iPadXmin;iPadX<=iPadXmax;iPadX++){ | |
26 | Double_t padQdc=iTotQdc*r->Param()->FracQdc(x2,iPadX,iPadY); | |
27 | cout<<padQdc<<endl; | |
28 | if(padQdc>0.1) r->AddSDigit(pHit->C(),iPadX,iPadY,padQdc,al->Stack()->Particle(pHit->GetTrack())->GetPdgCode(),pHit->GetTrack()); | |
29 | } | |
30 | }//hits loop | |
31 | }//prims loop | |
32 | rl->TreeS()->Fill(); | |
33 | rl->WriteSDigits("OVERWRITE"); | |
34 | }//events loop | |
35 | ||
36 | rl->UnloadHits(); al->UnloadHeader(); al->UnloadKinematics(); | |
37 | rl->UnloadSDigits(); | |
38 | Info("H_SD","Stop."); | |
39 | }//H_SD() | |
40 | //__________________________________________________________________________________________________ | |
ed3ceb24 | 41 | |
42 | Int_t countContrib[7][3]; | |
43 | ||
3b96aee8 | 44 | void ControlPlots() |
45 | { | |
46 | Int_t iChamber=1; | |
47 | ||
ed3ceb24 | 48 | TFile *pFile = new TFile("$(HOME)/plots.root","RECREATE"); |
49 | TH1F *pCqH1=new TH1F("ClusQ", "Cluster Charge all chambers;q [QDC]",r->P()->MaxQdc(),0,r->P()->MaxQdc()); | |
50 | TH1F *pCsH1=new TH1F("ClusSize","Cluster size all chambers;size [number of pads in cluster]",100,0,100); | |
51 | TH2F *pCmH2=new TH2F("ClusMap", "Cluster map;x [cm];y [cm]",1000,-r->P()->PcSizeX()/2,r->P()->PcSizeX()/2, | |
52 | 1000,-r->P()->PcSizeY()/2,r->P()->PcSizeY()/2); | |
3b96aee8 | 53 | |
ed3ceb24 | 54 | TH1F *pCqMipH1=new TH1F("MipClusQ", "MIP Cluster Charge all chambers;q [QDC]",r->P()->MaxQdc(),0,r->P()->MaxQdc()); |
55 | TH1F *pCsMipH1=new TH1F("MipClusSize","MIP Cluster size all chambers;size [number of pads in cluster]",100,0,100); | |
56 | TH2F *pCmMipH2=new TH2F("MipClusMap", "MIP Cluster map;x [cm];y [cm]",1000,-r->P()->PcSizeX()/2,r->P()->PcSizeX()/2, | |
57 | 1000,-r->P()->PcSizeY()/2,r->P()->PcSizeY()/2); | |
3b96aee8 | 58 | |
ed3ceb24 | 59 | TH1F *pCqCerH1=new TH1F("CerClusQ", "Cerenkov Cluster Charge all chambers;q [QDC]",r->P()->MaxQdc(),0,r->P()->MaxQdc()); |
60 | TH1F *pCsCerH1=new TH1F("CerClusSize","Cernekov Cluster size all chambers;size [number of pads in cluster]",100,0,100); | |
61 | TH2F *pCmCerH2=new TH2F("CerClusMap", "Cerenkov Cluster map;x [cm];y [cm]",1000,-r->P()->PcSizeX()/2,r->P()->PcSizeX()/2, | |
62 | 1000,-r->P()->PcSizeY()/2,r->P()->PcSizeY()/2); | |
63 | TH1F *pCqFeeH1=new TH1F("FeeClusQ", "Feedback Cluster Charge all chambers;q [QDC]",r->P()->MaxQdc(),0,r->P()->MaxQdc()); | |
64 | TH1F *pCsFeeH1=new TH1F("FeeClusSize","Feedback Cluster size all chambers;size [number of pads in cluster]",100,0,100); | |
65 | TH2F *pCmFeeH2=new TH2F("FeeClusMap", "Feedback Cluster map;x [cm];y [cm]",1000,-r->P()->PcSizeX()/2,r->P()->PcSizeX()/2, | |
66 | 1000,-r->P()->PcSizeY()/2,r->P()->PcSizeY()/2); | |
67 | Bool_t isClusters=!rl->LoadRecPoints(); | |
68 | r->SetTreeAddress(); | |
3b96aee8 | 69 | for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop |
70 | al->GetEvent(iEventN); | |
3b96aee8 | 71 | if(isClusters){ |
72 | rl->TreeR()->GetEntry(0); | |
73 | Int_t iTotalClusters=0; | |
ed3ceb24 | 74 | for(int i=1;i<=7;i++){//chambers loop |
75 | iTotalClusters+=r->Clusters(i)->GetEntries(); | |
76 | for(Int_t iClusterN=0;iClusterN<r->Clusters(i)->GetEntries();iClusterN++){//clusters loop | |
77 | AliRICHcluster *pClus=(AliRICHcluster*)r->Clusters(i)->At(iClusterN); | |
78 | ||
79 | countContrib[i-1][0] += pClus->Nmips(); | |
80 | countContrib[i-1][1] += pClus->Ncerenkovs(); | |
81 | countContrib[i-1][2] += pClus->Nfeedbacks(); | |
82 | ||
83 | pCqH1->Fill(pClus->Q()); | |
84 | pCsH1->Fill(pClus->Size()); | |
85 | pCmH2->Fill(pClus->X(),pClus->Y()); | |
86 | ||
87 | if(pClus->IsPureMip()){ //Pure Mips | |
88 | pCqMipH1->Fill(pClus->Q()); | |
89 | pCsMipH1->Fill(pClus->Size()); | |
90 | pCmMipH2->Fill(pClus->X(),pClus->Y()); | |
91 | } | |
92 | if(pClus->IsPureCerenkov()){ //Pure Photons | |
93 | pCqCerH1->Fill(pClus->Q()); | |
94 | pCsCerH1->Fill(pClus->Size()); | |
95 | pCmCerH2->Fill(pClus->X(),pClus->Y()); | |
96 | } | |
97 | if(pClus->IsPureFeedback()){ //Pure Feedbacks | |
98 | pCqFeeH1->Fill(pClus->Q()); | |
99 | pCsFeeH1->Fill(pClus->Size()); | |
100 | pCmFeeH2->Fill(pClus->X(),pClus->Y()); | |
101 | } | |
102 | }//clusters loop | |
103 | }//chambers loop | |
3b96aee8 | 104 | }//isClusters |
ed3ceb24 | 105 | Info("ControlPlots","Event %i processed.",iEventN); |
3b96aee8 | 106 | }//events loop |
ed3ceb24 | 107 | if(isClusters) rl->UnloadRecPoints(); |
108 | ||
109 | pFile->Write(); | |
110 | delete pFile; | |
111 | for(Int_t i=0;i<7;i++) | |
112 | cout <<" chamber " << i+1 << " n. mips " << countContrib[i][0] << " n. ckovs " << countContrib[i][1] << " n. fdbks " << countContrib[i][2] << endl; | |
3b96aee8 | 113 | }//void ControlPlots() |
114 | //__________________________________________________________________________________________________ | |
c67b2d9f | 115 | void MainTrank() |
116 | { | |
117 | TStopwatch sw;TDatime time; | |
86594bfc | 118 | H_SD(); SD_D(); AliRICHClusterFinder *z=new AliRICHClusterFinder(r); z->Exec();//delete z; |
c67b2d9f | 119 | cout<<"\nInfo in <MainTrank>: Start time: ";time.Print(); |
ed3ceb24 | 120 | cout<<"Info in <MainTrank>: Stop time: ";time.Set(); time.Print(); |
121 | cout<<"Info in <MainTrank>: Time used: ";sw.Print(); | |
c67b2d9f | 122 | } |
3b96aee8 | 123 | //__________________________________________________________________________________________________ |
124 | void sh() | |
125 | { | |
126 | if(rl->LoadHits()) return; | |
127 | ||
128 | Int_t iTotalHits=0; | |
129 | for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop | |
130 | rl->TreeH()->GetEntry(iPrimN); | |
131 | r->Hits()->Print(); | |
132 | iTotalHits+=r->Hits()->GetEntries(); | |
133 | } | |
134 | Info("sh","totally %i hits",iTotalHits); | |
135 | rl->UnloadHits(); | |
136 | } | |
137 | //__________________________________________________________________________________________________ | |
d32d34bf | 138 | void ss() |
139 | { | |
c1863e3c | 140 | if(rl->LoadSDigits()) return; |
d32d34bf | 141 | rl->TreeS()->GetEntry(0); |
142 | r->SDigits()->Print(); | |
3b96aee8 | 143 | Info("ss","totally %i sdigits",r->SDigits()->GetEntries()); |
d32d34bf | 144 | rl->UnloadSDigits(); |
145 | } | |
3b96aee8 | 146 | //__________________________________________________________________________________________________ |
c1863e3c | 147 | void sd() |
148 | { | |
149 | if(rl->LoadDigits()) return; | |
150 | rl->TreeD()->GetEntry(0); | |
3b96aee8 | 151 | Int_t iTotalDigits=0; |
152 | for(int i=1;i<=7;i++){ | |
153 | r->Digits(i)->Print(); | |
154 | iTotalDigits+=r->Digits(i)->GetEntries(); | |
155 | } | |
156 | Info("sd","totally %i digits",iTotalDigits); | |
c1863e3c | 157 | rl->UnloadDigits(); |
158 | } | |
159 | ||
160 | void sc() | |
161 | { | |
162 | if(rl->LoadRecPoints()) return; | |
c67b2d9f | 163 | r->SetTreeAddress(); |
c1863e3c | 164 | rl->TreeR()->GetEntry(0); |
165 | for(int i=1;i<=7;i++) r->Clusters(i)->Print(); | |
166 | rl->UnloadRecPoints(); | |
167 | } | |
8fc0dab8 | 168 | |
169 | Double_t r2d = TMath::RadToDeg(); | |
170 | Double_t d2r = TMath::DegToRad(); | |
171 | ||
ed3ceb24 | 172 | void DisplFast(){ AliRICHDisplFast *d = new AliRICHDisplFast(); d->Exec();} |
fa49f877 | 173 | |
174 | ||
af3d25a6 | 175 | void C_R() |
c60862bf | 176 | { |
5cb4dfc3 | 177 | AliRICHRecon *detect = new AliRICHRecon("RICH patrec algorithm","Reconstruction"); |
543d5224 | 178 | |
179 | ||
8fc0dab8 | 180 | for (int nev=0; nev< a->GetEventsPerRun(); nev++) { // Event Loop |
543d5224 | 181 | al->GetEvent(nev); |
182 | cout <<endl<< "Processing event:" <<nev<<endl; | |
5cb4dfc3 | 183 | detect->StartProcessEvent(); |
543d5224 | 184 | } // event loop |
fa49f877 | 185 | delete detect; |
543d5224 | 186 | } |
0f72f306 | 187 | //__________________________________________________________________________________________________ |
188 | void D_C() | |
189 | { | |
190 | TStopwatch sw;TDatime time; | |
543d5224 | 191 | |
0f72f306 | 192 | AliRICHClusterFinder *z=new AliRICHClusterFinder(r); z->Exec(); |
543d5224 | 193 | |
0f72f306 | 194 | cout << endl; |
195 | cout << "Info in Digits->Clusters: Start time: ";time.Print(); | |
196 | cout << "Info in Digits->Clusters: Stop time: ";time.Set(); time.Print(); | |
197 | cout << "Info in Digits->Clusters: Time used: ";sw.Print(); | |
198 | } | |
d32d34bf | 199 | //__________________________________________________________________________________________________ |
200 | void OLD_S_SD() | |
c60862bf | 201 | { |
ed3ceb24 | 202 | Info("OLD_S_SD","Start."); |
203 | rl->LoadHits(); | |
c60862bf | 204 | for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop |
ed3ceb24 | 205 | al->GetEvent(iEventN); Info("OLD_S_SD","Processing event %i",iEventN); |
c60862bf | 206 | |
543d5224 | 207 | rl->MakeTree("S"); r->MakeBranch("S"); |
d32d34bf | 208 | r->ResetSDigits(); r->ResetSpecialsOld(); |
543d5224 | 209 | |
c60862bf | 210 | for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop |
211 | rl->TreeH()->GetEntry(iPrimN); | |
af3d25a6 | 212 | for(Int_t i=0;i<r->Specials()->GetEntries();i++){//specials loop |
a239137a | 213 | Int_t padx=1+ ((AliRICHSDigit*)r->Specials()->At(i))->PadX()+r->Param()->NpadsX()/2; |
214 | Int_t pady=1+ ((AliRICHSDigit*)r->Specials()->At(i))->PadY()+r->Param()->NpadsY()/2; | |
d32d34bf | 215 | Double_t q= ((AliRICHSDigit*)r->Specials()->At(i))->QPad(); |
ed3ceb24 | 216 | |
543d5224 | 217 | Int_t hitN= ((AliRICHSDigit*)r->Specials()->At(i))->HitNumber()-1;//!!! important -1 |
218 | Int_t chamber=((AliRICHhit*)r->Hits()->At(hitN))->C(); | |
ed3ceb24 | 219 | Int_t tid=((AliRICHhit*)r->Hits()->At(hitN))->GetTrack(); |
220 | Int_t pid=((AliRICHhit*)r->Hits()->At(hitN))->Pid(); | |
3b96aee8 | 221 | if(padx<1 || padx>r->Param()->NpadsX() ||pady<1 || pady>r->Param()->NpadsY()) |
a239137a | 222 | Warning("OLD_S_SD","pad is out of valid range padx= %i pady=%i event %i",padx,pady,iEventN); |
3b96aee8 | 223 | else |
ed3ceb24 | 224 | r->AddSDigit(chamber,padx,pady,q,pid,tid); |
c60862bf | 225 | }//specials loop |
226 | }//prims loop | |
227 | rl->TreeS()->Fill(); | |
228 | rl->WriteSDigits("OVERWRITE"); | |
c60862bf | 229 | }//events loop |
230 | rl->UnloadHits(); rl->UnloadSDigits(); | |
d32d34bf | 231 | Info("OLD_S_SD","Stop."); |
3b96aee8 | 232 | }//OLD_S_SD() |
543d5224 | 233 | //__________________________________________________________________________________________________ |
d32d34bf | 234 | void SD_D() |
543d5224 | 235 | { |
d32d34bf | 236 | Info("SD_D","Start."); |
ed3ceb24 | 237 | extern Int_t kBad; |
a239137a | 238 | r->Param()->GenSigmaThMap(); |
543d5224 | 239 | rl->LoadSDigits(); |
240 | ||
241 | for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop | |
a239137a | 242 | al->GetEvent(iEventN); cout<<"Event "<<iEventN<<endl; |
543d5224 | 243 | rl->MakeTree("D");r->MakeBranch("D"); //create TreeD with RICH branches |
d32d34bf | 244 | r->ResetSDigits();r->ResetDigits();//reset lists of sdigits and digits |
543d5224 | 245 | rl->TreeS()->GetEntry(0); |
d32d34bf | 246 | r->SDigits()->Sort(); |
ed3ceb24 | 247 | |
248 | Int_t combiPid,chamber,x,y,tid[3],id; Double_t q; | |
249 | Int_t iNdigitsPerPad;//how many sdigits for a given pad | |
250 | const int kBad=-101;//??? to be removed in code | |
d32d34bf | 251 | for(Int_t i=0;i<r->SDigits()->GetEntries();i++){//sdigits loop (sorted) |
252 | AliRICHdigit *pSdig=(AliRICHdigit*)r->SDigits()->At(i); | |
543d5224 | 253 | if(pSdig->Id()==id){//still the same pad |
254 | iNdigitsPerPad++; | |
d32d34bf | 255 | q+=pSdig->Q(); |
ed3ceb24 | 256 | combiPid+=pSdig->CombiPid(); |
543d5224 | 257 | if(iNdigitsPerPad<=3) |
ed3ceb24 | 258 | tid[iNdigitsPerPad-1]=pSdig->Tid(0); |
3582c1f9 | 259 | else |
260 | Warning("SDigits2Digits","More then 3 sdigits for the given pad"); | |
543d5224 | 261 | }else{//new pad, add the pevious one |
af3d25a6 | 262 | if(id!=kBad&&r->Param()->IsOverTh(chamber,x,y,q)) { |
ed3ceb24 | 263 | r->AddDigit(chamber,x,y,q,combiPid,tid); |
af3d25a6 | 264 | } |
ed3ceb24 | 265 | combiPid=pSdig->CombiPid();chamber=pSdig->C();id=pSdig->Id(); |
266 | x=pSdig->X();y=pSdig->Y(); | |
267 | q=pSdig->Q(); | |
268 | tid[0]=pSdig->Tid(0); | |
269 | iNdigitsPerPad=1;tid[1]=tid[2]=kBad; | |
543d5224 | 270 | } |
271 | }//sdigits loop (sorted) | |
272 | ||
a239137a | 273 | if(r->SDigits()->GetEntries()&&r->Param()->IsOverTh(chamber,x,y,q)) |
ed3ceb24 | 274 | r->AddDigit(chamber,x,y,q,combiPid,tid);//add the last digit |
543d5224 | 275 | |
276 | rl->TreeD()->Fill(); | |
277 | rl->WriteDigits("OVERWRITE"); | |
278 | }//events loop | |
279 | rl->UnloadSDigits(); rl->UnloadDigits(); | |
d32d34bf | 280 | r->ResetSDigits();r->ResetDigits();//reset lists of sdigits and digits |
281 | Info("SD_D","Stop."); | |
3b96aee8 | 282 | }//SD_D() |
08479a10 | 283 | //__________________________________________________________________________________________________ |
3b96aee8 | 284 | void Show() |
d48cca74 | 285 | { |
abb44d7c | 286 | cout<<endl; |
c60862bf | 287 | al->LoadHeader(); al->LoadKinematics(); |
abb44d7c | 288 | |
aed240d4 | 289 | rl->LoadHits(); |
290 | Bool_t isSdigits=!rl->LoadSDigits(); | |
291 | Bool_t isClusters=!rl->LoadRecPoints(); | |
292 | Bool_t isDigits=!rl->LoadDigits();//loaders | |
c60862bf | 293 | |
294 | cout<<endl; cout<<endl; | |
295 | for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop | |
296 | Int_t iNparticles=a->GetEvent(iEventN); | |
abb44d7c | 297 | Int_t iNprims=rl->TreeH()->GetEntries(); |
c60862bf | 298 | |
84365c70 | 299 | Int_t iTotalHits=0; |
abb44d7c | 300 | for(Int_t iPrimN=0;iPrimN<iNprims;iPrimN++){//prims loop |
c60862bf | 301 | rl->TreeH()->GetEntry(iPrimN); |
302 | iTotalHits+=r->Hits()->GetEntries(); | |
abb44d7c | 303 | TParticle *pPrim=al->Stack()->Particle(iPrimN); |
84365c70 | 304 | Info("Show","Evt %4i prim %4i has %4i hits from %s (,%7.2f,%7.2f)", |
c60862bf | 305 | iEventN, |
306 | iPrimN, | |
307 | r->Hits()->GetEntries(), | |
c60862bf | 308 | pPrim->GetName(), |
309 | pPrim->Theta()*r2d,pPrim->Phi()*r2d); | |
abb44d7c | 310 | }//prims loop |
84365c70 | 311 | Info("Show-HITS","Evt %i total: %i particles %i primaries %i hits", |
312 | iEventN, iNparticles, iNprims, iTotalHits); | |
c60862bf | 313 | if(isSdigits){ |
314 | rl->TreeS()->GetEntry(0); | |
d32d34bf | 315 | Info("Show-SDIGITS","Evt %i contains %5i sdigits",iEventN,r->SDigits()->GetEntries()); |
abb44d7c | 316 | } |
c60862bf | 317 | if(isDigits){ |
318 | rl->TreeD()->GetEntry(0); | |
543d5224 | 319 | for(int i=1;i<=7;i++) |
aed240d4 | 320 | Info("Show-DIGITS","Evt %i chamber %i contains %5i digits", |
321 | iEventN, i, r->Digits(i)->GetEntries()); | |
322 | } | |
323 | if(isClusters){ | |
324 | rl->TreeR()->GetEntry(0); | |
325 | for(int i=1;i<=7;i++) | |
326 | Info("Show-CLUSTERS","Evt %i chamber %i contains %5i clusters", | |
327 | iEventN, i, r->Clusters(i)->GetEntries()); | |
c60862bf | 328 | } |
329 | cout<<endl; | |
abb44d7c | 330 | }//events loop |
aed240d4 | 331 | rl->UnloadHits(); |
332 | if(isSdigits) rl->UnloadSDigits(); | |
333 | if(isDigits) rl->UnloadDigits(); | |
334 | if(isClusters) rl->UnloadRecPoints(); | |
abb44d7c | 335 | al->UnloadHeader(); |
336 | al->UnloadKinematics(); | |
337 | cout<<endl; | |
d48cca74 | 338 | }//void Show() |
aed240d4 | 339 | //__________________________________________________________________________________________________ |
abb44d7c | 340 | |
d48cca74 | 341 | |
d48cca74 | 342 | AliRun *a; |
853634d3 | 343 | AliRunLoader *al; |
344 | AliLoader *rl,*tl,*il; | |
345 | ||
346 | AliRICH *r; | |
853634d3 | 347 | |
d32d34bf | 348 | Bool_t ReadAlice() |
d48cca74 | 349 | { |
d32d34bf | 350 | Info("ReadAlice","Tring to read ALICE from SIMULATED FILE."); |
abb44d7c | 351 | AliLoader::SetDebug(0); |
352 | if(gAlice) delete gAlice; | |
353 | if(!(al=AliRunLoader::Open("galice.root","AlicE","update"))){ | |
354 | gSystem->Exec("rm -rf *.root *.dat"); | |
d32d34bf | 355 | Error("ReadAlice","galice.root broken, removing all this garbage then init new one"); |
356 | new AliRun("gAlice","Alice experiment system"); | |
357 | gAlice->SetDebug(-1); | |
86594bfc | 358 | gAlice->Init("Config.C"); |
d32d34bf | 359 | r=(AliRICH*)gAlice->GetDetector("RICH"); |
360 | return kFALSE; | |
abb44d7c | 361 | } |
362 | al->LoadgAlice(); | |
363 | if(!gAlice) Fatal("ReadAlice","No gAlice in file"); | |
364 | a=al->GetAliRun(); | |
365 | a->SetDebug(0); | |
366 | //RICH | |
367 | if(!(r=(AliRICH*)gAlice->GetDetector("RICH"))) Warning("RICH/menu.C::ReadAlice","No RICH in file"); | |
368 | r->SetDebug(0); | |
369 | if(!(rl=al->GetLoader("RICHLoader"))) Warning("RICH/menu.C::ReadAlice","No RICH loader in file"); | |
370 | ||
371 | Info("ReadAlice","Run contains %i event(s)",gAlice->GetEventsPerRun()); | |
d32d34bf | 372 | return kTRUE; |
abb44d7c | 373 | } |
374 | //__________________________________________________________________________________________________ | |
c33c49f0 | 375 | void TestResponse() |
abb44d7c | 376 | { |
c33c49f0 | 377 | TCanvas *pC=new TCanvas("c","Amplification test",900,800); |
378 | pC->Divide(1,2); | |
379 | pC->cd(1); | |
86594bfc | 380 | TF1 *pF1=new TF1("f1",Gain,-70,70,1); pF1->SetParameters(1,1);pF1->SetParNames("Sector"); |
381 | TF1 *pF2=new TF1("f2",Gain,-70,70,1); pF2->SetParameters(2,1);pF2->SetParNames("Sector"); | |
382 | pF1->Draw();pF2->Draw("same"); | |
c33c49f0 | 383 | |
384 | pC->cd(2); | |
385 | ||
386 | const Int_t nPoints=8; | |
387 | THStack *pStack=new THStack("stack","photons"); | |
388 | TLegend *pLeg=new TLegend(0.6,0.2,0.9,0.5,"legend"); | |
389 | TH1F *apH[nPoints]; | |
390 | ||
391 | Double_t starty=AliRICHParam::DeadZone()/2; | |
392 | Double_t deltay=AliRICHParam::SectorSizeY()/nPoints; | |
393 | ||
394 | for(int i=0;i<nPoints;i++){ | |
86594bfc | 395 | apH[i]=new TH1F(Form("h%i",i),"Qdc for Photon;QDC;Counts",500,0,500); apH[i]->SetLineColor(i); |
c33c49f0 | 396 | pStack->Add(apH[i]); |
397 | pLeg->AddEntry(apH[i],Form("@(0,%5.2f->%5.2f)",starty+i*deltay,starty+i*deltay-AliRICHParam::SectorSizeY()/2)); | |
abb44d7c | 398 | } |
c33c49f0 | 399 | |
400 | ||
86594bfc | 401 | TVector2 x2(0,0); |
c33c49f0 | 402 | // AliRICHParam::ResetWireSag(); |
403 | for(Int_t i=0;i<10000;i++){//events loop | |
404 | for(int j=0;j<nPoints;j++){ | |
86594bfc | 405 | x2.Set(0,starty-j*deltay); |
406 | apH[j]->Fill(AliRICHParam::TotQdc(x2,0)); | |
c33c49f0 | 407 | } |
abb44d7c | 408 | } |
c33c49f0 | 409 | pStack->Draw("nostack"); |
410 | pLeg->Draw(); | |
411 | }//TestResponse() | |
abb44d7c | 412 | //__________________________________________________________________________________________________ |
d32d34bf | 413 | void TestSD() |
abb44d7c | 414 | { |
d32d34bf | 415 | Info("TestSD","Creating test sdigits."); |
86594bfc | 416 | TVector3 hit(426.55,246.28,17.21); |
417 | TVector2 x2=r->C(4)->Glob2Loc(hit); | |
418 | Int_t iTotQdc=r->Param()->TotQdc(x2,624e-9); | |
419 | Int_t iPadXmin,iPadXmax,iPadYmin,iPadYmax; | |
420 | Int_t padx,pady; | |
421 | Int_t sec=r->Param()->Loc2Pad(x2,padx,pady); | |
422 | r->Param()->Loc2Area(x2,iPadXmin,iPadYmin,iPadXmax,iPadYmax); | |
423 | Info("TestSD","Initial hit (%7.2f,%7.2f,%7.2f)->(%7.2f,%7.2f)->(%4i,%4i,%4i) gives %i charge", | |
424 | hit.X(),hit.Y(),hit.Z(),x2.X(),x2.Y(),sec,padx,pady,iTotQdc); | |
425 | ||
426 | cout<<"left-down=("<<iPadXmin<<","<<iPadYmin<<") right-up=("<<iPadXmax<<','<<iPadYmax<<')'<<endl; | |
427 | for(Int_t iPadY=iPadYmin;iPadY<=iPadYmax;iPadY++) | |
428 | for(Int_t iPadX=iPadXmin;iPadX<=iPadXmax;iPadX++) | |
429 | cout<<r->Param()->FracQdc(x2,iPadX,iPadY)<<endl; | |
430 | Info("TestSD","Stop."); | |
543d5224 | 431 | }//void TestSdigits() |
abb44d7c | 432 | //__________________________________________________________________________________________________ |
c67b2d9f | 433 | void TestC() |
abb44d7c | 434 | { |
c67b2d9f | 435 | Info("TestC","Creating test clusters."); |
543d5224 | 436 | rl->MakeTree("R");r->MakeBranch("R"); |
437 | ||
c67b2d9f | 438 | AliRICHcluster c; |
439 | c.AddDigit(new AliRICHdigit(1,20,21,200,1,2,3)); | |
440 | c.AddDigit(new AliRICHdigit(1,22,21,250,1,2,3)); | |
441 | c.CoG(); | |
442 | ||
443 | r->AddCluster(c); | |
444 | ||
543d5224 | 445 | rl->TreeR()->Fill(); |
446 | rl->WriteRecPoints("OVERWRITE"); | |
447 | rl->UnloadRecPoints(); | |
c67b2d9f | 448 | r->ResetClusters(); |
543d5224 | 449 | |
c67b2d9f | 450 | Info("TestC","Stop."); |
451 | }//TestC() | |
543d5224 | 452 | //__________________________________________________________________________________________________ |
453 | void TestSeg() | |
454 | { | |
455 | AliRICHParam *p=r->Param(); | |
86594bfc | 456 | Int_t padx,pady,sec; |
d32d34bf | 457 | Double_t x,y; |
86594bfc | 458 | Double_t eps=0.0000001; |
459 | Double_t x1=-0.5*p->PcSizeX()+eps; Double_t x2=-0.5*p->SectorSizeX()-p->DeadZone()-eps; Double_t x3=-0.5*p->SectorSizeX()+eps; | |
460 | Double_t x6= 0.5*p->PcSizeX()-eps; Double_t x5= 0.5*p->SectorSizeX()+p->DeadZone()+eps; Double_t x4= 0.5*p->SectorSizeX()-eps; | |
461 | Double_t y1=-0.5*p->PcSizeY()+eps; Double_t y2=-0.5*p->DeadZone()-eps; | |
462 | Double_t y4= 0.5*p->PcSizeY()-eps; Double_t y3= 0.5*p->DeadZone()+eps; | |
463 | TVector2 v2; | |
464 | ||
465 | AliRICHParam::Print(); | |
466 | ||
467 | sec=p->Loc2Pad(TVector2(x= 0,y=y1),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 73- 1","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
468 | sec=p->Loc2Pad(TVector2(x= 0,y=y2),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 73- 80","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
469 | sec=p->Loc2Pad(TVector2(x= 0,y= 0),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" dead ","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
470 | sec=p->Loc2Pad(TVector2(x= 0,y=y3),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 73- 81","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
471 | sec=p->Loc2Pad(TVector2(x= 0,y=y4),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 73-160","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)\n",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
472 | ||
473 | sec=p->Loc2Pad(TVector2(x=x1,y=y4),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 1-160","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
474 | sec=p->Loc2Pad(TVector2(x=x2,y=y4),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 48-160","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
475 | sec=p->Loc2Pad(TVector2(x=x3,y=y4),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 49-160","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
476 | sec=p->Loc2Pad(TVector2(x=x4,y=y4),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 96-160","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
477 | sec=p->Loc2Pad(TVector2(x=x5,y=y4),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 97-160","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
478 | sec=p->Loc2Pad(TVector2(x=x6,y=y4),padx,pady); v2=p->Pad2Loc(padx,pady); Info("144-160","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)\n",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
479 | ||
480 | sec=p->Loc2Pad(TVector2(x=x1,y=y3),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 1- 81","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
481 | sec=p->Loc2Pad(TVector2(x=x2,y=y3),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 48- 81","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
482 | sec=p->Loc2Pad(TVector2(x=x3,y=y3),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 49- 81","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
483 | sec=p->Loc2Pad(TVector2(x=x4,y=y3),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 96- 81","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
484 | sec=p->Loc2Pad(TVector2(x=x5,y=y3),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 97- 81","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
485 | sec=p->Loc2Pad(TVector2(x=x6,y=y3),padx,pady); v2=p->Pad2Loc(padx,pady); Info("144- 81","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)\n",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
486 | ||
487 | sec=p->Loc2Pad(TVector2(x=x1,y=y2),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 1- 80","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
488 | sec=p->Loc2Pad(TVector2(x=x2,y=y2),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 48- 80","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
489 | sec=p->Loc2Pad(TVector2(x=x3,y=y2),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 49- 80","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
490 | sec=p->Loc2Pad(TVector2(x=x4,y=y2),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 96- 80","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
491 | sec=p->Loc2Pad(TVector2(x=x5,y=y2),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 97- 80","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
492 | sec=p->Loc2Pad(TVector2(x=x6,y=y2),padx,pady); v2=p->Pad2Loc(padx,pady); Info("144- 80","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)\n",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
493 | ||
494 | sec=p->Loc2Pad(TVector2(x=x1,y=y1),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 1- 1","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
495 | sec=p->Loc2Pad(TVector2(x=x2,y=y1),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 48- 1","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
496 | sec=p->Loc2Pad(TVector2(x=x3,y=y1),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 49- 1","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
497 | sec=p->Loc2Pad(TVector2(x=x4,y=y1),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 96- 1","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
498 | sec=p->Loc2Pad(TVector2(x=x5,y=y1),padx,pady); v2=p->Pad2Loc(padx,pady); Info(" 97- 1","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
499 | sec=p->Loc2Pad(TVector2(x=x6,y=y1),padx,pady); v2=p->Pad2Loc(padx,pady); Info("144- 1","(%7.2f,%7.2f)->(%5i,%5i,%5i) center=(%7.2f,%7.2f)\n",x,y,sec,padx,pady,v2.X(),v2.Y()); | |
500 | ||
543d5224 | 501 | }//void TestSeg() |
abb44d7c | 502 | //__________________________________________________________________________________________________ |
543d5224 | 503 | void TestMenu() |
abb44d7c | 504 | { |
543d5224 | 505 | TControlBar *pMenu = new TControlBar("vertical","RICH test"); |
c67b2d9f | 506 | pMenu->AddButton("Test segmentation", "TestSeg()", "Test AliRICHParam segmentation methods"); |
c33c49f0 | 507 | pMenu->AddButton("Test response", "TestResponse()", "Test AliRICHParam response methods"); |
d32d34bf | 508 | pMenu->AddButton("Test sdigits", "TestSD()", "Create test set of sdigits"); |
c67b2d9f | 509 | pMenu->AddButton("Test clusters", "TestC()", "Create test set of clusters"); |
86594bfc | 510 | pMenu->AddButton("Test digits OLD", "TestDigitsOLD()", "Create test set of OLD digits"); |
543d5224 | 511 | pMenu->Show(); |
512 | }//TestMenu() | |
513 | //__________________________________________________________________________________________________ | |
543d5224 | 514 | void menu() |
515 | { | |
516 | TControlBar *pMenu = new TControlBar("vertical","RICH main"); | |
517 | ||
d32d34bf | 518 | if(ReadAlice()){//it's from file, reconstruct |
3b96aee8 | 519 | pMenu->AddButton("hits->sdigits->digits->clusters","MainTrank()","Convert"); |
d32d34bf | 520 | |
86594bfc | 521 | pMenu->AddButton("hits->sdigits" ,"H_SD()" ,"AliRICH::Hits2SDigits"); |
522 | pMenu->AddButton("sdigits->digits" ,"SD_D()" ,"AliRICHDigitizer"); | |
523 | pMenu->AddButton("digits->clusters" ,"D_C()" ,"AliRICHClusterFinder"); | |
524 | pMenu->AddButton("clusters->recos" ,"C_R()" ,"AliRICHRecon"); | |
543d5224 | 525 | |
86594bfc | 526 | pMenu->AddButton("Show", "Show()","Shows the structure of events in files"); |
527 | pMenu->AddButton("Display Fast", "DisplFast()", "Display Fast"); | |
528 | pMenu->AddButton("Control Plots", "ControlPlots()", "Display some control histograms"); | |
d32d34bf | 529 | pMenu->AddButton("OLD specials->sdigits", "OLD_S_SD()", "Perform first phase converstion"); |
543d5224 | 530 | |
531 | }else{//it's aliroot, simulate | |
532 | pMenu->AddButton("Run", "a->Run(1)", "Process!"); | |
86594bfc | 533 | pMenu->AddButton("Geo GUI", "new G3GeometryGUI;","Create instance of G4GeometryGUI"); |
543d5224 | 534 | } |
543d5224 | 535 | pMenu->AddButton("Test submenu", "TestMenu()", "Shows test submenu"); |
536 | pMenu->AddButton("Browser", "new TBrowser;", "Start ROOT TBrowser"); | |
3b96aee8 | 537 | pMenu->AddButton("Debug ON", "DebugON();", "Switch debug on-off"); |
538 | pMenu->AddButton("Debug OFF", "DebugOFF();", "Switch debug on-off"); | |
543d5224 | 539 | pMenu->AddButton("Quit", ".q", "Close session"); |
540 | pMenu->Show(); | |
541 | a=gAlice;//for manual manipulation convinience | |
542 | }//menu() | |
543 | //__________________________________________________________________________________________________ | |
3b96aee8 | 544 | void DebugOFF(){ Info("DebugOFF",""); a->SetDebug(0); r->SetDebug(0); AliLoader::SetDebug(0);} |
545 | void DebugON() { Info("DebugON",""); a->SetDebug(1); r->SetDebug(1); AliLoader::SetDebug(1);} |