]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDPreprocessor.cxx
Shuttle debugging line removed.
[u/mrichter/AliRoot.git] / TRD / AliTRDPreprocessor.cxx
CommitLineData
ec55623f 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 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 **************************************************************************/
15
16/* $Id$ */
17
18////////////////////////////////////////////////////////////////////////////
19// //
20// This class is a first implementation for the TRD. //
21// It takes data from HLT and computes the parameters //
22// and stores both reference data and online calibration //
23// parameters in the CDB //
a5e1169e 24// It alsotakes DCS data, does spline fits //
25// and stores both reference data and spline fits results //
26// in the CDB //
ec55623f 27// //
28// Author: //
29// R. Bailhache (R.Bailhache@gsi.de) //
cd4fc278 30// W. Monange (w.monange@gsi.de) //
ec55623f 31// //
32////////////////////////////////////////////////////////////////////////////
e5c60cc7 33
e5c60cc7 34#include <TFile.h>
35#include <TProfile2D.h>
e5c60cc7 36#include <TStopwatch.h>
37#include <TObjString.h>
38#include <TString.h>
39#include <TList.h>
40#include <TCollection.h>
41
42#include "AliCDBMetaData.h"
e5c60cc7 43#include "AliLog.h"
44
c8ab4518 45#include "AliTRDPreprocessor.h"
3a0f6479 46#include "AliTRDSensorArray.h"
67c25e8d 47#include "AliTRDCalibraFit.h"
48#include "AliTRDCalibraMode.h"
3a0f6479 49#include "AliTRDCalibPadStatus.h"
50#include "Cal/AliTRDCalDet.h"
51#include "Cal/AliTRDCalPadStatus.h"
e5c60cc7 52
e5c60cc7 53ClassImp(AliTRDPreprocessor)
54
55//______________________________________________________________________________________________
ec55623f 56AliTRDPreprocessor::AliTRDPreprocessor(AliShuttleInterface *shuttle)
c8ab4518 57 :AliPreprocessor("TRD", shuttle)
58 ,fVdriftHLT(0)
e5c60cc7 59{
60 //
61 // Constructor
62 //
63
64}
65
66//______________________________________________________________________________________________
67AliTRDPreprocessor::~AliTRDPreprocessor()
68{
69 //
70 // Destructor
71 //
72
73}
74
75//______________________________________________________________________________________________
76void AliTRDPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
77{
78 //
79 // Initialization routine for the TRD preprocessor
80 //
81
82 AliPreprocessor::Initialize(run,startTime,endTime);
83
84}
85
86//______________________________________________________________________________________________
a5e1169e 87UInt_t AliTRDPreprocessor::Process(TMap* dcsAliasMap)
e5c60cc7 88{
a5e1169e 89 //
90 // Process DCS and calibration part for HLT
91 //
92
8dd14606 93 TString runType = GetRunType();
94 Log(Form("runtype %s\n",runType.Data()));
95
b70c68da 96 if (runType=="PEDESTAL"){
8dd14606 97 if(ExtractPedestals()) return 1;
98 return 0;
99 }
a5e1169e 100
b70c68da 101 if ((runType=="PHYSICS") || (runType=="STANDALONE")){
f5bb5557 102 // DCS
103 if(ProcessDCS(dcsAliasMap)) return 1;
104 // HLT if On
105 //TString runPar = GetRunParameter("HLTStatus");
8dd14606 106 //if(runPar=="1") {
f5bb5557 107 if(GetHLTStatus()) {
108 if(ExtractHLT()) return 1;
109 }
110 // DAQ if HLT failed
8dd14606 111 if(!fVdriftHLT) {
112 if(ExtractDriftVelocityDAQ()) return 1;
113 }
6ace5fe2 114 }
8dd14606 115
116 return 0;
6ace5fe2 117
f5bb5557 118}
c8ab4518 119
f5bb5557 120//______________________________________________________________________________
121Bool_t AliTRDPreprocessor::ProcessDCS()
122{
c8ab4518 123 //
124 // Default process DCS method
125 //
f5bb5557 126
127 TString runType = GetRunType();
b70c68da 128 if ((runType == "PHYSICS") || (runType == "STANDALONE")) {
c8ab4518 129 return kTRUE;
130 }
f5bb5557 131 return kFALSE;
132
6ace5fe2 133}
134
6ace5fe2 135//______________________________________________________________________________
c8ab4518 136Bool_t AliTRDPreprocessor::ProcessDCS(TMap *dcsAliasMap)
6ace5fe2 137{
c8ab4518 138 //
139 // Process DCS method
140 //
141
142 Bool_t error = kFALSE;
6ace5fe2 143
a5e1169e 144 AliCDBMetaData metaData;
145 metaData.SetBeamPeriod(0);
146 metaData.SetResponsible("Wilfried Monange/Raphaelle Bailhache");
147 metaData.SetComment("TRD calib test");
c8ab4518 148
149 Log("****** DCS ******\n");
cd4fc278 150
8dd14606 151 TObjArray * list=AliTRDSensorArray::GetList ();
cd4fc278 152
153 if (list == 0x0) {
6ace5fe2 154 Log ("Error during AliTRDSensorArray::GetList");
155 Log ("DCS will not be processing");
8dd14606 156 return kTRUE;
6ace5fe2 157 }
158
159 Int_t nEntries = list->GetEntries ();
160 Log (Form ("%d alias loaded", nEntries));
cd4fc278 161
6ace5fe2 162 Bool_t * results=new Bool_t [nEntries];
163 Int_t * nGraph=new Int_t [nEntries];
cd4fc278 164
6ace5fe2 165 for (Int_t iAlias = 0; iAlias < nEntries; iAlias++) {
cd4fc278 166
6ace5fe2 167 AliTRDSensorArray * oneTRDDCS = (AliTRDSensorArray *)list->At (iAlias);
cd4fc278 168
6ace5fe2 169 oneTRDDCS->SetStartTime (TTimeStamp (fStartTime));
170 oneTRDDCS->SetEndTime (TTimeStamp (fEndTime));
cd4fc278 171
c8ab4518 172 Log(Form("Processing DCS : \"%s\"", oneTRDDCS->GetStoreName ().Data ()));
cd4fc278 173
6ace5fe2 174 TMap * map;
175
176 map=oneTRDDCS->ExtractDCS (dcsAliasMap);
cd4fc278 177
6ace5fe2 178 nGraph [iAlias] = map->GetEntries ();
cd4fc278 179
6ace5fe2 180 if (nGraph [iAlias] == 0) {
181 Log("No TGraph for this dcsDatapointAlias : not stored");
182 results [iAlias] = kFALSE;
2ff01398 183 error = kTRUE;
6ace5fe2 184 continue;
185 }
cd4fc278 186
6ace5fe2 187 oneTRDDCS->SetGraph(map);
188 results[iAlias]=Store("Calib", oneTRDDCS->GetStoreName().Data(), oneTRDDCS, &metaData, 0, kTRUE);
189 delete map;
190
191 //results [iAlias] = StoreReferenceData("Calib", oneTRDDCS->GetStoreName ().Data (), oneTRDDCS, &metaData);
192
6ace5fe2 193 if (!results[iAlias]) {
8dd14606 194 AliError("Problem during StoreRef DCS");
195 error=kTRUE;
6ace5fe2 196 }
197
6ace5fe2 198 //BEGIN TEST (should not be removed ...)
199 /*
200 oneTRDDCS->ClearGraph();
201 oneTRDDCS->ClearFit();
202 oneTRDDCS->SetDiffCut2 (0.1);
203 map=oneTRDDCS->ExtractDCS (dcsAliasMap);
204 oneTRDDCS->SetGraph (map);
205 Store("Calib", ("cut_"+oneTRDDCS->GetStoreName()).Data(), oneTRDDCS, &metaData, 0, kTRUE);
206 delete map;
207
208
209 if(iAlias==1 || iAlias==19) continue;
210
211 oneTRDDCS->ClearGraph();
212 oneTRDDCS->ClearFit();
213 oneTRDDCS->SetDiffCut2(0);
214 map=oneTRDDCS->ExtractDCS(dcsAliasMap);
215 oneTRDDCS->MakeSplineFit(map);
216 Store("Calib", ("fit_"+oneTRDDCS->GetStoreName()).Data() , oneTRDDCS, &metaData, 0, kTRUE);
217 delete map;
218
219
220 oneTRDDCS->ClearGraph();
221 oneTRDDCS->ClearFit();
222 oneTRDDCS->SetDiffCut2 (0.1);
223 map=oneTRDDCS->ExtractDCS (dcsAliasMap);
224 oneTRDDCS->MakeSplineFit(map);
225 Store("Calib", ("cutfit_"+oneTRDDCS->GetStoreName()).Data() , oneTRDDCS, &metaData, 0, kTRUE);
226 delete map;
227 */
228 //END TEST
229
6ace5fe2 230 }
cd4fc278 231
6ace5fe2 232 Log (" Summury of DCS :\n");
233 Log (Form("%30s %10s %10s", "dcsDatapointAlias", "Stored ?", "# graph"));
234 for (Int_t iAlias = 0; iAlias < nEntries; iAlias++) {
235 AliTRDSensorArray * oneTRDDCS = (AliTRDSensorArray *)list->At (iAlias);
236 Log (Form ("%30s %10s %4d",
237 oneTRDDCS->GetStoreName ().Data (),
238 results[iAlias] ? "ok" : "X",
239 nGraph [iAlias]));
240 }
241 Log ("*********** End of DCS **********");
242
243 delete results;
244 delete nGraph;
245
8dd14606 246 return error;
c8ab4518 247
6ace5fe2 248}
249
250//______________________________________________________________________________________________
8dd14606 251Bool_t AliTRDPreprocessor::ExtractPedestals()
6ace5fe2 252{
253 //
254 // Pedestal running on LDCs at the DAQ
255 //
8dd14606 256
257 Bool_t error = kFALSE;
6ace5fe2 258
259 // Init a AliTRDCalibPadStatus
260 AliTRDCalibPadStatus calPedSum = AliTRDCalibPadStatus();
261
262 AliCDBMetaData metaData;
263 metaData.SetBeamPeriod(0);
264 metaData.SetResponsible("Raphaelle Bailhache");
265 metaData.SetComment("TRD calib test");
266
267 // Sum the contributions of the LDCs
268 TList * listpad = GetFileSources(kDAQ,"PADSTATUS");
8dd14606 269 if (!listpad) {
270 Log("No list found for the PEDESTRAL Run");
271 return kTRUE;
272 }
273
c8ab4518 274 // loop through all files from LDCs
8dd14606 275 UInt_t index = 0;
276 while (listpad->At(index)!=NULL) {
277 TObjString* fileNameEntry = (TObjString*) listpad->At(index);
278 if (fileNameEntry != NULL)
279 {
6ace5fe2 280 TString fileName = GetFile(kDAQ, "PADSTATUS",
281 fileNameEntry->GetString().Data());
8dd14606 282 if(fileName.Length() ==0){
6ace5fe2 283 Log(Form("Error by retrieving the file %d for the pedestal",(Int_t)index));
8dd14606 284 delete listpad;
285 return kTRUE;
cd4fc278 286 }
8dd14606 287
288 TFile *f = TFile::Open(fileName);
289 AliTRDCalibPadStatus *calPed;
290 f->GetObject("calibpadstatus",calPed);
291
292 if(calPed){
293
289cc637 294 Int_t sm = -1;
295
8dd14606 296 // analyse
289cc637 297 //calPed->AnalyseHisto();
298
299 // Add to the calPedSum
300 for (Int_t idet=0; idet<540; idet++) {
301 AliTRDCalROC *rocMean = calPed->GetCalRocMean(idet, kFALSE);
302 if ( rocMean ) {
303 calPedSum.SetCalRocMean(rocMean,idet);
304 sm = (Int_t) (idet / 30);
305 }
306 AliTRDCalROC *rocRMS = calPed->GetCalRocRMS(idet, kFALSE);
307 if ( rocRMS ) {
308 calPedSum.SetCalRocRMS(rocRMS,idet);
309 }
e4db522f 310 AliTRDCalROC *rocMeand = calPed->GetCalRocMeand(idet, kFALSE);
311 if ( rocMeand ) {
312 calPedSum.SetCalRocMeand(rocMeand,idet);
313 }
314 AliTRDCalROC *rocRMSd = calPed->GetCalRocRMSd(idet, kFALSE);
315 if ( rocRMSd ) {
316 calPedSum.SetCalRocRMSd(rocRMSd,idet);
317 }
289cc637 318 }// det loop
319
8dd14606 320 // store as reference data
321 TString name("PadStatus");
289cc637 322 name += sm;
8dd14606 323 if(!StoreReferenceData("DAQData",(const char *)name,(TObject *) calPed,&metaData)){
324 Log(Form("Error storing AliTRDCalibPadStatus object %d as reference data",(Int_t)index));
325 error = kTRUE;
326 }
289cc637 327
8dd14606 328 } // calPed
329 } // fileNameEntry
330 ++index;
331 }// while (list)
c8ab4518 332
8dd14606 333 Log(Form("%d elements found in the list for the pedestal",(Int_t)index));
334 if(index==0){
6ace5fe2 335 delete listpad;
8dd14606 336 return kTRUE;
6ace5fe2 337 }
c8ab4518 338
8dd14606 339 //
340 // Store pedestal entry to OCDB
341 //
c8ab4518 342
8dd14606 343 // Create Pad Status
344 AliTRDCalPadStatus *calPadStatus = calPedSum.CreateCalPadStatus();
345 AliCDBMetaData md3;
346 md3.SetObjectClassName("AliTRDCalPadStatus");
347 md3.SetResponsible("Raphaelle Bailhache");
348 md3.SetBeamPeriod(1);
349 md3.SetComment("TRD calib test");
350 if(!Store("Calib","PadStatus" ,(TObject *)calPadStatus, &md3, 0, kTRUE)){
351 Log("Error storing the pedestal");
352 delete listpad;
353 return kTRUE;
a5e1169e 354 }
289cc637 355
356 // Create Noise
357 //Make the AliTRDCalPad
358 AliTRDCalPad *calPad2 = calPedSum.CreateCalPad();
359 AliCDBMetaData md4;
360 md4.SetObjectClassName("AliTRDCalPad");
361 md4.SetResponsible("Raphaelle Bailhache");
362 md4.SetBeamPeriod(1);
363 md4.SetComment("TRD calib test");
364 if(!Store("Calib","PadNoise" ,(TObject *)calPad2, &md4, 0, kTRUE)){
365 Log("Error storing the pedestal");
366 delete listpad;
367 return kTRUE;
368 }
369 //Make the AliTRDCalDet correspondant
370 AliTRDCalDet *calDet = calPedSum.CreateCalDet();
371 AliCDBMetaData md5;
372 md5.SetObjectClassName("AliTRDCalDet");
373 md5.SetResponsible("Raphaelle Bailhache");
374 md5.SetBeamPeriod(1);
375 md5.SetComment("TRD calib test");
376 if(!Store("Calib","DetNoise" ,(TObject *)calDet, &md5, 0, kTRUE)){
377 Log("Error storing the pedestal");
378 delete listpad;
379 return kTRUE;
380 }
381
8dd14606 382 delete listpad;
383 return error;
a5e1169e 384
6ace5fe2 385}
c8ab4518 386
6ace5fe2 387//______________________________________________________________________________________________
8dd14606 388Bool_t AliTRDPreprocessor::ExtractDriftVelocityDAQ()
6ace5fe2 389{
e5c60cc7 390 //
6ace5fe2 391 // Drift velocity DA running on monitoring servers at the DAQ
e5c60cc7 392 //
393
8dd14606 394 Bool_t error = kFALSE;
6ace5fe2 395
396 // Objects for HLT and DAQ zusammen
3a0f6479 397 AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance();
6ace5fe2 398 AliCDBMetaData metaData;
399 metaData.SetBeamPeriod(0);
400 metaData.SetResponsible("Raphaelle Bailhache");
401 metaData.SetComment("TRD calib test");
3a0f6479 402 // Store the infos for the detector
6ace5fe2 403 AliCDBMetaData md1;
404 md1.SetObjectClassName("AliTRDCalDet");
405 md1.SetResponsible("Raphaelle Bailhache");
406 md1.SetBeamPeriod(0);
407 md1.SetComment("TRD calib test");
3a0f6479 408 // Store the infos for the pads
6ace5fe2 409 AliCDBMetaData md2;
410 md2.SetObjectClassName("AliTRDCalPad");
411 md2.SetResponsible("Raphaelle Bailhache");
412 md2.SetBeamPeriod(0);
413 md2.SetComment("TRD calib test");
3a0f6479 414
6ace5fe2 415 // Take the file from the DAQ file exchange server
416 TList *listdaq = GetFileSources(kDAQ,"VDRIFT");
8dd14606 417 if (!listdaq) {
6ace5fe2 418 Log("No list found for vdrift (DAQ)");
8dd14606 419 return kTRUE;
420 }
421
422 if(listdaq->GetSize() !=1){
423 Log(Form("Problem on the size of the list: %d (DAQ)",listdaq->GetSize()));
424 delete listdaq;
425 return kTRUE;
6ace5fe2 426 }
8dd14606 427
428 TObjString* fileNameEntry = (TObjString*) listdaq->At(0);
429 if(fileNameEntry != NULL){
430 TString fileName = GetFile(kDAQ, "VDRIFT",
431 fileNameEntry->GetString().Data());
432 if(fileName.Length() ==0){
433 Log("Error retrieving the file vdrift (DAQ)");
434 delete listdaq;
435 return kTRUE;
436 }
437 TFile *filedaq = TFile::Open(fileName);
438 TProfile2D *histodriftvelocity = (TProfile2D *) filedaq->Get("PH2d");
439 if (histodriftvelocity) {
440
441 // store as reference data
442 if(!StoreReferenceData("DAQData","VdriftT0",(TObject *) histodriftvelocity,&metaData)){
443 Log("Error storing 2D Profile for vdrift from the DAQ");
444 error = kTRUE;
445 }
446
447 // analyse
448
449 Log("Take the PH reference data. Now we will try to fit\n");
450 calibra->SetMinEntries(2000); // If there is less than 2000
451 calibra->AnalysePH(histodriftvelocity);
452
453 Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(1))
454 + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(1));
455 Int_t nbfit = calibra->GetNumberFit();
456 Int_t nbE = calibra->GetNumberEnt();
457
458 // if enough statistics store the results
459 if ((nbtg > 0) &&
460 (nbfit >= 0.95*nbE)) {
461 // create the cal objects
462 TObjArray object = calibra->GetVectorFit();
463 AliTRDCalDet *objdriftvelocitydet = calibra->CreateDetObjectVdrift(&object,kTRUE);
464 TObject *objdriftvelocitypad = calibra->CreatePadObjectVdrift();
465 object = calibra->GetVectorFit2();
466 AliTRDCalDet *objtime0det = calibra->CreateDetObjectT0(&object,kTRUE);
467 TObject *objtime0pad = calibra->CreatePadObjectT0();
468 calibra->ResetVectorFit();
469 // store
470 if(!Store("Calib","ChamberVdrift" ,(TObject *) objdriftvelocitydet,&md1,0,kTRUE)){
471 Log("Error storing the calibration object for the chamber vdrift (DAQ)");
472 error = kTRUE;
473 }
474 if(!Store("Calib","ChamberT0" ,(TObject *) objtime0det ,&md1,0,kTRUE)){
475 Log("Error storing the calibration object for the chamber t0 (DAQ)");
476 error = kTRUE;
477 }
478 if(!Store("Calib","LocalVdrift" ,(TObject *) objdriftvelocitypad,&md2,0,kTRUE)){
479 Log("Error storing the calibration object for the local drift velocity (DAQ)");
480 error = kTRUE;
481 }
482 if(!Store("Calib","LocalT0" ,(TObject *) objtime0pad ,&md2,0,kTRUE)){
483 Log("Error storing the calibration object for the local time0 (DAQ)");
484 error = kTRUE;
485 }
486 }
487 else{
488 Log("Not enough statistics for the average pulse height (DAQ)");
489 }
490 } // histo here
491 }// if fileNameEntry
492
493 delete listdaq;
494 return error;
495
6ace5fe2 496}
c8ab4518 497
6ace5fe2 498//______________________________________________________________________________________________
8dd14606 499Bool_t AliTRDPreprocessor::ExtractHLT()
6ace5fe2 500{
e5c60cc7 501 //
6ace5fe2 502 // Gain, vdrift and PRF calibration running on HLT
f5bb5557 503 // return kTRUE if NULL pointer to the list
e5c60cc7 504 //
3a0f6479 505
8dd14606 506 Bool_t error = kFALSE;
507
6ace5fe2 508 // Objects for HLT and DAQ zusammen
509 AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance();
510 AliCDBMetaData metaData;
511 metaData.SetBeamPeriod(0);
512 metaData.SetResponsible("Raphaelle Bailhache");
513 metaData.SetComment("TRD calib test");
514 // Store the infos for the detector
515 AliCDBMetaData md1;
516 md1.SetObjectClassName("AliTRDCalDet");
517 md1.SetResponsible("Raphaelle Bailhache");
518 md1.SetBeamPeriod(0);
519 md1.SetComment("TRD calib test");
520 // Store the infos for the pads
521 AliCDBMetaData md2;
522 md2.SetObjectClassName("AliTRDCalPad");
523 md2.SetResponsible("Raphaelle Bailhache");
524 md2.SetBeamPeriod(0);
525 md2.SetComment("TRD calib test");
6ace5fe2 526
527 // Take the file from the HLT file exchange server
528 TList *listhlt = GetFileSources(kHLT,"GAINDRIFTPRF");
8dd14606 529 if (!listhlt) {
6ace5fe2 530 Log("No list found for the HLT");
8dd14606 531 return kTRUE;
532 }
533
534 if(listhlt->GetSize() != 1) {
535 Log(Form("Problem on the size of the list: %d (HLT)",listhlt->GetSize()));
536 delete listhlt;
537 return kTRUE;
6ace5fe2 538 }
3a0f6479 539
8dd14606 540 TObjString* fileNameEntry = (TObjString*) listhlt->At(0);
541 if(fileNameEntry != NULL){
542 TString fileName = GetFile(kHLT, "GAINDRIFTPRF",
543 fileNameEntry->GetString().Data());
544 if(fileName.Length() ==0){
545 Log("Error retrieving the file (HLT)");
546 delete listhlt;
547 return kTRUE;
548 }
549 // Take the file
550 TFile *filehlt = TFile::Open(fileName);
551
8dd14606 552 // gain
553 TH2I *histogain = (TH2I *) filehlt->Get("CH2d");
554 histogain->SetDirectory(0);
555 if (histogain) {
556 // store the reference data
557 if(!StoreReferenceData("HLTData","Gain",(TObject *) histogain,&metaData)){
558 Log("Error storing 2D histos for gain");
559 error = kTRUE;
560 }
561 // analyse
562 Log("Take the CH reference data. Now we will try to fit\n");
563 calibra->SetMinEntries(1000); // If there is less than 1000 entries in the histo: no fit
564 calibra->AnalyseCH(histogain);
565 Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(0))
566 + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(0));
567 Int_t nbfit = calibra->GetNumberFit();
568 Int_t nbE = calibra->GetNumberEnt();
569 // enough statistics
570 if ((nbtg > 0) &&
571 (nbfit >= 0.95*nbE)) {
572 // create the cal objects
573 TObjArray object = calibra->GetVectorFit();
413153cb 574 AliTRDCalDet *objgaindet = calibra->CreateDetObjectGain(&object);
8dd14606 575 TObject *objgainpad = calibra->CreatePadObjectGain();
576 // store them
577 if(!Store("Calib","ChamberGainFactor",(TObject *) objgaindet ,&md1,0,kTRUE)){
578 Log("Error storing the calibration object for the chamber gain");
579 error = kTRUE;
580 }
581 if(!Store("Calib","LocalGainFactor" ,(TObject *) objgainpad ,&md2,0,kTRUE)){
582 Log("Error storing the calibration object for the local gain factor");
583 error = kTRUE;
584 }
585 }
586 calibra->ResetVectorFit();
587 }// if histogain
588
8dd14606 589 // vdrift
590 fVdriftHLT = kFALSE;
591 TProfile2D *histodriftvelocity = (TProfile2D *) filehlt->Get("PH2d");
592 histodriftvelocity->SetDirectory(0);
593 if (histodriftvelocity) {
594 // store the reference data
595 if(!StoreReferenceData("HLTData","VdriftT0",(TObject *) histodriftvelocity,&metaData)){
596 Log("Error storing 2D Profile for average pulse height (HLT)");
597 error = kTRUE;
598 }
599 // analyse
600 Log("Take the PH reference data. Now we will try to fit\n");
601 calibra->SetMinEntries(1000*20); // If there is less than 20000
602 calibra->AnalysePH(histodriftvelocity);
603 Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(1))
604 + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(1));
605 Int_t nbfit = calibra->GetNumberFit();
606 Int_t nbE = calibra->GetNumberEnt();
607 // enough statistics
608 if ((nbtg > 0) &&
609 (nbfit >= 0.95*nbE)) {
610 // create the cal objects
611 TObjArray object = calibra->GetVectorFit();
612 AliTRDCalDet *objdriftvelocitydet = calibra->CreateDetObjectVdrift(&object,kTRUE);
613 TObject *objdriftvelocitypad = calibra->CreatePadObjectVdrift();
614 object = calibra->GetVectorFit2();
615 AliTRDCalDet *objtime0det = calibra->CreateDetObjectT0(&object,kTRUE);
616 TObject *objtime0pad = calibra->CreatePadObjectT0();
617 // store them
618 if(!Store("Calib","ChamberVdrift" ,(TObject *) objdriftvelocitydet,&md1,0,kTRUE)){
619 Log("Error storing the calibration object for the chamber vdrift (HLT)");
620 error = kTRUE;
621 }
622 if(!Store("Calib","ChamberT0" ,(TObject *) objtime0det ,&md1,0,kTRUE)){
623 Log("Error storing the calibration object for the chamber t0 (HLT)");
624 error = kTRUE;
625 }
626 if(!Store("Calib","LocalVdrift" ,(TObject *) objdriftvelocitypad,&md2,0,kTRUE)){
627 Log("Error storing the calibration object for the local drift velocity (HLT)");
628 error = kTRUE;
629 }
630 if(!Store("Calib","LocalT0" ,(TObject *) objtime0pad ,&md2,0,kTRUE)){
631 Log("Error storing the calibration object for the local time0 (HLT)");
632 error = kTRUE;
633 }
634 fVdriftHLT = kTRUE;
635 }
636 calibra->ResetVectorFit();
637 }// if TProfile2D
638
8dd14606 639 // prf
640 TProfile2D *histoprf = (TProfile2D *) filehlt->Get("PRF2d");
641 histoprf->SetDirectory(0);
642 if (histoprf) {
643 // store reference data
644 if(!StoreReferenceData("HLTData","PRF",(TObject *) histoprf,&metaData)){
645 Log("Error storing the 2D Profile for Pad Response Function");
646 error = kTRUE;
647 }
648 // analyse
649 Log("Take the PRF reference data. Now we will try to fit\n");
650 calibra->SetMinEntries(600); // If there is less than 20000
651 calibra->AnalysePRFMarianFit(histoprf);
652 Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(2))
653 + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(2));
654 Int_t nbfit = calibra->GetNumberFit();
655 Int_t nbE = calibra->GetNumberEnt();
656 // enough statistics
657 if ((nbtg > 0) &&
658 (nbfit >= 0.95*nbE)) {
659 // create cal pad objects
660 TObjArray object = calibra->GetVectorFit();
661 TObject *objPRFpad = calibra->CreatePadObjectPRF(&object);
662 // store them
663 if(!Store("Calib","PRFWidth" ,(TObject *) objPRFpad ,&md2,0,kTRUE)){
664 Log("Error storing the calibration object for the Pad Response Function");
665 error = kTRUE;
666 }
667 }
668 calibra->ResetVectorFit();
669 }// if PRF
670 }// if fileNameEntry
671
672 delete listhlt;
673 return error;
674
e5c60cc7 675}