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