Use average Xbeam and Ybeam also in 3D vertexer + Updated calculation of generated...
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDPreprocessor.cxx
CommitLineData
56d2de52 1#include "AliHMPIDPreprocessor.h" //header no includes
2#include "AliHMPIDDigit.h" //ProcPed()
21f61e25 3#include "AliHMPIDRawStream.h" //ProcPed()
56d2de52 4#include <Riostream.h> //ProcPed()
ad712d2e 5#include <AliLog.h> //all
56d2de52 6#include <AliCDBMetaData.h> //ProcPed(), ProcDcs()
7#include <AliDCSValue.h> //ProcDcs()
8#include <TObjString.h> //ProcDcs(), ProcPed()
ad712d2e 9#include <TTimeStamp.h> //Initialize()
56d2de52 10#include <TF1.h> //Process()
11#include <TF2.h> //Process()
520ee7b5 12#include <TString.h>
56d2de52 13#include <TGraph.h> //Process()
14#include <TMatrix.h> //ProcPed()
15#include <TList.h> //ProcPed()
16#include <TSystem.h> //ProcPed()
423554a3 17//.
18// HMPID Preprocessor base class
19//.
20//.
21//.
d3da6dc4 22ClassImp(AliHMPIDPreprocessor)
23
24//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
25void AliHMPIDPreprocessor::Initialize(Int_t run, UInt_t startTime,UInt_t endTime)
26{
b38ac33a 27// Initialize the parameter coming from AliPreprocessor
28// run -> run number
29// startTime -> starting time
30// endTime -> ending time
d3da6dc4 31 AliPreprocessor::Initialize(run, startTime, endTime);
ad712d2e 32
33 AliInfo(Form("HMPID started for Run %d \n\tStartTime %s \n\t EndTime %s", run,TTimeStamp(startTime).AsString(),TTimeStamp(endTime).AsString()));
34
d3da6dc4 35}
36//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
abb5f786 37UInt_t AliHMPIDPreprocessor::Process(TMap* pMap)
d3da6dc4 38{
56d2de52 39// Process all information from DCS and DAQ
40// Arguments: pMap- map of DCS aliases
ad712d2e 41// Returns: 0 on success or 1 on error (opposite to Store!)
af66844d 42
9cc1a411 43 TString runType = GetRunType();
ad712d2e 44 Log(Form(" AliHMPIDPreprocessor: RunType is %s",runType.Data()));
af66844d 45
46// start to check event type and procedures
47
48 Log("HMPID - Process in Preprocessor started");
49 if(! pMap) {
50 Log("HMPID - ERROR - Not map of DCS aliases for HMPID - "); return kTRUE; // error in the DCS mapped aliases
51 }
520ee7b5 52 if (runType == "CALIBRATION"){
af66844d 53 if (!ProcPed()){
54 Log("HMPID - ERROR - Pedestal processing failed!!"); return kTRUE; // error in pedestal processing
55 } else {
56 Log("HMPID - Pedestal processing successful!!"); return kFALSE; // ok for pedestals
57 }
520ee7b5 58 } else if ( runType=="STANDALONE" || runType=="PHYSICS"){
f455af6e 59 if (!ProcDcs(pMap)){
af66844d 60 Log("HMPID - ERROR - DCS processing failed!!"); return kTRUE; // error in DCS processing
61 } else {
62 Log("HMPID - DCS processing successful!!"); return kFALSE; // ok for DCS
63 }
9cc1a411 64 } else {
af66844d 65 Log("HMPID - Nothing to do with preprocessor for HMPID, bye!"); return kFALSE; // ok - nothing done
9cc1a411 66 }
56d2de52 67}//Process()
68//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
69Bool_t AliHMPIDPreprocessor::ProcDcs(TMap* pMap)
70{
f455af6e 71// Process: 1 (old). inlet and outlet C6F14 temperature, stores TObjArray of 21 TF1, where TF1 is Nmean=f(t), one per radiator
72// Process: 1. inlet and outlet C6F14 temperature, stores TObjArray of 42 TF1, where TF1 are Tin and Tout per radiator
73// + one function for the mean energy photon (in total 43).
abb5f786 74// 2. CH4 pressure and HV stores TObjArray of 7 TF1 where TF1 is thr=f(t), one per chamber
75// Arguments: pDcsMap - map of structure "alias name" - TObjArray of AliDCSValue
76// Assume that: HV is the same during the run for a given chamber, different chambers might have different HV
a0e5c1b9 77// P=f(t), different for different chambers
56d2de52 78// Returns: kTRUE on success
d3da6dc4 79
ad712d2e 80 Bool_t stDcsStore=kFALSE;
81
56d2de52 82// Qthr=f(HV,P) [V,mBar] logA0=k*HV+b is taken from p. 64 TDR plot 2.59 for PC32
83// A0=f(P) is taken from DiMauro mail
84// Qthr is estimated as 3*A0
f455af6e 85
56d2de52 86 TF2 thr("RthrCH4" ,"3*10^(3.01e-3*x-4.72)+170745848*exp(-y*0.0162012)" ,2000,3000,900,1200);
87
f455af6e 88 TObjArray arNmean(43); arNmean.SetOwner(kTRUE); //42 Tin and Tout one per radiator + 1 for ePhotMean
49881df7 89 TObjArray arQthre(42); arQthre.SetOwner(kTRUE); //42 Qthre=f(time) one per sector
d3da6dc4 90
56d2de52 91 AliDCSValue *pVal; Int_t cnt=0;
32d20573 92
93 Double_t xP,yP;
f357a568 94
f455af6e 95 TF1 **pTin = new TF1*[21];
96 TF1 **pTout = new TF1*[21];
97
32d20573 98// evaluate Environment Pressure
99
100 TObjArray *pPenv=(TObjArray*)pMap->GetValue("HMP_DET/HMP_ENV/HMP_ENV_PENV.actual.value");
dab53e94 101 if(!pPenv) {
102 AliWarning(" No Data Points from HMP_ENV_PENV.actual.value!");
103 return kFALSE;
104 } else {
105 Log(Form(" Environment Pressure data ---> %3i entries",pPenv->GetEntries()));
106 if(pPenv->GetEntries()) {
107 TIter nextPenv(pPenv);
108 TGraph *pGrPenv=new TGraph; cnt=0;
109 while((pVal=(AliDCSValue*)nextPenv())) pGrPenv->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat()); //P env
110 if( cnt==1) {
111 pGrPenv->GetPoint(0,xP,yP);
112 new TF1("Penv",Form("%f",yP),fStartTime,fEndTime);
113 } else {
114 pGrPenv->Fit(new TF1("Penv","1000+x*[0]",fStartTime,fEndTime),"Q");
115 }
116 delete pGrPenv;
117 } else {AliWarning(" No Data Points from HMP_ENV_PENV.actual.value!");return kFALSE;}
118 }
ad712d2e 119// evaluate Pressure
32d20573 120
121 for(Int_t iCh=0;iCh<7;iCh++){
49881df7 122 TObjArray *pP =(TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_GAS/HMP_MP%i_GAS_PMWPC.actual.value",iCh,iCh,iCh));
7b2a49b9 123 Log(Form(" Pressure for module %i data ---> %3i entries",iCh,pP->GetEntries()));
32d20573 124 if(pP->GetEntries()) {
125 TIter nextP(pP);
126 TGraph *pGrP=new TGraph; cnt=0;
127 while((pVal=(AliDCSValue*)nextP())) pGrP->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat()); //P
128 if( cnt==1) {
129 pGrP->GetPoint(0,xP,yP);
130 new TF1(Form("P%i",iCh),Form("%f",yP),fStartTime,fEndTime);
131 } else {
132 pGrP->Fit(new TF1(Form("P%i",iCh),"[0] + x*[1]",fStartTime,fEndTime),"Q");
133 }
134 delete pGrP;
135 } else {AliWarning(" No Data Points from HMP_MP0-6_GAS_PMWPC.actual.value!");return kFALSE;}
afe12692 136
49881df7 137// evaluate High Voltage
32d20573 138
139 for(Int_t iSec=0;iSec<6;iSec++){
140 TObjArray *pHV=(TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_PW/HMP_MP%i_SEC%i/HMP_MP%i_SEC%i_HV.actual.vMon",iCh,iCh,iCh,iSec,iCh,iSec));
7b2a49b9 141 Log(Form(" HV for module %i and secto %i data ---> %3i entries",iCh,iSec,pHV->GetEntries()));
32d20573 142 if(pHV->GetEntries()) {
143 TIter nextHV(pHV);
144 TGraph *pGrHV=new TGraph; cnt=0;
145 while((pVal=(AliDCSValue*)nextHV())) pGrHV->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat()); //HV
146 if( cnt==1) {
147 pGrHV->GetPoint(0,xP,yP);
148 new TF1(Form("HV%i_%i",iCh,iSec),Form("%f",yP),fStartTime,fEndTime);
149 } else {
150 pGrHV->Fit(new TF1(Form("HV%i_%i",iCh,iSec),"[0]+x*[1]",fStartTime,fEndTime),"Q");
151 }
152 delete pGrHV;
153 } else {AliWarning(" No Data Points from HMP_MP0-6_SEC0-5_HV.actual.vMon!");return kFALSE;}
154
ad712d2e 155// evaluate Qthre
32d20573 156
157 arQthre.AddAt(new TF1(Form("HMP_QthreC%iS%i",iCh,iSec),
158 Form("3*10^(3.01e-3*HV%i_%i - 4.72)+170745848*exp(-(P%i+Penv)*0.0162012)",iCh,iSec,iCh),fStartTime,fEndTime),6*iCh+iSec);
49881df7 159 }
32d20573 160// evaluate Temperatures: in and out of the radiators
32d20573 161 // T in
d3da6dc4 162 for(Int_t iRad=0;iRad<3;iRad++){
f455af6e 163
164 pTin[3*iCh+iRad] = new TF1(Form("Tin%i%i" ,iCh,iRad),"[0]+[1]*x",fStartTime,fEndTime);
165 pTout[3*iCh+iRad] = new TF1(Form("Tout%i%i",iCh,iRad),"[0]+[1]*x",fStartTime,fEndTime);
166
32d20573 167 TObjArray *pT1=(TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_LIQ_LOOP.actual.sensors.Rad%iIn_Temp",iCh,iCh,iRad));
7b2a49b9 168 Log(Form(" Temperatures for module %i inside data ---> %3i entries",iCh,pT1->GetEntries()));
32d20573 169 if(pT1->GetEntries()) {
170 TIter nextT1(pT1);//Tin
171 TGraph *pGrT1=new TGraph; cnt=0; while((pVal=(AliDCSValue*)nextT1())) pGrT1->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat()); //T inlet
172 if(cnt==1) {
173 pGrT1->GetPoint(0,xP,yP);
f455af6e 174 pTin[3*iCh+iRad]->SetParameter(0,yP);
175 pTin[3*iCh+iRad]->SetParameter(1,0);
32d20573 176 } else {
f455af6e 177 pGrT1->Fit(pTin[3*iCh+iRad],"Q");
32d20573 178 }
179 delete pGrT1;
180 } else {AliWarning(" No Data Points from HMP_MP0-6_LIQ_LOOP.actual.sensors.Rad0-2In_Temp!");return kFALSE;}
181 // T out
182 TObjArray *pT2=(TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_LIQ_LOOP.actual.sensors.Rad%iOut_Temp",iCh,iCh,iRad));
7b2a49b9 183 Log(Form(" Temperatures for module %i outside data ---> %3i entries",iCh,pT2->GetEntries()));
32d20573 184 if(pT2->GetEntries()) {
185 TIter nextT2(pT2);//Tout
186 TGraph *pGrT2=new TGraph; cnt=0; while((pVal=(AliDCSValue*)nextT2())) pGrT2->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat()); //T outlet
187 if(cnt==1) {
188 pGrT2->GetPoint(0,xP,yP);
f455af6e 189 pTout[3*iCh+iRad]->SetParameter(0,yP);
190 pTout[3*iCh+iRad]->SetParameter(1,0);
32d20573 191 } else {
f455af6e 192 pGrT2->Fit(pTout[3*iCh+iRad],"Q");
32d20573 193 }
194 delete pGrT2;
195 } else {AliWarning(" No Data Points from HMP_MP0-6_LIQ_LOOP.actual.sensors.Rad0-2Out_Temp!");return kFALSE;}
43724042 196
ad712d2e 197// evaluate Mean Refractive Index
32d20573 198
f455af6e 199 arNmean.AddAt(pTin[3*iCh+iRad] ,6*iCh+2*iRad ); //Tin =f(t)
200 arNmean.AddAt(pTout[3*iCh+iRad],6*iCh+2*iRad+1); //Tout=f(t)
32d20573 201
d3da6dc4 202 }//radiators loop
203 }//chambers loop
204
f455af6e 205 Double_t eMean = ProcTrans(pMap);
206 arNmean.AddAt(new TF1("HMP_PhotEmean",Form("%f",eMean),fStartTime,fEndTime),42); //Photon energy mean
207
ad712d2e 208 AliCDBMetaData metaData;
209 metaData.SetBeamPeriod(0);
210 metaData.SetResponsible("AliHMPIDPreprocessor");
b7c14c1c 211 metaData.SetComment("HMPID preprocessor fills TObjArrays.");
ad712d2e 212
8f2dafcf 213 stDcsStore = Store("Calib","Qthre",&arQthre,&metaData,0,kTRUE) && // from DCS 0,kTRUE generates the file from Run 0 to Run 99999999
214 Store("Calib","Nmean",&arNmean,&metaData,0,kTRUE); // from DCS
215// stDcsStore = Store("Calib","Qthre",&arQthre,&metaData) && // from DCS
216// Store("Calib","Nmean",&arNmean,&metaData); // from DCS
ad712d2e 217 if(!stDcsStore) {
218 Log("HMPID - failure to store DCS data results in OCDB");
219 }
f455af6e 220
221// arNmean.Delete();
222// arQthre.Delete();
223
224// for(Int_t i=0;i<21;i++) delete pTin[i]; delete []pTin;
225// for(Int_t i=0;i<21;i++) delete pTout[i]; delete []pTout;
226
ad712d2e 227 return stDcsStore;
d3da6dc4 228}//Process()
229//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
56d2de52 230Bool_t AliHMPIDPreprocessor::ProcPed()
231{
232// Process pedestal files and create 7 M(padx,pady)=sigma, one for each chamber
233// Arguments:
48558cb5 234// Returns: kTRUE on success
ad712d2e 235
236 Bool_t stPedStore=kFALSE;
56d2de52 237 AliHMPIDDigit dig;
21f61e25 238 AliHMPIDRawStream rs;
56d2de52 239 Int_t nSigCut,r,d,a,hard; Float_t mean,sigma;
7c912209 240 Int_t runNumber,ldcId,timeStamp,nEv,nDdlEv,nBadEv; Char_t tName[10];
241 Float_t nBadEvPer;
48558cb5 242
243 TObjArray aDaqSig(7); aDaqSig.SetOwner(kTRUE); for(Int_t i=0;i<7;i++) aDaqSig.AddAt(new TMatrix(160,144),i); //TObjArray of 7 TMatrixF, m(padx,pady)=sigma
244
245 for(Int_t iddl=0;iddl<AliHMPIDRawStream::kNDDL;iddl++) //retrieve the files from LDCs independently the DDL<->LDC connection
246 {
247 TList *pLdc=GetFileSources(kDAQ,Form("HmpidPedDdl%02i.txt",iddl)); //get list of LDC names containing id "pedestals"
248 if(!pLdc) {Log(Form("ERROR: Retrieval of sources for pedestals: HmpidPedDdl%02i.txt failed!",iddl));continue;}
9477d3cd 249
48558cb5 250 Log(Form("HMPID - Pedestal files to be read --> %i LDCs for HMPID",pLdc->GetEntries()));
251 for(Int_t i=0;i<pLdc->GetEntries();i++) {//lists of LDCs -- but in general we have 1 LDC for 1 ped file
252 TString fileName = GetFile(kDAQ,Form("HmpidPedDdl%02i.txt",iddl),((TObjString*)pLdc->At(i))->GetName());
253 if(fileName.Length()==0) {Log(Form("ERROR retrieving pedestal file: HmpidPedDdl%02i.txt!",iddl));continue;}
b7c14c1c 254
48558cb5 255 //reading pedestal file
70e96725 256 ifstream infile(fileName.Data());
257
48558cb5 258 if(!infile.is_open()) {Log("No pedestal file found for HMPID,bye!");continue;}
259 TMatrix *pM=(TMatrixF*)aDaqSig.At(iddl/2);
260
70e96725 261 infile>>tName>>runNumber;Printf("Xcheck: reading run %i",runNumber);
9477d3cd 262 infile>>tName>>ldcId;
263 infile>>tName>>timeStamp;
264 infile>>tName>>nEv;
7c912209 265 infile>>tName>>nDdlEv;
266 infile>>tName>>nBadEv;
267 infile>>tName>>nBadEvPer;
b7c14c1c 268 infile>>tName>>nSigCut; pM->SetUniqueID(nSigCut); //n. of pedestal distribution sigmas used to create zero suppresion table
56d2de52 269 while(!infile.eof()){
ec575c20 270 infile>>dec>>r>>d>>a>>mean>>sigma>>hex>>hard;
df8ff88a 271 if(rs.GetPad(iddl,r,d,a)>=0){ //the GetPad returns meaningful abs pad number
ec575c20 272 dig.SetPad(rs.GetPad(iddl,r,d,a));
273 dig.SetQ((Int_t)mean);
ab5ca5d6 274 (*pM)(dig.PadChX(),dig.PadChY()) = sigma;
df8ff88a 275 }
56d2de52 276 }
277 infile.close();
48558cb5 278 Log(Form("Pedestal file for DDL %i read successfully",iddl));
ad712d2e 279
48558cb5 280 }//LDCs reading entries
281
282 }//DDL
283
ad712d2e 284 AliCDBMetaData metaData;
285 metaData.SetBeamPeriod(0);
286 metaData.SetResponsible("AliHMPIDPreprocessor");
48558cb5 287 metaData.SetComment("HMPID processor fills TObjArrays.");
ad712d2e 288 stPedStore = Store("Calib","DaqSig",&aDaqSig,&metaData,0,kTRUE);
8f2dafcf 289// stPedStore = Store("Calib","DaqSig",&aDaqSig,&metaData);
ad712d2e 290 if(!stPedStore) {
291 Log("HMPID - failure to store PEDESTAL data results in OCDB");
292 }
293 return stPedStore;
294
56d2de52 295}//ProcPed()
296//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f455af6e 297Double_t AliHMPIDPreprocessor::ProcTrans(TMap* pMap)
56d2de52 298{
f455af6e 299 // Process transparency monitoring data and calculates Emean
300
301
302 Double_t sEnergProb=0, sProb=0;
303
304 Double_t tRefCR5 = 19. ; // mean temperature of CR5 where the system is in place
305
306 Double_t eMean = 0;
307
308 AliDCSValue *pVal;
309
310 for(Int_t i=0; i<30; i++){
311
312 // evaluate wavelenght
313 TObjArray *pWaveLenght = (TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_INFR/HMP_INFR_TRANPLANT/HMP_INFR_TRANPLANT_MEASURE.measure[%i].waveLenght",i));
314 TIter NextWl(pWaveLenght); pVal=(AliDCSValue*)NextWl();
315 Double_t lambda = pVal->GetFloat();
316
317 Double_t photEn = 1239.842609/lambda; // 1239.842609 from nm to eV
318
319 if(photEn<AliHMPIDParam::EPhotMin() || photEn>AliHMPIDParam::EPhotMax()) continue;
320
321 // evaluate phototube current for argon reference
322 TObjArray *pArgonRef = (TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_INFR/HMP_INFR_TRANPLANT/HMP_INFR_TRANPLANT_MEASURE.measure[%i].argonReference",i));
323 TIter NextArRef(pArgonRef); pVal=(AliDCSValue*)NextArRef();
324 Double_t aRefArgon = pVal->GetFloat();
325
326 // evaluate phototube current for argon cell
327 TObjArray *pArgonCell = (TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_INFR/HMP_INFR_TRANPLANT/HMP_INFR_TRANPLANT_MEASURE.measure[%i].argonCell",i));
328 TIter NextArCell(pArgonCell); pVal=(AliDCSValue*)NextArCell();
329 Double_t aCellArgon = pVal->GetFloat();
330
331 //evaluate phototube current for freon reference
332 TObjArray *pFreonRef = (TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_INFR/HMP_INFR_TRANPLANT/HMP_INFR_TRANPLANT_MEASURE.measure[%i].c6f14Reference",i));
333 TIter NextFrRef(pFreonRef); pVal=(AliDCSValue*)NextFrRef();
334 Double_t aRefFreon = pVal->GetFloat();
335
336 //evaluate phototube current for freon cell
337 TObjArray *pFreonCell = (TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_INFR/HMP_INFR_TRANPLANT/HMP_INFR_TRANPLANT_MEASURE.measure[%i].c6f14Cell",i));
338 TIter NextFrCell(pFreonCell); pVal=(AliDCSValue*)NextFrCell();
339 Double_t aCellFreon = pVal->GetFloat();
340
341 //evaluate correction factor to calculate trasparency (Ref. NIMA 486 (2002) 590-609)
342
343 Double_t aN1 = AliHMPIDParam::NIdxRad(photEn,tRefCR5);
344 Double_t aN2 = AliHMPIDParam::NMgF2Idx(photEn);
345 Double_t aN3 = 1; // Argon Idx
346
347 Double_t aR1 = ((aN1 - aN2)*(aN1 - aN2))/((aN1 + aN2)*(aN1 + aN2));
348 Double_t aR2 = ((aN2 - aN3)*(aN2 - aN3))/((aN2 + aN3)*(aN2 + aN3));
349 Double_t aT1 = (1 - aR1);
350 Double_t aT2 = (1 - aR2);
351 Double_t aCorrFactor = (aT1*aT1)/(aT2*aT2);
352
353 // evaluate 15 mm of thickness C6F14 Trans
354 Double_t aTransRad;
355
356 if(aRefFreon*aRefArgon>0) {
357 aTransRad = TMath::Power((aCellFreon/aRefFreon)/(aCellArgon/aRefArgon)*aCorrFactor,1.5);
358 } else {
359 return DefaultEMean();
360 }
361
362 // evaluate 0.5 mm of thickness SiO2 Trans
363 Double_t aTransSiO2 = TMath::Exp(-0.5/AliHMPIDParam::LAbsWin(photEn));
364
365 // evaluate 80 cm of thickness Gap (low density CH4) transparency
366 Double_t aTransGap = TMath::Exp(-80./AliHMPIDParam::LAbsGap(photEn));
367
368 // evaluate CsI quantum efficiency
369 Double_t aCsIQE = AliHMPIDParam::QEffCSI(photEn);
370
371 // evaluate total convolution of all material optical properties
372 Double_t aTotConvolution = aTransRad*aTransSiO2*aTransGap*aCsIQE;
373
374 sEnergProb+=aTotConvolution*photEn;
375
376 sProb+=aTotConvolution;
377}
378
379 if(sProb>0) {
380 eMean = sEnergProb/sProb;
381 } else {
382 return DefaultEMean();
383 }
384
385 Log(Form(" Mean energy photon calculated ---> %f eV ",eMean));
386
387 if(eMean<AliHMPIDParam::EPhotMin() || eMean>AliHMPIDParam::EPhotMax()) return DefaultEMean();
388
56d2de52 389 return eMean;
f455af6e 390
56d2de52 391}
392//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f455af6e 393Double_t AliHMPIDPreprocessor::DefaultEMean()
394{
395 Double_t eMean = 6.675; //just set a refractive index for C6F14 at ephot=6.675 eV @ T=25 C
396 AliWarning(Form("Mean energy for photons out of range [%f,%f] in Preprocessor. Default value Eph=%f eV taken.",AliHMPIDParam::EPhotMin(),
397 AliHMPIDParam::EPhotMax(),
398 eMean));
399 return eMean;
400}