1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 //_________________________________________________________________________
19 // Implementation version v1 of EMCAL Manager class
20 // An object of this class does not produce digits
21 // It is the one to use if you do want to produce outputs in TREEH
23 //*-- Author: Sahal Yacoob (LBL /UCT)
24 //*-- : Jennifer Klay (LBL)
26 // This Class not stores information on all particles prior to EMCAL entry - in order to facilitate analysis.
27 // This is done by setting fIShunt =2, and flagging all parents of particles entering the EMCAL.
29 // 15/02/2002 .... Yves Schutz
30 // 1. fSamplingFraction and fLayerToPreshowerRatio have been removed
31 // 2. Timing signal is collected and added to hit
33 // --- ROOT system ---
39 #include "TGeometry.h"
40 #include "TParticle.h"
42 // --- Standard library ---
47 #include <strstream.h>
50 // --- AliRoot header files ---
52 #include "AliEMCALv1.h"
53 #include "AliEMCALHit.h"
54 #include "AliEMCALGeometry.h"
62 //______________________________________________________________________
63 AliEMCALv1::AliEMCALv1():AliEMCALv0(){
66 fIntrinsicAPDEfficiency = fLightFactor = fLightYieldAttenuation = fAPDFactor = fAPDGain = fRecalibrationFactor = fAPDFactor = 0. ;
69 //______________________________________________________________________
70 AliEMCALv1::AliEMCALv1(const char *name, const char *title):
71 AliEMCALv0(name,title){
74 fHits= new TClonesArray("AliEMCALHit",1000);
75 gAlice->AddHitList(fHits);
78 fIshunt = 2; // All hits are associated with particles entering the calorimeter
80 //Photoelectron statistics:
81 // The light yield is a poissonian distribution of the number of
82 // photons created in a plastic layer, calculated using following formula
83 // NumberOfPhotons = EnergyLost * LightYieldMean* APDEfficiency *
84 // exp (-LightYieldAttenuation * DistanceToPINdiodeFromTheHit)
85 // LightYieldMean is parameter calculated to be over 100000 photons per GeV (a guess)
86 // APDEfficiency is 0.02655
87 // fLightYieldAttenuation is 0.0045 a guess
89 //***** Need a method in geometry to retrieve the fiber length corresponding to each layer
90 //***** See the step manager for the light attenuation calculation
91 // The number of electrons created in the APD is
92 // NumberOfElectrons = APDGain * LightYield
93 // The APD Gain is 300
95 fLightYieldMean = 10000000.; // This is a guess
96 fIntrinsicAPDEfficiency = 0.02655 ;
97 fLightFactor = fLightYieldMean * fIntrinsicAPDEfficiency ;
98 fLightYieldAttenuation = 0.0045 ; // an other guess
100 fRecalibrationFactor = 13.418/ fLightYieldMean ;
101 fAPDFactor = (fRecalibrationFactor/100.) * fAPDGain ;
105 //______________________________________________________________________
106 AliEMCALv1::~AliEMCALv1(){
115 //______________________________________________________________________
116 void AliEMCALv1::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t iparent, Float_t ienergy,
117 Int_t id, Float_t * hits,Float_t * p){
118 // Add a hit to the hit list.
119 // An EMCAL hit is the sum of all hits in a single segment
120 // originating from the same enterring particle
125 Bool_t deja = kFALSE;
127 newHit = new AliEMCALHit(shunt, primary, tracknumber, iparent, ienergy, id, hits, p);
128 for ( hitCounter = fNhits-1; hitCounter >= 0 && !deja; hitCounter-- ) {
129 curHit = (AliEMCALHit*) (*fHits)[hitCounter];
130 // We add hits with the same tracknumber, while GEANT treats
131 // primaries succesively
132 if(curHit->GetPrimary() != primary) break;
133 if( *curHit == *newHit ) {
134 *curHit = *curHit + *newHit;
137 } // end for hitCounter
140 new((*fHits)[fNhits]) AliEMCALHit(*newHit);
146 //______________________________________________________________________
147 void AliEMCALv1::StepManager(void){
148 // Accumulates hits as long as the track stays in a single
149 // crystal or PPSD gas Cell
151 Int_t id[2]; // (layer, phi, Eta) indices
153 // position wrt MRS and energy deposited
154 Float_t xyzte[5]={0.,0.,0.,0.,0.};// position wrt MRS, time and energy deposited
155 Float_t pmom[4]={0.,0.,0.,0.};
156 TLorentzVector pos; // Lorentz vector of the track current position.
157 TLorentzVector mom; // Lorentz vector of the track current momentum.
158 Int_t tracknumber = gAlice->CurrentTrack();
160 static Int_t iparent = 0;
161 static Float_t ienergy = 0;
164 if(gMC->IsTrackEntering() && (strcmp(gMC->CurrentVolName(),"XALU") == 0)){ // This Particle in enterring the Calorimeter
165 gMC->TrackPosition(pos) ;
169 if ( (xyzte[0]*xyzte[0] + xyzte[1]*xyzte[1])
170 < (fGeom->GetEnvelop(0)+fGeom->GetGap2Active()+1.5 )*(fGeom->GetEnvelop(0)+fGeom->GetGap2Active()+1.5 ) ) {
171 iparent = tracknumber;
172 gMC->TrackMomentum(mom);
174 TParticle * part = 0 ;
175 Int_t parent = iparent ;
176 while ( parent != -1 ) { // <------------- flags this particle to be kept and
177 //all the ancestors of this particle
178 part = gAlice->Particle(parent) ;
179 part->SetBit(kKeepBit);
180 parent = part->GetFirstMother() ;
184 if(gMC->CurrentVolID(copy) == gMC->VolId("XPHI") ) { // We are in a Scintillator Layer
186 Float_t depositedEnergy ;
188 if( (depositedEnergy = gMC->Edep()) > 0.){// Track is inside a scintillator and deposits some energy
190 gMC->TrackPosition(pos);
194 xyzte[3] = gMC->TrackTime() ;
196 gMC->TrackMomentum(mom);
202 gMC->CurrentVolOffID(1, id[0]); // get the POLY copy number;
203 gMC->CurrentVolID(id[1]); // get the phi number inside the layer
204 absid = (id[0]-1)*(fGeom->GetNPhi()) + id[1];
206 //Calculates the light yield, the number of photons produced in the
208 // Here we need to know the fiber lebgth to calculate the attenuation
210 Float_t lengthOfFiber = 0. ;// should be retrieved from the geometry
212 Float_t lightYield = gRandom->Poisson(fLightFactor * depositedEnergy *
213 exp(-fLightYieldAttenuation * lengthOfFiber)) ;
214 xyzte[4] = fAPDFactor * lightYield ;
216 primary = gAlice->GetPrimary(tracknumber);
217 AddHit(fIshunt, primary,tracknumber, iparent, ienergy, absid, xyzte, pmom);
218 } // there is deposited energy