In vmctest/production:
[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// //
fdfee371 28// Authors: //
ec55623f 29// R. Bailhache (R.Bailhache@gsi.de) //
cd4fc278 30// W. Monange (w.monange@gsi.de) //
fdfee371 31// F. Kramer (kramer@ikf.uni-frankfurt.de) //
ec55623f 32// //
33////////////////////////////////////////////////////////////////////////////
e5c60cc7 34
c893147d 35#include <fstream>
36
e5c60cc7 37#include <TFile.h>
38#include <TProfile2D.h>
e5c60cc7 39#include <TObjString.h>
40#include <TString.h>
41#include <TList.h>
fdfee371 42#include <TSAXParser.h>
e5c60cc7 43
44#include "AliCDBMetaData.h"
e5c60cc7 45#include "AliLog.h"
46
c8ab4518 47#include "AliTRDPreprocessor.h"
3a0f6479 48#include "AliTRDSensorArray.h"
67c25e8d 49#include "AliTRDCalibraFit.h"
50#include "AliTRDCalibraMode.h"
3a0f6479 51#include "AliTRDCalibPadStatus.h"
fdfee371 52#include "AliTRDSaxHandler.h"
c893147d 53#include "AliTRDgeometry.h"
5029ad25 54#include "Cal/AliTRDCalPad.h"
3a0f6479 55#include "Cal/AliTRDCalPadStatus.h"
fdfee371 56#include "Cal/AliTRDCalDCS.h"
5029ad25 57#include "Cal/AliTRDCalSingleChamberStatus.h"
58#include "Cal/AliTRDCalROC.h"
59
e5c60cc7 60ClassImp(AliTRDPreprocessor)
61
62//______________________________________________________________________________________________
ec55623f 63AliTRDPreprocessor::AliTRDPreprocessor(AliShuttleInterface *shuttle)
c8ab4518 64 :AliPreprocessor("TRD", shuttle)
65 ,fVdriftHLT(0)
e5c60cc7 66{
67 //
68 // Constructor
69 //
70
f9ed5395 71 AddRunType("PHYSICS");
72 AddRunType("STANDALONE");
73 AddRunType("PEDESTAL");
74 AddRunType("DAQ");
75
e5c60cc7 76}
77
78//______________________________________________________________________________________________
79AliTRDPreprocessor::~AliTRDPreprocessor()
80{
81 //
82 // Destructor
83 //
84
85}
86
87//______________________________________________________________________________________________
88void AliTRDPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
89{
90 //
91 // Initialization routine for the TRD preprocessor
92 //
93
94 AliPreprocessor::Initialize(run,startTime,endTime);
95
96}
97
98//______________________________________________________________________________________________
a5e1169e 99UInt_t AliTRDPreprocessor::Process(TMap* dcsAliasMap)
e5c60cc7 100{
101 //
a5e1169e 102 // Process DCS and calibration part for HLT
103 //
104
8dd14606 105 TString runType = GetRunType();
106 Log(Form("runtype %s\n",runType.Data()));
65ffd646 107
fdfee371 108 // always process the configuration data
3821ce70 109 Int_t DCSConfigReturn = ProcessDCSConfigData();
110 if(DCSConfigReturn) return DCSConfigReturn;
f9ed5395 111
b70c68da 112 if (runType=="PEDESTAL"){
8dd14606 113 if(ExtractPedestals()) return 1;
114 return 0;
115 }
a5e1169e 116
f9ed5395 117 if ((runType=="PHYSICS") || (runType=="STANDALONE") || (runType=="DAQ")){
65ffd646 118 // DCS
207402fc 119 if(ProcessDCS(dcsAliasMap)) return 1;
f9ed5395 120 if(runType=="PHYSICS"){
121 // HLT if On
122 //TString runPar = GetRunParameter("HLTStatus");
123 //if(runPar=="1") {
124 if(GetHLTStatus()) {
83bc2fc6 125 //if(ExtractHLT()) return 1; // for testing!
126 ExtractHLT();
f9ed5395 127 }
128 // DAQ if HLT failed
129 if(!fVdriftHLT) {
594b418c 130 //if(ExtractDriftVelocityDAQ()) return 1;
131 ExtractDriftVelocityDAQ(); // for testing!
f9ed5395 132 }
133 }
6ace5fe2 134 }
8dd14606 135
136 return 0;
6ace5fe2 137
138}
f5bb5557 139//______________________________________________________________________________
140Bool_t AliTRDPreprocessor::ProcessDCS()
141{
c8ab4518 142 //
143 // Default process DCS method
144 //
f5bb5557 145
146 TString runType = GetRunType();
b70c68da 147 if ((runType == "PHYSICS") || (runType == "STANDALONE")) {
c8ab4518 148 return kTRUE;
149 }
f5bb5557 150 return kFALSE;
151
152}
6ace5fe2 153
6ace5fe2 154//______________________________________________________________________________
c8ab4518 155Bool_t AliTRDPreprocessor::ProcessDCS(TMap *dcsAliasMap)
6ace5fe2 156{
c8ab4518 157 //
158 // Process DCS method
159 //
160
161 Bool_t error = kFALSE;
6ace5fe2 162
a5e1169e 163 AliCDBMetaData metaData;
164 metaData.SetBeamPeriod(0);
165 metaData.SetResponsible("Wilfried Monange/Raphaelle Bailhache");
166 metaData.SetComment("TRD calib test");
c8ab4518 167
168 Log("****** DCS ******\n");
cd4fc278 169
8dd14606 170 TObjArray * list=AliTRDSensorArray::GetList ();
cd4fc278 171
172 if (list == 0x0) {
6ace5fe2 173 Log ("Error during AliTRDSensorArray::GetList");
174 Log ("DCS will not be processing");
8dd14606 175 return kTRUE;
6ace5fe2 176 }
177
178 Int_t nEntries = list->GetEntries ();
179 Log (Form ("%d alias loaded", nEntries));
cd4fc278 180
6ace5fe2 181 Bool_t * results=new Bool_t [nEntries];
182 Int_t * nGraph=new Int_t [nEntries];
cd4fc278 183
6ace5fe2 184 for (Int_t iAlias = 0; iAlias < nEntries; iAlias++) {
cd4fc278 185
6ace5fe2 186 AliTRDSensorArray * oneTRDDCS = (AliTRDSensorArray *)list->At (iAlias);
cd4fc278 187
6ace5fe2 188 oneTRDDCS->SetStartTime (TTimeStamp (fStartTime));
189 oneTRDDCS->SetEndTime (TTimeStamp (fEndTime));
cd4fc278 190
c8ab4518 191 Log(Form("Processing DCS : \"%s\"", oneTRDDCS->GetStoreName ().Data ()));
cd4fc278 192
6ace5fe2 193 TMap * map;
194
195 map=oneTRDDCS->ExtractDCS (dcsAliasMap);
cd4fc278 196
6ace5fe2 197 nGraph [iAlias] = map->GetEntries ();
cd4fc278 198
6ace5fe2 199 if (nGraph [iAlias] == 0) {
200 Log("No TGraph for this dcsDatapointAlias : not stored");
201 results [iAlias] = kFALSE;
611a7239 202 //error = kTRUE;
6ace5fe2 203 continue;
204 }
cd4fc278 205
6ace5fe2 206 oneTRDDCS->SetGraph(map);
611a7239 207 results[iAlias]=Store("Calib", oneTRDDCS->GetStoreName().Data(), oneTRDDCS, &metaData, 0, kFALSE);
6ace5fe2 208 delete map;
209
210 //results [iAlias] = StoreReferenceData("Calib", oneTRDDCS->GetStoreName ().Data (), oneTRDDCS, &metaData);
211
6ace5fe2 212 if (!results[iAlias]) {
8dd14606 213 AliError("Problem during StoreRef DCS");
611a7239 214 //error=kTRUE;
6ace5fe2 215 }
216
6ace5fe2 217 //BEGIN TEST (should not be removed ...)
218 /*
219 oneTRDDCS->ClearGraph();
220 oneTRDDCS->ClearFit();
221 oneTRDDCS->SetDiffCut2 (0.1);
222 map=oneTRDDCS->ExtractDCS (dcsAliasMap);
223 oneTRDDCS->SetGraph (map);
224 Store("Calib", ("cut_"+oneTRDDCS->GetStoreName()).Data(), oneTRDDCS, &metaData, 0, kTRUE);
225 delete map;
226
227
228 if(iAlias==1 || iAlias==19) continue;
229
230 oneTRDDCS->ClearGraph();
231 oneTRDDCS->ClearFit();
232 oneTRDDCS->SetDiffCut2(0);
233 map=oneTRDDCS->ExtractDCS(dcsAliasMap);
234 oneTRDDCS->MakeSplineFit(map);
235 Store("Calib", ("fit_"+oneTRDDCS->GetStoreName()).Data() , oneTRDDCS, &metaData, 0, kTRUE);
236 delete map;
237
238
239 oneTRDDCS->ClearGraph();
240 oneTRDDCS->ClearFit();
241 oneTRDDCS->SetDiffCut2 (0.1);
242 map=oneTRDDCS->ExtractDCS (dcsAliasMap);
243 oneTRDDCS->MakeSplineFit(map);
244 Store("Calib", ("cutfit_"+oneTRDDCS->GetStoreName()).Data() , oneTRDDCS, &metaData, 0, kTRUE);
245 delete map;
246 */
247 //END TEST
248
6ace5fe2 249 }
611a7239 250
251 // Check errors
252 Int_t nbCount = 0;
253 for (Int_t iAlias = 0; iAlias < nEntries; iAlias++) {
254 if (results[iAlias]) {
255 nbCount++;
256 }
257 }
258 if(nbCount == 0) error = kTRUE;
259
cd4fc278 260
6ace5fe2 261 Log (" Summury of DCS :\n");
262 Log (Form("%30s %10s %10s", "dcsDatapointAlias", "Stored ?", "# graph"));
263 for (Int_t iAlias = 0; iAlias < nEntries; iAlias++) {
264 AliTRDSensorArray * oneTRDDCS = (AliTRDSensorArray *)list->At (iAlias);
265 Log (Form ("%30s %10s %4d",
266 oneTRDDCS->GetStoreName ().Data (),
267 results[iAlias] ? "ok" : "X",
268 nGraph [iAlias]));
269 }
270 Log ("*********** End of DCS **********");
271
272 delete results;
273 delete nGraph;
274
8dd14606 275 return error;
c8ab4518 276
6ace5fe2 277}
278
279//______________________________________________________________________________________________
8dd14606 280Bool_t AliTRDPreprocessor::ExtractPedestals()
6ace5fe2 281{
282 //
283 // Pedestal running on LDCs at the DAQ
284 //
54c85ef7 285
286 //
287 // The reference data are stored in:
288 // PadStatus1 for sm-00-01-02-09-10-11
289 // PadStatus2 for sm-03-04-05-12-13-14
290 // PadStatus3 for sm-06-07-08-15-16-17
291 // PadStatus0 if nothing found..means problems
292 //
5029ad25 293
8dd14606 294 Bool_t error = kFALSE;
6ace5fe2 295
296 // Init a AliTRDCalibPadStatus
297 AliTRDCalibPadStatus calPedSum = AliTRDCalibPadStatus();
298
299 AliCDBMetaData metaData;
300 metaData.SetBeamPeriod(0);
301 metaData.SetResponsible("Raphaelle Bailhache");
302 metaData.SetComment("TRD calib test");
303
304 // Sum the contributions of the LDCs
305 TList * listpad = GetFileSources(kDAQ,"PADSTATUS");
8dd14606 306 if (!listpad) {
307 Log("No list found for the PEDESTRAL Run");
308 return kTRUE;
309 }
310
c8ab4518 311 // loop through all files from LDCs
8dd14606 312 UInt_t index = 0;
313 while (listpad->At(index)!=NULL) {
314 TObjString* fileNameEntry = (TObjString*) listpad->At(index);
315 if (fileNameEntry != NULL)
316 {
6ace5fe2 317 TString fileName = GetFile(kDAQ, "PADSTATUS",
318 fileNameEntry->GetString().Data());
8dd14606 319 if(fileName.Length() ==0){
6ace5fe2 320 Log(Form("Error by retrieving the file %d for the pedestal",(Int_t)index));
8dd14606 321 delete listpad;
322 return kTRUE;
cd4fc278 323 }
8dd14606 324
325 TFile *f = TFile::Open(fileName);
326 AliTRDCalibPadStatus *calPed;
327 f->GetObject("calibpadstatus",calPed);
328
329 if(calPed){
330
54c85ef7 331 Int_t ldc = 0;
289cc637 332
8dd14606 333 // analyse
289cc637 334 //calPed->AnalyseHisto();
335
336 // Add to the calPedSum
337 for (Int_t idet=0; idet<540; idet++) {
338 AliTRDCalROC *rocMean = calPed->GetCalRocMean(idet, kFALSE);
339 if ( rocMean ) {
340 calPedSum.SetCalRocMean(rocMean,idet);
54c85ef7 341 ldc = (Int_t) (idet / 30);
289cc637 342 }
343 AliTRDCalROC *rocRMS = calPed->GetCalRocRMS(idet, kFALSE);
344 if ( rocRMS ) {
345 calPedSum.SetCalRocRMS(rocRMS,idet);
346 }
e4db522f 347 AliTRDCalROC *rocMeand = calPed->GetCalRocMeand(idet, kFALSE);
348 if ( rocMeand ) {
349 calPedSum.SetCalRocMeand(rocMeand,idet);
350 }
351 AliTRDCalROC *rocRMSd = calPed->GetCalRocRMSd(idet, kFALSE);
352 if ( rocRMSd ) {
353 calPedSum.SetCalRocRMSd(rocRMSd,idet);
354 }
289cc637 355 }// det loop
356
1ac4bb35 357 if((ldc==0) || (ldc==1) || (ldc==2)) ldc = 1;
358 if((ldc==3) || (ldc==4) || (ldc==5)) ldc = 2;
359 if((ldc==6) || (ldc==7) || (ldc==8)) ldc = 3;
360 if((ldc==9) || (ldc==10) || (ldc==11)) ldc = 4;
361 if((ldc==12) || (ldc==13) || (ldc==14)) ldc = 5;
362 if((ldc==15) || (ldc==16) || (ldc==17)) ldc = 6;
54c85ef7 363
8dd14606 364 // store as reference data
365 TString name("PadStatus");
54c85ef7 366 name += ldc;
8dd14606 367 if(!StoreReferenceData("DAQData",(const char *)name,(TObject *) calPed,&metaData)){
368 Log(Form("Error storing AliTRDCalibPadStatus object %d as reference data",(Int_t)index));
369 error = kTRUE;
370 }
289cc637 371
8dd14606 372 } // calPed
373 } // fileNameEntry
374 ++index;
375 }// while (list)
c8ab4518 376
8dd14606 377 Log(Form("%d elements found in the list for the pedestal",(Int_t)index));
378 if(index==0){
6ace5fe2 379 delete listpad;
8dd14606 380 return kTRUE;
6ace5fe2 381 }
c8ab4518 382
8dd14606 383 //
5029ad25 384 // Create pedestal
8dd14606 385 //
c8ab4518 386
8dd14606 387 // Create Pad Status
388 AliTRDCalPadStatus *calPadStatus = calPedSum.CreateCalPadStatus();
5029ad25 389 // Create Noise
390 //Make the AliTRDCalPad
391 AliTRDCalPad *calPad2 = calPedSum.CreateCalPad();
392 //Make the AliTRDCalDet correspondant
393 AliTRDCalDet *calDet = calPedSum.CreateCalDet();
394
395 //
396 // Take the noise and Pad status from the previous OCDB
397 //
398
399 AliTRDCalPad *calPadPrevious=0;
400 AliCDBEntry* entry = GetFromOCDB("Calib", "PadNoise");
401 if (entry) calPadPrevious = (AliTRDCalPad*)entry->GetObject();
402 if ( calPadPrevious==NULL ) {
403 Log("AliTRDPreprocsessor: No previous TRD pad noise entry available.\n");
404 calPadPrevious = new AliTRDCalPad("PadNoise", "PadNoise");
405 }
406
407 AliTRDCalPadStatus *calPadStatusPrevious=0;
408 entry = GetFromOCDB("Calib", "PadStatus");
409 if (entry) calPadStatusPrevious = (AliTRDCalPadStatus*)entry->GetObject();
410 if ( calPadStatusPrevious==NULL ) {
411 Log("AliTRDPreprocsessor: No previous TRD pad status entry available.\n");
412 calPadStatusPrevious = new AliTRDCalPadStatus("padstatus", "padstatus");
413 for (Int_t idet=0; idet<540; ++idet)
414 {
415 AliTRDCalSingleChamberStatus *calROC = calPadStatusPrevious->GetCalROC(idet);
416 for(Int_t k = 0; k < calROC->GetNchannels(); k++){
417 calROC->SetStatus(k,AliTRDCalPadStatus::kMasked);
418 }
419 }
420 }
421
422
423 // Loop over detectors for check
424 for (Int_t det=0; det<AliTRDgeometry::kNdet; ++det) {
425
426 // noise
427 AliTRDCalROC *calROCPreviousNoise = calPadPrevious->GetCalROC(det);
428 AliTRDCalROC *calROCNoise = calPad2->GetCalROC(det);
429
430 // padstatus
431 AliTRDCalSingleChamberStatus *calROCPreviousStatus = calPadStatusPrevious->GetCalROC(det);
432 AliTRDCalSingleChamberStatus *calROCStatus = calPadStatus->GetCalROC(det);
433
434
435 // loop over first half and second half chamber
436 for(Int_t half = 0; half < 2; half++){
437
438 Bool_t data = AreThereDataPedestal(calROCStatus,(Bool_t)half);
37b0cf5e 439 //printf("There are data for the detector %d the half %d: %d\n",det,half,data);
5029ad25 440 if(!data){
441 // look if data in the OCDB
442 Bool_t dataPrevious = AreThereDataPedestal(calROCPreviousStatus,(Bool_t)half);
443 // if no data at all, set to default value
444 if(!dataPrevious){
445 SetDefaultStatus(*calROCStatus,(Bool_t)half);
446 SetDefaultNoise(*calROCNoise,(Bool_t)half);
447 }
448 else{
449 // if data, set to previous value
450 SetStatus(*calROCStatus,calROCPreviousStatus,(Bool_t)half);
451 SetNoise(*calROCNoise,calROCPreviousNoise,(Bool_t)half);
452 }
453 }
454 }
455 }
456
457 //
458 // Store
459 //
460
8dd14606 461 AliCDBMetaData md3;
462 md3.SetObjectClassName("AliTRDCalPadStatus");
463 md3.SetResponsible("Raphaelle Bailhache");
464 md3.SetBeamPeriod(1);
465 md3.SetComment("TRD calib test");
466 if(!Store("Calib","PadStatus" ,(TObject *)calPadStatus, &md3, 0, kTRUE)){
467 Log("Error storing the pedestal");
468 delete listpad;
469 return kTRUE;
a5e1169e 470 }
289cc637 471
289cc637 472 AliCDBMetaData md4;
473 md4.SetObjectClassName("AliTRDCalPad");
474 md4.SetResponsible("Raphaelle Bailhache");
475 md4.SetBeamPeriod(1);
476 md4.SetComment("TRD calib test");
477 if(!Store("Calib","PadNoise" ,(TObject *)calPad2, &md4, 0, kTRUE)){
478 Log("Error storing the pedestal");
479 delete listpad;
480 return kTRUE;
481 }
5029ad25 482
289cc637 483 AliCDBMetaData md5;
484 md5.SetObjectClassName("AliTRDCalDet");
485 md5.SetResponsible("Raphaelle Bailhache");
486 md5.SetBeamPeriod(1);
487 md5.SetComment("TRD calib test");
488 if(!Store("Calib","DetNoise" ,(TObject *)calDet, &md5, 0, kTRUE)){
489 Log("Error storing the pedestal");
490 delete listpad;
491 return kTRUE;
492 }
493
8dd14606 494 delete listpad;
495 return error;
5029ad25 496
497}
c893147d 498
5029ad25 499//__________________________________________________________________
c893147d 500Bool_t AliTRDPreprocessor::AreThereDataPedestal(AliTRDCalSingleChamberStatus * const calROCStatus
501 , Bool_t second)
502{
a5e1169e 503
5029ad25 504 //
505 // Data for this half chamber
506 //
507
508 Bool_t data = kFALSE;
509 Int_t nCols = calROCStatus->GetNcols();
510 Int_t nCol0 = 0;
511 Int_t nColE = (Int_t) nCols/2 - 2;
512 if(second) {
513 nCol0 = nColE + 4;
514 nColE = nCols;
515 }
f2a468d7 516
517 Int_t totalnumberofpads = 0;
518 Int_t totalnumberofdata = 0;
519
5029ad25 520 for(Int_t col = nCol0; col < nColE; col++){
521 for(Int_t row = 0; row < calROCStatus->GetNrows(); row++){
f2a468d7 522 totalnumberofpads++;
5029ad25 523 //printf("ismasked %d\n",(Int_t)calROCStatus->IsMasked(col,row));
37b0cf5e 524 if(!calROCStatus->GetStatus(col,row)) {
5029ad25 525 data = kTRUE;
f2a468d7 526 totalnumberofdata++;
5029ad25 527 }
528 }
5029ad25 529 }
f2a468d7 530 if(totalnumberofdata < (Int_t)(totalnumberofpads/2)) data = kFALSE;
5029ad25 531
532 return data;
533
534}
535//__________________________________________________________________
536void AliTRDPreprocessor::SetDefaultStatus(AliTRDCalSingleChamberStatus &calROCStatus, Bool_t second){
537
538 //
539 // default status for this half chamber
540 //
541
542 Int_t nCols = calROCStatus.GetNcols();
543 Int_t nCol0 = 0;
544 Int_t nColE = (Int_t) nCols/2;
545 if(second) {
546 nCol0 = nColE;
547 nColE = nCols;
548 }
549 for(Int_t col = nCol0; col < nColE; col++){
550 for(Int_t row = 0; row < calROCStatus.GetNrows(); row++){
551 calROCStatus.SetStatus(col,row,0);
552 }
553 }
554}
555//__________________________________________________________________
556void AliTRDPreprocessor::SetStatus(AliTRDCalSingleChamberStatus &calROCStatus, AliTRDCalSingleChamberStatus *calROCStatusPrevious,Bool_t second){
557
558 //
559 // previous status for this half chamber
560 //
561
562 Int_t nCols = calROCStatus.GetNcols();
563 Int_t nCol0 = 0;
564 Int_t nColE = (Int_t) nCols/2;
565 if(second) {
566 nCol0 = nColE;
567 nColE = nCols;
568 }
569 for(Int_t col = nCol0; col < nColE; col++){
570 for(Int_t row = 0; row < calROCStatus.GetNrows(); row++){
571 calROCStatus.SetStatus(col,row,calROCStatusPrevious->GetStatus(col,row));
572 }
573 }
6ace5fe2 574}
5029ad25 575//__________________________________________________________________
576void AliTRDPreprocessor::SetDefaultNoise(AliTRDCalROC &calROCNoise, Bool_t second){
577
578 //
579 // default noise for this half chamber
580 //
c8ab4518 581
5029ad25 582 Int_t nCols = calROCNoise.GetNcols();
583 Int_t nCol0 = 0;
584 Int_t nColE = (Int_t) nCols/2;
585 if(second) {
586 nCol0 = nColE;
587 nColE = nCols;
588 }
589 for(Int_t col = nCol0; col < nColE; col++){
590 for(Int_t row = 0; row < calROCNoise.GetNrows(); row++){
591 calROCNoise.SetValue(col,row,0.12);
592 }
593 }
594}
595//__________________________________________________________________
596void AliTRDPreprocessor::SetNoise(AliTRDCalROC &calROCNoise, AliTRDCalROC *calROCNoisePrevious, Bool_t second){
597
598 //
599 // previous noise for this half chamber
600 //
601
602 Int_t nCols = calROCNoise.GetNcols();
603 Int_t nCol0 = 0;
604 Int_t nColE = (Int_t) nCols/2;
605 if(second) {
606 nCol0 = nColE;
607 nColE = nCols;
608 }
609 for(Int_t col = nCol0; col < nColE; col++){
610 for(Int_t row = 0; row < calROCNoise.GetNrows(); row++){
611 calROCNoise.SetValue(col,row,calROCNoisePrevious->GetValue(col,row));
612 }
613 }
614}
6ace5fe2 615//______________________________________________________________________________________________
8dd14606 616Bool_t AliTRDPreprocessor::ExtractDriftVelocityDAQ()
6ace5fe2 617{
a5e1169e 618 //
6ace5fe2 619 // Drift velocity DA running on monitoring servers at the DAQ
e5c60cc7 620 //
621
8dd14606 622 Bool_t error = kFALSE;
6ace5fe2 623
624 // Objects for HLT and DAQ zusammen
3a0f6479 625 AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance();
6ace5fe2 626 AliCDBMetaData metaData;
627 metaData.SetBeamPeriod(0);
628 metaData.SetResponsible("Raphaelle Bailhache");
629 metaData.SetComment("TRD calib test");
3a0f6479 630 // Store the infos for the detector
6ace5fe2 631 AliCDBMetaData md1;
632 md1.SetObjectClassName("AliTRDCalDet");
633 md1.SetResponsible("Raphaelle Bailhache");
634 md1.SetBeamPeriod(0);
635 md1.SetComment("TRD calib test");
3a0f6479 636 // Store the infos for the pads
6ace5fe2 637 AliCDBMetaData md2;
638 md2.SetObjectClassName("AliTRDCalPad");
639 md2.SetResponsible("Raphaelle Bailhache");
640 md2.SetBeamPeriod(0);
641 md2.SetComment("TRD calib test");
3a0f6479 642
6ace5fe2 643 // Take the file from the DAQ file exchange server
644 TList *listdaq = GetFileSources(kDAQ,"VDRIFT");
8dd14606 645 if (!listdaq) {
6ace5fe2 646 Log("No list found for vdrift (DAQ)");
8dd14606 647 return kTRUE;
648 }
649
650 if(listdaq->GetSize() !=1){
651 Log(Form("Problem on the size of the list: %d (DAQ)",listdaq->GetSize()));
652 delete listdaq;
653 return kTRUE;
6ace5fe2 654 }
8dd14606 655
656 TObjString* fileNameEntry = (TObjString*) listdaq->At(0);
657 if(fileNameEntry != NULL){
658 TString fileName = GetFile(kDAQ, "VDRIFT",
659 fileNameEntry->GetString().Data());
660 if(fileName.Length() ==0){
661 Log("Error retrieving the file vdrift (DAQ)");
662 delete listdaq;
663 return kTRUE;
664 }
665 TFile *filedaq = TFile::Open(fileName);
666 TProfile2D *histodriftvelocity = (TProfile2D *) filedaq->Get("PH2d");
667 if (histodriftvelocity) {
668
669 // store as reference data
670 if(!StoreReferenceData("DAQData","VdriftT0",(TObject *) histodriftvelocity,&metaData)){
671 Log("Error storing 2D Profile for vdrift from the DAQ");
672 error = kTRUE;
673 }
674
675 // analyse
676
677 Log("Take the PH reference data. Now we will try to fit\n");
678 calibra->SetMinEntries(2000); // If there is less than 2000
679 calibra->AnalysePH(histodriftvelocity);
680
681 Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(1))
682 + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(1));
683 Int_t nbfit = calibra->GetNumberFit();
6aafa7ea 684 Int_t nbfitSuccess = calibra->GetNumberFitSuccess();
8dd14606 685 Int_t nbE = calibra->GetNumberEnt();
686
687 // if enough statistics store the results
688 if ((nbtg > 0) &&
6aafa7ea 689 (nbfit >= 0.5*nbE) && (nbE > 30) && (nbfitSuccess > 30)) {
8dd14606 690 // create the cal objects
6aafa7ea 691 calibra->RemoveOutliers(1,kTRUE);
64942b85 692 calibra->PutMeanValueOtherVectorFit(1,kTRUE);
6aafa7ea 693 calibra->RemoveOutliers2(kTRUE);
64942b85 694 calibra->PutMeanValueOtherVectorFit2(1,kTRUE);
8dd14606 695 TObjArray object = calibra->GetVectorFit();
696 AliTRDCalDet *objdriftvelocitydet = calibra->CreateDetObjectVdrift(&object,kTRUE);
79b38efd 697 //TObject *objdriftvelocitypad = calibra->CreatePadObjectVdrift();
8dd14606 698 object = calibra->GetVectorFit2();
699 AliTRDCalDet *objtime0det = calibra->CreateDetObjectT0(&object,kTRUE);
79b38efd 700 //TObject *objtime0pad = calibra->CreatePadObjectT0();
8dd14606 701 calibra->ResetVectorFit();
702 // store
703 if(!Store("Calib","ChamberVdrift" ,(TObject *) objdriftvelocitydet,&md1,0,kTRUE)){
704 Log("Error storing the calibration object for the chamber vdrift (DAQ)");
705 error = kTRUE;
706 }
707 if(!Store("Calib","ChamberT0" ,(TObject *) objtime0det ,&md1,0,kTRUE)){
708 Log("Error storing the calibration object for the chamber t0 (DAQ)");
709 error = kTRUE;
710 }
79b38efd 711 //if(!Store("Calib","LocalVdrift" ,(TObject *) objdriftvelocitypad,&md2,0,kTRUE)){
712 // Log("Error storing the calibration object for the local drift velocity (DAQ)");
713 // error = kTRUE;
714 //}
715 //if(!Store("Calib","LocalT0" ,(TObject *) objtime0pad ,&md2,0,kTRUE)){
716 // Log("Error storing the calibration object for the local time0 (DAQ)");
717 // error = kTRUE;
718 //}
8dd14606 719 }
720 else{
721 Log("Not enough statistics for the average pulse height (DAQ)");
722 }
723 } // histo here
724 }// if fileNameEntry
725
726 delete listdaq;
727 return error;
728
6ace5fe2 729}
c8ab4518 730
6ace5fe2 731//______________________________________________________________________________________________
8dd14606 732Bool_t AliTRDPreprocessor::ExtractHLT()
6ace5fe2 733{
e5c60cc7 734 //
6ace5fe2 735 // Gain, vdrift and PRF calibration running on HLT
f5bb5557 736 // return kTRUE if NULL pointer to the list
e5c60cc7 737 //
3a0f6479 738
8dd14606 739 Bool_t error = kFALSE;
740
6ace5fe2 741 // Objects for HLT and DAQ zusammen
742 AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance();
743 AliCDBMetaData metaData;
744 metaData.SetBeamPeriod(0);
745 metaData.SetResponsible("Raphaelle Bailhache");
746 metaData.SetComment("TRD calib test");
747 // Store the infos for the detector
748 AliCDBMetaData md1;
749 md1.SetObjectClassName("AliTRDCalDet");
750 md1.SetResponsible("Raphaelle Bailhache");
751 md1.SetBeamPeriod(0);
752 md1.SetComment("TRD calib test");
753 // Store the infos for the pads
754 AliCDBMetaData md2;
755 md2.SetObjectClassName("AliTRDCalPad");
756 md2.SetResponsible("Raphaelle Bailhache");
757 md2.SetBeamPeriod(0);
758 md2.SetComment("TRD calib test");
6ace5fe2 759
760 // Take the file from the HLT file exchange server
761 TList *listhlt = GetFileSources(kHLT,"GAINDRIFTPRF");
8dd14606 762 if (!listhlt) {
6ace5fe2 763 Log("No list found for the HLT");
8dd14606 764 return kTRUE;
765 }
766
767 if(listhlt->GetSize() != 1) {
768 Log(Form("Problem on the size of the list: %d (HLT)",listhlt->GetSize()));
769 delete listhlt;
770 return kTRUE;
6ace5fe2 771 }
3a0f6479 772
8dd14606 773 TObjString* fileNameEntry = (TObjString*) listhlt->At(0);
774 if(fileNameEntry != NULL){
775 TString fileName = GetFile(kHLT, "GAINDRIFTPRF",
776 fileNameEntry->GetString().Data());
777 if(fileName.Length() ==0){
778 Log("Error retrieving the file (HLT)");
779 delete listhlt;
780 return kTRUE;
781 }
782 // Take the file
783 TFile *filehlt = TFile::Open(fileName);
784
8dd14606 785 // gain
786 TH2I *histogain = (TH2I *) filehlt->Get("CH2d");
8dd14606 787 if (histogain) {
7172a9fa 788 histogain->SetDirectory(0);
8dd14606 789 // store the reference data
790 if(!StoreReferenceData("HLTData","Gain",(TObject *) histogain,&metaData)){
791 Log("Error storing 2D histos for gain");
792 error = kTRUE;
793 }
794 // analyse
795 Log("Take the CH reference data. Now we will try to fit\n");
64942b85 796 calibra->SetMinEntries(800); // If there is less than 1000 entries in the histo: no fit
8dd14606 797 calibra->AnalyseCH(histogain);
798 Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(0))
799 + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(0));
800 Int_t nbfit = calibra->GetNumberFit();
801 Int_t nbE = calibra->GetNumberEnt();
802 // enough statistics
803 if ((nbtg > 0) &&
4da4a4c8 804 (nbfit >= 0.5*nbE) && (nbE > 30)) {
8dd14606 805 // create the cal objects
64942b85 806 calibra->PutMeanValueOtherVectorFit(1,kTRUE);
8dd14606 807 TObjArray object = calibra->GetVectorFit();
413153cb 808 AliTRDCalDet *objgaindet = calibra->CreateDetObjectGain(&object);
79b38efd 809 //TObject *objgainpad = calibra->CreatePadObjectGain();
8dd14606 810 // store them
811 if(!Store("Calib","ChamberGainFactor",(TObject *) objgaindet ,&md1,0,kTRUE)){
812 Log("Error storing the calibration object for the chamber gain");
813 error = kTRUE;
814 }
79b38efd 815 //if(!Store("Calib","LocalGainFactor" ,(TObject *) objgainpad ,&md2,0,kTRUE)){
816 // Log("Error storing the calibration object for the local gain factor");
817 // error = kTRUE;
818 //}
8dd14606 819 }
820 calibra->ResetVectorFit();
821 }// if histogain
822
8dd14606 823 // vdrift
824 fVdriftHLT = kFALSE;
825 TProfile2D *histodriftvelocity = (TProfile2D *) filehlt->Get("PH2d");
8dd14606 826 if (histodriftvelocity) {
7172a9fa 827 histodriftvelocity->SetDirectory(0);
8dd14606 828 // store the reference data
829 if(!StoreReferenceData("HLTData","VdriftT0",(TObject *) histodriftvelocity,&metaData)){
830 Log("Error storing 2D Profile for average pulse height (HLT)");
831 error = kTRUE;
832 }
833 // analyse
834 Log("Take the PH reference data. Now we will try to fit\n");
64942b85 835 calibra->SetMinEntries(800*20); // If there is less than 20000
8dd14606 836 calibra->AnalysePH(histodriftvelocity);
837 Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(1))
838 + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(1));
839 Int_t nbfit = calibra->GetNumberFit();
6aafa7ea 840 Int_t nbfitSuccess = calibra->GetNumberFitSuccess();
8dd14606 841 Int_t nbE = calibra->GetNumberEnt();
842 // enough statistics
843 if ((nbtg > 0) &&
6aafa7ea 844 (nbfit >= 0.5*nbE) && (nbE > 30) && (nbfitSuccess > 30)) {
8dd14606 845 // create the cal objects
6aafa7ea 846 calibra->RemoveOutliers(1,kTRUE);
64942b85 847 calibra->PutMeanValueOtherVectorFit(1,kTRUE);
6aafa7ea 848 calibra->RemoveOutliers2(kTRUE);
64942b85 849 calibra->PutMeanValueOtherVectorFit2(1,kTRUE);
8dd14606 850 TObjArray object = calibra->GetVectorFit();
851 AliTRDCalDet *objdriftvelocitydet = calibra->CreateDetObjectVdrift(&object,kTRUE);
79b38efd 852 //TObject *objdriftvelocitypad = calibra->CreatePadObjectVdrift();
8dd14606 853 object = calibra->GetVectorFit2();
854 AliTRDCalDet *objtime0det = calibra->CreateDetObjectT0(&object,kTRUE);
79b38efd 855 //TObject *objtime0pad = calibra->CreatePadObjectT0();
8dd14606 856 // store them
857 if(!Store("Calib","ChamberVdrift" ,(TObject *) objdriftvelocitydet,&md1,0,kTRUE)){
858 Log("Error storing the calibration object for the chamber vdrift (HLT)");
859 error = kTRUE;
860 }
861 if(!Store("Calib","ChamberT0" ,(TObject *) objtime0det ,&md1,0,kTRUE)){
862 Log("Error storing the calibration object for the chamber t0 (HLT)");
863 error = kTRUE;
864 }
79b38efd 865 //if(!Store("Calib","LocalVdrift" ,(TObject *) objdriftvelocitypad,&md2,0,kTRUE)){
866 // Log("Error storing the calibration object for the local drift velocity (HLT)");
867 // error = kTRUE;
868 //}
869 //if(!Store("Calib","LocalT0" ,(TObject *) objtime0pad ,&md2,0,kTRUE)){
870 // Log("Error storing the calibration object for the local time0 (HLT)");
871 // error = kTRUE;
872 //}
8dd14606 873 fVdriftHLT = kTRUE;
874 }
875 calibra->ResetVectorFit();
876 }// if TProfile2D
877
8dd14606 878 // prf
879 TProfile2D *histoprf = (TProfile2D *) filehlt->Get("PRF2d");
8dd14606 880 if (histoprf) {
7172a9fa 881 histoprf->SetDirectory(0);
8dd14606 882 // store reference data
883 if(!StoreReferenceData("HLTData","PRF",(TObject *) histoprf,&metaData)){
884 Log("Error storing the 2D Profile for Pad Response Function");
885 error = kTRUE;
886 }
887 // analyse
888 Log("Take the PRF reference data. Now we will try to fit\n");
889 calibra->SetMinEntries(600); // If there is less than 20000
890 calibra->AnalysePRFMarianFit(histoprf);
891 Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(2))
892 + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(2));
893 Int_t nbfit = calibra->GetNumberFit();
894 Int_t nbE = calibra->GetNumberEnt();
895 // enough statistics
896 if ((nbtg > 0) &&
4da4a4c8 897 (nbfit >= 0.95*nbE) && (nbE > 30)) {
8dd14606 898 // create cal pad objects
899 TObjArray object = calibra->GetVectorFit();
900 TObject *objPRFpad = calibra->CreatePadObjectPRF(&object);
901 // store them
902 if(!Store("Calib","PRFWidth" ,(TObject *) objPRFpad ,&md2,0,kTRUE)){
903 Log("Error storing the calibration object for the Pad Response Function");
904 error = kTRUE;
905 }
906 }
907 calibra->ResetVectorFit();
908 }// if PRF
909 }// if fileNameEntry
910
911 delete listhlt;
912 return error;
913
e5c60cc7 914}
fdfee371 915
916//_____________________________________________________________________________
917UInt_t AliTRDPreprocessor::ProcessDCSConfigData()
918{
919 //
920 // process the configuration of FEE, PTR and GTU
e74c968f 921 // reteive XML filei(s) from the DCS FXS
922 // parse it/them and store TObjArrays in the CDB
923 //
fdfee371 924 // return 0 for success, otherwise:
8b9bf3e9 925 // 5 : Could not get the (SOR and EOR) or SOR file from the FXS
8f7e6c0b 926 // 8 : Both files are not valid
eaceaf51 927 // 10 : SOR XML is not well-formed
928 // 11 : EOR XML is not well-formed
8f7e6c0b 929 // 12 : ERROR in SOR XML SAX validation: something wrong with the content
930 // 12 : ERROR in EOR XML SAX validation: something wrong with the content
931 // 14 : ERROR while creating SOR calibration objects in the handler
932 // 15 : ERROR while creating EOR calibration objects in the handler
933 // 16 : ERROR while storing data in the CDB
fdfee371 934 //
935
eaceaf51 936 Log("Processing the DCS config summary files.");
fdfee371 937
e74c968f 938 // get the XML files
939 Log("Requesting the 2 summaryfiles from the FXS..");
8b9bf3e9 940 TString xmlFileS = GetFile(kDCS,"CONFIGSUMMARYSOR","");
941 TString xmlFileE = GetFile(kDCS,"CONFIGSUMMARYEOR","");
3821ce70 942 // Request EOR and SOR files from the fxs, if both are not found exit
943
f4200e67 944 Bool_t fileExistE = kTRUE, fileExistS = kTRUE;
3821ce70 945
8f7e6c0b 946 // check if the files are there
8b9bf3e9 947 if (xmlFileS.IsNull()) {
948 Log(Form("Warning: SOR file %s not found!", xmlFileS.Data()));
f4200e67 949 fileExistS = kFALSE;
8b9bf3e9 950 } else Log(Form("SOR file found: %s", xmlFileS.Data()));
f4200e67 951
8b9bf3e9 952 if (xmlFileE.IsNull()) {
953 Log(Form("Warning: EOR file %s not found!", xmlFileE.Data()));
f4200e67 954 fileExistE = kFALSE;
8b9bf3e9 955 } else Log(Form("EOR file found: %s", xmlFileE.Data()));
f4200e67 956
957 if (fileExistS==0 && fileExistE==0) {
8b9bf3e9 958 Log(Form("ERROR: SOR and EOR files not found: %s and %s", xmlFileS.Data(), xmlFileE.Data()));
f4200e67 959 return 5;
6b36d985 960 }
3821ce70 961
8f7e6c0b 962 // test the files
3821ce70 963 if (fileExistS) {
f4200e67 964 Log("Checking if SOR file is valid.");
3821ce70 965 std::ifstream fileTestS;
8b9bf3e9 966 fileTestS.open(xmlFileS.Data(), std::ios_base::binary | std::ios_base::in);
3821ce70 967 if (!fileTestS.good() || fileTestS.eof() || !fileTestS.is_open()) {
8b9bf3e9 968 Log(Form("Warning: File %s not valid!",xmlFileS.Data()));
f4200e67 969 fileExistS = kFALSE;
8b9bf3e9 970 return 5;
3821ce70 971 }
f4200e67 972 Log("Checking if SOR file is not empty.");
3821ce70 973 fileTestS.seekg(0, std::ios_base::end);
974 if (static_cast<int>(fileTestS.tellg()) < 2) {
8b9bf3e9 975 Log(Form("Warning: File %s is empty!",xmlFileS.Data()));
f4200e67 976 fileExistS = kFALSE;
8b9bf3e9 977 return 5;
3821ce70 978 }
979 }
f4200e67 980
f4200e67 981
3821ce70 982 if (fileExistE) {
f4200e67 983 Log("Checking if EOR file is valid.");
3821ce70 984 std::ifstream fileTestE;
8b9bf3e9 985 fileTestE.open(xmlFileE.Data(), std::ios_base::binary | std::ios_base::in);
3821ce70 986 if (!fileTestE.good() || fileTestE.eof() || !fileTestE.is_open()) {
8b9bf3e9 987 Log(Form("Warning: File %s not valid!",xmlFileE.Data()));
f4200e67 988 fileExistE = kFALSE;
3821ce70 989 }
f4200e67 990 Log("Checking if EOR file is not empty.");
3821ce70 991 fileTestE.seekg(0, std::ios_base::end);
992 if (static_cast<int>(fileTestE.tellg()) < 2) {
8b9bf3e9 993 Log(Form("Warning: File %s is empty!",xmlFileE.Data()));
f4200e67 994 fileExistE = kFALSE;
3821ce70 995 }
996 }
f4200e67 997
f4200e67 998 if (fileExistS==0 && fileExistE==0) {
8f7e6c0b 999 Log("ERROR: Both files (SOR/EOR) are not valid!");
1000 return 8;
1001 }
f4200e67 1002
8f7e6c0b 1003 Log("One or both of the tested files are valid.");
fdfee371 1004
6b36d985 1005 // make a robust XML validation
1006 TSAXParser testParser;
8b9bf3e9 1007 if (fileExistS && testParser.ParseFile(xmlFileS.Data()) < 0 ) {
eaceaf51 1008 Log("ERROR: XML content (SOR) is not well-formed.");
e74c968f 1009 return 10;
8b9bf3e9 1010 } else if (fileExistE && testParser.ParseFile(xmlFileE.Data()) < 0 ) {
eaceaf51 1011 Log("ERROR: XML content (EOR) is not well-formed.");
1012 return 11;
6b36d985 1013 }
eaceaf51 1014 Log("XML contents are well-formed.");
3821ce70 1015
fdfee371 1016 // create parser and parse
eaceaf51 1017 TSAXParser saxParserS, saxParserE;
1018 AliTRDSaxHandler saxHandlerS, saxHandlerE;
3821ce70 1019 if (fileExistS) {
1020 saxParserS.ConnectToHandler("AliTRDSaxHandler", &saxHandlerS);
8b9bf3e9 1021 saxParserS.ParseFile(xmlFileS.Data());
3821ce70 1022 }
1023 if (fileExistE) {
1024 saxParserE.ConnectToHandler("AliTRDSaxHandler", &saxHandlerE);
8b9bf3e9 1025 saxParserE.ParseFile(xmlFileE.Data());
3821ce70 1026 }
8f7e6c0b 1027 // report errors of the parser if present
1028 if (fileExistS && saxParserS.GetParseCode() != 0) {
1029 Log(Form("ERROR in XML file validation. SOR Parse Code: %s", saxParserS.GetParseCode()));
e74c968f 1030 return 12;
fdfee371 1031 }
8f7e6c0b 1032 if (fileExistE && saxParserE.GetParseCode() != 0) {
1033 Log(Form("ERROR in XML file validation. EOR Parse Code: %s", saxParserE.GetParseCode()));
1034 return 13;
fdfee371 1035 }
8f7e6c0b 1036 Log("XML file validation OK.");
1037 // report errors of the handler if present
1038 if (fileExistS && saxHandlerS.GetHandlerStatus() != 0) {
1039 Log(Form("ERROR while creating calibration objects. SOR Error code: %s", saxHandlerS.GetHandlerStatus()));
1040 return 14;
1041 }
1042 if (fileExistE && saxHandlerE.GetHandlerStatus() != 0) {
1043 Log(Form("ERROR while creating calibration objects. EOR Error code: %s", saxHandlerE.GetHandlerStatus()));
1044 return 15;
1045 }
1046 Log("SAX handler reports no errors.");
fdfee371 1047
eaceaf51 1048 // put both objects in one TObjArray to store them
1049 TObjArray* fCalObjArray = new TObjArray(2);
1050 fCalObjArray->SetOwner();
3821ce70 1051
1052 // get the calibration object storing the data from the handler
1053 if (fileExistS) {
1054 AliTRDCalDCS* fCalDCSObjSOR = saxHandlerS.GetCalDCSObj();
1055 fCalDCSObjSOR->EvaluateGlobalParameters();
8f7e6c0b 1056 fCalDCSObjSOR->SetRunType(GetRunType());
1057 fCalDCSObjSOR->SetStartTime(GetStartTimeDCSQuery());
1058 fCalDCSObjSOR->SetEndTime(GetEndTimeDCSQuery());
3821ce70 1059 fCalObjArray->AddAt(fCalDCSObjSOR,0);
8f7e6c0b 1060 Log("TRDCalDCS object for SOR created.");
3821ce70 1061 }
1062
1063 if (fileExistE) {
1064 AliTRDCalDCS* fCalDCSObjEOR = saxHandlerE.GetCalDCSObj();
1065 fCalDCSObjEOR->EvaluateGlobalParameters();
8f7e6c0b 1066 fCalDCSObjEOR->SetRunType(GetRunType());
1067 fCalDCSObjEOR->SetStartTime(GetStartTimeDCSQuery());
1068 fCalDCSObjEOR->SetEndTime(GetEndTimeDCSQuery());
3821ce70 1069 fCalObjArray->AddAt(fCalDCSObjEOR,1);
8f7e6c0b 1070 Log("TRDCalDCS object for EOR created.");
3821ce70 1071 }
1072
fdfee371 1073 // store the DCS calib data in the CDB
1074 AliCDBMetaData metaData1;
1075 metaData1.SetBeamPeriod(0);
1076 metaData1.SetResponsible("Frederick Kramer");
eaceaf51 1077 metaData1.SetComment("DCS configuration data in two AliTRDCalDCS objects in one TObjArray (0:SOR, 1:EOR).");
1078 if (!Store("Calib", "DCS", fCalObjArray, &metaData1, 0, kTRUE)) {
fdfee371 1079 Log("problems while storing DCS config data object");
8f7e6c0b 1080 return 16;
6b36d985 1081 } else {
1082 Log("DCS config data object stored.");
fdfee371 1083 }
1084
eaceaf51 1085 //delete fCalObjArray;
6b36d985 1086
8f7e6c0b 1087 Log("SUCCESS: Processing of the DCS config summary file DONE.");
fdfee371 1088 return 0;
75ba22eb 1089}
1090
1091
7172a9fa 1092