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