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 ---
34 #include "TParticle.h"
35 #include "TVirtualMC.h"
37 // --- Standard library ---
39 // --- AliRoot header files ---
40 #include "AliEMCALv1.h"
41 #include "AliEMCALHit.h"
42 #include "AliEMCALGeometry.h"
49 //______________________________________________________________________
50 AliEMCALv1::AliEMCALv1():AliEMCALv0(){
55 //______________________________________________________________________
56 AliEMCALv1::AliEMCALv1(const char *name, const char *title):
57 AliEMCALv0(name,title){
60 fHits= new TClonesArray("AliEMCALHit",1000);
61 gAlice->GetMCApp()->AddHitList(fHits);
64 fIshunt = 2; // All hits are associated with particles entering the calorimeter
67 //______________________________________________________________________
68 AliEMCALv1::~AliEMCALv1(){
77 //______________________________________________________________________
78 void AliEMCALv1::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t iparent, Float_t ienergy,
79 Int_t id, Float_t * hits,Float_t * p){
80 // Add a hit to the hit list.
81 // An EMCAL hit is the sum of all hits in a tower section (PRE, ECAL, HCAL)
82 // originating from the same entering particle
89 newHit = new AliEMCALHit(shunt, primary, tracknumber, iparent, ienergy, id, hits, p);
90 for ( hitCounter = fNhits-1; hitCounter >= 0 && !deja; hitCounter-- ) {
91 curHit = (AliEMCALHit*) (*fHits)[hitCounter];
92 // We add hits with the same tracknumber, while GEANT treats
93 // primaries succesively
94 if(curHit->GetPrimary() != primary)
96 if( *curHit == *newHit ) {
97 *curHit = *curHit + *newHit;
100 } // end for hitCounter
103 new((*fHits)[fNhits]) AliEMCALHit(*newHit);
109 //______________________________________________________________________
110 void AliEMCALv1::StepManager(void){
111 // Accumulates hits as long as the track stays in a single
112 // crystal or PPSD gas Cell
114 Int_t id[2]; // (layer, phi, Eta) indices
115 // position wrt MRS and energy deposited
116 Float_t xyzte[5]={0.,0.,0.,0.,0.};// position wrt MRS, time and energy deposited
117 Float_t pmom[4]={0.,0.,0.,0.};
118 TLorentzVector pos; // Lorentz vector of the track current position.
119 TLorentzVector mom; // Lorentz vector of the track current momentum.
120 Int_t tracknumber = gAlice->GetMCApp()->GetCurrentTrackNumber();
122 static Int_t iparent = 0;
123 static Float_t ienergy = 0;
126 AliEMCALGeometry * geom = GetGeometry() ;
128 if(gMC->IsTrackEntering() && (strcmp(gMC->CurrentVolName(),"XALU") == 0)){ // This Particle in enterring the Calorimeter
129 gMC->TrackPosition(pos) ;
133 if ( (xyzte[0]*xyzte[0] + xyzte[1]*xyzte[1])
134 < (geom->GetEnvelop(0)+geom->GetGap2Active()+1.5 )*(geom->GetEnvelop(0)+geom->GetGap2Active()+1.5 ) ) {
135 iparent = tracknumber;
136 gMC->TrackMomentum(mom);
138 TParticle * part = 0 ;
139 Int_t parent = iparent ;
140 while ( parent != -1 ) { // <------------- flags this particle to be kept and
141 //all the ancestors of this particle
142 part = gAlice->GetMCApp()->Particle(parent) ;
143 part->SetBit(kKeepBit);
144 parent = part->GetFirstMother() ;
148 if(gMC->CurrentVolID(copy) == gMC->VolId("XPHI") ) { // We are in a Scintillator Layer
150 Float_t depositedEnergy ;
152 if( (depositedEnergy = gMC->Edep()) > 0.){// Track is inside a scintillator and deposits some energy
154 gMC->TrackPosition(pos);
158 xyzte[3] = gMC->TrackTime() ;
160 gMC->TrackMomentum(mom);
166 gMC->CurrentVolOffID(1, id[0]); // get the POLY copy number;
167 gMC->CurrentVolID(id[1]); // get the phi number inside the layer
169 Int_t tower = (id[0]-1) % geom->GetNZ() + 1 + (id[1] - 1) * geom->GetNZ() ;
170 Int_t layer = static_cast<Int_t>((id[0]-1)/(geom->GetNZ())) + 1 ;
171 Int_t absid = tower ;
172 if (layer <= geom->GetNPRLayers() )
173 absid += geom->GetNZ() * geom->GetNPhi() ;
174 else if (layer > geom->GetNECLayers() )
175 absid += 2 * geom->GetNZ() * geom->GetNPhi() ;
177 Int_t nlayers = geom->GetNPRLayers()+ geom->GetNECLayers()+ geom->GetNHCLayers() ;
179 Fatal("StepManager", "Wrong calculation of layer number: layer = %d > %d\n", layer, nlayers) ;
182 Float_t lightYield = depositedEnergy ;
184 xyzte[4] = lightYield ;
186 primary = gAlice->GetMCApp()->GetPrimary(tracknumber);
189 Info("StepManager", "id0 = %d, id1 = %d, absid = %d tower = %d layer = %d energy = %f\n", id[0], id[1], absid, tower, layer, xyzte[4]) ;
191 AddHit(fIshunt, primary,tracknumber, iparent, ienergy, absid, xyzte, pmom);
192 } // there is deposited energy