1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 ////////////////////////////////////////////////
19 // Manager and hits classes for set:RICH //
20 ////////////////////////////////////////////////
22 #include <Riostream.h>
30 #include <TGeometry.h>
34 #include <TObjArray.h>
36 #include <TParticle.h>
45 #include "AliPoints.h"
47 #include "AliRICHClusterFinder.h"
48 #include "AliRICHDigit.h"
49 #include "AliRICHDigitizer.h"
50 #include "AliRICHHitMapA1.h"
51 #include "AliRICHMerger.h"
52 #include "AliRICHRawCluster.h"
53 #include "AliRICHRecHit1D.h"
54 #include "AliRICHRecHit3D.h"
55 #include "AliRICHSDigit.h"
56 #include "AliRICHSegmentationV0.h"
57 #include "AliRICHTransientDigit.h"
59 #include "AliRunDigitizer.h"
60 #include "AliSegmentation.h"
63 static Int_t sMaxIterPad=0; // Static variables for the pad-hit iterator routines
64 static Int_t sCurIterPad=0;
67 ClassImp(AliRICHdigit)
70 //___________________________________________
74 <img src="gif/alirich.gif">
79 {//Default ctor should not contain any new operators
91 for (Int_t i=0; i<kNCH; i++){
100 //______________________________________________________________________________
101 AliRICH::AliRICH(const char *name, const char *title)
102 :AliDetector(name,title)
104 if(GetDebug())Info("named ctor","Start.");
105 fHits = new TClonesArray("AliRICHhit",1000 );
106 fCerenkovs = new TClonesArray("AliRICHCerenkov",1000);
107 fSDigits = new TClonesArray("AliRICHdigit",100000);
108 gAlice->AddHitList(fHits);
109 gAlice->AddHitList(fCerenkovs);
113 fDchambers =new TObjArray(kNCH);
114 fRawClusters=new TObjArray(kNCH);
115 fRecHits1D =new TObjArray(kNCH);
116 fRecHits3D =new TObjArray(kNCH);
117 for (int i=0; i<kNCH ;i++) {
118 fDchambers->AddAt(new TClonesArray("AliRICHDigit",10000), i);
119 fRawClusters->AddAt(new TClonesArray("AliRICHRawCluster",10000), i);
120 fRecHits1D->AddAt(new TClonesArray("AliRICHRecHit1D",1000), i);
121 fRecHits3D->AddAt(new TClonesArray("AliRICHRecHit3D",1000), i);
125 SetMarkerColor(kRed);
127 /*fChambers = new TObjArray(kNCH);
128 for (i=0; i<kNCH; i++)
129 (*fChambers)[i] = new AliRICHChamber();*/
133 if(GetDebug())Info("named ctor","Stop.");
134 }//AliRICH::AliRICH(const char *name, const char *title)
135 //______________________________________________________________________________
138 if(GetDebug()) Info("dtor","Start.");
145 //PH Delete TObjArrays
151 fDchambers->Delete();
155 fRawClusters->Delete();
159 fRecHits1D->Delete();
163 fRecHits3D->Delete();
166 if(GetDebug()) Info("dtor","Stop.");
167 }//AliRICH::~AliRICH()
168 //______________________________________________________________________________
169 void AliRICH::Hits2SDigits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, ResponseType res)
170 {//calls the charge disintegration method of the current chamber and adds all generated sdigits to the list of digits
172 if(GetDebug()) Info("Hits2SDigits","Start.");
174 Int_t iChamber,iPadX,iPadY,iAdc,iTrack;
175 Float_t list[4][500];
179 ((AliRICHChamber*)fChambers->At(idvol))->DisIntegration(eloss, xhit, yhit, iNdigits, list, res);
182 for(Int_t i=0; i<iNdigits; i++) {
183 if(Int_t(list[0][i]) > 0) {
185 iAdc = Int_t(list[0][i]);
186 iPadX = Int_t(list[1][i]);
187 iPadY = Int_t(list[2][i]);
188 iChamber = Int_t(list[3][i]);
191 AddSDigit(iChamber,iPadX,iPadY,iAdc,iTrack);
196 gAlice->TreeS()->Fill();
197 gAlice->TreeS()->Write(0,TObject::kOverwrite);
199 if(GetDebug()) Info("Hits2SDigits","Stop.");
200 }//Int_t AliRICH::Hits2SDigits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, ResponseType res)
202 void AliRICH::Hits2SDigits(Int_t iEventN)
203 {//Create a list of sdigits corresponding to list of hits. Every hit generates sdigit.
204 if(GetDebug()) Info("Hit2SDigits(iEventN)","Start.");
206 gAlice->GetEvent(iEventN);
208 if(!fLoader->TreeS()) fLoader->MakeTree("S");
211 for(int i=0;i<iEventN+40;i++) AddSDigit(i,13,24,55,2010);
213 fLoader->WriteSDigits("OVERWRITE");
215 if(GetDebug()) Info("Hit2SDigits(iEventN)","Stop.");
217 //______________________________________________________________________________
218 void AliRICH::Hits2SDigits()
219 {//Calls Hits2SDigits(EventNumber) for all events in the current run
220 if(GetDebug()) Info("Hit2SDigits","Start.");
222 for(Int_t iEventN=0;iEventN<gAlice->GetEventsPerRun();iEventN++)
223 Hits2SDigits(iEventN);
225 if(GetDebug()) Info("Hit2SDigits","Stop.");
227 //______________________________________________________________________________
228 void AliRICH::SDigits2Digits()
229 {//Generate digits from sdigits.
230 if(GetDebug()) Info("SDigits2Digits","Start.");
231 //AliRICHChamber* iChamber;
233 //printf("Generating tresholds...\n");
235 //for(Int_t i=0;i<7;i++) {
236 //iChamber = &(Chamber(i));
237 //iChamber->GenerateTresholds();
240 //int nparticles = gAlice->GetNtrack();
241 //cout << "Particles (RICH):" <<nparticles<<endl;
242 //if (nparticles <= 0) return;
244 //fMerger = new AliRICHMerger();
249 //fMerger->Digitise(nev,flag);
251 AliRunDigitizer * manager = new AliRunDigitizer(1,1);
252 manager->SetInputStream(0,"galice.root");
253 //AliRICHDigitizer *dRICH = new AliRICHDigitizer(manager);
254 manager->Exec("deb");
255 if(GetDebug()) Info("SDigits2Digits","Stop.");
256 }//void AliRICH::SDigits2Digits()
257 //______________________________________________________________________________
258 void AliRICH::Digits2Reco()
261 // Called from alirun, single event only.
262 if(GetDebug()) Info("Digits2Reco","Start.");
264 int nparticles = gAlice->GetNtrack();
265 cout << "Particles (RICH):" <<nparticles<<endl;
266 if (nparticles > 0) FindClusters(0,0);
268 }//void AliRICH::Digits2Reco()
271 void AliRICH::AddDigits(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
272 {// Add a RICH digit to the list
274 TClonesArray &ldigits = *((TClonesArray*)fDchambers->At(id));
275 new(ldigits[fNdch[id]++]) AliRICHDigit(tracks,charges,digits);
278 void AliRICH::AddRawCluster(Int_t id, const AliRICHRawCluster& c)
279 {// Add a RICH digit to the list
281 TClonesArray &lrawcl = *((TClonesArray*)fRawClusters->At(id));
282 new(lrawcl[fNrawch[id]++]) AliRICHRawCluster(c);
284 //_____________________________________________________________________________
285 void AliRICH::AddRecHit1D(Int_t id, Float_t *rechit, Float_t *photons, Int_t *padsx, Int_t* padsy)
286 {// Add a RICH reconstructed hit to the list
288 TClonesArray &lrec1D = *((TClonesArray*)fRecHits1D->At(id));
289 new(lrec1D[fNrechits1D[id]++]) AliRICHRecHit1D(id,rechit,photons,padsx,padsy);
291 //_____________________________________________________________________________
292 void AliRICH::AddRecHit3D(Int_t id, Float_t *rechit, Float_t omega, Float_t theta, Float_t phi)
293 {// Add a RICH reconstructed hit to the list
295 TClonesArray &lrec3D = *((TClonesArray*)fRecHits3D->At(id));
296 new(lrec3D[fNrechits3D[id]++]) AliRICHRecHit3D(id,rechit,omega,theta,phi);
298 //______________________________________________________________________________
299 void AliRICH::BuildGeometry()
300 {// Builds a TNode geometry for event display
301 if(GetDebug())Info("BuildGeometry","Start.");
303 TNode *node, *subnode, *top;
305 const int kColorRICH = kRed;
307 top=gAlice->GetGeometry()->GetNode("alice");
309 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
310 AliRICHSegmentationV0* segmentation;
311 AliRICHChamber* iChamber;
312 AliRICHGeometry* geometry;
314 iChamber = &(pRICH->Chamber(0));
315 segmentation=(AliRICHSegmentationV0*) iChamber->GetSegmentationModel();
316 geometry=iChamber->GetGeometryModel();
318 new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15);
320 Float_t padplane_width = segmentation->GetPadPlaneWidth();
321 Float_t padplane_length = segmentation->GetPadPlaneLength();
323 //printf("\n\n\n\n\n In BuildGeometry() npx: %d, npy: %d, dpx: %f, dpy:%f\n\n\n\n\n\n",segmentation->Npx(),segmentation->Npy(),segmentation->Dpx(),segmentation->Dpy());
325 new TBRIK("PHOTO","PHOTO","void", padplane_width/2,.1,padplane_length/2);
327 //printf("\n\n\n\n\n Padplane w: %f l: %f \n\n\n\n\n", padplane_width/2,padplane_length/2);
328 //printf("\n\n\n\n\n Padplane w: %f l: %f \n\n\n\n\n", segmentation->GetPadPlaneWidth(), segmentation->GetPadPlaneLength());
330 Float_t offset = 490 + 1.276 - geometry->GetGapThickness()/2; //distance from center of mother volume to methane
331 Float_t deltaphi = 19.5; //phi angle between center of chambers - z direction
332 Float_t deltatheta = 20; //theta angle between center of chambers - x direction
333 Float_t cosphi = TMath::Cos(deltaphi*TMath::Pi()/180);
334 Float_t sinphi = TMath::Sin(deltaphi*TMath::Pi()/180);
335 Float_t costheta = TMath::Cos(deltatheta*TMath::Pi()/180);
336 Float_t sintheta = TMath::Sin(deltatheta*TMath::Pi()/180);
338 //printf("\n\n%f %f %f %f %f %f %f\n\n",offset,deltatheta,deltaphi,cosphi,costheta,sinphi,sintheta);
340 new TRotMatrix("rot993","rot993",90., 0. , 90. - deltaphi, 90. , deltaphi, -90. );
341 new TRotMatrix("rot994","rot994",90., -deltatheta , 90. , 90.- deltatheta , 0. , 0. );
342 new TRotMatrix("rot995","rot995",90., 0. , 90. , 90. , 0. , 0. );
343 new TRotMatrix("rot996","rot996",90., deltatheta , 90. , 90 + deltatheta , 0. , 0. );
344 new TRotMatrix("rot997","rot997",90., 360. - deltatheta, 108.2 , 90.- deltatheta ,18.2 , 90 - deltatheta);
345 new TRotMatrix("rot998","rot998",90., 0. , 90 + deltaphi , 90. , deltaphi, 90. );
346 new TRotMatrix("rot999","rot999",90., deltatheta , 108.2 , 90.+ deltatheta ,18.2 , 90 + deltatheta);
348 Float_t pos1[3]={0. , offset*cosphi , offset*sinphi};
349 Float_t pos2[3]={offset*sintheta , offset*costheta , 0. };
350 Float_t pos3[3]={0. , offset , 0.};
351 Float_t pos4[3]={-offset*sintheta , offset*costheta , 0.};
352 Float_t pos5[3]={offset*sinphi , offset*costheta*cosphi, -offset*sinphi};
353 Float_t pos6[3]={0. , offset*cosphi , -offset*sinphi};
354 Float_t pos7[3]={ -offset*sinphi , offset*costheta*cosphi, -offset*sinphi};
358 //Float_t pos1[3]={0,471.8999,165.2599};
359 //Chamber(0).SetChamberTransform(pos1[0],pos1[1],pos1[2],
360 //new TRotMatrix("rot993","rot993",90,0,70.69,90,19.30999,-90);
361 node = new TNode("RICH1","RICH1","S_RICH",pos1[0],pos1[1],pos1[2],"rot993");
362 node->SetLineColor(kColorRICH);
364 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
365 subnode->SetLineColor(kGreen);
366 fNodes->Add(subnode);
367 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
368 subnode->SetLineColor(kGreen);
369 fNodes->Add(subnode);
370 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
371 subnode->SetLineColor(kGreen);
372 fNodes->Add(subnode);
373 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
374 subnode->SetLineColor(kGreen);
375 fNodes->Add(subnode);
376 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
377 subnode->SetLineColor(kGreen);
378 fNodes->Add(subnode);
379 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
380 subnode->SetLineColor(kGreen);
381 fNodes->Add(subnode);
386 //Float_t pos2[3]={171,470,0};
387 //Chamber(1).SetChamberTransform(pos2[0],pos2[1],pos2[2],
388 //new TRotMatrix("rot994","rot994",90,-20,90,70,0,0);
389 node = new TNode("RICH2","RICH2","S_RICH",pos2[0],pos2[1],pos2[2],"rot994");
390 node->SetLineColor(kColorRICH);
392 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
393 subnode->SetLineColor(kGreen);
394 fNodes->Add(subnode);
395 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
396 subnode->SetLineColor(kGreen);
397 fNodes->Add(subnode);
398 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
399 subnode->SetLineColor(kGreen);
400 fNodes->Add(subnode);
401 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
402 subnode->SetLineColor(kGreen);
403 fNodes->Add(subnode);
404 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
405 subnode->SetLineColor(kGreen);
406 fNodes->Add(subnode);
407 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
408 subnode->SetLineColor(kGreen);
409 fNodes->Add(subnode);
414 //Float_t pos3[3]={0,500,0};
415 //Chamber(2).SetChamberTransform(pos3[0],pos3[1],pos3[2],
416 //new TRotMatrix("rot995","rot995",90,0,90,90,0,0);
417 node = new TNode("RICH3","RICH3","S_RICH",pos3[0],pos3[1],pos3[2],"rot995");
418 node->SetLineColor(kColorRICH);
420 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
421 subnode->SetLineColor(kGreen);
422 fNodes->Add(subnode);
423 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
424 subnode->SetLineColor(kGreen);
425 fNodes->Add(subnode);
426 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
427 subnode->SetLineColor(kGreen);
428 fNodes->Add(subnode);
429 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
430 subnode->SetLineColor(kGreen);
431 fNodes->Add(subnode);
432 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
433 subnode->SetLineColor(kGreen);
434 fNodes->Add(subnode);
435 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
436 subnode->SetLineColor(kGreen);
437 fNodes->Add(subnode);
441 //Float_t pos4[3]={-171,470,0};
442 //Chamber(3).SetChamberTransform(pos4[0],pos4[1],pos4[2],
443 //new TRotMatrix("rot996","rot996",90,20,90,110,0,0);
444 node = new TNode("RICH4","RICH4","S_RICH",pos4[0],pos4[1],pos4[2],"rot996");
445 node->SetLineColor(kColorRICH);
447 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
448 subnode->SetLineColor(kGreen);
449 fNodes->Add(subnode);
450 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
451 subnode->SetLineColor(kGreen);
452 fNodes->Add(subnode);
453 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
454 subnode->SetLineColor(kGreen);
455 fNodes->Add(subnode);
456 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
457 subnode->SetLineColor(kGreen);
458 fNodes->Add(subnode);
459 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
460 subnode->SetLineColor(kGreen);
461 fNodes->Add(subnode);
462 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
463 subnode->SetLineColor(kGreen);
464 fNodes->Add(subnode);
469 //Float_t pos5[3]={161.3999,443.3999,-165.3};
470 //Chamber(4).SetChamberTransform(pos5[0],pos5[1],pos5[2],
471 //new TRotMatrix("rot997","rot997",90,340,108.1999,70,18.2,70);
472 node = new TNode("RICH5","RICH5","S_RICH",pos5[0],pos5[1],pos5[2],"rot997");
473 node->SetLineColor(kColorRICH);
475 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
476 subnode->SetLineColor(kGreen);
477 fNodes->Add(subnode);
478 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
479 subnode->SetLineColor(kGreen);
480 fNodes->Add(subnode);
481 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
482 subnode->SetLineColor(kGreen);
483 fNodes->Add(subnode);
484 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
485 subnode->SetLineColor(kGreen);
486 fNodes->Add(subnode);
487 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
488 subnode->SetLineColor(kGreen);
489 fNodes->Add(subnode);
490 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
491 subnode->SetLineColor(kGreen);
492 fNodes->Add(subnode);
497 //Float_t pos6[3]={0., 471.9, -165.3,};
498 //Chamber(5).SetChamberTransform(pos6[0],pos6[1],pos6[2],
499 //new TRotMatrix("rot998","rot998",90,0,109.3099,90,19.30999,90);
500 node = new TNode("RICH6","RICH6","S_RICH",pos6[0],pos6[1],pos6[2],"rot998");
501 node->SetLineColor(kColorRICH);
502 fNodes->Add(node);node->cd();
503 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
504 subnode->SetLineColor(kGreen);
505 fNodes->Add(subnode);
506 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
507 subnode->SetLineColor(kGreen);
508 fNodes->Add(subnode);
509 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
510 subnode->SetLineColor(kGreen);
511 fNodes->Add(subnode);
512 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
513 subnode->SetLineColor(kGreen);
514 fNodes->Add(subnode);
515 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
516 subnode->SetLineColor(kGreen);
517 fNodes->Add(subnode);
518 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
519 subnode->SetLineColor(kGreen);
520 fNodes->Add(subnode);
524 //Float_t pos7[3]={-161.399,443.3999,-165.3};
525 //Chamber(6).SetChamberTransform(pos7[0],pos7[1],pos7[2],
526 //new TRotMatrix("rot999","rot999",90,20,108.1999,110,18.2,110);
527 node = new TNode("RICH7","RICH7","S_RICH",pos7[0],pos7[1],pos7[2],"rot999");
528 node->SetLineColor(kColorRICH);
530 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
531 subnode->SetLineColor(kGreen);
532 fNodes->Add(subnode);
533 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
534 subnode->SetLineColor(kGreen);
535 fNodes->Add(subnode);
536 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
537 subnode->SetLineColor(kGreen);
538 fNodes->Add(subnode);
539 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
540 subnode->SetLineColor(kGreen);
541 fNodes->Add(subnode);
542 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
543 subnode->SetLineColor(kGreen);
544 fNodes->Add(subnode);
545 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
546 subnode->SetLineColor(kGreen);
547 fNodes->Add(subnode);
549 if(GetDebug())Info("BuildGeometry","Stop.");
550 }//void AliRICH::BuildGeometry()
551 //______________________________________________________________________________
552 void AliRICH::CreateGeometry()
554 // Create the geometry for RICH version 1
556 // Modified by: N. Colonna (INFN - BARI, Nicola.Colonna@ba.infn.it)
557 // R.A. Fini (INFN - BARI, Rosanna.Fini@ba.infn.it)
558 // R.A. Loconsole (Bari University, loco@riscom.ba.infn.it)
562 <img src="picts/AliRICHv1.gif">
567 <img src="picts/AliRICHv1Tree.gif">
571 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
572 AliRICHSegmentationV0* segmentation;
573 AliRICHGeometry* geometry;
574 AliRICHChamber* iChamber;
576 iChamber = &(pRICH->Chamber(0));
577 segmentation=(AliRICHSegmentationV0*) iChamber->GetSegmentationModel();
578 geometry=iChamber->GetGeometryModel();
581 distance = geometry->GetFreonThickness()/2 + geometry->GetQuartzThickness() + geometry->GetGapThickness();
582 geometry->SetRadiatorToPads(distance);
584 //Opaque quartz thickness
585 Float_t oqua_thickness = .5;
588 //Float_t csi_length = 160*.8 + 2.6;
589 //Float_t csi_width = 144*.84 + 2*2.6;
591 Float_t csi_width = segmentation->Npx()*segmentation->Dpx() + segmentation->DeadZone();
592 Float_t csi_length = segmentation->Npy()*segmentation->Dpy() + 2*segmentation->DeadZone();
594 //printf("\n\n\n\n\n In CreateGeometry() npx: %d, npy: %d, dpx: %f, dpy:%f deadzone: %f \n\n\n\n\n\n",segmentation->Npx(),segmentation->Npy(),segmentation->Dpx(),segmentation->Dpy(),segmentation->DeadZone());
596 Int_t *idtmed = fIdtmed->GetArray()-999;
603 // --- Define the RICH detector
604 // External aluminium box
606 par[1] = 13; //Original Settings
611 gMC->Gsvolu("RICH", "BOX ", idtmed[1009], par, 3);
615 par[1] = 13; //Original Settings
620 gMC->Gsvolu("SRIC", "BOX ", idtmed[1000], par, 3);
622 // Air 2 (cutting the lower part of the box)
625 par[1] = 3; //Original Settings
627 gMC->Gsvolu("AIR2", "BOX ", idtmed[1000], par, 3);
629 // Air 3 (cutting the lower part of the box)
632 par[1] = 3; //Original Settings
634 gMC->Gsvolu("AIR3", "BOX ", idtmed[1000], par, 3);
638 par[1] = .188; //Original Settings
643 gMC->Gsvolu("HONE", "BOX ", idtmed[1001], par, 3);
647 par[1] = .025; //Original Settings
652 gMC->Gsvolu("ALUM", "BOX ", idtmed[1009], par, 3);
655 par[0] = geometry->GetQuartzWidth()/2;
656 par[1] = geometry->GetQuartzThickness()/2;
657 par[2] = geometry->GetQuartzLength()/2;
659 par[1] = .25; //Original Settings
661 /*par[0] = geometry->GetQuartzWidth()/2;
662 par[1] = geometry->GetQuartzThickness()/2;
663 par[2] = geometry->GetQuartzLength()/2;*/
664 //printf("\n\n\n\n\n\n\n\\n\n\n\n Gap Thickness: %f %f %f\n\n\n\n\n\n\n\n\n\n\n\n\n\n",par[0],par[1],par[2]);
665 gMC->Gsvolu("QUAR", "BOX ", idtmed[1002], par, 3);
667 // Spacers (cylinders)
670 par[2] = geometry->GetFreonThickness()/2;
671 gMC->Gsvolu("SPAC", "TUBE", idtmed[1002], par, 3);
673 // Feet (freon slabs supports)
678 gMC->Gsvolu("FOOT", "BOX", idtmed[1009], par, 3);
681 par[0] = geometry->GetQuartzWidth()/2;
683 par[2] = geometry->GetQuartzLength()/2;
685 par[1] = .2; //Original Settings
690 gMC->Gsvolu("OQUA", "BOX ", idtmed[1007], par, 3);
692 // Frame of opaque quartz
693 par[0] = geometry->GetOuterFreonWidth()/2;
695 par[1] = geometry->GetFreonThickness()/2;
696 par[2] = geometry->GetOuterFreonLength()/2;
699 par[1] = .5; //Original Settings
704 gMC->Gsvolu("OQF1", "BOX ", idtmed[1007], par, 3);
706 par[0] = geometry->GetInnerFreonWidth()/2;
707 par[1] = geometry->GetFreonThickness()/2;
708 par[2] = geometry->GetInnerFreonLength()/2;
709 gMC->Gsvolu("OQF2", "BOX ", idtmed[1007], par, 3);
711 // Little bar of opaque quartz
713 //par[1] = geometry->GetQuartzThickness()/2;
714 //par[2] = geometry->GetInnerFreonLength()/2 - 2.4;
715 //par[2] = geometry->GetInnerFreonLength()/2;
718 par[1] = .25; //Original Settings
723 //gMC->Gsvolu("BARR", "BOX ", idtmed[1007], par, 3);
726 par[0] = geometry->GetOuterFreonWidth()/2 - oqua_thickness;
727 par[1] = geometry->GetFreonThickness()/2;
728 par[2] = geometry->GetOuterFreonLength()/2 - 2*oqua_thickness;
730 par[1] = .5; //Original Settings
735 gMC->Gsvolu("FRE1", "BOX ", idtmed[1003], par, 3);
737 par[0] = geometry->GetInnerFreonWidth()/2 - oqua_thickness;
738 par[1] = geometry->GetFreonThickness()/2;
739 par[2] = geometry->GetInnerFreonLength()/2 - 2*oqua_thickness;
740 gMC->Gsvolu("FRE2", "BOX ", idtmed[1003], par, 3);
744 par[0] = csi_width/2;
745 par[1] = geometry->GetGapThickness()/2;
746 //printf("\n\n\n\n\n\n\n\\n\n\n\n Gap Thickness: %f\n\n\n\n\n\n\n\n\n\n\n\n\n\n",par[1]);
748 par[2] = csi_length/2;
749 gMC->Gsvolu("META", "BOX ", idtmed[1004], par, 3);
753 par[0] = csi_width/2;
754 par[1] = geometry->GetProximityGapThickness()/2;
755 //printf("\n\n\n\n\n\n\n\\n\n\n\n Gap Thickness: %f\n\n\n\n\n\n\n\n\n\n\n\n\n\n",par[1]);
757 par[2] = csi_length/2;
758 gMC->Gsvolu("GAP ", "BOX ", idtmed[1008], par, 3);
762 par[0] = csi_width/2;
765 par[2] = csi_length/2;
766 gMC->Gsvolu("CSI ", "BOX ", idtmed[1005], par, 3);
772 gMC->Gsvolu("GRID", "TUBE", idtmed[1006], par, 3);
777 par[0] = csi_width/2;
780 gMC->Gsvolu("WSMe", "BOX ", idtmed[1009], par, 3);
782 // Ceramic pick up (base)
784 par[0] = csi_width/2;
787 gMC->Gsvolu("WSG1", "BOX ", idtmed[1010], par, 3);
789 // Ceramic pick up (head)
791 par[0] = csi_width/2;
794 gMC->Gsvolu("WSG2", "BOX ", idtmed[1010], par, 3);
796 // Aluminium supports for methane and CsI
799 par[0] = csi_width/2;
800 par[1] = geometry->GetGapThickness()/2 + .25;
801 par[2] = (68.35 - csi_length/2)/2;
802 gMC->Gsvolu("SMSH", "BOX", idtmed[1009], par, 3);
806 par[0] = (66.3 - csi_width/2)/2;
807 par[1] = geometry->GetGapThickness()/2 + .25;
808 par[2] = csi_length/2 + 68.35 - csi_length/2;
809 gMC->Gsvolu("SMLG", "BOX", idtmed[1009], par, 3);
811 // Aluminium supports for freon
814 par[0] = geometry->GetQuartzWidth()/2;
816 par[2] = (68.35 - geometry->GetQuartzLength()/2)/2;
817 gMC->Gsvolu("SFSH", "BOX", idtmed[1009], par, 3);
821 par[0] = (66.3 - geometry->GetQuartzWidth()/2)/2;
823 par[2] = geometry->GetQuartzLength()/2 + 68.35 - geometry->GetQuartzLength()/2;
824 gMC->Gsvolu("SFLG", "BOX", idtmed[1009], par, 3);
828 par[0] = csi_width/2;
830 par[2] = csi_length/4 -.5025;
831 gMC->Gsvolu("PCB ", "BOX", idtmed[1011], par, 3);
834 // Backplane supports
841 gMC->Gsvolu("BACK", "BOX", idtmed[1009], par, 3);
848 gMC->Gsvolu("BKHL", "BOX", idtmed[1000], par, 3);
855 gMC->Gsvolu("BKHS", "BOX", idtmed[1000], par, 3);
857 // Place holes inside backplane support
859 gMC->Gspos("BKHS", 1, "BACK", .8 + 5.7,0., .6 + 4.4625, 0, "ONLY");
860 gMC->Gspos("BKHS", 2, "BACK", -.8 - 5.7,0., .6 + 4.4625, 0, "ONLY");
861 gMC->Gspos("BKHS", 3, "BACK", .8 + 5.7,0., -.6 - 4.4625, 0, "ONLY");
862 gMC->Gspos("BKHS", 4, "BACK", -.8 - 5.7,0., -.6 - 4.4625, 0, "ONLY");
863 gMC->Gspos("BKHS", 5, "BACK", .8 + 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
864 gMC->Gspos("BKHS", 6, "BACK", -.8 - 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
865 gMC->Gspos("BKHS", 7, "BACK", .8 + 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
866 gMC->Gspos("BKHS", 8, "BACK", -.8 - 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
867 gMC->Gspos("BKHL", 1, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., .6 + 4.4625, 0, "ONLY");
868 gMC->Gspos("BKHL", 2, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 4.4625, 0, "ONLY");
869 gMC->Gspos("BKHL", 3, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 4.4625, 0, "ONLY");
870 gMC->Gspos("BKHL", 4, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 4.4625, 0, "ONLY");
871 gMC->Gspos("BKHL", 5, "BACK", .8 + 11.4+ 1.6 + 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
872 gMC->Gspos("BKHL", 6, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
873 gMC->Gspos("BKHL", 7, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
874 gMC->Gspos("BKHL", 8, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
878 // --- Places the detectors defined with GSVOLU
879 // Place material inside RICH
880 gMC->Gspos("SRIC", 1, "RICH", 0.,0., 0., 0, "ONLY");
881 gMC->Gspos("AIR2", 1, "RICH", 66.3 + 1.2505, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 0., 0, "ONLY");
882 gMC->Gspos("AIR2", 2, "RICH", -66.3 - 1.2505, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 0., 0, "ONLY");
883 gMC->Gspos("AIR3", 1, "RICH", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, -68.35 - 1.25, 0, "ONLY");
884 gMC->Gspos("AIR3", 2, "RICH", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 68.35 + 1.25, 0, "ONLY");
887 gMC->Gspos("ALUM", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.025, 0., 0, "ONLY");
888 gMC->Gspos("HONE", 1, "SRIC", 0., 1.276- geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .188, 0., 0, "ONLY");
889 gMC->Gspos("ALUM", 2, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .025, 0., 0, "ONLY");
890 gMC->Gspos("FOOT", 1, "SRIC", 64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
891 gMC->Gspos("FOOT", 2, "SRIC", 21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3 , 36.9, 0, "ONLY");
892 gMC->Gspos("FOOT", 3, "SRIC", -21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
893 gMC->Gspos("FOOT", 4, "SRIC", -64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
894 gMC->Gspos("FOOT", 5, "SRIC", 64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
895 gMC->Gspos("FOOT", 6, "SRIC", 21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
896 gMC->Gspos("FOOT", 7, "SRIC", -21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
897 gMC->Gspos("FOOT", 8, "SRIC", -64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
898 gMC->Gspos("OQUA", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .2, 0., 0, "ONLY");
903 gMC->Gspos("SMLG", 1, "SRIC", csi_width/2 + (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
904 gMC->Gspos("SMLG", 2, "SRIC", - csi_width/2 - (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
905 gMC->Gspos("SMSH", 1, "SRIC", 0., 1.276 + .25, csi_length/2 + (68.35 - csi_length/2)/2, 0, "ONLY");
906 gMC->Gspos("SMSH", 2, "SRIC", 0., 1.276 + .25, - csi_length/2 - (68.35 - csi_length/2)/2, 0, "ONLY");
910 Float_t supp_y = 1.276 - geometry->GetGapThickness()/2- geometry->GetQuartzThickness() -geometry->GetFreonThickness() - .2 + .3; //y position of freon supports
912 gMC->Gspos("SFLG", 1, "SRIC", geometry->GetQuartzWidth()/2 + (66.3 - geometry->GetQuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
913 gMC->Gspos("SFLG", 2, "SRIC", - geometry->GetQuartzWidth()/2 - (66.3 - geometry->GetQuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
914 gMC->Gspos("SFSH", 1, "SRIC", 0., supp_y, geometry->GetQuartzLength()/2 + (68.35 - geometry->GetQuartzLength()/2)/2, 0, "ONLY");
915 gMC->Gspos("SFSH", 2, "SRIC", 0., supp_y, - geometry->GetQuartzLength()/2 - (68.35 - geometry->GetQuartzLength()/2)/2, 0, "ONLY");
917 AliMatrix(idrotm[1019], 0., 0., 90., 0., 90., 90.);
919 //Placing of the spacers inside the freon slabs
922 //printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n Spacers:%d\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",nspacers);
924 //printf("Nspacers: %d", nspacers);
926 for (i = 0; i < nspacers/3; i++) {
927 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
928 gMC->Gspos("SPAC", i, "FRE1", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
931 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
932 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
933 gMC->Gspos("SPAC", i, "FRE1", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
936 for (i = (nspacers*2)/3; i < nspacers; ++i) {
937 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
938 gMC->Gspos("SPAC", i, "FRE1", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
941 for (i = 0; i < nspacers/3; i++) {
942 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
943 gMC->Gspos("SPAC", i, "FRE2", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
946 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
947 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
948 gMC->Gspos("SPAC", i, "FRE2", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
951 for (i = (nspacers*2)/3; i < nspacers; ++i) {
952 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
953 gMC->Gspos("SPAC", i, "FRE2", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
957 gMC->Gspos("FRE1", 1, "OQF1", 0., 0., 0., 0, "ONLY");
958 gMC->Gspos("FRE2", 1, "OQF2", 0., 0., 0., 0, "ONLY");
959 gMC->Gspos("OQF1", 1, "SRIC", geometry->GetOuterFreonWidth()/2 + geometry->GetInnerFreonWidth()/2 + 2, 1.276 - geometry->GetGapThickness()/2- geometry->GetQuartzThickness() -geometry->GetFreonThickness()/2, 0., 0, "ONLY"); //Original settings (31.3)
960 // printf("Opaque quartz in SRIC %f\n", 1.276 - geometry->GetGapThickness()/2- geometry->GetQuartzThickness() -geometry->GetFreonThickness()/2);
961 gMC->Gspos("OQF2", 2, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()/2, 0., 0, "ONLY"); //Original settings
962 gMC->Gspos("OQF1", 3, "SRIC", - (geometry->GetOuterFreonWidth()/2 + geometry->GetInnerFreonWidth()/2) - 2, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()/2, 0., 0, "ONLY"); //Original settings (-31.3)
963 //gMC->Gspos("BARR", 1, "QUAR", - geometry->GetInnerFreonWidth()/2 - oqua_thickness, 0., 0., 0, "ONLY"); //Original settings (-21.65)
964 //gMC->Gspos("BARR", 2, "QUAR", geometry->GetInnerFreonWidth()/2 + oqua_thickness, 0., 0., 0, "ONLY"); //Original settings (21.65)
965 gMC->Gspos("QUAR", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness()/2, 0., 0, "ONLY");
966 gMC->Gspos("GAP ", 1, "META", 0., geometry->GetGapThickness()/2 - geometry->GetProximityGapThickness()/2 - 0.0001, 0., 0, "ONLY");
967 gMC->Gspos("META", 1, "SRIC", 0., 1.276, 0., 0, "ONLY");
968 gMC->Gspos("CSI ", 1, "SRIC", 0., 1.276 + geometry->GetGapThickness()/2 + .25, 0., 0, "ONLY");
969 printf("CSI pos: %f\n",1.276 + geometry->GetGapThickness()/2 + .25);
971 // Wire support placing
973 gMC->Gspos("WSG2", 1, "GAP ", 0., geometry->GetProximityGapThickness()/2 - .1, 0., 0, "ONLY");
974 gMC->Gspos("WSG1", 1, "CSI ", 0., 0., 0., 0, "ONLY");
975 gMC->Gspos("WSMe", 1, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, 0., 0, "ONLY");
979 gMC->Gspos("BACK", 1, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 43.3, 0, "ONLY");
980 gMC->Gspos("BACK", 2, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2 , 43.3, 0, "ONLY");
981 gMC->Gspos("BACK", 3, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
982 gMC->Gspos("BACK", 4, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
983 gMC->Gspos("BACK", 5, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
984 gMC->Gspos("BACK", 6, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
988 gMC->Gspos("PCB ", 1, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, csi_width/4 + .5025 + 2.5, 0, "ONLY");
989 gMC->Gspos("PCB ", 2, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, -csi_width/4 - .5025 - 2.5, 0, "ONLY");
993 //printf("Position of the gap: %f to %f\n", 1.276 + geometry->GetGapThickness()/2 - geometry->GetProximityGapThickness()/2 - .2, 1.276 + geometry->GetGapThickness()/2 - geometry->GetProximityGapThickness()/2 + .2);
995 // Place RICH inside ALICE apparatus
999 AliMatrix(idrotm[1000], 90., 0., 70.69, 90., 19.31, -90.);
1000 AliMatrix(idrotm[1001], 90., -20., 90., 70., 0., 0.);
1001 AliMatrix(idrotm[1002], 90., 0., 90., 90., 0., 0.);
1002 AliMatrix(idrotm[1003], 90., 20., 90., 110., 0., 0.);
1003 AliMatrix(idrotm[1004], 90., 340., 108.2, 70., 18.2, 70.);
1004 AliMatrix(idrotm[1005], 90., 0., 109.31, 90., 19.31, 90.);
1005 AliMatrix(idrotm[1006], 90., 20., 108.2, 110., 18.2, 110.);
1007 gMC->Gspos("RICH", 1, "ALIC", 0., 471.9, 165.26, idrotm[1000], "ONLY");
1008 gMC->Gspos("RICH", 2, "ALIC", 171., 470., 0., idrotm[1001], "ONLY");
1009 gMC->Gspos("RICH", 3, "ALIC", 0., 500., 0., idrotm[1002], "ONLY");
1010 gMC->Gspos("RICH", 4, "ALIC", -171., 470., 0., idrotm[1003], "ONLY");
1011 gMC->Gspos("RICH", 5, "ALIC", 161.4, 443.4, -165.3, idrotm[1004], "ONLY");
1012 gMC->Gspos("RICH", 6, "ALIC", 0., 471.9, -165.3, idrotm[1005], "ONLY");
1013 gMC->Gspos("RICH", 7, "ALIC", -161.4, 443.4, -165.3, idrotm[1006], "ONLY");*/
1015 // The placing of the chambers is measured from the vertex to the base of the methane vessel (490 cm)
1017 Float_t offset = 490 + 1.276 - geometry->GetGapThickness()/2; //distance from center of mother volume to methane
1018 Float_t deltaphi = 19.5; //phi angle between center of chambers - z direction
1019 Float_t deltatheta = 20; //theta angle between center of chambers - x direction
1020 Float_t cosphi = TMath::Cos(deltaphi*TMath::Pi()/180);
1021 Float_t sinphi = TMath::Sin(deltaphi*TMath::Pi()/180);
1022 Float_t costheta = TMath::Cos(deltatheta*TMath::Pi()/180);
1023 Float_t sintheta = TMath::Sin(deltatheta*TMath::Pi()/180);
1025 //printf("\n\n%f %f %f %f %f %f %f\n\n",offset,deltatheta,deltaphi,cosphi,costheta,sinphi,sintheta);
1027 AliMatrix(idrotm[1000], 90., 0. , 90. - deltaphi, 90. , deltaphi, -90. );
1028 AliMatrix(idrotm[1001], 90., -deltatheta , 90. , 90.- deltatheta , 0. , 0. );
1029 AliMatrix(idrotm[1002], 90., 0. , 90. , 90. , 0. , 0. );
1030 AliMatrix(idrotm[1003], 90., deltatheta , 90. , 90 + deltatheta , 0. , 0. );
1031 AliMatrix(idrotm[1004], 90., 360. - deltatheta, 108.2 , 90.- deltatheta ,18.2 , 90 - deltatheta);
1032 AliMatrix(idrotm[1005], 90., 0. , 90 + deltaphi , 90. , deltaphi, 90. );
1033 AliMatrix(idrotm[1006], 90., deltatheta , 108.2 , 90.+ deltatheta ,18.2 , 90 + deltatheta);
1035 gMC->Gspos("RICH", 1, "ALIC", 0. , offset*cosphi , offset*sinphi ,idrotm[1000], "ONLY");
1036 gMC->Gspos("RICH", 2, "ALIC", (offset)*sintheta , offset*costheta , 0. ,idrotm[1001], "ONLY");
1037 gMC->Gspos("RICH", 3, "ALIC", 0. , offset , 0. ,idrotm[1002], "ONLY");
1038 gMC->Gspos("RICH", 4, "ALIC", -(offset)*sintheta, offset*costheta , 0. ,idrotm[1003], "ONLY");
1039 gMC->Gspos("RICH", 5, "ALIC", (offset)*sinphi , offset*costheta*cosphi, -offset*sinphi,idrotm[1004], "ONLY");
1040 gMC->Gspos("RICH", 6, "ALIC", 0. , offset*cosphi , -offset*sinphi,idrotm[1005], "ONLY");
1041 gMC->Gspos("RICH", 7, "ALIC", -(offset)*sinphi , offset*costheta*cosphi, -offset*sinphi,idrotm[1006], "ONLY");
1044 //______________________________________________________________________________
1045 void AliRICH::CreateMaterials()
1048 // *** DEFINITION OF AVAILABLE RICH MATERIALS ***
1049 // ORIGIN : NICK VAN EIJNDHOVEN
1050 // Modified by: N. Colonna (INFN - BARI, Nicola.Colonna@ba.infn.it)
1051 // R.A. Fini (INFN - BARI, Rosanna.Fini@ba.infn.it)
1052 // R.A. Loconsole (Bari University, loco@riscom.ba.infn.it)
1054 Int_t isxfld = gAlice->Field()->Integ();
1055 Float_t sxmgmx = gAlice->Field()->Max();
1058 /************************************Antonnelo's Values (14-vectors)*****************************************/
1060 Float_t ppckov[14] = { 5.63e-9,5.77e-9,5.9e-9,6.05e-9,6.2e-9,6.36e-9,6.52e-9,
1061 6.7e-9,6.88e-9,7.08e-9,7.3e-9,7.51e-9,7.74e-9,8e-9 };
1062 Float_t rIndexQuarz[14] = { 1.528309,1.533333,
1063 1.538243,1.544223,1.550568,1.55777,
1064 1.565463,1.574765,1.584831,1.597027,
1065 1.611858,1.6277,1.6472,1.6724 };
1066 Float_t rIndexOpaqueQuarz[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1067 Float_t rIndexMethane[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1068 Float_t rIndexGrid[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1069 Float_t abscoFreon[14] = { 179.0987,179.0987,
1070 179.0987,179.0987,179.0987,142.92,56.65,13.95,10.43,7.07,2.03,.5773,.33496,0. };
1071 //Float_t abscoFreon[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,
1072 // 1e-5,1e-5,1e-5,1e-5,1e-5 };
1073 Float_t abscoQuarz[14] = { 64.035,39.98,35.665,31.262,27.527,22.815,21.04,17.52,
1074 14.177,9.282,4.0925,1.149,.3627,.10857 };
1075 Float_t abscoOpaqueQuarz[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,
1076 1e-5,1e-5,1e-5,1e-5,1e-5 };
1077 Float_t abscoCsI[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
1078 1e-4,1e-4,1e-4,1e-4 };
1079 Float_t abscoMethane[14] = { 1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,
1081 Float_t abscoGrid[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
1082 1e-4,1e-4,1e-4,1e-4 };
1083 Float_t efficAll[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1084 Float_t efficCsI[14] = { 6e-4,.005,.0075,.01125,.045,.117,.135,.16575,
1085 .17425,.1785,.1836,.1904,.1938,.221 };
1086 Float_t efficGrid[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1090 /**********************************End of Antonnelo's Values**********************************/
1092 /**********************************Values from rich_media.f (31-vectors)**********************************/
1095 //Photons energy intervals
1099 ppckov[i] = (Float_t(i)*0.1+5.5)*1e-9;
1100 //printf ("Energy intervals: %e\n",ppckov[i]);
1104 //Refraction index for quarz
1105 Float_t rIndexQuarz[26];
1112 Float_t ene=ppckov[i]*1e9;
1113 Float_t a=f1/(e1*e1 - ene*ene);
1114 Float_t b=f2/(e2*e2 - ene*ene);
1115 rIndexQuarz[i] = TMath::Sqrt(1. + a + b );
1116 //printf ("rIndexQuarz: %e\n",rIndexQuarz[i]);
1119 //Refraction index for opaque quarz, methane and grid
1120 Float_t rIndexOpaqueQuarz[26];
1121 Float_t rIndexMethane[26];
1122 Float_t rIndexGrid[26];
1125 rIndexOpaqueQuarz[i]=1;
1126 rIndexMethane[i]=1.000444;
1128 //printf ("rIndexOpaqueQuarz , etc: %e, %e, %e\n",rIndexOpaqueQuarz[i], rIndexMethane[i], rIndexGrid[i]=1);
1131 //Absorption index for freon
1132 Float_t abscoFreon[26] = {179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987,
1133 179.0987, 142.9206, 56.64957, 25.58622, 13.95293, 12.03905, 10.42953, 8.804196,
1134 7.069031, 4.461292, 2.028366, 1.293013, .577267, .40746, .334964, 0., 0., 0.};
1136 //Absorption index for quarz
1137 /*Float_t Qzt [21] = {.0,.0,.005,.04,.35,.647,.769,.808,.829,.844,.853,.858,.869,.887,.903,.902,.902,
1138 .906,.907,.907,.907};
1139 Float_t Wavl2[] = {150.,155.,160.0,165.0,170.0,175.0,180.0,185.0,190.0,195.0,200.0,205.0,210.0,
1140 215.0,220.0,225.0,230.0,235.0,240.0,245.0,250.0};
1141 Float_t abscoQuarz[31];
1142 for (Int_t i=0;i<31;i++)
1144 Float_t Xlam = 1237.79 / (ppckov[i]*1e9);
1145 if (Xlam <= 160) abscoQuarz[i] = 0;
1146 if (Xlam > 250) abscoQuarz[i] = 1;
1149 for (Int_t j=0;j<21;j++)
1151 //printf ("Passed\n");
1152 if (Xlam > Wavl2[j] && Xlam < Wavl2[j+1])
1154 Float_t Dabs = (Qzt[j+1] - Qzt[j])/(Wavl2[j+1] - Wavl2[j]);
1155 Float_t Abso = Qzt[j] + Dabs*(Xlam - Wavl2[j]);
1156 abscoQuarz[i] = -5.0/(TMath::Log(Abso));
1160 printf ("abscoQuarz: %e abscoFreon: %e for energy: %e\n",abscoQuarz[i],abscoFreon[i],ppckov[i]);
1163 /*Float_t abscoQuarz[31] = {49.64211, 48.41296, 47.46989, 46.50492, 45.13682, 44.47883, 43.1929 , 41.30922, 40.5943 ,
1164 39.82956, 38.98623, 38.6247 , 38.43448, 37.41084, 36.22575, 33.74852, 30.73901, 24.25086,
1165 17.94531, 11.88753, 5.99128, 3.83503, 2.36661, 1.53155, 1.30582, 1.08574, .8779708,
1166 .675275, 0., 0., 0.};
1168 for (Int_t i=0;i<31;i++)
1170 abscoQuarz[i] = abscoQuarz[i]/10;
1173 Float_t abscoQuarz [26] = {105.8, 65.52, 48.58, 42.85, 35.79, 31.262, 28.598, 27.527, 25.007, 22.815, 21.004,
1174 19.266, 17.525, 15.878, 14.177, 11.719, 9.282, 6.62, 4.0925, 2.601, 1.149, .667, .3627,
1175 .192, .1497, .10857};
1177 //Absorption index for methane
1178 Float_t abscoMethane[26];
1181 abscoMethane[i]=AbsoCH4(ppckov[i]*1e9);
1182 //printf("abscoMethane: %e for energy: %e\n", abscoMethane[i],ppckov[i]*1e9);
1185 //Absorption index for opaque quarz, csi and grid, efficiency for all and grid
1186 Float_t abscoOpaqueQuarz[26];
1187 Float_t abscoCsI[26];
1188 Float_t abscoGrid[26];
1189 Float_t efficAll[26];
1190 Float_t efficGrid[26];
1193 abscoOpaqueQuarz[i]=1e-5;
1198 //printf ("All must be 1: %e, %e, %e, %e, %e\n",abscoOpaqueQuarz[i],abscoCsI[i],abscoGrid[i],efficAll[i],efficGrid[i]);
1201 //Efficiency for csi
1203 Float_t efficCsI[26] = {0.000199999995, 0.000600000028, 0.000699999975, 0.00499999989, 0.00749999983, 0.010125,
1204 0.0242999997, 0.0405000001, 0.0688500032, 0.105299994, 0.121500008, 0.141749993, 0.157949999,
1205 0.162, 0.166050002, 0.167669997, 0.174299985, 0.176789999, 0.179279998, 0.182599992, 0.18592,
1206 0.187579989, 0.189239994, 0.190899998, 0.207499996, 0.215799987};
1210 //FRESNEL LOSS CORRECTION FOR PERPENDICULAR INCIDENCE AND
1211 //UNPOLARIZED PHOTONS
1215 efficCsI[i] = efficCsI[i]/(1.-Fresnel(ppckov[i]*1e9,1.,0));
1216 //printf ("Fresnel result: %e for energy: %e\n",Fresnel(ppckov[i]*1e9,1.,0),ppckov[i]*1e9);
1219 /*******************************************End of rich_media.f***************************************/
1226 Float_t afre[2], agri, amet[2], aqua[2], ahon, zfre[2], zgri, zhon,
1230 Int_t nlmatmet, nlmatqua;
1231 Float_t wmatquao[2], rIndexFreon[26];
1232 Float_t aquao[2], epsil, stmin, zquao[2];
1234 Float_t radlal, densal, tmaxfd, deemax, stemax;
1235 Float_t aal, zal, radlgri, densfre, radlhon, densgri, denshon,densqua, densmet, wmatfre[2], wmatmet[2], wmatqua[2];
1237 Int_t *idtmed = fIdtmed->GetArray()-999;
1239 // --- Photon energy (GeV)
1240 // --- Refraction indexes
1241 for (i = 0; i < 26; ++i) {
1242 rIndexFreon[i] = ppckov[i] * .0172 * 1e9 + 1.177;
1243 //rIndexFreon[i] = 1;
1244 //printf ("rIndexFreon: %e \n efficCsI: %e for energy: %e\n",rIndexFreon[i], efficCsI[i], ppckov[i]);
1247 // --- Detection efficiencies (quantum efficiency for CsI)
1248 // --- Define parameters for honeycomb.
1249 // Used carbon of equivalent rad. lenght
1256 // --- Parameters to include in GSMIXT, relative to Quarz (SiO2)
1267 // --- Parameters to include in GSMIXT, relative to opaque Quarz (SiO2)
1278 // --- Parameters to include in GSMIXT, relative to Freon (C6F14)
1289 // --- Parameters to include in GSMIXT, relative to methane (CH4)
1300 // --- Parameters to include in GSMIXT, relative to anode grid (Cu)
1307 // --- Parameters to include in GSMATE related to aluminium sheet
1314 // --- Glass parameters
1316 Float_t aglass[5]={12.01, 28.09, 16., 10.8, 23.};
1317 Float_t zglass[5]={ 6., 14., 8., 5., 11.};
1318 Float_t wglass[5]={ 0.5, 0.105, 0.355, 0.03, 0.01};
1319 Float_t dglass=1.74;
1322 AliMaterial(1, "Air $", 14.61, 7.3, .001205, 30420., 67500);
1323 AliMaterial(6, "HON", ahon, zhon, denshon, radlhon, 0);
1324 AliMaterial(16, "CSI", ahon, zhon, denshon, radlhon, 0);
1325 AliMixture(20, "QUA", aqua, zqua, densqua, nlmatqua, wmatqua);
1326 AliMixture(21, "QUAO", aquao, zquao, densquao, nlmatquao, wmatquao);
1327 AliMixture(30, "FRE", afre, zfre, densfre, nlmatfre, wmatfre);
1328 AliMixture(40, "MET", amet, zmet, densmet, nlmatmet, wmatmet);
1329 AliMixture(41, "METG", amet, zmet, densmet, nlmatmet, wmatmet);
1330 AliMaterial(11, "GRI", agri, zgri, densgri, radlgri, 0);
1331 AliMaterial(50, "ALUM", aal, zal, densal, radlal, 0);
1332 AliMixture(32, "GLASS",aglass, zglass, dglass, 5, wglass);
1333 AliMaterial(31, "COPPER$", 63.54, 29., 8.96, 1.4, 0.);
1341 AliMedium(1, "DEFAULT MEDIUM AIR$", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1342 AliMedium(2, "HONEYCOMB$", 6, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1343 AliMedium(3, "QUARZO$", 20, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1344 AliMedium(4, "FREON$", 30, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1345 AliMedium(5, "METANO$", 40, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1346 AliMedium(6, "CSI$", 16, 1, isxfld, sxmgmx,tmaxfd, stemax, deemax, epsil, stmin);
1347 AliMedium(7, "GRIGLIA$", 11, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1348 AliMedium(8, "QUARZOO$", 21, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1349 AliMedium(9, "GAP$", 41, 1, isxfld, sxmgmx,tmaxfd, .1, -deemax, epsil, -stmin);
1350 AliMedium(10, "ALUMINUM$", 50, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1351 AliMedium(11, "GLASS", 32, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1352 AliMedium(12, "PCB_COPPER", 31, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1355 gMC->SetCerenkov(idtmed[1000], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
1356 gMC->SetCerenkov(idtmed[1001], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
1357 gMC->SetCerenkov(idtmed[1002], 26, ppckov, abscoQuarz, efficAll,rIndexQuarz);
1358 gMC->SetCerenkov(idtmed[1003], 26, ppckov, abscoFreon, efficAll,rIndexFreon);
1359 gMC->SetCerenkov(idtmed[1004], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
1360 gMC->SetCerenkov(idtmed[1005], 26, ppckov, abscoCsI, efficCsI, rIndexMethane);
1361 gMC->SetCerenkov(idtmed[1006], 26, ppckov, abscoGrid, efficGrid, rIndexGrid);
1362 gMC->SetCerenkov(idtmed[1007], 26, ppckov, abscoOpaqueQuarz, efficAll, rIndexOpaqueQuarz);
1363 gMC->SetCerenkov(idtmed[1008], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
1364 gMC->SetCerenkov(idtmed[1009], 26, ppckov, abscoGrid, efficGrid, rIndexGrid);
1365 gMC->SetCerenkov(idtmed[1010], 26, ppckov, abscoOpaqueQuarz, efficAll, rIndexOpaqueQuarz);
1367 //______________________________________________________________________________
1368 Float_t AliRICH::Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)
1371 //ENE(EV), PDOTI=COS(INC.ANG.), PDOTR=COS(POL.PLANE ROT.ANG.)
1373 Float_t en[36] = {5.0,5.1,5.2,5.3,5.4,5.5,5.6,5.7,5.8,5.9,6.0,6.1,6.2,
1374 6.3,6.4,6.5,6.6,6.7,6.8,6.9,7.0,7.1,7.2,7.3,7.4,7.5,7.6,7.7,
1375 7.8,7.9,8.0,8.1,8.2,8.3,8.4,8.5};
1378 Float_t csin[36] = {2.14,2.21,2.33,2.48,2.76,2.97,2.99,2.59,2.81,3.05,
1379 2.86,2.53,2.55,2.66,2.79,2.96,3.18,3.05,2.84,2.81,2.38,2.11,
1380 2.01,2.13,2.39,2.73,3.08,3.15,2.95,2.73,2.56,2.41,2.12,1.95,
1383 Float_t csik[36] = {0.,0.,0.,0.,0.,0.196,0.408,0.208,0.118,0.49,0.784,0.543,
1384 0.424,0.404,0.371,0.514,0.922,1.102,1.139,1.376,1.461,1.253,0.878,
1385 0.69,0.612,0.649,0.824,1.347,1.571,1.678,1.763,1.857,1.824,1.824,
1388 Int_t j=Int_t(xe*10)-49;
1389 Float_t cn=csin[j]+((csin[j+1]-csin[j])/0.1)*(xe-en[j]);
1390 Float_t ck=csik[j]+((csik[j+1]-csik[j])/0.1)*(xe-en[j]);
1392 //FORMULAE FROM HANDBOOK OF OPTICS, 33.23 OR
1393 //W.R. HUNTER, J.O.S.A. 54 (1964),15 , J.O.S.A. 55(1965),1197
1395 Float_t sinin=TMath::Sqrt(1-pdoti*pdoti);
1396 Float_t tanin=sinin/pdoti;
1398 Float_t c1=cn*cn-ck*ck-sinin*sinin;
1399 Float_t c2=4*cn*cn*ck*ck;
1400 Float_t aO=TMath::Sqrt(0.5*(TMath::Sqrt(c1*c1+c2)+c1));
1401 Float_t b2=0.5*(TMath::Sqrt(c1*c1+c2)-c1);
1403 Float_t rs=((aO-pdoti)*(aO-pdoti)+b2)/((aO+pdoti)*(aO+pdoti)+b2);
1404 Float_t rp=rs*((aO-sinin*tanin)*(aO-sinin*tanin)+b2)/((aO+sinin*tanin)*(aO+sinin*tanin)+b2);
1407 //CORRECTION FACTOR FOR SURFACE ROUGHNESS
1408 //B.J. STAGG APPLIED OPTICS, 30(1991),4113
1411 Float_t lamb=1240/ene;
1414 Float_t rO=TMath::Exp(-(4*TMath::Pi()*pdoti*sigraf/lamb)*(4*TMath::Pi()*pdoti*sigraf/lamb));
1418 Float_t pdotr=0.8; //DEGREE OF POLARIZATION : 1->P , -1->S
1419 fresn=0.5*(rp*(1+pdotr)+rs*(1-pdotr));
1428 //__________________________________________
1429 Float_t AliRICH::AbsoCH4(Float_t x)
1432 //KLOSCH,SCH4(9),WL(9),EM(9),ALENGTH(31)
1433 Float_t sch4[9] = {.12,.16,.23,.38,.86,2.8,7.9,28.,80.}; //MB X 10^22
1434 //Float_t wl[9] = {153.,152.,151.,150.,149.,148.,147.,146.,145};
1435 Float_t em[9] = {8.1,8.158,8.212,8.267,8.322,8.378,8.435,8.493,8.55};
1436 const Float_t kLosch=2.686763E19; // LOSCHMIDT NUMBER IN CM-3
1437 const Float_t kIgas1=100, kIgas2=0, kOxy=10., kWater=5., kPressure=750.,kTemperature=283.;
1438 Float_t pn=kPressure/760.;
1439 Float_t tn=kTemperature/273.16;
1442 // ------- METHANE CROSS SECTION -----------------
1443 // ASTROPH. J. 214, L47 (1978)
1449 if(x>=7.75 && x<=8.1)
1451 Float_t c0=-1.655279e-1;
1452 Float_t c1=6.307392e-2;
1453 Float_t c2=-8.011441e-3;
1454 Float_t c3=3.392126e-4;
1455 sm=(c0+c1*x+c2*x*x+c3*x*x*x)*1.e-18;
1461 while (x<=em[j] && x>=em[j+1])
1464 Float_t a=(sch4[j+1]-sch4[j])/(em[j+1]-em[j]);
1465 sm=(sch4[j]+a*(x-em[j]))*1e-22;
1469 Float_t dm=(kIgas1/100.)*(1.-((kOxy+kWater)/1.e6))*kLosch*pn/tn;
1470 Float_t abslm=1./sm/dm;
1472 // ------- ISOBUTHANE CROSS SECTION --------------
1473 // i-C4H10 (ai) abs. length from curves in
1474 // Lu-McDonald paper for BARI RICH workshop .
1475 // -----------------------------------------------------------
1484 if(x>=7.25 && x<7.375)
1490 Float_t si = 1./(ai*kLosch*273.16/293.); // ISOB. CRO.SEC.IN CM2
1491 Float_t di=(kIgas2/100.)*(1.-((kOxy+kWater)/1.e6))*kLosch*pn/tn;
1496 // ---------------------------------------------------------
1498 // transmission of O2
1500 // y= path in cm, x=energy in eV
1501 // so= cross section for UV absorption in cm2
1502 // do= O2 molecular density in cm-3
1503 // ---------------------------------------------------------
1511 so=3.392709e-13 * TMath::Exp(2.864104 *x);
1517 so=2.910039e-34 * TMath::Exp(10.3337*x);
1524 Float_t a0=-73770.76;
1525 Float_t a1=46190.69;
1526 Float_t a2=-11475.44;
1527 Float_t a3=1412.611;
1528 Float_t a4=-86.07027;
1529 Float_t a5=2.074234;
1530 so= a0+(a1*x)+(a2*x*x)+(a3*x*x*x)+(a4*x*x*x*x)+(a5*x*x*x*x*x);
1534 Float_t dox=(kOxy/1e6)*kLosch*pn/tn;
1539 // ---------------------------------------------------------
1541 // transmission of H2O
1543 // y= path in cm, x=energy in eV
1544 // sw= cross section for UV absorption in cm2
1545 // dw= H2O molecular density in cm-3
1546 // ---------------------------------------------------------
1550 Float_t b0=29231.65;
1551 Float_t b1=-15807.74;
1552 Float_t b2=3192.926;
1553 Float_t b3=-285.4809;
1554 Float_t b4=9.533944;
1558 Float_t sw= b0+(b1*x)+(b2*x*x)+(b3*x*x*x)+(b4*x*x*x*x);
1560 Float_t dw=(kWater/1e6)*kLosch*pn/tn;
1566 // ---------------------------------------------------------
1568 Float_t alength=1./(1./abslm+1./absli+1./abslo+1./abslw);
1574 //___________________________________________
1575 //____________________________________________
1576 void AliRICH::ResetDigits()
1577 {//Reset number of digits and the digits array for this detector
1578 for ( int i=0;i<kNCH;i++ ) {
1579 if (fDchambers && fDchambers->At(i)) fDchambers->At(i)->Clear();
1580 if (fNdch) fNdch[i]=0;
1583 //____________________________________________
1584 void AliRICH::ResetRawClusters()
1585 {//Reset number of raw clusters and the raw clust array for this detector
1586 for ( int i=0;i<kNCH;i++ ) {
1587 if (fRawClusters->At(i)) ((TClonesArray*)fRawClusters->At(i))->Clear();
1588 if (fNrawch) fNrawch[i]=0;
1591 //____________________________________________
1592 void AliRICH::ResetRecHits1D()
1593 {//Reset number of raw clusters and the raw clust array for this detector
1594 for ( int i=0;i<kNCH;i++ ) {
1595 if (fRecHits1D->At(i)) ((TClonesArray*)fRecHits1D->At(i))->Clear();
1596 if (fNrechits1D) fNrechits1D[i]=0;
1600 //____________________________________________
1601 void AliRICH::ResetRecHits3D()
1602 {// Reset number of raw clusters and the raw clust array for this detector
1603 for ( int i=0;i<kNCH;i++ ) {
1604 if (fRecHits3D->At(i)) ((TClonesArray*)fRecHits3D->At(i))->Clear();
1605 if (fNrechits3D) fNrechits3D[i]=0;
1608 //______________________________________________________________________________
1609 void AliRICH::FindClusters(Int_t nev,Int_t lastEntry)
1613 // Loop on chambers and on cathode planes
1615 for (Int_t icat=1;icat<2;icat++) {
1616 gAlice->ResetDigits();
1617 gAlice->TreeD()->GetEvent(0);
1618 for (Int_t ich=0;ich<kNCH;ich++) {
1619 //PH AliRICHChamber* iChamber=(AliRICHChamber*) (*fChambers)[ich];
1620 AliRICHChamber* iChamber=(AliRICHChamber*)fChambers->At(ich);
1621 TClonesArray *pRICHdigits = this->DigitsAddress(ich);
1622 if (pRICHdigits == 0)
1625 // Get ready the current chamber stuff
1627 AliRICHResponse* response = iChamber->GetResponseModel();
1628 AliSegmentation* seg = iChamber->GetSegmentationModel();
1629 AliRICHClusterFinder* rec = iChamber->GetReconstructionModel();
1631 rec->SetSegmentation(seg);
1632 rec->SetResponse(response);
1633 rec->SetDigits(pRICHdigits);
1634 rec->SetChamber(ich);
1635 if (nev==0) rec->CalibrateCOG();
1636 rec->FindRawClusters();
1639 fRch=RawClustAddress(ich);
1643 gAlice->TreeR()->Fill();
1645 for (int i=0;i<kNCH;i++) {
1646 fRch=RawClustAddress(i);
1647 int nraw=fRch->GetEntriesFast();
1648 printf ("Chamber %d, raw clusters %d\n",i,nraw);
1656 sprintf(hname,"TreeR%d",nev);
1657 gAlice->TreeR()->Write(hname,kOverwrite,0);
1658 gAlice->TreeR()->Reset();
1659 //gObjectTable->Print();
1660 }//void AliRICH::FindClusters(Int_t nev,Int_t lastEntry)
1661 //______________________________________________________________________________
1662 AliRICHSDigit* AliRICH::FirstPad(AliRICHhit* hit,TClonesArray *clusters )
1663 {// Initialise the pad iterator Return the address of the first sdigit for hit
1664 TClonesArray *theClusters = clusters;
1665 Int_t nclust = theClusters->GetEntriesFast();
1666 if (nclust && hit->PHlast() > 0) {
1667 sMaxIterPad=Int_t(hit->PHlast());
1668 sCurIterPad=Int_t(hit->PHfirst());
1669 return (AliRICHSDigit*) clusters->UncheckedAt(sCurIterPad-1);
1675 //______________________________________________________________________________
1676 AliRICHSDigit* AliRICH::NextPad(TClonesArray *clusters)
1677 {// Iterates over pads
1680 if (sCurIterPad <= sMaxIterPad) {
1681 return (AliRICHSDigit*) clusters->UncheckedAt(sCurIterPad-1);
1688 void AliRICH::DiagnosticsFE(Int_t evNumber1,Int_t evNumber2)
1691 Int_t NpadX = 162; // number of pads on X
1692 Int_t NpadY = 162; // number of pads on Y
1694 Int_t Pad[162][162];
1695 for (Int_t i=0;i<NpadX;i++) {
1696 for (Int_t j=0;j<NpadY;j++) {
1701 // Create some histograms
1703 TH1F *pionspectra1 = new TH1F("pionspectra1","Pion Spectra",200,-4,2);
1704 TH1F *pionspectra2 = new TH1F("pionspectra2","Pion Spectra",200,-4,2);
1705 TH1F *pionspectra3 = new TH1F("pionspectra3","Pion Spectra",200,-4,2);
1706 TH1F *protonspectra1 = new TH1F("protonspectra1","Proton Spectra",200,-4,2);
1707 TH1F *protonspectra2 = new TH1F("protonspectra2","Proton Spectra",200,-4,2);
1708 TH1F *protonspectra3 = new TH1F("protonspectra3","Proton Spectra",200,-4,2);
1709 TH1F *kaonspectra1 = new TH1F("kaonspectra1","Kaon Spectra",100,-4,2);
1710 TH1F *kaonspectra2 = new TH1F("kaonspectra2","Kaon Spectra",100,-4,2);
1711 TH1F *kaonspectra3 = new TH1F("kaonspectra3","Kaon Spectra",100,-4,2);
1712 TH1F *electronspectra1 = new TH1F("electronspectra1","Electron Spectra",100,-4,2);
1713 TH1F *electronspectra2 = new TH1F("electronspectra2","Electron Spectra",100,-4,2);
1714 TH1F *electronspectra3 = new TH1F("electronspectra3","Electron Spectra",100,-4,2);
1715 TH1F *muonspectra1 = new TH1F("muonspectra1","Muon Spectra",100,-4,2);
1716 TH1F *muonspectra2 = new TH1F("muonspectra2","Muon Spectra",100,-4,2);
1717 TH1F *muonspectra3 = new TH1F("muonspectra3","Muon Spectra",100,-4,2);
1718 TH1F *neutronspectra1 = new TH1F("neutronspectra1","Neutron Spectra",100,-4,2);
1719 TH1F *neutronspectra2 = new TH1F("neutronspectra2","Neutron Spectra",100,-4,2);
1720 TH1F *neutronspectra3 = new TH1F("neutronspectra2","Neutron Spectra",100,-4,2);
1721 TH1F *chargedspectra1 = new TH1F("chargedspectra1","Charged particles above 1 GeV Spectra",100,-1,3);
1722 TH1F *chargedspectra2 = new TH1F("chargedspectra2","Charged particles above 1 GeV Spectra",100,-1,3);
1723 TH1F *chargedspectra3 = new TH1F("chargedspectra2","Charged particles above 1 GeV Spectra",100,-1,3);
1724 TH1F *pionptspectrafinal = new TH1F("pionptspectrafinal","Primary Pions Transverse Momenta at HMPID",20,0,5);
1725 TH1F *pionptspectravertex = new TH1F("pionptspectravertex","Primary Pions Transverse Momenta at vertex",20,0,5);
1726 TH1F *kaonptspectrafinal = new TH1F("kaonptspectrafinal","Primary Kaons Transverse Momenta at HMPID",20,0,5);
1727 TH1F *kaonptspectravertex = new TH1F("kaonptspectravertex","Primary Kaons Transverse Momenta at vertex",20,0,5);
1728 //TH1F *hitsPhi = new TH1F("hitsPhi","Distribution of phi angle of incidence",100,-180,180);
1729 TH1F *hitsTheta = new TH1F("hitsTheta","Distribution of Theta angle of incidence, all tracks",100,0,50);
1730 TH1F *hitsTheta500MeV = new TH1F("hitsTheta500MeV","Distribution of Theta angle of incidence, 0.5-1 GeV primary tracks",100,0,50);
1731 TH1F *hitsTheta1GeV = new TH1F("hitsTheta1GeV","Distribution of Theta angle of incidence, 1-2 GeV primary tracks",100,0,50);
1732 TH1F *hitsTheta2GeV = new TH1F("hitsTheta2GeV","Distribution of Theta angle of incidence, 2-3 GeV primary tracks",100,0,50);
1733 TH1F *hitsTheta3GeV = new TH1F("hitsTheta3GeV","Distribution of Theta angle of incidence, >3 GeV primary tracks",100,0,50);
1734 TH2F *production = new TH2F("production","Mother production vertices",100,-300,300,100,0,600);
1739 // Start loop over events
1741 Int_t pion=0, kaon=0, proton=0, electron=0, positron=0, neutron=0, highneutrons=0, muon=0;
1742 Int_t chargedpions=0,primarypions=0,highprimarypions=0,chargedkaons=0,primarykaons=0,highprimarykaons=0;
1743 Int_t photons=0, primaryphotons=0, highprimaryphotons=0;
1746 for (int nev=0; nev<= evNumber2; nev++) {
1747 Int_t nparticles = gAlice->GetEvent(nev);
1750 printf ("Event number : %d\n",nev);
1751 printf ("Number of particles: %d\n",nparticles);
1752 if (nev < evNumber1) continue;
1753 if (nparticles <= 0) return;
1755 // Get pointers to RICH detector and Hits containers
1757 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
1759 TTree *treeH = TreeH();
1760 Int_t ntracks =(Int_t) treeH->GetEntries();
1762 // Start loop on tracks in the hits containers
1764 for (Int_t track=0; track<ntracks;track++) {
1765 printf ("Processing Track: %d\n",track);
1766 gAlice->ResetHits();
1767 treeH->GetEvent(track);
1769 for(AliRICHhit* mHit=(AliRICHhit*)pRICH->FirstHit(-1);
1771 mHit=(AliRICHhit*)pRICH->NextHit())
1773 //Int_t nch = mHit->fChamber; // chamber number
1774 //Float_t x = mHit->X(); // x-pos of hit
1775 //Float_t y = mHit->Z(); // y-pos
1776 //Float_t z = mHit->Y();
1777 //Float_t phi = mHit->Phi(); //Phi angle of incidence
1778 Float_t theta = mHit->Theta(); //Theta angle of incidence
1779 Float_t px = mHit->MomX();
1780 Float_t py = mHit->MomY();
1781 Int_t index = mHit->Track();
1782 Int_t particle = (Int_t)(mHit->Particle());
1787 TParticle *current = gAlice->Particle(index);
1789 //Float_t energy=current->Energy();
1791 R=TMath::Sqrt(current->Vx()*current->Vx() + current->Vy()*current->Vy());
1792 PTfinal=TMath::Sqrt(px*px + py*py);
1793 PTvertex=TMath::Sqrt(current->Px()*current->Px() + current->Py()*current->Py());
1797 if (TMath::Abs(particle) < 10000000)
1799 hitsTheta->Fill(theta,(float) 1);
1802 if (PTvertex>.5 && PTvertex<=1)
1804 hitsTheta500MeV->Fill(theta,(float) 1);
1806 if (PTvertex>1 && PTvertex<=2)
1808 hitsTheta1GeV->Fill(theta,(float) 1);
1810 if (PTvertex>2 && PTvertex<=3)
1812 hitsTheta2GeV->Fill(theta,(float) 1);
1816 hitsTheta3GeV->Fill(theta,(float) 1);
1825 //printf("Particle type: %d\n",current->GetPdgCode());
1826 if (TMath::Abs(particle) < 50000051)
1828 //if (TMath::Abs(particle) == 50000050 || TMath::Abs(particle) == 2112)
1829 if (TMath::Abs(particle) == 2112 || TMath::Abs(particle) == 50000050)
1831 //gMC->Rndm(&random, 1);
1832 if (random->Rndm() < .1)
1833 production->Fill(current->Vz(),R,(float) 1);
1834 if (TMath::Abs(particle) == 50000050)
1835 //if (TMath::Abs(particle) > 50000000)
1841 if (current->Energy()>0.001)
1842 highprimaryphotons +=1;
1845 if (TMath::Abs(particle) == 2112)
1848 if (current->Energy()>0.0001)
1852 if (TMath::Abs(particle) < 50000000)
1854 production->Fill(current->Vz(),R,(float) 1);
1855 //printf("Adding %d at %f\n",particle,R);
1857 //mip->Fill(x,y,(float) 1);
1860 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
1864 pionptspectravertex->Fill(PTvertex,(float) 1);
1865 pionptspectrafinal->Fill(PTfinal,(float) 1);
1869 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
1870 || TMath::Abs(particle)==311)
1874 kaonptspectravertex->Fill(PTvertex,(float) 1);
1875 kaonptspectrafinal->Fill(PTfinal,(float) 1);
1880 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
1882 pionspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1883 //printf ("fParticle: %d, PDG code:%d\n",particle,current->GetPdgCode());
1884 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
1885 pionspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1888 pionspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1889 //printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\R:%f\n\n\n\n\n\n\n\n\n",R);
1891 //printf("Pion mass: %e\n",current->GetCalcMass());
1893 if (TMath::Abs(particle)==211)
1899 if (current->Energy()>1)
1900 highprimarypions +=1;
1904 if (TMath::Abs(particle)==2212)
1906 protonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1907 //ptspectra->Fill(Pt,(float) 1);
1908 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
1909 protonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1911 protonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1912 //printf("\n\n\n\n\n\n\nProton mass: %e\n\n\n\n\n\n\n\n\n",current->GetCalcMass());
1915 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
1916 || TMath::Abs(particle)==311)
1918 kaonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1919 //ptspectra->Fill(Pt,(float) 1);
1920 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
1921 kaonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1923 kaonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1924 //printf("Kaon mass: %e\n",current->GetCalcMass());
1926 if (TMath::Abs(particle)==321)
1932 if (current->Energy()>1)
1933 highprimarykaons +=1;
1937 if (TMath::Abs(particle)==11)
1939 electronspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1940 //ptspectra->Fill(Pt,(float) 1);
1941 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
1942 electronspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1944 electronspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1945 //printf("Electron mass: %e\n",current->GetCalcMass());
1948 if (particle == -11)
1951 if (TMath::Abs(particle)==13)
1953 muonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1954 //ptspectra->Fill(Pt,(float) 1);
1955 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
1956 muonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1958 muonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1959 //printf("Muon mass: %e\n",current->GetCalcMass());
1962 if (TMath::Abs(particle)==2112)
1964 neutronspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1965 //ptspectra->Fill(Pt,(float) 1);
1966 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
1967 neutronspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1970 neutronspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1971 //printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\R:%f\n\n\n\n\n\n\n\n\n",R);
1973 //printf("Neutron mass: %e\n",current->GetCalcMass());
1976 if(TMath::Abs(particle)==211 || TMath::Abs(particle)==2212 || TMath::Abs(particle)==321)
1978 if (current->Energy()-current->GetCalcMass()>1)
1980 chargedspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1981 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
1982 chargedspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1984 chargedspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1987 //printf("Hits:%d\n",hit);
1988 //printf ("Chamber number:%d x:%f y:%f\n",nch,x,y);
1989 // Fill the histograms
1991 //h->Fill(x,y,(float) 1);
2001 TStyle *mystyle=new TStyle("Plain","mystyle");
2002 mystyle->SetPalette(1,0);
2005 //Create canvases, set the view range, show histograms
2007 TCanvas *c2 = new TCanvas("c2","Angles of incidence",150,150,100,150);
2009 //c2->SetFillColor(42);
2012 hitsTheta500MeV->SetFillColor(5);
2013 hitsTheta500MeV->Draw();
2015 hitsTheta1GeV->SetFillColor(5);
2016 hitsTheta1GeV->Draw();
2018 hitsTheta2GeV->SetFillColor(5);
2019 hitsTheta2GeV->Draw();
2021 hitsTheta3GeV->SetFillColor(5);
2022 hitsTheta3GeV->Draw();
2026 TCanvas *c15 = new TCanvas("c15","Mothers Production Vertices",50,50,600,600);
2028 production->SetFillColor(42);
2029 production->SetXTitle("z (m)");
2030 production->SetYTitle("R (m)");
2033 TCanvas *c10 = new TCanvas("c10","Pt Spectra",50,50,600,700);
2036 pionptspectravertex->SetFillColor(5);
2037 pionptspectravertex->SetXTitle("Pt (GeV)");
2038 pionptspectravertex->Draw();
2040 pionptspectrafinal->SetFillColor(5);
2041 pionptspectrafinal->SetXTitle("Pt (GeV)");
2042 pionptspectrafinal->Draw();
2044 kaonptspectravertex->SetFillColor(5);
2045 kaonptspectravertex->SetXTitle("Pt (GeV)");
2046 kaonptspectravertex->Draw();
2048 kaonptspectrafinal->SetFillColor(5);
2049 kaonptspectrafinal->SetXTitle("Pt (GeV)");
2050 kaonptspectrafinal->Draw();
2053 TCanvas *c16 = new TCanvas("c16","Particles Spectra II",150,150,600,350);
2057 //TCanvas *c13 = new TCanvas("c13","Electron Spectra",400,10,600,700);
2058 electronspectra1->SetFillColor(5);
2059 electronspectra1->SetXTitle("log(GeV)");
2060 electronspectra2->SetFillColor(46);
2061 electronspectra2->SetXTitle("log(GeV)");
2062 electronspectra3->SetFillColor(10);
2063 electronspectra3->SetXTitle("log(GeV)");
2065 electronspectra1->Draw();
2066 electronspectra2->Draw("same");
2067 electronspectra3->Draw("same");
2070 //TCanvas *c14 = new TCanvas("c14","Muon Spectra",400,10,600,700);
2071 muonspectra1->SetFillColor(5);
2072 muonspectra1->SetXTitle("log(GeV)");
2073 muonspectra2->SetFillColor(46);
2074 muonspectra2->SetXTitle("log(GeV)");
2075 muonspectra3->SetFillColor(10);
2076 muonspectra3->SetXTitle("log(GeV)");
2078 muonspectra1->Draw();
2079 muonspectra2->Draw("same");
2080 muonspectra3->Draw("same");
2083 //TCanvas *c16 = new TCanvas("c16","Neutron Spectra",400,10,600,700);
2084 //neutronspectra1->SetFillColor(42);
2085 //neutronspectra1->SetXTitle("log(GeV)");
2086 //neutronspectra2->SetFillColor(46);
2087 //neutronspectra2->SetXTitle("log(GeV)");
2088 //neutronspectra3->SetFillColor(10);
2089 //neutronspectra3->SetXTitle("log(GeV)");
2091 //neutronspectra1->Draw();
2092 //neutronspectra2->Draw("same");
2093 //neutronspectra3->Draw("same");
2095 TCanvas *c9 = new TCanvas("c9","Particles Spectra",150,150,600,700);
2096 //TCanvas *c9 = new TCanvas("c9","Pion Spectra",400,10,600,700);
2100 pionspectra1->SetFillColor(5);
2101 pionspectra1->SetXTitle("log(GeV)");
2102 pionspectra2->SetFillColor(46);
2103 pionspectra2->SetXTitle("log(GeV)");
2104 pionspectra3->SetFillColor(10);
2105 pionspectra3->SetXTitle("log(GeV)");
2107 pionspectra1->Draw();
2108 pionspectra2->Draw("same");
2109 pionspectra3->Draw("same");
2112 //TCanvas *c10 = new TCanvas("c10","Proton Spectra",400,10,600,700);
2113 protonspectra1->SetFillColor(5);
2114 protonspectra1->SetXTitle("log(GeV)");
2115 protonspectra2->SetFillColor(46);
2116 protonspectra2->SetXTitle("log(GeV)");
2117 protonspectra3->SetFillColor(10);
2118 protonspectra3->SetXTitle("log(GeV)");
2120 protonspectra1->Draw();
2121 protonspectra2->Draw("same");
2122 protonspectra3->Draw("same");
2125 //TCanvas *c11 = new TCanvas("c11","Kaon Spectra",400,10,600,700);
2126 kaonspectra1->SetFillColor(5);
2127 kaonspectra1->SetXTitle("log(GeV)");
2128 kaonspectra2->SetFillColor(46);
2129 kaonspectra2->SetXTitle("log(GeV)");
2130 kaonspectra3->SetFillColor(10);
2131 kaonspectra3->SetXTitle("log(GeV)");
2133 kaonspectra1->Draw();
2134 kaonspectra2->Draw("same");
2135 kaonspectra3->Draw("same");
2138 //TCanvas *c12 = new TCanvas("c12","Charged Particles Spectra",400,10,600,700);
2139 chargedspectra1->SetFillColor(5);
2140 chargedspectra1->SetXTitle("log(GeV)");
2141 chargedspectra2->SetFillColor(46);
2142 chargedspectra2->SetXTitle("log(GeV)");
2143 chargedspectra3->SetFillColor(10);
2144 chargedspectra3->SetXTitle("log(GeV)");
2146 chargedspectra1->Draw();
2147 chargedspectra2->Draw("same");
2148 chargedspectra3->Draw("same");
2152 printf("*****************************************\n");
2153 printf("* Particle * Counts *\n");
2154 printf("*****************************************\n");
2156 printf("* Pions: * %4d *\n",pion);
2157 printf("* Charged Pions: * %4d *\n",chargedpions);
2158 printf("* Primary Pions: * %4d *\n",primarypions);
2159 printf("* Primary Pions (p>1GeV/c): * %4d *\n",highprimarypions);
2160 printf("* Kaons: * %4d *\n",kaon);
2161 printf("* Charged Kaons: * %4d *\n",chargedkaons);
2162 printf("* Primary Kaons: * %4d *\n",primarykaons);
2163 printf("* Primary Kaons (p>1GeV/c): * %4d *\n",highprimarykaons);
2164 printf("* Muons: * %4d *\n",muon);
2165 printf("* Electrons: * %4d *\n",electron);
2166 printf("* Positrons: * %4d *\n",positron);
2167 printf("* Protons: * %4d *\n",proton);
2168 printf("* All Charged: * %4d *\n",(chargedpions+chargedkaons+muon+electron+positron+proton));
2169 printf("*****************************************\n");
2170 //printf("* Photons: * %3.1f *\n",photons);
2171 //printf("* Primary Photons: * %3.1f *\n",primaryphotons);
2172 //printf("* Primary Photons (p>1MeV/c):* %3.1f *\n",highprimaryphotons);
2173 //printf("*****************************************\n");
2174 //printf("* Neutrons: * %3.1f *\n",neutron);
2175 //printf("* Neutrons (p>100keV/c): * %3.1f *\n",highneutrons);
2176 //printf("*****************************************\n");
2178 if (gAlice->TreeD())
2180 gAlice->TreeD()->GetEvent(0);
2185 printf("\n*****************************************\n");
2186 printf("* Chamber * Digits * Occupancy *\n");
2187 printf("*****************************************\n");
2189 for (Int_t ich=0;ich<7;ich++)
2191 TClonesArray *Digits = DigitsAddress(ich); // Raw clusters branch
2192 Int_t ndigits = Digits->GetEntriesFast();
2193 occ[ich] = Float_t(ndigits)/(160*144);
2194 sum += Float_t(ndigits)/(160*144);
2195 printf("* %d * %d * %3.1f%% *\n",ich,ndigits,occ[ich]*100);
2198 printf("*****************************************\n");
2199 printf("* Mean occupancy * %3.1f%% *\n",mean*100);
2200 printf("*****************************************\n");
2203 printf("\nEnd of analysis\n");
2205 }//void AliRICH::DiagnosticsFE(Int_t evNumber1,Int_t evNumber2)
2206 //______________________________________________________________________________
2207 void AliRICH::DiagnosticsSE(Int_t diaglevel,Int_t evNumber1,Int_t evNumber2)
2210 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
2211 AliRICHSegmentationV0* segmentation;
2212 AliRICHChamber* chamber;
2214 chamber = &(pRICH->Chamber(0));
2215 segmentation=(AliRICHSegmentationV0*) chamber->GetSegmentationModel();
2217 Int_t NpadX = segmentation->Npx(); // number of pads on X
2218 Int_t NpadY = segmentation->Npy(); // number of pads on Y
2220 //Int_t Pad[144][160];
2221 /*for (Int_t i=0;i<NpadX;i++) {
2222 for (Int_t j=0;j<NpadY;j++) {
2228 Int_t xmin= -NpadX/2;
2229 Int_t xmax= NpadX/2;
2230 Int_t ymin= -NpadY/2;
2231 Int_t ymax= NpadY/2;
2233 Float_t PTfinal = 0;
2234 Int_t pionCount = 0;
2235 Int_t kaonCount = 0;
2236 Int_t protonCount = 0;
2245 TH2F *hc0 = new TH2F("hc0","Zoom on center of central chamber",150,-25,25,150,-45,5);
2249 printf("Single Ring Hits\n");
2250 feedback = new TH2F("feedback","Feedback hit distribution",150,-20,20,150,-35,5);
2251 mip = new TH2F("mip","Mip hit distribution",150,-20,20,150,-35,5);
2252 cerenkov = new TH2F("cerenkov","Cerenkov hit distribution",150,-20,20,150,-35,5);
2253 h = new TH2F("h","Detector hit distribution",150,-20,20,150,-35,5);
2254 hitsX = new TH1F("hitsX","Distribution of hits along x-axis",150,-50,50);
2255 hitsY = new TH1F("hitsY","Distribution of hits along z-axis",150,-50,50);
2259 printf("Full Event Hits\n");
2261 feedback = new TH2F("feedback","Feedback hit distribution",150,-300,300,150,-300,300);
2262 mip = new TH2F("mip","Mip hit distribution",150,-300,300,150,-300,300);
2263 cerenkov = new TH2F("cerenkov","Cerenkov hit distribution",150,-300,300,150,-300,300);
2264 h = new TH2F("h","Detector hit distribution",150,-300,300,150,-300,300);
2265 hitsX = new TH1F("digitsX","Distribution of hits along x-axis",200,-300,300);
2266 hitsY = new TH1F("digitsY","Distribution of hits along z-axis",200,-300,300);
2271 TH2F *hc1 = new TH2F("hc1","Chamber 1 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
2272 TH2F *hc2 = new TH2F("hc2","Chamber 2 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
2273 TH2F *hc3 = new TH2F("hc3","Chamber 3 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
2274 TH2F *hc4 = new TH2F("hc4","Chamber 4 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
2275 TH2F *hc5 = new TH2F("hc5","Chamber 5 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
2276 TH2F *hc6 = new TH2F("hc6","Chamber 6 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
2277 TH2F *hc7 = new TH2F("hc7","Chamber 7 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
2279 TH1F *Clcharge = new TH1F("Clcharge","Cluster Charge Distribution",500,0.,500.);
2280 TH1F *ckovangle = new TH1F("ckovangle","Cerenkov angle per photon",100,.35,.8);
2281 TH1F *hckphi = new TH1F("hckphi","Cerenkov phi angle per photon",620,-3.1,3.1);
2282 TH1F *mother = new TH1F("mother","Cerenkovs per Mip",75,0.,75.);
2283 TH1F *radius = new TH1F("radius","Mean distance to Mip",100,0.,20.);
2284 TH1F *phspectra1 = new TH1F("phspectra1","Detected Photon Spectra",200,5.,10.);
2285 TH1F *phspectra2 = new TH1F("phspectra2","Produced Photon Spectra",200,5.,10.);
2286 TH1F *totalphotonstrack = new TH1F("totalphotonstrack","Produced Photons per Mip",100,200,700.);
2287 TH1F *totalphotonsevent = new TH1F("totalphotonsevent","Produced Photons per Mip",100,200,700.);
2288 //TH1F *feedbacks = new TH1F("feedbacks","Produced Feedbacks per Mip",50,0.5,50.);
2289 TH1F *padnumber = new TH1F("padnumber","Number of pads per cluster",50,-0.5,50.);
2290 TH1F *padsev = new TH1F("padsev","Number of pads hit per MIP",50,0.5,100.);
2291 TH1F *clusev = new TH1F("clusev","Number of clusters per MIP",50,0.5,50.);
2292 TH1F *photev = new TH1F("photev","Number of detected photons per MIP",50,0.5,50.);
2293 TH1F *feedev = new TH1F("feedev","Number of feedbacks per MIP",50,0.5,50.);
2294 TH1F *padsmip = new TH1F("padsmip","Number of pads per event inside MIP region",50,0.5,50.);
2295 TH1F *padscl = new TH1F("padscl","Number of pads per event from cluster count",50,0.5,100.);
2296 TH1F *pionspectra = new TH1F("pionspectra","Pion Spectra",200,.5,10.);
2297 TH1F *protonspectra = new TH1F("protonspectra","Proton Spectra",200,.5,10.);
2298 TH1F *kaonspectra = new TH1F("kaonspectra","Kaon Spectra",100,.5,10.);
2299 TH1F *chargedspectra = new TH1F("chargedspectra","Charged particles above 1 GeV Spectra",100,.5,10.);
2300 TH1F *hitsPhi = new TH1F("hitsPhi","Distribution of phi angle of incidence",50,0,360);
2301 TH1F *hitsTheta = new TH1F("hitsTheta","Distribution of theta angle of incidence",50,0,15);
2302 TH1F *Omega1D = new TH1F("omega","Reconstructed Cerenkov angle per track",50,.5,1);
2303 TH1F *Theta = new TH1F("theta","Reconstructed theta incidence angle per track",100,0,15);
2304 TH1F *Phi = new TH1F("phi","Reconstructed phi incidence per track",100,0,360);
2305 TH1F *Omega3D = new TH1F("omega","Reconstructed Cerenkov angle per track",100,.35,.8);
2306 TH1F *PhotonCer = new TH1F("photoncer","Reconstructed Cerenkov angle per photon",100,.35,.8);
2307 TH2F *PadsUsed = new TH2F("padsused","Pads Used for Reconstruction",100,-30,30,100,-30,30);
2308 TH1F *MeanRadius = new TH1F("radius","Mean Radius for reconstructed track",100,0.,20.);
2309 TH2F *identification = new TH2F("identification","Particle Identification",100,1,5,100,0,.8);
2310 TH1F *OriginalOmega = new TH1F("Original Omega","Cerenkov angle per track",100,.35,.8);
2311 TH1F *OriginalPhi = new TH1F("Original Phi","Distribution of phi angle of incidence per track",100,0,360);
2312 TH1F *OriginalTheta = new TH1F("Original Theta","Distribution of theta angle per track",100,0,15);
2313 TH1F *OmegaError = new TH1F("Omega Error","Difference between original an reconstructed cerenkov angle",100,0,.2);
2314 TH1F *PhiError = new TH1F("Phi Error","Difference between original an reconstructed phi angle",100,0,360);
2315 TH1F *ThetaError = new TH1F("Theta Error","Difference between original an reconstructed phi angle",100,0,15);
2318 // Start loop over events
2323 Int_t mothers[80000];
2324 Int_t mothers2[80000];
2332 Float_t chiSquareOmega = 0;
2333 Float_t chiSquareTheta = 0;
2334 Float_t chiSquarePhi = 0;
2336 Float_t recEffEvent = 0;
2337 Float_t recEffTotal = 0;
2339 Float_t trackglob[3];
2340 Float_t trackloc[3];
2343 for (Int_t i=0;i<100;i++) mothers[i]=0;
2345 for (int nev=0; nev<= evNumber2; nev++) {
2346 Int_t nparticles = gAlice->GetEvent(nev);
2349 //cout<<"nev "<<nev<<endl;
2350 printf ("\n**********************************\nProcessing Event: %d\n",nev);
2351 //cout<<"nparticles "<<nparticles<<endl;
2352 printf ("Particles : %d\n\n",nparticles);
2353 if (nev < evNumber1) continue;
2354 if (nparticles <= 0) return;
2356 // Get pointers to RICH detector and Hits containers
2359 TTree *TH = TreeH();
2360 Stat_t ntracks = TH->GetEntries();
2362 // Start loop on tracks in the hits containers
2364 for (Int_t track=0; track<ntracks;track++) {
2366 printf ("\nProcessing Track: %d\n",track);
2367 gAlice->ResetHits();
2368 TH->GetEvent(track);
2369 Int_t nhits = pRICH->Hits()->GetEntriesFast();
2370 if (nhits) Nh+=nhits;
2371 printf("Hits : %d\n",nhits);
2372 for(AliRICHhit* mHit=(AliRICHhit*)pRICH->FirstHit(-1);
2374 mHit=(AliRICHhit*)pRICH->NextHit())
2376 Int_t nch = mHit->Chamber(); // chamber number
2377 trackglob[0] = mHit->X(); // x-pos of hit
2378 trackglob[1] = mHit->Y();
2379 trackglob[2] = mHit->Z(); // y-pos of hit
2380 //x = mHit->X(); // x-pos of hit
2381 //y = mHit->Z(); // y-pos
2382 Float_t phi = mHit->Phi(); //Phi angle of incidence
2383 Float_t theta = mHit->Theta(); //Theta angle of incidence
2384 Int_t index = mHit->Track();
2385 Int_t particle = (Int_t)(mHit->Particle());
2386 //Int_t freon = (Int_t)(mHit->fLoss);
2387 Float_t px = mHit->MomX();
2388 Float_t py = mHit->MomY();
2390 if (TMath::Abs(particle) < 10000000)
2392 PTfinal=TMath::Sqrt(px*px + py*py);
2393 //printf("PTfinal 0: %f\n",PTfinal);
2396 chamber = &(pRICH->Chamber(nch-1));
2398 //printf("Nch:%d\n",nch);
2400 chamber->GlobaltoLocal(trackglob,trackloc);
2402 chamber->LocaltoGlobal(trackloc,trackglob);
2408 hitsX->Fill(x,(float) 1);
2409 hitsY->Fill(y,(float) 1);
2411 //printf("Particle:%9d\n",particle);
2413 TParticle *current = (TParticle*)gAlice->Particle(index);
2414 //printf("Particle type: %d\n",sizeoff(Particles));
2416 hitsTheta->Fill(theta,(float) 1);
2417 //hitsPhi->Fill(phi,(float) 1);
2418 //if (pRICH->GetDebugLevel() == -1)
2419 //printf("Theta:%f, Phi:%f\n",theta,phi);
2421 //printf("Debug Level:%d\n",pRICH->GetDebugLevel());
2423 if (current->GetPdgCode() < 10000000)
2425 mip->Fill(x,y,(float) 1);
2426 //printf("adding mip\n");
2427 //if (current->Energy() - current->GetCalcMass()>1 && freon==1)
2429 hitsPhi->Fill(TMath::Abs(phi),(float) 1);
2430 //hitsTheta->Fill(theta,(float) 1);
2431 //printf("Theta:%f, Phi:%f\n",theta,phi);
2435 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
2437 pionspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
2439 if (TMath::Abs(particle)==2212)
2441 protonspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
2443 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
2444 || TMath::Abs(particle)==311)
2446 kaonspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
2448 if(TMath::Abs(particle)==211 || TMath::Abs(particle)==2212 || TMath::Abs(particle)==321)
2450 if (current->Energy() - current->GetCalcMass()>1)
2451 chargedspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
2453 //printf("Hits:%d\n",hit);
2454 //printf ("Chamber number:%d x:%f y:%f\n",nch,x,y);
2455 // Fill the histograms
2457 h->Fill(x,y,(float) 1);
2462 Int_t ncerenkovs = pRICH->Cerenkovs()->GetEntriesFast();
2463 //if (current->GetPdgCode() < 50000051 && current->GetPdgCode() > 50000040)
2464 //totalphotonsevent->Fill(ncerenkovs,(float) 1);
2467 printf("Cerenkovs : %d\n",ncerenkovs);
2468 totalphotonsevent->Fill(ncerenkovs,(float) 1);
2469 for (Int_t hit=0;hit<ncerenkovs;hit++) {
2470 AliRICHCerenkov* cHit = (AliRICHCerenkov*) pRICH->Cerenkovs()->UncheckedAt(hit);
2471 Int_t nchamber = cHit->fChamber; // chamber number
2472 Int_t index = cHit->Track();
2473 //Int_t pindex = (Int_t)(cHit->fIndex);
2474 trackglob[0] = cHit->X(); // x-pos of hit
2475 trackglob[1] = cHit->Y();
2476 trackglob[2] = cHit->Z(); // y-pos of hit
2477 //Float_t cx = cHit->X(); // x-position
2478 //Float_t cy = cHit->Z(); // y-position
2479 Int_t cmother = cHit->fCMother; // Index of mother particle
2480 Int_t closs = (Int_t)(cHit->fLoss); // How did the particle get lost?
2481 Float_t cherenkov = cHit->fCerenkovAngle; //production cerenkov angle
2483 chamber = &(pRICH->Chamber(nchamber-1));
2485 //printf("Nch:%d\n",nch);
2487 chamber->GlobaltoLocal(trackglob,trackloc);
2489 chamber->LocaltoGlobal(trackloc,trackglob);
2492 Float_t cx=trackloc[0];
2493 Float_t cy=trackloc[2];
2495 //printf ("Cerenkov hit number %d/%d, X:%f, Y:%f\n",hit,ncerenkovs,cx,cy);
2498 //printf("Particle:%9d\n",index);
2500 TParticle *current = (TParticle*)gAlice->Particle(index);
2501 Float_t energyckov = current->Energy();
2503 if (current->GetPdgCode() == 50000051)
2507 feedback->Fill(cx,cy,(float) 1);
2511 if (current->GetPdgCode() == 50000050)
2516 phspectra2->Fill(energyckov*1e9,(float) 1);
2521 cerenkov->Fill(cx,cy,(float) 1);
2523 //printf ("Cerenkov hit number %d/%d, X:%d, Y:%d\n",hit,ncerenkovs,cx,cy);
2525 //TParticle *MIP = (TParticle*)gAlice->Particle(cmother);
2526 AliRICHhit* mipHit = (AliRICHhit*) pRICH->Hits()->UncheckedAt(0);
2527 mom[0] = current->Px();
2528 mom[1] = current->Py();
2529 mom[2] = current->Pz();
2530 //mom[0] = cHit->fMomX;
2531 // mom[1] = cHit->fMomZ;
2532 //mom[2] = cHit->fMomY;
2533 //Float_t energymip = MIP->Energy();
2534 //Float_t Mip_px = mipHit->fMomFreoX;
2535 //Float_t Mip_py = mipHit->fMomFreoY;
2536 //Float_t Mip_pz = mipHit->fMomFreoZ;
2537 //Float_t Mip_px = MIP->Px();
2538 //Float_t Mip_py = MIP->Py();
2539 //Float_t Mip_pz = MIP->Pz();
2543 //Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
2544 //Float_t rt = TMath::Sqrt(r);
2545 //Float_t Mip_r = Mip_px*Mip_px + Mip_py*Mip_py + Mip_pz*Mip_pz;
2546 //Float_t Mip_rt = TMath::Sqrt(Mip_r);
2547 //Float_t coscerenkov = (mom[0]*Mip_px + mom[1]*Mip_py + mom[2]*Mip_pz)/(rt*Mip_rt+0.0000001);
2548 //Float_t cherenkov = TMath::ACos(coscerenkov);
2549 ckovangle->Fill(cherenkov,(float) 1); //Cerenkov angle calculus
2550 //printf("Cherenkov: %f\n",cherenkov);
2551 Float_t ckphi=TMath::ATan2(mom[0], mom[2]);
2552 hckphi->Fill(ckphi,(float) 1);
2555 //Float_t mix = MIP->Vx();
2556 //Float_t miy = MIP->Vy();
2557 Float_t mx = mipHit->X();
2558 Float_t my = mipHit->Z();
2559 //printf("FX %e, FY %e, VX %e, VY %e\n",cx,cy,mx,my);
2560 Float_t dx = trackglob[0] - mx;
2561 Float_t dy = trackglob[2] - my;
2562 //printf("Dx:%f, Dy:%f\n",dx,dy);
2563 Float_t final_radius = TMath::Sqrt(dx*dx+dy*dy);
2564 //printf("Final radius:%f\n",final_radius);
2565 radius->Fill(final_radius,(float) 1);
2567 phspectra1->Fill(energyckov*1e9,(float) 1);
2570 for (Int_t nmothers=0;nmothers<=ntracks;nmothers++){
2571 if (cmother == nmothers){
2573 mothers2[cmother]++;
2584 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
2585 gAlice->TreeR()->GetEvent(nent-1);
2586 TClonesArray *Rawclusters = pRICH->RawClustAddress(2); // Raw clusters branch
2587 //printf ("Rawclusters:%p",Rawclusters);
2588 Int_t nrawclusters = Rawclusters->GetEntriesFast();
2591 printf("Raw Clusters : %d\n",nrawclusters);
2592 for (Int_t hit=0;hit<nrawclusters;hit++) {
2593 AliRICHRawCluster* rcHit = (AliRICHRawCluster*) pRICH->RawClustAddress(2)->UncheckedAt(hit);
2594 //Int_t nchamber = rcHit->fChamber; // chamber number
2595 //Int_t nhit = cHit->fHitNumber; // hit number
2596 Int_t qtot = rcHit->fQ; // charge
2597 Float_t fx = rcHit->fX; // x-position
2598 Float_t fy = rcHit->fY; // y-position
2599 //Int_t type = rcHit->fCtype; // cluster type ?
2600 Int_t mult = rcHit->fMultiplicity; // How many pads form the cluster
2603 //printf ("fx: %d, fy: %d\n",fx,fy);
2604 if (fx>(x-4) && fx<(x+4) && fy>(y-4) && fy<(y+4)) {
2605 //printf("There %d \n",mult);
2608 padnumber->Fill(mult,(float) 1);
2610 if (mult<4) Clcharge->Fill(qtot,(float) 1);
2618 TClonesArray *RecHits1D = pRICH->RecHitsAddress1D(2);
2619 Int_t nrechits1D = RecHits1D->GetEntriesFast();
2620 //printf (" nrechits:%d\n",nrechits);
2624 for (Int_t hit=0;hit<nrechits1D;hit++) {
2625 AliRICHRecHit1D* recHit1D = (AliRICHRecHit1D*) pRICH->RecHitsAddress1D(2)->UncheckedAt(hit);
2626 Float_t r_omega = recHit1D->fOmega; // Cerenkov angle
2627 Float_t *cer_pho = recHit1D->fCerPerPhoton; // Cerenkov angle per photon
2628 Int_t *padsx = recHit1D->fPadsUsedX; // Pads Used fo reconstruction (x)
2629 Int_t *padsy = recHit1D->fPadsUsedY; // Pads Used fo reconstruction (y)
2630 Int_t goodPhotons = recHit1D->fGoodPhotons; // Number of pads used for reconstruction
2632 Omega1D->Fill(r_omega,(float) 1);
2634 for (Int_t i=0; i<goodPhotons; i++)
2636 PhotonCer->Fill(cer_pho[i],(float) 1);
2637 PadsUsed->Fill(padsx[i],padsy[i],1);
2638 //printf("Angle:%f, pad: %d %d\n",cer_pho[i],padsx[i],padsy[i]);
2641 //printf("Omega: %f, Theta: %f, Phi: %f\n",r_omega,r_theta,r_phi);
2646 TClonesArray *RecHits3D = pRICH->RecHitsAddress3D(2);
2647 Int_t nrechits3D = RecHits3D->GetEntriesFast();
2648 //printf (" nrechits:%d\n",nrechits);
2654 //for (Int_t hit=0;hit<nrechits3D;hit++) {
2655 AliRICHRecHit3D* recHit3D = (AliRICHRecHit3D*) pRICH->RecHitsAddress3D(2)->UncheckedAt(track);
2656 Float_t r_omega = recHit3D->fOmega; // Cerenkov angle
2657 Float_t r_theta = recHit3D->fTheta; // Theta angle of incidence
2658 Float_t r_phi = recHit3D->fPhi; // Phi angle if incidence
2659 Float_t meanradius = recHit3D->fMeanRadius; // Mean radius for reconstructed point
2660 Float_t originalOmega = recHit3D->fOriginalOmega; // Real Cerenkov angle
2661 Float_t originalTheta = recHit3D->fOriginalTheta; // Real incidence angle
2662 Float_t originalPhi = recHit3D->fOriginalPhi; // Real azimuthal angle
2665 //correction to track cerenkov angle
2666 originalOmega = (Float_t) ckovangle->GetMean();
2670 printf("\nMean cerenkov angle: %f\n", originalOmega);
2671 printf("Reconstructed cerenkov angle: %f\n",r_omega);
2674 Float_t omegaError = TMath::Abs(originalOmega - r_omega);
2675 Float_t thetaError = TMath::Abs(originalTheta - r_theta);
2676 Float_t phiError = TMath::Abs(originalPhi - r_phi);
2678 //chiSquareOmega += (omegaError/originalOmega)*(omegaError/originalOmega);
2679 //chiSquareTheta += (thetaError/originalTheta)*(thetaError/originalTheta);
2680 //chiSquarePhi += (phiError/originalPhi)*(phiError/originalPhi);
2682 if(TMath::Abs(omegaError) < 0.015)
2687 //printf("rechit %f %f %f %f %f\n",recHit3D->fOmega,recHit3D->fTheta,recHit3D->fPhi, recHit3D->fX,recHit3D->fY);
2689 Omega3D->Fill(r_omega,(float) 1);
2690 Theta->Fill(r_theta*180/TMath::Pi(),(float) 1);
2691 Phi->Fill(r_phi*180/TMath::Pi()-180,(float) 1);
2692 MeanRadius->Fill(meanradius,(float) 1);
2693 identification->Fill(PTfinal, r_omega,1);
2694 OriginalOmega->Fill(originalOmega, (float) 1);
2695 OriginalTheta->Fill(originalTheta, (float) 1);
2696 OriginalPhi->Fill(TMath::Abs(originalPhi), (float) 1);
2697 OmegaError->Fill(omegaError, (float) 1);
2698 ThetaError->Fill(thetaError, (float) 1);
2699 PhiError->Fill(phiError, (float) 1);
2701 recEffEvent = recEffEvent;
2702 recEffTotal += recEffEvent;
2704 Float_t pioncer = acos(sqrt((.139*.139+PTfinal*PTfinal)/(PTfinal*PTfinal*1.285*1.285)));
2705 Float_t kaoncer = acos(sqrt((.439*.439+PTfinal*PTfinal)/(PTfinal*PTfinal*1.285*1.285)));
2706 Float_t protoncer = acos(sqrt((.938*.938+PTfinal*PTfinal)/(PTfinal*PTfinal*1.285*1.285)));
2708 Float_t piondist = TMath::Abs(r_omega - pioncer);
2709 Float_t kaondist = TMath::Abs(r_omega - kaoncer);
2710 Float_t protondist = TMath::Abs(r_omega - protoncer);
2716 printf("Identified as a PION!\n");
2719 if(kaoncer<r_omega && pioncer>r_omega)
2721 if(kaondist>piondist)
2723 printf("Identified as a PION!\n");
2728 printf("Identified as a KAON!\n");
2732 if(protoncer<r_omega && kaoncer>r_omega)
2734 if(kaondist>protondist)
2736 printf("Identified as a PROTON!\n");
2741 printf("Identified as a KAON!\n");
2745 if(protoncer>r_omega)
2747 printf("Identified as a PROTON!\n");
2751 printf("\nReconstruction efficiency: %5.2f%%\n", recEffEvent*100);
2757 for (Int_t nmothers=0;nmothers<ntracks;nmothers++){
2758 totalphotonstrack->Fill(mothers[nmothers],(float) 1);
2759 mother->Fill(mothers2[nmothers],(float) 1);
2760 //printf ("Entries in %d : %d\n",nmothers, mothers[nmothers]);
2763 clusev->Fill(nraw,(float) 1);
2764 photev->Fill(phot,(float) 1);
2765 feedev->Fill(feed,(float) 1);
2766 padsmip->Fill(padmip,(float) 1);
2767 padscl->Fill(pads,(float) 1);
2768 //printf("Photons:%d\n",phot);
2777 gAlice->ResetDigits();
2778 //Int_t nent=(Int_t)gAlice->TreeD()->GetEntries();
2779 gAlice->TreeD()->GetEvent(0);
2785 TClonesArray *Digits = pRICH->DigitsAddress(2);
2786 Int_t ndigits = Digits->GetEntriesFast();
2787 printf("Digits : %d\n",ndigits);
2788 padsev->Fill(ndigits,(float) 1);
2789 for (Int_t hit=0;hit<ndigits;hit++) {
2790 AliRICHDigit* dHit = (AliRICHDigit*) Digits->UncheckedAt(hit);
2791 Int_t qtot = dHit->Signal(); // charge
2792 Int_t ipx = dHit->PadX(); // pad number on X
2793 Int_t ipy = dHit->PadY(); // pad number on Y
2794 //printf("%d, %d\n",ipx,ipy);
2795 if( ipx<=100 && ipy <=100) hc0->Fill(ipx,ipy,(float) qtot);
2801 for (Int_t ich=0;ich<7;ich++)
2803 TClonesArray *Digits = pRICH->DigitsAddress(ich); // Raw clusters branch
2804 Int_t ndigits = Digits->GetEntriesFast();
2805 //printf("Digits:%d\n",ndigits);
2806 padsev->Fill(ndigits,(float) 1);
2808 for (Int_t hit=0;hit<ndigits;hit++) {
2809 AliRICHDigit* dHit = (AliRICHDigit*) Digits->UncheckedAt(hit);
2810 //Int_t nchamber = dHit->GetChamber(); // chamber number
2811 //Int_t nhit = dHit->fHitNumber; // hit number
2812 Int_t qtot = dHit->Signal(); // charge
2813 Int_t ipx = dHit->PadX(); // pad number on X
2814 Int_t ipy = dHit->PadY(); // pad number on Y
2815 //Int_t iqpad = dHit->fQpad; // charge per pad
2816 //Int_t rpad = dHit->fRSec; // R-position of pad
2817 //printf ("Pad hit, PadX:%d, PadY:%d\n",ipx,ipy);
2818 if( ipx<=100 && ipy <=100 && ich==2) hc0->Fill(ipx,ipy,(float) qtot);
2819 if( ipx<=162 && ipy <=162 && ich==0) hc1->Fill(ipx,ipy,(float) qtot);
2820 if( ipx<=162 && ipy <=162 && ich==1) hc2->Fill(ipx,ipy,(float) qtot);
2821 if( ipx<=162 && ipy <=162 && ich==2) hc3->Fill(ipx,ipy,(float) qtot);
2822 if( ipx<=162 && ipy <=162 && ich==3) hc4->Fill(ipx,ipy,(float) qtot);
2823 if( ipx<=162 && ipy <=162 && ich==4) hc5->Fill(ipx,ipy,(float) qtot);
2824 if( ipx<=162 && ipy <=162 && ich==5) hc6->Fill(ipx,ipy,(float) qtot);
2825 if( ipx<=162 && ipy <=162 && ich==6) hc7->Fill(ipx,ipy,(float) qtot);
2843 for(Int_t i=0;i<99;i++)
2845 omegaE = OriginalOmega->GetBinContent(i);
2848 omegaO = Omega3D->GetBinContent(i);
2849 chiSquareOmega += (TMath::Power(omegaE,2) - TMath::Power(omegaO,2))/omegaO;
2852 thetaE = OriginalTheta->GetBinContent(i);
2855 thetaO = Theta->GetBinContent(i);
2856 chiSquareTheta += (TMath::Power(thetaE,2) - TMath::Power(thetaO,2))/thetaO;
2859 phiE = OriginalPhi->GetBinContent(i);
2862 phiO = Phi->GetBinContent(i);
2863 chiSquarePhi += (TMath::Power(phiE,2) - TMath::Power(phiO,2))/phiO;
2866 //printf(" o: %f t: %f p: %f\n", OriginalOmega->GetBinContent(i), OriginalTheta->GetBinContent(i),OriginalPhi->GetBinContent(i));
2872 printf("\nChi square test values: Omega - %f\n", chiSquareOmega);
2873 printf(" Theta - %f\n", chiSquareTheta);
2874 printf(" Phi - %f\n", chiSquarePhi);
2876 printf("\nKolmogorov test values: Omega - %5.4f\n", Omega3D->KolmogorovTest(OriginalOmega));
2877 printf(" Theta - %5.4f\n", Theta->KolmogorovTest(OriginalTheta));
2878 printf(" Phi - %5.4f\n", Phi->KolmogorovTest(OriginalPhi));
2880 recEffTotal = recEffTotal/evNumber2;
2881 printf("\nTotal reconstruction efficiency: %5.2f%%\n", recEffTotal*100);
2882 printf("\n Pions: %d\n Kaons: %d\n Protons:%d\n",pionCount, kaonCount, protonCount);
2887 //Create canvases, set the view range, show histograms
2906 TStyle *mystyle=new TStyle("Plain","mystyle");
2907 mystyle->SetPalette(1,0);
2908 //mystyle->SetTitleYSize(0.2);
2909 //mystyle->SetStatW(0.19);
2910 //mystyle->SetStatH(0.1);
2911 //mystyle->SetStatFontSize(0.01);
2912 //mystyle->SetTitleYSize(0.3);
2913 mystyle->SetFuncColor(2);
2914 //mystyle->SetOptStat(0111);
2915 mystyle->SetDrawBorder(0);
2916 mystyle->SetTitleBorderSize(0);
2917 mystyle->SetOptFit(1111);
2921 TClonesArray *RecHits3D = pRICH->RecHitsAddress3D(2);
2922 Int_t nrechits3D = RecHits3D->GetEntriesFast();
2923 TClonesArray *RecHits1D = pRICH->RecHitsAddress1D(2);
2924 Int_t nrechits1D = RecHits1D->GetEntriesFast();
2930 c1 = new TCanvas("c1","Alice RICH digits",50,50,300,350);
2931 hc0->SetXTitle("ix (npads)");
2935 c2 = new TCanvas("c2","Hits per type",100,100,600,700);
2937 //c4->SetFillColor(42);
2940 feedback->SetXTitle("x (cm)");
2941 feedback->SetYTitle("y (cm)");
2942 feedback->Draw("colz");
2945 //mip->SetFillColor(5);
2946 mip->SetXTitle("x (cm)");
2947 mip->SetYTitle("y (cm)");
2951 //cerenkov->SetFillColor(5);
2952 cerenkov->SetXTitle("x (cm)");
2953 cerenkov->SetYTitle("y (cm)");
2954 cerenkov->Draw("colz");
2957 //h->SetFillColor(5);
2958 h->SetXTitle("x (cm)");
2959 h->SetYTitle("y (cm)");
2962 c3 = new TCanvas("c3","Hits distribution",150,150,600,350);
2964 //c10->SetFillColor(42);
2967 hitsX->SetFillColor(5);
2968 hitsX->SetXTitle("(cm)");
2972 hitsY->SetFillColor(5);
2973 hitsY->SetXTitle("(cm)");
2981 c4 = new TCanvas("c4","Photon Spectra",50,50,600,350);
2983 //c6->SetFillColor(42);
2986 phspectra2->SetFillColor(5);
2987 phspectra2->SetXTitle("energy (eV)");
2990 phspectra1->SetFillColor(5);
2991 phspectra1->SetXTitle("energy (eV)");
2994 c5 = new TCanvas("c5","Particles Spectra",100,100,600,700);
2996 //c9->SetFillColor(42);
2999 pionspectra->SetFillColor(5);
3000 pionspectra->SetXTitle("(GeV)");
3001 pionspectra->Draw();
3004 protonspectra->SetFillColor(5);
3005 protonspectra->SetXTitle("(GeV)");
3006 protonspectra->Draw();
3009 kaonspectra->SetFillColor(5);
3010 kaonspectra->SetXTitle("(GeV)");
3011 kaonspectra->Draw();
3014 chargedspectra->SetFillColor(5);
3015 chargedspectra->SetXTitle("(GeV)");
3016 chargedspectra->Draw();
3025 c6=new TCanvas("c6","Clusters Statistics",50,50,600,700);
3027 //c3->SetFillColor(42);
3032 Clcharge->SetFillColor(5);
3033 Clcharge->SetXTitle("ADC counts");
3036 Clcharge->Fit("expo");
3037 //expo->SetLineColor(2);
3038 //expo->SetLineWidth(3);
3043 padnumber->SetFillColor(5);
3044 padnumber->SetXTitle("(counts)");
3048 clusev->SetFillColor(5);
3049 clusev->SetXTitle("(counts)");
3052 clusev->Fit("gaus");
3053 //gaus->SetLineColor(2);
3054 //gaus->SetLineWidth(3);
3059 padsmip->SetFillColor(5);
3060 padsmip->SetXTitle("(counts)");
3066 c11 = new TCanvas("c11","Cherenkov per Mip",400,10,600,700);
3067 mother->SetFillColor(5);
3068 mother->SetXTitle("counts");
3072 c7 = new TCanvas("c7","Production Statistics",100,100,600,700);
3074 //c7->SetFillColor(42);
3077 totalphotonsevent->SetFillColor(5);
3078 totalphotonsevent->SetXTitle("Photons (counts)");
3081 totalphotonsevent->Fit("gaus");
3082 //gaus->SetLineColor(2);
3083 //gaus->SetLineWidth(3);
3085 totalphotonsevent->Draw();
3088 photev->SetFillColor(5);
3089 photev->SetXTitle("(counts)");
3092 photev->Fit("gaus");
3093 //gaus->SetLineColor(2);
3094 //gaus->SetLineWidth(3);
3099 feedev->SetFillColor(5);
3100 feedev->SetXTitle("(counts)");
3103 feedev->Fit("gaus");
3104 //gaus->SetLineColor(2);
3105 //gaus->SetLineWidth(3);
3110 padsev->SetFillColor(5);
3111 padsev->SetXTitle("(counts)");
3114 padsev->Fit("gaus");
3115 //gaus->SetLineColor(2);
3116 //gaus->SetLineWidth(3);
3127 c8 = new TCanvas("c8","3D reconstruction of Phi angle",50,50,300,1050);
3129 //c2->SetFillColor(42);
3134 hitsPhi->SetFillColor(5);
3136 hitsPhi->Fit("gaus");
3141 OriginalPhi->SetFillColor(5);
3143 OriginalPhi->Fit("gaus");
3144 OriginalPhi->Draw();
3148 Phi->SetFillColor(5);
3153 c9 = new TCanvas("c9","3D reconstruction of theta angle",75,75,300,1050);
3158 hitsTheta->SetFillColor(5);
3160 hitsTheta->Fit("gaus");
3165 OriginalTheta->SetFillColor(5);
3167 OriginalTheta->Fit("gaus");
3168 OriginalTheta->Draw();
3172 Theta->SetFillColor(5);
3177 c10 = new TCanvas("c10","3D reconstruction of cherenkov angle",100,100,300,1050);
3182 ckovangle->SetFillColor(5);
3183 ckovangle->SetXTitle("angle (radians)");
3185 ckovangle->Fit("gaus");
3190 OriginalOmega->SetFillColor(5);
3191 OriginalOmega->SetXTitle("angle (radians)");
3193 OriginalOmega->Fit("gaus");
3194 OriginalOmega->Draw();
3198 Omega3D->SetFillColor(5);
3199 Omega3D->SetXTitle("angle (radians)");
3201 Omega3D->Fit("gaus");
3205 c11 = new TCanvas("c11","3D reconstruction of mean radius",125,125,300,700);
3210 radius->SetFillColor(5);
3211 radius->SetXTitle("radius (cm)");
3216 MeanRadius->SetFillColor(5);
3217 MeanRadius->SetXTitle("radius (cm)");
3221 c12 = new TCanvas("c12","Cerenkov angle vs. Momentum",150,150,550,350);
3224 identification->SetFillColor(5);
3225 identification->SetXTitle("Momentum (GeV/c)");
3226 identification->SetYTitle("Cherenkov angle (radians)");
3228 //Float_t pionmass=.139;
3229 //Float_t kaonmass=.493;
3230 //Float_t protonmass=.938;
3233 TF1 *pionplot = new TF1("pion","acos(sqrt((.139*.139+x*x)/(x*x*1.285*1.285)))",1,5);
3234 TF1 *kaonplot = new TF1("kaon","acos(sqrt((.439*.439+x*x)/(x*x*1.285*1.285)))",1,5);
3235 TF1 *protonplot = new TF1("proton","acos(sqrt((.938*.938+x*x)/(x*x*1.285*1.285)))",1,5);
3237 identification->Draw();
3239 pionplot->SetLineColor(5);
3240 pionplot->Draw("same");
3242 kaonplot->SetLineColor(4);
3243 kaonplot->Draw("same");
3245 protonplot->SetLineColor(3);
3246 protonplot->Draw("same");
3247 //identification->Draw("same");
3251 c13 = new TCanvas("c13","Reconstruction Errors",200,200,900,350);
3255 PhiError->SetFillColor(5);
3257 PhiError->Fit("gaus");
3260 ThetaError->SetFillColor(5);
3262 ThetaError->Fit("gaus");
3265 OmegaError->SetFillColor(5);
3266 OmegaError->SetXTitle("angle (radians)");
3268 OmegaError->Fit("gaus");
3275 c9 = new TCanvas("c9","1D Reconstruction",100,100,1100,700);
3277 //c5->SetFillColor(42);
3280 ckovangle->SetFillColor(5);
3281 ckovangle->SetXTitle("angle (radians)");
3285 radius->SetFillColor(5);
3286 radius->SetXTitle("radius (cm)");
3290 hc0->SetXTitle("pads");
3294 Omega1D->SetFillColor(5);
3295 Omega1D->SetXTitle("angle (radians)");
3299 PhotonCer->SetFillColor(5);
3300 PhotonCer->SetXTitle("angle (radians)");
3304 PadsUsed->SetXTitle("pads");
3305 PadsUsed->Draw("box");
3312 printf("Drawing histograms.../n");
3316 c10 = new TCanvas("c10","Alice RICH digits",50,50,1200,700);
3318 //c1->SetFillColor(42);
3321 hc1->SetXTitle("ix (npads)");
3324 hc2->SetXTitle("ix (npads)");
3327 hc3->SetXTitle("ix (npads)");
3330 hc4->SetXTitle("ix (npads)");
3333 hc5->SetXTitle("ix (npads)");
3336 hc6->SetXTitle("ix (npads)");
3339 hc7->SetXTitle("ix (npads)");
3342 hc0->SetXTitle("ix (npads)");
3346 c11 = new TCanvas("c11","Hits per type",100,100,600,700);
3348 //c4->SetFillColor(42);
3351 feedback->SetXTitle("x (cm)");
3352 feedback->SetYTitle("y (cm)");
3356 //mip->SetFillColor(5);
3357 mip->SetXTitle("x (cm)");
3358 mip->SetYTitle("y (cm)");
3362 //cerenkov->SetFillColor(5);
3363 cerenkov->SetXTitle("x (cm)");
3364 cerenkov->SetYTitle("y (cm)");
3368 //h->SetFillColor(5);
3369 h->SetXTitle("x (cm)");
3370 h->SetYTitle("y (cm)");
3373 c12 = new TCanvas("c12","Hits distribution",150,150,600,350);
3375 //c10->SetFillColor(42);
3378 hitsX->SetFillColor(5);
3379 hitsX->SetXTitle("(cm)");
3383 hitsY->SetFillColor(5);
3384 hitsY->SetXTitle("(cm)");
3392 // calculate the number of pads which give a signal
3396 /*for (Int_t i=0;i< NpadX;i++) {
3397 for (Int_t j=0;j< NpadY;j++) {
3403 //printf("The total number of pads which give a signal: %d %d\n",Nh,Nh1);
3404 printf("\nEnd of analysis\n");
3405 printf("**********************************\n");
3406 }//void AliRICH::DiagnosticsSE(Int_t diaglevel,Int_t evNumber1,Int_t evNumber2)
3407 //______________________________________________________________________________
3408 void AliRICH::MakeBranchInTreeD(TTree *treeD, const char *file)
3409 {// Create TreeD branches for the RICH.
3410 if(GetDebug())Info("MakeBranchInTreeD","Start.");
3412 const Int_t kBufferSize = 4000;
3413 char branchname[30];
3416 // one branch for digits per chamber
3418 for (Int_t i=0; i<kNCH ;i++) {
3419 sprintf(branchname,"%sDigits%d",GetName(),i+1);
3420 if (fDchambers && treeD) {
3421 MakeBranchInTree(treeD,branchname, &((*fDchambers)[i]), kBufferSize, file);
3422 // printf("Making Branch %s for digits in chamber %d\n",branchname,i+1);
3426 //______________________________________________________________________________
3427 void AliRICH::MakeBranch(Option_t* option)
3428 {//Create Tree branches for the RICH.
3429 if(GetDebug())Info("MakeBranch","Start with option= %s.",option);
3431 const Int_t kBufferSize = 4000;
3432 char branchname[20];
3435 const char *cH = strstr(option,"H");
3436 const char *cD = strstr(option,"D");
3437 const char *cR = strstr(option,"R");
3438 const char *cS = strstr(option,"S");
3442 if(!fHits) fHits=new TClonesArray("AliRICHhit",1000 );
3443 if(!fCerenkovs) fCerenkovs = new TClonesArray("AliRICHCerenkov",1000);
3444 MakeBranchInTree(TreeH(),"RICHCerenkov", &fCerenkovs, kBufferSize, 0) ;
3446 //kir if(!fSDigits) fSDigits = new TClonesArray("AliRICHdigit",100000);
3447 //kir MakeBranchInTree(TreeH(),"RICHSDigits", &fSDigits, kBufferSize, 0) ;
3449 AliDetector::MakeBranch(option);//this is after cH because we need to guarantee that fHits array is created
3451 if(cS&&fLoader->TreeS()){
3452 if(!fSDigits) fSDigits=new TClonesArray("AliRICHdigit",100000);
3453 MakeBranchInTree(fLoader->TreeS(),"RICH",&fSDigits,kBufferSize,0) ;
3457 if (cD&&fLoader->TreeD()){
3459 fDchambers=new TObjArray(kNCH); // one branch for digits per chamber
3460 for(i=0;i<kNCH;i++){
3461 fDchambers->AddAt(new TClonesArray("AliRICHDigit",10000), i);
3464 for (i=0; i<kNCH ;i++)
3466 sprintf(branchname,"%sDigits%d",GetName(),i+1);
3467 MakeBranchInTree(fLoader->TreeD(),branchname, &((*fDchambers)[i]), kBufferSize, 0);
3471 if (cR&&gAlice->TreeR()){//one branch for raw clusters per chamber
3473 if (fRawClusters == 0x0 )
3475 fRawClusters = new TObjArray(kNCH);
3476 for (i=0; i<kNCH ;i++)
3478 fRawClusters->AddAt(new TClonesArray("AliRICHRawCluster",10000), i);
3482 if (fRecHits1D == 0x0)
3484 fRecHits1D = new TObjArray(kNCH);
3485 for (i=0; i<kNCH ;i++)
3487 fRecHits1D->AddAt(new TClonesArray("AliRICHRecHit1D",1000), i);
3491 if (fRecHits3D == 0x0)
3493 fRecHits3D = new TObjArray(kNCH);
3494 for (i=0; i<kNCH ;i++)
3496 fRecHits3D->AddAt(new TClonesArray("AliRICHRecHit3D",1000), i);
3500 for (i=0; i<kNCH ;i++){
3501 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
3502 MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRawClusters)[i]), kBufferSize, 0);
3503 sprintf(branchname,"%sRecHits1D%d",GetName(),i+1);
3504 MakeBranchInTree(fLoader->TreeR(),branchname, &((*fRecHits1D)[i]), kBufferSize, 0);
3505 sprintf(branchname,"%sRecHits3D%d",GetName(),i+1);
3506 MakeBranchInTree(fLoader->TreeR(),branchname, &((*fRecHits3D)[i]), kBufferSize, 0);
3508 }//if (cR && gAlice->TreeR())
3509 if(GetDebug())Info("MakeBranch","Stop.");
3511 //______________________________________________________________________________
3512 void AliRICH::SetTreeAddress()
3513 {//Set branch address for the Hits and Digits Tree.
3514 if(GetDebug())Info("SetTreeAddress","Start.");
3516 char branchname[20];
3521 TTree *treeH = fLoader->TreeH();
3522 TTree *treeD = fLoader->TreeD();
3523 TTree *treeR = fLoader->TreeR();
3524 TTree *treeS = fLoader->TreeS();
3527 if(GetDebug())Info("SetTreeAddress","tree H is requested.");
3528 if(fHits==0x0) fHits=new TClonesArray("AliRICHhit",1000);
3530 branch = treeH->GetBranch("RICHCerenkov");
3532 if (fCerenkovs == 0x0) fCerenkovs = new TClonesArray("AliRICHCerenkov",1000);
3533 branch->SetAddress(&fCerenkovs);
3536 //kir branch = treeH->GetBranch("RICHSDigits");
3539 //kir if (fSDigits == 0x0) fSDigits = new TClonesArray("AliRICHdigit",100000);
3540 //kir branch->SetAddress(&fSDigits);
3544 //this is after TreeH because we need to guarantee that fHits array is created
3545 AliDetector::SetTreeAddress();
3548 if(GetDebug())Info("SetTreeAddress","tree S is requested.");
3549 branch = treeS->GetBranch("RICH");
3551 if(!fSDigits) fSDigits=new TClonesArray("AliRICHdigit",100000);
3552 branch->SetAddress(&fSDigits);
3558 if(GetDebug())Info("SetTreeAddress","tree D is requested.");
3560 if (fDchambers == 0x0)
3562 fDchambers = new TObjArray(kNCH);
3563 for (i=0; i<kNCH ;i++)
3565 fDchambers->AddAt(new TClonesArray("AliRICHDigit",10000), i);
3569 for (i=0; i<kNCH; i++) {
3570 sprintf(branchname,"%sDigits%d",GetName(),i+1);
3572 branch = treeD->GetBranch(branchname);
3573 if (branch) branch->SetAddress(&((*fDchambers)[i]));
3579 if(GetDebug())Info("SetTreeAddress","tree R is requested.");
3581 if (fRawClusters == 0x0 )
3583 fRawClusters = new TObjArray(kNCH);
3584 for (i=0; i<kNCH ;i++)
3586 fRawClusters->AddAt(new TClonesArray("AliRICHRawCluster",10000), i);
3590 if (fRecHits1D == 0x0)
3592 fRecHits1D = new TObjArray(kNCH);
3593 for (i=0; i<kNCH ;i++)
3595 fRecHits1D->AddAt(new TClonesArray("AliRICHRecHit1D",1000), i);
3599 if (fRecHits3D == 0x0)
3601 fRecHits3D = new TObjArray(kNCH);
3602 for (i=0; i<kNCH ;i++)
3604 fRecHits3D->AddAt(new TClonesArray("AliRICHRecHit3D",1000), i);
3608 for (i=0; i<kNCH; i++) {
3609 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
3611 branch = treeR->GetBranch(branchname);
3612 if (branch) branch->SetAddress(&((*fRawClusters)[i]));
3616 for (i=0; i<kNCH; i++) {
3617 sprintf(branchname,"%sRecHits1D%d",GetName(),i+1);
3619 branch = treeR->GetBranch(branchname);
3620 if (branch) branch->SetAddress(&((*fRecHits1D)[i]));
3624 for (i=0; i<kNCH; i++) {
3625 sprintf(branchname,"%sRecHits3D%d",GetName(),i+1);
3627 branch = treeR->GetBranch(branchname);
3628 if (branch) branch->SetAddress(&((*fRecHits3D)[i]));
3633 if(GetDebug())Info("SetTreeAddress","Stop.");
3634 }//void AliRICH::SetTreeAddress()
3635 //______________________________________________________________________________
3636 void AliRICH::Print(Option_t *option)const
3638 TObject::Print(option);
3639 GetGeometryModel(0)->Print(option);
3640 GetSegmentationModel(0)->Print(option);
3641 GetResponseModel(0)->Print(option);
3642 }//void AliRICH::Print(Option_t *option)const