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)
27 // --- ROOT system ---
33 #include "TGeometry.h"
36 // --- Standard library ---
41 #include <strstream.h>
44 // --- AliRoot header files ---
46 #include "AliEMCALv1.h"
47 #include "AliEMCALHit.h"
48 #include "AliEMCALGeometry.h"
56 //______________________________________________________________________
57 AliEMCALv1::AliEMCALv1():AliEMCALv0(){
60 //______________________________________________________________________
61 AliEMCALv1::AliEMCALv1(const char *name, const char *title):
62 AliEMCALv0(name,title){
65 fHits= new TClonesArray("AliEMCALHit",1000);
66 gAlice->AddHitList(fHits);
69 fSamplingFraction = 12.9 ;
70 fIshunt = 1; // All hits are associated with primary particles
72 //______________________________________________________________________
73 AliEMCALv1::~AliEMCALv1(){
82 //______________________________________________________________________
83 void AliEMCALv1::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t iparent, Float_t ienergy,
84 Int_t id, Float_t * hits,Float_t * p){
85 // Add a hit to the hit list.
86 // An EMCAL hit is the sum of all hits in a single segment
87 // originating from the same enterring particle
94 newHit = new AliEMCALHit(shunt, primary, tracknumber, iparent, ienergy, id, hits, p);
95 for ( hitCounter = fNhits-1; hitCounter >= 0 && !deja; hitCounter-- ) {
96 curHit = (AliEMCALHit*) (*fHits)[hitCounter];
97 // We add hits with the same tracknumber, while GEANT treats
98 // primaries succesively
99 if(curHit->GetPrimary() != primary) break;
100 if( *curHit == *newHit ) {
101 *curHit = *curHit + *newHit;
104 } // end for hitCounter
107 new((*fHits)[fNhits]) AliEMCALHit(*newHit);
113 //______________________________________________________________________
114 void AliEMCALv1::StepManager(void){
115 // Accumulates hits as long as the track stays in a single
116 // crystal or PPSD gas Cell
117 Int_t id[2]; // (layer, phi, Eta) indices
119 // position wrt MRS and energy deposited
120 Float_t xyze[4]={0.,0.,0.,0.};
121 Float_t pmom[4]={0.,0.,0.,0.};
122 TLorentzVector pos; // Lorentz vector of the track current position.
123 TLorentzVector mom; // Lorentz vector of the track current momentum.
124 Int_t tracknumber = gAlice->CurrentTrack();
126 static Int_t iparent = 0;
127 static Float_t ienergy = 0;
131 if(gMC->IsTrackEntering() && (strcmp(gMC->CurrentVolName(),"XALU") == 0)) // This Particle in enterring the Calorimeter
133 iparent = tracknumber;
134 gMC->TrackMomentum(mom);
137 if(gMC->CurrentVolID(copy) == gMC->VolId("XPHI") ) { // We are in a Scintillator Layer
139 gMC->CurrentVolOffID(1, id[0]); // get the POLY copy number;
140 gMC->CurrentVolID(id[1]); // get the phi number inside the layer
141 primary = gAlice->GetPrimary(tracknumber);
142 gMC->TrackPosition(pos);
143 gMC->TrackMomentum(mom);
147 xyze[3] = fSamplingFraction*(gMC->Edep()); // Correct for sampling calorimeter
153 if(xyze[3] > 0.){// Track is inside the crystal and deposits some energy
154 absid = (id[0]-1)*(fGeom->GetNPhi()) + id[1];
155 if((absid/fGeom->GetNPhi()) < (2*fGeom->GetNZ()))
156 {xyze[3] = 5*xyze[3]/6 ;} // Preshower readout must be scaled
157 AddHit(fIshunt, primary,tracknumber, iparent, ienergy, absid, xyze, pmom);
158 } // there is deposited energy