]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSv1.cxx
Particle identification improved by shower profile analysis
[u/mrichter/AliRoot.git] / PHOS / AliPHOSv1.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
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  **************************************************************************/
15
16 //_________________________________________________________________________
17 // Manager class for PHOS version SUBATECH
18 //*-- Author : Odd Harald Oddland & Gines Martinez  Feb-2000 
19 // The main goal of this version of AliPHOS is to calculted the 
20 // induced charged in the PIN diode, taking into account light
21 // tracking in the PbWO4 crystal, induced signal in the 
22 // PIN due to MIPS particle and electronic noise.
23 // In this respect, this class derived from AliPHOSv0 and 
24 // only the StepManager function has been "surcharged"
25 //////////////////////////////////////////////////////////////////////////////
26
27 // --- ROOT system ---
28 #include "TRandom.h"
29
30 // --- Standard library ---
31
32 #include <cstdio>
33 #include <cstring>
34 #include <cstdlib>
35 #include <strstream>
36 #include <cassert>
37
38 // --- AliRoot header files ---
39
40 #include "AliPHOSv1.h"
41 #include "AliPHOSHit.h"
42 #include "AliPHOSDigit.h"
43 #include "AliRun.h"
44 #include "AliConst.h"
45
46 ClassImp(AliPHOSv1)
47
48 //____________________________________________________________________________
49   AliPHOSv1::AliPHOSv1() :
50     AliPHOSv0()
51
52 }
53
54 //____________________________________________________________________________
55 AliPHOSv1::AliPHOSv1(const char *name, const char *title):
56   AliPHOSv0(name,title)
57 {
58   fLightYieldMean = 700000. ;
59   fIntrinsicPINEfficiency = 0.1875 ;
60   fLightYieldAttenuation = 0.0045 ;
61   fRecalibrationFactor = 6.2 / fLightYieldMean ;
62   fElectronsPerGeV = 2.77e+8 ; 
63 }
64 //____________________________________________________________________________
65 AliPHOSv1::AliPHOSv1(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title):
66   AliPHOSv0(Reconstructioner,name,title)
67
68   fLightYieldMean = 700000.;
69   fIntrinsicPINEfficiency = 0.1875 ;
70   fLightYieldAttenuation = 0.0045 ;
71   fRecalibrationFactor = 6.2 / fLightYieldMean ;
72   fElectronsPerGeV = 2.77e+8 ; // Odd Harald work
73 }
74
75 //____________________________________________________________________________
76 AliPHOSv1::~AliPHOSv1() 
77
78  
79 }
80
81 //____________________________________________________________________________
82
83
84
85
86
87
88 //____________________________________________________________________________
89 void AliPHOSv1::StepManager(void)
90 {
91   Int_t          relid[4] ;      // (box, layer, row, column) indices
92   Float_t        xyze[4] ;       // position wrt MRS and energy deposited
93   TLorentzVector pos ;
94   Int_t copy;
95   Float_t        lightyield ;  // Light Yield per GeV
96   Float_t        nElectrons ; // Number of electrons in the PIN diode
97   TString name = fGeom->GetName() ; 
98   Float_t        global[3] ;
99   Float_t        local[3] ;
100   Float_t        lostenergy ;
101
102   if ( name == "GPS2" ) { // the CPV is a PPSD
103     if( gMC->CurrentVolID(copy) == gMC->VolId("GCEL") )
104     //     if( strcmp ( gMC->CurrentVolName(), "GCEL" ) == 0 )  // We are inside a gas cell 
105     {
106       gMC->TrackPosition(pos) ;
107       xyze[0] = pos[0] ;
108       xyze[1] = pos[1] ;
109       xyze[2] = pos[2] ;
110       xyze[3] = gMC->Edep() ;
111
112
113       if ( xyze[3] != 0 ) { // there is deposited energy 
114         gMC->CurrentVolOffID(5, relid[0]) ;  // get the PHOS Module number
115         gMC->CurrentVolOffID(3, relid[1]) ;  // get the Micromegas Module number 
116       // 1-> Geom->GetNumberOfModulesPhi() *  fGeom->GetNumberOfModulesZ() upper                         
117       //  >  fGeom->GetNumberOfModulesPhi()  *  fGeom->GetNumberOfModulesZ() lower
118         gMC->CurrentVolOffID(1, relid[2]) ;  // get the row number of the cell
119         gMC->CurrentVolID(relid[3]) ;        // get the column number 
120
121         // get the absolute Id number
122
123         Int_t absid ; 
124         fGeom->RelToAbsNumbering(relid,absid) ; 
125         
126
127         AddHit(gAlice->CurrentTrack(), absid, xyze );
128
129       } // there is deposited energy 
130      } // We are inside the gas of the CPV  
131    } // GPS2 configuration
132   
133    if(gMC->CurrentVolID(copy) == gMC->VolId("PXTL") ) 
134   //      if( strcmp ( gMC->CurrentVolName(), "PXTL" ) == 0 ) { //  We are inside a PWO crystal
135      {
136        gMC->TrackPosition(pos) ;
137        xyze[0] = pos[0] ;
138        xyze[1] = pos[1] ;
139        xyze[2] = pos[2] ;
140        lostenergy = gMC->Edep() ; 
141        xyze[3] = gMC->Edep() ;
142
143        global[0] = pos[0] ;
144        global[1] = pos[1] ;
145        global[2] = pos[2] ;
146
147        if ( xyze[3] != 0 ) {
148           gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ;
149           relid[1] = 0   ;                    // means PW04
150           gMC->CurrentVolOffID(4, relid[2]) ; // get the row number inside the module
151           gMC->CurrentVolOffID(3, relid[3]) ; // get the cell number inside the module
152
153       // get the absolute Id number
154
155           Int_t absid ; 
156           fGeom->RelToAbsNumbering(relid,absid) ; 
157           gMC->Gmtod(global, local, 1) ;
158           
159           // calculating number of electrons in the PIN diode asociated to this hit
160           lightyield = gRandom->Poisson(fLightYieldMean) ;
161           nElectrons = lostenergy * lightyield * fIntrinsicPINEfficiency *
162             exp(-fLightYieldAttenuation * (local[1]+fGeom->GetCrystalSize(1)/2.0 ) ) ;
163
164           xyze[3] = nElectrons * fRecalibrationFactor ;
165           // add current hit to the hit list
166           AddHit(gAlice->CurrentTrack(), absid, xyze);
167     
168        } // there is deposited energy
169     } // we are inside a PHOS Xtal
170
171    if(gMC->CurrentVolID(copy) == gMC->VolId("PPIN") ) // We are inside de PIN diode 
172      {
173        gMC->TrackPosition(pos) ;
174        xyze[0] = pos[0] ;
175        xyze[1] = pos[1] ;
176        xyze[2] = pos[2] ;
177        lostenergy = gMC->Edep() ;
178        xyze[3] = gMC->Edep() ;
179
180        if ( xyze[3] != 0 ) {
181           gMC->CurrentVolOffID(11, relid[0]) ; // get the PHOS module number ;
182           relid[1] = 0   ;                    // means PW04and PIN
183           gMC->CurrentVolOffID(5, relid[2]) ; // get the row number inside the module
184           gMC->CurrentVolOffID(4, relid[3]) ; // get the cell number inside the module
185
186       // get the absolute Id number
187
188           Int_t absid ; 
189           fGeom->RelToAbsNumbering(relid,absid) ;
190           
191           // calculating number of electrons in the PIN diode asociated to this hit
192           nElectrons = lostenergy * fElectronsPerGeV ;
193           xyze[3] = nElectrons * fRecalibrationFactor ;
194
195           // add current hit to the hit list
196           AddHit(gAlice->CurrentTrack(), absid, xyze);
197           //printf("PIN volume is  %d, %d, %d, %d \n",relid[0],relid[1],relid[2],relid[3]);
198           //printf("Lost energy in the PIN is %f \n",lostenergy) ;
199        } // there is deposited energy
200     } // we are inside a PHOS XtalPHOS PIN diode
201 }
202