]>
Commit | Line | Data |
---|---|---|
979b5a5f | 1 | /************************************************************************** |
2 | * Copyright(c) 2007-2009, 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 | **************************************************************************/ | |
e56160b8 | 15 | |
20f3f947 | 16 | /* $Id$ */ |
5a9fd7dd | 17 | |
979b5a5f | 18 | /////////////////////////////////////////////////////////////////// |
19 | // // | |
20 | // Implementation of the class for SDD preprocessing // | |
21 | // Origin: E.Crescio, Torino, crescio@to.infn.it // | |
22 | // F.Prino, Torino, prino@to.infn.it // | |
23 | // // | |
24 | /////////////////////////////////////////////////////////////////// | |
25 | ||
e56160b8 | 26 | #include "AliITSPreprocessorSDD.h" |
27 | #include "AliITSCalibrationSDD.h" | |
18da6e54 | 28 | #include "AliITSDriftSpeedArraySDD.h" |
cfaccd71 | 29 | #include "AliITSDCSAnalyzerSDD.h" |
e56160b8 | 30 | #include "AliShuttleInterface.h" |
979b5a5f | 31 | #include "AliCDBEntry.h" |
e56160b8 | 32 | #include "AliCDBMetaData.h" |
33 | #include "TObjArray.h" | |
e56160b8 | 34 | #include "AliLog.h" |
dfb8947f | 35 | #include <TObjString.h> |
36 | #include <TSystem.h> | |
37 | #include <TList.h> | |
7960eafe | 38 | #include <TF1.h> |
39 | #include <TH1D.h> | |
e56160b8 | 40 | |
7537d03c | 41 | const TString AliITSPreprocessorSDD::fgkNameHistoPedestals = "hpedestal"; |
42 | const TString AliITSPreprocessorSDD::fgkNameHistoNoise = "hnoise"; | |
e56160b8 | 43 | ClassImp(AliITSPreprocessorSDD) |
44 | ||
15b67cdc | 45 | //______________________________________________________________________ |
46 | AliITSPreprocessorSDD::AliITSPreprocessorSDD( AliShuttleInterface* shuttle): | |
47 | AliPreprocessor("SDD", shuttle) | |
48 | { | |
49 | // constructor | |
50 | AddRunType("PULSER"); | |
51 | AddRunType("INJECTOR"); | |
52 | AddRunType("PHYSICS"); | |
53 | } | |
e56160b8 | 54 | |
317e638f | 55 | //______________________________________________________________________ |
cfaccd71 | 56 | UInt_t AliITSPreprocessorSDD::Process(TMap* dcsAliasMap){ |
e56160b8 | 57 | |
7d21c0a9 | 58 | |
979b5a5f | 59 | // Get DDL map from OCDB |
60 | AliCDBEntry* entry = GetFromOCDB("Calib", "DDLMapSDD"); | |
61 | if(!entry){ | |
62 | Log("DDL map file not found in OCDB."); | |
63 | return 2; | |
64 | } | |
65 | AliITSDDLModuleMapSDD* ddlmap = (AliITSDDLModuleMapSDD*)entry->GetObject(); | |
66 | if(!ddlmap){ | |
67 | Log("AliITSDDLModuleMapSDD object not in file."); | |
68 | return 2; | |
69 | } | |
b478db1a | 70 | ddlmap->PrintDDLMap(); |
e56160b8 | 71 | |
979b5a5f | 72 | //preprocessing |
18da6e54 | 73 | TString runType = GetRunType(); |
461c9263 | 74 | Int_t retcode=0; |
c2bd28b6 | 75 | |
ad2585ed | 76 | if (runType == "PULSER"){ |
b478db1a | 77 | Log("Process FXS files from PULSER RUN"); |
317e638f | 78 | retcode=ProcessPulser(ddlmap); |
79 | }else if(runType== "INJECTOR"){ | |
b478db1a | 80 | Log("Process FXS files from INJECTOR RUN"); |
317e638f | 81 | retcode=ProcessInjector(ddlmap); |
317e638f | 82 | } |
461c9263 | 83 | if(retcode!=0) return retcode; |
84 | ||
b478db1a | 85 | Log("Process DCS data"); |
461c9263 | 86 | Bool_t retcodedcs =ProcessDCSDataPoints(dcsAliasMap); |
87 | if(retcodedcs) return 0; | |
88 | else return 1; | |
89 | ||
317e638f | 90 | } |
91 | //______________________________________________________________________ | |
461c9263 | 92 | UInt_t AliITSPreprocessorSDD::ProcessPulser(AliITSDDLModuleMapSDD* ddlmap){ |
317e638f | 93 | // Process FXS files from PULSER run (baseline, noise, gain) |
461c9263 | 94 | // returns 0 in case of success, |
95 | // 1 in case of storage error, | |
96 | // 2 in case of error with input files | |
317e638f | 97 | TObjArray calSDD(kNumberOfSDD); |
98 | calSDD.SetOwner(kFALSE); | |
7d21c0a9 | 99 | |
317e638f | 100 | Float_t baseline,rawnoise,cmn,corn,gain; |
101 | Int_t isgoodan,i,im,is,isgoodmod,basmin,basoff; | |
e7610d19 | 102 | Int_t th,tl; |
317e638f | 103 | Int_t numOfBadChannels[kNumberOfSDD]; |
18da6e54 | 104 | |
317e638f | 105 | TList* sourceList = GetFileSources(kDAQ, "SDD_Calib"); |
106 | if (!sourceList){ | |
107 | Log("Error: no sources found for SDD_Calib"); | |
108 | return 2; | |
109 | } | |
dfb8947f | 110 | |
317e638f | 111 | Int_t ind = 0; |
112 | while (sourceList->At(ind)!=NULL) { | |
113 | TObjString* tarId = (TObjString*) sourceList->At(ind); | |
114 | TString tarName = GetFile(kDAQ, "SDD_Calib", tarId->GetString().Data()); | |
115 | if(tarName.Length()==0){ | |
116 | Log(Form("Baseline tar file from source %d not found.",ind)); | |
117 | return 2; | |
18da6e54 | 118 | } |
7d21c0a9 | 119 | TString command; |
120 | command.Form("tar -xf %s",tarName.Data()); | |
317e638f | 121 | gSystem->Exec(command); |
122 | ind++; | |
123 | } | |
124 | delete sourceList; | |
27416b0d | 125 | // Read ADC sampling frequency from fee.conf |
126 | Int_t amSamplFreq=40; | |
296ee458 | 127 | Int_t retfscf; |
27416b0d | 128 | FILE* feefil=fopen("fee.conf","r"); |
129 | if(feefil){ | |
296ee458 | 130 | retfscf=fscanf(feefil,"%d \n",&amSamplFreq); |
27416b0d | 131 | fclose(feefil); |
132 | Log(Form("AM sampling frequency = %d MHz",amSamplFreq)); | |
133 | }else{ | |
134 | Log("File fee.conf not found. AM sampling set at 40 MHz by default"); | |
135 | } | |
317e638f | 136 | |
137 | for(Int_t iddl=0;iddl<kNumberOfDDL;iddl++){ | |
138 | for(Int_t imod=0;imod<kModulesPerDDL;imod++){ | |
139 | Int_t modID=ddlmap->GetModuleNumber(iddl,imod); | |
140 | if(modID==-1) continue; | |
141 | modID-=240; // to have SDD modules numbering from 0 to 260 | |
142 | AliITSCalibrationSDD *cal = new AliITSCalibrationSDD("simulated"); | |
27416b0d | 143 | if(amSamplFreq!=40) cal->SetAMAt20MHz(); |
317e638f | 144 | numOfBadChannels[modID]=0; |
145 | Int_t badch[kNumberOfChannels]; | |
296ee458 | 146 | Bool_t sid0ok=kTRUE; |
147 | Bool_t sid1ok=kTRUE; | |
317e638f | 148 | for(Int_t isid=0;isid<=1;isid++){ |
7d21c0a9 | 149 | TString inpFileName; |
150 | inpFileName.Form("./SDDbase_ddl%02dc%02d_sid%d.data",iddl,imod,isid); | |
151 | ||
317e638f | 152 | FILE* basFil = fopen(inpFileName,"read"); |
153 | if (basFil == 0) { | |
7d21c0a9 | 154 | Log(Form("File %s not found.",inpFileName.Data())); |
296ee458 | 155 | if(isid==0){ |
156 | sid0ok=kFALSE; | |
157 | for(Int_t iChip=0; iChip<4; iChip++) cal->SetChipBad(iChip); | |
158 | cal->SetDeadChannels(cal->GetDeadChannels()+256); | |
159 | for(Int_t iAnode=0; iAnode<256; iAnode++) cal->SetBadChannel(iAnode,iAnode); | |
160 | }else{ | |
161 | sid1ok=kFALSE; | |
162 | for(Int_t iChip=4; iChip<8; iChip++) cal->SetChipBad(iChip); | |
163 | cal->SetDeadChannels(cal->GetDeadChannels()+256); | |
164 | for(Int_t iAnode=0; iAnode<256; iAnode++) cal->SetBadChannel(iAnode,iAnode+256); | |
165 | } | |
317e638f | 166 | continue; |
167 | } | |
296ee458 | 168 | |
169 | retfscf=fscanf(basFil,"%d %d %d\n",&im,&is,&isgoodmod); | |
170 | if(!isgoodmod){ | |
171 | if(isid==0){ | |
172 | sid0ok=kFALSE; | |
173 | for(Int_t iChip=0; iChip<4; iChip++) cal->SetChipBad(iChip); | |
174 | }else{ | |
175 | sid1ok=kFALSE; | |
176 | for(Int_t iChip=4; iChip<8; iChip++) cal->SetChipBad(iChip); | |
177 | } | |
178 | } | |
179 | retfscf=fscanf(basFil,"%d\n",&th); | |
180 | retfscf=fscanf(basFil,"%d\n",&tl); | |
20f3f947 | 181 | cal->SetZSLowThreshold(isid,tl); |
182 | cal->SetZSHighThreshold(isid,th); | |
317e638f | 183 | for(Int_t ian=0;ian<(kNumberOfChannels/2);ian++){ |
296ee458 | 184 | retfscf=fscanf(basFil,"%d %d %f %d %d %f %f %f %f\n",&i,&isgoodan,&baseline,&basmin,&basoff,&rawnoise,&cmn,&corn,&gain); |
317e638f | 185 | Int_t ich=ian; |
186 | if(isid==1) ich+=256; | |
187 | if(!isgoodan){ | |
188 | Int_t ibad=numOfBadChannels[modID]; | |
189 | badch[ibad]=ich; | |
190 | numOfBadChannels[modID]++; | |
979b5a5f | 191 | } |
20f3f947 | 192 | cal->SetBaseline(ich,baseline-basoff); |
317e638f | 193 | cal->SetNoiseAfterElectronics(ich,rawnoise); |
194 | cal->SetGain(ich,gain); | |
979b5a5f | 195 | } |
317e638f | 196 | cal->SetDeadChannels(numOfBadChannels[modID]); |
197 | for(Int_t ibad=0;ibad<numOfBadChannels[modID];ibad++){ | |
198 | cal->SetBadChannel(ibad,badch[ibad]); | |
199 | } | |
200 | fclose(basFil); | |
c2bd28b6 | 201 | } |
296ee458 | 202 | if(!sid0ok && !sid1ok) cal->SetBad(); |
b478db1a | 203 | Log(Form("Put calib obj for module %d (DDL %d Carlos %d)",modID,iddl,imod)); |
317e638f | 204 | calSDD.AddAt(cal,modID); |
e56160b8 | 205 | } |
317e638f | 206 | } |
207 | AliCDBMetaData *md= new AliCDBMetaData(); | |
208 | md->SetResponsible("Francesco Prino"); | |
209 | md->SetBeamPeriod(0); | |
210 | md->SetComment("AliITSCalibrationSDD from PEDESTAL+PULSER runs"); | |
211 | Bool_t retCode = Store("Calib","CalibSDD",&calSDD,md, 0, kTRUE); | |
461c9263 | 212 | if(retCode) return 0; |
213 | else return 1; | |
317e638f | 214 | } |
215 | //______________________________________________________________________ | |
461c9263 | 216 | UInt_t AliITSPreprocessorSDD::ProcessInjector(AliITSDDLModuleMapSDD* ddlmap){ |
317e638f | 217 | // Process FXS files from injector events (INJECTOR or PHYSICS runs) |
461c9263 | 218 | // returns 0 in case of success, |
219 | // 1 in case of storage error, | |
220 | // 2 in case of error with input files | |
317e638f | 221 | TObjArray vdrift(2*kNumberOfSDD); |
222 | vdrift.SetOwner(kFALSE); | |
317e638f | 223 | Int_t evNumb,polDeg; |
50d25e98 | 224 | UInt_t timeStamp,statusInj; |
9f963593 | 225 | Bool_t modSet[2*kNumberOfSDD]; // flag modules with good inj. |
5eb2b05e | 226 | for(Int_t ihyb=0; ihyb<2*kNumberOfSDD; ihyb++) modSet[ihyb]=0; |
50d25e98 | 227 | Double_t nPtLay3 = 0; |
228 | Double_t nPtLay4 = 0; | |
9f963593 | 229 | |
230 | Double_t param[4]; // parameters of poly fit | |
915c0469 | 231 | Double_t minValP0=5.; // min value for param[0] |
232 | Double_t maxValP0=8.; // max value for param[0] | |
9f963593 | 233 | Double_t minValP1=0.; // min value for param[1] |
50d25e98 | 234 | Double_t aveCoefLay3[4]={0.,0.,0.,0.}; // average param for good mod. |
235 | Double_t aveCoefLay4[4]={0.,0.,0.,0.}; // average param for good mod. | |
9f963593 | 236 | Double_t defCoef[4]={6.53227,0.00128941,-5.14493e-06,0}; // default values for param |
237 | Float_t auxP; | |
e56160b8 | 238 | |
317e638f | 239 | TList* sourceList = GetFileSources(kDAQ, "SDD_Injec"); |
240 | if (!sourceList){ | |
241 | Log("Error: no sources found for SDD_Injec"); | |
242 | return 2; | |
243 | } | |
244 | Int_t ind = 0; | |
245 | while (sourceList->At(ind)!=NULL) { | |
246 | TObjString* tarId = (TObjString*) sourceList->At(ind); | |
247 | TString tarName = GetFile(kDAQ, "SDD_Injec", tarId->GetString().Data()); | |
248 | if(tarName.Length()==0){ | |
249 | Log(Form("Injector tar file from source %d not found.",ind)); | |
18da6e54 | 250 | return 2; |
251 | } | |
7d21c0a9 | 252 | TString command; |
253 | command.Form("tar -xf %s",tarName.Data()); | |
317e638f | 254 | gSystem->Exec(command); |
255 | ind++; | |
256 | } | |
257 | delete sourceList; | |
296ee458 | 258 | Int_t retfscf; |
7960eafe | 259 | |
9f963593 | 260 | |
317e638f | 261 | for(Int_t iddl=0;iddl<kNumberOfDDL;iddl++){ |
262 | for(Int_t imod=0;imod<kModulesPerDDL;imod++){ | |
263 | Int_t modID=ddlmap->GetModuleNumber(iddl,imod); | |
264 | if(modID==-1) continue; | |
265 | modID-=240; // to have SDD modules numbering from 0 to 260 | |
266 | for(Int_t isid=0;isid<=1;isid++){ | |
267 | AliITSDriftSpeedArraySDD *arr=new AliITSDriftSpeedArraySDD(); | |
7d21c0a9 | 268 | TString inpFileName; |
269 | inpFileName.Form("./SDDinj_ddl%02dc%02d_sid%d.data",iddl,imod,isid); | |
317e638f | 270 | FILE* injFil = fopen(inpFileName,"read"); |
271 | if (injFil == 0) { | |
7d21c0a9 | 272 | Log(Form("File %s not found.",inpFileName.Data())); |
317e638f | 273 | continue; |
274 | } | |
296ee458 | 275 | retfscf=fscanf(injFil,"%d",&polDeg); |
317e638f | 276 | while (!feof(injFil)){ |
296ee458 | 277 | retfscf=fscanf(injFil,"%d %u ",&evNumb,&timeStamp); |
50d25e98 | 278 | if(evNumb==-99){ |
279 | statusInj=timeStamp; | |
280 | arr->SetInjectorStatus(statusInj); | |
281 | }else{ | |
282 | if(feof(injFil)) break; | |
283 | for(Int_t ic=0;ic<4;ic++){ | |
284 | retfscf=fscanf(injFil,"%f ",&auxP); | |
285 | param[ic]=auxP; | |
286 | } | |
9f963593 | 287 | |
7a8c5708 | 288 | if(polDeg>=0 && polDeg<=AliITSDriftSpeedSDD::GetMaxPolDeg() && |
289 | param[0]>minValP0 && param[0]<maxValP0 && param[1]>minValP1){ | |
915c0469 | 290 | if(polDeg==3){ |
291 | if(modID<kNumberOfSDDLay3){ | |
292 | for(Int_t ic=0;ic<4;ic++) aveCoefLay3[ic]+=param[ic]; | |
293 | nPtLay3++; | |
294 | }else{ | |
295 | for(Int_t ic=0;ic<4;ic++) aveCoefLay4[ic]+=param[ic]; | |
296 | nPtLay4++; | |
297 | } | |
50d25e98 | 298 | } |
299 | AliITSDriftSpeedSDD *dsp=new AliITSDriftSpeedSDD(evNumb,timeStamp,polDeg,param); | |
300 | arr->AddDriftSpeed(dsp); | |
301 | modSet[2*modID+isid]=1; | |
915c0469 | 302 | }else{ |
303 | Log(Form("Module %d side %d not accepted, degree=%d, params=%g %g %g %g",modID+240,isid,polDeg,param[0],param[1],param[2],param[3])); | |
50d25e98 | 304 | } |
9f963593 | 305 | } |
18da6e54 | 306 | } |
9ebc7917 | 307 | fclose(injFil); |
b478db1a | 308 | Log(Form("Put calib obj for hybrid %d (DDL %d Carlos %d)",2*modID+isid,iddl,imod)); |
9f963593 | 309 | if(modSet[2*modID+isid]) vdrift.AddAt(arr,2*modID+isid); |
18da6e54 | 310 | } |
311 | } | |
cfaccd71 | 312 | } |
9f963593 | 313 | |
314 | // set drift speed for modules with bad injectors | |
315 | for(Int_t ic=0;ic<4;ic++){ | |
50d25e98 | 316 | if(nPtLay3>0) aveCoefLay3[ic]/=nPtLay3; // mean parameters |
317 | else aveCoefLay3[ic]=defCoef[ic]; // default parameters | |
318 | if(nPtLay4>0) aveCoefLay4[ic]/=nPtLay4; // mean parameters | |
319 | else aveCoefLay4[ic]=defCoef[ic]; // default parameters | |
9f963593 | 320 | } |
2c4e6a6a | 321 | AliITSDriftSpeedSDD *avdsp3=new AliITSDriftSpeedSDD(evNumb,timeStamp,3,aveCoefLay3); |
322 | AliITSDriftSpeedSDD *avdsp4=new AliITSDriftSpeedSDD(evNumb,timeStamp,3,aveCoefLay4); | |
9f963593 | 323 | |
7960eafe | 324 | // Check status of golden modules |
325 | Int_t idGoldenMod=-1, idGoldenSide=-1; | |
326 | Int_t idGoldenModList[5]={319,319,321,243,243}; | |
327 | Int_t idGoldenSideList[5]={0,1,0,0,1}; | |
328 | AliITSDriftSpeedSDD* refSpeed=0x0; | |
329 | for(Int_t iGold=0; iGold<5; iGold++){ | |
330 | Int_t indexG=2*(idGoldenModList[iGold]-240)+idGoldenSideList[iGold]; | |
331 | if(modSet[indexG]){ | |
332 | idGoldenMod=idGoldenModList[iGold]; | |
333 | idGoldenSide=idGoldenSideList[iGold]; | |
334 | AliITSDriftSpeedArraySDD* arrRef=(AliITSDriftSpeedArraySDD*)vdrift.At(indexG); | |
335 | refSpeed=arrRef->GetDriftSpeedObject(0); | |
336 | break; | |
337 | } | |
338 | } | |
339 | TList* correctionList=0x0; | |
340 | if(idGoldenMod>=240 && idGoldenSide>=0){ | |
341 | // Get rescaling corrections from OCDB | |
342 | AliCDBEntry* entry = GetFromOCDB("Calib", "RescaleDriftSpeedSDD"); | |
343 | if(!entry){ | |
344 | Log("RescaleDriftSpeedSDD file not found in OCDB."); | |
345 | } | |
346 | TList* fullList=(TList*)entry->GetObject(); | |
347 | if(!fullList){ | |
348 | Log("TList object not found in file."); | |
349 | } | |
350 | TString listName=Form("RefMod%d_Side%d",idGoldenMod,idGoldenSide); | |
351 | correctionList=(TList*)fullList->FindObject(listName.Data()); | |
352 | if(!correctionList){ | |
353 | Log(Form("TList for requested module %d side %d not found",idGoldenMod,idGoldenSide)); | |
354 | }else{ | |
355 | Log(Form("Use module %d side %d as reference module",idGoldenMod,idGoldenSide)); | |
356 | if(refSpeed){ | |
357 | Log(Form("Drift speed params for golden module = %g %g %g %g",refSpeed->GetDriftSpeedParameter(0),refSpeed->GetDriftSpeedParameter(1),refSpeed->GetDriftSpeedParameter(2),refSpeed->GetDriftSpeedParameter(3))); | |
358 | }else{ | |
359 | AliError("No drift speed object for golden module"); | |
360 | } | |
361 | } | |
362 | } | |
363 | ||
50d25e98 | 364 | for(Int_t ihyb=0; ihyb<2*kNumberOfSDDLay3; ihyb++){ |
7960eafe | 365 | AliITSDriftSpeedArraySDD *arr=new AliITSDriftSpeedArraySDD(); |
9f963593 | 366 | if(modSet[ihyb]==0){ |
7960eafe | 367 | Int_t iBadMod=ihyb/2+240; |
368 | Int_t iBadSide=ihyb%2; | |
369 | Bool_t goldenUsed=kFALSE; | |
370 | if(correctionList && refSpeed){ | |
371 | Double_t *params=RescaleDriftSpeedModule(correctionList,iBadMod,iBadSide,refSpeed); | |
372 | if(params){ | |
373 | AliWarning(Form("No good injector events for mod. %d side %d --> use rescaled values from golden module",iBadMod,iBadSide)); | |
374 | AliITSDriftSpeedSDD* dspres=new AliITSDriftSpeedSDD(0,refSpeed->GetEventTimestamp(),3,params); | |
375 | arr->AddDriftSpeed(dspres); | |
376 | arr->SetInjectorStatus(1); | |
377 | goldenUsed=kTRUE; | |
378 | } | |
379 | } | |
380 | if(!goldenUsed){ | |
381 | AliWarning(Form("No good injector events for mod. %d side %d --> use average values for layer 3",iBadMod,iBadSide)); | |
382 | arr->AddDriftSpeed(avdsp3); | |
383 | arr->SetInjectorStatus(0); | |
384 | } | |
9f963593 | 385 | vdrift.AddAt(arr,ihyb); |
386 | } | |
387 | } | |
388 | ||
50d25e98 | 389 | for(Int_t ihyb=2*kNumberOfSDDLay3; ihyb<2*kNumberOfSDD; ihyb++){ |
390 | if(modSet[ihyb]==0){ | |
391 | AliWarning(Form("No good injector events for mod. %d side %d --> use average values for layer 4",ihyb/2,ihyb%2)); | |
392 | AliITSDriftSpeedArraySDD *arr=new AliITSDriftSpeedArraySDD(); | |
393 | arr->AddDriftSpeed(avdsp4); | |
394 | arr->SetInjectorStatus(0); | |
395 | vdrift.AddAt(arr,ihyb); | |
396 | } | |
397 | } | |
9f963593 | 398 | |
317e638f | 399 | AliCDBMetaData *md= new AliCDBMetaData(); |
400 | md->SetResponsible("Francesco Prino"); | |
401 | md->SetBeamPeriod(0); | |
402 | md->SetComment("AliITSDriftSpeedSDD from injector events"); | |
403 | Bool_t retCode = Store("Calib","DriftSpeedSDD",&vdrift,md,0, kTRUE); | |
461c9263 | 404 | if(retCode) return 0; |
405 | else return 1; | |
317e638f | 406 | } |
7960eafe | 407 | |
408 | //______________________________________________________________________ | |
409 | Double_t* AliITSPreprocessorSDD::RescaleDriftSpeedModule(TList* theList, | |
410 | Int_t iBadMod, | |
411 | Int_t iBadSide, | |
412 | AliITSDriftSpeedSDD* refSpeed) | |
413 | const | |
414 | { | |
415 | // Rescale driftSpeed for a drift region starting from values of golden module | |
416 | ||
417 | if(!refSpeed) return 0x0; | |
418 | TString hisName=Form("hRatioMod%d_Side%d",iBadMod,iBadSide); | |
419 | TH1D* h=(TH1D*)theList->FindObject(hisName.Data()); | |
420 | if(!h) return 0x0; | |
421 | ||
422 | TF1* fpoly=new TF1("fpoly","pol3",0.,255.); | |
423 | for(Int_t iAnode=0; iAnode<256; iAnode++){ | |
424 | Double_t vref=refSpeed->GetDriftSpeedAtAnode((Double_t)iAnode); | |
425 | Double_t vcorr=h->GetBinContent(iAnode+1)*vref; | |
426 | h->SetBinContent(iAnode+1,vcorr); | |
427 | } | |
428 | h->Fit(fpoly,"RNQ"); | |
429 | Double_t *params=new Double_t[4]; | |
430 | for(Int_t iPar=0; iPar<4; iPar++) params[iPar]=fpoly->GetParameter(iPar); | |
431 | delete fpoly; | |
432 | return params; | |
433 | } | |
434 | ||
317e638f | 435 | //______________________________________________________________________ |
436 | Bool_t AliITSPreprocessorSDD::ProcessDCSDataPoints(TMap* dcsAliasMap){ | |
437 | // Process DCS data | |
438 | AliITSDCSAnalyzerSDD *dcs=new AliITSDCSAnalyzerSDD(); | |
439 | dcs->AnalyzeData(dcsAliasMap); | |
440 | TObjArray refDCS(kNumberOfSDD); | |
441 | refDCS.SetOwner(kFALSE); | |
442 | for(Int_t imod=0;imod<kNumberOfSDD;imod++){ | |
443 | AliITSDCSDataSDD *dcsdata=dcs->GetDCSData(imod); | |
444 | refDCS.Add(dcsdata); | |
445 | } | |
446 | AliCDBMetaData *md= new AliCDBMetaData(); | |
447 | md->SetResponsible("Francesco Prino"); | |
448 | md->SetBeamPeriod(0); | |
449 | md->SetComment("AliITSDCSDataSDD objects from DCS DB"); | |
450 | Bool_t retCode = StoreReferenceData("DCS","DataSDD",&refDCS,md); | |
451 | return retCode; | |
e56160b8 | 452 | } |
5eb2b05e | 453 |