X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=EMCAL%2FAliEMCALv1.cxx;h=5a9f82b699d1a1fbf21aa2d316e5c92e96fddaec;hb=b7de6a56f05969bebd8e46e06892305973f5701e;hp=0253ba15a39a03ed44c00fc3baefd6af8061acf9;hpb=c0e2c4fc8a7b76b2db75826ccd9b37349205323d;p=u%2Fmrichter%2FAliRoot.git diff --git a/EMCAL/AliEMCALv1.cxx b/EMCAL/AliEMCALv1.cxx index 0253ba15a39..5a9f82b699d 100644 --- a/EMCAL/AliEMCALv1.cxx +++ b/EMCAL/AliEMCALv1.cxx @@ -16,13 +16,12 @@ /* $Id$ */ //_________________________________________________________________________ -// Implementation version v1 of EMCAL Manager class -// An object of this class does not produce digits -// It is the one to use if you do want to produce outputs in TREEH -// +//*-- Implementation version v1 of EMCAL Manager class +//*-- An object of this class does not produce digits +//*-- It is the one to use if you do want to produce outputs in TREEH +//*-- //*-- 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. @@ -31,29 +30,15 @@ // 2. Timing signal is collected and added to hit // --- ROOT system --- -#include "TPGON.h" -#include "TTUBS.h" -#include "TNode.h" -#include "TRandom.h" -#include "TTree.h" -#include "TGeometry.h" #include "TParticle.h" +#include "TVirtualMC.h" // --- Standard library --- -#include -#include -#include -#include -#include -#include - // --- AliRoot header files --- - #include "AliEMCALv1.h" #include "AliEMCALHit.h" #include "AliEMCALGeometry.h" -#include "AliConst.h" #include "AliRun.h" #include "AliMC.h" @@ -63,8 +48,7 @@ ClassImp(AliEMCALv1) //______________________________________________________________________ AliEMCALv1::AliEMCALv1():AliEMCALv0(){ // ctor - fLightYieldMean = 0 ; - fIntrinsicAPDEfficiency = fLightFactor = fLightYieldAttenuation = fAPDFactor = fAPDGain = fRecalibrationFactor = fAPDFactor = 0. ; + } //______________________________________________________________________ @@ -73,34 +57,10 @@ AliEMCALv1::AliEMCALv1(const char *name, const char *title): // Standard Creator. fHits= new TClonesArray("AliEMCALHit",1000); - gAlice->AddHitList(fHits); + gAlice->GetMCApp()->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 ; - } //______________________________________________________________________ @@ -117,8 +77,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. - // An EMCAL hit is the sum of all hits in a single segment - // originating from the same enterring particle + // An EMCAL hit is the sum of all hits in a tower section + // originating from the same entering particle Int_t hitCounter; AliEMCALHit *newHit; @@ -126,17 +86,18 @@ void AliEMCALv1::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t ipa Bool_t deja = kFALSE; newHit = new AliEMCALHit(shunt, primary, tracknumber, iparent, ienergy, id, hits, p); - for ( hitCounter = fNhits-1; hitCounter >= 0 && !deja; hitCounter-- ) { + for ( hitCounter = fNhits-1; hitCounter >= 0 && !deja; hitCounter-- ) { curHit = (AliEMCALHit*) (*fHits)[hitCounter]; // We add hits with the same tracknumber, while GEANT treats // primaries succesively - if(curHit->GetPrimary() != primary) break; + if(curHit->GetPrimary() != primary) + break; if( *curHit == *newHit ) { *curHit = *curHit + *newHit; deja = kTRUE; - } // end if + } // end if } // end for hitCounter - + if ( !deja ) { new((*fHits)[fNhits]) AliEMCALHit(*newHit); fNhits++; @@ -146,17 +107,15 @@ 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 + // Accumulates hits as long as the track stays in a tower - Int_t id[2]; // (layer, phi, Eta) indices - Int_t absid; + Int_t id[2]; // (phi, Eta) indices // 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 tracknumber = gAlice->GetMCApp()->GetCurrentTrackNumber(); Int_t primary = 0; static Int_t iparent = 0; static Float_t ienergy = 0; @@ -178,7 +137,7 @@ void AliEMCALv1::StepManager(void){ 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 = gAlice->GetMCApp()->Particle(parent) ; part->SetBit(kKeepBit); parent = part->GetFirstMother() ; } @@ -189,7 +148,10 @@ void AliEMCALv1::StepManager(void){ Float_t depositedEnergy ; if( (depositedEnergy = gMC->Edep()) > 0.){// Track is inside a scintillator and deposits some energy - + + // use sampling fraction to get original energy --HG + depositedEnergy = depositedEnergy * geom->GetSampling(); + gMC->TrackPosition(pos); xyzte[0] = pos[0]; xyzte[1] = pos[1]; @@ -204,20 +166,24 @@ void AliEMCALv1::StepManager(void){ 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)*(geom->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 ; + Int_t tower = (id[0]-1) % geom->GetNZ() + 1 + (id[1] - 1) * geom->GetNZ() ; + Int_t layer = static_cast((id[0]-1)/(geom->GetNZ())) + 1 ; + Int_t absid = tower; + Int_t nlayers = geom->GetNECLayers(); + if ((layer > nlayers)||(layer<1)) + Fatal("StepManager", "Wrong calculation of layer number: layer = %d > %d\n", layer, nlayers) ; + + + Float_t lightYield = depositedEnergy ; + xyzte[4] = lightYield ; - primary = gAlice->GetPrimary(tracknumber); - AddHit(fIshunt, primary,tracknumber, iparent, ienergy, absid, xyzte, pmom); + primary = gAlice->GetMCApp()->GetPrimary(tracknumber); + + if (gDebug == 2) + printf("StepManager: id0 = %d, id1 = %d, absid = %d tower = %d layer = %d energy = %f\n", id[0], id[1], absid, tower, layer, xyzte[4]) ; + + AddHit(fIshunt, primary,tracknumber, iparent, ienergy, absid, xyzte, pmom); } // there is deposited energy } }