]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALv1.cxx
Position of bellow.
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALv1.cxx
index c401e43004262a8503c2ed011e3d265f538d0f86..7047ed7cf927ccf5726edad2ab1e1a92b791cf68 100644 (file)
 //*-- Author: Sahal Yacoob (LBL /UCT)
 //*--       : Jennifer Klay (LBL)
 
+// This Class not stores information on all particles prior to EMCAL entry - in order to facilitate analysis.
+// This is done by setting fIShunt =2, and flagging all parents of particles entering the EMCAL.
+
+// 15/02/2002 .... Yves Schutz
+//  1. fSamplingFraction and fLayerToPreshowerRatio have been removed
+//  2. Timing signal is collected and added to hit
 
 // --- ROOT system ---
 #include "TPGON.h"
@@ -31,7 +37,7 @@
 #include "TRandom.h"
 #include "TTree.h"
 #include "TGeometry.h"
-
+#include "TParticle.h"
 
 // --- Standard library ---
 
@@ -56,7 +62,10 @@ ClassImp(AliEMCALv1)
 //______________________________________________________________________
 AliEMCALv1::AliEMCALv1():AliEMCALv0(){
   // ctor
+    fLightYieldMean = 0 ; 
+    fIntrinsicAPDEfficiency = fLightFactor = fLightYieldAttenuation =   fAPDFactor = fAPDGain = fRecalibrationFactor = fAPDFactor = 0. ; 
 }
+
 //______________________________________________________________________
 AliEMCALv1::AliEMCALv1(const char *name, const char *title):
     AliEMCALv0(name,title){
@@ -66,9 +75,33 @@ AliEMCALv1::AliEMCALv1(const char *name, const char *title):
     gAlice->AddHitList(fHits);
 
     fNhits = 0;
+    fIshunt     =  2; // All hits are associated with particles entering the calorimeter
+
+    //Photoelectron statistics:
+    // The light yield is a poissonian distribution of the number of
+    // photons created in a plastic layer, calculated using following formula
+    // NumberOfPhotons = EnergyLost * LightYieldMean* APDEfficiency *
+    //              exp (-LightYieldAttenuation * DistanceToPINdiodeFromTheHit)
+    // LightYieldMean is parameter calculated to be over 100000 photons per GeV (a guess)
+    // APDEfficiency is 0.02655
+    // fLightYieldAttenuation is 0.0045 a guess
+    // TO BE FIXED
+    //***** Need a method in geometry to retrieve the fiber length corresponding to each layer
+    //***** See the step manager for the light attenuation calculation 
+    // The number of electrons created in the APD is
+    // NumberOfElectrons = APDGain * LightYield
+    // The APD Gain is 300
+    
+    fLightYieldMean         = 10000000.;  // This is a guess
+    fIntrinsicAPDEfficiency = 0.02655 ;
+    fLightFactor            = fLightYieldMean * fIntrinsicAPDEfficiency ; 
+    fLightYieldAttenuation  = 0.0045 ; // an other guess 
+    fAPDGain                = 300. ;
+    fRecalibrationFactor    = 13.418/ fLightYieldMean ;
+    fAPDFactor              = (fRecalibrationFactor/100.) * fAPDGain ; 
 
-    fIshunt     =  1; // All hits are associated with primary particles
 }
+
 //______________________________________________________________________
 AliEMCALv1::~AliEMCALv1(){
     // dtor
@@ -83,8 +116,8 @@ AliEMCALv1::~AliEMCALv1(){
 void AliEMCALv1::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t iparent, Float_t ienergy, 
                        Int_t id, Float_t * hits,Float_t * p){
     // Add a hit to the hit list.
-    // A PHOS hit is the sum of all hits in a single crystal
-    //   or in a single PPSD gas cell
+    // An EMCAL hit is the sum of all hits in a single segment 
+    //   originating from the same enterring particle 
     Int_t hitCounter;
     
     AliEMCALHit *newHit;
@@ -112,47 +145,76 @@ void AliEMCALv1::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t ipa
 }
 //______________________________________________________________________
 void AliEMCALv1::StepManager(void){
-    // Accumulates hits as long as the track stays in a single
-    // crystal or PPSD gas Cell
-    Int_t          id[2];           // (layer, phi, Eta) indices
-    Int_t          absid;
-    // position wrt MRS and energy deposited
-    Float_t        xyze[4]={0.,0.,0.,0.};
-    Float_t        pmom[4]={0.,0.,0.,0.};
-    TLorentzVector pos; // Lorentz vector of the track current position.
-    TLorentzVector mom; // Lorentz vector of the track current momentum.
-    Int_t tracknumber =  gAlice->CurrentTrack();
-    Int_t primary;
-    static Int_t iparent = 0;
-    static Float_t ienergy = 0;
-    Int_t copy;
-
-
- if(gMC->IsTrackEntering() && (strcmp(gMC->CurrentVolName(),"XALU") == 0)) 
- {
-    iparent = tracknumber;
-    gMC->TrackMomentum(mom);
-    ienergy = mom[3]; 
-}
- if(gMC->CurrentVolID(copy) == gMC->VolId("XPHI") ) { //  We are inside a PBWO crysta
-
-    gMC->CurrentVolOffID(1, id[0]); // get the POLY copy number;
-    gMC->CurrentVolID(id[1]); // get the phi number inside the layer
-    primary = gAlice->GetPrimary(tracknumber);
-    gMC->TrackPosition(pos);
-    gMC->TrackMomentum(mom);
-    xyze[0] = pos[0];
-    xyze[1] = pos[1];
-    xyze[2] = pos[2];
-    xyze[3] = gMC->Edep();
-    pmom[0] = mom[0];
-    pmom[1] = mom[1];
-    pmom[2] = mom[2];
-    pmom[3] = mom[3];
+  // Accumulates hits as long as the track stays in a single
+  // crystal or PPSD gas Cell
+
+  Int_t          id[2];           // (layer, phi, Eta) indices
+  Int_t          absid;
+  // position wrt MRS and energy deposited
+  Float_t        xyzte[5]={0.,0.,0.,0.,0.};// position wrt MRS, time and energy deposited
+  Float_t        pmom[4]={0.,0.,0.,0.};
+  TLorentzVector pos; // Lorentz vector of the track current position.
+  TLorentzVector mom; // Lorentz vector of the track current momentum.
+  Int_t tracknumber =  gAlice->CurrentTrack();
+  Int_t primary = 0;
+  static Int_t iparent = 0;
+  static Float_t ienergy = 0;
+  Int_t copy = 0;
+  
+  if(gMC->IsTrackEntering() && (strcmp(gMC->CurrentVolName(),"XALU") == 0)){ // This Particle in enterring the Calorimeter
+    gMC->TrackPosition(pos) ;
+    xyzte[0] = pos[0] ;
+    xyzte[1] = pos[1] ;
+    xyzte[2] = pos[2] ;
+    if ( (xyzte[0]*xyzte[0] + xyzte[1]*xyzte[1])  
+        <  (fGeom->GetEnvelop(0)+fGeom->GetGap2Active()+1.5 )*(fGeom->GetEnvelop(0)+fGeom->GetGap2Active()+1.5 ) ) {
+      iparent = tracknumber;
+      gMC->TrackMomentum(mom);
+      ienergy = mom[3]; 
+      TParticle * part = 0 ;
+      Int_t parent = iparent ;
+      while ( parent != -1 ) { // <------------- flags this particle to be kept and
+       //all the ancestors of this particle
+       part = gAlice->Particle(parent) ;
+       part->SetBit(kKeepBit);
+       parent = part->GetFirstMother() ;
+      }
+    }
+  }
+  if(gMC->CurrentVolID(copy) == gMC->VolId("XPHI") ) { // We are in a Scintillator Layer 
     
-    if(xyze[3] > 0.){// Track is inside the crystal and deposits some energy
-       absid = (id[0]-1)*(fGeom->GetNPhi()) + id[1];
-       AddHit(fIshunt, primary,tracknumber, iparent, ienergy, absid, xyze, pmom);
+    Float_t depositedEnergy ; 
+    
+    if( (depositedEnergy = gMC->Edep()) > 0.){// Track is inside a scintillator and deposits some energy
+      
+      gMC->TrackPosition(pos);
+      xyzte[0] = pos[0];
+      xyzte[1] = pos[1];
+      xyzte[2] = pos[2];
+      xyzte[3] = gMC->TrackTime() ;       
+      
+      gMC->TrackMomentum(mom);
+      pmom[0] = mom[0];
+      pmom[1] = mom[1];
+      pmom[2] = mom[2];
+      pmom[3] = mom[3];
+      
+      gMC->CurrentVolOffID(1, id[0]); // get the POLY copy number;
+      gMC->CurrentVolID(id[1]); // get the phi number inside the layer
+      absid = (id[0]-1)*(fGeom->GetNPhi()) + id[1];
+      
+      //Calculates the light yield, the number of photons produced in the
+      //plastic layer 
+      // Here we need to know the fiber lebgth to calculate the attenuation
+     
+      Float_t lengthOfFiber = 0. ;// should be retrieved from the geometry
+
+      Float_t lightYield = gRandom->Poisson(fLightFactor * depositedEnergy *
+                                           exp(-fLightYieldAttenuation * lengthOfFiber)) ;
+      xyzte[4] = fAPDFactor * lightYield  ;
+   
+      primary = gAlice->GetPrimary(tracknumber);
+      AddHit(fIshunt, primary,tracknumber, iparent, ienergy, absid, xyzte, pmom);
     } // there is deposited energy
-}
+  }
 }