1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 Revision 1.57 2001/11/09 17:29:31 dibari
19 Setters fro models moved to header
21 Revision 1.56 2001/11/02 15:37:25 hristov
22 Digitizer class created. Code cleaning and bug fixes (J.Chudoba)
24 Revision 1.55 2001/10/23 13:03:35 hristov
25 The access to several data members was changed from public to protected. The digitisation was adapted to the multi-event case (J.Chudoba)
27 Revision 1.54 2001/09/07 08:38:10 hristov
28 Pointers initialised to 0 in the default constructors
30 Revision 1.53 2001/08/30 09:51:23 hristov
31 The operator[] is replaced by At() or AddAt() in case of TObjArray.
33 Revision 1.52 2001/05/16 14:57:20 alibrary
34 New files for folders and Stack
36 Revision 1.51 2001/05/14 10:18:55 hristov
37 Default arguments declared once
39 Revision 1.50 2001/05/10 14:44:16 jbarbosa
40 Corrected some overlaps (thanks I. Hrivnacovna).
42 Revision 1.49 2001/05/10 12:23:49 jbarbosa
43 Repositioned the RICH modules.
44 Eliminated magic numbers.
45 Incorporated diagnostics (from macros).
47 Revision 1.48 2001/03/15 10:35:00 jbarbosa
48 Corrected bug in MakeBranch (was using a different version of STEER)
50 Revision 1.47 2001/03/14 18:13:56 jbarbosa
51 Several changes to adapt to new IO.
52 Removed digitising function, using AliRICHMerger::Digitise from now on.
54 Revision 1.46 2001/03/12 17:46:33 hristov
55 Changes needed on Sun with CC 5.0
57 Revision 1.45 2001/02/27 22:11:46 jbarbosa
58 Testing TreeS, removing of output.
60 Revision 1.44 2001/02/27 15:19:12 jbarbosa
61 Transition to SDigits.
63 Revision 1.43 2001/02/23 17:19:06 jbarbosa
64 Corrected photocathode definition in BuildGeometry().
66 Revision 1.42 2001/02/13 20:07:23 jbarbosa
67 Parametrised definition of photcathode dimensions. New spacers. New data members in AliRICHHit to store particle momentum
68 when entering the freon. Corrected calls to particle stack.
70 Revision 1.41 2001/01/26 20:00:20 hristov
71 Major upgrade of AliRoot code
73 Revision 1.40 2001/01/24 20:58:03 jbarbosa
74 Enhanced BuildGeometry. Now the photocathodes are drawn.
76 Revision 1.39 2001/01/22 21:40:24 jbarbosa
77 Removing magic numbers
79 Revision 1.37 2000/12/20 14:07:25 jbarbosa
80 Removed dependencies on TGeant3 (thanks to F. Carminati and I. Hrivnacova)
82 Revision 1.36 2000/12/18 17:45:54 jbarbosa
83 Cleaned up PadHits object.
85 Revision 1.35 2000/12/15 16:49:40 jbarbosa
86 Geometry and materials updates (wire supports, pcbs, backplane supports, frame).
88 Revision 1.34 2000/11/10 18:12:12 jbarbosa
89 Bug fix for AliRICHCerenkov (thanks to P. Hristov)
91 Revision 1.33 2000/11/02 10:09:01 jbarbosa
92 Minor bug correction (some pointers were not initialised in the default constructor)
94 Revision 1.32 2000/11/01 15:32:55 jbarbosa
95 Updated to handle both reconstruction algorithms.
97 Revision 1.31 2000/10/26 20:18:33 jbarbosa
98 Supports for methane and freon vessels
100 Revision 1.30 2000/10/24 13:19:12 jbarbosa
103 Revision 1.29 2000/10/19 19:39:25 jbarbosa
104 Some more changes to geometry. Further correction of digitisation "per part. type"
106 Revision 1.28 2000/10/17 20:50:57 jbarbosa
107 Inversed digtise by particle type (now, only the selected particle type is not digitsed).
108 Corrected several geometry minor bugs.
109 Added new parameter (opaque quartz thickness).
111 Revision 1.27 2000/10/11 10:33:55 jbarbosa
112 Corrected bug introduced by earlier revisions (CerenkovData array cannot be reset to zero on wach call of StepManager)
114 Revision 1.26 2000/10/03 21:44:08 morsch
115 Use AliSegmentation and AliHit abstract base classes.
117 Revision 1.25 2000/10/02 21:28:12 fca
118 Removal of useless dependecies via forward declarations
120 Revision 1.24 2000/10/02 15:43:17 jbarbosa
121 Fixed forward declarations.
122 Fixed honeycomb density.
123 Fixed cerenkov storing.
126 Revision 1.23 2000/09/13 10:42:14 hristov
127 Minor corrections for HP, DEC and Sun; strings.h included
129 Revision 1.22 2000/09/12 18:11:13 fca
130 zero hits area before using
132 Revision 1.21 2000/07/21 10:21:07 morsch
133 fNrawch = 0; and fNrechits = 0; in the default constructor.
135 Revision 1.20 2000/07/10 15:28:39 fca
136 Correction of the inheritance scheme
138 Revision 1.19 2000/06/30 16:29:51 dibari
139 Added kDebugLevel variable to control output size on demand
141 Revision 1.18 2000/06/12 15:15:46 jbarbosa
144 Revision 1.17 2000/06/09 14:58:37 jbarbosa
145 New digitisation per particle type
147 Revision 1.16 2000/04/19 12:55:43 morsch
148 Newly structured and updated version (JB, AM)
153 ////////////////////////////////////////////////
154 // Manager and hits classes for set:RICH //
155 ////////////////////////////////////////////////
163 #include <TObjArray.h>
166 #include <TParticle.h>
167 #include <TGeometry.h>
175 #include <iostream.h>
179 #include "AliSegmentation.h"
180 #include "AliRICHSegmentationV0.h"
181 #include "AliRICHHit.h"
182 #include "AliRICHCerenkov.h"
183 #include "AliRICHSDigit.h"
184 #include "AliRICHDigit.h"
185 #include "AliRICHTransientDigit.h"
186 #include "AliRICHRawCluster.h"
187 #include "AliRICHRecHit1D.h"
188 #include "AliRICHRecHit3D.h"
189 #include "AliRICHHitMapA1.h"
190 #include "AliRICHClusterFinder.h"
191 #include "AliRICHMerger.h"
195 #include "AliConst.h"
197 #include "AliPoints.h"
198 #include "AliCallf77.h"
202 static Int_t sMaxIterPad=0; // Static variables for the pad-hit iterator routines
203 static Int_t sCurIterPad=0;
207 //___________________________________________
208 // RICH manager class
211 <img src="gif/alirich.gif">
217 // Default ctor should not contain any new operators
218 cout<<ClassName()<<"::named ctor(sName,sTitle)>\n"; // no way to control it as ctor is called before call to SetDebugXXXX()
231 for (Int_t i=0; i<7; i++){
240 }//AliRICH::AliRICH()
242 AliRICH::AliRICH(const char *name, const char *title)
243 : AliDetector(name,title)
246 cout<<ClassName()<<"::named ctor(sName,sTitle)>\n"; // no way to control it as ctor is called before call to SetDebugXXXX()
248 fHits = new TClonesArray("AliRICHHit",1000 );
249 gAlice->AddHitList(fHits);
250 fSDigits = new TClonesArray("AliRICHSDigit",100000);
251 fCerenkovs = new TClonesArray("AliRICHCerenkov",1000);
252 gAlice->AddHitList(fCerenkovs);
257 //fNdch = new Int_t[kNCH];
259 fDchambers = new TObjArray(kNCH);
261 fRecHits1D = new TObjArray(kNCH);
262 fRecHits3D = new TObjArray(kNCH);
266 for (i=0; i<kNCH ;i++) {
267 //PH (*fDchambers)[i] = new TClonesArray("AliRICHDigit",10000);
268 fDchambers->AddAt(new TClonesArray("AliRICHDigit",10000), i);
272 //fNrawch = new Int_t[kNCH];
274 fRawClusters = new TObjArray(kNCH);
275 //printf("Created fRwClusters with adress:%p",fRawClusters);
277 for (i=0; i<kNCH ;i++) {
278 //PH (*fRawClusters)[i] = new TClonesArray("AliRICHRawCluster",10000);
279 fRawClusters->AddAt(new TClonesArray("AliRICHRawCluster",10000), i);
283 //fNrechits = new Int_t[kNCH];
285 for (i=0; i<kNCH ;i++) {
286 //PH (*fRecHits1D)[i] = new TClonesArray("AliRICHRecHit1D",1000);
287 fRecHits1D->AddAt(new TClonesArray("AliRICHRecHit1D",1000), i);
289 for (i=0; i<kNCH ;i++) {
290 //PH (*fRecHits3D)[i] = new TClonesArray("AliRICHRecHit3D",1000);
291 fRecHits3D->AddAt(new TClonesArray("AliRICHRecHit3D",1000), i);
293 //printf("Created fRecHits with adress:%p",fRecHits);
296 SetMarkerColor(kRed);
298 /*fChambers = new TObjArray(kNCH);
299 for (i=0; i<kNCH; i++)
300 (*fChambers)[i] = new AliRICHChamber();*/
306 AliRICH::AliRICH(const AliRICH& RICH)
314 // Dtor of RICH manager class
315 if(IsDebugStart()) cout<<ClassName()<<"::default dtor()>\n";
322 //PH Delete TObjArrays
328 fDchambers->Delete();
332 fRawClusters->Delete();
336 fRecHits1D->Delete();
340 fRecHits3D->Delete();
347 //_____________________________________________________________________________
348 Int_t AliRICH::Hits2SDigits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, ResponseType res)
350 // Calls the charge disintegration method of the current chamber and adds
351 // the simulated cluster to the root tree
352 if(IsDebugHit()||IsDebugDigit()) cout<<ClassName()<<"::Hits2SDigits(...)>\n";
355 Float_t newclust[4][500];
359 // Integrated pulse height on chamber
363 ((AliRICHChamber*)fChambers->At(idvol))->DisIntegration(eloss, xhit, yhit, nnew, newclust, res);
368 for (Int_t i=0; i<nnew; i++) {
369 if (Int_t(newclust[0][i]) > 0) {
372 clhits[1] = Int_t(newclust[0][i]);
374 clhits[2] = Int_t(newclust[1][i]);
376 clhits[3] = Int_t(newclust[2][i]);
377 // Pad: chamber sector
378 clhits[4] = Int_t(newclust[3][i]);
380 //printf(" %d %d %d %d %d\n", clhits[0], clhits[1], clhits[2], clhits[3], clhits[4]);
386 if (gAlice->TreeS()){
387 gAlice->TreeS()->Fill();
388 gAlice->TreeS()->Write(0,TObject::kOverwrite);
389 //printf("Filled SDigits...\n");
393 }//Int_t AliRICH::Hits2SDigits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, ResponseType res)
395 void AliRICH::Hits2SDigits()
397 // Dummy: sdigits are created during transport.
398 // Called from alirun.
399 if(IsDebugHit()||IsDebugDigit()) cout<<ClassName()<<"::Hits2SDigits()>\n";
402 int nparticles = gAlice->GetNtrack();
403 cout << "Particles (RICH):" <<nparticles<<endl;
404 if (nparticles > 0) printf("SDigits were already generated.\n");
408 //___________________________________________
409 void AliRICH::SDigits2Digits(Int_t nev, Int_t flag)
412 // Called from macro. Multiple events, more functionality.
413 if(IsDebugDigit()) cout<<ClassName()<<"::SDigits2Digits()>\n";
415 AliRICHChamber* iChamber;
417 printf("Generating tresholds...\n");
419 for(Int_t i=0;i<7;i++) {
420 iChamber = &(Chamber(i));
421 iChamber->GenerateTresholds();
424 int nparticles = gAlice->GetNtrack();
425 cout << "Particles (RICH):" <<nparticles<<endl;
426 if (nparticles <= 0) return;
428 fMerger = new AliRICHMerger();
431 fMerger->Digitise(nev,flag);
433 //___________________________________________
434 void AliRICH::SDigits2Digits()
438 //___________________________________________
439 void AliRICH::Digits2Reco()
442 // Called from alirun, single event only.
443 if(IsDebugDigit()||IsDebugReco()) cout<<ClassName()<<"::Digits2Reco()>\n";
446 int nparticles = gAlice->GetNtrack();
447 cout << "Particles (RICH):" <<nparticles<<endl;
448 if (nparticles > 0) FindClusters(0,0);
452 void AliRICH::AddHit(Int_t track, Int_t *vol, Float_t *hits)
454 // Adds the current hit to the RICH hits list
455 if(IsDebugHit()) cout<<ClassName()<<"::AddHit(...)>\n";
457 TClonesArray &lhits = *fHits;
458 new(lhits[fNhits++]) AliRICHHit(fIshunt,track,vol,hits);
461 void AliRICH::AddCerenkov(Int_t track, Int_t *vol, Float_t *cerenkovs)
463 // Adds a RICH cerenkov hit to the Cerenkov Hits list
464 if(IsDebugHit()) cout<<ClassName()<<"::AddCerenkov()>\n";
466 TClonesArray &lcerenkovs = *fCerenkovs;
467 new(lcerenkovs[fNcerenkovs++]) AliRICHCerenkov(fIshunt,track,vol,cerenkovs);
470 void AliRICH::AddSDigit(Int_t *aSDigit)
472 // Adds the current S digit to the RICH list of S digits
473 if(IsDebugDigit()) cout<<ClassName()<<"::AddSDigit()>\n";
475 TClonesArray &lSDigits = *fSDigits;
476 new(lSDigits[fNSDigits++]) AliRICHSDigit(aSDigit);
480 void AliRICH::AddDigits(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
482 // Add a RICH digit to the list
483 if(IsDebugDigit()) cout<<ClassName()<<"::AddDigit()>\n";
485 TClonesArray &ldigits = *((TClonesArray*)fDchambers->At(id));
486 new(ldigits[fNdch[id]++]) AliRICHDigit(tracks,charges,digits);
489 void AliRICH::AddRawCluster(Int_t id, const AliRICHRawCluster& c)
491 // Add a RICH digit to the list
494 cout<<ClassName()<<"::AddRawCluster()>\n";
496 //PH TClonesArray &lrawcl = *((TClonesArray*)(*fRawClusters)[id]);
497 TClonesArray &lrawcl = *((TClonesArray*)fRawClusters->At(id));
498 new(lrawcl[fNrawch[id]++]) AliRICHRawCluster(c);
501 //_____________________________________________________________________________
502 void AliRICH::AddRecHit1D(Int_t id, Float_t *rechit, Float_t *photons, Int_t *padsx, Int_t* padsy)
506 // Add a RICH reconstructed hit to the list
509 //PH TClonesArray &lrec1D = *((TClonesArray*)(*fRecHits1D)[id]);
510 TClonesArray &lrec1D = *((TClonesArray*)fRecHits1D->At(id));
511 new(lrec1D[fNrechits1D[id]++]) AliRICHRecHit1D(id,rechit,photons,padsx,padsy);
514 //_____________________________________________________________________________
515 void AliRICH::AddRecHit3D(Int_t id, Float_t *rechit)
517 // Add a RICH reconstructed hit to the list
519 TClonesArray &lrec3D = *((TClonesArray*)fRecHits3D->At(id));
520 new(lrec3D[fNrechits3D[id]++]) AliRICHRecHit3D(id,rechit);
523 //___________________________________________
524 void AliRICH::BuildGeometry()
529 // Builds a TNode geometry for event display
531 TNode *node, *subnode, *top;
533 const int kColorRICH = kRed;
535 top=gAlice->GetGeometry()->GetNode("alice");
537 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
538 AliRICHSegmentationV0* segmentation;
539 AliRICHChamber* iChamber;
540 AliRICHGeometry* geometry;
542 iChamber = &(pRICH->Chamber(0));
543 segmentation=(AliRICHSegmentationV0*) iChamber->GetSegmentationModel();
544 geometry=iChamber->GetGeometryModel();
546 new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15);
548 Float_t padplane_width = segmentation->GetPadPlaneWidth();
549 Float_t padplane_length = segmentation->GetPadPlaneLength();
551 //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());
553 new TBRIK("PHOTO","PHOTO","void", padplane_width/2,.1,padplane_length/2);
555 //printf("\n\n\n\n\n Padplane w: %f l: %f \n\n\n\n\n", padplane_width/2,padplane_length/2);
556 //printf("\n\n\n\n\n Padplane w: %f l: %f \n\n\n\n\n", segmentation->GetPadPlaneWidth(), segmentation->GetPadPlaneLength());
558 Float_t offset = 490 + 1.276 - geometry->GetGapThickness()/2; //distance from center of mother volume to methane
559 Float_t deltaphi = 19.5; //phi angle between center of chambers - z direction
560 Float_t deltatheta = 20; //theta angle between center of chambers - x direction
561 Float_t cosphi = TMath::Cos(deltaphi*TMath::Pi()/180);
562 Float_t sinphi = TMath::Sin(deltaphi*TMath::Pi()/180);
563 Float_t costheta = TMath::Cos(deltatheta*TMath::Pi()/180);
564 Float_t sintheta = TMath::Sin(deltatheta*TMath::Pi()/180);
566 //printf("\n\n%f %f %f %f %f %f %f\n\n",offset,deltatheta,deltaphi,cosphi,costheta,sinphi,sintheta);
568 new TRotMatrix("rot993","rot993",90., 0. , 90. - deltaphi, 90. , deltaphi, -90. );
569 new TRotMatrix("rot994","rot994",90., -deltatheta , 90. , 90.- deltatheta , 0. , 0. );
570 new TRotMatrix("rot995","rot995",90., 0. , 90. , 90. , 0. , 0. );
571 new TRotMatrix("rot996","rot996",90., deltatheta , 90. , 90 + deltatheta , 0. , 0. );
572 new TRotMatrix("rot997","rot997",90., 360. - deltatheta, 108.2 , 90.- deltatheta ,18.2 , 90 - deltatheta);
573 new TRotMatrix("rot998","rot998",90., 0. , 90 + deltaphi , 90. , deltaphi, 90. );
574 new TRotMatrix("rot999","rot999",90., deltatheta , 108.2 , 90.+ deltatheta ,18.2 , 90 + deltatheta);
576 Float_t pos1[3]={0. , offset*cosphi , offset*sinphi};
577 Float_t pos2[3]={offset*sintheta , offset*costheta , 0. };
578 Float_t pos3[3]={0. , offset , 0.};
579 Float_t pos4[3]={-offset*sintheta , offset*costheta , 0.};
580 Float_t pos5[3]={offset*sinphi , offset*costheta*cosphi, -offset*sinphi};
581 Float_t pos6[3]={0. , offset*cosphi , -offset*sinphi};
582 Float_t pos7[3]={ -offset*sinphi , offset*costheta*cosphi, -offset*sinphi};
586 //Float_t pos1[3]={0,471.8999,165.2599};
587 //Chamber(0).SetChamberTransform(pos1[0],pos1[1],pos1[2],
588 //new TRotMatrix("rot993","rot993",90,0,70.69,90,19.30999,-90);
589 node = new TNode("RICH1","RICH1","S_RICH",pos1[0],pos1[1],pos1[2],"rot993");
590 node->SetLineColor(kColorRICH);
592 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
593 subnode->SetLineColor(kGreen);
594 fNodes->Add(subnode);
595 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
596 subnode->SetLineColor(kGreen);
597 fNodes->Add(subnode);
598 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
599 subnode->SetLineColor(kGreen);
600 fNodes->Add(subnode);
601 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
602 subnode->SetLineColor(kGreen);
603 fNodes->Add(subnode);
604 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
605 subnode->SetLineColor(kGreen);
606 fNodes->Add(subnode);
607 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
608 subnode->SetLineColor(kGreen);
609 fNodes->Add(subnode);
614 //Float_t pos2[3]={171,470,0};
615 //Chamber(1).SetChamberTransform(pos2[0],pos2[1],pos2[2],
616 //new TRotMatrix("rot994","rot994",90,-20,90,70,0,0);
617 node = new TNode("RICH2","RICH2","S_RICH",pos2[0],pos2[1],pos2[2],"rot994");
618 node->SetLineColor(kColorRICH);
620 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
621 subnode->SetLineColor(kGreen);
622 fNodes->Add(subnode);
623 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
624 subnode->SetLineColor(kGreen);
625 fNodes->Add(subnode);
626 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
627 subnode->SetLineColor(kGreen);
628 fNodes->Add(subnode);
629 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
630 subnode->SetLineColor(kGreen);
631 fNodes->Add(subnode);
632 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
633 subnode->SetLineColor(kGreen);
634 fNodes->Add(subnode);
635 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
636 subnode->SetLineColor(kGreen);
637 fNodes->Add(subnode);
642 //Float_t pos3[3]={0,500,0};
643 //Chamber(2).SetChamberTransform(pos3[0],pos3[1],pos3[2],
644 //new TRotMatrix("rot995","rot995",90,0,90,90,0,0);
645 node = new TNode("RICH3","RICH3","S_RICH",pos3[0],pos3[1],pos3[2],"rot995");
646 node->SetLineColor(kColorRICH);
648 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
649 subnode->SetLineColor(kGreen);
650 fNodes->Add(subnode);
651 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
652 subnode->SetLineColor(kGreen);
653 fNodes->Add(subnode);
654 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
655 subnode->SetLineColor(kGreen);
656 fNodes->Add(subnode);
657 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
658 subnode->SetLineColor(kGreen);
659 fNodes->Add(subnode);
660 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
661 subnode->SetLineColor(kGreen);
662 fNodes->Add(subnode);
663 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
664 subnode->SetLineColor(kGreen);
665 fNodes->Add(subnode);
669 //Float_t pos4[3]={-171,470,0};
670 //Chamber(3).SetChamberTransform(pos4[0],pos4[1],pos4[2],
671 //new TRotMatrix("rot996","rot996",90,20,90,110,0,0);
672 node = new TNode("RICH4","RICH4","S_RICH",pos4[0],pos4[1],pos4[2],"rot996");
673 node->SetLineColor(kColorRICH);
675 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
676 subnode->SetLineColor(kGreen);
677 fNodes->Add(subnode);
678 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
679 subnode->SetLineColor(kGreen);
680 fNodes->Add(subnode);
681 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
682 subnode->SetLineColor(kGreen);
683 fNodes->Add(subnode);
684 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
685 subnode->SetLineColor(kGreen);
686 fNodes->Add(subnode);
687 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
688 subnode->SetLineColor(kGreen);
689 fNodes->Add(subnode);
690 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
691 subnode->SetLineColor(kGreen);
692 fNodes->Add(subnode);
697 //Float_t pos5[3]={161.3999,443.3999,-165.3};
698 //Chamber(4).SetChamberTransform(pos5[0],pos5[1],pos5[2],
699 //new TRotMatrix("rot997","rot997",90,340,108.1999,70,18.2,70);
700 node = new TNode("RICH5","RICH5","S_RICH",pos5[0],pos5[1],pos5[2],"rot997");
701 node->SetLineColor(kColorRICH);
703 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
704 subnode->SetLineColor(kGreen);
705 fNodes->Add(subnode);
706 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
707 subnode->SetLineColor(kGreen);
708 fNodes->Add(subnode);
709 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
710 subnode->SetLineColor(kGreen);
711 fNodes->Add(subnode);
712 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
713 subnode->SetLineColor(kGreen);
714 fNodes->Add(subnode);
715 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
716 subnode->SetLineColor(kGreen);
717 fNodes->Add(subnode);
718 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
719 subnode->SetLineColor(kGreen);
720 fNodes->Add(subnode);
725 //Float_t pos6[3]={0., 471.9, -165.3,};
726 //Chamber(5).SetChamberTransform(pos6[0],pos6[1],pos6[2],
727 //new TRotMatrix("rot998","rot998",90,0,109.3099,90,19.30999,90);
728 node = new TNode("RICH6","RICH6","S_RICH",pos6[0],pos6[1],pos6[2],"rot998");
729 node->SetLineColor(kColorRICH);
730 fNodes->Add(node);node->cd();
731 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
732 subnode->SetLineColor(kGreen);
733 fNodes->Add(subnode);
734 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
735 subnode->SetLineColor(kGreen);
736 fNodes->Add(subnode);
737 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
738 subnode->SetLineColor(kGreen);
739 fNodes->Add(subnode);
740 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
741 subnode->SetLineColor(kGreen);
742 fNodes->Add(subnode);
743 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
744 subnode->SetLineColor(kGreen);
745 fNodes->Add(subnode);
746 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
747 subnode->SetLineColor(kGreen);
748 fNodes->Add(subnode);
752 //Float_t pos7[3]={-161.399,443.3999,-165.3};
753 //Chamber(6).SetChamberTransform(pos7[0],pos7[1],pos7[2],
754 //new TRotMatrix("rot999","rot999",90,20,108.1999,110,18.2,110);
755 node = new TNode("RICH7","RICH7","S_RICH",pos7[0],pos7[1],pos7[2],"rot999");
756 node->SetLineColor(kColorRICH);
758 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
759 subnode->SetLineColor(kGreen);
760 fNodes->Add(subnode);
761 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
762 subnode->SetLineColor(kGreen);
763 fNodes->Add(subnode);
764 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
765 subnode->SetLineColor(kGreen);
766 fNodes->Add(subnode);
767 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
768 subnode->SetLineColor(kGreen);
769 fNodes->Add(subnode);
770 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
771 subnode->SetLineColor(kGreen);
772 fNodes->Add(subnode);
773 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
774 subnode->SetLineColor(kGreen);
775 fNodes->Add(subnode);
780 //___________________________________________
781 void AliRICH::CreateGeometry()
784 // Create the geometry for RICH version 1
786 // Modified by: N. Colonna (INFN - BARI, Nicola.Colonna@ba.infn.it)
787 // R.A. Fini (INFN - BARI, Rosanna.Fini@ba.infn.it)
788 // R.A. Loconsole (Bari University, loco@riscom.ba.infn.it)
792 <img src="picts/AliRICHv1.gif">
797 <img src="picts/AliRICHv1Tree.gif">
801 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
802 AliRICHSegmentationV0* segmentation;
803 AliRICHGeometry* geometry;
804 AliRICHChamber* iChamber;
806 iChamber = &(pRICH->Chamber(0));
807 segmentation=(AliRICHSegmentationV0*) iChamber->GetSegmentationModel();
808 geometry=iChamber->GetGeometryModel();
811 distance = geometry->GetFreonThickness()/2 + geometry->GetQuartzThickness() + geometry->GetGapThickness();
812 geometry->SetRadiatorToPads(distance);
814 //Opaque quartz thickness
815 Float_t oqua_thickness = .5;
818 //Float_t csi_length = 160*.8 + 2.6;
819 //Float_t csi_width = 144*.84 + 2*2.6;
821 Float_t csi_width = segmentation->Npx()*segmentation->Dpx() + segmentation->DeadZone();
822 Float_t csi_length = segmentation->Npy()*segmentation->Dpy() + 2*segmentation->DeadZone();
824 //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());
826 Int_t *idtmed = fIdtmed->GetArray()-999;
833 // --- Define the RICH detector
834 // External aluminium box
836 par[1] = 13; //Original Settings
841 gMC->Gsvolu("RICH", "BOX ", idtmed[1009], par, 3);
845 par[1] = 13; //Original Settings
850 gMC->Gsvolu("SRIC", "BOX ", idtmed[1000], par, 3);
852 // Air 2 (cutting the lower part of the box)
855 par[1] = 3; //Original Settings
857 gMC->Gsvolu("AIR2", "BOX ", idtmed[1000], par, 3);
859 // Air 3 (cutting the lower part of the box)
862 par[1] = 3; //Original Settings
864 gMC->Gsvolu("AIR3", "BOX ", idtmed[1000], par, 3);
868 par[1] = .188; //Original Settings
873 gMC->Gsvolu("HONE", "BOX ", idtmed[1001], par, 3);
877 par[1] = .025; //Original Settings
882 gMC->Gsvolu("ALUM", "BOX ", idtmed[1009], par, 3);
885 par[0] = geometry->GetQuartzWidth()/2;
886 par[1] = geometry->GetQuartzThickness()/2;
887 par[2] = geometry->GetQuartzLength()/2;
889 par[1] = .25; //Original Settings
891 /*par[0] = geometry->GetQuartzWidth()/2;
892 par[1] = geometry->GetQuartzThickness()/2;
893 par[2] = geometry->GetQuartzLength()/2;*/
894 //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]);
895 gMC->Gsvolu("QUAR", "BOX ", idtmed[1002], par, 3);
897 // Spacers (cylinders)
900 par[2] = geometry->GetFreonThickness()/2;
901 gMC->Gsvolu("SPAC", "TUBE", idtmed[1002], par, 3);
903 // Feet (freon slabs supports)
908 gMC->Gsvolu("FOOT", "BOX", idtmed[1009], par, 3);
911 par[0] = geometry->GetQuartzWidth()/2;
913 par[2] = geometry->GetQuartzLength()/2;
915 par[1] = .2; //Original Settings
920 gMC->Gsvolu("OQUA", "BOX ", idtmed[1007], par, 3);
922 // Frame of opaque quartz
923 par[0] = geometry->GetOuterFreonWidth()/2;
925 par[1] = geometry->GetFreonThickness()/2;
926 par[2] = geometry->GetOuterFreonLength()/2;
929 par[1] = .5; //Original Settings
934 gMC->Gsvolu("OQF1", "BOX ", idtmed[1007], par, 3);
936 par[0] = geometry->GetInnerFreonWidth()/2;
937 par[1] = geometry->GetFreonThickness()/2;
938 par[2] = geometry->GetInnerFreonLength()/2;
939 gMC->Gsvolu("OQF2", "BOX ", idtmed[1007], par, 3);
941 // Little bar of opaque quartz
943 //par[1] = geometry->GetQuartzThickness()/2;
944 //par[2] = geometry->GetInnerFreonLength()/2 - 2.4;
945 //par[2] = geometry->GetInnerFreonLength()/2;
948 par[1] = .25; //Original Settings
953 //gMC->Gsvolu("BARR", "BOX ", idtmed[1007], par, 3);
956 par[0] = geometry->GetOuterFreonWidth()/2 - oqua_thickness;
957 par[1] = geometry->GetFreonThickness()/2;
958 par[2] = geometry->GetOuterFreonLength()/2 - 2*oqua_thickness;
960 par[1] = .5; //Original Settings
965 gMC->Gsvolu("FRE1", "BOX ", idtmed[1003], par, 3);
967 par[0] = geometry->GetInnerFreonWidth()/2 - oqua_thickness;
968 par[1] = geometry->GetFreonThickness()/2;
969 par[2] = geometry->GetInnerFreonLength()/2 - 2*oqua_thickness;
970 gMC->Gsvolu("FRE2", "BOX ", idtmed[1003], par, 3);
974 par[0] = csi_width/2;
975 par[1] = geometry->GetGapThickness()/2;
976 //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]);
978 par[2] = csi_length/2;
979 gMC->Gsvolu("META", "BOX ", idtmed[1004], par, 3);
983 par[0] = csi_width/2;
984 par[1] = geometry->GetProximityGapThickness()/2;
985 //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]);
987 par[2] = csi_length/2;
988 gMC->Gsvolu("GAP ", "BOX ", idtmed[1008], par, 3);
992 par[0] = csi_width/2;
995 par[2] = csi_length/2;
996 gMC->Gsvolu("CSI ", "BOX ", idtmed[1005], par, 3);
1002 gMC->Gsvolu("GRID", "TUBE", idtmed[1006], par, 3);
1007 par[0] = csi_width/2;
1010 gMC->Gsvolu("WSMe", "BOX ", idtmed[1009], par, 3);
1012 // Ceramic pick up (base)
1014 par[0] = csi_width/2;
1017 gMC->Gsvolu("WSG1", "BOX ", idtmed[1010], par, 3);
1019 // Ceramic pick up (head)
1021 par[0] = csi_width/2;
1024 gMC->Gsvolu("WSG2", "BOX ", idtmed[1010], par, 3);
1026 // Aluminium supports for methane and CsI
1029 par[0] = csi_width/2;
1030 par[1] = geometry->GetGapThickness()/2 + .25;
1031 par[2] = (68.35 - csi_length/2)/2;
1032 gMC->Gsvolu("SMSH", "BOX", idtmed[1009], par, 3);
1036 par[0] = (66.3 - csi_width/2)/2;
1037 par[1] = geometry->GetGapThickness()/2 + .25;
1038 par[2] = csi_length/2 + 68.35 - csi_length/2;
1039 gMC->Gsvolu("SMLG", "BOX", idtmed[1009], par, 3);
1041 // Aluminium supports for freon
1044 par[0] = geometry->GetQuartzWidth()/2;
1046 par[2] = (68.35 - geometry->GetQuartzLength()/2)/2;
1047 gMC->Gsvolu("SFSH", "BOX", idtmed[1009], par, 3);
1051 par[0] = (66.3 - geometry->GetQuartzWidth()/2)/2;
1053 par[2] = geometry->GetQuartzLength()/2 + 68.35 - geometry->GetQuartzLength()/2;
1054 gMC->Gsvolu("SFLG", "BOX", idtmed[1009], par, 3);
1058 par[0] = csi_width/2;
1060 par[2] = csi_length/4 -.5025;
1061 gMC->Gsvolu("PCB ", "BOX", idtmed[1011], par, 3);
1064 // Backplane supports
1071 gMC->Gsvolu("BACK", "BOX", idtmed[1009], par, 3);
1078 gMC->Gsvolu("BKHL", "BOX", idtmed[1000], par, 3);
1085 gMC->Gsvolu("BKHS", "BOX", idtmed[1000], par, 3);
1087 // Place holes inside backplane support
1089 gMC->Gspos("BKHS", 1, "BACK", .8 + 5.7,0., .6 + 4.4625, 0, "ONLY");
1090 gMC->Gspos("BKHS", 2, "BACK", -.8 - 5.7,0., .6 + 4.4625, 0, "ONLY");
1091 gMC->Gspos("BKHS", 3, "BACK", .8 + 5.7,0., -.6 - 4.4625, 0, "ONLY");
1092 gMC->Gspos("BKHS", 4, "BACK", -.8 - 5.7,0., -.6 - 4.4625, 0, "ONLY");
1093 gMC->Gspos("BKHS", 5, "BACK", .8 + 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1094 gMC->Gspos("BKHS", 6, "BACK", -.8 - 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1095 gMC->Gspos("BKHS", 7, "BACK", .8 + 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1096 gMC->Gspos("BKHS", 8, "BACK", -.8 - 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1097 gMC->Gspos("BKHL", 1, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., .6 + 4.4625, 0, "ONLY");
1098 gMC->Gspos("BKHL", 2, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 4.4625, 0, "ONLY");
1099 gMC->Gspos("BKHL", 3, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 4.4625, 0, "ONLY");
1100 gMC->Gspos("BKHL", 4, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 4.4625, 0, "ONLY");
1101 gMC->Gspos("BKHL", 5, "BACK", .8 + 11.4+ 1.6 + 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1102 gMC->Gspos("BKHL", 6, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1103 gMC->Gspos("BKHL", 7, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1104 gMC->Gspos("BKHL", 8, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1108 // --- Places the detectors defined with GSVOLU
1109 // Place material inside RICH
1110 gMC->Gspos("SRIC", 1, "RICH", 0.,0., 0., 0, "ONLY");
1111 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");
1112 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");
1113 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");
1114 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");
1117 gMC->Gspos("ALUM", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.025, 0., 0, "ONLY");
1118 gMC->Gspos("HONE", 1, "SRIC", 0., 1.276- geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .188, 0., 0, "ONLY");
1119 gMC->Gspos("ALUM", 2, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .025, 0., 0, "ONLY");
1120 gMC->Gspos("FOOT", 1, "SRIC", 64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
1121 gMC->Gspos("FOOT", 2, "SRIC", 21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3 , 36.9, 0, "ONLY");
1122 gMC->Gspos("FOOT", 3, "SRIC", -21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
1123 gMC->Gspos("FOOT", 4, "SRIC", -64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
1124 gMC->Gspos("FOOT", 5, "SRIC", 64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1125 gMC->Gspos("FOOT", 6, "SRIC", 21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1126 gMC->Gspos("FOOT", 7, "SRIC", -21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1127 gMC->Gspos("FOOT", 8, "SRIC", -64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1128 gMC->Gspos("OQUA", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .2, 0., 0, "ONLY");
1133 gMC->Gspos("SMLG", 1, "SRIC", csi_width/2 + (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
1134 gMC->Gspos("SMLG", 2, "SRIC", - csi_width/2 - (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
1135 gMC->Gspos("SMSH", 1, "SRIC", 0., 1.276 + .25, csi_length/2 + (68.35 - csi_length/2)/2, 0, "ONLY");
1136 gMC->Gspos("SMSH", 2, "SRIC", 0., 1.276 + .25, - csi_length/2 - (68.35 - csi_length/2)/2, 0, "ONLY");
1140 Float_t supp_y = 1.276 - geometry->GetGapThickness()/2- geometry->GetQuartzThickness() -geometry->GetFreonThickness() - .2 + .3; //y position of freon supports
1142 gMC->Gspos("SFLG", 1, "SRIC", geometry->GetQuartzWidth()/2 + (66.3 - geometry->GetQuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
1143 gMC->Gspos("SFLG", 2, "SRIC", - geometry->GetQuartzWidth()/2 - (66.3 - geometry->GetQuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
1144 gMC->Gspos("SFSH", 1, "SRIC", 0., supp_y, geometry->GetQuartzLength()/2 + (68.35 - geometry->GetQuartzLength()/2)/2, 0, "ONLY");
1145 gMC->Gspos("SFSH", 2, "SRIC", 0., supp_y, - geometry->GetQuartzLength()/2 - (68.35 - geometry->GetQuartzLength()/2)/2, 0, "ONLY");
1147 AliMatrix(idrotm[1019], 0., 0., 90., 0., 90., 90.);
1149 //Placing of the spacers inside the freon slabs
1151 Int_t nspacers = 30;
1152 //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);
1154 //printf("Nspacers: %d", nspacers);
1156 for (i = 0; i < nspacers/3; i++) {
1157 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
1158 gMC->Gspos("SPAC", i, "FRE1", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
1161 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
1162 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1163 gMC->Gspos("SPAC", i, "FRE1", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
1166 for (i = (nspacers*2)/3; i < nspacers; ++i) {
1167 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1168 gMC->Gspos("SPAC", i, "FRE1", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
1171 for (i = 0; i < nspacers/3; i++) {
1172 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
1173 gMC->Gspos("SPAC", i, "FRE2", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
1176 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
1177 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1178 gMC->Gspos("SPAC", i, "FRE2", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
1181 for (i = (nspacers*2)/3; i < nspacers; ++i) {
1182 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1183 gMC->Gspos("SPAC", i, "FRE2", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
1187 gMC->Gspos("FRE1", 1, "OQF1", 0., 0., 0., 0, "ONLY");
1188 gMC->Gspos("FRE2", 1, "OQF2", 0., 0., 0., 0, "ONLY");
1189 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)
1190 // printf("Opaque quartz in SRIC %f\n", 1.276 - geometry->GetGapThickness()/2- geometry->GetQuartzThickness() -geometry->GetFreonThickness()/2);
1191 gMC->Gspos("OQF2", 2, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()/2, 0., 0, "ONLY"); //Original settings
1192 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)
1193 //gMC->Gspos("BARR", 1, "QUAR", - geometry->GetInnerFreonWidth()/2 - oqua_thickness, 0., 0., 0, "ONLY"); //Original settings (-21.65)
1194 //gMC->Gspos("BARR", 2, "QUAR", geometry->GetInnerFreonWidth()/2 + oqua_thickness, 0., 0., 0, "ONLY"); //Original settings (21.65)
1195 gMC->Gspos("QUAR", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness()/2, 0., 0, "ONLY");
1196 gMC->Gspos("GAP ", 1, "META", 0., geometry->GetGapThickness()/2 - geometry->GetProximityGapThickness()/2 - 0.0001, 0., 0, "ONLY");
1197 gMC->Gspos("META", 1, "SRIC", 0., 1.276, 0., 0, "ONLY");
1198 gMC->Gspos("CSI ", 1, "SRIC", 0., 1.276 + geometry->GetGapThickness()/2 + .25, 0., 0, "ONLY");
1199 printf("CSI pos: %f\n",1.276 + geometry->GetGapThickness()/2 + .25);
1201 // Wire support placing
1203 gMC->Gspos("WSG2", 1, "GAP ", 0., geometry->GetProximityGapThickness()/2 - .1, 0., 0, "ONLY");
1204 gMC->Gspos("WSG1", 1, "CSI ", 0., 0., 0., 0, "ONLY");
1205 gMC->Gspos("WSMe", 1, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, 0., 0, "ONLY");
1207 // Backplane placing
1209 gMC->Gspos("BACK", 1, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 43.3, 0, "ONLY");
1210 gMC->Gspos("BACK", 2, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2 , 43.3, 0, "ONLY");
1211 gMC->Gspos("BACK", 3, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
1212 gMC->Gspos("BACK", 4, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
1213 gMC->Gspos("BACK", 5, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
1214 gMC->Gspos("BACK", 6, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
1218 gMC->Gspos("PCB ", 1, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, csi_width/4 + .5025 + 2.5, 0, "ONLY");
1219 gMC->Gspos("PCB ", 2, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, -csi_width/4 - .5025 - 2.5, 0, "ONLY");
1223 //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);
1225 // Place RICH inside ALICE apparatus
1229 AliMatrix(idrotm[1000], 90., 0., 70.69, 90., 19.31, -90.);
1230 AliMatrix(idrotm[1001], 90., -20., 90., 70., 0., 0.);
1231 AliMatrix(idrotm[1002], 90., 0., 90., 90., 0., 0.);
1232 AliMatrix(idrotm[1003], 90., 20., 90., 110., 0., 0.);
1233 AliMatrix(idrotm[1004], 90., 340., 108.2, 70., 18.2, 70.);
1234 AliMatrix(idrotm[1005], 90., 0., 109.31, 90., 19.31, 90.);
1235 AliMatrix(idrotm[1006], 90., 20., 108.2, 110., 18.2, 110.);
1237 gMC->Gspos("RICH", 1, "ALIC", 0., 471.9, 165.26, idrotm[1000], "ONLY");
1238 gMC->Gspos("RICH", 2, "ALIC", 171., 470., 0., idrotm[1001], "ONLY");
1239 gMC->Gspos("RICH", 3, "ALIC", 0., 500., 0., idrotm[1002], "ONLY");
1240 gMC->Gspos("RICH", 4, "ALIC", -171., 470., 0., idrotm[1003], "ONLY");
1241 gMC->Gspos("RICH", 5, "ALIC", 161.4, 443.4, -165.3, idrotm[1004], "ONLY");
1242 gMC->Gspos("RICH", 6, "ALIC", 0., 471.9, -165.3, idrotm[1005], "ONLY");
1243 gMC->Gspos("RICH", 7, "ALIC", -161.4, 443.4, -165.3, idrotm[1006], "ONLY");*/
1245 // The placing of the chambers is measured from the vertex to the base of the methane vessel (490 cm)
1247 Float_t offset = 490 + 1.276 - geometry->GetGapThickness()/2; //distance from center of mother volume to methane
1248 Float_t deltaphi = 19.5; //phi angle between center of chambers - z direction
1249 Float_t deltatheta = 20; //theta angle between center of chambers - x direction
1250 Float_t cosphi = TMath::Cos(deltaphi*TMath::Pi()/180);
1251 Float_t sinphi = TMath::Sin(deltaphi*TMath::Pi()/180);
1252 Float_t costheta = TMath::Cos(deltatheta*TMath::Pi()/180);
1253 Float_t sintheta = TMath::Sin(deltatheta*TMath::Pi()/180);
1255 //printf("\n\n%f %f %f %f %f %f %f\n\n",offset,deltatheta,deltaphi,cosphi,costheta,sinphi,sintheta);
1257 AliMatrix(idrotm[1000], 90., 0. , 90. - deltaphi, 90. , deltaphi, -90. );
1258 AliMatrix(idrotm[1001], 90., -deltatheta , 90. , 90.- deltatheta , 0. , 0. );
1259 AliMatrix(idrotm[1002], 90., 0. , 90. , 90. , 0. , 0. );
1260 AliMatrix(idrotm[1003], 90., deltatheta , 90. , 90 + deltatheta , 0. , 0. );
1261 AliMatrix(idrotm[1004], 90., 360. - deltatheta, 108.2 , 90.- deltatheta ,18.2 , 90 - deltatheta);
1262 AliMatrix(idrotm[1005], 90., 0. , 90 + deltaphi , 90. , deltaphi, 90. );
1263 AliMatrix(idrotm[1006], 90., deltatheta , 108.2 , 90.+ deltatheta ,18.2 , 90 + deltatheta);
1265 gMC->Gspos("RICH", 1, "ALIC", 0. , offset*cosphi , offset*sinphi ,idrotm[1000], "ONLY");
1266 gMC->Gspos("RICH", 2, "ALIC", (offset)*sintheta , offset*costheta , 0. ,idrotm[1001], "ONLY");
1267 gMC->Gspos("RICH", 3, "ALIC", 0. , offset , 0. ,idrotm[1002], "ONLY");
1268 gMC->Gspos("RICH", 4, "ALIC", -(offset)*sintheta, offset*costheta , 0. ,idrotm[1003], "ONLY");
1269 gMC->Gspos("RICH", 5, "ALIC", (offset)*sinphi , offset*costheta*cosphi, -offset*sinphi,idrotm[1004], "ONLY");
1270 gMC->Gspos("RICH", 6, "ALIC", 0. , offset*cosphi , -offset*sinphi,idrotm[1005], "ONLY");
1271 gMC->Gspos("RICH", 7, "ALIC", -(offset)*sinphi , offset*costheta*cosphi, -offset*sinphi,idrotm[1006], "ONLY");
1276 //___________________________________________
1277 void AliRICH::CreateMaterials()
1280 // *** DEFINITION OF AVAILABLE RICH MATERIALS ***
1281 // ORIGIN : NICK VAN EIJNDHOVEN
1282 // Modified by: N. Colonna (INFN - BARI, Nicola.Colonna@ba.infn.it)
1283 // R.A. Fini (INFN - BARI, Rosanna.Fini@ba.infn.it)
1284 // R.A. Loconsole (Bari University, loco@riscom.ba.infn.it)
1286 Int_t isxfld = gAlice->Field()->Integ();
1287 Float_t sxmgmx = gAlice->Field()->Max();
1290 /************************************Antonnelo's Values (14-vectors)*****************************************/
1292 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,
1293 6.7e-9,6.88e-9,7.08e-9,7.3e-9,7.51e-9,7.74e-9,8e-9 };
1294 Float_t rIndexQuarz[14] = { 1.528309,1.533333,
1295 1.538243,1.544223,1.550568,1.55777,
1296 1.565463,1.574765,1.584831,1.597027,
1297 1.611858,1.6277,1.6472,1.6724 };
1298 Float_t rIndexOpaqueQuarz[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1299 Float_t rIndexMethane[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1300 Float_t rIndexGrid[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1301 Float_t abscoFreon[14] = { 179.0987,179.0987,
1302 179.0987,179.0987,179.0987,142.92,56.65,13.95,10.43,7.07,2.03,.5773,.33496,0. };
1303 //Float_t abscoFreon[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,
1304 // 1e-5,1e-5,1e-5,1e-5,1e-5 };
1305 Float_t abscoQuarz[14] = { 64.035,39.98,35.665,31.262,27.527,22.815,21.04,17.52,
1306 14.177,9.282,4.0925,1.149,.3627,.10857 };
1307 Float_t abscoOpaqueQuarz[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,
1308 1e-5,1e-5,1e-5,1e-5,1e-5 };
1309 Float_t abscoCsI[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
1310 1e-4,1e-4,1e-4,1e-4 };
1311 Float_t abscoMethane[14] = { 1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,
1313 Float_t abscoGrid[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
1314 1e-4,1e-4,1e-4,1e-4 };
1315 Float_t efficAll[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1316 Float_t efficCsI[14] = { 6e-4,.005,.0075,.01125,.045,.117,.135,.16575,
1317 .17425,.1785,.1836,.1904,.1938,.221 };
1318 Float_t efficGrid[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1322 /**********************************End of Antonnelo's Values**********************************/
1324 /**********************************Values from rich_media.f (31-vectors)**********************************/
1327 //Photons energy intervals
1331 ppckov[i] = (Float_t(i)*0.1+5.5)*1e-9;
1332 //printf ("Energy intervals: %e\n",ppckov[i]);
1336 //Refraction index for quarz
1337 Float_t rIndexQuarz[26];
1344 Float_t ene=ppckov[i]*1e9;
1345 Float_t a=f1/(e1*e1 - ene*ene);
1346 Float_t b=f2/(e2*e2 - ene*ene);
1347 rIndexQuarz[i] = TMath::Sqrt(1. + a + b );
1348 //printf ("rIndexQuarz: %e\n",rIndexQuarz[i]);
1351 //Refraction index for opaque quarz, methane and grid
1352 Float_t rIndexOpaqueQuarz[26];
1353 Float_t rIndexMethane[26];
1354 Float_t rIndexGrid[26];
1357 rIndexOpaqueQuarz[i]=1;
1358 rIndexMethane[i]=1.000444;
1360 //printf ("rIndexOpaqueQuarz , etc: %e, %e, %e\n",rIndexOpaqueQuarz[i], rIndexMethane[i], rIndexGrid[i]=1);
1363 //Absorption index for freon
1364 Float_t abscoFreon[26] = {179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987,
1365 179.0987, 142.9206, 56.64957, 25.58622, 13.95293, 12.03905, 10.42953, 8.804196,
1366 7.069031, 4.461292, 2.028366, 1.293013, .577267, .40746, .334964, 0., 0., 0.};
1368 //Absorption index for quarz
1369 /*Float_t Qzt [21] = {.0,.0,.005,.04,.35,.647,.769,.808,.829,.844,.853,.858,.869,.887,.903,.902,.902,
1370 .906,.907,.907,.907};
1371 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,
1372 215.0,220.0,225.0,230.0,235.0,240.0,245.0,250.0};
1373 Float_t abscoQuarz[31];
1374 for (Int_t i=0;i<31;i++)
1376 Float_t Xlam = 1237.79 / (ppckov[i]*1e9);
1377 if (Xlam <= 160) abscoQuarz[i] = 0;
1378 if (Xlam > 250) abscoQuarz[i] = 1;
1381 for (Int_t j=0;j<21;j++)
1383 //printf ("Passed\n");
1384 if (Xlam > Wavl2[j] && Xlam < Wavl2[j+1])
1386 Float_t Dabs = (Qzt[j+1] - Qzt[j])/(Wavl2[j+1] - Wavl2[j]);
1387 Float_t Abso = Qzt[j] + Dabs*(Xlam - Wavl2[j]);
1388 abscoQuarz[i] = -5.0/(TMath::Log(Abso));
1392 printf ("abscoQuarz: %e abscoFreon: %e for energy: %e\n",abscoQuarz[i],abscoFreon[i],ppckov[i]);
1395 /*Float_t abscoQuarz[31] = {49.64211, 48.41296, 47.46989, 46.50492, 45.13682, 44.47883, 43.1929 , 41.30922, 40.5943 ,
1396 39.82956, 38.98623, 38.6247 , 38.43448, 37.41084, 36.22575, 33.74852, 30.73901, 24.25086,
1397 17.94531, 11.88753, 5.99128, 3.83503, 2.36661, 1.53155, 1.30582, 1.08574, .8779708,
1398 .675275, 0., 0., 0.};
1400 for (Int_t i=0;i<31;i++)
1402 abscoQuarz[i] = abscoQuarz[i]/10;
1405 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,
1406 19.266, 17.525, 15.878, 14.177, 11.719, 9.282, 6.62, 4.0925, 2.601, 1.149, .667, .3627,
1407 .192, .1497, .10857};
1409 //Absorption index for methane
1410 Float_t abscoMethane[26];
1413 abscoMethane[i]=AbsoCH4(ppckov[i]*1e9);
1414 //printf("abscoMethane: %e for energy: %e\n", abscoMethane[i],ppckov[i]*1e9);
1417 //Absorption index for opaque quarz, csi and grid, efficiency for all and grid
1418 Float_t abscoOpaqueQuarz[26];
1419 Float_t abscoCsI[26];
1420 Float_t abscoGrid[26];
1421 Float_t efficAll[26];
1422 Float_t efficGrid[26];
1425 abscoOpaqueQuarz[i]=1e-5;
1430 //printf ("All must be 1: %e, %e, %e, %e, %e\n",abscoOpaqueQuarz[i],abscoCsI[i],abscoGrid[i],efficAll[i],efficGrid[i]);
1433 //Efficiency for csi
1435 Float_t efficCsI[26] = {0.000199999995, 0.000600000028, 0.000699999975, 0.00499999989, 0.00749999983, 0.010125,
1436 0.0242999997, 0.0405000001, 0.0688500032, 0.105299994, 0.121500008, 0.141749993, 0.157949999,
1437 0.162, 0.166050002, 0.167669997, 0.174299985, 0.176789999, 0.179279998, 0.182599992, 0.18592,
1438 0.187579989, 0.189239994, 0.190899998, 0.207499996, 0.215799987};
1442 //FRESNEL LOSS CORRECTION FOR PERPENDICULAR INCIDENCE AND
1443 //UNPOLARIZED PHOTONS
1447 efficCsI[i] = efficCsI[i]/(1.-Fresnel(ppckov[i]*1e9,1.,0));
1448 //printf ("Fresnel result: %e for energy: %e\n",Fresnel(ppckov[i]*1e9,1.,0),ppckov[i]*1e9);
1451 /*******************************************End of rich_media.f***************************************/
1458 Float_t afre[2], agri, amet[2], aqua[2], ahon, zfre[2], zgri, zhon,
1462 Int_t nlmatmet, nlmatqua;
1463 Float_t wmatquao[2], rIndexFreon[26];
1464 Float_t aquao[2], epsil, stmin, zquao[2];
1466 Float_t radlal, densal, tmaxfd, deemax, stemax;
1467 Float_t aal, zal, radlgri, densfre, radlhon, densgri, denshon,densqua, densmet, wmatfre[2], wmatmet[2], wmatqua[2];
1469 Int_t *idtmed = fIdtmed->GetArray()-999;
1471 // --- Photon energy (GeV)
1472 // --- Refraction indexes
1473 for (i = 0; i < 26; ++i) {
1474 rIndexFreon[i] = ppckov[i] * .0172 * 1e9 + 1.177;
1475 //rIndexFreon[i] = 1;
1476 //printf ("rIndexFreon: %e \n efficCsI: %e for energy: %e\n",rIndexFreon[i], efficCsI[i], ppckov[i]);
1479 // --- Detection efficiencies (quantum efficiency for CsI)
1480 // --- Define parameters for honeycomb.
1481 // Used carbon of equivalent rad. lenght
1488 // --- Parameters to include in GSMIXT, relative to Quarz (SiO2)
1499 // --- Parameters to include in GSMIXT, relative to opaque Quarz (SiO2)
1510 // --- Parameters to include in GSMIXT, relative to Freon (C6F14)
1521 // --- Parameters to include in GSMIXT, relative to methane (CH4)
1532 // --- Parameters to include in GSMIXT, relative to anode grid (Cu)
1539 // --- Parameters to include in GSMATE related to aluminium sheet
1546 // --- Glass parameters
1548 Float_t aglass[5]={12.01, 28.09, 16., 10.8, 23.};
1549 Float_t zglass[5]={ 6., 14., 8., 5., 11.};
1550 Float_t wglass[5]={ 0.5, 0.105, 0.355, 0.03, 0.01};
1551 Float_t dglass=1.74;
1554 AliMaterial(1, "Air $", 14.61, 7.3, .001205, 30420., 67500);
1555 AliMaterial(6, "HON", ahon, zhon, denshon, radlhon, 0);
1556 AliMaterial(16, "CSI", ahon, zhon, denshon, radlhon, 0);
1557 AliMixture(20, "QUA", aqua, zqua, densqua, nlmatqua, wmatqua);
1558 AliMixture(21, "QUAO", aquao, zquao, densquao, nlmatquao, wmatquao);
1559 AliMixture(30, "FRE", afre, zfre, densfre, nlmatfre, wmatfre);
1560 AliMixture(40, "MET", amet, zmet, densmet, nlmatmet, wmatmet);
1561 AliMixture(41, "METG", amet, zmet, densmet, nlmatmet, wmatmet);
1562 AliMaterial(11, "GRI", agri, zgri, densgri, radlgri, 0);
1563 AliMaterial(50, "ALUM", aal, zal, densal, radlal, 0);
1564 AliMixture(32, "GLASS",aglass, zglass, dglass, 5, wglass);
1565 AliMaterial(31, "COPPER$", 63.54, 29., 8.96, 1.4, 0.);
1573 AliMedium(1, "DEFAULT MEDIUM AIR$", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1574 AliMedium(2, "HONEYCOMB$", 6, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1575 AliMedium(3, "QUARZO$", 20, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1576 AliMedium(4, "FREON$", 30, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1577 AliMedium(5, "METANO$", 40, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1578 AliMedium(6, "CSI$", 16, 1, isxfld, sxmgmx,tmaxfd, stemax, deemax, epsil, stmin);
1579 AliMedium(7, "GRIGLIA$", 11, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1580 AliMedium(8, "QUARZOO$", 21, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1581 AliMedium(9, "GAP$", 41, 1, isxfld, sxmgmx,tmaxfd, .1, -deemax, epsil, -stmin);
1582 AliMedium(10, "ALUMINUM$", 50, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1583 AliMedium(11, "GLASS", 32, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1584 AliMedium(12, "PCB_COPPER", 31, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1587 gMC->SetCerenkov(idtmed[1000], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
1588 gMC->SetCerenkov(idtmed[1001], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
1589 gMC->SetCerenkov(idtmed[1002], 26, ppckov, abscoQuarz, efficAll,rIndexQuarz);
1590 gMC->SetCerenkov(idtmed[1003], 26, ppckov, abscoFreon, efficAll,rIndexFreon);
1591 gMC->SetCerenkov(idtmed[1004], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
1592 gMC->SetCerenkov(idtmed[1005], 26, ppckov, abscoCsI, efficCsI, rIndexMethane);
1593 gMC->SetCerenkov(idtmed[1006], 26, ppckov, abscoGrid, efficGrid, rIndexGrid);
1594 gMC->SetCerenkov(idtmed[1007], 26, ppckov, abscoOpaqueQuarz, efficAll, rIndexOpaqueQuarz);
1595 gMC->SetCerenkov(idtmed[1008], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
1596 gMC->SetCerenkov(idtmed[1009], 26, ppckov, abscoGrid, efficGrid, rIndexGrid);
1597 gMC->SetCerenkov(idtmed[1010], 26, ppckov, abscoOpaqueQuarz, efficAll, rIndexOpaqueQuarz);
1600 //___________________________________________
1602 Float_t AliRICH::Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)
1605 //ENE(EV), PDOTI=COS(INC.ANG.), PDOTR=COS(POL.PLANE ROT.ANG.)
1607 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,
1608 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,
1609 7.8,7.9,8.0,8.1,8.2,8.3,8.4,8.5};
1612 Float_t csin[36] = {2.14,2.21,2.33,2.48,2.76,2.97,2.99,2.59,2.81,3.05,
1613 2.86,2.53,2.55,2.66,2.79,2.96,3.18,3.05,2.84,2.81,2.38,2.11,
1614 2.01,2.13,2.39,2.73,3.08,3.15,2.95,2.73,2.56,2.41,2.12,1.95,
1617 Float_t csik[36] = {0.,0.,0.,0.,0.,0.196,0.408,0.208,0.118,0.49,0.784,0.543,
1618 0.424,0.404,0.371,0.514,0.922,1.102,1.139,1.376,1.461,1.253,0.878,
1619 0.69,0.612,0.649,0.824,1.347,1.571,1.678,1.763,1.857,1.824,1.824,
1622 Int_t j=Int_t(xe*10)-49;
1623 Float_t cn=csin[j]+((csin[j+1]-csin[j])/0.1)*(xe-en[j]);
1624 Float_t ck=csik[j]+((csik[j+1]-csik[j])/0.1)*(xe-en[j]);
1626 //FORMULAE FROM HANDBOOK OF OPTICS, 33.23 OR
1627 //W.R. HUNTER, J.O.S.A. 54 (1964),15 , J.O.S.A. 55(1965),1197
1629 Float_t sinin=TMath::Sqrt(1-pdoti*pdoti);
1630 Float_t tanin=sinin/pdoti;
1632 Float_t c1=cn*cn-ck*ck-sinin*sinin;
1633 Float_t c2=4*cn*cn*ck*ck;
1634 Float_t aO=TMath::Sqrt(0.5*(TMath::Sqrt(c1*c1+c2)+c1));
1635 Float_t b2=0.5*(TMath::Sqrt(c1*c1+c2)-c1);
1637 Float_t rs=((aO-pdoti)*(aO-pdoti)+b2)/((aO+pdoti)*(aO+pdoti)+b2);
1638 Float_t rp=rs*((aO-sinin*tanin)*(aO-sinin*tanin)+b2)/((aO+sinin*tanin)*(aO+sinin*tanin)+b2);
1641 //CORRECTION FACTOR FOR SURFACE ROUGHNESS
1642 //B.J. STAGG APPLIED OPTICS, 30(1991),4113
1645 Float_t lamb=1240/ene;
1648 Float_t rO=TMath::Exp(-(4*TMath::Pi()*pdoti*sigraf/lamb)*(4*TMath::Pi()*pdoti*sigraf/lamb));
1652 Float_t pdotr=0.8; //DEGREE OF POLARIZATION : 1->P , -1->S
1653 fresn=0.5*(rp*(1+pdotr)+rs*(1-pdotr));
1662 //__________________________________________
1663 Float_t AliRICH::AbsoCH4(Float_t x)
1666 //KLOSCH,SCH4(9),WL(9),EM(9),ALENGTH(31)
1667 Float_t sch4[9] = {.12,.16,.23,.38,.86,2.8,7.9,28.,80.}; //MB X 10^22
1668 //Float_t wl[9] = {153.,152.,151.,150.,149.,148.,147.,146.,145};
1669 Float_t em[9] = {8.1,8.158,8.212,8.267,8.322,8.378,8.435,8.493,8.55};
1670 const Float_t kLosch=2.686763E19; // LOSCHMIDT NUMBER IN CM-3
1671 const Float_t kIgas1=100, kIgas2=0, kOxy=10., kWater=5., kPressure=750.,kTemperature=283.;
1672 Float_t pn=kPressure/760.;
1673 Float_t tn=kTemperature/273.16;
1676 // ------- METHANE CROSS SECTION -----------------
1677 // ASTROPH. J. 214, L47 (1978)
1683 if(x>=7.75 && x<=8.1)
1685 Float_t c0=-1.655279e-1;
1686 Float_t c1=6.307392e-2;
1687 Float_t c2=-8.011441e-3;
1688 Float_t c3=3.392126e-4;
1689 sm=(c0+c1*x+c2*x*x+c3*x*x*x)*1.e-18;
1695 while (x<=em[j] && x>=em[j+1])
1698 Float_t a=(sch4[j+1]-sch4[j])/(em[j+1]-em[j]);
1699 sm=(sch4[j]+a*(x-em[j]))*1e-22;
1703 Float_t dm=(kIgas1/100.)*(1.-((kOxy+kWater)/1.e6))*kLosch*pn/tn;
1704 Float_t abslm=1./sm/dm;
1706 // ------- ISOBUTHANE CROSS SECTION --------------
1707 // i-C4H10 (ai) abs. length from curves in
1708 // Lu-McDonald paper for BARI RICH workshop .
1709 // -----------------------------------------------------------
1718 if(x>=7.25 && x<7.375)
1724 Float_t si = 1./(ai*kLosch*273.16/293.); // ISOB. CRO.SEC.IN CM2
1725 Float_t di=(kIgas2/100.)*(1.-((kOxy+kWater)/1.e6))*kLosch*pn/tn;
1730 // ---------------------------------------------------------
1732 // transmission of O2
1734 // y= path in cm, x=energy in eV
1735 // so= cross section for UV absorption in cm2
1736 // do= O2 molecular density in cm-3
1737 // ---------------------------------------------------------
1745 so=3.392709e-13 * TMath::Exp(2.864104 *x);
1751 so=2.910039e-34 * TMath::Exp(10.3337*x);
1758 Float_t a0=-73770.76;
1759 Float_t a1=46190.69;
1760 Float_t a2=-11475.44;
1761 Float_t a3=1412.611;
1762 Float_t a4=-86.07027;
1763 Float_t a5=2.074234;
1764 so= a0+(a1*x)+(a2*x*x)+(a3*x*x*x)+(a4*x*x*x*x)+(a5*x*x*x*x*x);
1768 Float_t dox=(kOxy/1e6)*kLosch*pn/tn;
1773 // ---------------------------------------------------------
1775 // transmission of H2O
1777 // y= path in cm, x=energy in eV
1778 // sw= cross section for UV absorption in cm2
1779 // dw= H2O molecular density in cm-3
1780 // ---------------------------------------------------------
1784 Float_t b0=29231.65;
1785 Float_t b1=-15807.74;
1786 Float_t b2=3192.926;
1787 Float_t b3=-285.4809;
1788 Float_t b4=9.533944;
1792 Float_t sw= b0+(b1*x)+(b2*x*x)+(b3*x*x*x)+(b4*x*x*x*x);
1794 Float_t dw=(kWater/1e6)*kLosch*pn/tn;
1800 // ---------------------------------------------------------
1802 Float_t alength=1./(1./abslm+1./absli+1./abslo+1./abslw);
1808 //___________________________________________
1809 Int_t AliRICH::DistancetoPrimitive(Int_t , Int_t )
1817 //___________________________________________
1818 void AliRICH::MakeBranch(Option_t* option, const char *file)
1820 // Create Tree branches for the RICH.
1822 const Int_t kBufferSize = 4000;
1823 char branchname[20];
1825 AliDetector::MakeBranch(option,file);
1827 const char *cH = strstr(option,"H");
1828 const char *cD = strstr(option,"D");
1829 const char *cR = strstr(option,"R");
1830 const char *cS = strstr(option,"S");
1834 sprintf(branchname,"%sCerenkov",GetName());
1835 if (fCerenkovs && gAlice->TreeH()) {
1836 //TBranch* branch = MakeBranchInTree(gAlice->TreeH(),branchname, &fCerenkovs, kBufferSize, file) ;
1837 MakeBranchInTree(gAlice->TreeH(),branchname, &fCerenkovs, kBufferSize, file) ;
1838 //branch->SetAutoDelete(kFALSE);
1840 sprintf(branchname,"%sSDigits",GetName());
1841 if (fSDigits && gAlice->TreeH()) {
1842 //TBranch* branch = MakeBranchInTree(gAlice->TreeH(),branchname, &fSDigits, kBufferSize, file) ;
1843 MakeBranchInTree(gAlice->TreeH(),branchname, &fSDigits, kBufferSize, file) ;
1844 //branch->SetAutoDelete(kFALSE);
1845 //printf("Making branch %sSDigits in TreeH\n",GetName());
1850 sprintf(branchname,"%sSDigits",GetName());
1851 if (fSDigits && gAlice->TreeS()) {
1852 //TBranch* branch = MakeBranchInTree(gAlice->TreeS(),branchname, &fSDigits, kBufferSize, file) ;
1853 MakeBranchInTree(gAlice->TreeS(),branchname, &fSDigits, kBufferSize, file) ;
1854 //branch->SetAutoDelete(kFALSE);
1855 //printf("Making branch %sSDigits in TreeS\n",GetName());
1861 // one branch for digits per chamber
1865 for (i=0; i<kNCH ;i++) {
1866 sprintf(branchname,"%sDigits%d",GetName(),i+1);
1867 if (fDchambers && gAlice->TreeD()) {
1868 //TBranch* branch = MakeBranchInTree(gAlice->TreeD(),branchname, &((*fDchambers)[i]), kBufferSize, file) ;
1869 MakeBranchInTree(gAlice->TreeD(),branchname, &((*fDchambers)[i]), kBufferSize, file) ;
1870 //branch->SetAutoDelete(kFALSE);
1871 //printf("Making Branch %sDigits%d\n",GetName(),i+1);
1878 // one branch for raw clusters per chamber
1881 //printf("Called MakeBranch for TreeR\n");
1885 for (i=0; i<kNCH ;i++) {
1886 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
1887 if (fRawClusters && gAlice->TreeR()) {
1888 //TBranch* branch = MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRawClusters)[i]), kBufferSize, file) ;
1889 MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRawClusters)[i]), kBufferSize, file) ;
1890 //branch->SetAutoDelete(kFALSE);
1894 // one branch for rec hits per chamber
1896 for (i=0; i<kNCH ;i++) {
1897 sprintf(branchname,"%sRecHits1D%d",GetName(),i+1);
1898 if (fRecHits1D && gAlice->TreeR()) {
1899 //TBranch* branch = MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRecHits1D)[i]), kBufferSize, file) ;
1900 MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRecHits1D)[i]), kBufferSize, file) ;
1901 //branch->SetAutoDelete(kFALSE);
1904 for (i=0; i<kNCH ;i++) {
1905 sprintf(branchname,"%sRecHits3D%d",GetName(),i+1);
1906 if (fRecHits3D && gAlice->TreeR()) {
1907 MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRecHits3D)[i]), kBufferSize, file) ;
1908 //branch->SetAutoDelete(kFALSE);
1914 //___________________________________________
1915 void AliRICH::SetTreeAddress()
1917 // Set branch address for the Hits and Digits Tree.
1918 char branchname[20];
1921 AliDetector::SetTreeAddress();
1924 TTree *treeH = gAlice->TreeH();
1925 TTree *treeD = gAlice->TreeD();
1926 TTree *treeR = gAlice->TreeR();
1927 TTree *treeS = gAlice->TreeS();
1931 branch = treeH->GetBranch("RICHCerenkov");
1932 if (branch) branch->SetAddress(&fCerenkovs);
1935 branch = treeH->GetBranch("RICHSDigits");
1938 branch->SetAddress(&fSDigits);
1939 //printf("Setting sdigits branch address at %p in TreeH\n",&fSDigits);
1946 branch = treeS->GetBranch("RICHSDigits");
1949 branch->SetAddress(&fSDigits);
1950 //printf("Setting sdigits branch address at %p in TreeS\n",&fSDigits);
1957 for (int i=0; i<kNCH; i++) {
1958 sprintf(branchname,"%sDigits%d",GetName(),i+1);
1960 branch = treeD->GetBranch(branchname);
1961 if (branch) branch->SetAddress(&((*fDchambers)[i]));
1966 for (i=0; i<kNCH; i++) {
1967 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
1969 branch = treeR->GetBranch(branchname);
1970 if (branch) branch->SetAddress(&((*fRawClusters)[i]));
1974 for (i=0; i<kNCH; i++) {
1975 sprintf(branchname,"%sRecHits1D%d",GetName(),i+1);
1977 branch = treeR->GetBranch(branchname);
1978 if (branch) branch->SetAddress(&((*fRecHits1D)[i]));
1982 for (i=0; i<kNCH; i++) {
1983 sprintf(branchname,"%sRecHits3D%d",GetName(),i+1);
1985 branch = treeR->GetBranch(branchname);
1986 if (branch) branch->SetAddress(&((*fRecHits3D)[i]));
1992 //___________________________________________
1993 void AliRICH::ResetHits()
1995 // Reset number of clusters and the cluster array for this detector
1996 AliDetector::ResetHits();
1999 if (fSDigits) fSDigits->Clear();
2000 if (fCerenkovs) fCerenkovs->Clear();
2004 //____________________________________________
2005 void AliRICH::ResetDigits()
2008 // Reset number of digits and the digits array for this detector
2010 for ( int i=0;i<kNCH;i++ ) {
2011 //PH if (fDchambers && (*fDchambers)[i]) (*fDchambers)[i]->Clear();
2012 if (fDchambers && fDchambers->At(i)) fDchambers->At(i)->Clear();
2013 if (fNdch) fNdch[i]=0;
2017 //____________________________________________
2018 void AliRICH::ResetRawClusters()
2021 // Reset number of raw clusters and the raw clust array for this detector
2023 for ( int i=0;i<kNCH;i++ ) {
2024 //PH if ((*fRawClusters)[i]) ((TClonesArray*)(*fRawClusters)[i])->Clear();
2025 if (fRawClusters->At(i)) ((TClonesArray*)fRawClusters->At(i))->Clear();
2026 if (fNrawch) fNrawch[i]=0;
2030 //____________________________________________
2031 void AliRICH::ResetRecHits1D()
2034 // Reset number of raw clusters and the raw clust array for this detector
2037 for ( int i=0;i<kNCH;i++ ) {
2038 //PH if ((*fRecHits1D)[i]) ((TClonesArray*)(*fRecHits1D)[i])->Clear();
2039 if (fRecHits1D->At(i)) ((TClonesArray*)fRecHits1D->At(i))->Clear();
2040 if (fNrechits1D) fNrechits1D[i]=0;
2044 //____________________________________________
2045 void AliRICH::ResetRecHits3D()
2048 // Reset number of raw clusters and the raw clust array for this detector
2051 for ( int i=0;i<kNCH;i++ ) {
2052 //PH if ((*fRecHits3D)[i]) ((TClonesArray*)(*fRecHits3D)[i])->Clear();
2053 if (fRecHits3D->At(i)) ((TClonesArray*)fRecHits3D->At(i))->Clear();
2054 if (fNrechits3D) fNrechits3D[i]=0;
2059 //___________________________________________
2060 void AliRICH::StepManager()
2062 // Full Step Manager
2066 static Int_t vol[2];
2068 static Float_t hits[22];
2069 static Float_t ckovData[19];
2070 TLorentzVector position;
2071 TLorentzVector momentum;
2074 Float_t localPos[3];
2075 Float_t localMom[4];
2076 Float_t localTheta,localPhi;
2078 Float_t destep, step;
2081 Float_t coscerenkov;
2082 static Float_t eloss, xhit, yhit, tlength;
2083 const Float_t kBig=1.e10;
2085 TClonesArray &lhits = *fHits;
2086 TParticle *current = (TParticle*)(*gAlice->Particles())[gAlice->CurrentTrack()];
2088 //if (current->Energy()>1)
2091 // Only gas gap inside chamber
2092 // Tag chambers and record hits when track enters
2095 id=gMC->CurrentVolID(copy);
2096 Float_t cherenkovLoss=0;
2097 //gAlice->KeepTrack(gAlice->CurrentTrack());
2099 gMC->TrackPosition(position);
2103 //bzero((char *)ckovData,sizeof(ckovData)*19);
2104 ckovData[1] = pos[0]; // X-position for hit
2105 ckovData[2] = pos[1]; // Y-position for hit
2106 ckovData[3] = pos[2]; // Z-position for hit
2107 ckovData[6] = 0; // dummy track length
2108 //ckovData[11] = gAlice->CurrentTrack();
2110 //printf("\n+++++++++++\nTrack: %d\n++++++++++++\n",gAlice->CurrentTrack());
2112 //AliRICH *RICH = (AliRICH *) gAlice->GetDetector("RICH");
2114 /********************Store production parameters for Cerenkov photons************************/
2115 //is it a Cerenkov photon?
2116 if (gMC->TrackPid() == 50000050) {
2118 //if (gMC->VolId("GAP ")==gMC->CurrentVolID(copy))
2120 Float_t ckovEnergy = current->Energy();
2121 //energy interval for tracking
2122 if (ckovEnergy > 5.6e-09 && ckovEnergy < 7.8e-09 )
2123 //if (ckovEnergy > 0)
2125 if (gMC->IsTrackEntering()){ //is track entering?
2126 //printf("Track entered (1)\n");
2127 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
2129 if (gMC->IsNewTrack()){ //is it the first step?
2130 //printf("I'm in!\n");
2131 Int_t mother = current->GetFirstMother();
2133 //printf("Second Mother:%d\n",current->GetSecondMother());
2135 ckovData[10] = mother;
2136 ckovData[11] = gAlice->CurrentTrack();
2137 ckovData[12] = 1; //Media where photon was produced 1->Freon, 2->Quarz
2138 //printf("Produced in FREO\n");
2141 //printf("Index: %d\n",fCkovNumber);
2142 } //first step question
2145 if (gMC->IsNewTrack()){ //is it first step?
2146 if (gMC->VolId("QUAR")==gMC->CurrentVolID(copy)) //is it in quarz?
2149 //printf("Produced in QUAR\n");
2151 } //first step question
2153 //printf("Before %d\n",fFreonProd);
2154 } //track entering question
2156 if (ckovData[12] == 1) //was it produced in Freon?
2157 //if (fFreonProd == 1)
2159 if (gMC->IsTrackEntering()){ //is track entering?
2160 //printf("Track entered (2)\n");
2161 //printf("Current volume (should be META): %s\n",gMC->CurrentVolName());
2162 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("META"),gMC->CurrentVolID(copy));
2163 if (gMC->VolId("META")==gMC->CurrentVolID(copy)) //is it in gap?
2165 //printf("Got in META\n");
2166 gMC->TrackMomentum(momentum);
2171 // Z-position for hit
2174 /**************** Photons lost in second grid have to be calculated by hand************/
2176 Float_t cophi = TMath::Cos(TMath::ATan2(mom[0], mom[1]));
2177 Float_t t = (1. - .025 / cophi) * (1. - .05 / cophi);
2179 //printf("grid calculation:%f\n",t);
2183 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
2184 //printf("Added One (1)!\n");
2185 //printf("Lost one in grid\n");
2187 /**********************************************************************************/
2190 //printf("Current volume (should be CSI) (1): %s\n",gMC->CurrentVolName());
2191 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("CSI "),gMC->CurrentVolID(copy));
2192 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy)) //is it in csi?
2194 //printf("Got in CSI\n");
2195 gMC->TrackMomentum(momentum);
2201 /********* Photons lost by Fresnel reflection have to be calculated by hand********/
2202 /***********************Cerenkov phtons (always polarised)*************************/
2204 Float_t cophi = TMath::Cos(TMath::ATan2(mom[0], mom[1]));
2205 Float_t t = Fresnel(ckovEnergy*1e9,cophi,1);
2210 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
2211 //printf("Added One (2)!\n");
2212 //printf("Lost by Fresnel\n");
2214 /**********************************************************************************/
2219 /********************Evaluation of losses************************/
2220 /******************still in the old fashion**********************/
2223 Int_t i1 = gMC->StepProcesses(procs); //number of physics mechanisms acting on the particle
2224 for (Int_t i = 0; i < i1; ++i) {
2226 if (procs[i] == kPLightReflection) { //was it reflected
2228 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
2230 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
2233 //AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
2234 } //reflection question
2237 else if (procs[i] == kPLightAbsorption) { //was it absorbed?
2238 //printf("Got in absorption\n");
2240 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
2242 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
2244 if (gMC->CurrentVolID(copy) == gMC->VolId("META"))
2246 if (gMC->CurrentVolID(copy) == gMC->VolId("GAP "))
2249 if (gMC->CurrentVolID(copy) == gMC->VolId("SRIC"))
2253 if (gMC->CurrentVolID(copy) == gMC->VolId("CSI ")) {
2257 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
2258 //printf("Added One (3)!\n");
2259 //printf("Added cerenkov %d\n",fCkovNumber);
2260 } //absorption question
2263 // Photon goes out of tracking scope
2264 else if (procs[i] == kPStop) { //is it below energy treshold?
2267 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
2268 //printf("Added One (4)!\n");
2269 } // energy treshold question
2270 } //number of mechanisms cycle
2271 /**********************End of evaluation************************/
2272 } //freon production question
2273 } //energy interval question
2274 //}//inside the proximity gap question
2275 } //cerenkov photon question
2277 /**************************************End of Production Parameters Storing*********************/
2280 /*******************************Treat photons that hit the CsI (Ckovs and Feedbacks)************/
2282 if (gMC->TrackPid() == 50000050 || gMC->TrackPid() == 50000051) {
2283 //printf("Cerenkov\n");
2285 //if (gMC->TrackPid() == 50000051)
2286 //printf("Tracking a feedback\n");
2288 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy))
2290 //printf("Current volume (should be CSI) (2): %s\n",gMC->CurrentVolName());
2291 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("CSI "),gMC->CurrentVolID(copy));
2292 //printf("Got in CSI\n");
2293 //printf("Tracking a %d\n",gMC->TrackPid());
2294 if (gMC->Edep() > 0.){
2295 gMC->TrackPosition(position);
2296 gMC->TrackMomentum(momentum);
2304 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
2305 Double_t rt = TMath::Sqrt(tc);
2306 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
2307 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
2308 gMC->Gmtod(pos,localPos,1);
2309 gMC->Gmtod(mom,localMom,2);
2311 gMC->CurrentVolOffID(2,copy);
2315 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
2316 //->Sector(localPos[0], localPos[2]);
2317 //printf("Sector:%d\n",sector);
2319 /*if (gMC->TrackPid() == 50000051){
2321 printf("Feedbacks:%d\n",fFeedbacks);
2324 //PH ((AliRICHChamber*) (*fChambers)[idvol])
2325 ((AliRICHChamber*)fChambers->At(idvol))
2326 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
2328 ckovData[0] = gMC->TrackPid(); // particle type
2329 ckovData[1] = pos[0]; // X-position for hit
2330 ckovData[2] = pos[1]; // Y-position for hit
2331 ckovData[3] = pos[2]; // Z-position for hit
2332 ckovData[4] = theta; // theta angle of incidence
2333 ckovData[5] = phi; // phi angle of incidence
2334 ckovData[8] = (Float_t) fNSDigits; // first sdigit
2335 ckovData[9] = -1; // last pad hit
2336 ckovData[13] = 4; // photon was detected
2337 ckovData[14] = mom[0];
2338 ckovData[15] = mom[1];
2339 ckovData[16] = mom[2];
2341 destep = gMC->Edep();
2342 gMC->SetMaxStep(kBig);
2343 cherenkovLoss += destep;
2344 ckovData[7]=cherenkovLoss;
2346 nPads = Hits2SDigits(localPos[0],localPos[2],cherenkovLoss,idvol,kCerenkov);
2348 if (fNSDigits > (Int_t)ckovData[8]) {
2349 ckovData[8]= ckovData[8]+1;
2350 ckovData[9]= (Float_t) fNSDigits;
2353 //printf("Cerenkov loss: %f\n", cherenkovLoss);
2355 ckovData[17] = nPads;
2356 //printf("nPads:%d",nPads);
2358 //TClonesArray *Hits = RICH->Hits();
2359 AliRICHHit *mipHit = (AliRICHHit*) (fHits->UncheckedAt(0));
2362 mom[0] = current->Px();
2363 mom[1] = current->Py();
2364 mom[2] = current->Pz();
2365 Float_t mipPx = mipHit->MomX();
2366 Float_t mipPy = mipHit->MomY();
2367 Float_t mipPz = mipHit->MomZ();
2369 Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
2370 Float_t rt = TMath::Sqrt(r);
2371 Float_t mipR = mipPx*mipPx + mipPy*mipPy + mipPz*mipPz;
2372 Float_t mipRt = TMath::Sqrt(mipR);
2375 coscerenkov = (mom[0]*mipPx + mom[1]*mipPy + mom[2]*mipPz)/(rt*mipRt);
2381 Float_t cherenkov = TMath::ACos(coscerenkov);
2382 ckovData[18]=cherenkov;
2386 AddHit(gAlice->CurrentTrack(),vol,ckovData);
2387 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
2388 //printf("Added One (5)!\n");
2395 /***********************************************End of photon hits*********************************************/
2398 /**********************************************Charged particles treatment*************************************/
2400 else if (gMC->TrackCharge())
2404 /*if (gMC->IsTrackEntering())
2406 hits[13]=20;//is track entering?
2408 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
2410 gMC->TrackMomentum(momentum);
2421 if (gMC->VolId("GAP ")== gMC->CurrentVolID(copy)) {
2422 // Get current particle id (ipart), track position (pos) and momentum (mom)
2424 gMC->CurrentVolOffID(3,copy);
2428 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
2429 //->Sector(localPos[0], localPos[2]);
2430 //printf("Sector:%d\n",sector);
2432 gMC->TrackPosition(position);
2433 gMC->TrackMomentum(momentum);
2441 gMC->Gmtod(pos,localPos,1);
2442 gMC->Gmtod(mom,localMom,2);
2444 ipart = gMC->TrackPid();
2446 // momentum loss and steplength in last step
2447 destep = gMC->Edep();
2448 step = gMC->TrackStep();
2451 // record hits when track enters ...
2452 if( gMC->IsTrackEntering()) {
2453 // gMC->SetMaxStep(fMaxStepGas);
2454 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
2455 Double_t rt = TMath::Sqrt(tc);
2456 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
2457 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
2460 Double_t localTc = localMom[0]*localMom[0]+localMom[2]*localMom[2];
2461 Double_t localRt = TMath::Sqrt(localTc);
2462 localTheta = Float_t(TMath::ATan2(localRt,Double_t(localMom[1])))*kRaddeg;
2463 localPhi = Float_t(TMath::ATan2(Double_t(localMom[2]),Double_t(localMom[0])))*kRaddeg;
2465 hits[0] = Float_t(ipart); // particle type
2466 hits[1] = localPos[0]; // X-position for hit
2467 hits[2] = localPos[1]; // Y-position for hit
2468 hits[3] = localPos[2]; // Z-position for hit
2469 hits[4] = localTheta; // theta angle of incidence
2470 hits[5] = localPhi; // phi angle of incidence
2471 hits[8] = (Float_t) fNSDigits; // first sdigit
2472 hits[9] = -1; // last pad hit
2473 hits[13] = fFreonProd; // did id hit the freon?
2477 hits[18] = 0; // dummy cerenkov angle
2483 Chamber(idvol).LocaltoGlobal(localPos,hits+1);
2486 //To make chamber coordinates x-y had to pass localPos[0], localPos[2]
2489 // Only if not trigger chamber
2492 // Initialize hit position (cursor) in the segmentation model
2493 //PH ((AliRICHChamber*) (*fChambers)[idvol])
2494 ((AliRICHChamber*)fChambers->At(idvol))
2495 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
2500 // Calculate the charge induced on a pad (disintegration) in case
2502 // Mip left chamber ...
2503 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
2504 gMC->SetMaxStep(kBig);
2509 // Only if not trigger chamber
2513 if(gMC->TrackPid() == kNeutron)
2514 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
2515 nPads = Hits2SDigits(xhit,yhit,eloss,idvol,kMip);
2517 //printf("nPads:%d",nPads);
2523 if (fNSDigits > (Int_t)hits[8]) {
2525 hits[9]= (Float_t) fNSDigits;
2529 new(lhits[fNhits++]) AliRICHHit(fIshunt,gAlice->CurrentTrack(),vol,hits);
2532 // Check additional signal generation conditions
2533 // defined by the segmentation
2534 // model (boundary crossing conditions)
2536 //PH (((AliRICHChamber*) (*fChambers)[idvol])
2537 (((AliRICHChamber*)fChambers->At(idvol))
2538 ->SigGenCond(localPos[0], localPos[2], localPos[1]))
2540 //PH ((AliRICHChamber*) (*fChambers)[idvol])
2541 ((AliRICHChamber*)fChambers->At(idvol))
2542 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
2545 if(gMC->TrackPid() == kNeutron)
2546 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
2547 nPads = Hits2SDigits(xhit,yhit,eloss,idvol,kMip);
2549 //printf("Npads:%d",NPads);
2556 // nothing special happened, add up energy loss
2563 /*************************************************End of MIP treatment**************************************/
2565 }//void AliRICH::StepManager()
2567 void AliRICH::FindClusters(Int_t nev,Int_t lastEntry)
2571 // Loop on chambers and on cathode planes
2573 for (Int_t icat=1;icat<2;icat++) {
2574 gAlice->ResetDigits();
2575 gAlice->TreeD()->GetEvent(0);
2576 for (Int_t ich=0;ich<kNCH;ich++) {
2577 //PH AliRICHChamber* iChamber=(AliRICHChamber*) (*fChambers)[ich];
2578 AliRICHChamber* iChamber=(AliRICHChamber*)fChambers->At(ich);
2579 TClonesArray *pRICHdigits = this->DigitsAddress(ich);
2580 if (pRICHdigits == 0)
2583 // Get ready the current chamber stuff
2585 AliRICHResponse* response = iChamber->GetResponseModel();
2586 AliSegmentation* seg = iChamber->GetSegmentationModel();
2587 AliRICHClusterFinder* rec = iChamber->GetReconstructionModel();
2589 rec->SetSegmentation(seg);
2590 rec->SetResponse(response);
2591 rec->SetDigits(pRICHdigits);
2592 rec->SetChamber(ich);
2593 if (nev==0) rec->CalibrateCOG();
2594 rec->FindRawClusters();
2597 fRch=RawClustAddress(ich);
2601 gAlice->TreeR()->Fill();
2603 for (int i=0;i<kNCH;i++) {
2604 fRch=RawClustAddress(i);
2605 int nraw=fRch->GetEntriesFast();
2606 printf ("Chamber %d, raw clusters %d\n",i,nraw);
2614 sprintf(hname,"TreeR%d",nev);
2615 gAlice->TreeR()->Write(hname,kOverwrite,0);
2616 gAlice->TreeR()->Reset();
2618 //gObjectTable->Print();
2621 AliRICHSDigit* AliRICH::FirstPad(AliRICHHit* hit,TClonesArray *clusters )
2624 // Initialise the pad iterator
2625 // Return the address of the first sdigit for hit
2626 TClonesArray *theClusters = clusters;
2627 Int_t nclust = theClusters->GetEntriesFast();
2628 if (nclust && hit->PHlast() > 0) {
2629 sMaxIterPad=Int_t(hit->PHlast());
2630 sCurIterPad=Int_t(hit->PHfirst());
2631 return (AliRICHSDigit*) clusters->UncheckedAt(sCurIterPad-1);
2638 AliRICHSDigit* AliRICH::NextPad(TClonesArray *clusters)
2641 // Iterates over pads
2644 if (sCurIterPad <= sMaxIterPad) {
2645 return (AliRICHSDigit*) clusters->UncheckedAt(sCurIterPad-1);
2651 AliRICH& AliRICH::operator=(const AliRICH& rhs)
2653 // Assignment operator
2658 void AliRICH::DiagnosticsFE(Int_t evNumber1,Int_t evNumber2)
2661 Int_t NpadX = 162; // number of pads on X
2662 Int_t NpadY = 162; // number of pads on Y
2664 Int_t Pad[162][162];
2665 for (Int_t i=0;i<NpadX;i++) {
2666 for (Int_t j=0;j<NpadY;j++) {
2671 // Create some histograms
2673 TH1F *pionspectra1 = new TH1F("pionspectra1","Pion Spectra",200,-4,2);
2674 TH1F *pionspectra2 = new TH1F("pionspectra2","Pion Spectra",200,-4,2);
2675 TH1F *pionspectra3 = new TH1F("pionspectra3","Pion Spectra",200,-4,2);
2676 TH1F *protonspectra1 = new TH1F("protonspectra1","Proton Spectra",200,-4,2);
2677 TH1F *protonspectra2 = new TH1F("protonspectra2","Proton Spectra",200,-4,2);
2678 TH1F *protonspectra3 = new TH1F("protonspectra3","Proton Spectra",200,-4,2);
2679 TH1F *kaonspectra1 = new TH1F("kaonspectra1","Kaon Spectra",100,-4,2);
2680 TH1F *kaonspectra2 = new TH1F("kaonspectra2","Kaon Spectra",100,-4,2);
2681 TH1F *kaonspectra3 = new TH1F("kaonspectra3","Kaon Spectra",100,-4,2);
2682 TH1F *electronspectra1 = new TH1F("electronspectra1","Electron Spectra",100,-4,2);
2683 TH1F *electronspectra2 = new TH1F("electronspectra2","Electron Spectra",100,-4,2);
2684 TH1F *electronspectra3 = new TH1F("electronspectra3","Electron Spectra",100,-4,2);
2685 TH1F *muonspectra1 = new TH1F("muonspectra1","Muon Spectra",100,-4,2);
2686 TH1F *muonspectra2 = new TH1F("muonspectra2","Muon Spectra",100,-4,2);
2687 TH1F *muonspectra3 = new TH1F("muonspectra3","Muon Spectra",100,-4,2);
2688 TH1F *neutronspectra1 = new TH1F("neutronspectra1","Neutron Spectra",100,-4,2);
2689 TH1F *neutronspectra2 = new TH1F("neutronspectra2","Neutron Spectra",100,-4,2);
2690 TH1F *neutronspectra3 = new TH1F("neutronspectra2","Neutron Spectra",100,-4,2);
2691 TH1F *chargedspectra1 = new TH1F("chargedspectra1","Charged particles above 1 GeV Spectra",100,-1,3);
2692 TH1F *chargedspectra2 = new TH1F("chargedspectra2","Charged particles above 1 GeV Spectra",100,-1,3);
2693 TH1F *chargedspectra3 = new TH1F("chargedspectra2","Charged particles above 1 GeV Spectra",100,-1,3);
2694 TH1F *pionptspectrafinal = new TH1F("pionptspectrafinal","Primary Pions Transverse Momenta at HMPID",20,0,5);
2695 TH1F *pionptspectravertex = new TH1F("pionptspectravertex","Primary Pions Transverse Momenta at vertex",20,0,5);
2696 TH1F *kaonptspectrafinal = new TH1F("kaonptspectrafinal","Primary Kaons Transverse Momenta at HMPID",20,0,5);
2697 TH1F *kaonptspectravertex = new TH1F("kaonptspectravertex","Primary Kaons Transverse Momenta at vertex",20,0,5);
2698 //TH1F *hitsPhi = new TH1F("hitsPhi","Distribution of phi angle of incidence",100,-180,180);
2699 TH1F *hitsTheta = new TH1F("hitsTheta","Distribution of Theta angle of incidence, all tracks",100,0,50);
2700 TH1F *hitsTheta500MeV = new TH1F("hitsTheta500MeV","Distribution of Theta angle of incidence, 0.5-1 GeV primary tracks",100,0,50);
2701 TH1F *hitsTheta1GeV = new TH1F("hitsTheta1GeV","Distribution of Theta angle of incidence, 1-2 GeV primary tracks",100,0,50);
2702 TH1F *hitsTheta2GeV = new TH1F("hitsTheta2GeV","Distribution of Theta angle of incidence, 2-3 GeV primary tracks",100,0,50);
2703 TH1F *hitsTheta3GeV = new TH1F("hitsTheta3GeV","Distribution of Theta angle of incidence, >3 GeV primary tracks",100,0,50);
2704 TH2F *production = new TH2F("production","Mother production vertices",100,-300,300,100,0,600);
2709 // Start loop over events
2711 Int_t pion=0, kaon=0, proton=0, electron=0, positron=0, neutron=0, highneutrons=0, muon=0;
2712 Int_t chargedpions=0,primarypions=0,highprimarypions=0,chargedkaons=0,primarykaons=0,highprimarykaons=0;
2713 Int_t photons=0, primaryphotons=0, highprimaryphotons=0;
2716 for (int nev=0; nev<= evNumber2; nev++) {
2717 Int_t nparticles = gAlice->GetEvent(nev);
2720 printf ("Event number : %d\n",nev);
2721 printf ("Number of particles: %d\n",nparticles);
2722 if (nev < evNumber1) continue;
2723 if (nparticles <= 0) return;
2725 // Get pointers to RICH detector and Hits containers
2727 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
2729 TTree *treeH = gAlice->TreeH();
2730 Int_t ntracks =(Int_t) treeH->GetEntries();
2732 // Start loop on tracks in the hits containers
2734 for (Int_t track=0; track<ntracks;track++) {
2735 printf ("Processing Track: %d\n",track);
2736 gAlice->ResetHits();
2737 treeH->GetEvent(track);
2739 for(AliRICHHit* mHit=(AliRICHHit*)pRICH->FirstHit(-1);
2741 mHit=(AliRICHHit*)pRICH->NextHit())
2743 //Int_t nch = mHit->fChamber; // chamber number
2744 //Float_t x = mHit->X(); // x-pos of hit
2745 //Float_t y = mHit->Z(); // y-pos
2746 //Float_t z = mHit->Y();
2747 //Float_t phi = mHit->Phi(); //Phi angle of incidence
2748 Float_t theta = mHit->Theta(); //Theta angle of incidence
2749 Float_t px = mHit->MomX();
2750 Float_t py = mHit->MomY();
2751 Int_t index = mHit->Track();
2752 Int_t particle = (Int_t)(mHit->Particle());
2757 TParticle *current = gAlice->Particle(index);
2759 //Float_t energy=current->Energy();
2761 R=TMath::Sqrt(current->Vx()*current->Vx() + current->Vy()*current->Vy());
2762 PTfinal=TMath::Sqrt(px*px + py*py);
2763 PTvertex=TMath::Sqrt(current->Px()*current->Px() + current->Py()*current->Py());
2767 if (TMath::Abs(particle) < 10000000)
2769 hitsTheta->Fill(theta,(float) 1);
2772 if (PTvertex>.5 && PTvertex<=1)
2774 hitsTheta500MeV->Fill(theta,(float) 1);
2776 if (PTvertex>1 && PTvertex<=2)
2778 hitsTheta1GeV->Fill(theta,(float) 1);
2780 if (PTvertex>2 && PTvertex<=3)
2782 hitsTheta2GeV->Fill(theta,(float) 1);
2786 hitsTheta3GeV->Fill(theta,(float) 1);
2795 //printf("Particle type: %d\n",current->GetPdgCode());
2796 if (TMath::Abs(particle) < 50000051)
2798 //if (TMath::Abs(particle) == 50000050 || TMath::Abs(particle) == 2112)
2799 if (TMath::Abs(particle) == 2112 || TMath::Abs(particle) == 50000050)
2801 //gMC->Rndm(&random, 1);
2802 if (random->Rndm() < .1)
2803 production->Fill(current->Vz(),R,(float) 1);
2804 if (TMath::Abs(particle) == 50000050)
2805 //if (TMath::Abs(particle) > 50000000)
2811 if (current->Energy()>0.001)
2812 highprimaryphotons +=1;
2815 if (TMath::Abs(particle) == 2112)
2818 if (current->Energy()>0.0001)
2822 if (TMath::Abs(particle) < 50000000)
2824 production->Fill(current->Vz(),R,(float) 1);
2825 //printf("Adding %d at %f\n",particle,R);
2827 //mip->Fill(x,y,(float) 1);
2830 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
2834 pionptspectravertex->Fill(PTvertex,(float) 1);
2835 pionptspectrafinal->Fill(PTfinal,(float) 1);
2839 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
2840 || TMath::Abs(particle)==311)
2844 kaonptspectravertex->Fill(PTvertex,(float) 1);
2845 kaonptspectrafinal->Fill(PTfinal,(float) 1);
2850 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
2852 pionspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2853 //printf ("fParticle: %d, PDG code:%d\n",particle,current->GetPdgCode());
2854 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2855 pionspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2858 pionspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2859 //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);
2861 //printf("Pion mass: %e\n",current->GetCalcMass());
2863 if (TMath::Abs(particle)==211)
2869 if (current->Energy()>1)
2870 highprimarypions +=1;
2874 if (TMath::Abs(particle)==2212)
2876 protonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2877 //ptspectra->Fill(Pt,(float) 1);
2878 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2879 protonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2881 protonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2882 //printf("\n\n\n\n\n\n\nProton mass: %e\n\n\n\n\n\n\n\n\n",current->GetCalcMass());
2885 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
2886 || TMath::Abs(particle)==311)
2888 kaonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2889 //ptspectra->Fill(Pt,(float) 1);
2890 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2891 kaonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2893 kaonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2894 //printf("Kaon mass: %e\n",current->GetCalcMass());
2896 if (TMath::Abs(particle)==321)
2902 if (current->Energy()>1)
2903 highprimarykaons +=1;
2907 if (TMath::Abs(particle)==11)
2909 electronspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2910 //ptspectra->Fill(Pt,(float) 1);
2911 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2912 electronspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2914 electronspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2915 //printf("Electron mass: %e\n",current->GetCalcMass());
2918 if (particle == -11)
2921 if (TMath::Abs(particle)==13)
2923 muonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2924 //ptspectra->Fill(Pt,(float) 1);
2925 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2926 muonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2928 muonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2929 //printf("Muon mass: %e\n",current->GetCalcMass());
2932 if (TMath::Abs(particle)==2112)
2934 neutronspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2935 //ptspectra->Fill(Pt,(float) 1);
2936 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2937 neutronspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2940 neutronspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2941 //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);
2943 //printf("Neutron mass: %e\n",current->GetCalcMass());
2946 if(TMath::Abs(particle)==211 || TMath::Abs(particle)==2212 || TMath::Abs(particle)==321)
2948 if (current->Energy()-current->GetCalcMass()>1)
2950 chargedspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2951 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
2952 chargedspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2954 chargedspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
2957 //printf("Hits:%d\n",hit);
2958 //printf ("Chamber number:%d x:%f y:%f\n",nch,x,y);
2959 // Fill the histograms
2961 //h->Fill(x,y,(float) 1);
2971 //Create canvases, set the view range, show histograms
2973 TCanvas *c2 = new TCanvas("c2","Angles of incidence",150,150,100,150);
2975 //c2->SetFillColor(42);
2978 hitsTheta500MeV->SetFillColor(5);
2979 hitsTheta500MeV->Draw();
2981 hitsTheta1GeV->SetFillColor(5);
2982 hitsTheta1GeV->Draw();
2984 hitsTheta2GeV->SetFillColor(5);
2985 hitsTheta2GeV->Draw();
2987 hitsTheta3GeV->SetFillColor(5);
2988 hitsTheta3GeV->Draw();
2992 TCanvas *c15 = new TCanvas("c15","Mothers Production Vertices",50,50,600,600);
2994 production->SetFillColor(42);
2995 production->SetXTitle("z (m)");
2996 production->SetYTitle("R (m)");
2999 TCanvas *c10 = new TCanvas("c10","Pt Spectra",50,50,600,700);
3002 pionptspectravertex->SetFillColor(5);
3003 pionptspectravertex->SetXTitle("Pt (GeV)");
3004 pionptspectravertex->Draw();
3006 pionptspectrafinal->SetFillColor(5);
3007 pionptspectrafinal->SetXTitle("Pt (GeV)");
3008 pionptspectrafinal->Draw();
3010 kaonptspectravertex->SetFillColor(5);
3011 kaonptspectravertex->SetXTitle("Pt (GeV)");
3012 kaonptspectravertex->Draw();
3014 kaonptspectrafinal->SetFillColor(5);
3015 kaonptspectrafinal->SetXTitle("Pt (GeV)");
3016 kaonptspectrafinal->Draw();
3019 TCanvas *c16 = new TCanvas("c16","Particles Spectra II",150,150,600,350);
3023 //TCanvas *c13 = new TCanvas("c13","Electron Spectra",400,10,600,700);
3024 electronspectra1->SetFillColor(5);
3025 electronspectra1->SetXTitle("log(GeV)");
3026 electronspectra2->SetFillColor(46);
3027 electronspectra2->SetXTitle("log(GeV)");
3028 electronspectra3->SetFillColor(10);
3029 electronspectra3->SetXTitle("log(GeV)");
3031 electronspectra1->Draw();
3032 electronspectra2->Draw("same");
3033 electronspectra3->Draw("same");
3036 //TCanvas *c14 = new TCanvas("c14","Muon Spectra",400,10,600,700);
3037 muonspectra1->SetFillColor(5);
3038 muonspectra1->SetXTitle("log(GeV)");
3039 muonspectra2->SetFillColor(46);
3040 muonspectra2->SetXTitle("log(GeV)");
3041 muonspectra3->SetFillColor(10);
3042 muonspectra3->SetXTitle("log(GeV)");
3044 muonspectra1->Draw();
3045 muonspectra2->Draw("same");
3046 muonspectra3->Draw("same");
3049 //TCanvas *c16 = new TCanvas("c16","Neutron Spectra",400,10,600,700);
3050 //neutronspectra1->SetFillColor(42);
3051 //neutronspectra1->SetXTitle("log(GeV)");
3052 //neutronspectra2->SetFillColor(46);
3053 //neutronspectra2->SetXTitle("log(GeV)");
3054 //neutronspectra3->SetFillColor(10);
3055 //neutronspectra3->SetXTitle("log(GeV)");
3057 //neutronspectra1->Draw();
3058 //neutronspectra2->Draw("same");
3059 //neutronspectra3->Draw("same");
3061 TCanvas *c9 = new TCanvas("c9","Particles Spectra",150,150,600,700);
3062 //TCanvas *c9 = new TCanvas("c9","Pion Spectra",400,10,600,700);
3066 pionspectra1->SetFillColor(5);
3067 pionspectra1->SetXTitle("log(GeV)");
3068 pionspectra2->SetFillColor(46);
3069 pionspectra2->SetXTitle("log(GeV)");
3070 pionspectra3->SetFillColor(10);
3071 pionspectra3->SetXTitle("log(GeV)");
3073 pionspectra1->Draw();
3074 pionspectra2->Draw("same");
3075 pionspectra3->Draw("same");
3078 //TCanvas *c10 = new TCanvas("c10","Proton Spectra",400,10,600,700);
3079 protonspectra1->SetFillColor(5);
3080 protonspectra1->SetXTitle("log(GeV)");
3081 protonspectra2->SetFillColor(46);
3082 protonspectra2->SetXTitle("log(GeV)");
3083 protonspectra3->SetFillColor(10);
3084 protonspectra3->SetXTitle("log(GeV)");
3086 protonspectra1->Draw();
3087 protonspectra2->Draw("same");
3088 protonspectra3->Draw("same");
3091 //TCanvas *c11 = new TCanvas("c11","Kaon Spectra",400,10,600,700);
3092 kaonspectra1->SetFillColor(5);
3093 kaonspectra1->SetXTitle("log(GeV)");
3094 kaonspectra2->SetFillColor(46);
3095 kaonspectra2->SetXTitle("log(GeV)");
3096 kaonspectra3->SetFillColor(10);
3097 kaonspectra3->SetXTitle("log(GeV)");
3099 kaonspectra1->Draw();
3100 kaonspectra2->Draw("same");
3101 kaonspectra3->Draw("same");
3104 //TCanvas *c12 = new TCanvas("c12","Charged Particles Spectra",400,10,600,700);
3105 chargedspectra1->SetFillColor(5);
3106 chargedspectra1->SetXTitle("log(GeV)");
3107 chargedspectra2->SetFillColor(46);
3108 chargedspectra2->SetXTitle("log(GeV)");
3109 chargedspectra3->SetFillColor(10);
3110 chargedspectra3->SetXTitle("log(GeV)");
3112 chargedspectra1->Draw();
3113 chargedspectra2->Draw("same");
3114 chargedspectra3->Draw("same");
3118 printf("*****************************************\n");
3119 printf("* Particle * Counts *\n");
3120 printf("*****************************************\n");
3122 printf("* Pions: * %4d *\n",pion);
3123 printf("* Charged Pions: * %4d *\n",chargedpions);
3124 printf("* Primary Pions: * %4d *\n",primarypions);
3125 printf("* Primary Pions (p>1GeV/c): * %4d *\n",highprimarypions);
3126 printf("* Kaons: * %4d *\n",kaon);
3127 printf("* Charged Kaons: * %4d *\n",chargedkaons);
3128 printf("* Primary Kaons: * %4d *\n",primarykaons);
3129 printf("* Primary Kaons (p>1GeV/c): * %4d *\n",highprimarykaons);
3130 printf("* Muons: * %4d *\n",muon);
3131 printf("* Electrons: * %4d *\n",electron);
3132 printf("* Positrons: * %4d *\n",positron);
3133 printf("* Protons: * %4d *\n",proton);
3134 printf("* All Charged: * %4d *\n",(chargedpions+chargedkaons+muon+electron+positron+proton));
3135 printf("*****************************************\n");
3136 //printf("* Photons: * %3.1f *\n",photons);
3137 //printf("* Primary Photons: * %3.1f *\n",primaryphotons);
3138 //printf("* Primary Photons (p>1MeV/c):* %3.1f *\n",highprimaryphotons);
3139 //printf("*****************************************\n");
3140 //printf("* Neutrons: * %3.1f *\n",neutron);
3141 //printf("* Neutrons (p>100keV/c): * %3.1f *\n",highneutrons);
3142 //printf("*****************************************\n");
3144 if (gAlice->TreeD())
3146 gAlice->TreeD()->GetEvent(0);
3151 printf("\n*****************************************\n");
3152 printf("* Chamber * Digits * Occupancy *\n");
3153 printf("*****************************************\n");
3155 for (Int_t ich=0;ich<7;ich++)
3157 TClonesArray *Digits = DigitsAddress(ich); // Raw clusters branch
3158 Int_t ndigits = Digits->GetEntriesFast();
3159 occ[ich] = Float_t(ndigits)/(160*144);
3160 sum += Float_t(ndigits)/(160*144);
3161 printf("* %d * %d * %3.1f%% *\n",ich,ndigits,occ[ich]*100);
3164 printf("*****************************************\n");
3165 printf("* Mean occupancy * %3.1f%% *\n",mean*100);
3166 printf("*****************************************\n");
3169 printf("\nEnd of analysis\n");
3173 //_________________________________________________________________________________________________
3176 void AliRICH::DiagnosticsSE(Int_t diaglevel,Int_t evNumber1,Int_t evNumber2)
3179 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
3180 AliRICHSegmentationV0* segmentation;
3181 AliRICHChamber* chamber;
3183 chamber = &(pRICH->Chamber(0));
3184 segmentation=(AliRICHSegmentationV0*) chamber->GetSegmentationModel();
3186 Int_t NpadX = segmentation->Npx(); // number of pads on X
3187 Int_t NpadY = segmentation->Npy(); // number of pads on Y
3189 //Int_t Pad[144][160];
3190 /*for (Int_t i=0;i<NpadX;i++) {
3191 for (Int_t j=0;j<NpadY;j++) {
3197 Int_t xmin= -NpadX/2;
3198 Int_t xmax= NpadX/2;
3199 Int_t ymin= -NpadY/2;
3200 Int_t ymax= NpadY/2;
3209 TH2F *hc0 = new TH2F("hc0","Zoom on center of central chamber",150,-30,30,150,-50,10);
3213 printf("Single Ring Hits\n");
3214 feedback = new TH2F("feedback","Feedback hit distribution",150,-30,30,150,-50,10);
3215 mip = new TH2F("mip","Mip hit distribution",150,-30,30,150,-50,10);
3216 cerenkov = new TH2F("cerenkov","Cerenkov hit distribution",150,-30,30,150,-50,10);
3217 h = new TH2F("h","Detector hit distribution",150,-30,30,150,-50,10);
3218 hitsX = new TH1F("hitsX","Distribution of hits along x-axis",150,-30,30);
3219 hitsY = new TH1F("hitsY","Distribution of hits along z-axis",150,-50,10);
3223 printf("Full Event Hits\n");
3225 feedback = new TH2F("feedback","Feedback hit distribution",150,-300,300,150,-300,300);
3226 mip = new TH2F("mip","Mip hit distribution",150,-300,300,150,-300,300);
3227 cerenkov = new TH2F("cerenkov","Cerenkov hit distribution",150,-300,300,150,-300,300);
3228 h = new TH2F("h","Detector hit distribution",150,-300,300,150,-300,300);
3229 hitsX = new TH1F("digitsX","Distribution of hits along x-axis",200,-300,300);
3230 hitsY = new TH1F("digitsY","Distribution of hits along z-axis",200,-300,300);
3235 TH2F *hc1 = new TH2F("hc1","Chamber 1 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3236 TH2F *hc2 = new TH2F("hc2","Chamber 2 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3237 TH2F *hc3 = new TH2F("hc3","Chamber 3 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3238 TH2F *hc4 = new TH2F("hc4","Chamber 4 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3239 TH2F *hc5 = new TH2F("hc5","Chamber 5 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3240 TH2F *hc6 = new TH2F("hc6","Chamber 6 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3241 TH2F *hc7 = new TH2F("hc7","Chamber 7 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
3243 TH1F *Clcharge = new TH1F("Clcharge","Cluster Charge Distribution",500,0.,500.);
3244 TH1F *ckovangle = new TH1F("ckovangle","Cerenkov angle per photon",200,.3,1);
3245 TH1F *hckphi = new TH1F("hckphi","Cerenkov phi angle per photon",620,-3.1,3.1);
3246 TH1F *mother = new TH1F("mother","Cerenkovs per Mip",75,0.,75.);
3247 TH1F *radius = new TH1F("radius","Mean distance to Mip",100,0.,20.);
3248 TH1F *phspectra1 = new TH1F("phspectra1","Detected Photon Spectra",200,5.,10.);
3249 TH1F *phspectra2 = new TH1F("phspectra2","Produced Photon Spectra",200,5.,10.);
3250 TH1F *totalphotonstrack = new TH1F("totalphotonstrack","Produced Photons per Mip",100,200,700.);
3251 TH1F *totalphotonsevent = new TH1F("totalphotonsevent","Produced Photons per Mip",100,200,700.);
3252 //TH1F *feedbacks = new TH1F("feedbacks","Produced Feedbacks per Mip",50,0.5,50.);
3253 TH1F *padnumber = new TH1F("padnumber","Number of pads per cluster",50,-0.5,50.);
3254 TH1F *padsev = new TH1F("padsev","Number of pads hit per MIP",50,0.5,100.);
3255 TH1F *clusev = new TH1F("clusev","Number of clusters per MIP",50,0.5,50.);
3256 TH1F *photev = new TH1F("photev","Number of detected photons per MIP",50,0.5,50.);
3257 TH1F *feedev = new TH1F("feedev","Number of feedbacks per MIP",50,0.5,50.);
3258 TH1F *padsmip = new TH1F("padsmip","Number of pads per event inside MIP region",50,0.5,50.);
3259 TH1F *padscl = new TH1F("padscl","Number of pads per event from cluster count",50,0.5,100.);
3260 TH1F *pionspectra = new TH1F("pionspectra","Pion Spectra",200,.5,10.);
3261 TH1F *protonspectra = new TH1F("protonspectra","Proton Spectra",200,.5,10.);
3262 TH1F *kaonspectra = new TH1F("kaonspectra","Kaon Spectra",100,.5,10.);
3263 TH1F *chargedspectra = new TH1F("chargedspectra","Charged particles above 1 GeV Spectra",100,.5,10.);
3264 TH1F *hitsPhi = new TH1F("hitsPhi","Distribution of phi angle of incidence",100,0,360);
3265 TH1F *hitsTheta = new TH1F("hitsTheta","Distribution of Theta angle of incidence",100,0,15);
3266 TH1F *Omega1D = new TH1F("omega","Reconstructed Cerenkov angle per track",200,.5,1);
3267 TH1F *Theta = new TH1F("theta","Reconstructed theta incidence angle per track",200,0,15);
3268 TH1F *Phi = new TH1F("phi","Reconstructed phi incidence per track",200,0,360);
3269 TH1F *Omega3D = new TH1F("omega","Reconstructed Cerenkov angle per track",200,.3,1);
3270 TH1F *PhotonCer = new TH1F("photoncer","Reconstructed Cerenkov angle per photon",200,.3,1);
3271 TH2F *PadsUsed = new TH2F("padsused","Pads Used for Reconstruction",100,-30,30,100,-30,30);
3272 TH1F *MeanRadius = new TH1F("radius","Mean Radius for reconstructed track",100,0.,20.);
3274 // Start loop over events
3279 Int_t mothers[80000];
3280 Int_t mothers2[80000];
3288 for (Int_t i=0;i<100;i++) mothers[i]=0;
3290 for (int nev=0; nev<= evNumber2; nev++) {
3291 Int_t nparticles = gAlice->GetEvent(nev);
3294 //cout<<"nev "<<nev<<endl;
3295 printf ("\n**********************************\nProcessing Event: %d\n",nev);
3296 //cout<<"nparticles "<<nparticles<<endl;
3297 printf ("Particles : %d\n\n",nparticles);
3298 if (nev < evNumber1) continue;
3299 if (nparticles <= 0) return;
3301 // Get pointers to RICH detector and Hits containers
3304 TTree *TH = gAlice->TreeH();
3305 Stat_t ntracks = TH->GetEntries();
3307 // Start loop on tracks in the hits containers
3309 for (Int_t track=0; track<ntracks;track++) {
3311 printf ("\nProcessing Track: %d\n",track);
3312 gAlice->ResetHits();
3313 TH->GetEvent(track);
3314 Int_t nhits = pRICH->Hits()->GetEntriesFast();
3315 if (nhits) Nh+=nhits;
3316 printf("Hits : %d\n",nhits);
3317 for(AliRICHHit* mHit=(AliRICHHit*)pRICH->FirstHit(-1);
3319 mHit=(AliRICHHit*)pRICH->NextHit())
3321 //Int_t nch = mHit->fChamber; // chamber number
3322 x = mHit->X(); // x-pos of hit
3323 y = mHit->Z(); // y-pos
3324 Float_t phi = mHit->Phi(); //Phi angle of incidence
3325 Float_t theta = mHit->Theta(); //Theta angle of incidence
3326 Int_t index = mHit->Track();
3327 Int_t particle = (Int_t)(mHit->Particle());
3328 //Int_t freon = (Int_t)(mHit->fLoss);
3330 hitsX->Fill(x,(float) 1);
3331 hitsY->Fill(y,(float) 1);
3333 //printf("Particle:%9d\n",particle);
3335 TParticle *current = (TParticle*)gAlice->Particle(index);
3336 //printf("Particle type: %d\n",sizeoff(Particles));
3338 hitsTheta->Fill(theta,(float) 1);
3339 //hitsPhi->Fill(phi,(float) 1);
3340 //if (pRICH->GetDebugLevel() == -1)
3341 //printf("Theta:%f, Phi:%f\n",theta,phi);
3343 //printf("Debug Level:%d\n",pRICH->GetDebugLevel());
3345 if (current->GetPdgCode() < 10000000)
3347 mip->Fill(x,y,(float) 1);
3348 //printf("adding mip\n");
3349 //if (current->Energy() - current->GetCalcMass()>1 && freon==1)
3351 hitsPhi->Fill(TMath::Abs(phi),(float) 1);
3352 //hitsTheta->Fill(theta,(float) 1);
3353 //printf("Theta:%f, Phi:%f\n",theta,phi);
3357 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
3359 pionspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
3361 if (TMath::Abs(particle)==2212)
3363 protonspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
3365 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
3366 || TMath::Abs(particle)==311)
3368 kaonspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
3370 if(TMath::Abs(particle)==211 || TMath::Abs(particle)==2212 || TMath::Abs(particle)==321)
3372 if (current->Energy() - current->GetCalcMass()>1)
3373 chargedspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
3375 //printf("Hits:%d\n",hit);
3376 //printf ("Chamber number:%d x:%f y:%f\n",nch,x,y);
3377 // Fill the histograms
3379 h->Fill(x,y,(float) 1);
3384 Int_t ncerenkovs = pRICH->Cerenkovs()->GetEntriesFast();
3385 //if (current->GetPdgCode() < 50000051 && current->GetPdgCode() > 50000040)
3386 //totalphotonsevent->Fill(ncerenkovs,(float) 1);
3389 printf("Cerenkovs : %d\n",ncerenkovs);
3390 totalphotonsevent->Fill(ncerenkovs,(float) 1);
3391 for (Int_t hit=0;hit<ncerenkovs;hit++) {
3392 AliRICHCerenkov* cHit = (AliRICHCerenkov*) pRICH->Cerenkovs()->UncheckedAt(hit);
3393 //Int_t nchamber = cHit->fChamber; // chamber number
3394 Int_t index = cHit->Track();
3395 //Int_t pindex = (Int_t)(cHit->fIndex);
3396 Float_t cx = cHit->X(); // x-position
3397 Float_t cy = cHit->Z(); // y-position
3398 Int_t cmother = cHit->fCMother; // Index of mother particle
3399 Int_t closs = (Int_t)(cHit->fLoss); // How did the particle get lost?
3400 Float_t cherenkov = cHit->fCerenkovAngle; //production cerenkov angle
3401 //printf ("Cerenkov hit number %d/%d, X:%d, Y:%d\n",hit,ncerenkovs,cx,cy);
3403 //printf("Particle:%9d\n",index);
3405 TParticle *current = (TParticle*)gAlice->Particle(index);
3406 Float_t energyckov = current->Energy();
3408 if (current->GetPdgCode() == 50000051)
3412 feedback->Fill(cx,cy,(float) 1);
3416 if (current->GetPdgCode() == 50000050)
3421 phspectra2->Fill(energyckov*1e9,(float) 1);
3426 cerenkov->Fill(cx,cy,(float) 1);
3428 //printf ("Cerenkov hit number %d/%d, X:%d, Y:%d\n",hit,ncerenkovs,cx,cy);
3430 //TParticle *MIP = (TParticle*)gAlice->Particle(cmother);
3431 AliRICHHit* mipHit = (AliRICHHit*) pRICH->Hits()->UncheckedAt(0);
3432 mom[0] = current->Px();
3433 mom[1] = current->Py();
3434 mom[2] = current->Pz();
3435 //mom[0] = cHit->fMomX;
3436 // mom[1] = cHit->fMomZ;
3437 //mom[2] = cHit->fMomY;
3438 //Float_t energymip = MIP->Energy();
3439 //Float_t Mip_px = mipHit->fMomFreoX;
3440 //Float_t Mip_py = mipHit->fMomFreoY;
3441 //Float_t Mip_pz = mipHit->fMomFreoZ;
3442 //Float_t Mip_px = MIP->Px();
3443 //Float_t Mip_py = MIP->Py();
3444 //Float_t Mip_pz = MIP->Pz();
3448 //Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
3449 //Float_t rt = TMath::Sqrt(r);
3450 //Float_t Mip_r = Mip_px*Mip_px + Mip_py*Mip_py + Mip_pz*Mip_pz;
3451 //Float_t Mip_rt = TMath::Sqrt(Mip_r);
3452 //Float_t coscerenkov = (mom[0]*Mip_px + mom[1]*Mip_py + mom[2]*Mip_pz)/(rt*Mip_rt+0.0000001);
3453 //Float_t cherenkov = TMath::ACos(coscerenkov);
3454 ckovangle->Fill(cherenkov,(float) 1); //Cerenkov angle calculus
3455 //printf("Cherenkov: %f\n",cherenkov);
3456 Float_t ckphi=TMath::ATan2(mom[0], mom[2]);
3457 hckphi->Fill(ckphi,(float) 1);
3460 //Float_t mix = MIP->Vx();
3461 //Float_t miy = MIP->Vy();
3462 Float_t mx = mipHit->X();
3463 Float_t my = mipHit->Z();
3464 //printf("FX %e, FY %e, VX %e, VY %e\n",cx,cy,mx,my);
3465 Float_t dx = cx - mx;
3466 Float_t dy = cy - my;
3467 //printf("Dx:%f, Dy:%f\n",dx,dy);
3468 Float_t final_radius = TMath::Sqrt(dx*dx+dy*dy);
3469 //printf("Final radius:%f\n",final_radius);
3470 radius->Fill(final_radius,(float) 1);
3472 phspectra1->Fill(energyckov*1e9,(float) 1);
3475 for (Int_t nmothers=0;nmothers<=ntracks;nmothers++){
3476 if (cmother == nmothers){
3478 mothers2[cmother]++;
3489 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
3490 gAlice->TreeR()->GetEvent(nent-1);
3491 TClonesArray *Rawclusters = pRICH->RawClustAddress(2); // Raw clusters branch
3492 //printf ("Rawclusters:%p",Rawclusters);
3493 Int_t nrawclusters = Rawclusters->GetEntriesFast();
3496 printf("Raw Clusters : %d\n",nrawclusters);
3497 for (Int_t hit=0;hit<nrawclusters;hit++) {
3498 AliRICHRawCluster* rcHit = (AliRICHRawCluster*) pRICH->RawClustAddress(2)->UncheckedAt(hit);
3499 //Int_t nchamber = rcHit->fChamber; // chamber number
3500 //Int_t nhit = cHit->fHitNumber; // hit number
3501 Int_t qtot = rcHit->fQ; // charge
3502 Float_t fx = rcHit->fX; // x-position
3503 Float_t fy = rcHit->fY; // y-position
3504 //Int_t type = rcHit->fCtype; // cluster type ?
3505 Int_t mult = rcHit->fMultiplicity; // How many pads form the cluster
3508 //printf ("fx: %d, fy: %d\n",fx,fy);
3509 if (fx>(x-4) && fx<(x+4) && fy>(y-4) && fy<(y+4)) {
3510 //printf("There %d \n",mult);
3513 padnumber->Fill(mult,(float) 1);
3515 if (mult<4) Clcharge->Fill(qtot,(float) 1);
3523 TClonesArray *RecHits1D = pRICH->RecHitsAddress1D(2);
3524 Int_t nrechits1D = RecHits1D->GetEntriesFast();
3525 //printf (" nrechits:%d\n",nrechits);
3529 for (Int_t hit=0;hit<nrechits1D;hit++) {
3530 AliRICHRecHit1D* recHit1D = (AliRICHRecHit1D*) pRICH->RecHitsAddress1D(2)->UncheckedAt(hit);
3531 Float_t r_omega = recHit1D->fOmega; // Cerenkov angle
3532 Float_t *cer_pho = recHit1D->fCerPerPhoton; // Cerenkov angle per photon
3533 Int_t *padsx = recHit1D->fPadsUsedX; // Pads Used fo reconstruction (x)
3534 Int_t *padsy = recHit1D->fPadsUsedY; // Pads Used fo reconstruction (y)
3535 Int_t goodPhotons = recHit1D->fGoodPhotons; // Number of pads used for reconstruction
3537 Omega1D->Fill(r_omega,(float) 1);
3539 for (Int_t i=0; i<goodPhotons; i++)
3541 PhotonCer->Fill(cer_pho[i],(float) 1);
3542 PadsUsed->Fill(padsx[i],padsy[i],1);
3543 //printf("Angle:%f, pad: %d %d\n",cer_pho[i],padsx[i],padsy[i]);
3546 //printf("Omega: %f, Theta: %f, Phi: %f\n",r_omega,r_theta,r_phi);
3551 TClonesArray *RecHits3D = pRICH->RecHitsAddress3D(2);
3552 Int_t nrechits3D = RecHits3D->GetEntriesFast();
3553 //printf (" nrechits:%d\n",nrechits);
3557 for (Int_t hit=0;hit<nrechits3D;hit++) {
3558 AliRICHRecHit3D* recHit3D = (AliRICHRecHit3D*) pRICH->RecHitsAddress3D(2)->UncheckedAt(hit);
3559 Float_t r_omega = recHit3D->fOmega; // Cerenkov angle
3560 Float_t r_theta = recHit3D->fTheta; // Theta angle of incidence
3561 Float_t r_phi = recHit3D->fPhi; // Phi angle if incidence
3562 Float_t meanradius = recHit3D->fMeanRadius; // Mean radius for reconstructed point
3564 //printf("rechit %f %f %f %f %f\n",recHit3D->fOmega,recHit3D->fTheta,recHit3D->fPhi, recHit3D->fX,recHit3D->fY);
3566 Omega3D->Fill(r_omega,(float) 1);
3567 Theta->Fill(r_theta*180/TMath::Pi(),(float) 1);
3568 Phi->Fill(r_phi*180/TMath::Pi()-180,(float) 1);
3569 MeanRadius->Fill(meanradius,(float) 1);
3575 for (Int_t nmothers=0;nmothers<ntracks;nmothers++){
3576 totalphotonstrack->Fill(mothers[nmothers],(float) 1);
3577 mother->Fill(mothers2[nmothers],(float) 1);
3578 //printf ("Entries in %d : %d\n",nmothers, mothers[nmothers]);
3581 clusev->Fill(nraw,(float) 1);
3582 photev->Fill(phot,(float) 1);
3583 feedev->Fill(feed,(float) 1);
3584 padsmip->Fill(padmip,(float) 1);
3585 padscl->Fill(pads,(float) 1);
3586 //printf("Photons:%d\n",phot);
3595 gAlice->ResetDigits();
3596 //Int_t nent=(Int_t)gAlice->TreeD()->GetEntries();
3597 gAlice->TreeD()->GetEvent(0);
3603 TClonesArray *Digits = pRICH->DigitsAddress(2);
3604 Int_t ndigits = Digits->GetEntriesFast();
3605 printf("Digits : %d\n",ndigits);
3606 padsev->Fill(ndigits,(float) 1);
3607 for (Int_t hit=0;hit<ndigits;hit++) {
3608 AliRICHDigit* dHit = (AliRICHDigit*) Digits->UncheckedAt(hit);
3609 Int_t qtot = dHit->Signal(); // charge
3610 Int_t ipx = dHit->PadX(); // pad number on X
3611 Int_t ipy = dHit->PadY(); // pad number on Y
3612 //printf("%d, %d\n",ipx,ipy);
3613 if( ipx<=100 && ipy <=100) hc0->Fill(ipx,ipy,(float) qtot);
3619 for (Int_t ich=0;ich<7;ich++)
3621 TClonesArray *Digits = pRICH->DigitsAddress(ich); // Raw clusters branch
3622 Int_t ndigits = Digits->GetEntriesFast();
3623 //printf("Digits:%d\n",ndigits);
3624 padsev->Fill(ndigits,(float) 1);
3626 for (Int_t hit=0;hit<ndigits;hit++) {
3627 AliRICHDigit* dHit = (AliRICHDigit*) Digits->UncheckedAt(hit);
3628 //Int_t nchamber = dHit->GetChamber(); // chamber number
3629 //Int_t nhit = dHit->fHitNumber; // hit number
3630 Int_t qtot = dHit->Signal(); // charge
3631 Int_t ipx = dHit->PadX(); // pad number on X
3632 Int_t ipy = dHit->PadY(); // pad number on Y
3633 //Int_t iqpad = dHit->fQpad; // charge per pad
3634 //Int_t rpad = dHit->fRSec; // R-position of pad
3635 //printf ("Pad hit, PadX:%d, PadY:%d\n",ipx,ipy);
3636 if( ipx<=100 && ipy <=100 && ich==2) hc0->Fill(ipx,ipy,(float) qtot);
3637 if( ipx<=162 && ipy <=162 && ich==0) hc1->Fill(ipx,ipy,(float) qtot);
3638 if( ipx<=162 && ipy <=162 && ich==1) hc2->Fill(ipx,ipy,(float) qtot);
3639 if( ipx<=162 && ipy <=162 && ich==2) hc3->Fill(ipx,ipy,(float) qtot);
3640 if( ipx<=162 && ipy <=162 && ich==3) hc4->Fill(ipx,ipy,(float) qtot);
3641 if( ipx<=162 && ipy <=162 && ich==4) hc5->Fill(ipx,ipy,(float) qtot);
3642 if( ipx<=162 && ipy <=162 && ich==5) hc6->Fill(ipx,ipy,(float) qtot);
3643 if( ipx<=162 && ipy <=162 && ich==6) hc7->Fill(ipx,ipy,(float) qtot);
3651 //Create canvases, set the view range, show histograms
3669 TClonesArray *RecHits3D = pRICH->RecHitsAddress3D(2);
3670 Int_t nrechits3D = RecHits3D->GetEntriesFast();
3671 TClonesArray *RecHits1D = pRICH->RecHitsAddress1D(2);
3672 Int_t nrechits1D = RecHits1D->GetEntriesFast();
3678 c1 = new TCanvas("c1","Alice RICH digits",50,50,300,350);
3679 hc0->SetXTitle("ix (npads)");
3683 c2 = new TCanvas("c2","Hits per type",100,100,600,700);
3685 //c4->SetFillColor(42);
3688 feedback->SetXTitle("x (cm)");
3689 feedback->SetYTitle("y (cm)");
3693 //mip->SetFillColor(5);
3694 mip->SetXTitle("x (cm)");
3695 mip->SetYTitle("y (cm)");
3699 //cerenkov->SetFillColor(5);
3700 cerenkov->SetXTitle("x (cm)");
3701 cerenkov->SetYTitle("y (cm)");
3705 //h->SetFillColor(5);
3706 h->SetXTitle("x (cm)");
3707 h->SetYTitle("y (cm)");
3710 c3 = new TCanvas("c3","Hits distribution",150,150,600,350);
3712 //c10->SetFillColor(42);
3715 hitsX->SetFillColor(5);
3716 hitsX->SetXTitle("(cm)");
3720 hitsY->SetFillColor(5);
3721 hitsY->SetXTitle("(cm)");
3729 c4 = new TCanvas("c4","Photon Spectra",50,50,600,350);
3731 //c6->SetFillColor(42);
3734 phspectra2->SetFillColor(5);
3735 phspectra2->SetXTitle("energy (eV)");
3738 phspectra1->SetFillColor(5);
3739 phspectra1->SetXTitle("energy (eV)");
3742 c5 = new TCanvas("c5","Particles Spectra",100,100,600,700);
3744 //c9->SetFillColor(42);
3747 pionspectra->SetFillColor(5);
3748 pionspectra->SetXTitle("(GeV)");
3749 pionspectra->Draw();
3752 protonspectra->SetFillColor(5);
3753 protonspectra->SetXTitle("(GeV)");
3754 protonspectra->Draw();
3757 kaonspectra->SetFillColor(5);
3758 kaonspectra->SetXTitle("(GeV)");
3759 kaonspectra->Draw();
3762 chargedspectra->SetFillColor(5);
3763 chargedspectra->SetXTitle("(GeV)");
3764 chargedspectra->Draw();
3773 c6=new TCanvas("c6","Clusters Statistics",50,50,600,700);
3775 //c3->SetFillColor(42);
3780 Clcharge->SetFillColor(5);
3781 Clcharge->SetXTitle("ADC counts");
3784 Clcharge->Fit("expo");
3785 //expo->SetLineColor(2);
3786 //expo->SetLineWidth(3);
3791 padnumber->SetFillColor(5);
3792 padnumber->SetXTitle("(counts)");
3796 clusev->SetFillColor(5);
3797 clusev->SetXTitle("(counts)");
3800 clusev->Fit("gaus");
3801 //gaus->SetLineColor(2);
3802 //gaus->SetLineWidth(3);
3807 padsmip->SetFillColor(5);
3808 padsmip->SetXTitle("(counts)");
3814 c11 = new TCanvas("c11","Cherenkov per Mip",400,10,600,700);
3815 mother->SetFillColor(5);
3816 mother->SetXTitle("counts");
3820 c7 = new TCanvas("c7","Production Statistics",100,100,600,700);
3822 //c7->SetFillColor(42);
3825 totalphotonsevent->SetFillColor(5);
3826 totalphotonsevent->SetXTitle("Photons (counts)");
3829 totalphotonsevent->Fit("gaus");
3830 //gaus->SetLineColor(2);
3831 //gaus->SetLineWidth(3);
3833 totalphotonsevent->Draw();
3836 photev->SetFillColor(5);
3837 photev->SetXTitle("(counts)");
3840 photev->Fit("gaus");
3841 //gaus->SetLineColor(2);
3842 //gaus->SetLineWidth(3);
3847 feedev->SetFillColor(5);
3848 feedev->SetXTitle("(counts)");
3851 feedev->Fit("gaus");
3852 //gaus->SetLineColor(2);
3853 //gaus->SetLineWidth(3);
3858 padsev->SetFillColor(5);
3859 padsev->SetXTitle("(counts)");
3862 padsev->Fit("gaus");
3863 //gaus->SetLineColor(2);
3864 //gaus->SetLineWidth(3);
3875 c8 = new TCanvas("c8","3D reconstruction",50,50,1100,700);
3877 //c2->SetFillColor(42);
3880 hitsPhi->SetFillColor(5);
3883 hitsTheta->SetFillColor(5);
3886 ckovangle->SetFillColor(5);
3887 ckovangle->SetXTitle("angle (radians)");
3890 radius->SetFillColor(5);
3891 radius->SetXTitle("radius (cm)");
3894 Phi->SetFillColor(5);
3897 Theta->SetFillColor(5);
3900 Omega3D->SetFillColor(5);
3901 Omega3D->SetXTitle("angle (radians)");
3904 MeanRadius->SetFillColor(5);
3905 MeanRadius->SetXTitle("radius (cm)");
3912 c9 = new TCanvas("c9","1D Reconstruction",100,100,1100,700);
3914 //c5->SetFillColor(42);
3917 ckovangle->SetFillColor(5);
3918 ckovangle->SetXTitle("angle (radians)");
3922 radius->SetFillColor(5);
3923 radius->SetXTitle("radius (cm)");
3927 hc0->SetXTitle("pads");
3931 Omega1D->SetFillColor(5);
3932 Omega1D->SetXTitle("angle (radians)");
3936 PhotonCer->SetFillColor(5);
3937 PhotonCer->SetXTitle("angle (radians)");
3941 PadsUsed->SetXTitle("pads");
3942 PadsUsed->Draw("box");
3949 printf("Drawing histograms.../n");
3953 c10 = new TCanvas("c10","Alice RICH digits",50,50,1200,700);
3955 //c1->SetFillColor(42);
3958 hc1->SetXTitle("ix (npads)");
3961 hc2->SetXTitle("ix (npads)");
3964 hc3->SetXTitle("ix (npads)");
3967 hc4->SetXTitle("ix (npads)");
3970 hc5->SetXTitle("ix (npads)");
3973 hc6->SetXTitle("ix (npads)");
3976 hc7->SetXTitle("ix (npads)");
3979 hc0->SetXTitle("ix (npads)");
3983 c11 = new TCanvas("c11","Hits per type",100,100,600,700);
3985 //c4->SetFillColor(42);
3988 feedback->SetXTitle("x (cm)");
3989 feedback->SetYTitle("y (cm)");
3993 //mip->SetFillColor(5);
3994 mip->SetXTitle("x (cm)");
3995 mip->SetYTitle("y (cm)");
3999 //cerenkov->SetFillColor(5);
4000 cerenkov->SetXTitle("x (cm)");
4001 cerenkov->SetYTitle("y (cm)");
4005 //h->SetFillColor(5);
4006 h->SetXTitle("x (cm)");
4007 h->SetYTitle("y (cm)");
4010 c12 = new TCanvas("c12","Hits distribution",150,150,600,350);
4012 //c10->SetFillColor(42);
4015 hitsX->SetFillColor(5);
4016 hitsX->SetXTitle("(cm)");
4020 hitsY->SetFillColor(5);
4021 hitsY->SetXTitle("(cm)");
4029 // calculate the number of pads which give a signal
4033 /*for (Int_t i=0;i< NpadX;i++) {
4034 for (Int_t j=0;j< NpadY;j++) {
4040 //printf("The total number of pads which give a signal: %d %d\n",Nh,Nh1);
4041 printf("\nEnd of analysis\n");
4042 printf("**********************************\n");
4045 ////////////////////////////////////////////////////////////////////////
4046 void AliRICH::MakeBranchInTreeD(TTree *treeD, const char *file)
4049 // Create TreeD branches for the RICH.
4052 const Int_t kBufferSize = 4000;
4053 char branchname[30];
4056 // one branch for digits per chamber
4058 for (Int_t i=0; i<kNCH ;i++) {
4059 sprintf(branchname,"%sDigits%d",GetName(),i+1);
4060 if (fDchambers && treeD) {
4061 MakeBranchInTree(treeD,
4062 branchname, &((*fDchambers)[i]), kBufferSize, file);
4063 // printf("Making Branch %s for digits in chamber %d\n",branchname,i+1);
4067 ////////////////////////////////////////////////////////////////////////