1 /**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
7 * Author: The ALICE Off-line Project. *
9 * Contributors are mentioned in the code where appropriate. *
13 * Permission to use, copy, modify and distribute this software and its *
15 * documentation strictly for non-commercial purposes is hereby granted *
17 * without fee, provided that the above copyright notice appears in all *
19 * copies and that both the copyright notice and this permission notice *
21 * appear in the supporting documentation. The authors make no claims *
23 * about the suitability of this software for any purpose. It is *
25 * provided "as is" without express or implied warranty. *
27 **************************************************************************/
35 //_________________________________________________________________________
37 // Implementation version v1 of EMCAL Manager class
39 // An object of this class does not produce digits
41 // It is the one to use if you do want to produce outputs in TREEH
45 //*-- Author: Sahal Yacoob (LBL /UCT)
47 //*-- : Jennifer Klay (LBL)
51 // This Class not stores information on all particles prior to EMCAL entry - in order to facilitate analysis.
53 // This is done by setting fIShunt =2, and flagging all parents of particles entering the EMCAL.
57 // 15/02/2002 .... Yves Schutz
59 // 1. fSamplingFraction and fLayerToPreshowerRatio have been removed
61 // 2. Timing signal is collected and added to hit
65 // --- ROOT system ---
77 #include "TGeometry.h"
79 #include "TParticle.h"
83 // --- Standard library ---
93 #include <strstream.h>
99 // --- AliRoot header files ---
103 #include "AliEMCALv1.h"
105 #include "AliEMCALHit.h"
107 #include "AliEMCALGeometry.h"
109 #include "AliConst.h"
123 //______________________________________________________________________
125 AliEMCALv1::AliEMCALv1():AliEMCALv0(){
129 fLightYieldMean = 0 ;
131 fIntrinsicAPDEfficiency = fLightFactor = fLightYieldAttenuation = fAPDFactor = fAPDGain = fRecalibrationFactor = fAPDFactor = 0. ;
137 //______________________________________________________________________
139 AliEMCALv1::AliEMCALv1(const char *name, const char *title):
141 AliEMCALv0(name,title){
147 fHits= new TClonesArray("AliEMCALHit",1000);
149 gAlice->AddHitList(fHits);
155 fIshunt = 2; // All hits are associated with particles entering the calorimeter
159 //Photoelectron statistics:
161 // The light yield is a poissonian distribution of the number of
163 // photons created in a plastic layer, calculated using following formula
165 // NumberOfPhotons = EnergyLost * LightYieldMean* APDEfficiency *
167 // exp (-LightYieldAttenuation * DistanceToPINdiodeFromTheHit)
169 // LightYieldMean is parameter calculated to be over 100000 photons per GeV (a guess)
171 // APDEfficiency is 0.02655
173 // fLightYieldAttenuation is 0.0045 a guess
177 //***** Need a method in geometry to retrieve the fiber length corresponding to each layer
179 //***** See the step manager for the light attenuation calculation
181 // The number of electrons created in the APD is
183 // NumberOfElectrons = APDGain * LightYield
185 // The APD Gain is 300
189 fLightYieldMean = 10000000.; // This is a guess
191 fIntrinsicAPDEfficiency = 0.02655 ;
193 fLightFactor = fLightYieldMean * fIntrinsicAPDEfficiency ;
195 fLightYieldAttenuation = 0.0045 ; // an other guess
199 fRecalibrationFactor = 13.418/ fLightYieldMean ;
201 fAPDFactor = (fRecalibrationFactor/100.) * fAPDGain ;
209 //______________________________________________________________________
211 AliEMCALv1::~AliEMCALv1(){
229 //______________________________________________________________________
231 void AliEMCALv1::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t iparent, Float_t ienergy,
233 Int_t id, Float_t * hits,Float_t * p){
235 // Add a hit to the hit list.
237 // An EMCAL hit is the sum of all hits in a single segment
239 // originating from the same enterring particle
249 Bool_t deja = kFALSE;
253 newHit = new AliEMCALHit(shunt, primary, tracknumber, iparent, ienergy, id, hits, p);
255 for ( hitCounter = fNhits-1; hitCounter >= 0 && !deja; hitCounter-- ) {
257 curHit = (AliEMCALHit*) (*fHits)[hitCounter];
259 // We add hits with the same tracknumber, while GEANT treats
261 // primaries succesively
263 if(curHit->GetPrimary() != primary) break;
265 if( *curHit == *newHit ) {
267 *curHit = *curHit + *newHit;
273 } // end for hitCounter
279 new((*fHits)[fNhits]) AliEMCALHit(*newHit);
291 //______________________________________________________________________
293 void AliEMCALv1::StepManager(void){
295 // Accumulates hits as long as the track stays in a single
297 // crystal or PPSD gas Cell
301 Int_t id[2]; // (layer, phi, Eta) indices
305 // position wrt MRS and energy deposited
307 Float_t xyzte[5]={0.,0.,0.,0.,0.};// position wrt MRS, time and energy deposited
309 Float_t pmom[4]={0.,0.,0.,0.};
311 TLorentzVector pos; // Lorentz vector of the track current position.
313 TLorentzVector mom; // Lorentz vector of the track current momentum.
315 Int_t tracknumber = gAlice->CurrentTrack();
319 static Int_t iparent = 0;
321 static Float_t ienergy = 0;
327 AliEMCALGeometry * geom = GetGeometry() ;
331 if(gMC->IsTrackEntering() && (strcmp(gMC->CurrentVolName(),"XALU") == 0)){ // This Particle in enterring the Calorimeter
333 gMC->TrackPosition(pos) ;
341 if ( (xyzte[0]*xyzte[0] + xyzte[1]*xyzte[1])
343 < (geom->GetEnvelop(0)+geom->GetGap2Active()+1.5 )*(geom->GetEnvelop(0)+geom->GetGap2Active()+1.5 ) ) {
345 iparent = tracknumber;
347 gMC->TrackMomentum(mom);
351 TParticle * part = 0 ;
353 Int_t parent = iparent ;
355 while ( parent != -1 ) { // <------------- flags this particle to be kept and
357 //all the ancestors of this particle
359 part = gAlice->Particle(parent) ;
361 part->SetBit(kKeepBit);
363 parent = part->GetFirstMother() ;
371 if(gMC->CurrentVolID(copy) == gMC->VolId("XPHI") ) { // We are in a Scintillator Layer
375 Float_t depositedEnergy ;
379 if( (depositedEnergy = gMC->Edep()) > 0.){// Track is inside a scintillator and deposits some energy
383 gMC->TrackPosition(pos);
391 xyzte[3] = gMC->TrackTime() ;
395 gMC->TrackMomentum(mom);
407 gMC->CurrentVolOffID(1, id[0]); // get the POLY copy number;
409 gMC->CurrentVolID(id[1]); // get the phi number inside the layer
411 absid = (id[0]-1)*(geom->GetNPhi()) + id[1];
415 //Calculates the light yield, the number of photons produced in the
419 // Here we need to know the fiber lebgth to calculate the attenuation
423 Float_t lengthOfFiber = 0. ;// should be retrieved from the geometry
427 Float_t lightYield = gRandom->Poisson(fLightFactor * depositedEnergy *
429 exp(-fLightYieldAttenuation * lengthOfFiber)) ;
431 xyzte[4] = fAPDFactor * lightYield ;
435 primary = gAlice->GetPrimary(tracknumber);
437 AddHit(fIshunt, primary,tracknumber, iparent, ienergy, absid, xyzte, pmom);
439 } // there is deposited energy