]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSv3.cxx
ac85d4eeb0ff498ec96e2d10f9453a38d5bf816b
[u/mrichter/AliRoot.git] / PHOS / AliPHOSv3.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 /* $Id$ */
17
18 //_________________________________________________________________________
19 // Implementation version v0 of PHOS Manager class 
20 // Layout EMC + PPSD has name GPS2  
21 // The main goal of this version of AliPHOS is to calculte the 
22 //  induced charged in the PIN diode, taking into account light
23 //  tracking in the PbWO4 crystal, induced signal in the 
24 //  PIN due to MIPS particle and electronic noise.
25 // This is done in the StepManager 
26 //                  
27 //*-- Author:  Odd Harald Oddland & Gines Martinez (SUBATECH)
28
29
30 // --- ROOT system ---
31 #include "TRandom.h"
32
33 // --- Standard library ---
34
35 #include <stdio.h>
36 #include <string.h>
37 #include <stdlib.h>
38 #include <strstream.h>
39
40 // --- AliRoot header files ---
41
42 #include "AliPHOSv3.h"
43 #include "AliPHOSHit.h"
44 #include "AliPHOSDigit.h"
45 #include "AliRun.h"
46 #include "AliConst.h"
47
48 ClassImp(AliPHOSv3)
49
50 //____________________________________________________________________________
51   AliPHOSv3::AliPHOSv3(const char *name, const char *title):
52 AliPHOSv1(name,title)
53 {
54   // ctor 
55
56   // Number of electrons created in the PIN due to light collected in the PbWo4 crystal is calculated using 
57   // following formula
58   // NumberOfElectrons = EnergyLost * LightYield * PINEfficiency * 
59   //                     exp (-LightYieldAttenuation * DistanceToPINdiodeFromTheHit) *
60   //                     RecalibrationFactor ;
61   // LightYield is obtained as a Poissonian distribution with a mean at 700000 photons per GeV fromValery Antonenko
62   // PINEfficiency is 0.1875 from Odd Harald Odland work
63   // k_0 is 0.0045 from Valery Antonenko 
64
65
66   fLightYieldMean = 700000. ;
67   fIntrinsicPINEfficiency = 0.1875 ;
68   fLightYieldAttenuation = 0.0045 ;
69   fRecalibrationFactor = 6.2 / fLightYieldMean ;
70   fElectronsPerGeV = 2.77e+8 ; 
71 }
72
73 //____________________________________________________________________________
74 AliPHOSv3::AliPHOSv3(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title):
75   AliPHOSv1(Reconstructioner,name,title)
76 {
77   // ctor 
78
79   // Number of electrons created in the PIN due to light collected in the PbWo4 crystal is calculated using 
80   // following formula
81   // NumberOfElectrons = EnergyLost * LightYield * PINEfficiency * 
82   //                     exp (-LightYieldAttenuation * DistanceToPINdiodeFromTheHit) *
83   //                     RecalibrationFactor ;
84   // LightYield is obtained as a Poissonian distribution with a mean at 700000 photons per GeV fromValery Antonenko
85   // PINEfficiency is 0.1875 from Odd Harald Odland work
86   // k_0 is 0.0045 from Valery Antonenko 
87
88   fLightYieldMean = 700000.;
89   fIntrinsicPINEfficiency = 0.1875 ;
90   fLightYieldAttenuation = 0.0045 ;
91   fRecalibrationFactor = 6.2 / fLightYieldMean ;
92   fElectronsPerGeV = 2.77e+8 ;
93 }
94
95 //____________________________________________________________________________
96 void AliPHOSv3::StepManager(void)
97 {
98   // Accumulates hits as long as the track stays in a single crystal or PPSD gas Cell
99   // Adds the energy deposited in the PIN diode
100
101   Int_t          relid[4] ;      // (box, layer, row, column) indices
102   Float_t        xyze[4] ;       // position wrt MRS and energy deposited
103   TLorentzVector pos ;
104   Int_t copy;
105   Float_t        lightyield ;   // Light Yield per GeV
106   Float_t        nElectrons ;   // Number of electrons in the PIN diode
107   TString name = fGeom->GetName() ; 
108   Float_t        global[3] ;
109   Float_t        local[3] ;
110   Float_t        lostenergy ;
111
112   Int_t tracknumber =  gAlice->CurrentTrack() ; 
113   Int_t primary =  gAlice->GetPrimary( gAlice->CurrentTrack() ); 
114
115   if ( name == "GPS2" ) { // the CPV is a PPSD
116     if( gMC->CurrentVolID(copy) == gMC->VolId("GCEL") ) // We are inside a gas cell 
117     {
118       gMC->TrackPosition(pos) ;
119       xyze[0] = pos[0] ;
120       xyze[1] = pos[1] ;
121       xyze[2] = pos[2] ;
122       xyze[3] = gMC->Edep() ;
123
124
125       if ( xyze[3] != 0 ) { // there is deposited energy 
126         gMC->CurrentVolOffID(5, relid[0]) ;  // get the PHOS Module number
127         gMC->CurrentVolOffID(3, relid[1]) ;  // get the Micromegas Module number 
128       // 1-> Geom->GetNumberOfModulesPhi() *  fGeom->GetNumberOfModulesZ() upper                         
129       //  >  fGeom->GetNumberOfModulesPhi()  *  fGeom->GetNumberOfModulesZ() lower
130         gMC->CurrentVolOffID(1, relid[2]) ;  // get the row number of the cell
131         gMC->CurrentVolID(relid[3]) ;        // get the column number 
132
133         // get the absolute Id number
134
135         Int_t absid ; 
136         fGeom->RelToAbsNumbering(relid,absid) ; 
137         
138
139         AddHit(fIshunt, primary, tracknumber, absid, xyze);
140
141       } // there is deposited energy 
142      } // We are inside the gas of the CPV  
143    } // GPS2 configuration
144   
145   if(gMC->CurrentVolID(copy) == gMC->VolId("PXTL") )//  We are inside a PBWO crystal 
146      {
147        gMC->TrackPosition(pos) ;
148        xyze[0] = pos[0] ;
149        xyze[1] = pos[1] ;
150        xyze[2] = pos[2] ;
151        lostenergy = gMC->Edep() ; 
152        xyze[3] = gMC->Edep() ;
153
154        global[0] = pos[0] ;
155        global[1] = pos[1] ;
156        global[2] = pos[2] ;
157
158        if ( xyze[3] != 0 ) {
159           gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ;
160           relid[1] = 0   ;                    // means PW04
161           gMC->CurrentVolOffID(4, relid[2]) ; // get the row number inside the module
162           gMC->CurrentVolOffID(3, relid[3]) ; // get the cell number inside the module
163
164       // get the absolute Id number
165
166           Int_t absid ; 
167           fGeom->RelToAbsNumbering(relid,absid) ; 
168           gMC->Gmtod(global, local, 1) ;
169           
170           // calculating number of electrons in the PIN diode asociated to this hit
171           lightyield = gRandom->Poisson(fLightYieldMean) ;
172           nElectrons = lostenergy * lightyield * fIntrinsicPINEfficiency *
173             exp(-fLightYieldAttenuation * (local[1]+fGeom->GetCrystalSize(1)/2.0 ) ) ;
174
175           xyze[3] = nElectrons * fRecalibrationFactor ;
176           // add current hit to the hit list
177           AddHit(fIshunt, primary, tracknumber, absid, xyze);
178
179        } // there is deposited energy
180     } // we are inside a PHOS Xtal
181
182    if(gMC->CurrentVolID(copy) == gMC->VolId("PPIN") ) // We are inside de PIN diode 
183      {
184        gMC->TrackPosition(pos) ;
185        xyze[0] = pos[0] ;
186        xyze[1] = pos[1] ;
187        xyze[2] = pos[2] ;
188        lostenergy = gMC->Edep() ;
189        xyze[3] = gMC->Edep() ;
190
191        if ( xyze[3] != 0 ) {
192           gMC->CurrentVolOffID(11, relid[0]) ; // get the PHOS module number ;
193           relid[1] = 0   ;                    // means PW04 and PIN
194           gMC->CurrentVolOffID(5, relid[2]) ; // get the row number inside the module
195           gMC->CurrentVolOffID(4, relid[3]) ; // get the cell number inside the module
196
197       // get the absolute Id number
198
199           Int_t absid ; 
200           fGeom->RelToAbsNumbering(relid,absid) ;
201           
202           // calculating number of electrons in the PIN diode asociated to this hit
203           nElectrons = lostenergy * fElectronsPerGeV ;
204           xyze[3] = nElectrons * fRecalibrationFactor ;
205
206           // add current hit to the hit list
207           AddHit(fIshunt, primary, tracknumber, absid, xyze);
208           //printf("PIN volume is  %d, %d, %d, %d \n",relid[0],relid[1],relid[2],relid[3]);
209           //printf("Lost energy in the PIN is %f \n",lostenergy) ;
210        } // there is deposited energy
211     } // we are inside a PHOS XtalPHOS PIN diode
212 }