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 Revision 1.62 2002/10/31 08:44:04 morsch
19 Problems with rotated RICH solved:
20 Detector response (fresnel reflection, grid absorption ...) has to be
21 determined using local coordinates.
23 Revision 1.61 2002/10/29 15:00:08 morsch
24 - Diagnostics updated.
25 - RecHits structure synchronized.
26 - Digitizer method using AliRICHDigitizer.
30 Revision 1.60 2002/10/22 16:28:21 alibrary
31 Introducing Riostream.h
33 Revision 1.59 2002/10/14 14:57:31 hristov
34 Merging the VirtualMC branch to the main development branch (HEAD)
36 Revision 1.58.6.1 2002/06/10 15:12:46 hristov
39 Revision 1.58 2001/11/14 09:49:37 dibari
42 Revision 1.57 2001/11/09 17:29:31 dibari
43 Setters fro models moved to header
45 Revision 1.56 2001/11/02 15:37:25 hristov
46 Digitizer class created. Code cleaning and bug fixes (J.Chudoba)
48 Revision 1.55 2001/10/23 13:03:35 hristov
49 The access to several data members was changed from public to protected. The digitisation was adapted to the multi-event case (J.Chudoba)
51 Revision 1.54 2001/09/07 08:38:10 hristov
52 Pointers initialised to 0 in the default constructors
54 Revision 1.53 2001/08/30 09:51:23 hristov
55 The operator[] is replaced by At() or AddAt() in case of TObjArray.
57 Revision 1.52 2001/05/16 14:57:20 alibrary
58 New files for folders and Stack
60 Revision 1.51 2001/05/14 10:18:55 hristov
61 Default arguments declared once
63 Revision 1.50 2001/05/10 14:44:16 jbarbosa
64 Corrected some overlaps (thanks I. Hrivnacovna).
66 Revision 1.49 2001/05/10 12:23:49 jbarbosa
67 Repositioned the RICH modules.
68 Eliminated magic numbers.
69 Incorporated diagnostics (from macros).
71 Revision 1.48 2001/03/15 10:35:00 jbarbosa
72 Corrected bug in MakeBranch (was using a different version of STEER)
74 Revision 1.47 2001/03/14 18:13:56 jbarbosa
75 Several changes to adapt to new IO.
76 Removed digitising function, using AliRICHMerger::Digitise from now on.
78 Revision 1.46 2001/03/12 17:46:33 hristov
79 Changes needed on Sun with CC 5.0
81 Revision 1.45 2001/02/27 22:11:46 jbarbosa
82 Testing TreeS, removing of output.
84 Revision 1.44 2001/02/27 15:19:12 jbarbosa
85 Transition to SDigits.
87 Revision 1.43 2001/02/23 17:19:06 jbarbosa
88 Corrected photocathode definition in BuildGeometry().
90 Revision 1.42 2001/02/13 20:07:23 jbarbosa
91 Parametrised definition of photcathode dimensions. New spacers. New data members in AliRICHHit to store particle momentum
92 when entering the freon. Corrected calls to particle stack.
94 Revision 1.41 2001/01/26 20:00:20 hristov
95 Major upgrade of AliRoot code
97 Revision 1.40 2001/01/24 20:58:03 jbarbosa
98 Enhanced BuildGeometry. Now the photocathodes are drawn.
100 Revision 1.39 2001/01/22 21:40:24 jbarbosa
101 Removing magic numbers
103 Revision 1.37 2000/12/20 14:07:25 jbarbosa
104 Removed dependencies on TGeant3 (thanks to F. Carminati and I. Hrivnacova)
106 Revision 1.36 2000/12/18 17:45:54 jbarbosa
107 Cleaned up PadHits object.
109 Revision 1.35 2000/12/15 16:49:40 jbarbosa
110 Geometry and materials updates (wire supports, pcbs, backplane supports, frame).
112 Revision 1.34 2000/11/10 18:12:12 jbarbosa
113 Bug fix for AliRICHCerenkov (thanks to P. Hristov)
115 Revision 1.33 2000/11/02 10:09:01 jbarbosa
116 Minor bug correction (some pointers were not initialised in the default constructor)
118 Revision 1.32 2000/11/01 15:32:55 jbarbosa
119 Updated to handle both reconstruction algorithms.
121 Revision 1.31 2000/10/26 20:18:33 jbarbosa
122 Supports for methane and freon vessels
124 Revision 1.30 2000/10/24 13:19:12 jbarbosa
127 Revision 1.29 2000/10/19 19:39:25 jbarbosa
128 Some more changes to geometry. Further correction of digitisation "per part. type"
130 Revision 1.28 2000/10/17 20:50:57 jbarbosa
131 Inversed digtise by particle type (now, only the selected particle type is not digitsed).
132 Corrected several geometry minor bugs.
133 Added new parameter (opaque quartz thickness).
135 Revision 1.27 2000/10/11 10:33:55 jbarbosa
136 Corrected bug introduced by earlier revisions (CerenkovData array cannot be reset to zero on wach call of StepManager)
138 Revision 1.26 2000/10/03 21:44:08 morsch
139 Use AliSegmentation and AliHit abstract base classes.
141 Revision 1.25 2000/10/02 21:28:12 fca
142 Removal of useless dependecies via forward declarations
144 Revision 1.24 2000/10/02 15:43:17 jbarbosa
145 Fixed forward declarations.
146 Fixed honeycomb density.
147 Fixed cerenkov storing.
150 Revision 1.23 2000/09/13 10:42:14 hristov
151 Minor corrections for HP, DEC and Sun; strings.h included
153 Revision 1.22 2000/09/12 18:11:13 fca
154 zero hits area before using
156 Revision 1.21 2000/07/21 10:21:07 morsch
157 fNrawch = 0; and fNrechits = 0; in the default constructor.
159 Revision 1.20 2000/07/10 15:28:39 fca
160 Correction of the inheritance scheme
162 Revision 1.19 2000/06/30 16:29:51 dibari
163 Added kDebugLevel variable to control output size on demand
165 Revision 1.18 2000/06/12 15:15:46 jbarbosa
168 Revision 1.17 2000/06/09 14:58:37 jbarbosa
169 New digitisation per particle type
171 Revision 1.16 2000/04/19 12:55:43 morsch
172 Newly structured and updated version (JB, AM)
177 ////////////////////////////////////////////////
178 // Manager and hits classes for set:RICH //
179 ////////////////////////////////////////////////
187 #include <TObjArray.h>
190 #include <TParticle.h>
191 #include <TGeometry.h>
199 #include <Riostream.h>
203 #include "AliSegmentation.h"
204 #include "AliRICHSegmentationV0.h"
205 #include "AliRICHHit.h"
206 #include "AliRICHCerenkov.h"
207 #include "AliRICHSDigit.h"
208 #include "AliRICHDigit.h"
209 #include "AliRICHTransientDigit.h"
210 #include "AliRICHRawCluster.h"
211 #include "AliRICHRecHit1D.h"
212 #include "AliRICHRecHit3D.h"
213 #include "AliRICHHitMapA1.h"
214 #include "AliRICHClusterFinder.h"
215 #include "AliRICHMerger.h"
216 #include "AliRICHDigitizer.h"
218 #include "AliRunDigitizer.h"
221 #include "AliConst.h"
223 #include "AliPoints.h"
228 static Int_t sMaxIterPad=0; // Static variables for the pad-hit iterator routines
229 static Int_t sCurIterPad=0;
233 //___________________________________________
234 // RICH manager class
237 <img src="gif/alirich.gif">
243 // Default ctor should not contain any new operators
244 cout<<ClassName()<<"::named ctor(sName,sTitle)>\n"; // no way to control it as ctor is called before call to SetDebugXXXX()
257 for (Int_t i=0; i<7; i++){
266 }//AliRICH::AliRICH()
268 AliRICH::AliRICH(const char *name, const char *title)
269 : AliDetector(name,title)
272 cout<<ClassName()<<"::named ctor(sName,sTitle)>\n"; // no way to control it as ctor is called before call to SetDebugXXXX()
274 fHits = new TClonesArray("AliRICHHit",1000 );
275 gAlice->AddHitList(fHits);
276 fSDigits = new TClonesArray("AliRICHSDigit",100000);
277 fCerenkovs = new TClonesArray("AliRICHCerenkov",1000);
278 gAlice->AddHitList(fCerenkovs);
283 //fNdch = new Int_t[kNCH];
285 fDchambers = new TObjArray(kNCH);
287 fRecHits1D = new TObjArray(kNCH);
288 fRecHits3D = new TObjArray(kNCH);
292 for (i=0; i<kNCH ;i++) {
293 //PH (*fDchambers)[i] = new TClonesArray("AliRICHDigit",10000);
294 fDchambers->AddAt(new TClonesArray("AliRICHDigit",10000), i);
298 //fNrawch = new Int_t[kNCH];
300 fRawClusters = new TObjArray(kNCH);
301 //printf("Created fRwClusters with adress:%p",fRawClusters);
303 for (i=0; i<kNCH ;i++) {
304 //PH (*fRawClusters)[i] = new TClonesArray("AliRICHRawCluster",10000);
305 fRawClusters->AddAt(new TClonesArray("AliRICHRawCluster",10000), i);
309 //fNrechits = new Int_t[kNCH];
311 for (i=0; i<kNCH ;i++) {
312 //PH (*fRecHits1D)[i] = new TClonesArray("AliRICHRecHit1D",1000);
313 fRecHits1D->AddAt(new TClonesArray("AliRICHRecHit1D",1000), i);
315 for (i=0; i<kNCH ;i++) {
316 //PH (*fRecHits3D)[i] = new TClonesArray("AliRICHRecHit3D",1000);
317 fRecHits3D->AddAt(new TClonesArray("AliRICHRecHit3D",1000), i);
319 //printf("Created fRecHits with adress:%p",fRecHits);
322 SetMarkerColor(kRed);
324 /*fChambers = new TObjArray(kNCH);
325 for (i=0; i<kNCH; i++)
326 (*fChambers)[i] = new AliRICHChamber();*/
332 AliRICH::AliRICH(const AliRICH& RICH)
340 // Dtor of RICH manager class
341 if(IsDebugStart()) cout<<ClassName()<<"::default dtor()>\n";
348 //PH Delete TObjArrays
354 fDchambers->Delete();
358 fRawClusters->Delete();
362 fRecHits1D->Delete();
366 fRecHits3D->Delete();
373 //_____________________________________________________________________________
374 Int_t AliRICH::Hits2SDigits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, ResponseType res)
376 // Calls the charge disintegration method of the current chamber and adds
377 // the simulated cluster to the root tree
378 if(IsDebugHit()||IsDebugDigit()) cout<<ClassName()<<"::Hits2SDigits(...)>\n";
381 Float_t newclust[4][500];
385 // Integrated pulse height on chamber
389 ((AliRICHChamber*)fChambers->At(idvol))->DisIntegration(eloss, xhit, yhit, nnew, newclust, res);
394 for (Int_t i=0; i<nnew; i++) {
395 if (Int_t(newclust[0][i]) > 0) {
398 clhits[1] = Int_t(newclust[0][i]);
400 clhits[2] = Int_t(newclust[1][i]);
402 clhits[3] = Int_t(newclust[2][i]);
403 // Pad: chamber sector
404 clhits[4] = Int_t(newclust[3][i]);
406 //printf(" %d %d %d %d %d\n", clhits[0], clhits[1], clhits[2], clhits[3], clhits[4]);
412 if (gAlice->TreeS()){
413 gAlice->TreeS()->Fill();
414 gAlice->TreeS()->Write(0,TObject::kOverwrite);
415 //printf("Filled SDigits...\n");
419 }//Int_t AliRICH::Hits2SDigits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, ResponseType res)
421 void AliRICH::Hits2SDigits()
423 // Dummy: sdigits are created during transport.
424 // Called from alirun.
425 if(IsDebugHit()||IsDebugDigit()) cout<<ClassName()<<"::Hits2SDigits()>\n";
428 int nparticles = gAlice->GetNtrack();
429 cout << "Particles (RICH):" <<nparticles<<endl;
430 if (nparticles > 0) printf("SDigits were already generated.\n");
434 //___________________________________________
435 void AliRICH::SDigits2Digits(Int_t nev, Int_t flag)
438 // Called from macro. Multiple events, more functionality.
439 if(IsDebugDigit()) cout<<ClassName()<<"::SDigits2Digits()>\n";
441 //AliRICHChamber* iChamber;
443 //printf("Generating tresholds...\n");
445 //for(Int_t i=0;i<7;i++) {
446 //iChamber = &(Chamber(i));
447 //iChamber->GenerateTresholds();
450 //int nparticles = gAlice->GetNtrack();
451 //cout << "Particles (RICH):" <<nparticles<<endl;
452 //if (nparticles <= 0) return;
454 //fMerger = new AliRICHMerger();
459 //fMerger->Digitise(nev,flag);
461 AliRunDigitizer * manager = new AliRunDigitizer(1,1);
462 manager->SetInputStream(0,"galice.root");
463 //AliRICHDigitizer *dRICH = new AliRICHDigitizer(manager);
464 manager->Exec("deb");
467 //___________________________________________
468 void AliRICH::SDigits2Digits()
472 //___________________________________________
473 void AliRICH::Digits2Reco()
476 // Called from alirun, single event only.
477 if(IsDebugDigit()||IsDebugReco()) cout<<ClassName()<<"::Digits2Reco()>\n";
480 int nparticles = gAlice->GetNtrack();
481 cout << "Particles (RICH):" <<nparticles<<endl;
482 if (nparticles > 0) FindClusters(0,0);
486 void AliRICH::AddHit(Int_t track, Int_t *vol, Float_t *hits)
488 // Adds the current hit to the RICH hits list
489 if(IsDebugHit()) cout<<ClassName()<<"::AddHit(...)>\n";
491 TClonesArray &lhits = *fHits;
492 new(lhits[fNhits++]) AliRICHHit(fIshunt,track,vol,hits);
495 void AliRICH::AddCerenkov(Int_t track, Int_t *vol, Float_t *cerenkovs)
497 // Adds a RICH cerenkov hit to the Cerenkov Hits list
498 if(IsDebugHit()) cout<<ClassName()<<"::AddCerenkov()>\n";
500 TClonesArray &lcerenkovs = *fCerenkovs;
501 new(lcerenkovs[fNcerenkovs++]) AliRICHCerenkov(fIshunt,track,vol,cerenkovs);
504 void AliRICH::AddSDigit(Int_t *aSDigit)
506 // Adds the current S digit to the RICH list of S digits
507 if(IsDebugDigit()) cout<<ClassName()<<"::AddSDigit()>\n";
509 TClonesArray &lSDigits = *fSDigits;
510 new(lSDigits[fNSDigits++]) AliRICHSDigit(aSDigit);
514 void AliRICH::AddDigits(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
516 // Add a RICH digit to the list
517 if(IsDebugDigit()) cout<<ClassName()<<"::AddDigit()>\n";
519 TClonesArray &ldigits = *((TClonesArray*)fDchambers->At(id));
520 new(ldigits[fNdch[id]++]) AliRICHDigit(tracks,charges,digits);
523 void AliRICH::AddRawCluster(Int_t id, const AliRICHRawCluster& c)
525 // Add a RICH digit to the list
528 cout<<ClassName()<<"::AddRawCluster()>\n";
530 //PH TClonesArray &lrawcl = *((TClonesArray*)(*fRawClusters)[id]);
531 TClonesArray &lrawcl = *((TClonesArray*)fRawClusters->At(id));
532 new(lrawcl[fNrawch[id]++]) AliRICHRawCluster(c);
535 //_____________________________________________________________________________
536 void AliRICH::AddRecHit1D(Int_t id, Float_t *rechit, Float_t *photons, Int_t *padsx, Int_t* padsy)
540 // Add a RICH reconstructed hit to the list
543 //PH TClonesArray &lrec1D = *((TClonesArray*)(*fRecHits1D)[id]);
544 TClonesArray &lrec1D = *((TClonesArray*)fRecHits1D->At(id));
545 new(lrec1D[fNrechits1D[id]++]) AliRICHRecHit1D(id,rechit,photons,padsx,padsy);
548 //_____________________________________________________________________________
549 void AliRICH::AddRecHit3D(Int_t id, Float_t *rechit, Float_t omega, Float_t theta, Float_t phi)
551 // Add a RICH reconstructed hit to the list
553 TClonesArray &lrec3D = *((TClonesArray*)fRecHits3D->At(id));
554 new(lrec3D[fNrechits3D[id]++]) AliRICHRecHit3D(id,rechit,omega,theta,phi);
557 //___________________________________________
558 void AliRICH::BuildGeometry()
563 // Builds a TNode geometry for event display
565 TNode *node, *subnode, *top;
567 const int kColorRICH = kRed;
569 top=gAlice->GetGeometry()->GetNode("alice");
571 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
572 AliRICHSegmentationV0* segmentation;
573 AliRICHChamber* iChamber;
574 AliRICHGeometry* geometry;
576 iChamber = &(pRICH->Chamber(0));
577 segmentation=(AliRICHSegmentationV0*) iChamber->GetSegmentationModel();
578 geometry=iChamber->GetGeometryModel();
580 new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15);
582 Float_t padplane_width = segmentation->GetPadPlaneWidth();
583 Float_t padplane_length = segmentation->GetPadPlaneLength();
585 //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());
587 new TBRIK("PHOTO","PHOTO","void", padplane_width/2,.1,padplane_length/2);
589 //printf("\n\n\n\n\n Padplane w: %f l: %f \n\n\n\n\n", padplane_width/2,padplane_length/2);
590 //printf("\n\n\n\n\n Padplane w: %f l: %f \n\n\n\n\n", segmentation->GetPadPlaneWidth(), segmentation->GetPadPlaneLength());
592 Float_t offset = 490 + 1.276 - geometry->GetGapThickness()/2; //distance from center of mother volume to methane
593 Float_t deltaphi = 19.5; //phi angle between center of chambers - z direction
594 Float_t deltatheta = 20; //theta angle between center of chambers - x direction
595 Float_t cosphi = TMath::Cos(deltaphi*TMath::Pi()/180);
596 Float_t sinphi = TMath::Sin(deltaphi*TMath::Pi()/180);
597 Float_t costheta = TMath::Cos(deltatheta*TMath::Pi()/180);
598 Float_t sintheta = TMath::Sin(deltatheta*TMath::Pi()/180);
600 //printf("\n\n%f %f %f %f %f %f %f\n\n",offset,deltatheta,deltaphi,cosphi,costheta,sinphi,sintheta);
602 new TRotMatrix("rot993","rot993",90., 0. , 90. - deltaphi, 90. , deltaphi, -90. );
603 new TRotMatrix("rot994","rot994",90., -deltatheta , 90. , 90.- deltatheta , 0. , 0. );
604 new TRotMatrix("rot995","rot995",90., 0. , 90. , 90. , 0. , 0. );
605 new TRotMatrix("rot996","rot996",90., deltatheta , 90. , 90 + deltatheta , 0. , 0. );
606 new TRotMatrix("rot997","rot997",90., 360. - deltatheta, 108.2 , 90.- deltatheta ,18.2 , 90 - deltatheta);
607 new TRotMatrix("rot998","rot998",90., 0. , 90 + deltaphi , 90. , deltaphi, 90. );
608 new TRotMatrix("rot999","rot999",90., deltatheta , 108.2 , 90.+ deltatheta ,18.2 , 90 + deltatheta);
610 Float_t pos1[3]={0. , offset*cosphi , offset*sinphi};
611 Float_t pos2[3]={offset*sintheta , offset*costheta , 0. };
612 Float_t pos3[3]={0. , offset , 0.};
613 Float_t pos4[3]={-offset*sintheta , offset*costheta , 0.};
614 Float_t pos5[3]={offset*sinphi , offset*costheta*cosphi, -offset*sinphi};
615 Float_t pos6[3]={0. , offset*cosphi , -offset*sinphi};
616 Float_t pos7[3]={ -offset*sinphi , offset*costheta*cosphi, -offset*sinphi};
620 //Float_t pos1[3]={0,471.8999,165.2599};
621 //Chamber(0).SetChamberTransform(pos1[0],pos1[1],pos1[2],
622 //new TRotMatrix("rot993","rot993",90,0,70.69,90,19.30999,-90);
623 node = new TNode("RICH1","RICH1","S_RICH",pos1[0],pos1[1],pos1[2],"rot993");
624 node->SetLineColor(kColorRICH);
626 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
627 subnode->SetLineColor(kGreen);
628 fNodes->Add(subnode);
629 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
630 subnode->SetLineColor(kGreen);
631 fNodes->Add(subnode);
632 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
633 subnode->SetLineColor(kGreen);
634 fNodes->Add(subnode);
635 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
636 subnode->SetLineColor(kGreen);
637 fNodes->Add(subnode);
638 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
639 subnode->SetLineColor(kGreen);
640 fNodes->Add(subnode);
641 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
642 subnode->SetLineColor(kGreen);
643 fNodes->Add(subnode);
648 //Float_t pos2[3]={171,470,0};
649 //Chamber(1).SetChamberTransform(pos2[0],pos2[1],pos2[2],
650 //new TRotMatrix("rot994","rot994",90,-20,90,70,0,0);
651 node = new TNode("RICH2","RICH2","S_RICH",pos2[0],pos2[1],pos2[2],"rot994");
652 node->SetLineColor(kColorRICH);
654 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
655 subnode->SetLineColor(kGreen);
656 fNodes->Add(subnode);
657 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
658 subnode->SetLineColor(kGreen);
659 fNodes->Add(subnode);
660 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
661 subnode->SetLineColor(kGreen);
662 fNodes->Add(subnode);
663 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
664 subnode->SetLineColor(kGreen);
665 fNodes->Add(subnode);
666 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
667 subnode->SetLineColor(kGreen);
668 fNodes->Add(subnode);
669 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
670 subnode->SetLineColor(kGreen);
671 fNodes->Add(subnode);
676 //Float_t pos3[3]={0,500,0};
677 //Chamber(2).SetChamberTransform(pos3[0],pos3[1],pos3[2],
678 //new TRotMatrix("rot995","rot995",90,0,90,90,0,0);
679 node = new TNode("RICH3","RICH3","S_RICH",pos3[0],pos3[1],pos3[2],"rot995");
680 node->SetLineColor(kColorRICH);
682 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
683 subnode->SetLineColor(kGreen);
684 fNodes->Add(subnode);
685 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
686 subnode->SetLineColor(kGreen);
687 fNodes->Add(subnode);
688 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
689 subnode->SetLineColor(kGreen);
690 fNodes->Add(subnode);
691 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
692 subnode->SetLineColor(kGreen);
693 fNodes->Add(subnode);
694 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
695 subnode->SetLineColor(kGreen);
696 fNodes->Add(subnode);
697 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
698 subnode->SetLineColor(kGreen);
699 fNodes->Add(subnode);
703 //Float_t pos4[3]={-171,470,0};
704 //Chamber(3).SetChamberTransform(pos4[0],pos4[1],pos4[2],
705 //new TRotMatrix("rot996","rot996",90,20,90,110,0,0);
706 node = new TNode("RICH4","RICH4","S_RICH",pos4[0],pos4[1],pos4[2],"rot996");
707 node->SetLineColor(kColorRICH);
709 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
710 subnode->SetLineColor(kGreen);
711 fNodes->Add(subnode);
712 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
713 subnode->SetLineColor(kGreen);
714 fNodes->Add(subnode);
715 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
716 subnode->SetLineColor(kGreen);
717 fNodes->Add(subnode);
718 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
719 subnode->SetLineColor(kGreen);
720 fNodes->Add(subnode);
721 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
722 subnode->SetLineColor(kGreen);
723 fNodes->Add(subnode);
724 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
725 subnode->SetLineColor(kGreen);
726 fNodes->Add(subnode);
731 //Float_t pos5[3]={161.3999,443.3999,-165.3};
732 //Chamber(4).SetChamberTransform(pos5[0],pos5[1],pos5[2],
733 //new TRotMatrix("rot997","rot997",90,340,108.1999,70,18.2,70);
734 node = new TNode("RICH5","RICH5","S_RICH",pos5[0],pos5[1],pos5[2],"rot997");
735 node->SetLineColor(kColorRICH);
737 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
738 subnode->SetLineColor(kGreen);
739 fNodes->Add(subnode);
740 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
741 subnode->SetLineColor(kGreen);
742 fNodes->Add(subnode);
743 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
744 subnode->SetLineColor(kGreen);
745 fNodes->Add(subnode);
746 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
747 subnode->SetLineColor(kGreen);
748 fNodes->Add(subnode);
749 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
750 subnode->SetLineColor(kGreen);
751 fNodes->Add(subnode);
752 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
753 subnode->SetLineColor(kGreen);
754 fNodes->Add(subnode);
759 //Float_t pos6[3]={0., 471.9, -165.3,};
760 //Chamber(5).SetChamberTransform(pos6[0],pos6[1],pos6[2],
761 //new TRotMatrix("rot998","rot998",90,0,109.3099,90,19.30999,90);
762 node = new TNode("RICH6","RICH6","S_RICH",pos6[0],pos6[1],pos6[2],"rot998");
763 node->SetLineColor(kColorRICH);
764 fNodes->Add(node);node->cd();
765 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
766 subnode->SetLineColor(kGreen);
767 fNodes->Add(subnode);
768 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
769 subnode->SetLineColor(kGreen);
770 fNodes->Add(subnode);
771 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
772 subnode->SetLineColor(kGreen);
773 fNodes->Add(subnode);
774 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
775 subnode->SetLineColor(kGreen);
776 fNodes->Add(subnode);
777 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
778 subnode->SetLineColor(kGreen);
779 fNodes->Add(subnode);
780 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
781 subnode->SetLineColor(kGreen);
782 fNodes->Add(subnode);
786 //Float_t pos7[3]={-161.399,443.3999,-165.3};
787 //Chamber(6).SetChamberTransform(pos7[0],pos7[1],pos7[2],
788 //new TRotMatrix("rot999","rot999",90,20,108.1999,110,18.2,110);
789 node = new TNode("RICH7","RICH7","S_RICH",pos7[0],pos7[1],pos7[2],"rot999");
790 node->SetLineColor(kColorRICH);
792 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
793 subnode->SetLineColor(kGreen);
794 fNodes->Add(subnode);
795 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
796 subnode->SetLineColor(kGreen);
797 fNodes->Add(subnode);
798 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
799 subnode->SetLineColor(kGreen);
800 fNodes->Add(subnode);
801 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
802 subnode->SetLineColor(kGreen);
803 fNodes->Add(subnode);
804 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
805 subnode->SetLineColor(kGreen);
806 fNodes->Add(subnode);
807 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
808 subnode->SetLineColor(kGreen);
809 fNodes->Add(subnode);
814 //___________________________________________
815 void AliRICH::CreateGeometry()
818 // Create the geometry for RICH version 1
820 // Modified by: N. Colonna (INFN - BARI, Nicola.Colonna@ba.infn.it)
821 // R.A. Fini (INFN - BARI, Rosanna.Fini@ba.infn.it)
822 // R.A. Loconsole (Bari University, loco@riscom.ba.infn.it)
826 <img src="picts/AliRICHv1.gif">
831 <img src="picts/AliRICHv1Tree.gif">
835 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
836 AliRICHSegmentationV0* segmentation;
837 AliRICHGeometry* geometry;
838 AliRICHChamber* iChamber;
840 iChamber = &(pRICH->Chamber(0));
841 segmentation=(AliRICHSegmentationV0*) iChamber->GetSegmentationModel();
842 geometry=iChamber->GetGeometryModel();
845 distance = geometry->GetFreonThickness()/2 + geometry->GetQuartzThickness() + geometry->GetGapThickness();
846 geometry->SetRadiatorToPads(distance);
848 //Opaque quartz thickness
849 Float_t oqua_thickness = .5;
852 //Float_t csi_length = 160*.8 + 2.6;
853 //Float_t csi_width = 144*.84 + 2*2.6;
855 Float_t csi_width = segmentation->Npx()*segmentation->Dpx() + segmentation->DeadZone();
856 Float_t csi_length = segmentation->Npy()*segmentation->Dpy() + 2*segmentation->DeadZone();
858 //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());
860 Int_t *idtmed = fIdtmed->GetArray()-999;
867 // --- Define the RICH detector
868 // External aluminium box
870 par[1] = 13; //Original Settings
875 gMC->Gsvolu("RICH", "BOX ", idtmed[1009], par, 3);
879 par[1] = 13; //Original Settings
884 gMC->Gsvolu("SRIC", "BOX ", idtmed[1000], par, 3);
886 // Air 2 (cutting the lower part of the box)
889 par[1] = 3; //Original Settings
891 gMC->Gsvolu("AIR2", "BOX ", idtmed[1000], par, 3);
893 // Air 3 (cutting the lower part of the box)
896 par[1] = 3; //Original Settings
898 gMC->Gsvolu("AIR3", "BOX ", idtmed[1000], par, 3);
902 par[1] = .188; //Original Settings
907 gMC->Gsvolu("HONE", "BOX ", idtmed[1001], par, 3);
911 par[1] = .025; //Original Settings
916 gMC->Gsvolu("ALUM", "BOX ", idtmed[1009], par, 3);
919 par[0] = geometry->GetQuartzWidth()/2;
920 par[1] = geometry->GetQuartzThickness()/2;
921 par[2] = geometry->GetQuartzLength()/2;
923 par[1] = .25; //Original Settings
925 /*par[0] = geometry->GetQuartzWidth()/2;
926 par[1] = geometry->GetQuartzThickness()/2;
927 par[2] = geometry->GetQuartzLength()/2;*/
928 //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]);
929 gMC->Gsvolu("QUAR", "BOX ", idtmed[1002], par, 3);
931 // Spacers (cylinders)
934 par[2] = geometry->GetFreonThickness()/2;
935 gMC->Gsvolu("SPAC", "TUBE", idtmed[1002], par, 3);
937 // Feet (freon slabs supports)
942 gMC->Gsvolu("FOOT", "BOX", idtmed[1009], par, 3);
945 par[0] = geometry->GetQuartzWidth()/2;
947 par[2] = geometry->GetQuartzLength()/2;
949 par[1] = .2; //Original Settings
954 gMC->Gsvolu("OQUA", "BOX ", idtmed[1007], par, 3);
956 // Frame of opaque quartz
957 par[0] = geometry->GetOuterFreonWidth()/2;
959 par[1] = geometry->GetFreonThickness()/2;
960 par[2] = geometry->GetOuterFreonLength()/2;
963 par[1] = .5; //Original Settings
968 gMC->Gsvolu("OQF1", "BOX ", idtmed[1007], par, 3);
970 par[0] = geometry->GetInnerFreonWidth()/2;
971 par[1] = geometry->GetFreonThickness()/2;
972 par[2] = geometry->GetInnerFreonLength()/2;
973 gMC->Gsvolu("OQF2", "BOX ", idtmed[1007], par, 3);
975 // Little bar of opaque quartz
977 //par[1] = geometry->GetQuartzThickness()/2;
978 //par[2] = geometry->GetInnerFreonLength()/2 - 2.4;
979 //par[2] = geometry->GetInnerFreonLength()/2;
982 par[1] = .25; //Original Settings
987 //gMC->Gsvolu("BARR", "BOX ", idtmed[1007], par, 3);
990 par[0] = geometry->GetOuterFreonWidth()/2 - oqua_thickness;
991 par[1] = geometry->GetFreonThickness()/2;
992 par[2] = geometry->GetOuterFreonLength()/2 - 2*oqua_thickness;
994 par[1] = .5; //Original Settings
999 gMC->Gsvolu("FRE1", "BOX ", idtmed[1003], par, 3);
1001 par[0] = geometry->GetInnerFreonWidth()/2 - oqua_thickness;
1002 par[1] = geometry->GetFreonThickness()/2;
1003 par[2] = geometry->GetInnerFreonLength()/2 - 2*oqua_thickness;
1004 gMC->Gsvolu("FRE2", "BOX ", idtmed[1003], par, 3);
1008 par[0] = csi_width/2;
1009 par[1] = geometry->GetGapThickness()/2;
1010 //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]);
1012 par[2] = csi_length/2;
1013 gMC->Gsvolu("META", "BOX ", idtmed[1004], par, 3);
1017 par[0] = csi_width/2;
1018 par[1] = geometry->GetProximityGapThickness()/2;
1019 //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]);
1021 par[2] = csi_length/2;
1022 gMC->Gsvolu("GAP ", "BOX ", idtmed[1008], par, 3);
1026 par[0] = csi_width/2;
1029 par[2] = csi_length/2;
1030 gMC->Gsvolu("CSI ", "BOX ", idtmed[1005], par, 3);
1036 gMC->Gsvolu("GRID", "TUBE", idtmed[1006], par, 3);
1041 par[0] = csi_width/2;
1044 gMC->Gsvolu("WSMe", "BOX ", idtmed[1009], par, 3);
1046 // Ceramic pick up (base)
1048 par[0] = csi_width/2;
1051 gMC->Gsvolu("WSG1", "BOX ", idtmed[1010], par, 3);
1053 // Ceramic pick up (head)
1055 par[0] = csi_width/2;
1058 gMC->Gsvolu("WSG2", "BOX ", idtmed[1010], par, 3);
1060 // Aluminium supports for methane and CsI
1063 par[0] = csi_width/2;
1064 par[1] = geometry->GetGapThickness()/2 + .25;
1065 par[2] = (68.35 - csi_length/2)/2;
1066 gMC->Gsvolu("SMSH", "BOX", idtmed[1009], par, 3);
1070 par[0] = (66.3 - csi_width/2)/2;
1071 par[1] = geometry->GetGapThickness()/2 + .25;
1072 par[2] = csi_length/2 + 68.35 - csi_length/2;
1073 gMC->Gsvolu("SMLG", "BOX", idtmed[1009], par, 3);
1075 // Aluminium supports for freon
1078 par[0] = geometry->GetQuartzWidth()/2;
1080 par[2] = (68.35 - geometry->GetQuartzLength()/2)/2;
1081 gMC->Gsvolu("SFSH", "BOX", idtmed[1009], par, 3);
1085 par[0] = (66.3 - geometry->GetQuartzWidth()/2)/2;
1087 par[2] = geometry->GetQuartzLength()/2 + 68.35 - geometry->GetQuartzLength()/2;
1088 gMC->Gsvolu("SFLG", "BOX", idtmed[1009], par, 3);
1092 par[0] = csi_width/2;
1094 par[2] = csi_length/4 -.5025;
1095 gMC->Gsvolu("PCB ", "BOX", idtmed[1011], par, 3);
1098 // Backplane supports
1105 gMC->Gsvolu("BACK", "BOX", idtmed[1009], par, 3);
1112 gMC->Gsvolu("BKHL", "BOX", idtmed[1000], par, 3);
1119 gMC->Gsvolu("BKHS", "BOX", idtmed[1000], par, 3);
1121 // Place holes inside backplane support
1123 gMC->Gspos("BKHS", 1, "BACK", .8 + 5.7,0., .6 + 4.4625, 0, "ONLY");
1124 gMC->Gspos("BKHS", 2, "BACK", -.8 - 5.7,0., .6 + 4.4625, 0, "ONLY");
1125 gMC->Gspos("BKHS", 3, "BACK", .8 + 5.7,0., -.6 - 4.4625, 0, "ONLY");
1126 gMC->Gspos("BKHS", 4, "BACK", -.8 - 5.7,0., -.6 - 4.4625, 0, "ONLY");
1127 gMC->Gspos("BKHS", 5, "BACK", .8 + 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1128 gMC->Gspos("BKHS", 6, "BACK", -.8 - 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1129 gMC->Gspos("BKHS", 7, "BACK", .8 + 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1130 gMC->Gspos("BKHS", 8, "BACK", -.8 - 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1131 gMC->Gspos("BKHL", 1, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., .6 + 4.4625, 0, "ONLY");
1132 gMC->Gspos("BKHL", 2, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 4.4625, 0, "ONLY");
1133 gMC->Gspos("BKHL", 3, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 4.4625, 0, "ONLY");
1134 gMC->Gspos("BKHL", 4, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 4.4625, 0, "ONLY");
1135 gMC->Gspos("BKHL", 5, "BACK", .8 + 11.4+ 1.6 + 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1136 gMC->Gspos("BKHL", 6, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1137 gMC->Gspos("BKHL", 7, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1138 gMC->Gspos("BKHL", 8, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1142 // --- Places the detectors defined with GSVOLU
1143 // Place material inside RICH
1144 gMC->Gspos("SRIC", 1, "RICH", 0.,0., 0., 0, "ONLY");
1145 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");
1146 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");
1147 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");
1148 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");
1151 gMC->Gspos("ALUM", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.025, 0., 0, "ONLY");
1152 gMC->Gspos("HONE", 1, "SRIC", 0., 1.276- geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .188, 0., 0, "ONLY");
1153 gMC->Gspos("ALUM", 2, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .025, 0., 0, "ONLY");
1154 gMC->Gspos("FOOT", 1, "SRIC", 64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
1155 gMC->Gspos("FOOT", 2, "SRIC", 21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3 , 36.9, 0, "ONLY");
1156 gMC->Gspos("FOOT", 3, "SRIC", -21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
1157 gMC->Gspos("FOOT", 4, "SRIC", -64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
1158 gMC->Gspos("FOOT", 5, "SRIC", 64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1159 gMC->Gspos("FOOT", 6, "SRIC", 21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1160 gMC->Gspos("FOOT", 7, "SRIC", -21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1161 gMC->Gspos("FOOT", 8, "SRIC", -64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1162 gMC->Gspos("OQUA", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .2, 0., 0, "ONLY");
1167 gMC->Gspos("SMLG", 1, "SRIC", csi_width/2 + (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
1168 gMC->Gspos("SMLG", 2, "SRIC", - csi_width/2 - (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
1169 gMC->Gspos("SMSH", 1, "SRIC", 0., 1.276 + .25, csi_length/2 + (68.35 - csi_length/2)/2, 0, "ONLY");
1170 gMC->Gspos("SMSH", 2, "SRIC", 0., 1.276 + .25, - csi_length/2 - (68.35 - csi_length/2)/2, 0, "ONLY");
1174 Float_t supp_y = 1.276 - geometry->GetGapThickness()/2- geometry->GetQuartzThickness() -geometry->GetFreonThickness() - .2 + .3; //y position of freon supports
1176 gMC->Gspos("SFLG", 1, "SRIC", geometry->GetQuartzWidth()/2 + (66.3 - geometry->GetQuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
1177 gMC->Gspos("SFLG", 2, "SRIC", - geometry->GetQuartzWidth()/2 - (66.3 - geometry->GetQuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
1178 gMC->Gspos("SFSH", 1, "SRIC", 0., supp_y, geometry->GetQuartzLength()/2 + (68.35 - geometry->GetQuartzLength()/2)/2, 0, "ONLY");
1179 gMC->Gspos("SFSH", 2, "SRIC", 0., supp_y, - geometry->GetQuartzLength()/2 - (68.35 - geometry->GetQuartzLength()/2)/2, 0, "ONLY");
1181 AliMatrix(idrotm[1019], 0., 0., 90., 0., 90., 90.);
1183 //Placing of the spacers inside the freon slabs
1185 Int_t nspacers = 30;
1186 //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);
1188 //printf("Nspacers: %d", nspacers);
1190 for (i = 0; i < nspacers/3; i++) {
1191 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
1192 gMC->Gspos("SPAC", i, "FRE1", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
1195 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
1196 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1197 gMC->Gspos("SPAC", i, "FRE1", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
1200 for (i = (nspacers*2)/3; i < nspacers; ++i) {
1201 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1202 gMC->Gspos("SPAC", i, "FRE1", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
1205 for (i = 0; i < nspacers/3; i++) {
1206 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
1207 gMC->Gspos("SPAC", i, "FRE2", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
1210 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
1211 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1212 gMC->Gspos("SPAC", i, "FRE2", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
1215 for (i = (nspacers*2)/3; i < nspacers; ++i) {
1216 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1217 gMC->Gspos("SPAC", i, "FRE2", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
1221 gMC->Gspos("FRE1", 1, "OQF1", 0., 0., 0., 0, "ONLY");
1222 gMC->Gspos("FRE2", 1, "OQF2", 0., 0., 0., 0, "ONLY");
1223 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)
1224 // printf("Opaque quartz in SRIC %f\n", 1.276 - geometry->GetGapThickness()/2- geometry->GetQuartzThickness() -geometry->GetFreonThickness()/2);
1225 gMC->Gspos("OQF2", 2, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()/2, 0., 0, "ONLY"); //Original settings
1226 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)
1227 //gMC->Gspos("BARR", 1, "QUAR", - geometry->GetInnerFreonWidth()/2 - oqua_thickness, 0., 0., 0, "ONLY"); //Original settings (-21.65)
1228 //gMC->Gspos("BARR", 2, "QUAR", geometry->GetInnerFreonWidth()/2 + oqua_thickness, 0., 0., 0, "ONLY"); //Original settings (21.65)
1229 gMC->Gspos("QUAR", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness()/2, 0., 0, "ONLY");
1230 gMC->Gspos("GAP ", 1, "META", 0., geometry->GetGapThickness()/2 - geometry->GetProximityGapThickness()/2 - 0.0001, 0., 0, "ONLY");
1231 gMC->Gspos("META", 1, "SRIC", 0., 1.276, 0., 0, "ONLY");
1232 gMC->Gspos("CSI ", 1, "SRIC", 0., 1.276 + geometry->GetGapThickness()/2 + .25, 0., 0, "ONLY");
1233 printf("CSI pos: %f\n",1.276 + geometry->GetGapThickness()/2 + .25);
1235 // Wire support placing
1237 gMC->Gspos("WSG2", 1, "GAP ", 0., geometry->GetProximityGapThickness()/2 - .1, 0., 0, "ONLY");
1238 gMC->Gspos("WSG1", 1, "CSI ", 0., 0., 0., 0, "ONLY");
1239 gMC->Gspos("WSMe", 1, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, 0., 0, "ONLY");
1241 // Backplane placing
1243 gMC->Gspos("BACK", 1, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 43.3, 0, "ONLY");
1244 gMC->Gspos("BACK", 2, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2 , 43.3, 0, "ONLY");
1245 gMC->Gspos("BACK", 3, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
1246 gMC->Gspos("BACK", 4, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
1247 gMC->Gspos("BACK", 5, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
1248 gMC->Gspos("BACK", 6, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
1252 gMC->Gspos("PCB ", 1, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, csi_width/4 + .5025 + 2.5, 0, "ONLY");
1253 gMC->Gspos("PCB ", 2, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, -csi_width/4 - .5025 - 2.5, 0, "ONLY");
1257 //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);
1259 // Place RICH inside ALICE apparatus
1263 AliMatrix(idrotm[1000], 90., 0., 70.69, 90., 19.31, -90.);
1264 AliMatrix(idrotm[1001], 90., -20., 90., 70., 0., 0.);
1265 AliMatrix(idrotm[1002], 90., 0., 90., 90., 0., 0.);
1266 AliMatrix(idrotm[1003], 90., 20., 90., 110., 0., 0.);
1267 AliMatrix(idrotm[1004], 90., 340., 108.2, 70., 18.2, 70.);
1268 AliMatrix(idrotm[1005], 90., 0., 109.31, 90., 19.31, 90.);
1269 AliMatrix(idrotm[1006], 90., 20., 108.2, 110., 18.2, 110.);
1271 gMC->Gspos("RICH", 1, "ALIC", 0., 471.9, 165.26, idrotm[1000], "ONLY");
1272 gMC->Gspos("RICH", 2, "ALIC", 171., 470., 0., idrotm[1001], "ONLY");
1273 gMC->Gspos("RICH", 3, "ALIC", 0., 500., 0., idrotm[1002], "ONLY");
1274 gMC->Gspos("RICH", 4, "ALIC", -171., 470., 0., idrotm[1003], "ONLY");
1275 gMC->Gspos("RICH", 5, "ALIC", 161.4, 443.4, -165.3, idrotm[1004], "ONLY");
1276 gMC->Gspos("RICH", 6, "ALIC", 0., 471.9, -165.3, idrotm[1005], "ONLY");
1277 gMC->Gspos("RICH", 7, "ALIC", -161.4, 443.4, -165.3, idrotm[1006], "ONLY");*/
1279 // The placing of the chambers is measured from the vertex to the base of the methane vessel (490 cm)
1281 Float_t offset = 490 + 1.276 - geometry->GetGapThickness()/2; //distance from center of mother volume to methane
1282 Float_t deltaphi = 19.5; //phi angle between center of chambers - z direction
1283 Float_t deltatheta = 20; //theta angle between center of chambers - x direction
1284 Float_t cosphi = TMath::Cos(deltaphi*TMath::Pi()/180);
1285 Float_t sinphi = TMath::Sin(deltaphi*TMath::Pi()/180);
1286 Float_t costheta = TMath::Cos(deltatheta*TMath::Pi()/180);
1287 Float_t sintheta = TMath::Sin(deltatheta*TMath::Pi()/180);
1289 //printf("\n\n%f %f %f %f %f %f %f\n\n",offset,deltatheta,deltaphi,cosphi,costheta,sinphi,sintheta);
1291 AliMatrix(idrotm[1000], 90., 0. , 90. - deltaphi, 90. , deltaphi, -90. );
1292 AliMatrix(idrotm[1001], 90., -deltatheta , 90. , 90.- deltatheta , 0. , 0. );
1293 AliMatrix(idrotm[1002], 90., 0. , 90. , 90. , 0. , 0. );
1294 AliMatrix(idrotm[1003], 90., deltatheta , 90. , 90 + deltatheta , 0. , 0. );
1295 AliMatrix(idrotm[1004], 90., 360. - deltatheta, 108.2 , 90.- deltatheta ,18.2 , 90 - deltatheta);
1296 AliMatrix(idrotm[1005], 90., 0. , 90 + deltaphi , 90. , deltaphi, 90. );
1297 AliMatrix(idrotm[1006], 90., deltatheta , 108.2 , 90.+ deltatheta ,18.2 , 90 + deltatheta);
1299 gMC->Gspos("RICH", 1, "ALIC", 0. , offset*cosphi , offset*sinphi ,idrotm[1000], "ONLY");
1300 gMC->Gspos("RICH", 2, "ALIC", (offset)*sintheta , offset*costheta , 0. ,idrotm[1001], "ONLY");
1301 gMC->Gspos("RICH", 3, "ALIC", 0. , offset , 0. ,idrotm[1002], "ONLY");
1302 gMC->Gspos("RICH", 4, "ALIC", -(offset)*sintheta, offset*costheta , 0. ,idrotm[1003], "ONLY");
1303 gMC->Gspos("RICH", 5, "ALIC", (offset)*sinphi , offset*costheta*cosphi, -offset*sinphi,idrotm[1004], "ONLY");
1304 gMC->Gspos("RICH", 6, "ALIC", 0. , offset*cosphi , -offset*sinphi,idrotm[1005], "ONLY");
1305 gMC->Gspos("RICH", 7, "ALIC", -(offset)*sinphi , offset*costheta*cosphi, -offset*sinphi,idrotm[1006], "ONLY");
1310 //___________________________________________
1311 void AliRICH::CreateMaterials()
1314 // *** DEFINITION OF AVAILABLE RICH MATERIALS ***
1315 // ORIGIN : NICK VAN EIJNDHOVEN
1316 // Modified by: N. Colonna (INFN - BARI, Nicola.Colonna@ba.infn.it)
1317 // R.A. Fini (INFN - BARI, Rosanna.Fini@ba.infn.it)
1318 // R.A. Loconsole (Bari University, loco@riscom.ba.infn.it)
1320 Int_t isxfld = gAlice->Field()->Integ();
1321 Float_t sxmgmx = gAlice->Field()->Max();
1324 /************************************Antonnelo's Values (14-vectors)*****************************************/
1326 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,
1327 6.7e-9,6.88e-9,7.08e-9,7.3e-9,7.51e-9,7.74e-9,8e-9 };
1328 Float_t rIndexQuarz[14] = { 1.528309,1.533333,
1329 1.538243,1.544223,1.550568,1.55777,
1330 1.565463,1.574765,1.584831,1.597027,
1331 1.611858,1.6277,1.6472,1.6724 };
1332 Float_t rIndexOpaqueQuarz[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1333 Float_t rIndexMethane[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1334 Float_t rIndexGrid[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1335 Float_t abscoFreon[14] = { 179.0987,179.0987,
1336 179.0987,179.0987,179.0987,142.92,56.65,13.95,10.43,7.07,2.03,.5773,.33496,0. };
1337 //Float_t abscoFreon[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,
1338 // 1e-5,1e-5,1e-5,1e-5,1e-5 };
1339 Float_t abscoQuarz[14] = { 64.035,39.98,35.665,31.262,27.527,22.815,21.04,17.52,
1340 14.177,9.282,4.0925,1.149,.3627,.10857 };
1341 Float_t abscoOpaqueQuarz[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,
1342 1e-5,1e-5,1e-5,1e-5,1e-5 };
1343 Float_t abscoCsI[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
1344 1e-4,1e-4,1e-4,1e-4 };
1345 Float_t abscoMethane[14] = { 1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,
1347 Float_t abscoGrid[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
1348 1e-4,1e-4,1e-4,1e-4 };
1349 Float_t efficAll[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1350 Float_t efficCsI[14] = { 6e-4,.005,.0075,.01125,.045,.117,.135,.16575,
1351 .17425,.1785,.1836,.1904,.1938,.221 };
1352 Float_t efficGrid[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1356 /**********************************End of Antonnelo's Values**********************************/
1358 /**********************************Values from rich_media.f (31-vectors)**********************************/
1361 //Photons energy intervals
1365 ppckov[i] = (Float_t(i)*0.1+5.5)*1e-9;
1366 //printf ("Energy intervals: %e\n",ppckov[i]);
1370 //Refraction index for quarz
1371 Float_t rIndexQuarz[26];
1378 Float_t ene=ppckov[i]*1e9;
1379 Float_t a=f1/(e1*e1 - ene*ene);
1380 Float_t b=f2/(e2*e2 - ene*ene);
1381 rIndexQuarz[i] = TMath::Sqrt(1. + a + b );
1382 //printf ("rIndexQuarz: %e\n",rIndexQuarz[i]);
1385 //Refraction index for opaque quarz, methane and grid
1386 Float_t rIndexOpaqueQuarz[26];
1387 Float_t rIndexMethane[26];
1388 Float_t rIndexGrid[26];
1391 rIndexOpaqueQuarz[i]=1;
1392 rIndexMethane[i]=1.000444;
1394 //printf ("rIndexOpaqueQuarz , etc: %e, %e, %e\n",rIndexOpaqueQuarz[i], rIndexMethane[i], rIndexGrid[i]=1);
1397 //Absorption index for freon
1398 Float_t abscoFreon[26] = {179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987,
1399 179.0987, 142.9206, 56.64957, 25.58622, 13.95293, 12.03905, 10.42953, 8.804196,
1400 7.069031, 4.461292, 2.028366, 1.293013, .577267, .40746, .334964, 0., 0., 0.};
1402 //Absorption index for quarz
1403 /*Float_t Qzt [21] = {.0,.0,.005,.04,.35,.647,.769,.808,.829,.844,.853,.858,.869,.887,.903,.902,.902,
1404 .906,.907,.907,.907};
1405 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,
1406 215.0,220.0,225.0,230.0,235.0,240.0,245.0,250.0};
1407 Float_t abscoQuarz[31];
1408 for (Int_t i=0;i<31;i++)
1410 Float_t Xlam = 1237.79 / (ppckov[i]*1e9);
1411 if (Xlam <= 160) abscoQuarz[i] = 0;
1412 if (Xlam > 250) abscoQuarz[i] = 1;
1415 for (Int_t j=0;j<21;j++)
1417 //printf ("Passed\n");
1418 if (Xlam > Wavl2[j] && Xlam < Wavl2[j+1])
1420 Float_t Dabs = (Qzt[j+1] - Qzt[j])/(Wavl2[j+1] - Wavl2[j]);
1421 Float_t Abso = Qzt[j] + Dabs*(Xlam - Wavl2[j]);
1422 abscoQuarz[i] = -5.0/(TMath::Log(Abso));
1426 printf ("abscoQuarz: %e abscoFreon: %e for energy: %e\n",abscoQuarz[i],abscoFreon[i],ppckov[i]);
1429 /*Float_t abscoQuarz[31] = {49.64211, 48.41296, 47.46989, 46.50492, 45.13682, 44.47883, 43.1929 , 41.30922, 40.5943 ,
1430 39.82956, 38.98623, 38.6247 , 38.43448, 37.41084, 36.22575, 33.74852, 30.73901, 24.25086,
1431 17.94531, 11.88753, 5.99128, 3.83503, 2.36661, 1.53155, 1.30582, 1.08574, .8779708,
1432 .675275, 0., 0., 0.};
1434 for (Int_t i=0;i<31;i++)
1436 abscoQuarz[i] = abscoQuarz[i]/10;
1439 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,
1440 19.266, 17.525, 15.878, 14.177, 11.719, 9.282, 6.62, 4.0925, 2.601, 1.149, .667, .3627,
1441 .192, .1497, .10857};
1443 //Absorption index for methane
1444 Float_t abscoMethane[26];
1447 abscoMethane[i]=AbsoCH4(ppckov[i]*1e9);
1448 //printf("abscoMethane: %e for energy: %e\n", abscoMethane[i],ppckov[i]*1e9);
1451 //Absorption index for opaque quarz, csi and grid, efficiency for all and grid
1452 Float_t abscoOpaqueQuarz[26];
1453 Float_t abscoCsI[26];
1454 Float_t abscoGrid[26];
1455 Float_t efficAll[26];
1456 Float_t efficGrid[26];
1459 abscoOpaqueQuarz[i]=1e-5;
1464 //printf ("All must be 1: %e, %e, %e, %e, %e\n",abscoOpaqueQuarz[i],abscoCsI[i],abscoGrid[i],efficAll[i],efficGrid[i]);
1467 //Efficiency for csi
1469 Float_t efficCsI[26] = {0.000199999995, 0.000600000028, 0.000699999975, 0.00499999989, 0.00749999983, 0.010125,
1470 0.0242999997, 0.0405000001, 0.0688500032, 0.105299994, 0.121500008, 0.141749993, 0.157949999,
1471 0.162, 0.166050002, 0.167669997, 0.174299985, 0.176789999, 0.179279998, 0.182599992, 0.18592,
1472 0.187579989, 0.189239994, 0.190899998, 0.207499996, 0.215799987};
1476 //FRESNEL LOSS CORRECTION FOR PERPENDICULAR INCIDENCE AND
1477 //UNPOLARIZED PHOTONS
1481 efficCsI[i] = efficCsI[i]/(1.-Fresnel(ppckov[i]*1e9,1.,0));
1482 //printf ("Fresnel result: %e for energy: %e\n",Fresnel(ppckov[i]*1e9,1.,0),ppckov[i]*1e9);
1485 /*******************************************End of rich_media.f***************************************/
1492 Float_t afre[2], agri, amet[2], aqua[2], ahon, zfre[2], zgri, zhon,
1496 Int_t nlmatmet, nlmatqua;
1497 Float_t wmatquao[2], rIndexFreon[26];
1498 Float_t aquao[2], epsil, stmin, zquao[2];
1500 Float_t radlal, densal, tmaxfd, deemax, stemax;
1501 Float_t aal, zal, radlgri, densfre, radlhon, densgri, denshon,densqua, densmet, wmatfre[2], wmatmet[2], wmatqua[2];
1503 Int_t *idtmed = fIdtmed->GetArray()-999;
1505 // --- Photon energy (GeV)
1506 // --- Refraction indexes
1507 for (i = 0; i < 26; ++i) {
1508 rIndexFreon[i] = ppckov[i] * .0172 * 1e9 + 1.177;
1509 //rIndexFreon[i] = 1;
1510 //printf ("rIndexFreon: %e \n efficCsI: %e for energy: %e\n",rIndexFreon[i], efficCsI[i], ppckov[i]);
1513 // --- Detection efficiencies (quantum efficiency for CsI)
1514 // --- Define parameters for honeycomb.
1515 // Used carbon of equivalent rad. lenght
1522 // --- Parameters to include in GSMIXT, relative to Quarz (SiO2)
1533 // --- Parameters to include in GSMIXT, relative to opaque Quarz (SiO2)
1544 // --- Parameters to include in GSMIXT, relative to Freon (C6F14)
1555 // --- Parameters to include in GSMIXT, relative to methane (CH4)
1566 // --- Parameters to include in GSMIXT, relative to anode grid (Cu)
1573 // --- Parameters to include in GSMATE related to aluminium sheet
1580 // --- Glass parameters
1582 Float_t aglass[5]={12.01, 28.09, 16., 10.8, 23.};
1583 Float_t zglass[5]={ 6., 14., 8., 5., 11.};
1584 Float_t wglass[5]={ 0.5, 0.105, 0.355, 0.03, 0.01};
1585 Float_t dglass=1.74;
1588 AliMaterial(1, "Air $", 14.61, 7.3, .001205, 30420., 67500);
1589 AliMaterial(6, "HON", ahon, zhon, denshon, radlhon, 0);
1590 AliMaterial(16, "CSI", ahon, zhon, denshon, radlhon, 0);
1591 AliMixture(20, "QUA", aqua, zqua, densqua, nlmatqua, wmatqua);
1592 AliMixture(21, "QUAO", aquao, zquao, densquao, nlmatquao, wmatquao);
1593 AliMixture(30, "FRE", afre, zfre, densfre, nlmatfre, wmatfre);
1594 AliMixture(40, "MET", amet, zmet, densmet, nlmatmet, wmatmet);
1595 AliMixture(41, "METG", amet, zmet, densmet, nlmatmet, wmatmet);
1596 AliMaterial(11, "GRI", agri, zgri, densgri, radlgri, 0);
1597 AliMaterial(50, "ALUM", aal, zal, densal, radlal, 0);
1598 AliMixture(32, "GLASS",aglass, zglass, dglass, 5, wglass);
1599 AliMaterial(31, "COPPER$", 63.54, 29., 8.96, 1.4, 0.);
1607 AliMedium(1, "DEFAULT MEDIUM AIR$", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1608 AliMedium(2, "HONEYCOMB$", 6, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1609 AliMedium(3, "QUARZO$", 20, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1610 AliMedium(4, "FREON$", 30, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1611 AliMedium(5, "METANO$", 40, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1612 AliMedium(6, "CSI$", 16, 1, isxfld, sxmgmx,tmaxfd, stemax, deemax, epsil, stmin);
1613 AliMedium(7, "GRIGLIA$", 11, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1614 AliMedium(8, "QUARZOO$", 21, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1615 AliMedium(9, "GAP$", 41, 1, isxfld, sxmgmx,tmaxfd, .1, -deemax, epsil, -stmin);
1616 AliMedium(10, "ALUMINUM$", 50, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1617 AliMedium(11, "GLASS", 32, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1618 AliMedium(12, "PCB_COPPER", 31, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1621 gMC->SetCerenkov(idtmed[1000], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
1622 gMC->SetCerenkov(idtmed[1001], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
1623 gMC->SetCerenkov(idtmed[1002], 26, ppckov, abscoQuarz, efficAll,rIndexQuarz);
1624 gMC->SetCerenkov(idtmed[1003], 26, ppckov, abscoFreon, efficAll,rIndexFreon);
1625 gMC->SetCerenkov(idtmed[1004], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
1626 gMC->SetCerenkov(idtmed[1005], 26, ppckov, abscoCsI, efficCsI, rIndexMethane);
1627 gMC->SetCerenkov(idtmed[1006], 26, ppckov, abscoGrid, efficGrid, rIndexGrid);
1628 gMC->SetCerenkov(idtmed[1007], 26, ppckov, abscoOpaqueQuarz, efficAll, rIndexOpaqueQuarz);
1629 gMC->SetCerenkov(idtmed[1008], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
1630 gMC->SetCerenkov(idtmed[1009], 26, ppckov, abscoGrid, efficGrid, rIndexGrid);
1631 gMC->SetCerenkov(idtmed[1010], 26, ppckov, abscoOpaqueQuarz, efficAll, rIndexOpaqueQuarz);
1634 //___________________________________________
1636 Float_t AliRICH::Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)
1639 //ENE(EV), PDOTI=COS(INC.ANG.), PDOTR=COS(POL.PLANE ROT.ANG.)
1641 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,
1642 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,
1643 7.8,7.9,8.0,8.1,8.2,8.3,8.4,8.5};
1646 Float_t csin[36] = {2.14,2.21,2.33,2.48,2.76,2.97,2.99,2.59,2.81,3.05,
1647 2.86,2.53,2.55,2.66,2.79,2.96,3.18,3.05,2.84,2.81,2.38,2.11,
1648 2.01,2.13,2.39,2.73,3.08,3.15,2.95,2.73,2.56,2.41,2.12,1.95,
1651 Float_t csik[36] = {0.,0.,0.,0.,0.,0.196,0.408,0.208,0.118,0.49,0.784,0.543,
1652 0.424,0.404,0.371,0.514,0.922,1.102,1.139,1.376,1.461,1.253,0.878,
1653 0.69,0.612,0.649,0.824,1.347,1.571,1.678,1.763,1.857,1.824,1.824,
1656 Int_t j=Int_t(xe*10)-49;
1657 Float_t cn=csin[j]+((csin[j+1]-csin[j])/0.1)*(xe-en[j]);
1658 Float_t ck=csik[j]+((csik[j+1]-csik[j])/0.1)*(xe-en[j]);
1660 //FORMULAE FROM HANDBOOK OF OPTICS, 33.23 OR
1661 //W.R. HUNTER, J.O.S.A. 54 (1964),15 , J.O.S.A. 55(1965),1197
1663 Float_t sinin=TMath::Sqrt(1-pdoti*pdoti);
1664 Float_t tanin=sinin/pdoti;
1666 Float_t c1=cn*cn-ck*ck-sinin*sinin;
1667 Float_t c2=4*cn*cn*ck*ck;
1668 Float_t aO=TMath::Sqrt(0.5*(TMath::Sqrt(c1*c1+c2)+c1));
1669 Float_t b2=0.5*(TMath::Sqrt(c1*c1+c2)-c1);
1671 Float_t rs=((aO-pdoti)*(aO-pdoti)+b2)/((aO+pdoti)*(aO+pdoti)+b2);
1672 Float_t rp=rs*((aO-sinin*tanin)*(aO-sinin*tanin)+b2)/((aO+sinin*tanin)*(aO+sinin*tanin)+b2);
1675 //CORRECTION FACTOR FOR SURFACE ROUGHNESS
1676 //B.J. STAGG APPLIED OPTICS, 30(1991),4113
1679 Float_t lamb=1240/ene;
1682 Float_t rO=TMath::Exp(-(4*TMath::Pi()*pdoti*sigraf/lamb)*(4*TMath::Pi()*pdoti*sigraf/lamb));
1686 Float_t pdotr=0.8; //DEGREE OF POLARIZATION : 1->P , -1->S
1687 fresn=0.5*(rp*(1+pdotr)+rs*(1-pdotr));
1696 //__________________________________________
1697 Float_t AliRICH::AbsoCH4(Float_t x)
1700 //KLOSCH,SCH4(9),WL(9),EM(9),ALENGTH(31)
1701 Float_t sch4[9] = {.12,.16,.23,.38,.86,2.8,7.9,28.,80.}; //MB X 10^22
1702 //Float_t wl[9] = {153.,152.,151.,150.,149.,148.,147.,146.,145};
1703 Float_t em[9] = {8.1,8.158,8.212,8.267,8.322,8.378,8.435,8.493,8.55};
1704 const Float_t kLosch=2.686763E19; // LOSCHMIDT NUMBER IN CM-3
1705 const Float_t kIgas1=100, kIgas2=0, kOxy=10., kWater=5., kPressure=750.,kTemperature=283.;
1706 Float_t pn=kPressure/760.;
1707 Float_t tn=kTemperature/273.16;
1710 // ------- METHANE CROSS SECTION -----------------
1711 // ASTROPH. J. 214, L47 (1978)
1717 if(x>=7.75 && x<=8.1)
1719 Float_t c0=-1.655279e-1;
1720 Float_t c1=6.307392e-2;
1721 Float_t c2=-8.011441e-3;
1722 Float_t c3=3.392126e-4;
1723 sm=(c0+c1*x+c2*x*x+c3*x*x*x)*1.e-18;
1729 while (x<=em[j] && x>=em[j+1])
1732 Float_t a=(sch4[j+1]-sch4[j])/(em[j+1]-em[j]);
1733 sm=(sch4[j]+a*(x-em[j]))*1e-22;
1737 Float_t dm=(kIgas1/100.)*(1.-((kOxy+kWater)/1.e6))*kLosch*pn/tn;
1738 Float_t abslm=1./sm/dm;
1740 // ------- ISOBUTHANE CROSS SECTION --------------
1741 // i-C4H10 (ai) abs. length from curves in
1742 // Lu-McDonald paper for BARI RICH workshop .
1743 // -----------------------------------------------------------
1752 if(x>=7.25 && x<7.375)
1758 Float_t si = 1./(ai*kLosch*273.16/293.); // ISOB. CRO.SEC.IN CM2
1759 Float_t di=(kIgas2/100.)*(1.-((kOxy+kWater)/1.e6))*kLosch*pn/tn;
1764 // ---------------------------------------------------------
1766 // transmission of O2
1768 // y= path in cm, x=energy in eV
1769 // so= cross section for UV absorption in cm2
1770 // do= O2 molecular density in cm-3
1771 // ---------------------------------------------------------
1779 so=3.392709e-13 * TMath::Exp(2.864104 *x);
1785 so=2.910039e-34 * TMath::Exp(10.3337*x);
1792 Float_t a0=-73770.76;
1793 Float_t a1=46190.69;
1794 Float_t a2=-11475.44;
1795 Float_t a3=1412.611;
1796 Float_t a4=-86.07027;
1797 Float_t a5=2.074234;
1798 so= a0+(a1*x)+(a2*x*x)+(a3*x*x*x)+(a4*x*x*x*x)+(a5*x*x*x*x*x);
1802 Float_t dox=(kOxy/1e6)*kLosch*pn/tn;
1807 // ---------------------------------------------------------
1809 // transmission of H2O
1811 // y= path in cm, x=energy in eV
1812 // sw= cross section for UV absorption in cm2
1813 // dw= H2O molecular density in cm-3
1814 // ---------------------------------------------------------
1818 Float_t b0=29231.65;
1819 Float_t b1=-15807.74;
1820 Float_t b2=3192.926;
1821 Float_t b3=-285.4809;
1822 Float_t b4=9.533944;
1826 Float_t sw= b0+(b1*x)+(b2*x*x)+(b3*x*x*x)+(b4*x*x*x*x);
1828 Float_t dw=(kWater/1e6)*kLosch*pn/tn;
1834 // ---------------------------------------------------------
1836 Float_t alength=1./(1./abslm+1./absli+1./abslo+1./abslw);
1842 //___________________________________________
1843 Int_t AliRICH::DistancetoPrimitive(Int_t , Int_t )
1851 //___________________________________________
1852 void AliRICH::MakeBranch(Option_t* option, const char *file)
1854 // Create Tree branches for the RICH.
1856 const Int_t kBufferSize = 4000;
1857 char branchname[20];
1859 AliDetector::MakeBranch(option,file);
1861 const char *cH = strstr(option,"H");
1862 const char *cD = strstr(option,"D");
1863 const char *cR = strstr(option,"R");
1864 const char *cS = strstr(option,"S");
1868 sprintf(branchname,"%sCerenkov",GetName());
1869 if (fCerenkovs && gAlice->TreeH()) {
1870 //TBranch* branch = MakeBranchInTree(gAlice->TreeH(),branchname, &fCerenkovs, kBufferSize, file) ;
1871 MakeBranchInTree(gAlice->TreeH(),branchname, &fCerenkovs, kBufferSize, file) ;
1872 //branch->SetAutoDelete(kFALSE);
1874 sprintf(branchname,"%sSDigits",GetName());
1875 if (fSDigits && gAlice->TreeH()) {
1876 //TBranch* branch = MakeBranchInTree(gAlice->TreeH(),branchname, &fSDigits, kBufferSize, file) ;
1877 MakeBranchInTree(gAlice->TreeH(),branchname, &fSDigits, kBufferSize, file) ;
1878 //branch->SetAutoDelete(kFALSE);
1879 //printf("Making branch %sSDigits in TreeH\n",GetName());
1884 sprintf(branchname,"%sSDigits",GetName());
1885 if (fSDigits && gAlice->TreeS()) {
1886 //TBranch* branch = MakeBranchInTree(gAlice->TreeS(),branchname, &fSDigits, kBufferSize, file) ;
1887 MakeBranchInTree(gAlice->TreeS(),branchname, &fSDigits, kBufferSize, file) ;
1888 //branch->SetAutoDelete(kFALSE);
1889 //printf("Making branch %sSDigits in TreeS\n",GetName());
1895 // one branch for digits per chamber
1899 for (i=0; i<kNCH ;i++) {
1900 sprintf(branchname,"%sDigits%d",GetName(),i+1);
1901 if (fDchambers && gAlice->TreeD()) {
1902 //TBranch* branch = MakeBranchInTree(gAlice->TreeD(),branchname, &((*fDchambers)[i]), kBufferSize, file) ;
1903 MakeBranchInTree(gAlice->TreeD(),branchname, &((*fDchambers)[i]), kBufferSize, file) ;
1904 //branch->SetAutoDelete(kFALSE);
1905 //printf("Making Branch %sDigits%d\n",GetName(),i+1);
1912 // one branch for raw clusters per chamber
1915 //printf("Called MakeBranch for TreeR\n");
1919 for (i=0; i<kNCH ;i++) {
1920 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
1921 if (fRawClusters && gAlice->TreeR()) {
1922 //TBranch* branch = MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRawClusters)[i]), kBufferSize, file) ;
1923 MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRawClusters)[i]), kBufferSize, file) ;
1924 //branch->SetAutoDelete(kFALSE);
1928 // one branch for rec hits per chamber
1930 for (i=0; i<kNCH ;i++) {
1931 sprintf(branchname,"%sRecHits1D%d",GetName(),i+1);
1932 if (fRecHits1D && gAlice->TreeR()) {
1933 //TBranch* branch = MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRecHits1D)[i]), kBufferSize, file) ;
1934 MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRecHits1D)[i]), kBufferSize, file) ;
1935 //branch->SetAutoDelete(kFALSE);
1938 for (i=0; i<kNCH ;i++) {
1939 sprintf(branchname,"%sRecHits3D%d",GetName(),i+1);
1940 if (fRecHits3D && gAlice->TreeR()) {
1941 MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRecHits3D)[i]), kBufferSize, file) ;
1942 //branch->SetAutoDelete(kFALSE);
1948 //___________________________________________
1949 void AliRICH::SetTreeAddress()
1951 // Set branch address for the Hits and Digits Tree.
1952 char branchname[20];
1955 AliDetector::SetTreeAddress();
1958 TTree *treeH = gAlice->TreeH();
1959 TTree *treeD = gAlice->TreeD();
1960 TTree *treeR = gAlice->TreeR();
1961 TTree *treeS = gAlice->TreeS();
1965 branch = treeH->GetBranch("RICHCerenkov");
1966 if (branch) branch->SetAddress(&fCerenkovs);
1969 branch = treeH->GetBranch("RICHSDigits");
1972 branch->SetAddress(&fSDigits);
1973 //printf("Setting sdigits branch address at %p in TreeH\n",&fSDigits);
1980 branch = treeS->GetBranch("RICHSDigits");
1983 branch->SetAddress(&fSDigits);
1984 //printf("Setting sdigits branch address at %p in TreeS\n",&fSDigits);
1991 for (int i=0; i<kNCH; i++) {
1992 sprintf(branchname,"%sDigits%d",GetName(),i+1);
1994 branch = treeD->GetBranch(branchname);
1995 if (branch) branch->SetAddress(&((*fDchambers)[i]));
2000 for (i=0; i<kNCH; i++) {
2001 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
2003 branch = treeR->GetBranch(branchname);
2004 if (branch) branch->SetAddress(&((*fRawClusters)[i]));
2008 for (i=0; i<kNCH; i++) {
2009 sprintf(branchname,"%sRecHits1D%d",GetName(),i+1);
2011 branch = treeR->GetBranch(branchname);
2012 if (branch) branch->SetAddress(&((*fRecHits1D)[i]));
2016 for (i=0; i<kNCH; i++) {
2017 sprintf(branchname,"%sRecHits3D%d",GetName(),i+1);
2019 branch = treeR->GetBranch(branchname);
2020 if (branch) branch->SetAddress(&((*fRecHits3D)[i]));
2026 //___________________________________________
2027 void AliRICH::ResetHits()
2029 // Reset number of clusters and the cluster array for this detector
2030 AliDetector::ResetHits();
2033 if (fSDigits) fSDigits->Clear();
2034 if (fCerenkovs) fCerenkovs->Clear();
2038 //____________________________________________
2039 void AliRICH::ResetDigits()
2042 // Reset number of digits and the digits array for this detector
2044 for ( int i=0;i<kNCH;i++ ) {
2045 //PH if (fDchambers && (*fDchambers)[i]) (*fDchambers)[i]->Clear();
2046 if (fDchambers && fDchambers->At(i)) fDchambers->At(i)->Clear();
2047 if (fNdch) fNdch[i]=0;
2051 //____________________________________________
2052 void AliRICH::ResetRawClusters()
2055 // Reset number of raw clusters and the raw clust array for this detector
2057 for ( int i=0;i<kNCH;i++ ) {
2058 //PH if ((*fRawClusters)[i]) ((TClonesArray*)(*fRawClusters)[i])->Clear();
2059 if (fRawClusters->At(i)) ((TClonesArray*)fRawClusters->At(i))->Clear();
2060 if (fNrawch) fNrawch[i]=0;
2064 //____________________________________________
2065 void AliRICH::ResetRecHits1D()
2068 // Reset number of raw clusters and the raw clust array for this detector
2071 for ( int i=0;i<kNCH;i++ ) {
2072 //PH if ((*fRecHits1D)[i]) ((TClonesArray*)(*fRecHits1D)[i])->Clear();
2073 if (fRecHits1D->At(i)) ((TClonesArray*)fRecHits1D->At(i))->Clear();
2074 if (fNrechits1D) fNrechits1D[i]=0;
2078 //____________________________________________
2079 void AliRICH::ResetRecHits3D()
2082 // Reset number of raw clusters and the raw clust array for this detector
2085 for ( int i=0;i<kNCH;i++ ) {
2086 //PH if ((*fRecHits3D)[i]) ((TClonesArray*)(*fRecHits3D)[i])->Clear();
2087 if (fRecHits3D->At(i)) ((TClonesArray*)fRecHits3D->At(i))->Clear();
2088 if (fNrechits3D) fNrechits3D[i]=0;
2093 //___________________________________________
2094 void AliRICH::StepManager()
2096 // Full Step Manager
2100 static Int_t vol[2];
2102 static Float_t hits[22];
2103 static Float_t ckovData[19];
2104 TLorentzVector position;
2105 TLorentzVector momentum;
2108 Float_t localPos[3];
2109 Float_t localMom[4];
2110 Float_t localTheta,localPhi;
2112 Float_t destep, step;
2115 Float_t coscerenkov;
2116 static Float_t eloss, xhit, yhit, tlength;
2117 const Float_t kBig=1.e10;
2119 TClonesArray &lhits = *fHits;
2120 TParticle *current = (TParticle*)(*gAlice->Particles())[gAlice->CurrentTrack()];
2122 //if (current->Energy()>1)
2125 // Only gas gap inside chamber
2126 // Tag chambers and record hits when track enters
2129 id=gMC->CurrentVolID(copy);
2131 Float_t cherenkovLoss=0;
2132 //gAlice->KeepTrack(gAlice->CurrentTrack());
2134 gMC->TrackPosition(position);
2138 //bzero((char *)ckovData,sizeof(ckovData)*19);
2139 ckovData[1] = pos[0]; // X-position for hit
2140 ckovData[2] = pos[1]; // Y-position for hit
2141 ckovData[3] = pos[2]; // Z-position for hit
2142 ckovData[6] = 0; // dummy track length
2143 //ckovData[11] = gAlice->CurrentTrack();
2145 //printf("\n+++++++++++\nTrack: %d\n++++++++++++\n",gAlice->CurrentTrack());
2147 //AliRICH *RICH = (AliRICH *) gAlice->GetDetector("RICH");
2149 /********************Store production parameters for Cerenkov photons************************/
2150 //is it a Cerenkov photon?
2151 if (gMC->TrackPid() == 50000050) {
2153 //if (gMC->VolId("GAP ")==gMC->CurrentVolID(copy))
2155 Float_t ckovEnergy = current->Energy();
2156 //energy interval for tracking
2157 if (ckovEnergy > 5.6e-09 && ckovEnergy < 7.8e-09 )
2158 //if (ckovEnergy > 0)
2160 if (gMC->IsTrackEntering()){ //is track entering?
2161 //printf("Track entered (1)\n");
2162 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
2164 if (gMC->IsNewTrack()){ //is it the first step?
2165 //printf("I'm in!\n");
2166 Int_t mother = current->GetFirstMother();
2168 //printf("Second Mother:%d\n",current->GetSecondMother());
2170 ckovData[10] = mother;
2171 ckovData[11] = gAlice->CurrentTrack();
2172 ckovData[12] = 1; //Media where photon was produced 1->Freon, 2->Quarz
2173 //printf("Produced in FREO\n");
2176 //printf("Index: %d\n",fCkovNumber);
2177 } //first step question
2180 if (gMC->IsNewTrack()){ //is it first step?
2181 if (gMC->VolId("QUAR")==gMC->CurrentVolID(copy)) //is it in quarz?
2184 //printf("Produced in QUAR\n");
2186 } //first step question
2188 //printf("Before %d\n",fFreonProd);
2189 } //track entering question
2191 if (ckovData[12] == 1) //was it produced in Freon?
2192 //if (fFreonProd == 1)
2194 if (gMC->IsTrackEntering()){ //is track entering?
2195 //printf("Track entered (2)\n");
2196 //printf("Current volume (should be META): %s\n",gMC->CurrentVolName());
2197 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("META"),gMC->CurrentVolID(copy));
2198 if (gMC->VolId("META")==gMC->CurrentVolID(copy)) //is it in gap?
2200 //printf("Got in META\n");
2201 gMC->TrackMomentum(momentum);
2207 gMC->Gmtod(mom,localMom,2);
2208 Float_t cophi = TMath::Cos(TMath::ATan2(localMom[0], localMom[1]));
2209 Float_t t = (1. - .025 / cophi) * (1. - .05 / cophi);
2210 /**************** Photons lost in second grid have to be calculated by hand************/
2211 gMC->GetRandom()->RndmArray(1,ranf);
2215 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
2216 //printf("Added One (1)!\n");
2217 //printf("Lost one in grid\n");
2219 /**********************************************************************************/
2222 //printf("Current volume (should be CSI) (1): %s\n",gMC->CurrentVolName());
2223 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("CSI "),gMC->CurrentVolID(copy));
2224 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy)) //is it in csi?
2226 //printf("Got in CSI\n");
2227 gMC->TrackMomentum(momentum);
2233 gMC->Gmtod(mom,localMom,2);
2234 /********* Photons lost by Fresnel reflection have to be calculated by hand********/
2235 /***********************Cerenkov phtons (always polarised)*************************/
2236 Double_t localTc = localMom[0]*localMom[0]+localMom[2]*localMom[2];
2237 Double_t localRt = TMath::Sqrt(localTc);
2238 localTheta = Float_t(TMath::ATan2(localRt,Double_t(localMom[1])));
2239 Double_t cotheta = TMath::Abs(cos(localTheta));
2240 Float_t t = Fresnel(ckovEnergy*1e9,cotheta,1);
2241 gMC->GetRandom()->RndmArray(1,ranf);
2245 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
2247 //printf("Added One (2)!\n");
2248 //printf("Lost by Fresnel\n");
2250 /**********************************************************************************/
2255 /********************Evaluation of losses************************/
2256 /******************still in the old fashion**********************/
2259 Int_t i1 = gMC->StepProcesses(procs); //number of physics mechanisms acting on the particle
2260 for (Int_t i = 0; i < i1; ++i) {
2262 if (procs[i] == kPLightReflection) { //was it reflected
2264 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
2266 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
2269 //AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
2270 } //reflection question
2273 else if (procs[i] == kPLightAbsorption) { //was it absorbed?
2274 //printf("Got in absorption\n");
2276 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
2278 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
2280 if (gMC->CurrentVolID(copy) == gMC->VolId("META"))
2282 if (gMC->CurrentVolID(copy) == gMC->VolId("GAP "))
2285 if (gMC->CurrentVolID(copy) == gMC->VolId("SRIC"))
2289 if (gMC->CurrentVolID(copy) == gMC->VolId("CSI ")) {
2293 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
2294 //printf("Added One (3)!\n");
2295 //printf("Added cerenkov %d\n",fCkovNumber);
2296 } //absorption question
2299 // Photon goes out of tracking scope
2300 else if (procs[i] == kPStop) { //is it below energy treshold?
2303 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
2304 //printf("Added One (4)!\n");
2305 } // energy treshold question
2306 } //number of mechanisms cycle
2307 /**********************End of evaluation************************/
2308 } //freon production question
2309 } //energy interval question
2310 //}//inside the proximity gap question
2311 } //cerenkov photon question
2313 /**************************************End of Production Parameters Storing*********************/
2316 /*******************************Treat photons that hit the CsI (Ckovs and Feedbacks)************/
2318 if (gMC->TrackPid() == 50000050 || gMC->TrackPid() == 50000051) {
2319 //printf("Cerenkov\n");
2321 //if (gMC->TrackPid() == 50000051)
2322 //printf("Tracking a feedback\n");
2324 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy))
2326 //printf("Current volume (should be CSI) (2): %s\n",gMC->CurrentVolName());
2327 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("CSI "),gMC->CurrentVolID(copy));
2328 //printf("Got in CSI\n");
2329 //printf("Tracking a %d\n",gMC->TrackPid());
2330 if (gMC->Edep() > 0.){
2331 gMC->TrackPosition(position);
2332 gMC->TrackMomentum(momentum);
2340 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
2341 Double_t rt = TMath::Sqrt(tc);
2342 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
2343 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
2345 gMC->CurrentVolOffID(2,copy);
2350 gMC->Gmtod(pos,localPos,1);
2352 //Chamber(idvol).GlobaltoLocal(pos,localPos);
2354 gMC->Gmtod(mom,localMom,2);
2356 //Chamber(idvol).GlobaltoLocal(mom,localMom);
2358 gMC->CurrentVolOffID(2,copy);
2362 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
2363 //->Sector(localPos[0], localPos[2]);
2364 //printf("Sector:%d\n",sector);
2366 /*if (gMC->TrackPid() == 50000051){
2368 printf("Feedbacks:%d\n",fFeedbacks);
2371 //PH ((AliRICHChamber*) (*fChambers)[idvol])
2372 ((AliRICHChamber*)fChambers->At(idvol))
2373 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
2375 ckovData[0] = gMC->TrackPid(); // particle type
2376 ckovData[1] = pos[0]; // X-position for hit
2377 ckovData[2] = pos[1]; // Y-position for hit
2378 ckovData[3] = pos[2]; // Z-position for hit
2379 ckovData[4] = theta; // theta angle of incidence
2380 ckovData[5] = phi; // phi angle of incidence
2381 ckovData[8] = (Float_t) fNSDigits; // first sdigit
2382 ckovData[9] = -1; // last pad hit
2383 ckovData[13] = 4; // photon was detected
2384 ckovData[14] = mom[0];
2385 ckovData[15] = mom[1];
2386 ckovData[16] = mom[2];
2388 destep = gMC->Edep();
2389 gMC->SetMaxStep(kBig);
2390 cherenkovLoss += destep;
2391 ckovData[7]=cherenkovLoss;
2393 nPads = Hits2SDigits(localPos[0],localPos[2],cherenkovLoss,idvol,kCerenkov);
2395 if (fNSDigits > (Int_t)ckovData[8]) {
2396 ckovData[8]= ckovData[8]+1;
2397 ckovData[9]= (Float_t) fNSDigits;
2400 //printf("Cerenkov loss: %f\n", cherenkovLoss);
2402 ckovData[17] = nPads;
2403 //printf("nPads:%d",nPads);
2405 //TClonesArray *Hits = RICH->Hits();
2406 AliRICHHit *mipHit = (AliRICHHit*) (fHits->UncheckedAt(0));
2409 mom[0] = current->Px();
2410 mom[1] = current->Py();
2411 mom[2] = current->Pz();
2412 Float_t mipPx = mipHit->MomX();
2413 Float_t mipPy = mipHit->MomY();
2414 Float_t mipPz = mipHit->MomZ();
2416 Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
2417 Float_t rt = TMath::Sqrt(r);
2418 Float_t mipR = mipPx*mipPx + mipPy*mipPy + mipPz*mipPz;
2419 Float_t mipRt = TMath::Sqrt(mipR);
2422 coscerenkov = (mom[0]*mipPx + mom[1]*mipPy + mom[2]*mipPz)/(rt*mipRt);
2428 Float_t cherenkov = TMath::ACos(coscerenkov);
2429 ckovData[18]=cherenkov;
2433 AddHit(gAlice->CurrentTrack(),vol,ckovData);
2434 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
2435 //printf("Added One (5)!\n");
2442 /***********************************************End of photon hits*********************************************/
2445 /**********************************************Charged particles treatment*************************************/
2447 else if (gMC->TrackCharge())
2451 /*if (gMC->IsTrackEntering())
2453 hits[13]=20;//is track entering?
2455 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
2457 gMC->TrackMomentum(momentum);
2468 if (gMC->VolId("GAP ")== gMC->CurrentVolID(copy)) {
2469 // Get current particle id (ipart), track position (pos) and momentum (mom)
2471 gMC->CurrentVolOffID(3,copy);
2475 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
2476 //->Sector(localPos[0], localPos[2]);
2477 //printf("Sector:%d\n",sector);
2479 gMC->TrackPosition(position);
2480 gMC->TrackMomentum(momentum);
2489 gMC->Gmtod(pos,localPos,1);
2491 //Chamber(idvol).GlobaltoLocal(pos,localPos);
2493 gMC->Gmtod(mom,localMom,2);
2495 //Chamber(idvol).GlobaltoLocal(mom,localMom);
2497 ipart = gMC->TrackPid();
2499 // momentum loss and steplength in last step
2500 destep = gMC->Edep();
2501 step = gMC->TrackStep();
2504 // record hits when track enters ...
2505 if( gMC->IsTrackEntering()) {
2506 // gMC->SetMaxStep(fMaxStepGas);
2507 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
2508 Double_t rt = TMath::Sqrt(tc);
2509 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
2510 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
2513 Double_t localTc = localMom[0]*localMom[0]+localMom[2]*localMom[2];
2514 Double_t localRt = TMath::Sqrt(localTc);
2515 localTheta = Float_t(TMath::ATan2(localRt,Double_t(localMom[1])))*kRaddeg;
2516 localPhi = Float_t(TMath::ATan2(Double_t(localMom[2]),Double_t(localMom[0])))*kRaddeg;
2518 hits[0] = Float_t(ipart); // particle type
2519 hits[1] = localPos[0]; // X-position for hit
2520 hits[2] = localPos[1]; // Y-position for hit
2521 hits[3] = localPos[2]; // Z-position for hit
2522 hits[4] = localTheta; // theta angle of incidence
2523 hits[5] = localPhi; // phi angle of incidence
2524 hits[8] = (Float_t) fNSDigits; // first sdigit
2525 hits[9] = -1; // last pad hit
2526 hits[13] = fFreonProd; // did id hit the freon?
2530 hits[18] = 0; // dummy cerenkov angle
2536 Chamber(idvol).LocaltoGlobal(localPos,hits+1);
2539 //To make chamber coordinates x-y had to pass localPos[0], localPos[2]
2542 // Only if not trigger chamber
2545 // Initialize hit position (cursor) in the segmentation model
2546 //PH ((AliRICHChamber*) (*fChambers)[idvol])
2547 ((AliRICHChamber*)fChambers->At(idvol))
2548 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
2553 // Calculate the charge induced on a pad (disintegration) in case
2555 // Mip left chamber ...
2556 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
2557 gMC->SetMaxStep(kBig);
2562 // Only if not trigger chamber
2566 if(gMC->TrackPid() == kNeutron)
2567 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
2568 nPads = Hits2SDigits(xhit,yhit,eloss,idvol,kMip);
2570 //printf("nPads:%d",nPads);
2576 if (fNSDigits > (Int_t)hits[8]) {
2578 hits[9]= (Float_t) fNSDigits;
2582 new(lhits[fNhits++]) AliRICHHit(fIshunt,gAlice->CurrentTrack(),vol,hits);
2585 // Check additional signal generation conditions
2586 // defined by the segmentation
2587 // model (boundary crossing conditions)
2589 //PH (((AliRICHChamber*) (*fChambers)[idvol])
2590 (((AliRICHChamber*)fChambers->At(idvol))
2591 ->SigGenCond(localPos[0], localPos[2], localPos[1]))
2593 //PH ((AliRICHChamber*) (*fChambers)[idvol])
2594 ((AliRICHChamber*)fChambers->At(idvol))
2595 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
2598 if(gMC->TrackPid() == kNeutron)
2599 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
2600 nPads = Hits2SDigits(xhit,yhit,eloss,idvol,kMip);
2602 //printf("Npads:%d",NPads);
2609 // nothing special happened, add up energy loss
2616 /*************************************************End of MIP treatment**************************************/
2618 }//void AliRICH::StepManager()
2620 void AliRICH::FindClusters(Int_t nev,Int_t lastEntry)
2624 // Loop on chambers and on cathode planes
2626 for (Int_t icat=1;icat<2;icat++) {
2627 gAlice->ResetDigits();
2628 gAlice->TreeD()->GetEvent(0);
2629 for (Int_t ich=0;ich<kNCH;ich++) {
2630 //PH AliRICHChamber* iChamber=(AliRICHChamber*) (*fChambers)[ich];
2631 AliRICHChamber* iChamber=(AliRICHChamber*)fChambers->At(ich);
2632 TClonesArray *pRICHdigits = this->DigitsAddress(ich);
2633 if (pRICHdigits == 0)
2636 // Get ready the current chamber stuff
2638 AliRICHResponse* response = iChamber->GetResponseModel();
2639 AliSegmentation* seg = iChamber->GetSegmentationModel();
2640 AliRICHClusterFinder* rec = iChamber->GetReconstructionModel();
2642 rec->SetSegmentation(seg);
2643 rec->SetResponse(response);
2644 rec->SetDigits(pRICHdigits);
2645 rec->SetChamber(ich);
2646 if (nev==0) rec->CalibrateCOG();
2647 rec->FindRawClusters();
2650 fRch=RawClustAddress(ich);
2654 gAlice->TreeR()->Fill();
2656 for (int i=0;i<kNCH;i++) {
2657 fRch=RawClustAddress(i);
2658 int nraw=fRch->GetEntriesFast();
2659 printf ("Chamber %d, raw clusters %d\n",i,nraw);
2667 sprintf(hname,"TreeR%d",nev);
2668 gAlice->TreeR()->Write(hname,kOverwrite,0);
2669 gAlice->TreeR()->Reset();
2671 //gObjectTable->Print();
2674 AliRICHSDigit* AliRICH::FirstPad(AliRICHHit* hit,TClonesArray *clusters )
2677 // Initialise the pad iterator
2678 // Return the address of the first sdigit for hit
2679 TClonesArray *theClusters = clusters;
2680 Int_t nclust = theClusters->GetEntriesFast();
2681 if (nclust && hit->PHlast() > 0) {
2682 sMaxIterPad=Int_t(hit->PHlast());
2683 sCurIterPad=Int_t(hit->PHfirst());
2684 return (AliRICHSDigit*) clusters->UncheckedAt(sCurIterPad-1);
2691 AliRICHSDigit* AliRICH::NextPad(TClonesArray *clusters)
2694 // Iterates over pads
2697 if (sCurIterPad <= sMaxIterPad) {
2698 return (AliRICHSDigit*) clusters->UncheckedAt(sCurIterPad-1);
2704 AliRICH& AliRICH::operator=(const AliRICH& rhs)
2706 // Assignment operator
2711 void AliRICH::DiagnosticsFE(Int_t evNumber1,Int_t evNumber2)
2714 Int_t NpadX = 162; // number of pads on X
2715 Int_t NpadY = 162; // number of pads on Y
2717 Int_t Pad[162][162];
2718 for (Int_t i=0;i<NpadX;i++) {
2719 for (Int_t j=0;j<NpadY;j++) {
2724 // Create some histograms
2726 TH1F *pionspectra1 = new TH1F("pionspectra1","Pion Spectra",200,-4,2);
2727 TH1F *pionspectra2 = new TH1F("pionspectra2","Pion Spectra",200,-4,2);
2728 TH1F *pionspectra3 = new TH1F("pionspectra3","Pion Spectra",200,-4,2);
2729 TH1F *protonspectra1 = new TH1F("protonspectra1","Proton Spectra",200,-4,2);
2730 TH1F *protonspectra2 = new TH1F("protonspectra2","Proton Spectra",200,-4,2);
2731 TH1F *protonspectra3 = new TH1F("protonspectra3","Proton Spectra",200,-4,2);
2732 TH1F *kaonspectra1 = new TH1F("kaonspectra1","Kaon Spectra",100,-4,2);
2733 TH1F *kaonspectra2 = new TH1F("kaonspectra2","Kaon Spectra",100,-4,2);
2734 TH1F *kaonspectra3 = new TH1F("kaonspectra3","Kaon Spectra",100,-4,2);
2735 TH1F *electronspectra1 = new TH1F("electronspectra1","Electron Spectra",100,-4,2);
2736 TH1F *electronspectra2 = new TH1F("electronspectra2","Electron Spectra",100,-4,2);
2737 TH1F *electronspectra3 = new TH1F("electronspectra3","Electron Spectra",100,-4,2);
2738 TH1F *muonspectra1 = new TH1F("muonspectra1","Muon Spectra",100,-4,2);
2739 TH1F *muonspectra2 = new TH1F("muonspectra2","Muon Spectra",100,-4,2);
2740 TH1F *muonspectra3 = new TH1F("muonspectra3","Muon Spectra",100,-4,2);
2741 TH1F *neutronspectra1 = new TH1F("neutronspectra1","Neutron Spectra",100,-4,2);
2742 TH1F *neutronspectra2 = new TH1F("neutronspectra2","Neutron Spectra",100,-4,2);
2743 TH1F *neutronspectra3 = new TH1F("neutronspectra2","Neutron Spectra",100,-4,2);
2744 TH1F *chargedspectra1 = new TH1F("chargedspectra1","Charged particles above 1 GeV Spectra",100,-1,3);
2745 TH1F *chargedspectra2 = new TH1F("chargedspectra2","Charged particles above 1 GeV Spectra",100,-1,3);
2746 TH1F *chargedspectra3 = new TH1F("chargedspectra2","Charged particles above 1 GeV Spectra",100,-1,3);
2747 TH1F *pionptspectrafinal = new TH1F("pionptspectrafinal","Primary Pions Transverse Momenta at HMPID",20,0,5);
2748 TH1F *pionptspectravertex = new TH1F("pionptspectravertex","Primary Pions Transverse Momenta at vertex",20,0,5);
2749 TH1F *kaonptspectrafinal = new TH1F("kaonptspectrafinal","Primary Kaons Transverse Momenta at HMPID",20,0,5);
2750 TH1F *kaonptspectravertex = new TH1F("kaonptspectravertex","Primary Kaons Transverse Momenta at vertex",20,0,5);
2751 //TH1F *hitsPhi = new TH1F("hitsPhi","Distribution of phi angle of incidence",100,-180,180);
2752 TH1F *hitsTheta = new TH1F("hitsTheta","Distribution of Theta angle of incidence, all tracks",100,0,50);
2753 TH1F *hitsTheta500MeV = new TH1F("hitsTheta500MeV","Distribution of Theta angle of incidence, 0.5-1 GeV primary tracks",100,0,50);
2754 TH1F *hitsTheta1GeV = new TH1F("hitsTheta1GeV","Distribution of Theta angle of incidence, 1-2 GeV primary tracks",100,0,50);
2755 TH1F *hitsTheta2GeV = new TH1F("hitsTheta2GeV","Distribution of Theta angle of incidence, 2-3 GeV primary tracks",100,0,50);
2756 TH1F *hitsTheta3GeV = new TH1F("hitsTheta3GeV","Distribution of Theta angle of incidence, >3 GeV primary tracks",100,0,50);
2757 TH2F *production = new TH2F("production","Mother production vertices",100,-300,300,100,0,600);
2762 // Start loop over events
2764 Int_t pion=0, kaon=0, proton=0, electron=0, positron=0, neutron=0, highneutrons=0, muon=0;
2765 Int_t chargedpions=0,primarypions=0,highprimarypions=0,chargedkaons=0,primarykaons=0,highprimarykaons=0;
2766 Int_t photons=0, primaryphotons=0, highprimaryphotons=0;
2769 for (int nev=0; nev<= evNumber2; nev++) {
2770 Int_t nparticles = gAlice->GetEvent(nev);
2773 printf ("Event number : %d\n",nev);
2774 printf ("Number of particles: %d\n",nparticles);
2775 if (nev < evNumber1) continue;
2776 if (nparticles <= 0) return;
2778 // Get pointers to RICH detector and Hits containers
2780 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
2782 TTree *treeH = gAlice->TreeH();
2783 Int_t ntracks =(Int_t) treeH->GetEntries();
2785 // Start loop on tracks in the hits containers
2787 for (Int_t track=0; track<ntracks;track++) {
2788 printf ("Processing Track: %d\n",track);
2789 gAlice->ResetHits();
2790 treeH->GetEvent(track);
2792 for(AliRICHHit* mHit=(AliRICHHit*)pRICH->FirstHit(-1);
2794 mHit=(AliRICHHit*)pRICH->NextHit())
2796 //Int_t nch = mHit->fChamber; // chamber number
2797 //Float_t x = mHit->X(); // x-pos of hit
2798 //Float_t y = mHit->Z(); // y-pos
2799 //Float_t z = mHit->Y();
2800 //Float_t phi = mHit->Phi(); //Phi angle of incidence
2801 Float_t theta = mHit->Theta(); //Theta angle of incidence
2802 Float_t px = mHit->MomX();
2803 Float_t py = mHit->MomY();
2804 Int_t index = mHit->Track();
2805 Int_t particle = (Int_t)(mHit->Particle());
2810 TParticle *current = gAlice->Particle(index);
2812 //Float_t energy=current->Energy();
2814 R=TMath::Sqrt(current->Vx()*current->Vx() + current->Vy()*current->Vy());
2815 PTfinal=TMath::Sqrt(px*px + py*py);
2816 PTvertex=TMath::Sqrt(current->Px()*current->Px() + current->Py()*current->Py());
2820 if (TMath::Abs(particle) < 10000000)
2822 hitsTheta->Fill(theta,(float) 1);
2825 if (PTvertex>.5 && PTvertex<=1)
2827 hitsTheta500MeV->Fill(theta,(float) 1);
2829 if (PTvertex>1 && PTvertex<=2)
2831 hitsTheta1GeV->Fill(theta,(float) 1);
2833 if (PTvertex>2 && PTvertex<=3)
2835 hitsTheta2GeV->Fill(theta,(float) 1);
2839 hitsTheta3GeV->Fill(theta,(float) 1);
2848 //printf("Particle type: %d\n",current->GetPdgCode());
2849 if (TMath::Abs(particle) < 50000051)
2851 //if (TMath::Abs(particle) == 50000050 || TMath::Abs(particle) == 2112)
2852 if (TMath::Abs(particle) == 2112 || TMath::Abs(particle) == 50000050)
2854 //gMC->Rndm(&random, 1);
2855 if (random->Rndm() < .1)
2856 production->Fill(current->Vz(),R,(float) 1);
2857 if (TMath::Abs(particle) == 50000050)
2858 //if (TMath::Abs(particle) > 50000000)
2864 if (current->Energy()>0.001)
2865 highprimaryphotons +=1;
2868 if (TMath::Abs(particle) == 2112)
2871 if (current->Energy()>0.0001)
2875 if (TMath::Abs(particle) < 50000000)
2877 production->Fill(current->Vz(),R,(float) 1);
2878 //printf("Adding %d at %f\n",particle,R);
2880 //mip->Fill(x,y,(float) 1);
2883 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
2887 pionptspectravertex->Fill(PTvertex,(float) 1);
2888 pionptspectrafinal->Fill(PTfinal,(float) 1);
2892 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
2893 || TMath::Abs(particle)==311)
2897 kaonptspectravertex->Fill(PTvertex,(float) 1);
2898 kaonptspectrafinal->Fill(PTfinal,(float) 1);
2903 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
2905 pionspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2906 //printf ("fParticle: %d, PDG code:%d\n",particle,current->GetPdgCode());
2907 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2908 pionspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2911 pionspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2912 //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);
2914 //printf("Pion mass: %e\n",current->GetCalcMass());
2916 if (TMath::Abs(particle)==211)
2922 if (current->Energy()>1)
2923 highprimarypions +=1;
2927 if (TMath::Abs(particle)==2212)
2929 protonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2930 //ptspectra->Fill(Pt,(float) 1);
2931 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2932 protonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2934 protonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2935 //printf("\n\n\n\n\n\n\nProton mass: %e\n\n\n\n\n\n\n\n\n",current->GetCalcMass());
2938 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
2939 || TMath::Abs(particle)==311)
2941 kaonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2942 //ptspectra->Fill(Pt,(float) 1);
2943 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2944 kaonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2946 kaonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2947 //printf("Kaon mass: %e\n",current->GetCalcMass());
2949 if (TMath::Abs(particle)==321)
2955 if (current->Energy()>1)
2956 highprimarykaons +=1;
2960 if (TMath::Abs(particle)==11)
2962 electronspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2963 //ptspectra->Fill(Pt,(float) 1);
2964 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2965 electronspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2967 electronspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2968 //printf("Electron mass: %e\n",current->GetCalcMass());
2971 if (particle == -11)
2974 if (TMath::Abs(particle)==13)
2976 muonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2977 //ptspectra->Fill(Pt,(float) 1);
2978 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2979 muonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2981 muonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2982 //printf("Muon mass: %e\n",current->GetCalcMass());
2985 if (TMath::Abs(particle)==2112)
2987 neutronspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2988 //ptspectra->Fill(Pt,(float) 1);
2989 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2990 neutronspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2993 neutronspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2994 //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);
2996 //printf("Neutron mass: %e\n",current->GetCalcMass());
2999 if(TMath::Abs(particle)==211 || TMath::Abs(particle)==2212 || TMath::Abs(particle)==321)
3001 if (current->Energy()-current->GetCalcMass()>1)
3003 chargedspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
3004 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
3005 chargedspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
3007 chargedspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
3010 //printf("Hits:%d\n",hit);
3011 //printf ("Chamber number:%d x:%f y:%f\n",nch,x,y);
3012 // Fill the histograms
3014 //h->Fill(x,y,(float) 1);
3024 TStyle *mystyle=new TStyle("Plain","mystyle");
3025 mystyle->SetPalette(1,0);
3028 //Create canvases, set the view range, show histograms
3030 TCanvas *c2 = new TCanvas("c2","Angles of incidence",150,150,100,150);
3032 //c2->SetFillColor(42);
3035 hitsTheta500MeV->SetFillColor(5);
3036 hitsTheta500MeV->Draw();
3038 hitsTheta1GeV->SetFillColor(5);
3039 hitsTheta1GeV->Draw();
3041 hitsTheta2GeV->SetFillColor(5);
3042 hitsTheta2GeV->Draw();
3044 hitsTheta3GeV->SetFillColor(5);
3045 hitsTheta3GeV->Draw();
3049 TCanvas *c15 = new TCanvas("c15","Mothers Production Vertices",50,50,600,600);
3051 production->SetFillColor(42);
3052 production->SetXTitle("z (m)");
3053 production->SetYTitle("R (m)");
3056 TCanvas *c10 = new TCanvas("c10","Pt Spectra",50,50,600,700);
3059 pionptspectravertex->SetFillColor(5);
3060 pionptspectravertex->SetXTitle("Pt (GeV)");
3061 pionptspectravertex->Draw();
3063 pionptspectrafinal->SetFillColor(5);
3064 pionptspectrafinal->SetXTitle("Pt (GeV)");
3065 pionptspectrafinal->Draw();
3067 kaonptspectravertex->SetFillColor(5);
3068 kaonptspectravertex->SetXTitle("Pt (GeV)");
3069 kaonptspectravertex->Draw();
3071 kaonptspectrafinal->SetFillColor(5);
3072 kaonptspectrafinal->SetXTitle("Pt (GeV)");
3073 kaonptspectrafinal->Draw();
3076 TCanvas *c16 = new TCanvas("c16","Particles Spectra II",150,150,600,350);
3080 //TCanvas *c13 = new TCanvas("c13","Electron Spectra",400,10,600,700);
3081 electronspectra1->SetFillColor(5);
3082 electronspectra1->SetXTitle("log(GeV)");
3083 electronspectra2->SetFillColor(46);
3084 electronspectra2->SetXTitle("log(GeV)");
3085 electronspectra3->SetFillColor(10);
3086 electronspectra3->SetXTitle("log(GeV)");
3088 electronspectra1->Draw();
3089 electronspectra2->Draw("same");
3090 electronspectra3->Draw("same");
3093 //TCanvas *c14 = new TCanvas("c14","Muon Spectra",400,10,600,700);
3094 muonspectra1->SetFillColor(5);
3095 muonspectra1->SetXTitle("log(GeV)");
3096 muonspectra2->SetFillColor(46);
3097 muonspectra2->SetXTitle("log(GeV)");
3098 muonspectra3->SetFillColor(10);
3099 muonspectra3->SetXTitle("log(GeV)");
3101 muonspectra1->Draw();
3102 muonspectra2->Draw("same");
3103 muonspectra3->Draw("same");
3106 //TCanvas *c16 = new TCanvas("c16","Neutron Spectra",400,10,600,700);
3107 //neutronspectra1->SetFillColor(42);
3108 //neutronspectra1->SetXTitle("log(GeV)");
3109 //neutronspectra2->SetFillColor(46);
3110 //neutronspectra2->SetXTitle("log(GeV)");
3111 //neutronspectra3->SetFillColor(10);
3112 //neutronspectra3->SetXTitle("log(GeV)");
3114 //neutronspectra1->Draw();
3115 //neutronspectra2->Draw("same");
3116 //neutronspectra3->Draw("same");
3118 TCanvas *c9 = new TCanvas("c9","Particles Spectra",150,150,600,700);
3119 //TCanvas *c9 = new TCanvas("c9","Pion Spectra",400,10,600,700);
3123 pionspectra1->SetFillColor(5);
3124 pionspectra1->SetXTitle("log(GeV)");
3125 pionspectra2->SetFillColor(46);
3126 pionspectra2->SetXTitle("log(GeV)");
3127 pionspectra3->SetFillColor(10);
3128 pionspectra3->SetXTitle("log(GeV)");
3130 pionspectra1->Draw();
3131 pionspectra2->Draw("same");
3132 pionspectra3->Draw("same");
3135 //TCanvas *c10 = new TCanvas("c10","Proton Spectra",400,10,600,700);
3136 protonspectra1->SetFillColor(5);
3137 protonspectra1->SetXTitle("log(GeV)");
3138 protonspectra2->SetFillColor(46);
3139 protonspectra2->SetXTitle("log(GeV)");
3140 protonspectra3->SetFillColor(10);
3141 protonspectra3->SetXTitle("log(GeV)");
3143 protonspectra1->Draw();
3144 protonspectra2->Draw("same");
3145 protonspectra3->Draw("same");
3148 //TCanvas *c11 = new TCanvas("c11","Kaon Spectra",400,10,600,700);
3149 kaonspectra1->SetFillColor(5);
3150 kaonspectra1->SetXTitle("log(GeV)");
3151 kaonspectra2->SetFillColor(46);
3152 kaonspectra2->SetXTitle("log(GeV)");
3153 kaonspectra3->SetFillColor(10);
3154 kaonspectra3->SetXTitle("log(GeV)");
3156 kaonspectra1->Draw();
3157 kaonspectra2->Draw("same");
3158 kaonspectra3->Draw("same");
3161 //TCanvas *c12 = new TCanvas("c12","Charged Particles Spectra",400,10,600,700);
3162 chargedspectra1->SetFillColor(5);
3163 chargedspectra1->SetXTitle("log(GeV)");
3164 chargedspectra2->SetFillColor(46);
3165 chargedspectra2->SetXTitle("log(GeV)");
3166 chargedspectra3->SetFillColor(10);
3167 chargedspectra3->SetXTitle("log(GeV)");
3169 chargedspectra1->Draw();
3170 chargedspectra2->Draw("same");
3171 chargedspectra3->Draw("same");
3175 printf("*****************************************\n");
3176 printf("* Particle * Counts *\n");
3177 printf("*****************************************\n");
3179 printf("* Pions: * %4d *\n",pion);
3180 printf("* Charged Pions: * %4d *\n",chargedpions);
3181 printf("* Primary Pions: * %4d *\n",primarypions);
3182 printf("* Primary Pions (p>1GeV/c): * %4d *\n",highprimarypions);
3183 printf("* Kaons: * %4d *\n",kaon);
3184 printf("* Charged Kaons: * %4d *\n",chargedkaons);
3185 printf("* Primary Kaons: * %4d *\n",primarykaons);
3186 printf("* Primary Kaons (p>1GeV/c): * %4d *\n",highprimarykaons);
3187 printf("* Muons: * %4d *\n",muon);
3188 printf("* Electrons: * %4d *\n",electron);
3189 printf("* Positrons: * %4d *\n",positron);
3190 printf("* Protons: * %4d *\n",proton);
3191 printf("* All Charged: * %4d *\n",(chargedpions+chargedkaons+muon+electron+positron+proton));
3192 printf("*****************************************\n");
3193 //printf("* Photons: * %3.1f *\n",photons);
3194 //printf("* Primary Photons: * %3.1f *\n",primaryphotons);
3195 //printf("* Primary Photons (p>1MeV/c):* %3.1f *\n",highprimaryphotons);
3196 //printf("*****************************************\n");
3197 //printf("* Neutrons: * %3.1f *\n",neutron);
3198 //printf("* Neutrons (p>100keV/c): * %3.1f *\n",highneutrons);
3199 //printf("*****************************************\n");
3201 if (gAlice->TreeD())
3203 gAlice->TreeD()->GetEvent(0);
3208 printf("\n*****************************************\n");
3209 printf("* Chamber * Digits * Occupancy *\n");
3210 printf("*****************************************\n");
3212 for (Int_t ich=0;ich<7;ich++)
3214 TClonesArray *Digits = DigitsAddress(ich); // Raw clusters branch
3215 Int_t ndigits = Digits->GetEntriesFast();
3216 occ[ich] = Float_t(ndigits)/(160*144);
3217 sum += Float_t(ndigits)/(160*144);
3218 printf("* %d * %d * %3.1f%% *\n",ich,ndigits,occ[ich]*100);
3221 printf("*****************************************\n");
3222 printf("* Mean occupancy * %3.1f%% *\n",mean*100);
3223 printf("*****************************************\n");
3226 printf("\nEnd of analysis\n");
3230 //_________________________________________________________________________________________________
3233 void AliRICH::DiagnosticsSE(Int_t diaglevel,Int_t evNumber1,Int_t evNumber2)
3236 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
3237 AliRICHSegmentationV0* segmentation;
3238 AliRICHChamber* chamber;
3240 chamber = &(pRICH->Chamber(0));
3241 segmentation=(AliRICHSegmentationV0*) chamber->GetSegmentationModel();
3243 Int_t NpadX = segmentation->Npx(); // number of pads on X
3244 Int_t NpadY = segmentation->Npy(); // number of pads on Y
3246 //Int_t Pad[144][160];
3247 /*for (Int_t i=0;i<NpadX;i++) {
3248 for (Int_t j=0;j<NpadY;j++) {
3254 Int_t xmin= -NpadX/2;
3255 Int_t xmax= NpadX/2;
3256 Int_t ymin= -NpadY/2;
3257 Int_t ymax= NpadY/2;
3259 Float_t PTfinal = 0;
3260 Int_t pionCount = 0;
3261 Int_t kaonCount = 0;
3262 Int_t protonCount = 0;
3271 TH2F *hc0 = new TH2F("hc0","Zoom on center of central chamber",150,-25,25,150,-45,5);
3275 printf("Single Ring Hits\n");
3276 feedback = new TH2F("feedback","Feedback hit distribution",150,-20,20,150,-35,5);
3277 mip = new TH2F("mip","Mip hit distribution",150,-20,20,150,-35,5);
3278 cerenkov = new TH2F("cerenkov","Cerenkov hit distribution",150,-20,20,150,-35,5);
3279 h = new TH2F("h","Detector hit distribution",150,-20,20,150,-35,5);
3280 hitsX = new TH1F("hitsX","Distribution of hits along x-axis",150,-50,50);
3281 hitsY = new TH1F("hitsY","Distribution of hits along z-axis",150,-50,50);
3285 printf("Full Event Hits\n");
3287 feedback = new TH2F("feedback","Feedback hit distribution",150,-300,300,150,-300,300);
3288 mip = new TH2F("mip","Mip hit distribution",150,-300,300,150,-300,300);
3289 cerenkov = new TH2F("cerenkov","Cerenkov hit distribution",150,-300,300,150,-300,300);
3290 h = new TH2F("h","Detector hit distribution",150,-300,300,150,-300,300);
3291 hitsX = new TH1F("digitsX","Distribution of hits along x-axis",200,-300,300);
3292 hitsY = new TH1F("digitsY","Distribution of hits along z-axis",200,-300,300);
3297 TH2F *hc1 = new TH2F("hc1","Chamber 1 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3298 TH2F *hc2 = new TH2F("hc2","Chamber 2 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3299 TH2F *hc3 = new TH2F("hc3","Chamber 3 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3300 TH2F *hc4 = new TH2F("hc4","Chamber 4 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3301 TH2F *hc5 = new TH2F("hc5","Chamber 5 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3302 TH2F *hc6 = new TH2F("hc6","Chamber 6 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3303 TH2F *hc7 = new TH2F("hc7","Chamber 7 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3305 TH1F *Clcharge = new TH1F("Clcharge","Cluster Charge Distribution",500,0.,500.);
3306 TH1F *ckovangle = new TH1F("ckovangle","Cerenkov angle per photon",100,.35,.8);
3307 TH1F *hckphi = new TH1F("hckphi","Cerenkov phi angle per photon",620,-3.1,3.1);
3308 TH1F *mother = new TH1F("mother","Cerenkovs per Mip",75,0.,75.);
3309 TH1F *radius = new TH1F("radius","Mean distance to Mip",100,0.,20.);
3310 TH1F *phspectra1 = new TH1F("phspectra1","Detected Photon Spectra",200,5.,10.);
3311 TH1F *phspectra2 = new TH1F("phspectra2","Produced Photon Spectra",200,5.,10.);
3312 TH1F *totalphotonstrack = new TH1F("totalphotonstrack","Produced Photons per Mip",100,200,700.);
3313 TH1F *totalphotonsevent = new TH1F("totalphotonsevent","Produced Photons per Mip",100,200,700.);
3314 //TH1F *feedbacks = new TH1F("feedbacks","Produced Feedbacks per Mip",50,0.5,50.);
3315 TH1F *padnumber = new TH1F("padnumber","Number of pads per cluster",50,-0.5,50.);
3316 TH1F *padsev = new TH1F("padsev","Number of pads hit per MIP",50,0.5,100.);
3317 TH1F *clusev = new TH1F("clusev","Number of clusters per MIP",50,0.5,50.);
3318 TH1F *photev = new TH1F("photev","Number of detected photons per MIP",50,0.5,50.);
3319 TH1F *feedev = new TH1F("feedev","Number of feedbacks per MIP",50,0.5,50.);
3320 TH1F *padsmip = new TH1F("padsmip","Number of pads per event inside MIP region",50,0.5,50.);
3321 TH1F *padscl = new TH1F("padscl","Number of pads per event from cluster count",50,0.5,100.);
3322 TH1F *pionspectra = new TH1F("pionspectra","Pion Spectra",200,.5,10.);
3323 TH1F *protonspectra = new TH1F("protonspectra","Proton Spectra",200,.5,10.);
3324 TH1F *kaonspectra = new TH1F("kaonspectra","Kaon Spectra",100,.5,10.);
3325 TH1F *chargedspectra = new TH1F("chargedspectra","Charged particles above 1 GeV Spectra",100,.5,10.);
3326 TH1F *hitsPhi = new TH1F("hitsPhi","Distribution of phi angle of incidence",50,0,360);
3327 TH1F *hitsTheta = new TH1F("hitsTheta","Distribution of theta angle of incidence",50,0,15);
3328 TH1F *Omega1D = new TH1F("omega","Reconstructed Cerenkov angle per track",50,.5,1);
3329 TH1F *Theta = new TH1F("theta","Reconstructed theta incidence angle per track",100,0,15);
3330 TH1F *Phi = new TH1F("phi","Reconstructed phi incidence per track",100,0,360);
3331 TH1F *Omega3D = new TH1F("omega","Reconstructed Cerenkov angle per track",100,.35,.8);
3332 TH1F *PhotonCer = new TH1F("photoncer","Reconstructed Cerenkov angle per photon",100,.35,.8);
3333 TH2F *PadsUsed = new TH2F("padsused","Pads Used for Reconstruction",100,-30,30,100,-30,30);
3334 TH1F *MeanRadius = new TH1F("radius","Mean Radius for reconstructed track",100,0.,20.);
3335 TH2F *identification = new TH2F("identification","Particle Identification",100,1,5,100,0,.8);
3336 TH1F *OriginalOmega = new TH1F("Original Omega","Cerenkov angle per track",100,.35,.8);
3337 TH1F *OriginalPhi = new TH1F("Original Phi","Distribution of phi angle of incidence per track",100,0,360);
3338 TH1F *OriginalTheta = new TH1F("Original Theta","Distribution of theta angle per track",100,0,15);
3339 TH1F *OmegaError = new TH1F("Omega Error","Difference between original an reconstructed cerenkov angle",100,0,.2);
3340 TH1F *PhiError = new TH1F("Phi Error","Difference between original an reconstructed phi angle",100,0,360);
3341 TH1F *ThetaError = new TH1F("Theta Error","Difference between original an reconstructed phi angle",100,0,15);
3344 // Start loop over events
3349 Int_t mothers[80000];
3350 Int_t mothers2[80000];
3358 Float_t chiSquareOmega = 0;
3359 Float_t chiSquareTheta = 0;
3360 Float_t chiSquarePhi = 0;
3362 Float_t recEffEvent = 0;
3363 Float_t recEffTotal = 0;
3365 Float_t trackglob[3];
3366 Float_t trackloc[3];
3369 for (Int_t i=0;i<100;i++) mothers[i]=0;
3371 for (int nev=0; nev<= evNumber2; nev++) {
3372 Int_t nparticles = gAlice->GetEvent(nev);
3375 //cout<<"nev "<<nev<<endl;
3376 printf ("\n**********************************\nProcessing Event: %d\n",nev);
3377 //cout<<"nparticles "<<nparticles<<endl;
3378 printf ("Particles : %d\n\n",nparticles);
3379 if (nev < evNumber1) continue;
3380 if (nparticles <= 0) return;
3382 // Get pointers to RICH detector and Hits containers
3385 TTree *TH = gAlice->TreeH();
3386 Stat_t ntracks = TH->GetEntries();
3388 // Start loop on tracks in the hits containers
3390 for (Int_t track=0; track<ntracks;track++) {
3392 printf ("\nProcessing Track: %d\n",track);
3393 gAlice->ResetHits();
3394 TH->GetEvent(track);
3395 Int_t nhits = pRICH->Hits()->GetEntriesFast();
3396 if (nhits) Nh+=nhits;
3397 printf("Hits : %d\n",nhits);
3398 for(AliRICHHit* mHit=(AliRICHHit*)pRICH->FirstHit(-1);
3400 mHit=(AliRICHHit*)pRICH->NextHit())
3402 Int_t nch = mHit->Chamber(); // chamber number
3403 trackglob[0] = mHit->X(); // x-pos of hit
3404 trackglob[1] = mHit->Y();
3405 trackglob[2] = mHit->Z(); // y-pos of hit
3406 //x = mHit->X(); // x-pos of hit
3407 //y = mHit->Z(); // y-pos
3408 Float_t phi = mHit->Phi(); //Phi angle of incidence
3409 Float_t theta = mHit->Theta(); //Theta angle of incidence
3410 Int_t index = mHit->Track();
3411 Int_t particle = (Int_t)(mHit->Particle());
3412 //Int_t freon = (Int_t)(mHit->fLoss);
3413 Float_t px = mHit->MomX();
3414 Float_t py = mHit->MomY();
3416 if (TMath::Abs(particle) < 10000000)
3418 PTfinal=TMath::Sqrt(px*px + py*py);
3419 //printf("PTfinal 0: %f\n",PTfinal);
3422 chamber = &(pRICH->Chamber(nch-1));
3424 //printf("Nch:%d\n",nch);
3426 chamber->GlobaltoLocal(trackglob,trackloc);
3428 chamber->LocaltoGlobal(trackloc,trackglob);
3434 hitsX->Fill(x,(float) 1);
3435 hitsY->Fill(y,(float) 1);
3437 //printf("Particle:%9d\n",particle);
3439 TParticle *current = (TParticle*)gAlice->Particle(index);
3440 //printf("Particle type: %d\n",sizeoff(Particles));
3442 hitsTheta->Fill(theta,(float) 1);
3443 //hitsPhi->Fill(phi,(float) 1);
3444 //if (pRICH->GetDebugLevel() == -1)
3445 //printf("Theta:%f, Phi:%f\n",theta,phi);
3447 //printf("Debug Level:%d\n",pRICH->GetDebugLevel());
3449 if (current->GetPdgCode() < 10000000)
3451 mip->Fill(x,y,(float) 1);
3452 //printf("adding mip\n");
3453 //if (current->Energy() - current->GetCalcMass()>1 && freon==1)
3455 hitsPhi->Fill(TMath::Abs(phi),(float) 1);
3456 //hitsTheta->Fill(theta,(float) 1);
3457 //printf("Theta:%f, Phi:%f\n",theta,phi);
3461 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
3463 pionspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
3465 if (TMath::Abs(particle)==2212)
3467 protonspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
3469 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
3470 || TMath::Abs(particle)==311)
3472 kaonspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
3474 if(TMath::Abs(particle)==211 || TMath::Abs(particle)==2212 || TMath::Abs(particle)==321)
3476 if (current->Energy() - current->GetCalcMass()>1)
3477 chargedspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
3479 //printf("Hits:%d\n",hit);
3480 //printf ("Chamber number:%d x:%f y:%f\n",nch,x,y);
3481 // Fill the histograms
3483 h->Fill(x,y,(float) 1);
3488 Int_t ncerenkovs = pRICH->Cerenkovs()->GetEntriesFast();
3489 //if (current->GetPdgCode() < 50000051 && current->GetPdgCode() > 50000040)
3490 //totalphotonsevent->Fill(ncerenkovs,(float) 1);
3493 printf("Cerenkovs : %d\n",ncerenkovs);
3494 totalphotonsevent->Fill(ncerenkovs,(float) 1);
3495 for (Int_t hit=0;hit<ncerenkovs;hit++) {
3496 AliRICHCerenkov* cHit = (AliRICHCerenkov*) pRICH->Cerenkovs()->UncheckedAt(hit);
3497 Int_t nchamber = cHit->fChamber; // chamber number
3498 Int_t index = cHit->Track();
3499 //Int_t pindex = (Int_t)(cHit->fIndex);
3500 trackglob[0] = cHit->X(); // x-pos of hit
3501 trackglob[1] = cHit->Y();
3502 trackglob[2] = cHit->Z(); // y-pos of hit
3503 //Float_t cx = cHit->X(); // x-position
3504 //Float_t cy = cHit->Z(); // y-position
3505 Int_t cmother = cHit->fCMother; // Index of mother particle
3506 Int_t closs = (Int_t)(cHit->fLoss); // How did the particle get lost?
3507 Float_t cherenkov = cHit->fCerenkovAngle; //production cerenkov angle
3509 chamber = &(pRICH->Chamber(nchamber-1));
3511 //printf("Nch:%d\n",nch);
3513 chamber->GlobaltoLocal(trackglob,trackloc);
3515 chamber->LocaltoGlobal(trackloc,trackglob);
3518 Float_t cx=trackloc[0];
3519 Float_t cy=trackloc[2];
3521 //printf ("Cerenkov hit number %d/%d, X:%f, Y:%f\n",hit,ncerenkovs,cx,cy);
3524 //printf("Particle:%9d\n",index);
3526 TParticle *current = (TParticle*)gAlice->Particle(index);
3527 Float_t energyckov = current->Energy();
3529 if (current->GetPdgCode() == 50000051)
3533 feedback->Fill(cx,cy,(float) 1);
3537 if (current->GetPdgCode() == 50000050)
3542 phspectra2->Fill(energyckov*1e9,(float) 1);
3547 cerenkov->Fill(cx,cy,(float) 1);
3549 //printf ("Cerenkov hit number %d/%d, X:%d, Y:%d\n",hit,ncerenkovs,cx,cy);
3551 //TParticle *MIP = (TParticle*)gAlice->Particle(cmother);
3552 AliRICHHit* mipHit = (AliRICHHit*) pRICH->Hits()->UncheckedAt(0);
3553 mom[0] = current->Px();
3554 mom[1] = current->Py();
3555 mom[2] = current->Pz();
3556 //mom[0] = cHit->fMomX;
3557 // mom[1] = cHit->fMomZ;
3558 //mom[2] = cHit->fMomY;
3559 //Float_t energymip = MIP->Energy();
3560 //Float_t Mip_px = mipHit->fMomFreoX;
3561 //Float_t Mip_py = mipHit->fMomFreoY;
3562 //Float_t Mip_pz = mipHit->fMomFreoZ;
3563 //Float_t Mip_px = MIP->Px();
3564 //Float_t Mip_py = MIP->Py();
3565 //Float_t Mip_pz = MIP->Pz();
3569 //Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
3570 //Float_t rt = TMath::Sqrt(r);
3571 //Float_t Mip_r = Mip_px*Mip_px + Mip_py*Mip_py + Mip_pz*Mip_pz;
3572 //Float_t Mip_rt = TMath::Sqrt(Mip_r);
3573 //Float_t coscerenkov = (mom[0]*Mip_px + mom[1]*Mip_py + mom[2]*Mip_pz)/(rt*Mip_rt+0.0000001);
3574 //Float_t cherenkov = TMath::ACos(coscerenkov);
3575 ckovangle->Fill(cherenkov,(float) 1); //Cerenkov angle calculus
3576 //printf("Cherenkov: %f\n",cherenkov);
3577 Float_t ckphi=TMath::ATan2(mom[0], mom[2]);
3578 hckphi->Fill(ckphi,(float) 1);
3581 //Float_t mix = MIP->Vx();
3582 //Float_t miy = MIP->Vy();
3583 Float_t mx = mipHit->X();
3584 Float_t my = mipHit->Z();
3585 //printf("FX %e, FY %e, VX %e, VY %e\n",cx,cy,mx,my);
3586 Float_t dx = trackglob[0] - mx;
3587 Float_t dy = trackglob[2] - my;
3588 //printf("Dx:%f, Dy:%f\n",dx,dy);
3589 Float_t final_radius = TMath::Sqrt(dx*dx+dy*dy);
3590 //printf("Final radius:%f\n",final_radius);
3591 radius->Fill(final_radius,(float) 1);
3593 phspectra1->Fill(energyckov*1e9,(float) 1);
3596 for (Int_t nmothers=0;nmothers<=ntracks;nmothers++){
3597 if (cmother == nmothers){
3599 mothers2[cmother]++;
3610 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
3611 gAlice->TreeR()->GetEvent(nent-1);
3612 TClonesArray *Rawclusters = pRICH->RawClustAddress(2); // Raw clusters branch
3613 //printf ("Rawclusters:%p",Rawclusters);
3614 Int_t nrawclusters = Rawclusters->GetEntriesFast();
3617 printf("Raw Clusters : %d\n",nrawclusters);
3618 for (Int_t hit=0;hit<nrawclusters;hit++) {
3619 AliRICHRawCluster* rcHit = (AliRICHRawCluster*) pRICH->RawClustAddress(2)->UncheckedAt(hit);
3620 //Int_t nchamber = rcHit->fChamber; // chamber number
3621 //Int_t nhit = cHit->fHitNumber; // hit number
3622 Int_t qtot = rcHit->fQ; // charge
3623 Float_t fx = rcHit->fX; // x-position
3624 Float_t fy = rcHit->fY; // y-position
3625 //Int_t type = rcHit->fCtype; // cluster type ?
3626 Int_t mult = rcHit->fMultiplicity; // How many pads form the cluster
3629 //printf ("fx: %d, fy: %d\n",fx,fy);
3630 if (fx>(x-4) && fx<(x+4) && fy>(y-4) && fy<(y+4)) {
3631 //printf("There %d \n",mult);
3634 padnumber->Fill(mult,(float) 1);
3636 if (mult<4) Clcharge->Fill(qtot,(float) 1);
3644 TClonesArray *RecHits1D = pRICH->RecHitsAddress1D(2);
3645 Int_t nrechits1D = RecHits1D->GetEntriesFast();
3646 //printf (" nrechits:%d\n",nrechits);
3650 for (Int_t hit=0;hit<nrechits1D;hit++) {
3651 AliRICHRecHit1D* recHit1D = (AliRICHRecHit1D*) pRICH->RecHitsAddress1D(2)->UncheckedAt(hit);
3652 Float_t r_omega = recHit1D->fOmega; // Cerenkov angle
3653 Float_t *cer_pho = recHit1D->fCerPerPhoton; // Cerenkov angle per photon
3654 Int_t *padsx = recHit1D->fPadsUsedX; // Pads Used fo reconstruction (x)
3655 Int_t *padsy = recHit1D->fPadsUsedY; // Pads Used fo reconstruction (y)
3656 Int_t goodPhotons = recHit1D->fGoodPhotons; // Number of pads used for reconstruction
3658 Omega1D->Fill(r_omega,(float) 1);
3660 for (Int_t i=0; i<goodPhotons; i++)
3662 PhotonCer->Fill(cer_pho[i],(float) 1);
3663 PadsUsed->Fill(padsx[i],padsy[i],1);
3664 //printf("Angle:%f, pad: %d %d\n",cer_pho[i],padsx[i],padsy[i]);
3667 //printf("Omega: %f, Theta: %f, Phi: %f\n",r_omega,r_theta,r_phi);
3672 TClonesArray *RecHits3D = pRICH->RecHitsAddress3D(2);
3673 Int_t nrechits3D = RecHits3D->GetEntriesFast();
3674 //printf (" nrechits:%d\n",nrechits);
3680 //for (Int_t hit=0;hit<nrechits3D;hit++) {
3681 AliRICHRecHit3D* recHit3D = (AliRICHRecHit3D*) pRICH->RecHitsAddress3D(2)->UncheckedAt(track);
3682 Float_t r_omega = recHit3D->fOmega; // Cerenkov angle
3683 Float_t r_theta = recHit3D->fTheta; // Theta angle of incidence
3684 Float_t r_phi = recHit3D->fPhi; // Phi angle if incidence
3685 Float_t meanradius = recHit3D->fMeanRadius; // Mean radius for reconstructed point
3686 Float_t originalOmega = recHit3D->fOriginalOmega; // Real Cerenkov angle
3687 Float_t originalTheta = recHit3D->fOriginalTheta; // Real incidence angle
3688 Float_t originalPhi = recHit3D->fOriginalPhi; // Real azimuthal angle
3691 //correction to track cerenkov angle
3692 originalOmega = (Float_t) ckovangle->GetMean();
3696 printf("\nMean cerenkov angle: %f\n", originalOmega);
3697 printf("Reconstructed cerenkov angle: %f\n",r_omega);
3700 Float_t omegaError = TMath::Abs(originalOmega - r_omega);
3701 Float_t thetaError = TMath::Abs(originalTheta - r_theta);
3702 Float_t phiError = TMath::Abs(originalPhi - r_phi);
3704 //chiSquareOmega += (omegaError/originalOmega)*(omegaError/originalOmega);
3705 //chiSquareTheta += (thetaError/originalTheta)*(thetaError/originalTheta);
3706 //chiSquarePhi += (phiError/originalPhi)*(phiError/originalPhi);
3708 if(TMath::Abs(omegaError) < 0.015)
3713 //printf("rechit %f %f %f %f %f\n",recHit3D->fOmega,recHit3D->fTheta,recHit3D->fPhi, recHit3D->fX,recHit3D->fY);
3715 Omega3D->Fill(r_omega,(float) 1);
3716 Theta->Fill(r_theta*180/TMath::Pi(),(float) 1);
3717 Phi->Fill(r_phi*180/TMath::Pi()-180,(float) 1);
3718 MeanRadius->Fill(meanradius,(float) 1);
3719 identification->Fill(PTfinal, r_omega,1);
3720 OriginalOmega->Fill(originalOmega, (float) 1);
3721 OriginalTheta->Fill(originalTheta, (float) 1);
3722 OriginalPhi->Fill(TMath::Abs(originalPhi), (float) 1);
3723 OmegaError->Fill(omegaError, (float) 1);
3724 ThetaError->Fill(thetaError, (float) 1);
3725 PhiError->Fill(phiError, (float) 1);
3727 recEffEvent = recEffEvent;
3728 recEffTotal += recEffEvent;
3730 Float_t pioncer = acos(sqrt((.139*.139+PTfinal*PTfinal)/(PTfinal*PTfinal*1.285*1.285)));
3731 Float_t kaoncer = acos(sqrt((.439*.439+PTfinal*PTfinal)/(PTfinal*PTfinal*1.285*1.285)));
3732 Float_t protoncer = acos(sqrt((.938*.938+PTfinal*PTfinal)/(PTfinal*PTfinal*1.285*1.285)));
3734 Float_t piondist = TMath::Abs(r_omega - pioncer);
3735 Float_t kaondist = TMath::Abs(r_omega - kaoncer);
3736 Float_t protondist = TMath::Abs(r_omega - protoncer);
3742 printf("Identified as a PION!\n");
3745 if(kaoncer<r_omega && pioncer>r_omega)
3747 if(kaondist>piondist)
3749 printf("Identified as a PION!\n");
3754 printf("Identified as a KAON!\n");
3758 if(protoncer<r_omega && kaoncer>r_omega)
3760 if(kaondist>protondist)
3762 printf("Identified as a PROTON!\n");
3767 printf("Identified as a KAON!\n");
3771 if(protoncer>r_omega)
3773 printf("Identified as a PROTON!\n");
3777 printf("\nReconstruction efficiency: %5.2f%%\n", recEffEvent*100);
3783 for (Int_t nmothers=0;nmothers<ntracks;nmothers++){
3784 totalphotonstrack->Fill(mothers[nmothers],(float) 1);
3785 mother->Fill(mothers2[nmothers],(float) 1);
3786 //printf ("Entries in %d : %d\n",nmothers, mothers[nmothers]);
3789 clusev->Fill(nraw,(float) 1);
3790 photev->Fill(phot,(float) 1);
3791 feedev->Fill(feed,(float) 1);
3792 padsmip->Fill(padmip,(float) 1);
3793 padscl->Fill(pads,(float) 1);
3794 //printf("Photons:%d\n",phot);
3803 gAlice->ResetDigits();
3804 //Int_t nent=(Int_t)gAlice->TreeD()->GetEntries();
3805 gAlice->TreeD()->GetEvent(0);
3811 TClonesArray *Digits = pRICH->DigitsAddress(2);
3812 Int_t ndigits = Digits->GetEntriesFast();
3813 printf("Digits : %d\n",ndigits);
3814 padsev->Fill(ndigits,(float) 1);
3815 for (Int_t hit=0;hit<ndigits;hit++) {
3816 AliRICHDigit* dHit = (AliRICHDigit*) Digits->UncheckedAt(hit);
3817 Int_t qtot = dHit->Signal(); // charge
3818 Int_t ipx = dHit->PadX(); // pad number on X
3819 Int_t ipy = dHit->PadY(); // pad number on Y
3820 //printf("%d, %d\n",ipx,ipy);
3821 if( ipx<=100 && ipy <=100) hc0->Fill(ipx,ipy,(float) qtot);
3827 for (Int_t ich=0;ich<7;ich++)
3829 TClonesArray *Digits = pRICH->DigitsAddress(ich); // Raw clusters branch
3830 Int_t ndigits = Digits->GetEntriesFast();
3831 //printf("Digits:%d\n",ndigits);
3832 padsev->Fill(ndigits,(float) 1);
3834 for (Int_t hit=0;hit<ndigits;hit++) {
3835 AliRICHDigit* dHit = (AliRICHDigit*) Digits->UncheckedAt(hit);
3836 //Int_t nchamber = dHit->GetChamber(); // chamber number
3837 //Int_t nhit = dHit->fHitNumber; // hit number
3838 Int_t qtot = dHit->Signal(); // charge
3839 Int_t ipx = dHit->PadX(); // pad number on X
3840 Int_t ipy = dHit->PadY(); // pad number on Y
3841 //Int_t iqpad = dHit->fQpad; // charge per pad
3842 //Int_t rpad = dHit->fRSec; // R-position of pad
3843 //printf ("Pad hit, PadX:%d, PadY:%d\n",ipx,ipy);
3844 if( ipx<=100 && ipy <=100 && ich==2) hc0->Fill(ipx,ipy,(float) qtot);
3845 if( ipx<=162 && ipy <=162 && ich==0) hc1->Fill(ipx,ipy,(float) qtot);
3846 if( ipx<=162 && ipy <=162 && ich==1) hc2->Fill(ipx,ipy,(float) qtot);
3847 if( ipx<=162 && ipy <=162 && ich==2) hc3->Fill(ipx,ipy,(float) qtot);
3848 if( ipx<=162 && ipy <=162 && ich==3) hc4->Fill(ipx,ipy,(float) qtot);
3849 if( ipx<=162 && ipy <=162 && ich==4) hc5->Fill(ipx,ipy,(float) qtot);
3850 if( ipx<=162 && ipy <=162 && ich==5) hc6->Fill(ipx,ipy,(float) qtot);
3851 if( ipx<=162 && ipy <=162 && ich==6) hc7->Fill(ipx,ipy,(float) qtot);
3869 for(Int_t i=0;i<99;i++)
3871 omegaE = OriginalOmega->GetBinContent(i);
3874 omegaO = Omega3D->GetBinContent(i);
3875 chiSquareOmega += (TMath::Power(omegaE,2) - TMath::Power(omegaO,2))/omegaO;
3878 thetaE = OriginalTheta->GetBinContent(i);
3881 thetaO = Theta->GetBinContent(i);
3882 chiSquareTheta += (TMath::Power(thetaE,2) - TMath::Power(thetaO,2))/thetaO;
3885 phiE = OriginalPhi->GetBinContent(i);
3888 phiO = Phi->GetBinContent(i);
3889 chiSquarePhi += (TMath::Power(phiE,2) - TMath::Power(phiO,2))/phiO;
3892 //printf(" o: %f t: %f p: %f\n", OriginalOmega->GetBinContent(i), OriginalTheta->GetBinContent(i),OriginalPhi->GetBinContent(i));
3898 printf("\nChi square test values: Omega - %f\n", chiSquareOmega);
3899 printf(" Theta - %f\n", chiSquareTheta);
3900 printf(" Phi - %f\n", chiSquarePhi);
3902 printf("\nKolmogorov test values: Omega - %5.4f\n", Omega3D->KolmogorovTest(OriginalOmega));
3903 printf(" Theta - %5.4f\n", Theta->KolmogorovTest(OriginalTheta));
3904 printf(" Phi - %5.4f\n", Phi->KolmogorovTest(OriginalPhi));
3906 recEffTotal = recEffTotal/evNumber2;
3907 printf("\nTotal reconstruction efficiency: %5.2f%%\n", recEffTotal*100);
3908 printf("\n Pions: %d\n Kaons: %d\n Protons:%d\n",pionCount, kaonCount, protonCount);
3913 //Create canvases, set the view range, show histograms
3932 TStyle *mystyle=new TStyle("Plain","mystyle");
3933 mystyle->SetPalette(1,0);
3934 //mystyle->SetTitleYSize(0.2);
3935 //mystyle->SetStatW(0.19);
3936 //mystyle->SetStatH(0.1);
3937 //mystyle->SetStatFontSize(0.01);
3938 //mystyle->SetTitleYSize(0.3);
3939 mystyle->SetFuncColor(2);
3940 //mystyle->SetOptStat(0111);
3941 mystyle->SetDrawBorder(0);
3942 mystyle->SetTitleBorderSize(0);
3943 mystyle->SetOptFit(1111);
3947 TClonesArray *RecHits3D = pRICH->RecHitsAddress3D(2);
3948 Int_t nrechits3D = RecHits3D->GetEntriesFast();
3949 TClonesArray *RecHits1D = pRICH->RecHitsAddress1D(2);
3950 Int_t nrechits1D = RecHits1D->GetEntriesFast();
3956 c1 = new TCanvas("c1","Alice RICH digits",50,50,300,350);
3957 hc0->SetXTitle("ix (npads)");
3961 c2 = new TCanvas("c2","Hits per type",100,100,600,700);
3963 //c4->SetFillColor(42);
3966 feedback->SetXTitle("x (cm)");
3967 feedback->SetYTitle("y (cm)");
3968 feedback->Draw("colz");
3971 //mip->SetFillColor(5);
3972 mip->SetXTitle("x (cm)");
3973 mip->SetYTitle("y (cm)");
3977 //cerenkov->SetFillColor(5);
3978 cerenkov->SetXTitle("x (cm)");
3979 cerenkov->SetYTitle("y (cm)");
3980 cerenkov->Draw("colz");
3983 //h->SetFillColor(5);
3984 h->SetXTitle("x (cm)");
3985 h->SetYTitle("y (cm)");
3988 c3 = new TCanvas("c3","Hits distribution",150,150,600,350);
3990 //c10->SetFillColor(42);
3993 hitsX->SetFillColor(5);
3994 hitsX->SetXTitle("(cm)");
3998 hitsY->SetFillColor(5);
3999 hitsY->SetXTitle("(cm)");
4007 c4 = new TCanvas("c4","Photon Spectra",50,50,600,350);
4009 //c6->SetFillColor(42);
4012 phspectra2->SetFillColor(5);
4013 phspectra2->SetXTitle("energy (eV)");
4016 phspectra1->SetFillColor(5);
4017 phspectra1->SetXTitle("energy (eV)");
4020 c5 = new TCanvas("c5","Particles Spectra",100,100,600,700);
4022 //c9->SetFillColor(42);
4025 pionspectra->SetFillColor(5);
4026 pionspectra->SetXTitle("(GeV)");
4027 pionspectra->Draw();
4030 protonspectra->SetFillColor(5);
4031 protonspectra->SetXTitle("(GeV)");
4032 protonspectra->Draw();
4035 kaonspectra->SetFillColor(5);
4036 kaonspectra->SetXTitle("(GeV)");
4037 kaonspectra->Draw();
4040 chargedspectra->SetFillColor(5);
4041 chargedspectra->SetXTitle("(GeV)");
4042 chargedspectra->Draw();
4051 c6=new TCanvas("c6","Clusters Statistics",50,50,600,700);
4053 //c3->SetFillColor(42);
4058 Clcharge->SetFillColor(5);
4059 Clcharge->SetXTitle("ADC counts");
4062 Clcharge->Fit("expo");
4063 //expo->SetLineColor(2);
4064 //expo->SetLineWidth(3);
4069 padnumber->SetFillColor(5);
4070 padnumber->SetXTitle("(counts)");
4074 clusev->SetFillColor(5);
4075 clusev->SetXTitle("(counts)");
4078 clusev->Fit("gaus");
4079 //gaus->SetLineColor(2);
4080 //gaus->SetLineWidth(3);
4085 padsmip->SetFillColor(5);
4086 padsmip->SetXTitle("(counts)");
4092 c11 = new TCanvas("c11","Cherenkov per Mip",400,10,600,700);
4093 mother->SetFillColor(5);
4094 mother->SetXTitle("counts");
4098 c7 = new TCanvas("c7","Production Statistics",100,100,600,700);
4100 //c7->SetFillColor(42);
4103 totalphotonsevent->SetFillColor(5);
4104 totalphotonsevent->SetXTitle("Photons (counts)");
4107 totalphotonsevent->Fit("gaus");
4108 //gaus->SetLineColor(2);
4109 //gaus->SetLineWidth(3);
4111 totalphotonsevent->Draw();
4114 photev->SetFillColor(5);
4115 photev->SetXTitle("(counts)");
4118 photev->Fit("gaus");
4119 //gaus->SetLineColor(2);
4120 //gaus->SetLineWidth(3);
4125 feedev->SetFillColor(5);
4126 feedev->SetXTitle("(counts)");
4129 feedev->Fit("gaus");
4130 //gaus->SetLineColor(2);
4131 //gaus->SetLineWidth(3);
4136 padsev->SetFillColor(5);
4137 padsev->SetXTitle("(counts)");
4140 padsev->Fit("gaus");
4141 //gaus->SetLineColor(2);
4142 //gaus->SetLineWidth(3);
4153 c8 = new TCanvas("c8","3D reconstruction of Phi angle",50,50,300,1050);
4155 //c2->SetFillColor(42);
4160 hitsPhi->SetFillColor(5);
4162 hitsPhi->Fit("gaus");
4167 OriginalPhi->SetFillColor(5);
4169 OriginalPhi->Fit("gaus");
4170 OriginalPhi->Draw();
4174 Phi->SetFillColor(5);
4179 c9 = new TCanvas("c9","3D reconstruction of theta angle",75,75,300,1050);
4184 hitsTheta->SetFillColor(5);
4186 hitsTheta->Fit("gaus");
4191 OriginalTheta->SetFillColor(5);
4193 OriginalTheta->Fit("gaus");
4194 OriginalTheta->Draw();
4198 Theta->SetFillColor(5);
4203 c10 = new TCanvas("c10","3D reconstruction of cherenkov angle",100,100,300,1050);
4208 ckovangle->SetFillColor(5);
4209 ckovangle->SetXTitle("angle (radians)");
4211 ckovangle->Fit("gaus");
4216 OriginalOmega->SetFillColor(5);
4217 OriginalOmega->SetXTitle("angle (radians)");
4219 OriginalOmega->Fit("gaus");
4220 OriginalOmega->Draw();
4224 Omega3D->SetFillColor(5);
4225 Omega3D->SetXTitle("angle (radians)");
4227 Omega3D->Fit("gaus");
4231 c11 = new TCanvas("c11","3D reconstruction of mean radius",125,125,300,700);
4236 radius->SetFillColor(5);
4237 radius->SetXTitle("radius (cm)");
4242 MeanRadius->SetFillColor(5);
4243 MeanRadius->SetXTitle("radius (cm)");
4247 c12 = new TCanvas("c12","Cerenkov angle vs. Momentum",150,150,550,350);
4250 identification->SetFillColor(5);
4251 identification->SetXTitle("Momentum (GeV/c)");
4252 identification->SetYTitle("Cherenkov angle (radians)");
4254 //Float_t pionmass=.139;
4255 //Float_t kaonmass=.493;
4256 //Float_t protonmass=.938;
4259 TF1 *pionplot = new TF1("pion","acos(sqrt((.139*.139+x*x)/(x*x*1.285*1.285)))",1,5);
4260 TF1 *kaonplot = new TF1("kaon","acos(sqrt((.439*.439+x*x)/(x*x*1.285*1.285)))",1,5);
4261 TF1 *protonplot = new TF1("proton","acos(sqrt((.938*.938+x*x)/(x*x*1.285*1.285)))",1,5);
4263 identification->Draw();
4265 pionplot->SetLineColor(5);
4266 pionplot->Draw("same");
4268 kaonplot->SetLineColor(4);
4269 kaonplot->Draw("same");
4271 protonplot->SetLineColor(3);
4272 protonplot->Draw("same");
4273 //identification->Draw("same");
4277 c13 = new TCanvas("c13","Reconstruction Errors",200,200,900,350);
4281 PhiError->SetFillColor(5);
4283 PhiError->Fit("gaus");
4286 ThetaError->SetFillColor(5);
4288 ThetaError->Fit("gaus");
4291 OmegaError->SetFillColor(5);
4292 OmegaError->SetXTitle("angle (radians)");
4294 OmegaError->Fit("gaus");
4301 c9 = new TCanvas("c9","1D Reconstruction",100,100,1100,700);
4303 //c5->SetFillColor(42);
4306 ckovangle->SetFillColor(5);
4307 ckovangle->SetXTitle("angle (radians)");
4311 radius->SetFillColor(5);
4312 radius->SetXTitle("radius (cm)");
4316 hc0->SetXTitle("pads");
4320 Omega1D->SetFillColor(5);
4321 Omega1D->SetXTitle("angle (radians)");
4325 PhotonCer->SetFillColor(5);
4326 PhotonCer->SetXTitle("angle (radians)");
4330 PadsUsed->SetXTitle("pads");
4331 PadsUsed->Draw("box");
4338 printf("Drawing histograms.../n");
4342 c10 = new TCanvas("c10","Alice RICH digits",50,50,1200,700);
4344 //c1->SetFillColor(42);
4347 hc1->SetXTitle("ix (npads)");
4350 hc2->SetXTitle("ix (npads)");
4353 hc3->SetXTitle("ix (npads)");
4356 hc4->SetXTitle("ix (npads)");
4359 hc5->SetXTitle("ix (npads)");
4362 hc6->SetXTitle("ix (npads)");
4365 hc7->SetXTitle("ix (npads)");
4368 hc0->SetXTitle("ix (npads)");
4372 c11 = new TCanvas("c11","Hits per type",100,100,600,700);
4374 //c4->SetFillColor(42);
4377 feedback->SetXTitle("x (cm)");
4378 feedback->SetYTitle("y (cm)");
4382 //mip->SetFillColor(5);
4383 mip->SetXTitle("x (cm)");
4384 mip->SetYTitle("y (cm)");
4388 //cerenkov->SetFillColor(5);
4389 cerenkov->SetXTitle("x (cm)");
4390 cerenkov->SetYTitle("y (cm)");
4394 //h->SetFillColor(5);
4395 h->SetXTitle("x (cm)");
4396 h->SetYTitle("y (cm)");
4399 c12 = new TCanvas("c12","Hits distribution",150,150,600,350);
4401 //c10->SetFillColor(42);
4404 hitsX->SetFillColor(5);
4405 hitsX->SetXTitle("(cm)");
4409 hitsY->SetFillColor(5);
4410 hitsY->SetXTitle("(cm)");
4418 // calculate the number of pads which give a signal
4422 /*for (Int_t i=0;i< NpadX;i++) {
4423 for (Int_t j=0;j< NpadY;j++) {
4429 //printf("The total number of pads which give a signal: %d %d\n",Nh,Nh1);
4430 printf("\nEnd of analysis\n");
4431 printf("**********************************\n");
4434 ////////////////////////////////////////////////////////////////////////
4435 void AliRICH::MakeBranchInTreeD(TTree *treeD, const char *file)
4438 // Create TreeD branches for the RICH.
4441 const Int_t kBufferSize = 4000;
4442 char branchname[30];
4445 // one branch for digits per chamber
4447 for (Int_t i=0; i<kNCH ;i++) {
4448 sprintf(branchname,"%sDigits%d",GetName(),i+1);
4449 if (fDchambers && treeD) {
4450 MakeBranchInTree(treeD,
4451 branchname, &((*fDchambers)[i]), kBufferSize, file);
4452 // printf("Making Branch %s for digits in chamber %d\n",branchname,i+1);
4456 ////////////////////////////////////////////////////////////////////////