]>
Commit | Line | Data |
---|---|---|
2f4cac02 | 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 notifce * | |
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: AliJPhoton.cxx,v 1.2 2008/01/21 11:56:39 djkim Exp $ | |
17 | ||
18 | //////////////////////////////////////////////////// | |
19 | // | |
20 | // \file AliJPhoton.cxx | |
21 | // \brief | |
22 | // \author J. Rak, D.J.Kim, R.Diaz (University of Jyvaskyla) | |
23 | // \email: djkim@jyu.fi | |
24 | // \version $Revision: 1.1 $ | |
25 | // \date $Date: 2008/05/02 11:56:39 $ | |
26 | // | |
27 | // class for alice photons | |
28 | //////////////////////////////////////////////////// | |
29 | ||
30 | #include <iostream> | |
31 | #include <fstream> | |
32 | #include <stdlib.h> | |
33 | #include <stdio.h> | |
34 | ||
35 | #include <TFormula.h> | |
36 | #include "JConst.h" | |
37 | #include "AliPhJBaseTrack.h" | |
38 | #include "AliPhJPhoton.h" | |
39 | #include "AliJPhoton.h" | |
40 | ||
41 | ||
42 | //ClassImp(AliJPhoton) | |
43 | ||
44 | ||
45 | //______________________________________________________________________________ | |
46 | AliJPhoton::AliJPhoton() : | |
47 | AliPhJPhoton(), | |
48 | fCaloType(kUndef), | |
49 | fDistToBadChannel(-999), | |
50 | fDispersion(-999), | |
51 | fM20(-999), | |
52 | fM02(-999), | |
53 | fEmcCpvDist(-999), | |
54 | fNCells(0), | |
55 | fSuperModuleId(-999), | |
56 | fCellsAbsId(0x0), | |
57 | fCellsAmpFraction(0x0), | |
58 | fMCid(-999) | |
59 | { | |
60 | // default constructor | |
61 | for(Int_t i=0;i<kUnknownAli+1;i++) fCaloPID[i]=-1; | |
62 | ||
63 | SetPID((Double_t*)NULL); | |
64 | } | |
65 | ||
66 | //______________________________________________________________________________ | |
67 | AliJPhoton::AliJPhoton(const AliJPhoton& a): | |
68 | AliPhJPhoton(a), | |
69 | fCaloType(a.fCaloType), | |
70 | fDistToBadChannel(a.fDistToBadChannel), | |
71 | fDispersion(a.fDispersion), | |
72 | fM20(a.fM20), | |
73 | fM02(a.fM02), | |
74 | fEmcCpvDist(a.fEmcCpvDist), | |
75 | fNCells(a.fNCells), | |
76 | fSuperModuleId(a.fSuperModuleId), | |
77 | fCellsAbsId(a.fCellsAbsId), | |
78 | fCellsAmpFraction(a.fCellsAmpFraction), | |
79 | fMCid(a.fMCid) | |
80 | { | |
81 | //copy contructor | |
82 | for(Int_t i=0;i<kUnknownAli+1;i++) fCaloPID[i] = a.fCaloPID[i]; | |
83 | } | |
84 | ||
85 | //______________________________________________________________________________ | |
86 | void AliJPhoton::SetCellsAbsId(const UShort_t *array) | |
87 | { | |
88 | // Set the array of cell absId numbers | |
89 | if (fNCells) { | |
90 | fCellsAbsId = new UShort_t[fNCells]; | |
91 | for (Int_t i = 0; i < fNCells; i++) fCellsAbsId[i] = array[i]; | |
92 | } | |
93 | } | |
94 | ||
95 | //_______________________________________________________________________ | |
96 | void AliJPhoton::SetCellsAmplitudeFraction(const Double32_t *array) | |
97 | { | |
98 | // Set the array of cell amplitude fraction | |
99 | if (fNCells) { | |
100 | fCellsAmpFraction = new Double32_t[fNCells]; | |
101 | for (Int_t i = 0; i < fNCells; i++) fCellsAmpFraction[i] = array[i]; | |
102 | } | |
103 | } | |
104 | ||
105 | //______________________________________________________________________________ | |
106 | void AliJPhoton::SetPID(const Double_t *pid) { | |
107 | //set pid | |
108 | if(pid){ | |
109 | for(Int_t i=0; i<kUnknownAli+1; ++i) fCaloPID[i]=pid[i]; | |
110 | SetProbPhot(fCaloPID[kPhotonAli]); | |
111 | }else{ | |
112 | for(Int_t i=0; i<kUnknownAli+1; fCaloPID[i++]=0.){} | |
113 | fCaloPID[kUnknownAli]=1.; | |
114 | } | |
115 | } | |
116 | ||
117 | ||
118 | //______________________________________________________________________________ | |
119 | particleType AliJPhoton::GetParticleType() { | |
120 | ||
121 | // return the most problable particle type | |
122 | // Note: following the AliCaloPID implementation | |
123 | ||
124 | //Init default weights | |
125 | Float_t wPhoton = 0.75 ; | |
126 | Float_t wPi0 = 0.8 ; | |
127 | Float_t wElectron = 0.5 ; | |
128 | Float_t wCharged = 0.5 ; | |
129 | Float_t wNeutral = 0.5 ; | |
130 | ||
131 | Bool_t usePHOSweightFormula = kTRUE; | |
132 | //Formula to set the PID weight threshold for photon or pizero | |
133 | // ALICE-INT-2005-016 (2007) | |
134 | TFormula* wPhotonPHOSFormula = | |
135 | new TFormula("photonWeight","0.75*(x<40)+ 0.68*(x>=100)+(x>=40 && x<100)*(0.98+x*(6e-3)-x*x*(2e-04)+x*x*x*(1.1e-06))"); | |
136 | TFormula* wPi0PHOSFormula = | |
137 | new TFormula("pi0Weight","0.80*(x<65)+ 0.915*(x>=100)+(x>=65 && x-x*(1.95e-3)-x*x*(4.31e-05)+x*x*x*(3.61e-07))"); | |
138 | ||
139 | if(fCaloType == kPHOSCalo && usePHOSweightFormula){ | |
140 | wPhoton = wPhotonPHOSFormula->Eval(GetE()) ; | |
141 | wPi0 = wPi0PHOSFormula->Eval(GetE()); | |
142 | // cout << "wPhotonF " << wPhoton << " wphoton " << fCaloPID[kPhotonAli] << " wPi0F " << wPi0 << " wpi0 " << fCaloPID[kPi0Ali] << endl; | |
143 | } | |
144 | ||
145 | if(fCaloType == kEMCALCalo){ | |
146 | wPhoton = 0.8 ; | |
147 | wPi0 = 0.5 ; | |
148 | wElectron = 0.8 ; | |
149 | wCharged = 0.5 ; | |
150 | wNeutral = 0.5 ; | |
151 | } | |
152 | ||
153 | ||
154 | particleType pdg = kHadron; | |
155 | ||
156 | //Select most probable ID | |
157 | if(fCaloType == kPHOSCalo){ | |
158 | if(fCaloPID[kPhotonAli] > wPhoton) pdg = kPhoton ; | |
159 | else if(fCaloPID[kPi0Ali] > wPi0) pdg = kPizero ; | |
160 | //else if(fCaloPID[kElectronAli] > wElectron) pdg = electron ; | |
161 | //else if(fCaloPID[kEleConAli] > wElectron) pdg = electronCon ; | |
162 | //else if(chargedHadronWeight > wCharged) pdg = chargedHadron ; | |
163 | //else if(neutralHadronWeight > wNeutral) pdg = neutralHadron ; | |
164 | //else if(allChargedWeight > allNeutralWeight) | |
165 | // pdg = chargedUnknown ; | |
166 | //else | |
167 | // pdg = neutralUnknown ; | |
168 | } | |
169 | else{//EMCAL | |
170 | //Temporal solution, electrons and photons not differenciated | |
171 | if(fCaloPID[kPhotonAli] + fCaloPID[kElectronAli] > wPhoton) pdg = kPhoton ; | |
172 | else if(fCaloPID[kPi0Ali] > wPi0) pdg = kPizero ; | |
173 | //else if(chargedHadronWeight + neutralHadronWeight > wCharged) pdg = chargedHadron ; | |
174 | //else if(neutralHadronWeight + chargedHadronWeight > wNeutral) pdg = neutralHadron ; | |
175 | //else pdg = neutralUnknown ; | |
176 | ||
177 | } | |
178 | ||
179 | delete wPhotonPHOSFormula; | |
180 | delete wPi0PHOSFormula; | |
181 | ||
182 | //if(fCaloType == kPHOSCalo) cout << "pdg " << pdg << endl; | |
183 | ||
184 | return pdg ; | |
185 | ||
186 | } | |
187 | ||
188 | //_____________________________________________________________________________ | |
189 | AliJPhoton& AliJPhoton::operator=(const AliJPhoton& photon){ | |
190 | //overloaded = | |
191 | if(this != &photon) { | |
192 | AliPhJPhoton::operator=(photon); | |
193 | fCaloType = photon.fCaloType; | |
194 | for(Int_t i=0; i<kUnknownAli+1; i++){ | |
195 | fCaloPID[i] = photon.fCaloPID[i]; | |
196 | } | |
197 | fDistToBadChannel = photon.fDistToBadChannel; | |
198 | fDispersion = photon.fDispersion; | |
199 | fM20 = photon.fM20; | |
200 | fM02 = photon.fM02; | |
201 | fEmcCpvDist = photon.fEmcCpvDist; | |
202 | fNCells = photon.fNCells; | |
203 | fSuperModuleId = photon.fSuperModuleId; | |
204 | fCellsAbsId = photon.fCellsAbsId; | |
205 | fCellsAmpFraction = photon.fCellsAmpFraction; | |
206 | fMCid = photon.fMCid; | |
207 | } | |
208 | return *this; | |
209 | } | |
210 |