Some rule violations fixed
[u/mrichter/AliRoot.git] / RICH / menu.C
CommitLineData
c67b2d9f 1void MainTrank()
2{
3 TStopwatch sw;TDatime time;
4 OLD_S_SD(); SD_D(); //D_C();
5 cout<<"\nInfo in <MainTrank>: Start time: ";time.Print();
6 cout<<"Info in <MainTrank>: Stop time: ";time.Set(); time.Print();
7 cout<<"Info in <MainTrank>: Time used: ";sw.Print();
8}
9
d32d34bf 10void ss()
11{
c1863e3c 12 if(rl->LoadSDigits()) return;
d32d34bf 13 rl->TreeS()->GetEntry(0);
14 r->SDigits()->Print();
c67b2d9f 15 Info("ss","totally %i",r->SDigits()->GetEntries());
d32d34bf 16 rl->UnloadSDigits();
17}
18
c1863e3c 19void sd()
20{
21 if(rl->LoadDigits()) return;
22 rl->TreeD()->GetEntry(0);
23 for(int i=1;i<=7;i++) r->Digits(i)->Print();
24 rl->UnloadDigits();
25}
26
27void sc()
28{
29 if(rl->LoadRecPoints()) return;
c67b2d9f 30 r->SetTreeAddress();
c1863e3c 31 rl->TreeR()->GetEntry(0);
32 for(int i=1;i<=7;i++) r->Clusters(i)->Print();
33 rl->UnloadRecPoints();
34}
8fc0dab8 35
36Double_t r2d = TMath::RadToDeg();
37Double_t d2r = TMath::DegToRad();
38
fa49f877 39void DisplFast()
40{
41 AliRICHDisplFast *d = new AliRICHDisplFast();
aed240d4 42 d->Exec();
fa49f877 43}
44
45
543d5224 46void Digits2Recos()
c60862bf 47{
5cb4dfc3 48 AliRICHRecon *detect = new AliRICHRecon("RICH patrec algorithm","Reconstruction");
543d5224 49
50
8fc0dab8 51 for (int nev=0; nev< a->GetEventsPerRun(); nev++) { // Event Loop
543d5224 52 al->GetEvent(nev);
53 cout <<endl<< "Processing event:" <<nev<<endl;
5cb4dfc3 54 detect->StartProcessEvent();
543d5224 55 } // event loop
fa49f877 56 delete detect;
543d5224 57}
58
59
60
543d5224 61
d32d34bf 62void D_C()
543d5224 63{
64 AliRICHClusterFinder *z=new AliRICHClusterFinder(r);
65 z->Exec();
66}
d32d34bf 67//__________________________________________________________________________________________________
68void OLD_S_SD()
c60862bf 69{
d32d34bf 70 Info("OLD_S_SD","Start.");
c60862bf 71
543d5224 72 rl->LoadHits();
c60862bf 73
74 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
75 al->GetEvent(iEventN);
c60862bf 76
543d5224 77 rl->MakeTree("S"); r->MakeBranch("S");
d32d34bf 78 r->ResetSDigits(); r->ResetSpecialsOld();
543d5224 79
c60862bf 80 for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop
81 rl->TreeH()->GetEntry(iPrimN);
82 for(Int_t i=0;i<r->Specials()->GetEntries();i++){//specials loop
83 Int_t padx= ((AliRICHSDigit*)r->Specials()->At(i))->PadX();
84 Int_t pady= ((AliRICHSDigit*)r->Specials()->At(i))->PadY();
d32d34bf 85 Double_t q= ((AliRICHSDigit*)r->Specials()->At(i))->QPad();
543d5224 86 Int_t hitN= ((AliRICHSDigit*)r->Specials()->At(i))->HitNumber()-1;//!!! important -1
87 Int_t chamber=((AliRICHhit*)r->Hits()->At(hitN))->C();
88 Int_t track=((AliRICHhit*)r->Hits()->At(hitN))->GetTrack();
d32d34bf 89 r->AddSDigit(chamber,padx+r->Param()->NpadsX()/2,pady+r->Param()->NpadsY()/2,q,track);
c60862bf 90 }//specials loop
91 }//prims loop
92 rl->TreeS()->Fill();
93 rl->WriteSDigits("OVERWRITE");
c60862bf 94 }//events loop
95 rl->UnloadHits(); rl->UnloadSDigits();
d32d34bf 96 Info("OLD_S_SD","Stop.");
543d5224 97}//Specials2Sdigits()
98//__________________________________________________________________________________________________
c712cb2f 99void H_SD()
c60862bf 100{
c712cb2f 101 Info("H_SD","Start.");
c60862bf 102
103 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
104 al->GetEvent(iEventN);
105
106 if(!rl->TreeH()) rl->LoadHits();//from
107 if(!rl->TreeS()) rl->MakeTree("S"); r->MakeBranch("S");//to
543d5224 108
c60862bf 109 for(Int_t iPrimN=0;iPrimN<rl->TreeH()->GetEntries();iPrimN++){//prims loop
110 rl->TreeH()->GetEntry(iPrimN);
d32d34bf 111 for(Int_t iHitN=0;iHitN<3;iHitN++){//hits loop ???
c712cb2f 112 AliRICHhit *pHit=r->Hits()->At(iHitN);
113 TVector3 globX3(pHit->X(),pHit->Y(),pHit->Z());
114 TVector3 locX3=r->C(pHit->C())->Glob2Loc(globX3);
115
116 Int_t sector;
117 Int_t iTotQdc=r->Param()->Loc2TotQdc(locX3,pHit->Eloss(),pHit->Pid(),sector);
118
119 Int_t iPadXmin,iPadXmax,iPadYmin,iPadYmax;
120 r->Param()->Loc2Area(locX3,iPadXmin,iPadYmin,iPadXmax,iPadYmax);
121 cout<<"left-down=("<<iPadXmin<<","<<iPadYmin<<") right-up=("<<iPadXmax<<','<<iPadYmax<<')'<<endl;
122 for(Int_t iPadY=iPadYmin;iPadY<=iPadYmax;iPadY++)
123 for(Int_t iPadX=iPadXmin;iPadX<=iPadXmax;iPadX++){
d32d34bf 124 Double_t padQdc=iTotQdc*r->Param()->Loc2PadFrac(locX3,iPadX,iPadY);
125 if(padQdc>0.1)r->AddSDigit(pHit->C(),iPadX,iPadY,padQdc,pHit->GetTrack());
126 }
c712cb2f 127 }//hits loop
128 }//prims loop
c60862bf 129 rl->TreeS()->Fill();
130 rl->WriteSDigits("OVERWRITE");
131 }//events loop
132
133 rl->UnloadHits();
134 rl->UnloadSDigits();
d32d34bf 135 Info("H_SD","Stop.");
543d5224 136}//Hits2Sdigits()
137//__________________________________________________________________________________________________
d32d34bf 138void SD_D()
543d5224 139{
d32d34bf 140 Info("SD_D","Start.");
543d5224 141
142 rl->LoadSDigits();
143
144 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
145 al->GetEvent(iEventN);
146
147 rl->MakeTree("D");r->MakeBranch("D"); //create TreeD with RICH branches
d32d34bf 148 r->ResetSDigits();r->ResetDigits();//reset lists of sdigits and digits
543d5224 149 rl->TreeS()->GetEntry(0);
d32d34bf 150 r->SDigits()->Sort();
543d5224 151
152 Int_t kBad=-101;
d32d34bf 153 Int_t chamber,x,y,tr[3],id;
154 Double_t q=kBad;
155 chamber=x=y=tr[0]=tr[1]=tr[2]=id=kBad;
543d5224 156 Int_t iNdigitsPerPad=kBad;//how many sdigits for a given pad
157
d32d34bf 158 for(Int_t i=0;i<r->SDigits()->GetEntries();i++){//sdigits loop (sorted)
159 AliRICHdigit *pSdig=(AliRICHdigit*)r->SDigits()->At(i);
543d5224 160 if(pSdig->Id()==id){//still the same pad
161 iNdigitsPerPad++;
d32d34bf 162 q+=pSdig->Q();
543d5224 163 if(iNdigitsPerPad<=3)
164 tr[iNdigitsPerPad-1]=pSdig->T(0);
165 else
166 Info("","More then 3 sdigits for the given pad");
167 }else{//new pad, add the pevious one
08479a10 168 if(id!=kBad&&r->Param()->IsOverTh(chamber,x,y,q)) {
169
170 r->AddDigit(chamber,x,y,q,tr[0],tr[1],tr[2]);//ch-xpad-ypad-qdc-tr1-2-3
171 }
d32d34bf 172 chamber=pSdig->C();x=pSdig->X();y=pSdig->Y();q=pSdig->Q();tr[0]=pSdig->T(0);id=pSdig->Id();
543d5224 173 iNdigitsPerPad=1;tr[1]=tr[2]=kBad;
174 }
175 }//sdigits loop (sorted)
176
08479a10 177 if(r->SDigits()->GetEntries()&&r->Param()->IsOverTh(chamber,x,y,q))
178 r->AddDigit(chamber,x,y,q,tr[0],tr[1],tr[2]);//add the last digit
543d5224 179
180 rl->TreeD()->Fill();
181 rl->WriteDigits("OVERWRITE");
182 }//events loop
183 rl->UnloadSDigits(); rl->UnloadDigits();
d32d34bf 184 r->ResetSDigits();r->ResetDigits();//reset lists of sdigits and digits
185 Info("SD_D","Stop.");
c60862bf 186}
187
543d5224 188
189
d32d34bf 190void OLD_SD_D()
abb44d7c 191{
d32d34bf 192 Info("SD_DOLD","Start.");
543d5224 193
abb44d7c 194 rl->LoadSDigits();
abb44d7c 195
543d5224 196 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
197 al->GetEvent(iEventN);
198
199 rl->MakeTree("D");r->MakeBranch("D"); //create TreeD with RICH branches
d32d34bf 200 r->ResetSDigits();r->ResetDigitsOld();//reset lists of sdigits and digits
543d5224 201 rl->TreeS()->GetEntry(0);
d32d34bf 202 r->SDigits()->Sort();
abb44d7c 203
543d5224 204 Int_t kBad=-101;
205
206 Int_t tr[3],q[3],dig[5]; for(Int_t i=0;i<3;i++) tr[i]=q[i]=kBad; for(Int_t i=0;i<5;i++) dig[i]=kBad;
207 Int_t chamber=kBad,id=kBad,iNdigitsPerPad=kBad;//how many sdigits for a given pad
abb44d7c 208
d32d34bf 209 for(Int_t i=0;i<r->SDigits()->GetEntries();i++){//sdigits loop (sorted)
210 AliRICHdigit *pSdig=(AliRICHdigit*)r->SDigits()->At(i);
543d5224 211 if(pSdig->Id()==id){//still the same pad
212 iNdigitsPerPad++;
d32d34bf 213 dig[2]+=pSdig->Q();//sum up qdc
543d5224 214 if(iNdigitsPerPad<=3)
215 tr[iNdigitsPerPad-1]=pSdig->T(0);
216 else
217 Info("","More then 3 sdigits for the given pad");
218 }else{//new pad, add the pevious one
219 if(id!=kBad) r->AddDigitOld(chamber,tr,q,dig);
220 chamber=pSdig->C();dig[0]=pSdig->X();dig[1]=pSdig->Y();dig[2]=pSdig->Qdc();tr[0]=pSdig->T(0);id=pSdig->Id();
221 iNdigitsPerPad=1;tr[1]=tr[2]=kBad;
222 }
223 }//sdigits loop (sorted)
224 r->AddDigitOld(chamber,tr,q,dig);//add the last digit
abb44d7c 225
543d5224 226 rl->TreeD()->Fill();
227 rl->WriteDigits("OVERWRITE");
228 }//events loop
229 rl->UnloadSDigits(); rl->UnloadDigits();
d32d34bf 230 r->ResetSDigits();r->ResetDigitsOld();//reset lists of sdigits and digits
231 Info("SD_DOLD","Stop.");
abb44d7c 232}
08479a10 233//__________________________________________________________________________________________________
abb44d7c 234void Show3()
d48cca74 235{
abb44d7c 236 cout<<endl;
c60862bf 237 al->LoadHeader(); al->LoadKinematics();
abb44d7c 238
aed240d4 239 rl->LoadHits();
240 Bool_t isSdigits=!rl->LoadSDigits();
241 Bool_t isClusters=!rl->LoadRecPoints();
242 Bool_t isDigits=!rl->LoadDigits();//loaders
c60862bf 243
244 cout<<endl; cout<<endl;
245 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
246 Int_t iNparticles=a->GetEvent(iEventN);
abb44d7c 247 Int_t iNprims=rl->TreeH()->GetEntries();
c60862bf 248
249 Int_t iTotalHits=0,iTotalCerenkovs=0,iTotalSpecials=0;
abb44d7c 250 for(Int_t iPrimN=0;iPrimN<iNprims;iPrimN++){//prims loop
c60862bf 251 rl->TreeH()->GetEntry(iPrimN);
252 iTotalHits+=r->Hits()->GetEntries();
253 iTotalCerenkovs+=r->Cerenkovs()->GetEntries();
254 iTotalSpecials+=r->Specials()->GetEntries();
abb44d7c 255 TParticle *pPrim=al->Stack()->Particle(iPrimN);
543d5224 256 Info("Show","Evt %4i prim %4i has %4i hits %5i cerenkovs and %5i specials from %s (,%7.2f,%7.2f)",
c60862bf 257 iEventN,
258 iPrimN,
259 r->Hits()->GetEntries(),
260 r->Cerenkovs()->GetEntries(),
261 r->Specials()->GetEntries(),
262 pPrim->GetName(),
263 pPrim->Theta()*r2d,pPrim->Phi()*r2d);
abb44d7c 264 }//prims loop
543d5224 265 Info("Show-HITS","Evt %i total: %i particles %i primaries %i hits %i cerenkovs %i specials",
c60862bf 266 iEventN, iNparticles, iNprims, iTotalHits,iTotalCerenkovs,iTotalSpecials);
267 if(isSdigits){
268 rl->TreeS()->GetEntry(0);
d32d34bf 269 Info("Show-SDIGITS","Evt %i contains %5i sdigits",iEventN,r->SDigits()->GetEntries());
abb44d7c 270 }
c60862bf 271 if(isDigits){
272 rl->TreeD()->GetEntry(0);
543d5224 273 for(int i=1;i<=7;i++)
aed240d4 274 Info("Show-DIGITS","Evt %i chamber %i contains %5i digits",
275 iEventN, i, r->Digits(i)->GetEntries());
276 }
277 if(isClusters){
278 rl->TreeR()->GetEntry(0);
279 for(int i=1;i<=7;i++)
280 Info("Show-CLUSTERS","Evt %i chamber %i contains %5i clusters",
281 iEventN, i, r->Clusters(i)->GetEntries());
c60862bf 282 }
283 cout<<endl;
abb44d7c 284 }//events loop
aed240d4 285 rl->UnloadHits();
286 if(isSdigits) rl->UnloadSDigits();
287 if(isDigits) rl->UnloadDigits();
288 if(isClusters) rl->UnloadRecPoints();
abb44d7c 289 al->UnloadHeader();
290 al->UnloadKinematics();
291 cout<<endl;
d48cca74 292}//void Show()
aed240d4 293//__________________________________________________________________________________________________
08479a10 294void ControlPlots()
295{
296 Int_t iChamber = 1;
297 TH1F *pqclusterH1 = new TH1F("qclus","charge of clusters;Q (ADC);events",2000,0.,2000);
298
299 al->LoadHeader(); al->LoadKinematics();
300
301 rl->LoadHits();
302 Bool_t isSdigits=!rl->LoadSDigits();
303 Bool_t isClusters=!rl->LoadRecPoints();
304 Bool_t isDigits=!rl->LoadDigits();//loaders
305
306 for(Int_t iEventN=0;iEventN<a->GetEventsPerRun();iEventN++){//events loop
307 Int_t iNparticles=a->GetEvent(iEventN);
308 Int_t iNprims=rl->TreeH()->GetEntries();
309
310 Int_t iTotalHits=0,iTotalCerenkovs=0,iTotalSpecials=0;
311 for(Int_t iPrimN=0;iPrimN<iNprims;iPrimN++){//prims loop
312 rl->TreeH()->GetEntry(iPrimN);
313 iTotalHits+=r->Hits()->GetEntries();
314 iTotalCerenkovs+=r->Cerenkovs()->GetEntries();
315 iTotalSpecials+=r->Specials()->GetEntries();
316 TParticle *pPrim=al->Stack()->Particle(iPrimN);
317 }//prims loop
318 if(isSdigits){
319 rl->TreeS()->GetEntry(0);
320 }
321 if(isDigits){
322 rl->TreeD()->GetEntry(0);
323 for(int i=1;i<=7;i++);
324 }
325 if(isClusters){
326 rl->TreeR()->GetEntry(0);
327 for(Int_t iclus=0;iclus<r->Clusters(iChamber)->GetEntries();iclus++) {
328 pqclusterH1->Fill(((AliRICHcluster*)r->Clusters(iChamber)->At(iclus))->Q());
329 }
330 }
331 cout<<endl;
332 }//events loop
333 pqclusterH1->Draw();
334 rl->UnloadHits();
335 if(isSdigits) rl->UnloadSDigits();
336 if(isDigits) rl->UnloadDigits();
337 if(isClusters) rl->UnloadRecPoints();
338 al->UnloadHeader();
339 al->UnloadKinematics();
340