1 #include "AliITSPreprocessorSSD.h"
3 #include "AliCDBMetaData.h"
7 #include <TTimeStamp.h>
8 #include <TObjString.h>
10 #include "AliITSRawStreamSSD.h"
11 #include "AliITSNoiseSSD.h"
12 #include <Riostream.h>
16 // Author: Enrico Fragiacomo
19 // SHUTTLE preprocessing class for SSD calibration files
23 ClassImp(AliITSPreprocessorSSD)
25 //______________________________________________________________________________________________
26 void AliITSPreprocessorSSD::Initialize(Int_t run, UInt_t startTime,
30 AliPreprocessor::Initialize(run, startTime, endTime);
32 Log(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
33 TTimeStamp(startTime).AsString(),
34 TTimeStamp(endTime).AsString()));
38 //______________________________________________________________________________________________
39 UInt_t AliITSPreprocessorSSD::Process(TMap* /*dcsAliasMap*/)
42 // Note. To be modified: dcsAliasMap is not needed but I can not get rid
43 // of it unless the base class AliPreprocessor is modified accordingly.
45 TObjArray calib_array(1698);
46 //Float_t noise=0, gain=0;
48 TString runType = GetRunType();
49 if(runType == "ELECTRONICS_CALIBRATION_RUN") {
52 else if(runType == "PEDESTAL_RUN") {
54 TList* list = GetFileSources(kDAQ, "CALIBRATION");
55 if (list && list->GetEntries() > 0)
57 Log("The following sources produced files with the id CALIBRATION");
60 // create iterator over list of LDCs (provides list of TObjString)
64 // expect to iterate 3 times (LDC0, LDC1, LDC2)
65 while ( (ok = (TObjString*) next()) ) {
67 TString key = ok->String();
69 TString fileName = GetFile(kDAQ, "CALIBRATION", key.Data());
70 if (fileName.Length() > 0) {
72 Log(Form("Got the file %s, now we can extract some values.", fileName.Data()));
74 TFile *f = new TFile(fileName.Data());
75 if(!f || !f->IsOpen()){
76 Log("Error opening file!");
82 f->GetObject("TObjArray;1", cal);
86 Log("File does not contain expected data!");
90 Int_t nmod = cal->GetEntries();
92 for(Int_t mod=0; mod<nmod; mod++) {
94 AliITSNoiseSSD *calib = (AliITSNoiseSSD*) cal->At(mod);
95 calib_array.AddAt(calib,calib->GetMod());
99 Log("GetFile error!");
103 } // end iteration over LDCs
107 Log("GetFileSources error!");
108 if(list) delete list;
112 //Now we have to store the final CDB file
113 AliCDBMetaData metaData;
114 metaData.SetBeamPeriod(0);
115 metaData.SetResponsible("Enrico Fragiacomo");
116 metaData.SetComment("This preprocessor fills the TObjArray of AliITSNoiseSSD");
118 if(!Store("Calib", "NoiseSSD", &calib_array, &metaData, 0, 1)) {
123 } // end if noise_run
125 Log("Nothing to do");
129 Log("Database updated");
130 return 0; // 0 means success