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 **************************************************************************/
19 Revision 1.60 2002/10/22 16:28:21 alibrary
20 Introducing Riostream.h
22 Revision 1.59 2002/10/14 14:57:31 hristov
23 Merging the VirtualMC branch to the main development branch (HEAD)
25 Revision 1.58.6.1 2002/06/10 15:12:46 hristov
28 Revision 1.58 2001/11/14 09:49:37 dibari
31 Revision 1.57 2001/11/09 17:29:31 dibari
32 Setters fro models moved to header
34 Revision 1.56 2001/11/02 15:37:25 hristov
35 Digitizer class created. Code cleaning and bug fixes (J.Chudoba)
37 Revision 1.55 2001/10/23 13:03:35 hristov
38 The access to several data members was changed from public to protected. The digitisation was adapted to the multi-event case (J.Chudoba)
40 Revision 1.54 2001/09/07 08:38:10 hristov
41 Pointers initialised to 0 in the default constructors
43 Revision 1.53 2001/08/30 09:51:23 hristov
44 The operator[] is replaced by At() or AddAt() in case of TObjArray.
46 Revision 1.52 2001/05/16 14:57:20 alibrary
47 New files for folders and Stack
49 Revision 1.51 2001/05/14 10:18:55 hristov
50 Default arguments declared once
52 Revision 1.50 2001/05/10 14:44:16 jbarbosa
53 Corrected some overlaps (thanks I. Hrivnacovna).
55 Revision 1.49 2001/05/10 12:23:49 jbarbosa
56 Repositioned the RICH modules.
57 Eliminated magic numbers.
58 Incorporated diagnostics (from macros).
60 Revision 1.48 2001/03/15 10:35:00 jbarbosa
61 Corrected bug in MakeBranch (was using a different version of STEER)
63 Revision 1.47 2001/03/14 18:13:56 jbarbosa
64 Several changes to adapt to new IO.
65 Removed digitising function, using AliRICHMerger::Digitise from now on.
67 Revision 1.46 2001/03/12 17:46:33 hristov
68 Changes needed on Sun with CC 5.0
70 Revision 1.45 2001/02/27 22:11:46 jbarbosa
71 Testing TreeS, removing of output.
73 Revision 1.44 2001/02/27 15:19:12 jbarbosa
74 Transition to SDigits.
76 Revision 1.43 2001/02/23 17:19:06 jbarbosa
77 Corrected photocathode definition in BuildGeometry().
79 Revision 1.42 2001/02/13 20:07:23 jbarbosa
80 Parametrised definition of photcathode dimensions. New spacers. New data members in AliRICHHit to store particle momentum
81 when entering the freon. Corrected calls to particle stack.
83 Revision 1.41 2001/01/26 20:00:20 hristov
84 Major upgrade of AliRoot code
86 Revision 1.40 2001/01/24 20:58:03 jbarbosa
87 Enhanced BuildGeometry. Now the photocathodes are drawn.
89 Revision 1.39 2001/01/22 21:40:24 jbarbosa
90 Removing magic numbers
92 Revision 1.37 2000/12/20 14:07:25 jbarbosa
93 Removed dependencies on TGeant3 (thanks to F. Carminati and I. Hrivnacova)
95 Revision 1.36 2000/12/18 17:45:54 jbarbosa
96 Cleaned up PadHits object.
98 Revision 1.35 2000/12/15 16:49:40 jbarbosa
99 Geometry and materials updates (wire supports, pcbs, backplane supports, frame).
101 Revision 1.34 2000/11/10 18:12:12 jbarbosa
102 Bug fix for AliRICHCerenkov (thanks to P. Hristov)
104 Revision 1.33 2000/11/02 10:09:01 jbarbosa
105 Minor bug correction (some pointers were not initialised in the default constructor)
107 Revision 1.32 2000/11/01 15:32:55 jbarbosa
108 Updated to handle both reconstruction algorithms.
110 Revision 1.31 2000/10/26 20:18:33 jbarbosa
111 Supports for methane and freon vessels
113 Revision 1.30 2000/10/24 13:19:12 jbarbosa
116 Revision 1.29 2000/10/19 19:39:25 jbarbosa
117 Some more changes to geometry. Further correction of digitisation "per part. type"
119 Revision 1.28 2000/10/17 20:50:57 jbarbosa
120 Inversed digtise by particle type (now, only the selected particle type is not digitsed).
121 Corrected several geometry minor bugs.
122 Added new parameter (opaque quartz thickness).
124 Revision 1.27 2000/10/11 10:33:55 jbarbosa
125 Corrected bug introduced by earlier revisions (CerenkovData array cannot be reset to zero on wach call of StepManager)
127 Revision 1.26 2000/10/03 21:44:08 morsch
128 Use AliSegmentation and AliHit abstract base classes.
130 Revision 1.25 2000/10/02 21:28:12 fca
131 Removal of useless dependecies via forward declarations
133 Revision 1.24 2000/10/02 15:43:17 jbarbosa
134 Fixed forward declarations.
135 Fixed honeycomb density.
136 Fixed cerenkov storing.
139 Revision 1.23 2000/09/13 10:42:14 hristov
140 Minor corrections for HP, DEC and Sun; strings.h included
142 Revision 1.22 2000/09/12 18:11:13 fca
143 zero hits area before using
145 Revision 1.21 2000/07/21 10:21:07 morsch
146 fNrawch = 0; and fNrechits = 0; in the default constructor.
148 Revision 1.20 2000/07/10 15:28:39 fca
149 Correction of the inheritance scheme
151 Revision 1.19 2000/06/30 16:29:51 dibari
152 Added kDebugLevel variable to control output size on demand
154 Revision 1.18 2000/06/12 15:15:46 jbarbosa
157 Revision 1.17 2000/06/09 14:58:37 jbarbosa
158 New digitisation per particle type
160 Revision 1.16 2000/04/19 12:55:43 morsch
161 Newly structured and updated version (JB, AM)
166 ////////////////////////////////////////////////
167 // Manager and hits classes for set:RICH //
168 ////////////////////////////////////////////////
176 #include <TObjArray.h>
179 #include <TParticle.h>
180 #include <TGeometry.h>
188 #include <Riostream.h>
192 #include "AliSegmentation.h"
193 #include "AliRICHSegmentationV0.h"
194 #include "AliRICHHit.h"
195 #include "AliRICHCerenkov.h"
196 #include "AliRICHSDigit.h"
197 #include "AliRICHDigit.h"
198 #include "AliRICHTransientDigit.h"
199 #include "AliRICHRawCluster.h"
200 #include "AliRICHRecHit1D.h"
201 #include "AliRICHRecHit3D.h"
202 #include "AliRICHHitMapA1.h"
203 #include "AliRICHClusterFinder.h"
204 #include "AliRICHMerger.h"
205 #include "AliRICHDigitizer.h"
207 #include "AliRunDigitizer.h"
210 #include "AliConst.h"
212 #include "AliPoints.h"
217 static Int_t sMaxIterPad=0; // Static variables for the pad-hit iterator routines
218 static Int_t sCurIterPad=0;
222 //___________________________________________
223 // RICH manager class
226 <img src="gif/alirich.gif">
232 // Default ctor should not contain any new operators
233 cout<<ClassName()<<"::named ctor(sName,sTitle)>\n"; // no way to control it as ctor is called before call to SetDebugXXXX()
246 for (Int_t i=0; i<7; i++){
255 }//AliRICH::AliRICH()
257 AliRICH::AliRICH(const char *name, const char *title)
258 : AliDetector(name,title)
261 cout<<ClassName()<<"::named ctor(sName,sTitle)>\n"; // no way to control it as ctor is called before call to SetDebugXXXX()
263 fHits = new TClonesArray("AliRICHHit",1000 );
264 gAlice->AddHitList(fHits);
265 fSDigits = new TClonesArray("AliRICHSDigit",100000);
266 fCerenkovs = new TClonesArray("AliRICHCerenkov",1000);
267 gAlice->AddHitList(fCerenkovs);
272 //fNdch = new Int_t[kNCH];
274 fDchambers = new TObjArray(kNCH);
276 fRecHits1D = new TObjArray(kNCH);
277 fRecHits3D = new TObjArray(kNCH);
281 for (i=0; i<kNCH ;i++) {
282 //PH (*fDchambers)[i] = new TClonesArray("AliRICHDigit",10000);
283 fDchambers->AddAt(new TClonesArray("AliRICHDigit",10000), i);
287 //fNrawch = new Int_t[kNCH];
289 fRawClusters = new TObjArray(kNCH);
290 //printf("Created fRwClusters with adress:%p",fRawClusters);
292 for (i=0; i<kNCH ;i++) {
293 //PH (*fRawClusters)[i] = new TClonesArray("AliRICHRawCluster",10000);
294 fRawClusters->AddAt(new TClonesArray("AliRICHRawCluster",10000), i);
298 //fNrechits = new Int_t[kNCH];
300 for (i=0; i<kNCH ;i++) {
301 //PH (*fRecHits1D)[i] = new TClonesArray("AliRICHRecHit1D",1000);
302 fRecHits1D->AddAt(new TClonesArray("AliRICHRecHit1D",1000), i);
304 for (i=0; i<kNCH ;i++) {
305 //PH (*fRecHits3D)[i] = new TClonesArray("AliRICHRecHit3D",1000);
306 fRecHits3D->AddAt(new TClonesArray("AliRICHRecHit3D",1000), i);
308 //printf("Created fRecHits with adress:%p",fRecHits);
311 SetMarkerColor(kRed);
313 /*fChambers = new TObjArray(kNCH);
314 for (i=0; i<kNCH; i++)
315 (*fChambers)[i] = new AliRICHChamber();*/
321 AliRICH::AliRICH(const AliRICH& RICH)
329 // Dtor of RICH manager class
330 if(IsDebugStart()) cout<<ClassName()<<"::default dtor()>\n";
337 //PH Delete TObjArrays
343 fDchambers->Delete();
347 fRawClusters->Delete();
351 fRecHits1D->Delete();
355 fRecHits3D->Delete();
362 //_____________________________________________________________________________
363 Int_t AliRICH::Hits2SDigits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, ResponseType res)
365 // Calls the charge disintegration method of the current chamber and adds
366 // the simulated cluster to the root tree
367 if(IsDebugHit()||IsDebugDigit()) cout<<ClassName()<<"::Hits2SDigits(...)>\n";
370 Float_t newclust[4][500];
374 // Integrated pulse height on chamber
378 ((AliRICHChamber*)fChambers->At(idvol))->DisIntegration(eloss, xhit, yhit, nnew, newclust, res);
383 for (Int_t i=0; i<nnew; i++) {
384 if (Int_t(newclust[0][i]) > 0) {
387 clhits[1] = Int_t(newclust[0][i]);
389 clhits[2] = Int_t(newclust[1][i]);
391 clhits[3] = Int_t(newclust[2][i]);
392 // Pad: chamber sector
393 clhits[4] = Int_t(newclust[3][i]);
395 //printf(" %d %d %d %d %d\n", clhits[0], clhits[1], clhits[2], clhits[3], clhits[4]);
401 if (gAlice->TreeS()){
402 gAlice->TreeS()->Fill();
403 gAlice->TreeS()->Write(0,TObject::kOverwrite);
404 //printf("Filled SDigits...\n");
408 }//Int_t AliRICH::Hits2SDigits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, ResponseType res)
410 void AliRICH::Hits2SDigits()
412 // Dummy: sdigits are created during transport.
413 // Called from alirun.
414 if(IsDebugHit()||IsDebugDigit()) cout<<ClassName()<<"::Hits2SDigits()>\n";
417 int nparticles = gAlice->GetNtrack();
418 cout << "Particles (RICH):" <<nparticles<<endl;
419 if (nparticles > 0) printf("SDigits were already generated.\n");
423 //___________________________________________
424 void AliRICH::SDigits2Digits(Int_t nev, Int_t flag)
427 // Called from macro. Multiple events, more functionality.
428 if(IsDebugDigit()) cout<<ClassName()<<"::SDigits2Digits()>\n";
430 //AliRICHChamber* iChamber;
432 //printf("Generating tresholds...\n");
434 //for(Int_t i=0;i<7;i++) {
435 //iChamber = &(Chamber(i));
436 //iChamber->GenerateTresholds();
439 //int nparticles = gAlice->GetNtrack();
440 //cout << "Particles (RICH):" <<nparticles<<endl;
441 //if (nparticles <= 0) return;
443 //fMerger = new AliRICHMerger();
448 //fMerger->Digitise(nev,flag);
450 AliRunDigitizer * manager = new AliRunDigitizer(1,1);
451 manager->SetInputStream(0,"galice.root");
452 //AliRICHDigitizer *dRICH = new AliRICHDigitizer(manager);
453 manager->Exec("deb");
456 //___________________________________________
457 void AliRICH::SDigits2Digits()
461 //___________________________________________
462 void AliRICH::Digits2Reco()
465 // Called from alirun, single event only.
466 if(IsDebugDigit()||IsDebugReco()) cout<<ClassName()<<"::Digits2Reco()>\n";
469 int nparticles = gAlice->GetNtrack();
470 cout << "Particles (RICH):" <<nparticles<<endl;
471 if (nparticles > 0) FindClusters(0,0);
475 void AliRICH::AddHit(Int_t track, Int_t *vol, Float_t *hits)
477 // Adds the current hit to the RICH hits list
478 if(IsDebugHit()) cout<<ClassName()<<"::AddHit(...)>\n";
480 TClonesArray &lhits = *fHits;
481 new(lhits[fNhits++]) AliRICHHit(fIshunt,track,vol,hits);
484 void AliRICH::AddCerenkov(Int_t track, Int_t *vol, Float_t *cerenkovs)
486 // Adds a RICH cerenkov hit to the Cerenkov Hits list
487 if(IsDebugHit()) cout<<ClassName()<<"::AddCerenkov()>\n";
489 TClonesArray &lcerenkovs = *fCerenkovs;
490 new(lcerenkovs[fNcerenkovs++]) AliRICHCerenkov(fIshunt,track,vol,cerenkovs);
493 void AliRICH::AddSDigit(Int_t *aSDigit)
495 // Adds the current S digit to the RICH list of S digits
496 if(IsDebugDigit()) cout<<ClassName()<<"::AddSDigit()>\n";
498 TClonesArray &lSDigits = *fSDigits;
499 new(lSDigits[fNSDigits++]) AliRICHSDigit(aSDigit);
503 void AliRICH::AddDigits(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
505 // Add a RICH digit to the list
506 if(IsDebugDigit()) cout<<ClassName()<<"::AddDigit()>\n";
508 TClonesArray &ldigits = *((TClonesArray*)fDchambers->At(id));
509 new(ldigits[fNdch[id]++]) AliRICHDigit(tracks,charges,digits);
512 void AliRICH::AddRawCluster(Int_t id, const AliRICHRawCluster& c)
514 // Add a RICH digit to the list
517 cout<<ClassName()<<"::AddRawCluster()>\n";
519 //PH TClonesArray &lrawcl = *((TClonesArray*)(*fRawClusters)[id]);
520 TClonesArray &lrawcl = *((TClonesArray*)fRawClusters->At(id));
521 new(lrawcl[fNrawch[id]++]) AliRICHRawCluster(c);
524 //_____________________________________________________________________________
525 void AliRICH::AddRecHit1D(Int_t id, Float_t *rechit, Float_t *photons, Int_t *padsx, Int_t* padsy)
529 // Add a RICH reconstructed hit to the list
532 //PH TClonesArray &lrec1D = *((TClonesArray*)(*fRecHits1D)[id]);
533 TClonesArray &lrec1D = *((TClonesArray*)fRecHits1D->At(id));
534 new(lrec1D[fNrechits1D[id]++]) AliRICHRecHit1D(id,rechit,photons,padsx,padsy);
537 //_____________________________________________________________________________
538 void AliRICH::AddRecHit3D(Int_t id, Float_t *rechit, Float_t omega, Float_t theta, Float_t phi)
540 // Add a RICH reconstructed hit to the list
542 TClonesArray &lrec3D = *((TClonesArray*)fRecHits3D->At(id));
543 new(lrec3D[fNrechits3D[id]++]) AliRICHRecHit3D(id,rechit,omega,theta,phi);
546 //___________________________________________
547 void AliRICH::BuildGeometry()
552 // Builds a TNode geometry for event display
554 TNode *node, *subnode, *top;
556 const int kColorRICH = kRed;
558 top=gAlice->GetGeometry()->GetNode("alice");
560 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
561 AliRICHSegmentationV0* segmentation;
562 AliRICHChamber* iChamber;
563 AliRICHGeometry* geometry;
565 iChamber = &(pRICH->Chamber(0));
566 segmentation=(AliRICHSegmentationV0*) iChamber->GetSegmentationModel();
567 geometry=iChamber->GetGeometryModel();
569 new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15);
571 Float_t padplane_width = segmentation->GetPadPlaneWidth();
572 Float_t padplane_length = segmentation->GetPadPlaneLength();
574 //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());
576 new TBRIK("PHOTO","PHOTO","void", padplane_width/2,.1,padplane_length/2);
578 //printf("\n\n\n\n\n Padplane w: %f l: %f \n\n\n\n\n", padplane_width/2,padplane_length/2);
579 //printf("\n\n\n\n\n Padplane w: %f l: %f \n\n\n\n\n", segmentation->GetPadPlaneWidth(), segmentation->GetPadPlaneLength());
581 Float_t offset = 490 + 1.276 - geometry->GetGapThickness()/2; //distance from center of mother volume to methane
582 Float_t deltaphi = 19.5; //phi angle between center of chambers - z direction
583 Float_t deltatheta = 20; //theta angle between center of chambers - x direction
584 Float_t cosphi = TMath::Cos(deltaphi*TMath::Pi()/180);
585 Float_t sinphi = TMath::Sin(deltaphi*TMath::Pi()/180);
586 Float_t costheta = TMath::Cos(deltatheta*TMath::Pi()/180);
587 Float_t sintheta = TMath::Sin(deltatheta*TMath::Pi()/180);
589 //printf("\n\n%f %f %f %f %f %f %f\n\n",offset,deltatheta,deltaphi,cosphi,costheta,sinphi,sintheta);
591 new TRotMatrix("rot993","rot993",90., 0. , 90. - deltaphi, 90. , deltaphi, -90. );
592 new TRotMatrix("rot994","rot994",90., -deltatheta , 90. , 90.- deltatheta , 0. , 0. );
593 new TRotMatrix("rot995","rot995",90., 0. , 90. , 90. , 0. , 0. );
594 new TRotMatrix("rot996","rot996",90., deltatheta , 90. , 90 + deltatheta , 0. , 0. );
595 new TRotMatrix("rot997","rot997",90., 360. - deltatheta, 108.2 , 90.- deltatheta ,18.2 , 90 - deltatheta);
596 new TRotMatrix("rot998","rot998",90., 0. , 90 + deltaphi , 90. , deltaphi, 90. );
597 new TRotMatrix("rot999","rot999",90., deltatheta , 108.2 , 90.+ deltatheta ,18.2 , 90 + deltatheta);
599 Float_t pos1[3]={0. , offset*cosphi , offset*sinphi};
600 Float_t pos2[3]={offset*sintheta , offset*costheta , 0. };
601 Float_t pos3[3]={0. , offset , 0.};
602 Float_t pos4[3]={-offset*sintheta , offset*costheta , 0.};
603 Float_t pos5[3]={offset*sinphi , offset*costheta*cosphi, -offset*sinphi};
604 Float_t pos6[3]={0. , offset*cosphi , -offset*sinphi};
605 Float_t pos7[3]={ -offset*sinphi , offset*costheta*cosphi, -offset*sinphi};
609 //Float_t pos1[3]={0,471.8999,165.2599};
610 //Chamber(0).SetChamberTransform(pos1[0],pos1[1],pos1[2],
611 //new TRotMatrix("rot993","rot993",90,0,70.69,90,19.30999,-90);
612 node = new TNode("RICH1","RICH1","S_RICH",pos1[0],pos1[1],pos1[2],"rot993");
613 node->SetLineColor(kColorRICH);
615 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
616 subnode->SetLineColor(kGreen);
617 fNodes->Add(subnode);
618 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
619 subnode->SetLineColor(kGreen);
620 fNodes->Add(subnode);
621 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
622 subnode->SetLineColor(kGreen);
623 fNodes->Add(subnode);
624 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
625 subnode->SetLineColor(kGreen);
626 fNodes->Add(subnode);
627 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
628 subnode->SetLineColor(kGreen);
629 fNodes->Add(subnode);
630 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
631 subnode->SetLineColor(kGreen);
632 fNodes->Add(subnode);
637 //Float_t pos2[3]={171,470,0};
638 //Chamber(1).SetChamberTransform(pos2[0],pos2[1],pos2[2],
639 //new TRotMatrix("rot994","rot994",90,-20,90,70,0,0);
640 node = new TNode("RICH2","RICH2","S_RICH",pos2[0],pos2[1],pos2[2],"rot994");
641 node->SetLineColor(kColorRICH);
643 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
644 subnode->SetLineColor(kGreen);
645 fNodes->Add(subnode);
646 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
647 subnode->SetLineColor(kGreen);
648 fNodes->Add(subnode);
649 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
650 subnode->SetLineColor(kGreen);
651 fNodes->Add(subnode);
652 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
653 subnode->SetLineColor(kGreen);
654 fNodes->Add(subnode);
655 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
656 subnode->SetLineColor(kGreen);
657 fNodes->Add(subnode);
658 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
659 subnode->SetLineColor(kGreen);
660 fNodes->Add(subnode);
665 //Float_t pos3[3]={0,500,0};
666 //Chamber(2).SetChamberTransform(pos3[0],pos3[1],pos3[2],
667 //new TRotMatrix("rot995","rot995",90,0,90,90,0,0);
668 node = new TNode("RICH3","RICH3","S_RICH",pos3[0],pos3[1],pos3[2],"rot995");
669 node->SetLineColor(kColorRICH);
671 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
672 subnode->SetLineColor(kGreen);
673 fNodes->Add(subnode);
674 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
675 subnode->SetLineColor(kGreen);
676 fNodes->Add(subnode);
677 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
678 subnode->SetLineColor(kGreen);
679 fNodes->Add(subnode);
680 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
681 subnode->SetLineColor(kGreen);
682 fNodes->Add(subnode);
683 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
684 subnode->SetLineColor(kGreen);
685 fNodes->Add(subnode);
686 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
687 subnode->SetLineColor(kGreen);
688 fNodes->Add(subnode);
692 //Float_t pos4[3]={-171,470,0};
693 //Chamber(3).SetChamberTransform(pos4[0],pos4[1],pos4[2],
694 //new TRotMatrix("rot996","rot996",90,20,90,110,0,0);
695 node = new TNode("RICH4","RICH4","S_RICH",pos4[0],pos4[1],pos4[2],"rot996");
696 node->SetLineColor(kColorRICH);
698 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
699 subnode->SetLineColor(kGreen);
700 fNodes->Add(subnode);
701 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
702 subnode->SetLineColor(kGreen);
703 fNodes->Add(subnode);
704 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
705 subnode->SetLineColor(kGreen);
706 fNodes->Add(subnode);
707 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
708 subnode->SetLineColor(kGreen);
709 fNodes->Add(subnode);
710 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
711 subnode->SetLineColor(kGreen);
712 fNodes->Add(subnode);
713 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
714 subnode->SetLineColor(kGreen);
715 fNodes->Add(subnode);
720 //Float_t pos5[3]={161.3999,443.3999,-165.3};
721 //Chamber(4).SetChamberTransform(pos5[0],pos5[1],pos5[2],
722 //new TRotMatrix("rot997","rot997",90,340,108.1999,70,18.2,70);
723 node = new TNode("RICH5","RICH5","S_RICH",pos5[0],pos5[1],pos5[2],"rot997");
724 node->SetLineColor(kColorRICH);
726 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
727 subnode->SetLineColor(kGreen);
728 fNodes->Add(subnode);
729 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
730 subnode->SetLineColor(kGreen);
731 fNodes->Add(subnode);
732 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
733 subnode->SetLineColor(kGreen);
734 fNodes->Add(subnode);
735 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
736 subnode->SetLineColor(kGreen);
737 fNodes->Add(subnode);
738 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
739 subnode->SetLineColor(kGreen);
740 fNodes->Add(subnode);
741 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
742 subnode->SetLineColor(kGreen);
743 fNodes->Add(subnode);
748 //Float_t pos6[3]={0., 471.9, -165.3,};
749 //Chamber(5).SetChamberTransform(pos6[0],pos6[1],pos6[2],
750 //new TRotMatrix("rot998","rot998",90,0,109.3099,90,19.30999,90);
751 node = new TNode("RICH6","RICH6","S_RICH",pos6[0],pos6[1],pos6[2],"rot998");
752 node->SetLineColor(kColorRICH);
753 fNodes->Add(node);node->cd();
754 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
755 subnode->SetLineColor(kGreen);
756 fNodes->Add(subnode);
757 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
758 subnode->SetLineColor(kGreen);
759 fNodes->Add(subnode);
760 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
761 subnode->SetLineColor(kGreen);
762 fNodes->Add(subnode);
763 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
764 subnode->SetLineColor(kGreen);
765 fNodes->Add(subnode);
766 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
767 subnode->SetLineColor(kGreen);
768 fNodes->Add(subnode);
769 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
770 subnode->SetLineColor(kGreen);
771 fNodes->Add(subnode);
775 //Float_t pos7[3]={-161.399,443.3999,-165.3};
776 //Chamber(6).SetChamberTransform(pos7[0],pos7[1],pos7[2],
777 //new TRotMatrix("rot999","rot999",90,20,108.1999,110,18.2,110);
778 node = new TNode("RICH7","RICH7","S_RICH",pos7[0],pos7[1],pos7[2],"rot999");
779 node->SetLineColor(kColorRICH);
781 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
782 subnode->SetLineColor(kGreen);
783 fNodes->Add(subnode);
784 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
785 subnode->SetLineColor(kGreen);
786 fNodes->Add(subnode);
787 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
788 subnode->SetLineColor(kGreen);
789 fNodes->Add(subnode);
790 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
791 subnode->SetLineColor(kGreen);
792 fNodes->Add(subnode);
793 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
794 subnode->SetLineColor(kGreen);
795 fNodes->Add(subnode);
796 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
797 subnode->SetLineColor(kGreen);
798 fNodes->Add(subnode);
803 //___________________________________________
804 void AliRICH::CreateGeometry()
807 // Create the geometry for RICH version 1
809 // Modified by: N. Colonna (INFN - BARI, Nicola.Colonna@ba.infn.it)
810 // R.A. Fini (INFN - BARI, Rosanna.Fini@ba.infn.it)
811 // R.A. Loconsole (Bari University, loco@riscom.ba.infn.it)
815 <img src="picts/AliRICHv1.gif">
820 <img src="picts/AliRICHv1Tree.gif">
824 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
825 AliRICHSegmentationV0* segmentation;
826 AliRICHGeometry* geometry;
827 AliRICHChamber* iChamber;
829 iChamber = &(pRICH->Chamber(0));
830 segmentation=(AliRICHSegmentationV0*) iChamber->GetSegmentationModel();
831 geometry=iChamber->GetGeometryModel();
834 distance = geometry->GetFreonThickness()/2 + geometry->GetQuartzThickness() + geometry->GetGapThickness();
835 geometry->SetRadiatorToPads(distance);
837 //Opaque quartz thickness
838 Float_t oqua_thickness = .5;
841 //Float_t csi_length = 160*.8 + 2.6;
842 //Float_t csi_width = 144*.84 + 2*2.6;
844 Float_t csi_width = segmentation->Npx()*segmentation->Dpx() + segmentation->DeadZone();
845 Float_t csi_length = segmentation->Npy()*segmentation->Dpy() + 2*segmentation->DeadZone();
847 //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());
849 Int_t *idtmed = fIdtmed->GetArray()-999;
856 // --- Define the RICH detector
857 // External aluminium box
859 par[1] = 13; //Original Settings
864 gMC->Gsvolu("RICH", "BOX ", idtmed[1009], par, 3);
868 par[1] = 13; //Original Settings
873 gMC->Gsvolu("SRIC", "BOX ", idtmed[1000], par, 3);
875 // Air 2 (cutting the lower part of the box)
878 par[1] = 3; //Original Settings
880 gMC->Gsvolu("AIR2", "BOX ", idtmed[1000], par, 3);
882 // Air 3 (cutting the lower part of the box)
885 par[1] = 3; //Original Settings
887 gMC->Gsvolu("AIR3", "BOX ", idtmed[1000], par, 3);
891 par[1] = .188; //Original Settings
896 gMC->Gsvolu("HONE", "BOX ", idtmed[1001], par, 3);
900 par[1] = .025; //Original Settings
905 gMC->Gsvolu("ALUM", "BOX ", idtmed[1009], par, 3);
908 par[0] = geometry->GetQuartzWidth()/2;
909 par[1] = geometry->GetQuartzThickness()/2;
910 par[2] = geometry->GetQuartzLength()/2;
912 par[1] = .25; //Original Settings
914 /*par[0] = geometry->GetQuartzWidth()/2;
915 par[1] = geometry->GetQuartzThickness()/2;
916 par[2] = geometry->GetQuartzLength()/2;*/
917 //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]);
918 gMC->Gsvolu("QUAR", "BOX ", idtmed[1002], par, 3);
920 // Spacers (cylinders)
923 par[2] = geometry->GetFreonThickness()/2;
924 gMC->Gsvolu("SPAC", "TUBE", idtmed[1002], par, 3);
926 // Feet (freon slabs supports)
931 gMC->Gsvolu("FOOT", "BOX", idtmed[1009], par, 3);
934 par[0] = geometry->GetQuartzWidth()/2;
936 par[2] = geometry->GetQuartzLength()/2;
938 par[1] = .2; //Original Settings
943 gMC->Gsvolu("OQUA", "BOX ", idtmed[1007], par, 3);
945 // Frame of opaque quartz
946 par[0] = geometry->GetOuterFreonWidth()/2;
948 par[1] = geometry->GetFreonThickness()/2;
949 par[2] = geometry->GetOuterFreonLength()/2;
952 par[1] = .5; //Original Settings
957 gMC->Gsvolu("OQF1", "BOX ", idtmed[1007], par, 3);
959 par[0] = geometry->GetInnerFreonWidth()/2;
960 par[1] = geometry->GetFreonThickness()/2;
961 par[2] = geometry->GetInnerFreonLength()/2;
962 gMC->Gsvolu("OQF2", "BOX ", idtmed[1007], par, 3);
964 // Little bar of opaque quartz
966 //par[1] = geometry->GetQuartzThickness()/2;
967 //par[2] = geometry->GetInnerFreonLength()/2 - 2.4;
968 //par[2] = geometry->GetInnerFreonLength()/2;
971 par[1] = .25; //Original Settings
976 //gMC->Gsvolu("BARR", "BOX ", idtmed[1007], par, 3);
979 par[0] = geometry->GetOuterFreonWidth()/2 - oqua_thickness;
980 par[1] = geometry->GetFreonThickness()/2;
981 par[2] = geometry->GetOuterFreonLength()/2 - 2*oqua_thickness;
983 par[1] = .5; //Original Settings
988 gMC->Gsvolu("FRE1", "BOX ", idtmed[1003], par, 3);
990 par[0] = geometry->GetInnerFreonWidth()/2 - oqua_thickness;
991 par[1] = geometry->GetFreonThickness()/2;
992 par[2] = geometry->GetInnerFreonLength()/2 - 2*oqua_thickness;
993 gMC->Gsvolu("FRE2", "BOX ", idtmed[1003], par, 3);
997 par[0] = csi_width/2;
998 par[1] = geometry->GetGapThickness()/2;
999 //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]);
1001 par[2] = csi_length/2;
1002 gMC->Gsvolu("META", "BOX ", idtmed[1004], par, 3);
1006 par[0] = csi_width/2;
1007 par[1] = geometry->GetProximityGapThickness()/2;
1008 //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]);
1010 par[2] = csi_length/2;
1011 gMC->Gsvolu("GAP ", "BOX ", idtmed[1008], par, 3);
1015 par[0] = csi_width/2;
1018 par[2] = csi_length/2;
1019 gMC->Gsvolu("CSI ", "BOX ", idtmed[1005], par, 3);
1025 gMC->Gsvolu("GRID", "TUBE", idtmed[1006], par, 3);
1030 par[0] = csi_width/2;
1033 gMC->Gsvolu("WSMe", "BOX ", idtmed[1009], par, 3);
1035 // Ceramic pick up (base)
1037 par[0] = csi_width/2;
1040 gMC->Gsvolu("WSG1", "BOX ", idtmed[1010], par, 3);
1042 // Ceramic pick up (head)
1044 par[0] = csi_width/2;
1047 gMC->Gsvolu("WSG2", "BOX ", idtmed[1010], par, 3);
1049 // Aluminium supports for methane and CsI
1052 par[0] = csi_width/2;
1053 par[1] = geometry->GetGapThickness()/2 + .25;
1054 par[2] = (68.35 - csi_length/2)/2;
1055 gMC->Gsvolu("SMSH", "BOX", idtmed[1009], par, 3);
1059 par[0] = (66.3 - csi_width/2)/2;
1060 par[1] = geometry->GetGapThickness()/2 + .25;
1061 par[2] = csi_length/2 + 68.35 - csi_length/2;
1062 gMC->Gsvolu("SMLG", "BOX", idtmed[1009], par, 3);
1064 // Aluminium supports for freon
1067 par[0] = geometry->GetQuartzWidth()/2;
1069 par[2] = (68.35 - geometry->GetQuartzLength()/2)/2;
1070 gMC->Gsvolu("SFSH", "BOX", idtmed[1009], par, 3);
1074 par[0] = (66.3 - geometry->GetQuartzWidth()/2)/2;
1076 par[2] = geometry->GetQuartzLength()/2 + 68.35 - geometry->GetQuartzLength()/2;
1077 gMC->Gsvolu("SFLG", "BOX", idtmed[1009], par, 3);
1081 par[0] = csi_width/2;
1083 par[2] = csi_length/4 -.5025;
1084 gMC->Gsvolu("PCB ", "BOX", idtmed[1011], par, 3);
1087 // Backplane supports
1094 gMC->Gsvolu("BACK", "BOX", idtmed[1009], par, 3);
1101 gMC->Gsvolu("BKHL", "BOX", idtmed[1000], par, 3);
1108 gMC->Gsvolu("BKHS", "BOX", idtmed[1000], par, 3);
1110 // Place holes inside backplane support
1112 gMC->Gspos("BKHS", 1, "BACK", .8 + 5.7,0., .6 + 4.4625, 0, "ONLY");
1113 gMC->Gspos("BKHS", 2, "BACK", -.8 - 5.7,0., .6 + 4.4625, 0, "ONLY");
1114 gMC->Gspos("BKHS", 3, "BACK", .8 + 5.7,0., -.6 - 4.4625, 0, "ONLY");
1115 gMC->Gspos("BKHS", 4, "BACK", -.8 - 5.7,0., -.6 - 4.4625, 0, "ONLY");
1116 gMC->Gspos("BKHS", 5, "BACK", .8 + 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1117 gMC->Gspos("BKHS", 6, "BACK", -.8 - 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1118 gMC->Gspos("BKHS", 7, "BACK", .8 + 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1119 gMC->Gspos("BKHS", 8, "BACK", -.8 - 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1120 gMC->Gspos("BKHL", 1, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., .6 + 4.4625, 0, "ONLY");
1121 gMC->Gspos("BKHL", 2, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 4.4625, 0, "ONLY");
1122 gMC->Gspos("BKHL", 3, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 4.4625, 0, "ONLY");
1123 gMC->Gspos("BKHL", 4, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 4.4625, 0, "ONLY");
1124 gMC->Gspos("BKHL", 5, "BACK", .8 + 11.4+ 1.6 + 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1125 gMC->Gspos("BKHL", 6, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1126 gMC->Gspos("BKHL", 7, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1127 gMC->Gspos("BKHL", 8, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1131 // --- Places the detectors defined with GSVOLU
1132 // Place material inside RICH
1133 gMC->Gspos("SRIC", 1, "RICH", 0.,0., 0., 0, "ONLY");
1134 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");
1135 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");
1136 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");
1137 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");
1140 gMC->Gspos("ALUM", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.025, 0., 0, "ONLY");
1141 gMC->Gspos("HONE", 1, "SRIC", 0., 1.276- geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .188, 0., 0, "ONLY");
1142 gMC->Gspos("ALUM", 2, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .025, 0., 0, "ONLY");
1143 gMC->Gspos("FOOT", 1, "SRIC", 64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
1144 gMC->Gspos("FOOT", 2, "SRIC", 21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3 , 36.9, 0, "ONLY");
1145 gMC->Gspos("FOOT", 3, "SRIC", -21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
1146 gMC->Gspos("FOOT", 4, "SRIC", -64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
1147 gMC->Gspos("FOOT", 5, "SRIC", 64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1148 gMC->Gspos("FOOT", 6, "SRIC", 21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1149 gMC->Gspos("FOOT", 7, "SRIC", -21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1150 gMC->Gspos("FOOT", 8, "SRIC", -64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1151 gMC->Gspos("OQUA", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .2, 0., 0, "ONLY");
1156 gMC->Gspos("SMLG", 1, "SRIC", csi_width/2 + (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
1157 gMC->Gspos("SMLG", 2, "SRIC", - csi_width/2 - (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
1158 gMC->Gspos("SMSH", 1, "SRIC", 0., 1.276 + .25, csi_length/2 + (68.35 - csi_length/2)/2, 0, "ONLY");
1159 gMC->Gspos("SMSH", 2, "SRIC", 0., 1.276 + .25, - csi_length/2 - (68.35 - csi_length/2)/2, 0, "ONLY");
1163 Float_t supp_y = 1.276 - geometry->GetGapThickness()/2- geometry->GetQuartzThickness() -geometry->GetFreonThickness() - .2 + .3; //y position of freon supports
1165 gMC->Gspos("SFLG", 1, "SRIC", geometry->GetQuartzWidth()/2 + (66.3 - geometry->GetQuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
1166 gMC->Gspos("SFLG", 2, "SRIC", - geometry->GetQuartzWidth()/2 - (66.3 - geometry->GetQuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
1167 gMC->Gspos("SFSH", 1, "SRIC", 0., supp_y, geometry->GetQuartzLength()/2 + (68.35 - geometry->GetQuartzLength()/2)/2, 0, "ONLY");
1168 gMC->Gspos("SFSH", 2, "SRIC", 0., supp_y, - geometry->GetQuartzLength()/2 - (68.35 - geometry->GetQuartzLength()/2)/2, 0, "ONLY");
1170 AliMatrix(idrotm[1019], 0., 0., 90., 0., 90., 90.);
1172 //Placing of the spacers inside the freon slabs
1174 Int_t nspacers = 30;
1175 //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);
1177 //printf("Nspacers: %d", nspacers);
1179 for (i = 0; i < nspacers/3; i++) {
1180 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
1181 gMC->Gspos("SPAC", i, "FRE1", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
1184 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
1185 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1186 gMC->Gspos("SPAC", i, "FRE1", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
1189 for (i = (nspacers*2)/3; i < nspacers; ++i) {
1190 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1191 gMC->Gspos("SPAC", i, "FRE1", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
1194 for (i = 0; i < nspacers/3; i++) {
1195 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
1196 gMC->Gspos("SPAC", i, "FRE2", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
1199 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
1200 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1201 gMC->Gspos("SPAC", i, "FRE2", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
1204 for (i = (nspacers*2)/3; i < nspacers; ++i) {
1205 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1206 gMC->Gspos("SPAC", i, "FRE2", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
1210 gMC->Gspos("FRE1", 1, "OQF1", 0., 0., 0., 0, "ONLY");
1211 gMC->Gspos("FRE2", 1, "OQF2", 0., 0., 0., 0, "ONLY");
1212 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)
1213 // printf("Opaque quartz in SRIC %f\n", 1.276 - geometry->GetGapThickness()/2- geometry->GetQuartzThickness() -geometry->GetFreonThickness()/2);
1214 gMC->Gspos("OQF2", 2, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()/2, 0., 0, "ONLY"); //Original settings
1215 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)
1216 //gMC->Gspos("BARR", 1, "QUAR", - geometry->GetInnerFreonWidth()/2 - oqua_thickness, 0., 0., 0, "ONLY"); //Original settings (-21.65)
1217 //gMC->Gspos("BARR", 2, "QUAR", geometry->GetInnerFreonWidth()/2 + oqua_thickness, 0., 0., 0, "ONLY"); //Original settings (21.65)
1218 gMC->Gspos("QUAR", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness()/2, 0., 0, "ONLY");
1219 gMC->Gspos("GAP ", 1, "META", 0., geometry->GetGapThickness()/2 - geometry->GetProximityGapThickness()/2 - 0.0001, 0., 0, "ONLY");
1220 gMC->Gspos("META", 1, "SRIC", 0., 1.276, 0., 0, "ONLY");
1221 gMC->Gspos("CSI ", 1, "SRIC", 0., 1.276 + geometry->GetGapThickness()/2 + .25, 0., 0, "ONLY");
1222 printf("CSI pos: %f\n",1.276 + geometry->GetGapThickness()/2 + .25);
1224 // Wire support placing
1226 gMC->Gspos("WSG2", 1, "GAP ", 0., geometry->GetProximityGapThickness()/2 - .1, 0., 0, "ONLY");
1227 gMC->Gspos("WSG1", 1, "CSI ", 0., 0., 0., 0, "ONLY");
1228 gMC->Gspos("WSMe", 1, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, 0., 0, "ONLY");
1230 // Backplane placing
1232 gMC->Gspos("BACK", 1, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 43.3, 0, "ONLY");
1233 gMC->Gspos("BACK", 2, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2 , 43.3, 0, "ONLY");
1234 gMC->Gspos("BACK", 3, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
1235 gMC->Gspos("BACK", 4, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
1236 gMC->Gspos("BACK", 5, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
1237 gMC->Gspos("BACK", 6, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
1241 gMC->Gspos("PCB ", 1, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, csi_width/4 + .5025 + 2.5, 0, "ONLY");
1242 gMC->Gspos("PCB ", 2, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, -csi_width/4 - .5025 - 2.5, 0, "ONLY");
1246 //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);
1248 // Place RICH inside ALICE apparatus
1252 AliMatrix(idrotm[1000], 90., 0., 70.69, 90., 19.31, -90.);
1253 AliMatrix(idrotm[1001], 90., -20., 90., 70., 0., 0.);
1254 AliMatrix(idrotm[1002], 90., 0., 90., 90., 0., 0.);
1255 AliMatrix(idrotm[1003], 90., 20., 90., 110., 0., 0.);
1256 AliMatrix(idrotm[1004], 90., 340., 108.2, 70., 18.2, 70.);
1257 AliMatrix(idrotm[1005], 90., 0., 109.31, 90., 19.31, 90.);
1258 AliMatrix(idrotm[1006], 90., 20., 108.2, 110., 18.2, 110.);
1260 gMC->Gspos("RICH", 1, "ALIC", 0., 471.9, 165.26, idrotm[1000], "ONLY");
1261 gMC->Gspos("RICH", 2, "ALIC", 171., 470., 0., idrotm[1001], "ONLY");
1262 gMC->Gspos("RICH", 3, "ALIC", 0., 500., 0., idrotm[1002], "ONLY");
1263 gMC->Gspos("RICH", 4, "ALIC", -171., 470., 0., idrotm[1003], "ONLY");
1264 gMC->Gspos("RICH", 5, "ALIC", 161.4, 443.4, -165.3, idrotm[1004], "ONLY");
1265 gMC->Gspos("RICH", 6, "ALIC", 0., 471.9, -165.3, idrotm[1005], "ONLY");
1266 gMC->Gspos("RICH", 7, "ALIC", -161.4, 443.4, -165.3, idrotm[1006], "ONLY");*/
1268 // The placing of the chambers is measured from the vertex to the base of the methane vessel (490 cm)
1270 Float_t offset = 490 + 1.276 - geometry->GetGapThickness()/2; //distance from center of mother volume to methane
1271 Float_t deltaphi = 19.5; //phi angle between center of chambers - z direction
1272 Float_t deltatheta = 20; //theta angle between center of chambers - x direction
1273 Float_t cosphi = TMath::Cos(deltaphi*TMath::Pi()/180);
1274 Float_t sinphi = TMath::Sin(deltaphi*TMath::Pi()/180);
1275 Float_t costheta = TMath::Cos(deltatheta*TMath::Pi()/180);
1276 Float_t sintheta = TMath::Sin(deltatheta*TMath::Pi()/180);
1278 //printf("\n\n%f %f %f %f %f %f %f\n\n",offset,deltatheta,deltaphi,cosphi,costheta,sinphi,sintheta);
1280 AliMatrix(idrotm[1000], 90., 0. , 90. - deltaphi, 90. , deltaphi, -90. );
1281 AliMatrix(idrotm[1001], 90., -deltatheta , 90. , 90.- deltatheta , 0. , 0. );
1282 AliMatrix(idrotm[1002], 90., 0. , 90. , 90. , 0. , 0. );
1283 AliMatrix(idrotm[1003], 90., deltatheta , 90. , 90 + deltatheta , 0. , 0. );
1284 AliMatrix(idrotm[1004], 90., 360. - deltatheta, 108.2 , 90.- deltatheta ,18.2 , 90 - deltatheta);
1285 AliMatrix(idrotm[1005], 90., 0. , 90 + deltaphi , 90. , deltaphi, 90. );
1286 AliMatrix(idrotm[1006], 90., deltatheta , 108.2 , 90.+ deltatheta ,18.2 , 90 + deltatheta);
1288 gMC->Gspos("RICH", 1, "ALIC", 0. , offset*cosphi , offset*sinphi ,idrotm[1000], "ONLY");
1289 gMC->Gspos("RICH", 2, "ALIC", (offset)*sintheta , offset*costheta , 0. ,idrotm[1001], "ONLY");
1290 gMC->Gspos("RICH", 3, "ALIC", 0. , offset , 0. ,idrotm[1002], "ONLY");
1291 gMC->Gspos("RICH", 4, "ALIC", -(offset)*sintheta, offset*costheta , 0. ,idrotm[1003], "ONLY");
1292 gMC->Gspos("RICH", 5, "ALIC", (offset)*sinphi , offset*costheta*cosphi, -offset*sinphi,idrotm[1004], "ONLY");
1293 gMC->Gspos("RICH", 6, "ALIC", 0. , offset*cosphi , -offset*sinphi,idrotm[1005], "ONLY");
1294 gMC->Gspos("RICH", 7, "ALIC", -(offset)*sinphi , offset*costheta*cosphi, -offset*sinphi,idrotm[1006], "ONLY");
1299 //___________________________________________
1300 void AliRICH::CreateMaterials()
1303 // *** DEFINITION OF AVAILABLE RICH MATERIALS ***
1304 // ORIGIN : NICK VAN EIJNDHOVEN
1305 // Modified by: N. Colonna (INFN - BARI, Nicola.Colonna@ba.infn.it)
1306 // R.A. Fini (INFN - BARI, Rosanna.Fini@ba.infn.it)
1307 // R.A. Loconsole (Bari University, loco@riscom.ba.infn.it)
1309 Int_t isxfld = gAlice->Field()->Integ();
1310 Float_t sxmgmx = gAlice->Field()->Max();
1313 /************************************Antonnelo's Values (14-vectors)*****************************************/
1315 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,
1316 6.7e-9,6.88e-9,7.08e-9,7.3e-9,7.51e-9,7.74e-9,8e-9 };
1317 Float_t rIndexQuarz[14] = { 1.528309,1.533333,
1318 1.538243,1.544223,1.550568,1.55777,
1319 1.565463,1.574765,1.584831,1.597027,
1320 1.611858,1.6277,1.6472,1.6724 };
1321 Float_t rIndexOpaqueQuarz[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1322 Float_t rIndexMethane[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1323 Float_t rIndexGrid[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1324 Float_t abscoFreon[14] = { 179.0987,179.0987,
1325 179.0987,179.0987,179.0987,142.92,56.65,13.95,10.43,7.07,2.03,.5773,.33496,0. };
1326 //Float_t abscoFreon[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,
1327 // 1e-5,1e-5,1e-5,1e-5,1e-5 };
1328 Float_t abscoQuarz[14] = { 64.035,39.98,35.665,31.262,27.527,22.815,21.04,17.52,
1329 14.177,9.282,4.0925,1.149,.3627,.10857 };
1330 Float_t abscoOpaqueQuarz[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,
1331 1e-5,1e-5,1e-5,1e-5,1e-5 };
1332 Float_t abscoCsI[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
1333 1e-4,1e-4,1e-4,1e-4 };
1334 Float_t abscoMethane[14] = { 1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,
1336 Float_t abscoGrid[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
1337 1e-4,1e-4,1e-4,1e-4 };
1338 Float_t efficAll[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1339 Float_t efficCsI[14] = { 6e-4,.005,.0075,.01125,.045,.117,.135,.16575,
1340 .17425,.1785,.1836,.1904,.1938,.221 };
1341 Float_t efficGrid[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1345 /**********************************End of Antonnelo's Values**********************************/
1347 /**********************************Values from rich_media.f (31-vectors)**********************************/
1350 //Photons energy intervals
1354 ppckov[i] = (Float_t(i)*0.1+5.5)*1e-9;
1355 //printf ("Energy intervals: %e\n",ppckov[i]);
1359 //Refraction index for quarz
1360 Float_t rIndexQuarz[26];
1367 Float_t ene=ppckov[i]*1e9;
1368 Float_t a=f1/(e1*e1 - ene*ene);
1369 Float_t b=f2/(e2*e2 - ene*ene);
1370 rIndexQuarz[i] = TMath::Sqrt(1. + a + b );
1371 //printf ("rIndexQuarz: %e\n",rIndexQuarz[i]);
1374 //Refraction index for opaque quarz, methane and grid
1375 Float_t rIndexOpaqueQuarz[26];
1376 Float_t rIndexMethane[26];
1377 Float_t rIndexGrid[26];
1380 rIndexOpaqueQuarz[i]=1;
1381 rIndexMethane[i]=1.000444;
1383 //printf ("rIndexOpaqueQuarz , etc: %e, %e, %e\n",rIndexOpaqueQuarz[i], rIndexMethane[i], rIndexGrid[i]=1);
1386 //Absorption index for freon
1387 Float_t abscoFreon[26] = {179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987,
1388 179.0987, 142.9206, 56.64957, 25.58622, 13.95293, 12.03905, 10.42953, 8.804196,
1389 7.069031, 4.461292, 2.028366, 1.293013, .577267, .40746, .334964, 0., 0., 0.};
1391 //Absorption index for quarz
1392 /*Float_t Qzt [21] = {.0,.0,.005,.04,.35,.647,.769,.808,.829,.844,.853,.858,.869,.887,.903,.902,.902,
1393 .906,.907,.907,.907};
1394 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,
1395 215.0,220.0,225.0,230.0,235.0,240.0,245.0,250.0};
1396 Float_t abscoQuarz[31];
1397 for (Int_t i=0;i<31;i++)
1399 Float_t Xlam = 1237.79 / (ppckov[i]*1e9);
1400 if (Xlam <= 160) abscoQuarz[i] = 0;
1401 if (Xlam > 250) abscoQuarz[i] = 1;
1404 for (Int_t j=0;j<21;j++)
1406 //printf ("Passed\n");
1407 if (Xlam > Wavl2[j] && Xlam < Wavl2[j+1])
1409 Float_t Dabs = (Qzt[j+1] - Qzt[j])/(Wavl2[j+1] - Wavl2[j]);
1410 Float_t Abso = Qzt[j] + Dabs*(Xlam - Wavl2[j]);
1411 abscoQuarz[i] = -5.0/(TMath::Log(Abso));
1415 printf ("abscoQuarz: %e abscoFreon: %e for energy: %e\n",abscoQuarz[i],abscoFreon[i],ppckov[i]);
1418 /*Float_t abscoQuarz[31] = {49.64211, 48.41296, 47.46989, 46.50492, 45.13682, 44.47883, 43.1929 , 41.30922, 40.5943 ,
1419 39.82956, 38.98623, 38.6247 , 38.43448, 37.41084, 36.22575, 33.74852, 30.73901, 24.25086,
1420 17.94531, 11.88753, 5.99128, 3.83503, 2.36661, 1.53155, 1.30582, 1.08574, .8779708,
1421 .675275, 0., 0., 0.};
1423 for (Int_t i=0;i<31;i++)
1425 abscoQuarz[i] = abscoQuarz[i]/10;
1428 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,
1429 19.266, 17.525, 15.878, 14.177, 11.719, 9.282, 6.62, 4.0925, 2.601, 1.149, .667, .3627,
1430 .192, .1497, .10857};
1432 //Absorption index for methane
1433 Float_t abscoMethane[26];
1436 abscoMethane[i]=AbsoCH4(ppckov[i]*1e9);
1437 //printf("abscoMethane: %e for energy: %e\n", abscoMethane[i],ppckov[i]*1e9);
1440 //Absorption index for opaque quarz, csi and grid, efficiency for all and grid
1441 Float_t abscoOpaqueQuarz[26];
1442 Float_t abscoCsI[26];
1443 Float_t abscoGrid[26];
1444 Float_t efficAll[26];
1445 Float_t efficGrid[26];
1448 abscoOpaqueQuarz[i]=1e-5;
1453 //printf ("All must be 1: %e, %e, %e, %e, %e\n",abscoOpaqueQuarz[i],abscoCsI[i],abscoGrid[i],efficAll[i],efficGrid[i]);
1456 //Efficiency for csi
1458 Float_t efficCsI[26] = {0.000199999995, 0.000600000028, 0.000699999975, 0.00499999989, 0.00749999983, 0.010125,
1459 0.0242999997, 0.0405000001, 0.0688500032, 0.105299994, 0.121500008, 0.141749993, 0.157949999,
1460 0.162, 0.166050002, 0.167669997, 0.174299985, 0.176789999, 0.179279998, 0.182599992, 0.18592,
1461 0.187579989, 0.189239994, 0.190899998, 0.207499996, 0.215799987};
1465 //FRESNEL LOSS CORRECTION FOR PERPENDICULAR INCIDENCE AND
1466 //UNPOLARIZED PHOTONS
1470 efficCsI[i] = efficCsI[i]/(1.-Fresnel(ppckov[i]*1e9,1.,0));
1471 //printf ("Fresnel result: %e for energy: %e\n",Fresnel(ppckov[i]*1e9,1.,0),ppckov[i]*1e9);
1474 /*******************************************End of rich_media.f***************************************/
1481 Float_t afre[2], agri, amet[2], aqua[2], ahon, zfre[2], zgri, zhon,
1485 Int_t nlmatmet, nlmatqua;
1486 Float_t wmatquao[2], rIndexFreon[26];
1487 Float_t aquao[2], epsil, stmin, zquao[2];
1489 Float_t radlal, densal, tmaxfd, deemax, stemax;
1490 Float_t aal, zal, radlgri, densfre, radlhon, densgri, denshon,densqua, densmet, wmatfre[2], wmatmet[2], wmatqua[2];
1492 Int_t *idtmed = fIdtmed->GetArray()-999;
1494 // --- Photon energy (GeV)
1495 // --- Refraction indexes
1496 for (i = 0; i < 26; ++i) {
1497 rIndexFreon[i] = ppckov[i] * .0172 * 1e9 + 1.177;
1498 //rIndexFreon[i] = 1;
1499 //printf ("rIndexFreon: %e \n efficCsI: %e for energy: %e\n",rIndexFreon[i], efficCsI[i], ppckov[i]);
1502 // --- Detection efficiencies (quantum efficiency for CsI)
1503 // --- Define parameters for honeycomb.
1504 // Used carbon of equivalent rad. lenght
1511 // --- Parameters to include in GSMIXT, relative to Quarz (SiO2)
1522 // --- Parameters to include in GSMIXT, relative to opaque Quarz (SiO2)
1533 // --- Parameters to include in GSMIXT, relative to Freon (C6F14)
1544 // --- Parameters to include in GSMIXT, relative to methane (CH4)
1555 // --- Parameters to include in GSMIXT, relative to anode grid (Cu)
1562 // --- Parameters to include in GSMATE related to aluminium sheet
1569 // --- Glass parameters
1571 Float_t aglass[5]={12.01, 28.09, 16., 10.8, 23.};
1572 Float_t zglass[5]={ 6., 14., 8., 5., 11.};
1573 Float_t wglass[5]={ 0.5, 0.105, 0.355, 0.03, 0.01};
1574 Float_t dglass=1.74;
1577 AliMaterial(1, "Air $", 14.61, 7.3, .001205, 30420., 67500);
1578 AliMaterial(6, "HON", ahon, zhon, denshon, radlhon, 0);
1579 AliMaterial(16, "CSI", ahon, zhon, denshon, radlhon, 0);
1580 AliMixture(20, "QUA", aqua, zqua, densqua, nlmatqua, wmatqua);
1581 AliMixture(21, "QUAO", aquao, zquao, densquao, nlmatquao, wmatquao);
1582 AliMixture(30, "FRE", afre, zfre, densfre, nlmatfre, wmatfre);
1583 AliMixture(40, "MET", amet, zmet, densmet, nlmatmet, wmatmet);
1584 AliMixture(41, "METG", amet, zmet, densmet, nlmatmet, wmatmet);
1585 AliMaterial(11, "GRI", agri, zgri, densgri, radlgri, 0);
1586 AliMaterial(50, "ALUM", aal, zal, densal, radlal, 0);
1587 AliMixture(32, "GLASS",aglass, zglass, dglass, 5, wglass);
1588 AliMaterial(31, "COPPER$", 63.54, 29., 8.96, 1.4, 0.);
1596 AliMedium(1, "DEFAULT MEDIUM AIR$", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1597 AliMedium(2, "HONEYCOMB$", 6, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1598 AliMedium(3, "QUARZO$", 20, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1599 AliMedium(4, "FREON$", 30, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1600 AliMedium(5, "METANO$", 40, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1601 AliMedium(6, "CSI$", 16, 1, isxfld, sxmgmx,tmaxfd, stemax, deemax, epsil, stmin);
1602 AliMedium(7, "GRIGLIA$", 11, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1603 AliMedium(8, "QUARZOO$", 21, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1604 AliMedium(9, "GAP$", 41, 1, isxfld, sxmgmx,tmaxfd, .1, -deemax, epsil, -stmin);
1605 AliMedium(10, "ALUMINUM$", 50, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1606 AliMedium(11, "GLASS", 32, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1607 AliMedium(12, "PCB_COPPER", 31, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1610 gMC->SetCerenkov(idtmed[1000], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
1611 gMC->SetCerenkov(idtmed[1001], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
1612 gMC->SetCerenkov(idtmed[1002], 26, ppckov, abscoQuarz, efficAll,rIndexQuarz);
1613 gMC->SetCerenkov(idtmed[1003], 26, ppckov, abscoFreon, efficAll,rIndexFreon);
1614 gMC->SetCerenkov(idtmed[1004], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
1615 gMC->SetCerenkov(idtmed[1005], 26, ppckov, abscoCsI, efficCsI, rIndexMethane);
1616 gMC->SetCerenkov(idtmed[1006], 26, ppckov, abscoGrid, efficGrid, rIndexGrid);
1617 gMC->SetCerenkov(idtmed[1007], 26, ppckov, abscoOpaqueQuarz, efficAll, rIndexOpaqueQuarz);
1618 gMC->SetCerenkov(idtmed[1008], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
1619 gMC->SetCerenkov(idtmed[1009], 26, ppckov, abscoGrid, efficGrid, rIndexGrid);
1620 gMC->SetCerenkov(idtmed[1010], 26, ppckov, abscoOpaqueQuarz, efficAll, rIndexOpaqueQuarz);
1623 //___________________________________________
1625 Float_t AliRICH::Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)
1628 //ENE(EV), PDOTI=COS(INC.ANG.), PDOTR=COS(POL.PLANE ROT.ANG.)
1630 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,
1631 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,
1632 7.8,7.9,8.0,8.1,8.2,8.3,8.4,8.5};
1635 Float_t csin[36] = {2.14,2.21,2.33,2.48,2.76,2.97,2.99,2.59,2.81,3.05,
1636 2.86,2.53,2.55,2.66,2.79,2.96,3.18,3.05,2.84,2.81,2.38,2.11,
1637 2.01,2.13,2.39,2.73,3.08,3.15,2.95,2.73,2.56,2.41,2.12,1.95,
1640 Float_t csik[36] = {0.,0.,0.,0.,0.,0.196,0.408,0.208,0.118,0.49,0.784,0.543,
1641 0.424,0.404,0.371,0.514,0.922,1.102,1.139,1.376,1.461,1.253,0.878,
1642 0.69,0.612,0.649,0.824,1.347,1.571,1.678,1.763,1.857,1.824,1.824,
1645 Int_t j=Int_t(xe*10)-49;
1646 Float_t cn=csin[j]+((csin[j+1]-csin[j])/0.1)*(xe-en[j]);
1647 Float_t ck=csik[j]+((csik[j+1]-csik[j])/0.1)*(xe-en[j]);
1649 //FORMULAE FROM HANDBOOK OF OPTICS, 33.23 OR
1650 //W.R. HUNTER, J.O.S.A. 54 (1964),15 , J.O.S.A. 55(1965),1197
1652 Float_t sinin=TMath::Sqrt(1-pdoti*pdoti);
1653 Float_t tanin=sinin/pdoti;
1655 Float_t c1=cn*cn-ck*ck-sinin*sinin;
1656 Float_t c2=4*cn*cn*ck*ck;
1657 Float_t aO=TMath::Sqrt(0.5*(TMath::Sqrt(c1*c1+c2)+c1));
1658 Float_t b2=0.5*(TMath::Sqrt(c1*c1+c2)-c1);
1660 Float_t rs=((aO-pdoti)*(aO-pdoti)+b2)/((aO+pdoti)*(aO+pdoti)+b2);
1661 Float_t rp=rs*((aO-sinin*tanin)*(aO-sinin*tanin)+b2)/((aO+sinin*tanin)*(aO+sinin*tanin)+b2);
1664 //CORRECTION FACTOR FOR SURFACE ROUGHNESS
1665 //B.J. STAGG APPLIED OPTICS, 30(1991),4113
1668 Float_t lamb=1240/ene;
1671 Float_t rO=TMath::Exp(-(4*TMath::Pi()*pdoti*sigraf/lamb)*(4*TMath::Pi()*pdoti*sigraf/lamb));
1675 Float_t pdotr=0.8; //DEGREE OF POLARIZATION : 1->P , -1->S
1676 fresn=0.5*(rp*(1+pdotr)+rs*(1-pdotr));
1685 //__________________________________________
1686 Float_t AliRICH::AbsoCH4(Float_t x)
1689 //KLOSCH,SCH4(9),WL(9),EM(9),ALENGTH(31)
1690 Float_t sch4[9] = {.12,.16,.23,.38,.86,2.8,7.9,28.,80.}; //MB X 10^22
1691 //Float_t wl[9] = {153.,152.,151.,150.,149.,148.,147.,146.,145};
1692 Float_t em[9] = {8.1,8.158,8.212,8.267,8.322,8.378,8.435,8.493,8.55};
1693 const Float_t kLosch=2.686763E19; // LOSCHMIDT NUMBER IN CM-3
1694 const Float_t kIgas1=100, kIgas2=0, kOxy=10., kWater=5., kPressure=750.,kTemperature=283.;
1695 Float_t pn=kPressure/760.;
1696 Float_t tn=kTemperature/273.16;
1699 // ------- METHANE CROSS SECTION -----------------
1700 // ASTROPH. J. 214, L47 (1978)
1706 if(x>=7.75 && x<=8.1)
1708 Float_t c0=-1.655279e-1;
1709 Float_t c1=6.307392e-2;
1710 Float_t c2=-8.011441e-3;
1711 Float_t c3=3.392126e-4;
1712 sm=(c0+c1*x+c2*x*x+c3*x*x*x)*1.e-18;
1718 while (x<=em[j] && x>=em[j+1])
1721 Float_t a=(sch4[j+1]-sch4[j])/(em[j+1]-em[j]);
1722 sm=(sch4[j]+a*(x-em[j]))*1e-22;
1726 Float_t dm=(kIgas1/100.)*(1.-((kOxy+kWater)/1.e6))*kLosch*pn/tn;
1727 Float_t abslm=1./sm/dm;
1729 // ------- ISOBUTHANE CROSS SECTION --------------
1730 // i-C4H10 (ai) abs. length from curves in
1731 // Lu-McDonald paper for BARI RICH workshop .
1732 // -----------------------------------------------------------
1741 if(x>=7.25 && x<7.375)
1747 Float_t si = 1./(ai*kLosch*273.16/293.); // ISOB. CRO.SEC.IN CM2
1748 Float_t di=(kIgas2/100.)*(1.-((kOxy+kWater)/1.e6))*kLosch*pn/tn;
1753 // ---------------------------------------------------------
1755 // transmission of O2
1757 // y= path in cm, x=energy in eV
1758 // so= cross section for UV absorption in cm2
1759 // do= O2 molecular density in cm-3
1760 // ---------------------------------------------------------
1768 so=3.392709e-13 * TMath::Exp(2.864104 *x);
1774 so=2.910039e-34 * TMath::Exp(10.3337*x);
1781 Float_t a0=-73770.76;
1782 Float_t a1=46190.69;
1783 Float_t a2=-11475.44;
1784 Float_t a3=1412.611;
1785 Float_t a4=-86.07027;
1786 Float_t a5=2.074234;
1787 so= a0+(a1*x)+(a2*x*x)+(a3*x*x*x)+(a4*x*x*x*x)+(a5*x*x*x*x*x);
1791 Float_t dox=(kOxy/1e6)*kLosch*pn/tn;
1796 // ---------------------------------------------------------
1798 // transmission of H2O
1800 // y= path in cm, x=energy in eV
1801 // sw= cross section for UV absorption in cm2
1802 // dw= H2O molecular density in cm-3
1803 // ---------------------------------------------------------
1807 Float_t b0=29231.65;
1808 Float_t b1=-15807.74;
1809 Float_t b2=3192.926;
1810 Float_t b3=-285.4809;
1811 Float_t b4=9.533944;
1815 Float_t sw= b0+(b1*x)+(b2*x*x)+(b3*x*x*x)+(b4*x*x*x*x);
1817 Float_t dw=(kWater/1e6)*kLosch*pn/tn;
1823 // ---------------------------------------------------------
1825 Float_t alength=1./(1./abslm+1./absli+1./abslo+1./abslw);
1831 //___________________________________________
1832 Int_t AliRICH::DistancetoPrimitive(Int_t , Int_t )
1840 //___________________________________________
1841 void AliRICH::MakeBranch(Option_t* option, const char *file)
1843 // Create Tree branches for the RICH.
1845 const Int_t kBufferSize = 4000;
1846 char branchname[20];
1848 AliDetector::MakeBranch(option,file);
1850 const char *cH = strstr(option,"H");
1851 const char *cD = strstr(option,"D");
1852 const char *cR = strstr(option,"R");
1853 const char *cS = strstr(option,"S");
1857 sprintf(branchname,"%sCerenkov",GetName());
1858 if (fCerenkovs && gAlice->TreeH()) {
1859 //TBranch* branch = MakeBranchInTree(gAlice->TreeH(),branchname, &fCerenkovs, kBufferSize, file) ;
1860 MakeBranchInTree(gAlice->TreeH(),branchname, &fCerenkovs, kBufferSize, file) ;
1861 //branch->SetAutoDelete(kFALSE);
1863 sprintf(branchname,"%sSDigits",GetName());
1864 if (fSDigits && gAlice->TreeH()) {
1865 //TBranch* branch = MakeBranchInTree(gAlice->TreeH(),branchname, &fSDigits, kBufferSize, file) ;
1866 MakeBranchInTree(gAlice->TreeH(),branchname, &fSDigits, kBufferSize, file) ;
1867 //branch->SetAutoDelete(kFALSE);
1868 //printf("Making branch %sSDigits in TreeH\n",GetName());
1873 sprintf(branchname,"%sSDigits",GetName());
1874 if (fSDigits && gAlice->TreeS()) {
1875 //TBranch* branch = MakeBranchInTree(gAlice->TreeS(),branchname, &fSDigits, kBufferSize, file) ;
1876 MakeBranchInTree(gAlice->TreeS(),branchname, &fSDigits, kBufferSize, file) ;
1877 //branch->SetAutoDelete(kFALSE);
1878 //printf("Making branch %sSDigits in TreeS\n",GetName());
1884 // one branch for digits per chamber
1888 for (i=0; i<kNCH ;i++) {
1889 sprintf(branchname,"%sDigits%d",GetName(),i+1);
1890 if (fDchambers && gAlice->TreeD()) {
1891 //TBranch* branch = MakeBranchInTree(gAlice->TreeD(),branchname, &((*fDchambers)[i]), kBufferSize, file) ;
1892 MakeBranchInTree(gAlice->TreeD(),branchname, &((*fDchambers)[i]), kBufferSize, file) ;
1893 //branch->SetAutoDelete(kFALSE);
1894 //printf("Making Branch %sDigits%d\n",GetName(),i+1);
1901 // one branch for raw clusters per chamber
1904 //printf("Called MakeBranch for TreeR\n");
1908 for (i=0; i<kNCH ;i++) {
1909 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
1910 if (fRawClusters && gAlice->TreeR()) {
1911 //TBranch* branch = MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRawClusters)[i]), kBufferSize, file) ;
1912 MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRawClusters)[i]), kBufferSize, file) ;
1913 //branch->SetAutoDelete(kFALSE);
1917 // one branch for rec hits per chamber
1919 for (i=0; i<kNCH ;i++) {
1920 sprintf(branchname,"%sRecHits1D%d",GetName(),i+1);
1921 if (fRecHits1D && gAlice->TreeR()) {
1922 //TBranch* branch = MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRecHits1D)[i]), kBufferSize, file) ;
1923 MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRecHits1D)[i]), kBufferSize, file) ;
1924 //branch->SetAutoDelete(kFALSE);
1927 for (i=0; i<kNCH ;i++) {
1928 sprintf(branchname,"%sRecHits3D%d",GetName(),i+1);
1929 if (fRecHits3D && gAlice->TreeR()) {
1930 MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRecHits3D)[i]), kBufferSize, file) ;
1931 //branch->SetAutoDelete(kFALSE);
1937 //___________________________________________
1938 void AliRICH::SetTreeAddress()
1940 // Set branch address for the Hits and Digits Tree.
1941 char branchname[20];
1944 AliDetector::SetTreeAddress();
1947 TTree *treeH = gAlice->TreeH();
1948 TTree *treeD = gAlice->TreeD();
1949 TTree *treeR = gAlice->TreeR();
1950 TTree *treeS = gAlice->TreeS();
1954 branch = treeH->GetBranch("RICHCerenkov");
1955 if (branch) branch->SetAddress(&fCerenkovs);
1958 branch = treeH->GetBranch("RICHSDigits");
1961 branch->SetAddress(&fSDigits);
1962 //printf("Setting sdigits branch address at %p in TreeH\n",&fSDigits);
1969 branch = treeS->GetBranch("RICHSDigits");
1972 branch->SetAddress(&fSDigits);
1973 //printf("Setting sdigits branch address at %p in TreeS\n",&fSDigits);
1980 for (int i=0; i<kNCH; i++) {
1981 sprintf(branchname,"%sDigits%d",GetName(),i+1);
1983 branch = treeD->GetBranch(branchname);
1984 if (branch) branch->SetAddress(&((*fDchambers)[i]));
1989 for (i=0; i<kNCH; i++) {
1990 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
1992 branch = treeR->GetBranch(branchname);
1993 if (branch) branch->SetAddress(&((*fRawClusters)[i]));
1997 for (i=0; i<kNCH; i++) {
1998 sprintf(branchname,"%sRecHits1D%d",GetName(),i+1);
2000 branch = treeR->GetBranch(branchname);
2001 if (branch) branch->SetAddress(&((*fRecHits1D)[i]));
2005 for (i=0; i<kNCH; i++) {
2006 sprintf(branchname,"%sRecHits3D%d",GetName(),i+1);
2008 branch = treeR->GetBranch(branchname);
2009 if (branch) branch->SetAddress(&((*fRecHits3D)[i]));
2015 //___________________________________________
2016 void AliRICH::ResetHits()
2018 // Reset number of clusters and the cluster array for this detector
2019 AliDetector::ResetHits();
2022 if (fSDigits) fSDigits->Clear();
2023 if (fCerenkovs) fCerenkovs->Clear();
2027 //____________________________________________
2028 void AliRICH::ResetDigits()
2031 // Reset number of digits and the digits array for this detector
2033 for ( int i=0;i<kNCH;i++ ) {
2034 //PH if (fDchambers && (*fDchambers)[i]) (*fDchambers)[i]->Clear();
2035 if (fDchambers && fDchambers->At(i)) fDchambers->At(i)->Clear();
2036 if (fNdch) fNdch[i]=0;
2040 //____________________________________________
2041 void AliRICH::ResetRawClusters()
2044 // Reset number of raw clusters and the raw clust array for this detector
2046 for ( int i=0;i<kNCH;i++ ) {
2047 //PH if ((*fRawClusters)[i]) ((TClonesArray*)(*fRawClusters)[i])->Clear();
2048 if (fRawClusters->At(i)) ((TClonesArray*)fRawClusters->At(i))->Clear();
2049 if (fNrawch) fNrawch[i]=0;
2053 //____________________________________________
2054 void AliRICH::ResetRecHits1D()
2057 // Reset number of raw clusters and the raw clust array for this detector
2060 for ( int i=0;i<kNCH;i++ ) {
2061 //PH if ((*fRecHits1D)[i]) ((TClonesArray*)(*fRecHits1D)[i])->Clear();
2062 if (fRecHits1D->At(i)) ((TClonesArray*)fRecHits1D->At(i))->Clear();
2063 if (fNrechits1D) fNrechits1D[i]=0;
2067 //____________________________________________
2068 void AliRICH::ResetRecHits3D()
2071 // Reset number of raw clusters and the raw clust array for this detector
2074 for ( int i=0;i<kNCH;i++ ) {
2075 //PH if ((*fRecHits3D)[i]) ((TClonesArray*)(*fRecHits3D)[i])->Clear();
2076 if (fRecHits3D->At(i)) ((TClonesArray*)fRecHits3D->At(i))->Clear();
2077 if (fNrechits3D) fNrechits3D[i]=0;
2082 //___________________________________________
2083 void AliRICH::StepManager()
2085 // Full Step Manager
2089 static Int_t vol[2];
2091 static Float_t hits[22];
2092 static Float_t ckovData[19];
2093 TLorentzVector position;
2094 TLorentzVector momentum;
2097 Float_t localPos[3];
2098 Float_t localMom[4];
2099 Float_t localTheta,localPhi;
2101 Float_t destep, step;
2104 Float_t coscerenkov;
2105 static Float_t eloss, xhit, yhit, tlength;
2106 const Float_t kBig=1.e10;
2108 TClonesArray &lhits = *fHits;
2109 TParticle *current = (TParticle*)(*gAlice->Particles())[gAlice->CurrentTrack()];
2111 //if (current->Energy()>1)
2114 // Only gas gap inside chamber
2115 // Tag chambers and record hits when track enters
2118 id=gMC->CurrentVolID(copy);
2119 Float_t cherenkovLoss=0;
2120 //gAlice->KeepTrack(gAlice->CurrentTrack());
2122 gMC->TrackPosition(position);
2126 //bzero((char *)ckovData,sizeof(ckovData)*19);
2127 ckovData[1] = pos[0]; // X-position for hit
2128 ckovData[2] = pos[1]; // Y-position for hit
2129 ckovData[3] = pos[2]; // Z-position for hit
2130 ckovData[6] = 0; // dummy track length
2131 //ckovData[11] = gAlice->CurrentTrack();
2133 //printf("\n+++++++++++\nTrack: %d\n++++++++++++\n",gAlice->CurrentTrack());
2135 //AliRICH *RICH = (AliRICH *) gAlice->GetDetector("RICH");
2137 /********************Store production parameters for Cerenkov photons************************/
2138 //is it a Cerenkov photon?
2139 if (gMC->TrackPid() == 50000050) {
2141 //if (gMC->VolId("GAP ")==gMC->CurrentVolID(copy))
2143 Float_t ckovEnergy = current->Energy();
2144 //energy interval for tracking
2145 if (ckovEnergy > 5.6e-09 && ckovEnergy < 7.8e-09 )
2146 //if (ckovEnergy > 0)
2148 if (gMC->IsTrackEntering()){ //is track entering?
2149 //printf("Track entered (1)\n");
2150 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
2152 if (gMC->IsNewTrack()){ //is it the first step?
2153 //printf("I'm in!\n");
2154 Int_t mother = current->GetFirstMother();
2156 //printf("Second Mother:%d\n",current->GetSecondMother());
2158 ckovData[10] = mother;
2159 ckovData[11] = gAlice->CurrentTrack();
2160 ckovData[12] = 1; //Media where photon was produced 1->Freon, 2->Quarz
2161 //printf("Produced in FREO\n");
2164 //printf("Index: %d\n",fCkovNumber);
2165 } //first step question
2168 if (gMC->IsNewTrack()){ //is it first step?
2169 if (gMC->VolId("QUAR")==gMC->CurrentVolID(copy)) //is it in quarz?
2172 //printf("Produced in QUAR\n");
2174 } //first step question
2176 //printf("Before %d\n",fFreonProd);
2177 } //track entering question
2179 if (ckovData[12] == 1) //was it produced in Freon?
2180 //if (fFreonProd == 1)
2182 if (gMC->IsTrackEntering()){ //is track entering?
2183 //printf("Track entered (2)\n");
2184 //printf("Current volume (should be META): %s\n",gMC->CurrentVolName());
2185 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("META"),gMC->CurrentVolID(copy));
2186 if (gMC->VolId("META")==gMC->CurrentVolID(copy)) //is it in gap?
2188 //printf("Got in META\n");
2189 gMC->TrackMomentum(momentum);
2194 // Z-position for hit
2197 /**************** Photons lost in second grid have to be calculated by hand************/
2199 Float_t cophi = TMath::Cos(TMath::ATan2(mom[0], mom[1]));
2200 Float_t t = (1. - .025 / cophi) * (1. - .05 / cophi);
2201 //gMC->Rndm(ranf, 1);
2202 gMC->GetRandom()->RndmArray(1,ranf);
2203 //printf("grid calculation:%f\n",t);
2207 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
2208 //printf("Added One (1)!\n");
2209 //printf("Lost one in grid\n");
2211 /**********************************************************************************/
2214 //printf("Current volume (should be CSI) (1): %s\n",gMC->CurrentVolName());
2215 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("CSI "),gMC->CurrentVolID(copy));
2216 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy)) //is it in csi?
2218 //printf("Got in CSI\n");
2219 gMC->TrackMomentum(momentum);
2225 /********* Photons lost by Fresnel reflection have to be calculated by hand********/
2226 /***********************Cerenkov phtons (always polarised)*************************/
2228 Float_t cophi = TMath::Cos(TMath::ATan2(mom[0], mom[1]));
2229 Float_t t = Fresnel(ckovEnergy*1e9,cophi,1);
2230 //gMC->Rndm(ranf, 1);
2231 gMC->GetRandom()->RndmArray(1,ranf);
2235 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
2236 //printf("Added One (2)!\n");
2237 //printf("Lost by Fresnel\n");
2239 /**********************************************************************************/
2244 /********************Evaluation of losses************************/
2245 /******************still in the old fashion**********************/
2248 Int_t i1 = gMC->StepProcesses(procs); //number of physics mechanisms acting on the particle
2249 for (Int_t i = 0; i < i1; ++i) {
2251 if (procs[i] == kPLightReflection) { //was it reflected
2253 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
2255 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
2258 //AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
2259 } //reflection question
2262 else if (procs[i] == kPLightAbsorption) { //was it absorbed?
2263 //printf("Got in absorption\n");
2265 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
2267 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
2269 if (gMC->CurrentVolID(copy) == gMC->VolId("META"))
2271 if (gMC->CurrentVolID(copy) == gMC->VolId("GAP "))
2274 if (gMC->CurrentVolID(copy) == gMC->VolId("SRIC"))
2278 if (gMC->CurrentVolID(copy) == gMC->VolId("CSI ")) {
2282 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
2283 //printf("Added One (3)!\n");
2284 //printf("Added cerenkov %d\n",fCkovNumber);
2285 } //absorption question
2288 // Photon goes out of tracking scope
2289 else if (procs[i] == kPStop) { //is it below energy treshold?
2292 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
2293 //printf("Added One (4)!\n");
2294 } // energy treshold question
2295 } //number of mechanisms cycle
2296 /**********************End of evaluation************************/
2297 } //freon production question
2298 } //energy interval question
2299 //}//inside the proximity gap question
2300 } //cerenkov photon question
2302 /**************************************End of Production Parameters Storing*********************/
2305 /*******************************Treat photons that hit the CsI (Ckovs and Feedbacks)************/
2307 if (gMC->TrackPid() == 50000050 || gMC->TrackPid() == 50000051) {
2308 //printf("Cerenkov\n");
2310 //if (gMC->TrackPid() == 50000051)
2311 //printf("Tracking a feedback\n");
2313 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy))
2315 //printf("Current volume (should be CSI) (2): %s\n",gMC->CurrentVolName());
2316 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("CSI "),gMC->CurrentVolID(copy));
2317 //printf("Got in CSI\n");
2318 //printf("Tracking a %d\n",gMC->TrackPid());
2319 if (gMC->Edep() > 0.){
2320 gMC->TrackPosition(position);
2321 gMC->TrackMomentum(momentum);
2329 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
2330 Double_t rt = TMath::Sqrt(tc);
2331 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
2332 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
2334 gMC->CurrentVolOffID(2,copy);
2339 //gMC->Gmtod(pos,localPos,1);
2341 Chamber(idvol).GlobaltoLocal(pos,localPos);
2343 //gMC->Gmtod(mom,localMom,2);
2345 Chamber(idvol).GlobaltoLocal(mom,localMom);
2347 gMC->CurrentVolOffID(2,copy);
2351 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
2352 //->Sector(localPos[0], localPos[2]);
2353 //printf("Sector:%d\n",sector);
2355 /*if (gMC->TrackPid() == 50000051){
2357 printf("Feedbacks:%d\n",fFeedbacks);
2360 //PH ((AliRICHChamber*) (*fChambers)[idvol])
2361 ((AliRICHChamber*)fChambers->At(idvol))
2362 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
2364 ckovData[0] = gMC->TrackPid(); // particle type
2365 ckovData[1] = pos[0]; // X-position for hit
2366 ckovData[2] = pos[1]; // Y-position for hit
2367 ckovData[3] = pos[2]; // Z-position for hit
2368 ckovData[4] = theta; // theta angle of incidence
2369 ckovData[5] = phi; // phi angle of incidence
2370 ckovData[8] = (Float_t) fNSDigits; // first sdigit
2371 ckovData[9] = -1; // last pad hit
2372 ckovData[13] = 4; // photon was detected
2373 ckovData[14] = mom[0];
2374 ckovData[15] = mom[1];
2375 ckovData[16] = mom[2];
2377 destep = gMC->Edep();
2378 gMC->SetMaxStep(kBig);
2379 cherenkovLoss += destep;
2380 ckovData[7]=cherenkovLoss;
2382 nPads = Hits2SDigits(localPos[0],localPos[2],cherenkovLoss,idvol,kCerenkov);
2384 if (fNSDigits > (Int_t)ckovData[8]) {
2385 ckovData[8]= ckovData[8]+1;
2386 ckovData[9]= (Float_t) fNSDigits;
2389 //printf("Cerenkov loss: %f\n", cherenkovLoss);
2391 ckovData[17] = nPads;
2392 //printf("nPads:%d",nPads);
2394 //TClonesArray *Hits = RICH->Hits();
2395 AliRICHHit *mipHit = (AliRICHHit*) (fHits->UncheckedAt(0));
2398 mom[0] = current->Px();
2399 mom[1] = current->Py();
2400 mom[2] = current->Pz();
2401 Float_t mipPx = mipHit->MomX();
2402 Float_t mipPy = mipHit->MomY();
2403 Float_t mipPz = mipHit->MomZ();
2405 Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
2406 Float_t rt = TMath::Sqrt(r);
2407 Float_t mipR = mipPx*mipPx + mipPy*mipPy + mipPz*mipPz;
2408 Float_t mipRt = TMath::Sqrt(mipR);
2411 coscerenkov = (mom[0]*mipPx + mom[1]*mipPy + mom[2]*mipPz)/(rt*mipRt);
2417 Float_t cherenkov = TMath::ACos(coscerenkov);
2418 ckovData[18]=cherenkov;
2422 AddHit(gAlice->CurrentTrack(),vol,ckovData);
2423 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
2424 //printf("Added One (5)!\n");
2431 /***********************************************End of photon hits*********************************************/
2434 /**********************************************Charged particles treatment*************************************/
2436 else if (gMC->TrackCharge())
2440 /*if (gMC->IsTrackEntering())
2442 hits[13]=20;//is track entering?
2444 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
2446 gMC->TrackMomentum(momentum);
2457 if (gMC->VolId("GAP ")== gMC->CurrentVolID(copy)) {
2458 // Get current particle id (ipart), track position (pos) and momentum (mom)
2460 gMC->CurrentVolOffID(3,copy);
2464 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
2465 //->Sector(localPos[0], localPos[2]);
2466 //printf("Sector:%d\n",sector);
2468 gMC->TrackPosition(position);
2469 gMC->TrackMomentum(momentum);
2478 //gMC->Gmtod(pos,localPos,1);
2480 Chamber(idvol).GlobaltoLocal(pos,localPos);
2482 //gMC->Gmtod(mom,localMom,2);
2484 Chamber(idvol).GlobaltoLocal(mom,localMom);
2486 ipart = gMC->TrackPid();
2488 // momentum loss and steplength in last step
2489 destep = gMC->Edep();
2490 step = gMC->TrackStep();
2493 // record hits when track enters ...
2494 if( gMC->IsTrackEntering()) {
2495 // gMC->SetMaxStep(fMaxStepGas);
2496 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
2497 Double_t rt = TMath::Sqrt(tc);
2498 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
2499 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
2502 Double_t localTc = localMom[0]*localMom[0]+localMom[2]*localMom[2];
2503 Double_t localRt = TMath::Sqrt(localTc);
2504 localTheta = Float_t(TMath::ATan2(localRt,Double_t(localMom[1])))*kRaddeg;
2505 localPhi = Float_t(TMath::ATan2(Double_t(localMom[2]),Double_t(localMom[0])))*kRaddeg;
2507 hits[0] = Float_t(ipart); // particle type
2508 hits[1] = localPos[0]; // X-position for hit
2509 hits[2] = localPos[1]; // Y-position for hit
2510 hits[3] = localPos[2]; // Z-position for hit
2511 hits[4] = localTheta; // theta angle of incidence
2512 hits[5] = localPhi; // phi angle of incidence
2513 hits[8] = (Float_t) fNSDigits; // first sdigit
2514 hits[9] = -1; // last pad hit
2515 hits[13] = fFreonProd; // did id hit the freon?
2519 hits[18] = 0; // dummy cerenkov angle
2525 Chamber(idvol).LocaltoGlobal(localPos,hits+1);
2528 //To make chamber coordinates x-y had to pass localPos[0], localPos[2]
2531 // Only if not trigger chamber
2534 // Initialize hit position (cursor) in the segmentation model
2535 //PH ((AliRICHChamber*) (*fChambers)[idvol])
2536 ((AliRICHChamber*)fChambers->At(idvol))
2537 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
2542 // Calculate the charge induced on a pad (disintegration) in case
2544 // Mip left chamber ...
2545 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
2546 gMC->SetMaxStep(kBig);
2551 // Only if not trigger chamber
2555 if(gMC->TrackPid() == kNeutron)
2556 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
2557 nPads = Hits2SDigits(xhit,yhit,eloss,idvol,kMip);
2559 //printf("nPads:%d",nPads);
2565 if (fNSDigits > (Int_t)hits[8]) {
2567 hits[9]= (Float_t) fNSDigits;
2571 new(lhits[fNhits++]) AliRICHHit(fIshunt,gAlice->CurrentTrack(),vol,hits);
2574 // Check additional signal generation conditions
2575 // defined by the segmentation
2576 // model (boundary crossing conditions)
2578 //PH (((AliRICHChamber*) (*fChambers)[idvol])
2579 (((AliRICHChamber*)fChambers->At(idvol))
2580 ->SigGenCond(localPos[0], localPos[2], localPos[1]))
2582 //PH ((AliRICHChamber*) (*fChambers)[idvol])
2583 ((AliRICHChamber*)fChambers->At(idvol))
2584 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
2587 if(gMC->TrackPid() == kNeutron)
2588 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
2589 nPads = Hits2SDigits(xhit,yhit,eloss,idvol,kMip);
2591 //printf("Npads:%d",NPads);
2598 // nothing special happened, add up energy loss
2605 /*************************************************End of MIP treatment**************************************/
2607 }//void AliRICH::StepManager()
2609 void AliRICH::FindClusters(Int_t nev,Int_t lastEntry)
2613 // Loop on chambers and on cathode planes
2615 for (Int_t icat=1;icat<2;icat++) {
2616 gAlice->ResetDigits();
2617 gAlice->TreeD()->GetEvent(0);
2618 for (Int_t ich=0;ich<kNCH;ich++) {
2619 //PH AliRICHChamber* iChamber=(AliRICHChamber*) (*fChambers)[ich];
2620 AliRICHChamber* iChamber=(AliRICHChamber*)fChambers->At(ich);
2621 TClonesArray *pRICHdigits = this->DigitsAddress(ich);
2622 if (pRICHdigits == 0)
2625 // Get ready the current chamber stuff
2627 AliRICHResponse* response = iChamber->GetResponseModel();
2628 AliSegmentation* seg = iChamber->GetSegmentationModel();
2629 AliRICHClusterFinder* rec = iChamber->GetReconstructionModel();
2631 rec->SetSegmentation(seg);
2632 rec->SetResponse(response);
2633 rec->SetDigits(pRICHdigits);
2634 rec->SetChamber(ich);
2635 if (nev==0) rec->CalibrateCOG();
2636 rec->FindRawClusters();
2639 fRch=RawClustAddress(ich);
2643 gAlice->TreeR()->Fill();
2645 for (int i=0;i<kNCH;i++) {
2646 fRch=RawClustAddress(i);
2647 int nraw=fRch->GetEntriesFast();
2648 printf ("Chamber %d, raw clusters %d\n",i,nraw);
2656 sprintf(hname,"TreeR%d",nev);
2657 gAlice->TreeR()->Write(hname,kOverwrite,0);
2658 gAlice->TreeR()->Reset();
2660 //gObjectTable->Print();
2663 AliRICHSDigit* AliRICH::FirstPad(AliRICHHit* hit,TClonesArray *clusters )
2666 // Initialise the pad iterator
2667 // Return the address of the first sdigit for hit
2668 TClonesArray *theClusters = clusters;
2669 Int_t nclust = theClusters->GetEntriesFast();
2670 if (nclust && hit->PHlast() > 0) {
2671 sMaxIterPad=Int_t(hit->PHlast());
2672 sCurIterPad=Int_t(hit->PHfirst());
2673 return (AliRICHSDigit*) clusters->UncheckedAt(sCurIterPad-1);
2680 AliRICHSDigit* AliRICH::NextPad(TClonesArray *clusters)
2683 // Iterates over pads
2686 if (sCurIterPad <= sMaxIterPad) {
2687 return (AliRICHSDigit*) clusters->UncheckedAt(sCurIterPad-1);
2693 AliRICH& AliRICH::operator=(const AliRICH& rhs)
2695 // Assignment operator
2700 void AliRICH::DiagnosticsFE(Int_t evNumber1,Int_t evNumber2)
2703 Int_t NpadX = 162; // number of pads on X
2704 Int_t NpadY = 162; // number of pads on Y
2706 Int_t Pad[162][162];
2707 for (Int_t i=0;i<NpadX;i++) {
2708 for (Int_t j=0;j<NpadY;j++) {
2713 // Create some histograms
2715 TH1F *pionspectra1 = new TH1F("pionspectra1","Pion Spectra",200,-4,2);
2716 TH1F *pionspectra2 = new TH1F("pionspectra2","Pion Spectra",200,-4,2);
2717 TH1F *pionspectra3 = new TH1F("pionspectra3","Pion Spectra",200,-4,2);
2718 TH1F *protonspectra1 = new TH1F("protonspectra1","Proton Spectra",200,-4,2);
2719 TH1F *protonspectra2 = new TH1F("protonspectra2","Proton Spectra",200,-4,2);
2720 TH1F *protonspectra3 = new TH1F("protonspectra3","Proton Spectra",200,-4,2);
2721 TH1F *kaonspectra1 = new TH1F("kaonspectra1","Kaon Spectra",100,-4,2);
2722 TH1F *kaonspectra2 = new TH1F("kaonspectra2","Kaon Spectra",100,-4,2);
2723 TH1F *kaonspectra3 = new TH1F("kaonspectra3","Kaon Spectra",100,-4,2);
2724 TH1F *electronspectra1 = new TH1F("electronspectra1","Electron Spectra",100,-4,2);
2725 TH1F *electronspectra2 = new TH1F("electronspectra2","Electron Spectra",100,-4,2);
2726 TH1F *electronspectra3 = new TH1F("electronspectra3","Electron Spectra",100,-4,2);
2727 TH1F *muonspectra1 = new TH1F("muonspectra1","Muon Spectra",100,-4,2);
2728 TH1F *muonspectra2 = new TH1F("muonspectra2","Muon Spectra",100,-4,2);
2729 TH1F *muonspectra3 = new TH1F("muonspectra3","Muon Spectra",100,-4,2);
2730 TH1F *neutronspectra1 = new TH1F("neutronspectra1","Neutron Spectra",100,-4,2);
2731 TH1F *neutronspectra2 = new TH1F("neutronspectra2","Neutron Spectra",100,-4,2);
2732 TH1F *neutronspectra3 = new TH1F("neutronspectra2","Neutron Spectra",100,-4,2);
2733 TH1F *chargedspectra1 = new TH1F("chargedspectra1","Charged particles above 1 GeV Spectra",100,-1,3);
2734 TH1F *chargedspectra2 = new TH1F("chargedspectra2","Charged particles above 1 GeV Spectra",100,-1,3);
2735 TH1F *chargedspectra3 = new TH1F("chargedspectra2","Charged particles above 1 GeV Spectra",100,-1,3);
2736 TH1F *pionptspectrafinal = new TH1F("pionptspectrafinal","Primary Pions Transverse Momenta at HMPID",20,0,5);
2737 TH1F *pionptspectravertex = new TH1F("pionptspectravertex","Primary Pions Transverse Momenta at vertex",20,0,5);
2738 TH1F *kaonptspectrafinal = new TH1F("kaonptspectrafinal","Primary Kaons Transverse Momenta at HMPID",20,0,5);
2739 TH1F *kaonptspectravertex = new TH1F("kaonptspectravertex","Primary Kaons Transverse Momenta at vertex",20,0,5);
2740 //TH1F *hitsPhi = new TH1F("hitsPhi","Distribution of phi angle of incidence",100,-180,180);
2741 TH1F *hitsTheta = new TH1F("hitsTheta","Distribution of Theta angle of incidence, all tracks",100,0,50);
2742 TH1F *hitsTheta500MeV = new TH1F("hitsTheta500MeV","Distribution of Theta angle of incidence, 0.5-1 GeV primary tracks",100,0,50);
2743 TH1F *hitsTheta1GeV = new TH1F("hitsTheta1GeV","Distribution of Theta angle of incidence, 1-2 GeV primary tracks",100,0,50);
2744 TH1F *hitsTheta2GeV = new TH1F("hitsTheta2GeV","Distribution of Theta angle of incidence, 2-3 GeV primary tracks",100,0,50);
2745 TH1F *hitsTheta3GeV = new TH1F("hitsTheta3GeV","Distribution of Theta angle of incidence, >3 GeV primary tracks",100,0,50);
2746 TH2F *production = new TH2F("production","Mother production vertices",100,-300,300,100,0,600);
2751 // Start loop over events
2753 Int_t pion=0, kaon=0, proton=0, electron=0, positron=0, neutron=0, highneutrons=0, muon=0;
2754 Int_t chargedpions=0,primarypions=0,highprimarypions=0,chargedkaons=0,primarykaons=0,highprimarykaons=0;
2755 Int_t photons=0, primaryphotons=0, highprimaryphotons=0;
2758 for (int nev=0; nev<= evNumber2; nev++) {
2759 Int_t nparticles = gAlice->GetEvent(nev);
2762 printf ("Event number : %d\n",nev);
2763 printf ("Number of particles: %d\n",nparticles);
2764 if (nev < evNumber1) continue;
2765 if (nparticles <= 0) return;
2767 // Get pointers to RICH detector and Hits containers
2769 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
2771 TTree *treeH = gAlice->TreeH();
2772 Int_t ntracks =(Int_t) treeH->GetEntries();
2774 // Start loop on tracks in the hits containers
2776 for (Int_t track=0; track<ntracks;track++) {
2777 printf ("Processing Track: %d\n",track);
2778 gAlice->ResetHits();
2779 treeH->GetEvent(track);
2781 for(AliRICHHit* mHit=(AliRICHHit*)pRICH->FirstHit(-1);
2783 mHit=(AliRICHHit*)pRICH->NextHit())
2785 //Int_t nch = mHit->fChamber; // chamber number
2786 //Float_t x = mHit->X(); // x-pos of hit
2787 //Float_t y = mHit->Z(); // y-pos
2788 //Float_t z = mHit->Y();
2789 //Float_t phi = mHit->Phi(); //Phi angle of incidence
2790 Float_t theta = mHit->Theta(); //Theta angle of incidence
2791 Float_t px = mHit->MomX();
2792 Float_t py = mHit->MomY();
2793 Int_t index = mHit->Track();
2794 Int_t particle = (Int_t)(mHit->Particle());
2799 TParticle *current = gAlice->Particle(index);
2801 //Float_t energy=current->Energy();
2803 R=TMath::Sqrt(current->Vx()*current->Vx() + current->Vy()*current->Vy());
2804 PTfinal=TMath::Sqrt(px*px + py*py);
2805 PTvertex=TMath::Sqrt(current->Px()*current->Px() + current->Py()*current->Py());
2809 if (TMath::Abs(particle) < 10000000)
2811 hitsTheta->Fill(theta,(float) 1);
2814 if (PTvertex>.5 && PTvertex<=1)
2816 hitsTheta500MeV->Fill(theta,(float) 1);
2818 if (PTvertex>1 && PTvertex<=2)
2820 hitsTheta1GeV->Fill(theta,(float) 1);
2822 if (PTvertex>2 && PTvertex<=3)
2824 hitsTheta2GeV->Fill(theta,(float) 1);
2828 hitsTheta3GeV->Fill(theta,(float) 1);
2837 //printf("Particle type: %d\n",current->GetPdgCode());
2838 if (TMath::Abs(particle) < 50000051)
2840 //if (TMath::Abs(particle) == 50000050 || TMath::Abs(particle) == 2112)
2841 if (TMath::Abs(particle) == 2112 || TMath::Abs(particle) == 50000050)
2843 //gMC->Rndm(&random, 1);
2844 if (random->Rndm() < .1)
2845 production->Fill(current->Vz(),R,(float) 1);
2846 if (TMath::Abs(particle) == 50000050)
2847 //if (TMath::Abs(particle) > 50000000)
2853 if (current->Energy()>0.001)
2854 highprimaryphotons +=1;
2857 if (TMath::Abs(particle) == 2112)
2860 if (current->Energy()>0.0001)
2864 if (TMath::Abs(particle) < 50000000)
2866 production->Fill(current->Vz(),R,(float) 1);
2867 //printf("Adding %d at %f\n",particle,R);
2869 //mip->Fill(x,y,(float) 1);
2872 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
2876 pionptspectravertex->Fill(PTvertex,(float) 1);
2877 pionptspectrafinal->Fill(PTfinal,(float) 1);
2881 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
2882 || TMath::Abs(particle)==311)
2886 kaonptspectravertex->Fill(PTvertex,(float) 1);
2887 kaonptspectrafinal->Fill(PTfinal,(float) 1);
2892 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
2894 pionspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2895 //printf ("fParticle: %d, PDG code:%d\n",particle,current->GetPdgCode());
2896 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2897 pionspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2900 pionspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2901 //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);
2903 //printf("Pion mass: %e\n",current->GetCalcMass());
2905 if (TMath::Abs(particle)==211)
2911 if (current->Energy()>1)
2912 highprimarypions +=1;
2916 if (TMath::Abs(particle)==2212)
2918 protonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2919 //ptspectra->Fill(Pt,(float) 1);
2920 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2921 protonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2923 protonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2924 //printf("\n\n\n\n\n\n\nProton mass: %e\n\n\n\n\n\n\n\n\n",current->GetCalcMass());
2927 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
2928 || TMath::Abs(particle)==311)
2930 kaonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2931 //ptspectra->Fill(Pt,(float) 1);
2932 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2933 kaonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2935 kaonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2936 //printf("Kaon mass: %e\n",current->GetCalcMass());
2938 if (TMath::Abs(particle)==321)
2944 if (current->Energy()>1)
2945 highprimarykaons +=1;
2949 if (TMath::Abs(particle)==11)
2951 electronspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2952 //ptspectra->Fill(Pt,(float) 1);
2953 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2954 electronspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2956 electronspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2957 //printf("Electron mass: %e\n",current->GetCalcMass());
2960 if (particle == -11)
2963 if (TMath::Abs(particle)==13)
2965 muonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2966 //ptspectra->Fill(Pt,(float) 1);
2967 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2968 muonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2970 muonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2971 //printf("Muon mass: %e\n",current->GetCalcMass());
2974 if (TMath::Abs(particle)==2112)
2976 neutronspectra1->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 neutronspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2982 neutronspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2983 //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);
2985 //printf("Neutron mass: %e\n",current->GetCalcMass());
2988 if(TMath::Abs(particle)==211 || TMath::Abs(particle)==2212 || TMath::Abs(particle)==321)
2990 if (current->Energy()-current->GetCalcMass()>1)
2992 chargedspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2993 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2994 chargedspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2996 chargedspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2999 //printf("Hits:%d\n",hit);
3000 //printf ("Chamber number:%d x:%f y:%f\n",nch,x,y);
3001 // Fill the histograms
3003 //h->Fill(x,y,(float) 1);
3013 TStyle *mystyle=new TStyle("Plain","mystyle");
3014 mystyle->SetPalette(1,0);
3017 //Create canvases, set the view range, show histograms
3019 TCanvas *c2 = new TCanvas("c2","Angles of incidence",150,150,100,150);
3021 //c2->SetFillColor(42);
3024 hitsTheta500MeV->SetFillColor(5);
3025 hitsTheta500MeV->Draw();
3027 hitsTheta1GeV->SetFillColor(5);
3028 hitsTheta1GeV->Draw();
3030 hitsTheta2GeV->SetFillColor(5);
3031 hitsTheta2GeV->Draw();
3033 hitsTheta3GeV->SetFillColor(5);
3034 hitsTheta3GeV->Draw();
3038 TCanvas *c15 = new TCanvas("c15","Mothers Production Vertices",50,50,600,600);
3040 production->SetFillColor(42);
3041 production->SetXTitle("z (m)");
3042 production->SetYTitle("R (m)");
3045 TCanvas *c10 = new TCanvas("c10","Pt Spectra",50,50,600,700);
3048 pionptspectravertex->SetFillColor(5);
3049 pionptspectravertex->SetXTitle("Pt (GeV)");
3050 pionptspectravertex->Draw();
3052 pionptspectrafinal->SetFillColor(5);
3053 pionptspectrafinal->SetXTitle("Pt (GeV)");
3054 pionptspectrafinal->Draw();
3056 kaonptspectravertex->SetFillColor(5);
3057 kaonptspectravertex->SetXTitle("Pt (GeV)");
3058 kaonptspectravertex->Draw();
3060 kaonptspectrafinal->SetFillColor(5);
3061 kaonptspectrafinal->SetXTitle("Pt (GeV)");
3062 kaonptspectrafinal->Draw();
3065 TCanvas *c16 = new TCanvas("c16","Particles Spectra II",150,150,600,350);
3069 //TCanvas *c13 = new TCanvas("c13","Electron Spectra",400,10,600,700);
3070 electronspectra1->SetFillColor(5);
3071 electronspectra1->SetXTitle("log(GeV)");
3072 electronspectra2->SetFillColor(46);
3073 electronspectra2->SetXTitle("log(GeV)");
3074 electronspectra3->SetFillColor(10);
3075 electronspectra3->SetXTitle("log(GeV)");
3077 electronspectra1->Draw();
3078 electronspectra2->Draw("same");
3079 electronspectra3->Draw("same");
3082 //TCanvas *c14 = new TCanvas("c14","Muon Spectra",400,10,600,700);
3083 muonspectra1->SetFillColor(5);
3084 muonspectra1->SetXTitle("log(GeV)");
3085 muonspectra2->SetFillColor(46);
3086 muonspectra2->SetXTitle("log(GeV)");
3087 muonspectra3->SetFillColor(10);
3088 muonspectra3->SetXTitle("log(GeV)");
3090 muonspectra1->Draw();
3091 muonspectra2->Draw("same");
3092 muonspectra3->Draw("same");
3095 //TCanvas *c16 = new TCanvas("c16","Neutron Spectra",400,10,600,700);
3096 //neutronspectra1->SetFillColor(42);
3097 //neutronspectra1->SetXTitle("log(GeV)");
3098 //neutronspectra2->SetFillColor(46);
3099 //neutronspectra2->SetXTitle("log(GeV)");
3100 //neutronspectra3->SetFillColor(10);
3101 //neutronspectra3->SetXTitle("log(GeV)");
3103 //neutronspectra1->Draw();
3104 //neutronspectra2->Draw("same");
3105 //neutronspectra3->Draw("same");
3107 TCanvas *c9 = new TCanvas("c9","Particles Spectra",150,150,600,700);
3108 //TCanvas *c9 = new TCanvas("c9","Pion Spectra",400,10,600,700);
3112 pionspectra1->SetFillColor(5);
3113 pionspectra1->SetXTitle("log(GeV)");
3114 pionspectra2->SetFillColor(46);
3115 pionspectra2->SetXTitle("log(GeV)");
3116 pionspectra3->SetFillColor(10);
3117 pionspectra3->SetXTitle("log(GeV)");
3119 pionspectra1->Draw();
3120 pionspectra2->Draw("same");
3121 pionspectra3->Draw("same");
3124 //TCanvas *c10 = new TCanvas("c10","Proton Spectra",400,10,600,700);
3125 protonspectra1->SetFillColor(5);
3126 protonspectra1->SetXTitle("log(GeV)");
3127 protonspectra2->SetFillColor(46);
3128 protonspectra2->SetXTitle("log(GeV)");
3129 protonspectra3->SetFillColor(10);
3130 protonspectra3->SetXTitle("log(GeV)");
3132 protonspectra1->Draw();
3133 protonspectra2->Draw("same");
3134 protonspectra3->Draw("same");
3137 //TCanvas *c11 = new TCanvas("c11","Kaon Spectra",400,10,600,700);
3138 kaonspectra1->SetFillColor(5);
3139 kaonspectra1->SetXTitle("log(GeV)");
3140 kaonspectra2->SetFillColor(46);
3141 kaonspectra2->SetXTitle("log(GeV)");
3142 kaonspectra3->SetFillColor(10);
3143 kaonspectra3->SetXTitle("log(GeV)");
3145 kaonspectra1->Draw();
3146 kaonspectra2->Draw("same");
3147 kaonspectra3->Draw("same");
3150 //TCanvas *c12 = new TCanvas("c12","Charged Particles Spectra",400,10,600,700);
3151 chargedspectra1->SetFillColor(5);
3152 chargedspectra1->SetXTitle("log(GeV)");
3153 chargedspectra2->SetFillColor(46);
3154 chargedspectra2->SetXTitle("log(GeV)");
3155 chargedspectra3->SetFillColor(10);
3156 chargedspectra3->SetXTitle("log(GeV)");
3158 chargedspectra1->Draw();
3159 chargedspectra2->Draw("same");
3160 chargedspectra3->Draw("same");
3164 printf("*****************************************\n");
3165 printf("* Particle * Counts *\n");
3166 printf("*****************************************\n");
3168 printf("* Pions: * %4d *\n",pion);
3169 printf("* Charged Pions: * %4d *\n",chargedpions);
3170 printf("* Primary Pions: * %4d *\n",primarypions);
3171 printf("* Primary Pions (p>1GeV/c): * %4d *\n",highprimarypions);
3172 printf("* Kaons: * %4d *\n",kaon);
3173 printf("* Charged Kaons: * %4d *\n",chargedkaons);
3174 printf("* Primary Kaons: * %4d *\n",primarykaons);
3175 printf("* Primary Kaons (p>1GeV/c): * %4d *\n",highprimarykaons);
3176 printf("* Muons: * %4d *\n",muon);
3177 printf("* Electrons: * %4d *\n",electron);
3178 printf("* Positrons: * %4d *\n",positron);
3179 printf("* Protons: * %4d *\n",proton);
3180 printf("* All Charged: * %4d *\n",(chargedpions+chargedkaons+muon+electron+positron+proton));
3181 printf("*****************************************\n");
3182 //printf("* Photons: * %3.1f *\n",photons);
3183 //printf("* Primary Photons: * %3.1f *\n",primaryphotons);
3184 //printf("* Primary Photons (p>1MeV/c):* %3.1f *\n",highprimaryphotons);
3185 //printf("*****************************************\n");
3186 //printf("* Neutrons: * %3.1f *\n",neutron);
3187 //printf("* Neutrons (p>100keV/c): * %3.1f *\n",highneutrons);
3188 //printf("*****************************************\n");
3190 if (gAlice->TreeD())
3192 gAlice->TreeD()->GetEvent(0);
3197 printf("\n*****************************************\n");
3198 printf("* Chamber * Digits * Occupancy *\n");
3199 printf("*****************************************\n");
3201 for (Int_t ich=0;ich<7;ich++)
3203 TClonesArray *Digits = DigitsAddress(ich); // Raw clusters branch
3204 Int_t ndigits = Digits->GetEntriesFast();
3205 occ[ich] = Float_t(ndigits)/(160*144);
3206 sum += Float_t(ndigits)/(160*144);
3207 printf("* %d * %d * %3.1f%% *\n",ich,ndigits,occ[ich]*100);
3210 printf("*****************************************\n");
3211 printf("* Mean occupancy * %3.1f%% *\n",mean*100);
3212 printf("*****************************************\n");
3215 printf("\nEnd of analysis\n");
3219 //_________________________________________________________________________________________________
3222 void AliRICH::DiagnosticsSE(Int_t diaglevel,Int_t evNumber1,Int_t evNumber2)
3225 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
3226 AliRICHSegmentationV0* segmentation;
3227 AliRICHChamber* chamber;
3229 chamber = &(pRICH->Chamber(0));
3230 segmentation=(AliRICHSegmentationV0*) chamber->GetSegmentationModel();
3232 Int_t NpadX = segmentation->Npx(); // number of pads on X
3233 Int_t NpadY = segmentation->Npy(); // number of pads on Y
3235 //Int_t Pad[144][160];
3236 /*for (Int_t i=0;i<NpadX;i++) {
3237 for (Int_t j=0;j<NpadY;j++) {
3243 Int_t xmin= -NpadX/2;
3244 Int_t xmax= NpadX/2;
3245 Int_t ymin= -NpadY/2;
3246 Int_t ymax= NpadY/2;
3248 Float_t PTfinal = 0;
3249 Int_t pionCount = 0;
3250 Int_t kaonCount = 0;
3251 Int_t protonCount = 0;
3260 TH2F *hc0 = new TH2F("hc0","Zoom on center of central chamber",150,-25,25,150,-45,5);
3264 printf("Single Ring Hits\n");
3265 feedback = new TH2F("feedback","Feedback hit distribution",150,-20,20,150,-35,5);
3266 mip = new TH2F("mip","Mip hit distribution",150,-20,20,150,-35,5);
3267 cerenkov = new TH2F("cerenkov","Cerenkov hit distribution",150,-20,20,150,-35,5);
3268 h = new TH2F("h","Detector hit distribution",150,-20,20,150,-35,5);
3269 hitsX = new TH1F("hitsX","Distribution of hits along x-axis",150,-50,50);
3270 hitsY = new TH1F("hitsY","Distribution of hits along z-axis",150,-50,50);
3274 printf("Full Event Hits\n");
3276 feedback = new TH2F("feedback","Feedback hit distribution",150,-300,300,150,-300,300);
3277 mip = new TH2F("mip","Mip hit distribution",150,-300,300,150,-300,300);
3278 cerenkov = new TH2F("cerenkov","Cerenkov hit distribution",150,-300,300,150,-300,300);
3279 h = new TH2F("h","Detector hit distribution",150,-300,300,150,-300,300);
3280 hitsX = new TH1F("digitsX","Distribution of hits along x-axis",200,-300,300);
3281 hitsY = new TH1F("digitsY","Distribution of hits along z-axis",200,-300,300);
3286 TH2F *hc1 = new TH2F("hc1","Chamber 1 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3287 TH2F *hc2 = new TH2F("hc2","Chamber 2 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3288 TH2F *hc3 = new TH2F("hc3","Chamber 3 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3289 TH2F *hc4 = new TH2F("hc4","Chamber 4 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3290 TH2F *hc5 = new TH2F("hc5","Chamber 5 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3291 TH2F *hc6 = new TH2F("hc6","Chamber 6 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3292 TH2F *hc7 = new TH2F("hc7","Chamber 7 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3294 TH1F *Clcharge = new TH1F("Clcharge","Cluster Charge Distribution",500,0.,500.);
3295 TH1F *ckovangle = new TH1F("ckovangle","Cerenkov angle per photon",100,.35,.8);
3296 TH1F *hckphi = new TH1F("hckphi","Cerenkov phi angle per photon",620,-3.1,3.1);
3297 TH1F *mother = new TH1F("mother","Cerenkovs per Mip",75,0.,75.);
3298 TH1F *radius = new TH1F("radius","Mean distance to Mip",100,0.,20.);
3299 TH1F *phspectra1 = new TH1F("phspectra1","Detected Photon Spectra",200,5.,10.);
3300 TH1F *phspectra2 = new TH1F("phspectra2","Produced Photon Spectra",200,5.,10.);
3301 TH1F *totalphotonstrack = new TH1F("totalphotonstrack","Produced Photons per Mip",100,200,700.);
3302 TH1F *totalphotonsevent = new TH1F("totalphotonsevent","Produced Photons per Mip",100,200,700.);
3303 //TH1F *feedbacks = new TH1F("feedbacks","Produced Feedbacks per Mip",50,0.5,50.);
3304 TH1F *padnumber = new TH1F("padnumber","Number of pads per cluster",50,-0.5,50.);
3305 TH1F *padsev = new TH1F("padsev","Number of pads hit per MIP",50,0.5,100.);
3306 TH1F *clusev = new TH1F("clusev","Number of clusters per MIP",50,0.5,50.);
3307 TH1F *photev = new TH1F("photev","Number of detected photons per MIP",50,0.5,50.);
3308 TH1F *feedev = new TH1F("feedev","Number of feedbacks per MIP",50,0.5,50.);
3309 TH1F *padsmip = new TH1F("padsmip","Number of pads per event inside MIP region",50,0.5,50.);
3310 TH1F *padscl = new TH1F("padscl","Number of pads per event from cluster count",50,0.5,100.);
3311 TH1F *pionspectra = new TH1F("pionspectra","Pion Spectra",200,.5,10.);
3312 TH1F *protonspectra = new TH1F("protonspectra","Proton Spectra",200,.5,10.);
3313 TH1F *kaonspectra = new TH1F("kaonspectra","Kaon Spectra",100,.5,10.);
3314 TH1F *chargedspectra = new TH1F("chargedspectra","Charged particles above 1 GeV Spectra",100,.5,10.);
3315 TH1F *hitsPhi = new TH1F("hitsPhi","Distribution of phi angle of incidence",50,0,360);
3316 TH1F *hitsTheta = new TH1F("hitsTheta","Distribution of theta angle of incidence",50,0,15);
3317 TH1F *Omega1D = new TH1F("omega","Reconstructed Cerenkov angle per track",50,.5,1);
3318 TH1F *Theta = new TH1F("theta","Reconstructed theta incidence angle per track",100,0,15);
3319 TH1F *Phi = new TH1F("phi","Reconstructed phi incidence per track",100,0,360);
3320 TH1F *Omega3D = new TH1F("omega","Reconstructed Cerenkov angle per track",100,.35,.8);
3321 TH1F *PhotonCer = new TH1F("photoncer","Reconstructed Cerenkov angle per photon",100,.35,.8);
3322 TH2F *PadsUsed = new TH2F("padsused","Pads Used for Reconstruction",100,-30,30,100,-30,30);
3323 TH1F *MeanRadius = new TH1F("radius","Mean Radius for reconstructed track",100,0.,20.);
3324 TH2F *identification = new TH2F("identification","Particle Identification",100,1,5,100,0,.8);
3325 TH1F *OriginalOmega = new TH1F("Original Omega","Cerenkov angle per track",100,.35,.8);
3326 TH1F *OriginalPhi = new TH1F("Original Phi","Distribution of phi angle of incidence per track",100,0,360);
3327 TH1F *OriginalTheta = new TH1F("Original Theta","Distribution of theta angle per track",100,0,15);
3328 TH1F *OmegaError = new TH1F("Omega Error","Difference between original an reconstructed cerenkov angle",100,0,.2);
3329 TH1F *PhiError = new TH1F("Phi Error","Difference between original an reconstructed phi angle",100,0,360);
3330 TH1F *ThetaError = new TH1F("Theta Error","Difference between original an reconstructed phi angle",100,0,15);
3333 // Start loop over events
3338 Int_t mothers[80000];
3339 Int_t mothers2[80000];
3347 Float_t chiSquareOmega = 0;
3348 Float_t chiSquareTheta = 0;
3349 Float_t chiSquarePhi = 0;
3351 Float_t recEffEvent = 0;
3352 Float_t recEffTotal = 0;
3354 Float_t trackglob[3];
3355 Float_t trackloc[3];
3358 for (Int_t i=0;i<100;i++) mothers[i]=0;
3360 for (int nev=0; nev<= evNumber2; nev++) {
3361 Int_t nparticles = gAlice->GetEvent(nev);
3364 //cout<<"nev "<<nev<<endl;
3365 printf ("\n**********************************\nProcessing Event: %d\n",nev);
3366 //cout<<"nparticles "<<nparticles<<endl;
3367 printf ("Particles : %d\n\n",nparticles);
3368 if (nev < evNumber1) continue;
3369 if (nparticles <= 0) return;
3371 // Get pointers to RICH detector and Hits containers
3374 TTree *TH = gAlice->TreeH();
3375 Stat_t ntracks = TH->GetEntries();
3377 // Start loop on tracks in the hits containers
3379 for (Int_t track=0; track<ntracks;track++) {
3381 printf ("\nProcessing Track: %d\n",track);
3382 gAlice->ResetHits();
3383 TH->GetEvent(track);
3384 Int_t nhits = pRICH->Hits()->GetEntriesFast();
3385 if (nhits) Nh+=nhits;
3386 printf("Hits : %d\n",nhits);
3387 for(AliRICHHit* mHit=(AliRICHHit*)pRICH->FirstHit(-1);
3389 mHit=(AliRICHHit*)pRICH->NextHit())
3391 Int_t nch = mHit->Chamber(); // chamber number
3392 trackglob[0] = mHit->X(); // x-pos of hit
3393 trackglob[1] = mHit->Y();
3394 trackglob[2] = mHit->Z(); // y-pos of hit
3395 //x = mHit->X(); // x-pos of hit
3396 //y = mHit->Z(); // y-pos
3397 Float_t phi = mHit->Phi(); //Phi angle of incidence
3398 Float_t theta = mHit->Theta(); //Theta angle of incidence
3399 Int_t index = mHit->Track();
3400 Int_t particle = (Int_t)(mHit->Particle());
3401 //Int_t freon = (Int_t)(mHit->fLoss);
3402 Float_t px = mHit->MomX();
3403 Float_t py = mHit->MomY();
3405 if (TMath::Abs(particle) < 10000000)
3407 PTfinal=TMath::Sqrt(px*px + py*py);
3408 //printf("PTfinal 0: %f\n",PTfinal);
3411 chamber = &(pRICH->Chamber(nch-1));
3413 //printf("Nch:%d\n",nch);
3415 chamber->GlobaltoLocal(trackglob,trackloc);
3417 chamber->LocaltoGlobal(trackloc,trackglob);
3423 hitsX->Fill(x,(float) 1);
3424 hitsY->Fill(y,(float) 1);
3426 //printf("Particle:%9d\n",particle);
3428 TParticle *current = (TParticle*)gAlice->Particle(index);
3429 //printf("Particle type: %d\n",sizeoff(Particles));
3431 hitsTheta->Fill(theta,(float) 1);
3432 //hitsPhi->Fill(phi,(float) 1);
3433 //if (pRICH->GetDebugLevel() == -1)
3434 //printf("Theta:%f, Phi:%f\n",theta,phi);
3436 //printf("Debug Level:%d\n",pRICH->GetDebugLevel());
3438 if (current->GetPdgCode() < 10000000)
3440 mip->Fill(x,y,(float) 1);
3441 //printf("adding mip\n");
3442 //if (current->Energy() - current->GetCalcMass()>1 && freon==1)
3444 hitsPhi->Fill(TMath::Abs(phi),(float) 1);
3445 //hitsTheta->Fill(theta,(float) 1);
3446 //printf("Theta:%f, Phi:%f\n",theta,phi);
3450 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
3452 pionspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
3454 if (TMath::Abs(particle)==2212)
3456 protonspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
3458 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
3459 || TMath::Abs(particle)==311)
3461 kaonspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
3463 if(TMath::Abs(particle)==211 || TMath::Abs(particle)==2212 || TMath::Abs(particle)==321)
3465 if (current->Energy() - current->GetCalcMass()>1)
3466 chargedspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
3468 //printf("Hits:%d\n",hit);
3469 //printf ("Chamber number:%d x:%f y:%f\n",nch,x,y);
3470 // Fill the histograms
3472 h->Fill(x,y,(float) 1);
3477 Int_t ncerenkovs = pRICH->Cerenkovs()->GetEntriesFast();
3478 //if (current->GetPdgCode() < 50000051 && current->GetPdgCode() > 50000040)
3479 //totalphotonsevent->Fill(ncerenkovs,(float) 1);
3482 printf("Cerenkovs : %d\n",ncerenkovs);
3483 totalphotonsevent->Fill(ncerenkovs,(float) 1);
3484 for (Int_t hit=0;hit<ncerenkovs;hit++) {
3485 AliRICHCerenkov* cHit = (AliRICHCerenkov*) pRICH->Cerenkovs()->UncheckedAt(hit);
3486 Int_t nchamber = cHit->fChamber; // chamber number
3487 Int_t index = cHit->Track();
3488 //Int_t pindex = (Int_t)(cHit->fIndex);
3489 trackglob[0] = cHit->X(); // x-pos of hit
3490 trackglob[1] = cHit->Y();
3491 trackglob[2] = cHit->Z(); // y-pos of hit
3492 //Float_t cx = cHit->X(); // x-position
3493 //Float_t cy = cHit->Z(); // y-position
3494 Int_t cmother = cHit->fCMother; // Index of mother particle
3495 Int_t closs = (Int_t)(cHit->fLoss); // How did the particle get lost?
3496 Float_t cherenkov = cHit->fCerenkovAngle; //production cerenkov angle
3498 chamber = &(pRICH->Chamber(nchamber-1));
3500 //printf("Nch:%d\n",nch);
3502 chamber->GlobaltoLocal(trackglob,trackloc);
3504 chamber->LocaltoGlobal(trackloc,trackglob);
3507 Float_t cx=trackloc[0];
3508 Float_t cy=trackloc[2];
3510 //printf ("Cerenkov hit number %d/%d, X:%f, Y:%f\n",hit,ncerenkovs,cx,cy);
3513 //printf("Particle:%9d\n",index);
3515 TParticle *current = (TParticle*)gAlice->Particle(index);
3516 Float_t energyckov = current->Energy();
3518 if (current->GetPdgCode() == 50000051)
3522 feedback->Fill(cx,cy,(float) 1);
3526 if (current->GetPdgCode() == 50000050)
3531 phspectra2->Fill(energyckov*1e9,(float) 1);
3536 cerenkov->Fill(cx,cy,(float) 1);
3538 //printf ("Cerenkov hit number %d/%d, X:%d, Y:%d\n",hit,ncerenkovs,cx,cy);
3540 //TParticle *MIP = (TParticle*)gAlice->Particle(cmother);
3541 AliRICHHit* mipHit = (AliRICHHit*) pRICH->Hits()->UncheckedAt(0);
3542 mom[0] = current->Px();
3543 mom[1] = current->Py();
3544 mom[2] = current->Pz();
3545 //mom[0] = cHit->fMomX;
3546 // mom[1] = cHit->fMomZ;
3547 //mom[2] = cHit->fMomY;
3548 //Float_t energymip = MIP->Energy();
3549 //Float_t Mip_px = mipHit->fMomFreoX;
3550 //Float_t Mip_py = mipHit->fMomFreoY;
3551 //Float_t Mip_pz = mipHit->fMomFreoZ;
3552 //Float_t Mip_px = MIP->Px();
3553 //Float_t Mip_py = MIP->Py();
3554 //Float_t Mip_pz = MIP->Pz();
3558 //Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
3559 //Float_t rt = TMath::Sqrt(r);
3560 //Float_t Mip_r = Mip_px*Mip_px + Mip_py*Mip_py + Mip_pz*Mip_pz;
3561 //Float_t Mip_rt = TMath::Sqrt(Mip_r);
3562 //Float_t coscerenkov = (mom[0]*Mip_px + mom[1]*Mip_py + mom[2]*Mip_pz)/(rt*Mip_rt+0.0000001);
3563 //Float_t cherenkov = TMath::ACos(coscerenkov);
3564 ckovangle->Fill(cherenkov,(float) 1); //Cerenkov angle calculus
3565 //printf("Cherenkov: %f\n",cherenkov);
3566 Float_t ckphi=TMath::ATan2(mom[0], mom[2]);
3567 hckphi->Fill(ckphi,(float) 1);
3570 //Float_t mix = MIP->Vx();
3571 //Float_t miy = MIP->Vy();
3572 Float_t mx = mipHit->X();
3573 Float_t my = mipHit->Z();
3574 //printf("FX %e, FY %e, VX %e, VY %e\n",cx,cy,mx,my);
3575 Float_t dx = trackglob[0] - mx;
3576 Float_t dy = trackglob[2] - my;
3577 //printf("Dx:%f, Dy:%f\n",dx,dy);
3578 Float_t final_radius = TMath::Sqrt(dx*dx+dy*dy);
3579 //printf("Final radius:%f\n",final_radius);
3580 radius->Fill(final_radius,(float) 1);
3582 phspectra1->Fill(energyckov*1e9,(float) 1);
3585 for (Int_t nmothers=0;nmothers<=ntracks;nmothers++){
3586 if (cmother == nmothers){
3588 mothers2[cmother]++;
3599 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
3600 gAlice->TreeR()->GetEvent(nent-1);
3601 TClonesArray *Rawclusters = pRICH->RawClustAddress(2); // Raw clusters branch
3602 //printf ("Rawclusters:%p",Rawclusters);
3603 Int_t nrawclusters = Rawclusters->GetEntriesFast();
3606 printf("Raw Clusters : %d\n",nrawclusters);
3607 for (Int_t hit=0;hit<nrawclusters;hit++) {
3608 AliRICHRawCluster* rcHit = (AliRICHRawCluster*) pRICH->RawClustAddress(2)->UncheckedAt(hit);
3609 //Int_t nchamber = rcHit->fChamber; // chamber number
3610 //Int_t nhit = cHit->fHitNumber; // hit number
3611 Int_t qtot = rcHit->fQ; // charge
3612 Float_t fx = rcHit->fX; // x-position
3613 Float_t fy = rcHit->fY; // y-position
3614 //Int_t type = rcHit->fCtype; // cluster type ?
3615 Int_t mult = rcHit->fMultiplicity; // How many pads form the cluster
3618 //printf ("fx: %d, fy: %d\n",fx,fy);
3619 if (fx>(x-4) && fx<(x+4) && fy>(y-4) && fy<(y+4)) {
3620 //printf("There %d \n",mult);
3623 padnumber->Fill(mult,(float) 1);
3625 if (mult<4) Clcharge->Fill(qtot,(float) 1);
3633 TClonesArray *RecHits1D = pRICH->RecHitsAddress1D(2);
3634 Int_t nrechits1D = RecHits1D->GetEntriesFast();
3635 //printf (" nrechits:%d\n",nrechits);
3639 for (Int_t hit=0;hit<nrechits1D;hit++) {
3640 AliRICHRecHit1D* recHit1D = (AliRICHRecHit1D*) pRICH->RecHitsAddress1D(2)->UncheckedAt(hit);
3641 Float_t r_omega = recHit1D->fOmega; // Cerenkov angle
3642 Float_t *cer_pho = recHit1D->fCerPerPhoton; // Cerenkov angle per photon
3643 Int_t *padsx = recHit1D->fPadsUsedX; // Pads Used fo reconstruction (x)
3644 Int_t *padsy = recHit1D->fPadsUsedY; // Pads Used fo reconstruction (y)
3645 Int_t goodPhotons = recHit1D->fGoodPhotons; // Number of pads used for reconstruction
3647 Omega1D->Fill(r_omega,(float) 1);
3649 for (Int_t i=0; i<goodPhotons; i++)
3651 PhotonCer->Fill(cer_pho[i],(float) 1);
3652 PadsUsed->Fill(padsx[i],padsy[i],1);
3653 //printf("Angle:%f, pad: %d %d\n",cer_pho[i],padsx[i],padsy[i]);
3656 //printf("Omega: %f, Theta: %f, Phi: %f\n",r_omega,r_theta,r_phi);
3661 TClonesArray *RecHits3D = pRICH->RecHitsAddress3D(2);
3662 Int_t nrechits3D = RecHits3D->GetEntriesFast();
3663 //printf (" nrechits:%d\n",nrechits);
3669 //for (Int_t hit=0;hit<nrechits3D;hit++) {
3670 AliRICHRecHit3D* recHit3D = (AliRICHRecHit3D*) pRICH->RecHitsAddress3D(2)->UncheckedAt(track);
3671 Float_t r_omega = recHit3D->fOmega; // Cerenkov angle
3672 Float_t r_theta = recHit3D->fTheta; // Theta angle of incidence
3673 Float_t r_phi = recHit3D->fPhi; // Phi angle if incidence
3674 Float_t meanradius = recHit3D->fMeanRadius; // Mean radius for reconstructed point
3675 Float_t originalOmega = recHit3D->fOriginalOmega; // Real Cerenkov angle
3676 Float_t originalTheta = recHit3D->fOriginalTheta; // Real incidence angle
3677 Float_t originalPhi = recHit3D->fOriginalPhi; // Real azimuthal angle
3680 //correction to track cerenkov angle
3681 originalOmega = (Float_t) ckovangle->GetMean();
3685 printf("\nMean cerenkov angle: %f\n", originalOmega);
3686 printf("Reconstructed cerenkov angle: %f\n",r_omega);
3689 Float_t omegaError = TMath::Abs(originalOmega - r_omega);
3690 Float_t thetaError = TMath::Abs(originalTheta - r_theta);
3691 Float_t phiError = TMath::Abs(originalPhi - r_phi);
3693 //chiSquareOmega += (omegaError/originalOmega)*(omegaError/originalOmega);
3694 //chiSquareTheta += (thetaError/originalTheta)*(thetaError/originalTheta);
3695 //chiSquarePhi += (phiError/originalPhi)*(phiError/originalPhi);
3697 if(TMath::Abs(omegaError) < 0.015)
3702 //printf("rechit %f %f %f %f %f\n",recHit3D->fOmega,recHit3D->fTheta,recHit3D->fPhi, recHit3D->fX,recHit3D->fY);
3704 Omega3D->Fill(r_omega,(float) 1);
3705 Theta->Fill(r_theta*180/TMath::Pi(),(float) 1);
3706 Phi->Fill(r_phi*180/TMath::Pi()-180,(float) 1);
3707 MeanRadius->Fill(meanradius,(float) 1);
3708 identification->Fill(PTfinal, r_omega,1);
3709 OriginalOmega->Fill(originalOmega, (float) 1);
3710 OriginalTheta->Fill(originalTheta, (float) 1);
3711 OriginalPhi->Fill(TMath::Abs(originalPhi), (float) 1);
3712 OmegaError->Fill(omegaError, (float) 1);
3713 ThetaError->Fill(thetaError, (float) 1);
3714 PhiError->Fill(phiError, (float) 1);
3716 recEffEvent = recEffEvent;
3717 recEffTotal += recEffEvent;
3719 Float_t pioncer = acos(sqrt((.139*.139+PTfinal*PTfinal)/(PTfinal*PTfinal*1.285*1.285)));
3720 Float_t kaoncer = acos(sqrt((.439*.439+PTfinal*PTfinal)/(PTfinal*PTfinal*1.285*1.285)));
3721 Float_t protoncer = acos(sqrt((.938*.938+PTfinal*PTfinal)/(PTfinal*PTfinal*1.285*1.285)));
3723 Float_t piondist = TMath::Abs(r_omega - pioncer);
3724 Float_t kaondist = TMath::Abs(r_omega - kaoncer);
3725 Float_t protondist = TMath::Abs(r_omega - protoncer);
3731 printf("Identified as a PION!\n");
3734 if(kaoncer<r_omega && pioncer>r_omega)
3736 if(kaondist>piondist)
3738 printf("Identified as a PION!\n");
3743 printf("Identified as a KAON!\n");
3747 if(protoncer<r_omega && kaoncer>r_omega)
3749 if(kaondist>protondist)
3751 printf("Identified as a PROTON!\n");
3756 printf("Identified as a KAON!\n");
3760 if(protoncer>r_omega)
3762 printf("Identified as a PROTON!\n");
3766 printf("\nReconstruction efficiency: %5.2f%%\n", recEffEvent*100);
3772 for (Int_t nmothers=0;nmothers<ntracks;nmothers++){
3773 totalphotonstrack->Fill(mothers[nmothers],(float) 1);
3774 mother->Fill(mothers2[nmothers],(float) 1);
3775 //printf ("Entries in %d : %d\n",nmothers, mothers[nmothers]);
3778 clusev->Fill(nraw,(float) 1);
3779 photev->Fill(phot,(float) 1);
3780 feedev->Fill(feed,(float) 1);
3781 padsmip->Fill(padmip,(float) 1);
3782 padscl->Fill(pads,(float) 1);
3783 //printf("Photons:%d\n",phot);
3792 gAlice->ResetDigits();
3793 //Int_t nent=(Int_t)gAlice->TreeD()->GetEntries();
3794 gAlice->TreeD()->GetEvent(0);
3800 TClonesArray *Digits = pRICH->DigitsAddress(2);
3801 Int_t ndigits = Digits->GetEntriesFast();
3802 printf("Digits : %d\n",ndigits);
3803 padsev->Fill(ndigits,(float) 1);
3804 for (Int_t hit=0;hit<ndigits;hit++) {
3805 AliRICHDigit* dHit = (AliRICHDigit*) Digits->UncheckedAt(hit);
3806 Int_t qtot = dHit->Signal(); // charge
3807 Int_t ipx = dHit->PadX(); // pad number on X
3808 Int_t ipy = dHit->PadY(); // pad number on Y
3809 //printf("%d, %d\n",ipx,ipy);
3810 if( ipx<=100 && ipy <=100) hc0->Fill(ipx,ipy,(float) qtot);
3816 for (Int_t ich=0;ich<7;ich++)
3818 TClonesArray *Digits = pRICH->DigitsAddress(ich); // Raw clusters branch
3819 Int_t ndigits = Digits->GetEntriesFast();
3820 //printf("Digits:%d\n",ndigits);
3821 padsev->Fill(ndigits,(float) 1);
3823 for (Int_t hit=0;hit<ndigits;hit++) {
3824 AliRICHDigit* dHit = (AliRICHDigit*) Digits->UncheckedAt(hit);
3825 //Int_t nchamber = dHit->GetChamber(); // chamber number
3826 //Int_t nhit = dHit->fHitNumber; // hit number
3827 Int_t qtot = dHit->Signal(); // charge
3828 Int_t ipx = dHit->PadX(); // pad number on X
3829 Int_t ipy = dHit->PadY(); // pad number on Y
3830 //Int_t iqpad = dHit->fQpad; // charge per pad
3831 //Int_t rpad = dHit->fRSec; // R-position of pad
3832 //printf ("Pad hit, PadX:%d, PadY:%d\n",ipx,ipy);
3833 if( ipx<=100 && ipy <=100 && ich==2) hc0->Fill(ipx,ipy,(float) qtot);
3834 if( ipx<=162 && ipy <=162 && ich==0) hc1->Fill(ipx,ipy,(float) qtot);
3835 if( ipx<=162 && ipy <=162 && ich==1) hc2->Fill(ipx,ipy,(float) qtot);
3836 if( ipx<=162 && ipy <=162 && ich==2) hc3->Fill(ipx,ipy,(float) qtot);
3837 if( ipx<=162 && ipy <=162 && ich==3) hc4->Fill(ipx,ipy,(float) qtot);
3838 if( ipx<=162 && ipy <=162 && ich==4) hc5->Fill(ipx,ipy,(float) qtot);
3839 if( ipx<=162 && ipy <=162 && ich==5) hc6->Fill(ipx,ipy,(float) qtot);
3840 if( ipx<=162 && ipy <=162 && ich==6) hc7->Fill(ipx,ipy,(float) qtot);
3858 for(Int_t i=0;i<99;i++)
3860 omegaE = OriginalOmega->GetBinContent(i);
3863 omegaO = Omega3D->GetBinContent(i);
3864 chiSquareOmega += (TMath::Power(omegaE,2) - TMath::Power(omegaO,2))/omegaO;
3867 thetaE = OriginalTheta->GetBinContent(i);
3870 thetaO = Theta->GetBinContent(i);
3871 chiSquareTheta += (TMath::Power(thetaE,2) - TMath::Power(thetaO,2))/thetaO;
3874 phiE = OriginalPhi->GetBinContent(i);
3877 phiO = Phi->GetBinContent(i);
3878 chiSquarePhi += (TMath::Power(phiE,2) - TMath::Power(phiO,2))/phiO;
3881 //printf(" o: %f t: %f p: %f\n", OriginalOmega->GetBinContent(i), OriginalTheta->GetBinContent(i),OriginalPhi->GetBinContent(i));
3887 printf("\nChi square test values: Omega - %f\n", chiSquareOmega);
3888 printf(" Theta - %f\n", chiSquareTheta);
3889 printf(" Phi - %f\n", chiSquarePhi);
3891 printf("\nKolmogorov test values: Omega - %5.4f\n", Omega3D->KolmogorovTest(OriginalOmega));
3892 printf(" Theta - %5.4f\n", Theta->KolmogorovTest(OriginalTheta));
3893 printf(" Phi - %5.4f\n", Phi->KolmogorovTest(OriginalPhi));
3895 recEffTotal = recEffTotal/evNumber2;
3896 printf("\nTotal reconstruction efficiency: %5.2f%%\n", recEffTotal*100);
3897 printf("\n Pions: %d\n Kaons: %d\n Protons:%d\n",pionCount, kaonCount, protonCount);
3902 //Create canvases, set the view range, show histograms
3921 TStyle *mystyle=new TStyle("Plain","mystyle");
3922 mystyle->SetPalette(1,0);
3923 //mystyle->SetTitleYSize(0.2);
3924 //mystyle->SetStatW(0.19);
3925 //mystyle->SetStatH(0.1);
3926 //mystyle->SetStatFontSize(0.01);
3927 //mystyle->SetTitleYSize(0.3);
3928 mystyle->SetFuncColor(2);
3929 //mystyle->SetOptStat(0111);
3930 mystyle->SetDrawBorder(0);
3931 mystyle->SetTitleBorderSize(0);
3932 mystyle->SetOptFit(1111);
3936 TClonesArray *RecHits3D = pRICH->RecHitsAddress3D(2);
3937 Int_t nrechits3D = RecHits3D->GetEntriesFast();
3938 TClonesArray *RecHits1D = pRICH->RecHitsAddress1D(2);
3939 Int_t nrechits1D = RecHits1D->GetEntriesFast();
3945 c1 = new TCanvas("c1","Alice RICH digits",50,50,300,350);
3946 hc0->SetXTitle("ix (npads)");
3950 c2 = new TCanvas("c2","Hits per type",100,100,600,700);
3952 //c4->SetFillColor(42);
3955 feedback->SetXTitle("x (cm)");
3956 feedback->SetYTitle("y (cm)");
3957 feedback->Draw("colz");
3960 //mip->SetFillColor(5);
3961 mip->SetXTitle("x (cm)");
3962 mip->SetYTitle("y (cm)");
3966 //cerenkov->SetFillColor(5);
3967 cerenkov->SetXTitle("x (cm)");
3968 cerenkov->SetYTitle("y (cm)");
3969 cerenkov->Draw("colz");
3972 //h->SetFillColor(5);
3973 h->SetXTitle("x (cm)");
3974 h->SetYTitle("y (cm)");
3977 c3 = new TCanvas("c3","Hits distribution",150,150,600,350);
3979 //c10->SetFillColor(42);
3982 hitsX->SetFillColor(5);
3983 hitsX->SetXTitle("(cm)");
3987 hitsY->SetFillColor(5);
3988 hitsY->SetXTitle("(cm)");
3996 c4 = new TCanvas("c4","Photon Spectra",50,50,600,350);
3998 //c6->SetFillColor(42);
4001 phspectra2->SetFillColor(5);
4002 phspectra2->SetXTitle("energy (eV)");
4005 phspectra1->SetFillColor(5);
4006 phspectra1->SetXTitle("energy (eV)");
4009 c5 = new TCanvas("c5","Particles Spectra",100,100,600,700);
4011 //c9->SetFillColor(42);
4014 pionspectra->SetFillColor(5);
4015 pionspectra->SetXTitle("(GeV)");
4016 pionspectra->Draw();
4019 protonspectra->SetFillColor(5);
4020 protonspectra->SetXTitle("(GeV)");
4021 protonspectra->Draw();
4024 kaonspectra->SetFillColor(5);
4025 kaonspectra->SetXTitle("(GeV)");
4026 kaonspectra->Draw();
4029 chargedspectra->SetFillColor(5);
4030 chargedspectra->SetXTitle("(GeV)");
4031 chargedspectra->Draw();
4040 c6=new TCanvas("c6","Clusters Statistics",50,50,600,700);
4042 //c3->SetFillColor(42);
4047 Clcharge->SetFillColor(5);
4048 Clcharge->SetXTitle("ADC counts");
4051 Clcharge->Fit("expo");
4052 //expo->SetLineColor(2);
4053 //expo->SetLineWidth(3);
4058 padnumber->SetFillColor(5);
4059 padnumber->SetXTitle("(counts)");
4063 clusev->SetFillColor(5);
4064 clusev->SetXTitle("(counts)");
4067 clusev->Fit("gaus");
4068 //gaus->SetLineColor(2);
4069 //gaus->SetLineWidth(3);
4074 padsmip->SetFillColor(5);
4075 padsmip->SetXTitle("(counts)");
4081 c11 = new TCanvas("c11","Cherenkov per Mip",400,10,600,700);
4082 mother->SetFillColor(5);
4083 mother->SetXTitle("counts");
4087 c7 = new TCanvas("c7","Production Statistics",100,100,600,700);
4089 //c7->SetFillColor(42);
4092 totalphotonsevent->SetFillColor(5);
4093 totalphotonsevent->SetXTitle("Photons (counts)");
4096 totalphotonsevent->Fit("gaus");
4097 //gaus->SetLineColor(2);
4098 //gaus->SetLineWidth(3);
4100 totalphotonsevent->Draw();
4103 photev->SetFillColor(5);
4104 photev->SetXTitle("(counts)");
4107 photev->Fit("gaus");
4108 //gaus->SetLineColor(2);
4109 //gaus->SetLineWidth(3);
4114 feedev->SetFillColor(5);
4115 feedev->SetXTitle("(counts)");
4118 feedev->Fit("gaus");
4119 //gaus->SetLineColor(2);
4120 //gaus->SetLineWidth(3);
4125 padsev->SetFillColor(5);
4126 padsev->SetXTitle("(counts)");
4129 padsev->Fit("gaus");
4130 //gaus->SetLineColor(2);
4131 //gaus->SetLineWidth(3);
4142 c8 = new TCanvas("c8","3D reconstruction of Phi angle",50,50,300,1050);
4144 //c2->SetFillColor(42);
4149 hitsPhi->SetFillColor(5);
4151 hitsPhi->Fit("gaus");
4156 OriginalPhi->SetFillColor(5);
4158 OriginalPhi->Fit("gaus");
4159 OriginalPhi->Draw();
4163 Phi->SetFillColor(5);
4168 c9 = new TCanvas("c9","3D reconstruction of theta angle",75,75,300,1050);
4173 hitsTheta->SetFillColor(5);
4175 hitsTheta->Fit("gaus");
4180 OriginalTheta->SetFillColor(5);
4182 OriginalTheta->Fit("gaus");
4183 OriginalTheta->Draw();
4187 Theta->SetFillColor(5);
4192 c10 = new TCanvas("c10","3D reconstruction of cherenkov angle",100,100,300,1050);
4197 ckovangle->SetFillColor(5);
4198 ckovangle->SetXTitle("angle (radians)");
4200 ckovangle->Fit("gaus");
4205 OriginalOmega->SetFillColor(5);
4206 OriginalOmega->SetXTitle("angle (radians)");
4208 OriginalOmega->Fit("gaus");
4209 OriginalOmega->Draw();
4213 Omega3D->SetFillColor(5);
4214 Omega3D->SetXTitle("angle (radians)");
4216 Omega3D->Fit("gaus");
4220 c11 = new TCanvas("c11","3D reconstruction of mean radius",125,125,300,700);
4225 radius->SetFillColor(5);
4226 radius->SetXTitle("radius (cm)");
4231 MeanRadius->SetFillColor(5);
4232 MeanRadius->SetXTitle("radius (cm)");
4236 c12 = new TCanvas("c12","Cerenkov angle vs. Momentum",150,150,550,350);
4239 identification->SetFillColor(5);
4240 identification->SetXTitle("Momentum (GeV/c)");
4241 identification->SetYTitle("Cherenkov angle (radians)");
4243 //Float_t pionmass=.139;
4244 //Float_t kaonmass=.493;
4245 //Float_t protonmass=.938;
4248 TF1 *pionplot = new TF1("pion","acos(sqrt((.139*.139+x*x)/(x*x*1.285*1.285)))",1,5);
4249 TF1 *kaonplot = new TF1("kaon","acos(sqrt((.439*.439+x*x)/(x*x*1.285*1.285)))",1,5);
4250 TF1 *protonplot = new TF1("proton","acos(sqrt((.938*.938+x*x)/(x*x*1.285*1.285)))",1,5);
4252 identification->Draw();
4254 pionplot->SetLineColor(5);
4255 pionplot->Draw("same");
4257 kaonplot->SetLineColor(4);
4258 kaonplot->Draw("same");
4260 protonplot->SetLineColor(3);
4261 protonplot->Draw("same");
4262 //identification->Draw("same");
4266 c13 = new TCanvas("c13","Reconstruction Errors",200,200,900,350);
4270 PhiError->SetFillColor(5);
4272 PhiError->Fit("gaus");
4275 ThetaError->SetFillColor(5);
4277 ThetaError->Fit("gaus");
4280 OmegaError->SetFillColor(5);
4281 OmegaError->SetXTitle("angle (radians)");
4283 OmegaError->Fit("gaus");
4290 c9 = new TCanvas("c9","1D Reconstruction",100,100,1100,700);
4292 //c5->SetFillColor(42);
4295 ckovangle->SetFillColor(5);
4296 ckovangle->SetXTitle("angle (radians)");
4300 radius->SetFillColor(5);
4301 radius->SetXTitle("radius (cm)");
4305 hc0->SetXTitle("pads");
4309 Omega1D->SetFillColor(5);
4310 Omega1D->SetXTitle("angle (radians)");
4314 PhotonCer->SetFillColor(5);
4315 PhotonCer->SetXTitle("angle (radians)");
4319 PadsUsed->SetXTitle("pads");
4320 PadsUsed->Draw("box");
4327 printf("Drawing histograms.../n");
4331 c10 = new TCanvas("c10","Alice RICH digits",50,50,1200,700);
4333 //c1->SetFillColor(42);
4336 hc1->SetXTitle("ix (npads)");
4339 hc2->SetXTitle("ix (npads)");
4342 hc3->SetXTitle("ix (npads)");
4345 hc4->SetXTitle("ix (npads)");
4348 hc5->SetXTitle("ix (npads)");
4351 hc6->SetXTitle("ix (npads)");
4354 hc7->SetXTitle("ix (npads)");
4357 hc0->SetXTitle("ix (npads)");
4361 c11 = new TCanvas("c11","Hits per type",100,100,600,700);
4363 //c4->SetFillColor(42);
4366 feedback->SetXTitle("x (cm)");
4367 feedback->SetYTitle("y (cm)");
4371 //mip->SetFillColor(5);
4372 mip->SetXTitle("x (cm)");
4373 mip->SetYTitle("y (cm)");
4377 //cerenkov->SetFillColor(5);
4378 cerenkov->SetXTitle("x (cm)");
4379 cerenkov->SetYTitle("y (cm)");
4383 //h->SetFillColor(5);
4384 h->SetXTitle("x (cm)");
4385 h->SetYTitle("y (cm)");
4388 c12 = new TCanvas("c12","Hits distribution",150,150,600,350);
4390 //c10->SetFillColor(42);
4393 hitsX->SetFillColor(5);
4394 hitsX->SetXTitle("(cm)");
4398 hitsY->SetFillColor(5);
4399 hitsY->SetXTitle("(cm)");
4407 // calculate the number of pads which give a signal
4411 /*for (Int_t i=0;i< NpadX;i++) {
4412 for (Int_t j=0;j< NpadY;j++) {
4418 //printf("The total number of pads which give a signal: %d %d\n",Nh,Nh1);
4419 printf("\nEnd of analysis\n");
4420 printf("**********************************\n");
4423 ////////////////////////////////////////////////////////////////////////
4424 void AliRICH::MakeBranchInTreeD(TTree *treeD, const char *file)
4427 // Create TreeD branches for the RICH.
4430 const Int_t kBufferSize = 4000;
4431 char branchname[30];
4434 // one branch for digits per chamber
4436 for (Int_t i=0; i<kNCH ;i++) {
4437 sprintf(branchname,"%sDigits%d",GetName(),i+1);
4438 if (fDchambers && treeD) {
4439 MakeBranchInTree(treeD,
4440 branchname, &((*fDchambers)[i]), kBufferSize, file);
4441 // printf("Making Branch %s for digits in chamber %d\n",branchname,i+1);
4445 ////////////////////////////////////////////////////////////////////////