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.
30 // --- ROOT system ---
36 #include "TGeometry.h"
37 #include "TParticle.h"
39 // --- Standard library ---
44 #include <strstream.h>
47 // --- AliRoot header files ---
49 #include "AliEMCALv1.h"
50 #include "AliEMCALHit.h"
51 #include "AliEMCALGeometry.h"
59 //______________________________________________________________________
60 AliEMCALv1::AliEMCALv1():AliEMCALv0(){
63 //______________________________________________________________________
64 AliEMCALv1::AliEMCALv1(const char *name, const char *title):
65 AliEMCALv0(name,title){
68 fHits= new TClonesArray("AliEMCALHit",1000);
69 gAlice->AddHitList(fHits);
72 fSamplingFraction = 12.9 ;
73 fLayerToPreshowerRatio = 5.0/6.0;
74 fIshunt = 2; // All hits are associated with particles entering the calorimeter
76 //______________________________________________________________________
77 AliEMCALv1::~AliEMCALv1(){
86 //______________________________________________________________________
87 void AliEMCALv1::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t iparent, Float_t ienergy,
88 Int_t id, Float_t * hits,Float_t * p){
89 // Add a hit to the hit list.
90 // An EMCAL hit is the sum of all hits in a single segment
91 // originating from the same enterring particle
98 newHit = new AliEMCALHit(shunt, primary, tracknumber, iparent, ienergy, id, hits, p);
99 for ( hitCounter = fNhits-1; hitCounter >= 0 && !deja; hitCounter-- ) {
100 curHit = (AliEMCALHit*) (*fHits)[hitCounter];
101 // We add hits with the same tracknumber, while GEANT treats
102 // primaries succesively
103 if(curHit->GetPrimary() != primary) break;
104 if( *curHit == *newHit ) {
105 *curHit = *curHit + *newHit;
108 } // end for hitCounter
111 new((*fHits)[fNhits]) AliEMCALHit(*newHit);
117 //______________________________________________________________________
118 void AliEMCALv1::StepManager(void){
119 // Accumulates hits as long as the track stays in a single
120 // crystal or PPSD gas Cell
121 Int_t id[2]; // (layer, phi, Eta) indices
123 // position wrt MRS and energy deposited
124 Float_t xyze[4]={0.,0.,0.,0.};
125 Float_t pmom[4]={0.,0.,0.,0.};
126 TLorentzVector pos; // Lorentz vector of the track current position.
127 TLorentzVector mom; // Lorentz vector of the track current momentum.
128 Int_t tracknumber = gAlice->CurrentTrack();
130 static Int_t iparent = 0;
131 static Float_t ienergy = 0;
135 if(gMC->IsTrackEntering() && (strcmp(gMC->CurrentVolName(),"XALU") == 0)) // This Particle in enterring the Calorimeter
138 gMC->TrackPosition(pos) ;
143 if ( (xyze[1]*xyze[1] + xyze[2]*xyze[2] + xyze[3]*xyze[3]) < (fGeom->GetEnvelop(0)+fGeom->GetGap2Active()+1.5 )*(fGeom->GetEnvelop(0)+fGeom->GetGap2Active()+1.5 ) )
145 iparent = tracknumber;
146 gMC->TrackMomentum(mom);
148 TParticle * part = 0 ;
149 Int_t parent = iparent ;
150 while ( parent != -1 ) { // <------------- flags this particle to be kept and
151 //all the ancestors of this particle
152 part = gAlice->Particle(parent) ;
153 part->SetBit(kKeepBit);
154 parent = part->GetFirstMother() ;
161 if(gMC->CurrentVolID(copy) == gMC->VolId("XPHI") ) { // We are in a Scintillator Layer
163 gMC->CurrentVolOffID(1, id[0]); // get the POLY copy number;
164 gMC->CurrentVolID(id[1]); // get the phi number inside the layer
165 primary = gAlice->GetPrimary(tracknumber);
166 gMC->TrackPosition(pos);
167 gMC->TrackMomentum(mom);
171 xyze[3] = fSamplingFraction*(gMC->Edep()); // Correct for sampling calorimeter
177 if(xyze[3] > 0.){// Track is inside the crystal and deposits some energy
178 absid = (id[0]-1)*(fGeom->GetNPhi()) + id[1];
179 if((absid/fGeom->GetNPhi()) < (2*fGeom->GetNZ()))
180 {xyze[3] = fLayerToPreshowerRatio*xyze[3] ;} // Preshower readout must be scaled
181 AddHit(fIshunt, primary,tracknumber, iparent, ienergy, absid, xyze, pmom);
182 } // there is deposited energy