]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSv1.cxx
cosmetics only
[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   Int_t primary =  gAlice->GetPrimary( gAlice->CurrentTrack() ); 
103
104   if ( name == "GPS2" ) { // the CPV is a PPSD
105     if( gMC->CurrentVolID(copy) == gMC->VolId("GCEL") )
106     //     if( strcmp ( gMC->CurrentVolName(), "GCEL" ) == 0 )  // We are inside a gas cell 
107     {
108       gMC->TrackPosition(pos) ;
109       xyze[0] = pos[0] ;
110       xyze[1] = pos[1] ;
111       xyze[2] = pos[2] ;
112       xyze[3] = gMC->Edep() ;
113
114
115       if ( xyze[3] != 0 ) { // there is deposited energy 
116         gMC->CurrentVolOffID(5, relid[0]) ;  // get the PHOS Module number
117         gMC->CurrentVolOffID(3, relid[1]) ;  // get the Micromegas Module number 
118       // 1-> Geom->GetNumberOfModulesPhi() *  fGeom->GetNumberOfModulesZ() upper                         
119       //  >  fGeom->GetNumberOfModulesPhi()  *  fGeom->GetNumberOfModulesZ() lower
120         gMC->CurrentVolOffID(1, relid[2]) ;  // get the row number of the cell
121         gMC->CurrentVolID(relid[3]) ;        // get the column number 
122
123         // get the absolute Id number
124
125         Int_t absid ; 
126         fGeom->RelToAbsNumbering(relid,absid) ; 
127         
128
129         AddHit(primary, absid, xyze );
130
131       } // there is deposited energy 
132      } // We are inside the gas of the CPV  
133    } // GPS2 configuration
134   
135    if(gMC->CurrentVolID(copy) == gMC->VolId("PXTL") ) 
136   //      if( strcmp ( gMC->CurrentVolName(), "PXTL" ) == 0 ) { //  We are inside a PWO crystal
137      {
138        gMC->TrackPosition(pos) ;
139        xyze[0] = pos[0] ;
140        xyze[1] = pos[1] ;
141        xyze[2] = pos[2] ;
142        lostenergy = gMC->Edep() ; 
143        xyze[3] = gMC->Edep() ;
144
145        global[0] = pos[0] ;
146        global[1] = pos[1] ;
147        global[2] = pos[2] ;
148
149        if ( xyze[3] != 0 ) {
150           gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ;
151           relid[1] = 0   ;                    // means PW04
152           gMC->CurrentVolOffID(4, relid[2]) ; // get the row number inside the module
153           gMC->CurrentVolOffID(3, relid[3]) ; // get the cell number inside the module
154
155       // get the absolute Id number
156
157           Int_t absid ; 
158           fGeom->RelToAbsNumbering(relid,absid) ; 
159           gMC->Gmtod(global, local, 1) ;
160           
161           // calculating number of electrons in the PIN diode asociated to this hit
162           lightyield = gRandom->Poisson(fLightYieldMean) ;
163           nElectrons = lostenergy * lightyield * fIntrinsicPINEfficiency *
164             exp(-fLightYieldAttenuation * (local[1]+fGeom->GetCrystalSize(1)/2.0 ) ) ;
165
166           xyze[3] = nElectrons * fRecalibrationFactor ;
167           // add current hit to the hit list
168           AddHit(primary, absid, xyze);
169     
170        } // there is deposited energy
171     } // we are inside a PHOS Xtal
172
173    if(gMC->CurrentVolID(copy) == gMC->VolId("PPIN") ) // We are inside de PIN diode 
174      {
175        gMC->TrackPosition(pos) ;
176        xyze[0] = pos[0] ;
177        xyze[1] = pos[1] ;
178        xyze[2] = pos[2] ;
179        lostenergy = gMC->Edep() ;
180        xyze[3] = gMC->Edep() ;
181
182        if ( xyze[3] != 0 ) {
183           gMC->CurrentVolOffID(11, relid[0]) ; // get the PHOS module number ;
184           relid[1] = 0   ;                    // means PW04and PIN
185           gMC->CurrentVolOffID(5, relid[2]) ; // get the row number inside the module
186           gMC->CurrentVolOffID(4, relid[3]) ; // get the cell number inside the module
187
188       // get the absolute Id number
189
190           Int_t absid ; 
191           fGeom->RelToAbsNumbering(relid,absid) ;
192           
193           // calculating number of electrons in the PIN diode asociated to this hit
194           nElectrons = lostenergy * fElectronsPerGeV ;
195           xyze[3] = nElectrons * fRecalibrationFactor ;
196
197           // add current hit to the hit list
198           AddHit(primary, absid, xyze);
199           //printf("PIN volume is  %d, %d, %d, %d \n",relid[0],relid[1],relid[2],relid[3]);
200           //printf("Lost energy in the PIN is %f \n",lostenergy) ;
201        } // there is deposited energy
202     } // we are inside a PHOS XtalPHOS PIN diode
203 }
204