]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HMPID/AliHMPIDPreprocessor.cxx
Added deletions of AliPID object to avoid meamory leak
[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()));
74521328 45 Bool_t statusNoise=kFALSE, statusDcs=kFALSE;
af66844d 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 }
74521328 58 }//CALIBRATION
59 else if ( runType=="STANDALONE" || runType=="PHYSICS"){
60 statusDcs=ProcDcs(pMap);
61 statusNoise=ProcNoiseMap();
62 if(!statusDcs || !statusNoise) { Log(Form("HMPID - ERROR - Noise Map(%d) and/or DCS(%d) processing failed!! (0=OK, 1=FAILED)",statusNoise,statusDcs)); return kTRUE; } // error in Noise Map or DCS processing
63 else { Log("HMPID - Noise Map and DCS processing successful!!"); return kFALSE;} // ok
64 }//STANDALONE or PHYSICS run
65 else {
af66844d 66 Log("HMPID - Nothing to do with preprocessor for HMPID, bye!"); return kFALSE; // ok - nothing done
9cc1a411 67 }
56d2de52 68}//Process()
69//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
74521328 70Bool_t AliHMPIDPreprocessor::ProcNoiseMap()
71{
72 //
73 // Goal: Process the Noise Map created by the HMP Physics DA to mask
74 // noisy channels from reconstruction and follow changes in accepatnce
75 // eg. DDL turn on/off after PEDESTAL run and between PHYSICS runs.
76 // Returns kFALSE on success
77
b637e7dc 78 Bool_t stProcNoise=kFALSE;
74521328 79 TFile *fNoiseFile;
80 TH2F *hNoiseMap = 0x0;
81
82 TList *pNoiseSource=GetFileSources(kDAQ,"HmpPhysicsDaNoiseMap.root"); //get list of DAQ source names containing id "HmpPhysicsDaNoiseMap" --> defined in HMPIDphysda.cxx
83 if(!pNoiseSource) {Log(Form("ERROR: Retrieval of sources for noise map: HmpPhysicsDaNoiseMap.root is failed!")); return stProcNoise;}
d3a1a017 84 if(!(TObjString*)pNoiseSource->At(0)) {Log(Form("ERROR: empty list received from DAQ Source!")); return stProcNoise;}
85
74521328 86 TString noiseFile = GetFile(kDAQ,Form("HmpPhysicsDaNoiseMap.root"),((TObjString*)pNoiseSource->At(0))->GetName());
87 if(noiseFile.Length()==0) {Log(Form("ERROR retrieving noise map file: HmpPhysicsDaNoiseMap.root")); return stProcNoise;}
88
89 fNoiseFile = TFile::Open(noiseFile.Data(),"read");
90 if(!fNoiseFile) {Log(Form("ERROR cannot open NoiseFile: %s!",noiseFile.Data())); return stProcNoise;}
91 hNoiseMap = (TH2F*) fNoiseFile->Get("hHmpNoiseMaps");
92
93 AliCDBMetaData metaDataHisto;
94 metaDataHisto.SetBeamPeriod(0);
95 metaDataHisto.SetResponsible("AliHMPIDPreprocessor");
96 metaDataHisto.SetComment("AliHMPIDPreprocessor stores the Noise Map object as Reference Data.");
97 AliInfo("Storing Reference Data");
98 stProcNoise = Store("Calib","NoiseMap",hNoiseMap,&metaDataHisto,0,kTRUE);
99 if(!stProcNoise) {
b637e7dc 100 Log("HMPID - failure to store Noise Map data results in OCDB");
74521328 101 }
b637e7dc 102 return stProcNoise;
74521328 103}//ProcNoiseMap
104//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
56d2de52 105Bool_t AliHMPIDPreprocessor::ProcDcs(TMap* pMap)
106{
f455af6e 107// Process: 1 (old). inlet and outlet C6F14 temperature, stores TObjArray of 21 TF1, where TF1 is Nmean=f(t), one per radiator
108// Process: 1. inlet and outlet C6F14 temperature, stores TObjArray of 42 TF1, where TF1 are Tin and Tout per radiator
109// + one function for the mean energy photon (in total 43).
abb5f786 110// 2. CH4 pressure and HV stores TObjArray of 7 TF1 where TF1 is thr=f(t), one per chamber
111// Arguments: pDcsMap - map of structure "alias name" - TObjArray of AliDCSValue
112// Assume that: HV is the same during the run for a given chamber, different chambers might have different HV
a0e5c1b9 113// P=f(t), different for different chambers
56d2de52 114// Returns: kTRUE on success
d3da6dc4 115
ad712d2e 116 Bool_t stDcsStore=kFALSE;
117
56d2de52 118// Qthr=f(HV,P) [V,mBar] logA0=k*HV+b is taken from p. 64 TDR plot 2.59 for PC32
119// A0=f(P) is taken from DiMauro mail
120// Qthr is estimated as 3*A0
f455af6e 121
56d2de52 122 TF2 thr("RthrCH4" ,"3*10^(3.01e-3*x-4.72)+170745848*exp(-y*0.0162012)" ,2000,3000,900,1200);
123
f455af6e 124 TObjArray arNmean(43); arNmean.SetOwner(kTRUE); //42 Tin and Tout one per radiator + 1 for ePhotMean
49881df7 125 TObjArray arQthre(42); arQthre.SetOwner(kTRUE); //42 Qthre=f(time) one per sector
d3da6dc4 126
a086e874 127 AliDCSValue *pVal; Int_t cnt=0;
32d20573 128
a086e874 129 Double_t xP,yP;
f357a568 130
f455af6e 131 TF1 **pTin = new TF1*[21];
132 TF1 **pTout = new TF1*[21];
133
32d20573 134// evaluate Environment Pressure
a086e874 135
32d20573 136 TObjArray *pPenv=(TObjArray*)pMap->GetValue("HMP_DET/HMP_ENV/HMP_ENV_PENV.actual.value");
dab53e94 137 if(!pPenv) {
138 AliWarning(" No Data Points from HMP_ENV_PENV.actual.value!");
139 return kFALSE;
140 } else {
141 Log(Form(" Environment Pressure data ---> %3i entries",pPenv->GetEntries()));
142 if(pPenv->GetEntries()) {
143 TIter nextPenv(pPenv);
144 TGraph *pGrPenv=new TGraph; cnt=0;
145 while((pVal=(AliDCSValue*)nextPenv())) pGrPenv->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat()); //P env
146 if( cnt==1) {
147 pGrPenv->GetPoint(0,xP,yP);
148 new TF1("Penv",Form("%f",yP),fStartTime,fEndTime);
149 } else {
150 pGrPenv->Fit(new TF1("Penv","1000+x*[0]",fStartTime,fEndTime),"Q");
151 }
152 delete pGrPenv;
153 } else {AliWarning(" No Data Points from HMP_ENV_PENV.actual.value!");return kFALSE;}
a086e874 154 }
ad712d2e 155// evaluate Pressure
32d20573 156
157 for(Int_t iCh=0;iCh<7;iCh++){
a086e874 158 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));
785f7d56 159 if(!pP) {
160 AliWarning(Form(" No Data Points from HMP_MP%1i_GAS_PMWPC.actual.value!",iCh));
161 return kFALSE;
162 } else {
163 Log(Form(" Pressure for module %i data ---> %3i entries",iCh,pP->GetEntries()));
164 if(pP->GetEntries()) {
165 TIter nextP(pP);
166 TGraph *pGrP=new TGraph; cnt=0;
167 while((pVal=(AliDCSValue*)nextP())) pGrP->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat()); //P
168 if( cnt==1) {
169 pGrP->GetPoint(0,xP,yP);
170 new TF1(Form("P%i",iCh),Form("%f",yP),fStartTime,fEndTime);
171 } else {
172 pGrP->Fit(new TF1(Form("P%i",iCh),"[0] + x*[1]",fStartTime,fEndTime),"Q");
173 }
174 delete pGrP;
175 } else {AliWarning(" No Data Points from HMP_MP0-6_GAS_PMWPC.actual.value!");return kFALSE;}
a086e874 176 }
afe12692 177
49881df7 178// evaluate High Voltage
32d20573 179
db0e7063 180 for(Int_t iSec=0;iSec<6;iSec++){
a086e874 181 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));
785f7d56 182 if(!pHV) {
183 AliWarning(Form(" No Data Points from HMP_MP%1i_SEC%1i_HV.actual.vMon!",iCh,iSec));
184 return kFALSE;
185 } else {
186 Log(Form(" HV for module %i and secto %i data ---> %3i entries",iCh,iSec,pHV->GetEntries()));
187 if(pHV->GetEntries()) {
188 TIter nextHV(pHV);
189 TGraph *pGrHV=new TGraph; cnt=0;
190 while((pVal=(AliDCSValue*)nextHV())) pGrHV->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat()); //HV
191 if( cnt==1) {
192 pGrHV->GetPoint(0,xP,yP);
193 new TF1(Form("HV%i_%i",iCh,iSec),Form("%f",yP),fStartTime,fEndTime);
194 } else {
195 pGrHV->Fit(new TF1(Form("HV%i_%i",iCh,iSec),"[0]+x*[1]",fStartTime,fEndTime),"Q");
196 }
197 delete pGrHV;
198 } else {AliWarning(" No Data Points from HMP_MP0-6_SEC0-5_HV.actual.vMon!");return kFALSE;}
a086e874 199 }
ad712d2e 200// evaluate Qthre
32d20573 201
a086e874 202 arQthre.AddAt(new TF1(Form("HMP_QthreC%iS%i",iCh,iSec),
203 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);
db0e7063 204
a086e874 205 //arQthre.AddAt(new TF1(Form("HMP_QthreC%iS%i",iCh,iSec),"100",fStartTime,fEndTime),6*iCh+iSec);
49881df7 206 }
32d20573 207// evaluate Temperatures: in and out of the radiators
32d20573 208 // T in
d3da6dc4 209 for(Int_t iRad=0;iRad<3;iRad++){
f455af6e 210
a086e874 211 pTin[3*iCh+iRad] = new TF1(Form("Tin%i%i" ,iCh,iRad),"[0]+[1]*x",fStartTime,fEndTime);
212 pTout[3*iCh+iRad] = new TF1(Form("Tout%i%i",iCh,iRad),"[0]+[1]*x",fStartTime,fEndTime);
db0e7063 213
a086e874 214 //pTin[3*iCh+iRad] = new TF1(Form("Tin%i%i" ,iCh,iRad),"21",fStartTime,fEndTime);
215 //pTout[3*iCh+iRad] = new TF1(Form("Tout%i%i",iCh,iRad),"22",fStartTime,fEndTime);
db0e7063 216
a086e874 217 TObjArray *pT1=(TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_LIQ_LOOP.actual.sensors.Rad%iIn_Temp",iCh,iCh,iRad));
785f7d56 218 if(!pT1) {
219 AliWarning(Form(" No Data Points from HMP_MP%1i_LIQ_LOOP.actual.sensors.Rad%1iIn_Temp!",iCh,iRad));
220 return kFALSE;
221 } else {
222 Log(Form(" Temperatures for module %i inside data ---> %3i entries",iCh,pT1->GetEntries()));
223 if(pT1->GetEntries()) {
224 TIter nextT1(pT1);//Tin
225 TGraph *pGrT1=new TGraph; cnt=0; while((pVal=(AliDCSValue*)nextT1())) pGrT1->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat()); //T inlet
226 if(cnt==1) {
227 pGrT1->GetPoint(0,xP,yP);
228 pTin[3*iCh+iRad]->SetParameter(0,yP);
229 pTin[3*iCh+iRad]->SetParameter(1,0);
230 } else {
231 pGrT1->Fit(pTin[3*iCh+iRad],"Q");
232 }
233 delete pGrT1;
234 } else {AliWarning(" No Data Points from HMP_MP0-6_LIQ_LOOP.actual.sensors.Rad0-2In_Temp!");return kFALSE;}
235 }
32d20573 236 // T out
237 TObjArray *pT2=(TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_LIQ_LOOP.actual.sensors.Rad%iOut_Temp",iCh,iCh,iRad));
785f7d56 238 if(!pT2) {
239 AliWarning(Form(" No Data Points from HMP_MP%1i_LIQ_LOOP.actual.sensors.Rad%1iOut_Temp!",iCh,iRad));
240 return kFALSE;
241 } else {
242 Log(Form(" Temperatures for module %i outside data ---> %3i entries",iCh,pT2->GetEntries()));
243 if(pT2->GetEntries()) {
244 TIter nextT2(pT2);//Tout
245 TGraph *pGrT2=new TGraph; cnt=0; while((pVal=(AliDCSValue*)nextT2())) pGrT2->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat()); //T outlet
246 if(cnt==1) {
247 pGrT2->GetPoint(0,xP,yP);
248 pTout[3*iCh+iRad]->SetParameter(0,yP);
249 pTout[3*iCh+iRad]->SetParameter(1,0);
250 } else {
251 pGrT2->Fit(pTout[3*iCh+iRad],"Q");
252 }
253 delete pGrT2;
254 } else {AliWarning(" No Data Points from HMP_MP0-6_LIQ_LOOP.actual.sensors.Rad0-2Out_Temp!");return kFALSE;}
255 }
a086e874 256
ad712d2e 257// evaluate Mean Refractive Index
32d20573 258
f455af6e 259 arNmean.AddAt(pTin[3*iCh+iRad] ,6*iCh+2*iRad ); //Tin =f(t)
260 arNmean.AddAt(pTout[3*iCh+iRad],6*iCh+2*iRad+1); //Tout=f(t)
32d20573 261
d3da6dc4 262 }//radiators loop
263 }//chambers loop
264
f455af6e 265 Double_t eMean = ProcTrans(pMap);
266 arNmean.AddAt(new TF1("HMP_PhotEmean",Form("%f",eMean),fStartTime,fEndTime),42); //Photon energy mean
267
ad712d2e 268 AliCDBMetaData metaData;
269 metaData.SetBeamPeriod(0);
270 metaData.SetResponsible("AliHMPIDPreprocessor");
b7c14c1c 271 metaData.SetComment("HMPID preprocessor fills TObjArrays.");
ad712d2e 272
8f2dafcf 273 stDcsStore = Store("Calib","Qthre",&arQthre,&metaData,0,kTRUE) && // from DCS 0,kTRUE generates the file from Run 0 to Run 99999999
274 Store("Calib","Nmean",&arNmean,&metaData,0,kTRUE); // from DCS
275// stDcsStore = Store("Calib","Qthre",&arQthre,&metaData) && // from DCS
276// Store("Calib","Nmean",&arNmean,&metaData); // from DCS
ad712d2e 277 if(!stDcsStore) {
278 Log("HMPID - failure to store DCS data results in OCDB");
279 }
f455af6e 280
281// arNmean.Delete();
282// arQthre.Delete();
283
284// for(Int_t i=0;i<21;i++) delete pTin[i]; delete []pTin;
285// for(Int_t i=0;i<21;i++) delete pTout[i]; delete []pTout;
286
ad712d2e 287 return stDcsStore;
d3da6dc4 288}//Process()
289//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
56d2de52 290Bool_t AliHMPIDPreprocessor::ProcPed()
291{
292// Process pedestal files and create 7 M(padx,pady)=sigma, one for each chamber
293// Arguments:
48558cb5 294// Returns: kTRUE on success
ad712d2e 295
296 Bool_t stPedStore=kFALSE;
74521328 297 Bool_t stDeadMaskedStore=kFALSE;
56d2de52 298 AliHMPIDDigit dig;
21f61e25 299 AliHMPIDRawStream rs;
56d2de52 300 Int_t nSigCut,r,d,a,hard; Float_t mean,sigma;
7c912209 301 Int_t runNumber,ldcId,timeStamp,nEv,nDdlEv,nBadEv; Char_t tName[10];
302 Float_t nBadEvPer;
48558cb5 303
74521328 304 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
305 TObjArray aDeadMasked(7); aDeadMasked.SetOwner(kTRUE); for(Int_t i=0;i<7;i++) aDeadMasked.AddAt(new TMatrix(160,144),i); //TObjArray of 7 TMatrixF, m(padx,pady)=pedestal
48558cb5 306
307 for(Int_t iddl=0;iddl<AliHMPIDRawStream::kNDDL;iddl++) //retrieve the files from LDCs independently the DDL<->LDC connection
308 {
309 TList *pLdc=GetFileSources(kDAQ,Form("HmpidPedDdl%02i.txt",iddl)); //get list of LDC names containing id "pedestals"
310 if(!pLdc) {Log(Form("ERROR: Retrieval of sources for pedestals: HmpidPedDdl%02i.txt failed!",iddl));continue;}
9477d3cd 311
48558cb5 312 Log(Form("HMPID - Pedestal files to be read --> %i LDCs for HMPID",pLdc->GetEntries()));
313 for(Int_t i=0;i<pLdc->GetEntries();i++) {//lists of LDCs -- but in general we have 1 LDC for 1 ped file
314 TString fileName = GetFile(kDAQ,Form("HmpidPedDdl%02i.txt",iddl),((TObjString*)pLdc->At(i))->GetName());
315 if(fileName.Length()==0) {Log(Form("ERROR retrieving pedestal file: HmpidPedDdl%02i.txt!",iddl));continue;}
b7c14c1c 316
48558cb5 317 //reading pedestal file
70e96725 318 ifstream infile(fileName.Data());
319
48558cb5 320 if(!infile.is_open()) {Log("No pedestal file found for HMPID,bye!");continue;}
321 TMatrix *pM=(TMatrixF*)aDaqSig.At(iddl/2);
74521328 322 TMatrix *pDM=(TMatrixF*)aDeadMasked.At(iddl/2);
70e96725 323 infile>>tName>>runNumber;Printf("Xcheck: reading run %i",runNumber);
9477d3cd 324 infile>>tName>>ldcId;
325 infile>>tName>>timeStamp;
326 infile>>tName>>nEv;
7c912209 327 infile>>tName>>nDdlEv;
328 infile>>tName>>nBadEv;
329 infile>>tName>>nBadEvPer;
b7c14c1c 330 infile>>tName>>nSigCut; pM->SetUniqueID(nSigCut); //n. of pedestal distribution sigmas used to create zero suppresion table
56d2de52 331 while(!infile.eof()){
ec575c20 332 infile>>dec>>r>>d>>a>>mean>>sigma>>hex>>hard;
df8ff88a 333 if(rs.GetPad(iddl,r,d,a)>=0){ //the GetPad returns meaningful abs pad number
ec575c20 334 dig.SetPad(rs.GetPad(iddl,r,d,a));
335 dig.SetQ((Int_t)mean);
ab5ca5d6 336 (*pM)(dig.PadChX(),dig.PadChY()) = sigma;
74521328 337 if( (mean == AliHMPIDParam::kPadMeanZeroCharge && sigma == AliHMPIDParam::kPadSigmaZeroCharge) ||
338 (mean == AliHMPIDParam::kPadMeanMasked && sigma == AliHMPIDParam::kPadSigmaMasked) )
339 {(*pDM)(dig.PadChX(),dig.PadChY()) = mean;}
df8ff88a 340 }
56d2de52 341 }
342 infile.close();
48558cb5 343 Log(Form("Pedestal file for DDL %i read successfully",iddl));
ad712d2e 344
74521328 345
346
48558cb5 347 }//LDCs reading entries
348
349 }//DDL
350
ad712d2e 351 AliCDBMetaData metaData;
352 metaData.SetBeamPeriod(0);
353 metaData.SetResponsible("AliHMPIDPreprocessor");
48558cb5 354 metaData.SetComment("HMPID processor fills TObjArrays.");
ad712d2e 355 stPedStore = Store("Calib","DaqSig",&aDaqSig,&metaData,0,kTRUE);
74521328 356 if(!stPedStore) { Log("HMPID - failure to store PEDESTAL data results in OCDB"); }
357 stDeadMaskedStore = Store("Calib","Masked",&aDeadMasked,&metaData,0,kTRUE);
358 if(!stDeadMaskedStore) { Log("HMPID - failure to store DEAD & MASKED channel map in OCDB"); }
359 Bool_t pedRes=stPedStore*stDeadMaskedStore;
360 return pedRes;
ad712d2e 361
56d2de52 362}//ProcPed()
363//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f455af6e 364Double_t AliHMPIDPreprocessor::ProcTrans(TMap* pMap)
56d2de52 365{
f455af6e 366 // Process transparency monitoring data and calculates Emean
f455af6e 367
368 Double_t sEnergProb=0, sProb=0;
369
370 Double_t tRefCR5 = 19. ; // mean temperature of CR5 where the system is in place
371
372 Double_t eMean = 0;
373
374 AliDCSValue *pVal;
375
376 for(Int_t i=0; i<30; i++){
377
378 // evaluate wavelenght
8764d7e0 379 TObjArray *pWaveLenght = (TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_INFR/HMP_INFR_TRANPLANT/HMP_INFR_TRANPLANT_MEASURE.mesure%i.waveLenght",i));
380 if(!pWaveLenght){
592660bb 381 AliWarning(Form("No Data Point values for HMP_DET/HMP_INFR/HMP_INFR_TRANPLANT/HMP_INFR_TRANPLANT_MEASURE.mesure%i.waveLenght -----> Default E mean used!!!!!",i));
382 return DefaultEMean(); // to be checked
8764d7e0 383 }
592660bb 384
385 pVal=(AliDCSValue*)pWaveLenght->At(0);
f455af6e 386 Double_t lambda = pVal->GetFloat();
387
76e3b365 388 if(lambda<150. || lambda>230.){
389 AliWarning(Form("Wrong value for HMP_DET/HMP_INFR/HMP_INFR_TRANPLANT/HMP_INFR_TRANPLANT_MEASURE.mesure%i.waveLenght -----> Default E mean used!!!!!",i));
390 return DefaultEMean(); // to be checked
391 }
392
f455af6e 393 Double_t photEn = 1239.842609/lambda; // 1239.842609 from nm to eV
394
395 if(photEn<AliHMPIDParam::EPhotMin() || photEn>AliHMPIDParam::EPhotMax()) continue;
396
397 // evaluate phototube current for argon reference
8764d7e0 398 TObjArray *pArgonRef = (TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_INFR/HMP_INFR_TRANPLANT/HMP_INFR_TRANPLANT_MEASURE.mesure%i.argonReference",i));
399 if(!pArgonRef){
592660bb 400 AliWarning(Form("No Data Point values for HMP_DET/HMP_INFR/HMP_INFR_TRANPLANT/HMP_INFR_TRANPLANT_MEASURE.mesure%i.argonReference -----> Default E mean used!!!!!",i));
401 return DefaultEMean(); // to be checked
8764d7e0 402 }
592660bb 403
404 pVal=(AliDCSValue*)pArgonRef->At(0);
f455af6e 405 Double_t aRefArgon = pVal->GetFloat();
406
407 // evaluate phototube current for argon cell
8764d7e0 408 TObjArray *pArgonCell = (TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_INFR/HMP_INFR_TRANPLANT/HMP_INFR_TRANPLANT_MEASURE.mesure%i.argonCell",i));
409 if(!pArgonCell){
592660bb 410 AliWarning(Form("No Data Point values for HMP_DET/HMP_INFR/HMP_INFR_TRANPLANT/HMP_INFR_TRANPLANT_MEASURE.mesure%i.argonCell -----> Default E mean used!!!!!",i));
411 return DefaultEMean(); // to be checked
8764d7e0 412 }
413
592660bb 414 pVal=(AliDCSValue*)pArgonRef->At(0);
f455af6e 415 Double_t aCellArgon = pVal->GetFloat();
416
417 //evaluate phototube current for freon reference
8764d7e0 418 TObjArray *pFreonRef = (TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_INFR/HMP_INFR_TRANPLANT/HMP_INFR_TRANPLANT_MEASURE.mesure%i.c6f14Reference",i));
419 if(!pFreonRef){
592660bb 420 AliWarning(Form("No Data Point values for HMP_DET/HMP_INFR/HMP_INFR_TRANPLANT/HMP_INFR_TRANPLANT_MEASURE.mesure%i.c6f14Reference -----> Default E mean used!!!!!",i));
421 return DefaultEMean(); // to be checked
8764d7e0 422 }
592660bb 423
424 pVal=(AliDCSValue*)pFreonRef->At(0);
f455af6e 425 Double_t aRefFreon = pVal->GetFloat();
426
427 //evaluate phototube current for freon cell
8764d7e0 428 TObjArray *pFreonCell = (TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_INFR/HMP_INFR_TRANPLANT/HMP_INFR_TRANPLANT_MEASURE.mesure%i.c6f14Cell",i));
592660bb 429 if(!pFreonCell){
430 AliWarning(Form("No Data Point values for HMP_DET/HMP_INFR/HMP_INFR_TRANPLANT/HMP_INFR_TRANPLANT_MEASURE.mesure%i.c6f14Cell -----> Default E mean used!!!!!",i));
431 return DefaultEMean(); // to be checked
432 }
433
434 pVal=(AliDCSValue*)pFreonCell->At(0);
f455af6e 435 Double_t aCellFreon = pVal->GetFloat();
436
437 //evaluate correction factor to calculate trasparency (Ref. NIMA 486 (2002) 590-609)
438
439 Double_t aN1 = AliHMPIDParam::NIdxRad(photEn,tRefCR5);
440 Double_t aN2 = AliHMPIDParam::NMgF2Idx(photEn);
441 Double_t aN3 = 1; // Argon Idx
442
443 Double_t aR1 = ((aN1 - aN2)*(aN1 - aN2))/((aN1 + aN2)*(aN1 + aN2));
444 Double_t aR2 = ((aN2 - aN3)*(aN2 - aN3))/((aN2 + aN3)*(aN2 + aN3));
445 Double_t aT1 = (1 - aR1);
446 Double_t aT2 = (1 - aR2);
447 Double_t aCorrFactor = (aT1*aT1)/(aT2*aT2);
448
449 // evaluate 15 mm of thickness C6F14 Trans
450 Double_t aTransRad;
451
452 if(aRefFreon*aRefArgon>0) {
453 aTransRad = TMath::Power((aCellFreon/aRefFreon)/(aCellArgon/aRefArgon)*aCorrFactor,1.5);
454 } else {
455 return DefaultEMean();
456 }
457
458 // evaluate 0.5 mm of thickness SiO2 Trans
459 Double_t aTransSiO2 = TMath::Exp(-0.5/AliHMPIDParam::LAbsWin(photEn));
460
461 // evaluate 80 cm of thickness Gap (low density CH4) transparency
462 Double_t aTransGap = TMath::Exp(-80./AliHMPIDParam::LAbsGap(photEn));
463
464 // evaluate CsI quantum efficiency
465 Double_t aCsIQE = AliHMPIDParam::QEffCSI(photEn);
466
467 // evaluate total convolution of all material optical properties
468 Double_t aTotConvolution = aTransRad*aTransSiO2*aTransGap*aCsIQE;
469
470 sEnergProb+=aTotConvolution*photEn;
471
472 sProb+=aTotConvolution;
473}
f455af6e 474 if(sProb>0) {
475 eMean = sEnergProb/sProb;
476 } else {
477 return DefaultEMean();
478 }
f455af6e 479 Log(Form(" Mean energy photon calculated ---> %f eV ",eMean));
480
481 if(eMean<AliHMPIDParam::EPhotMin() || eMean>AliHMPIDParam::EPhotMax()) return DefaultEMean();
482
56d2de52 483 return eMean;
484}
485//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
f455af6e 486Double_t AliHMPIDPreprocessor::DefaultEMean()
487{
488 Double_t eMean = 6.675; //just set a refractive index for C6F14 at ephot=6.675 eV @ T=25 C
489 AliWarning(Form("Mean energy for photons out of range [%f,%f] in Preprocessor. Default value Eph=%f eV taken.",AliHMPIDParam::EPhotMin(),
490 AliHMPIDParam::EPhotMax(),
491 eMean));
492 return eMean;
493}