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