3 #include <TTimeStamp.h>
5 #include "AliPMDPreprocessor.h"
6 #include "AliPMDCalibData.h"
8 #include "AliShuttleInterface.h"
9 #include "AliCDBMetaData.h"
10 #include <TTimeStamp.h>
11 #include <TObjString.h>
16 ClassImp(AliPMDPreprocessor)
18 //______________________________________________________________________________________________
19 AliPMDPreprocessor::AliPMDPreprocessor(AliShuttleInterface* shuttle) :
20 AliPreprocessor("PMD", shuttle)
25 //______________________________________________________________________________________________
26 AliPMDPreprocessor::~AliPMDPreprocessor()
31 //______________________________________________________________________________________________
32 void AliPMDPreprocessor::Initialize(Int_t run, UInt_t startTime,
35 // Creates AliPMDDataDAQ object
37 AliPreprocessor::Initialize(run, startTime, endTime);
39 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
40 TTimeStamp(startTime).AsString(),
41 TTimeStamp(endTime).AsString()));
44 fStartTime = startTime;
49 //______________________________________________________________________________________________
50 UInt_t AliPMDPreprocessor::Process(TMap* pdaqAliasMap)
53 if(!pdaqAliasMap) return 1;
55 AliPMDCalibData *calibda = new AliPMDCalibData();
57 TList* filesources = GetFileSources(kDAQ, "PMDGAINS");
60 Log(Form("No sources found for PMDGAINS!"));
64 AliInfo("Here's the list of sources for PMDGAINS");
67 TIter iter(filesources);
72 while((source=dynamic_cast<TObjString*> (iter.Next()))){
73 filename = GetFile(kDAQ, "PMDGAINS", source->GetName());
74 if(filename.Length() == 0) {
75 Log(Form("Error retrieving file from source %s failed!", source->GetName()));
80 Log(Form("File with id PMDGAINS got from %s", source->GetName()));
83 TFile *f= new TFile(filename.Data());
84 if(!f || !f->IsOpen())
86 Log(Form("Error opening file with Id PMDGAINS from source %s!", source->GetName()));
89 TTree *tree = dynamic_cast<TTree *> (f->Get("ic"));
92 Log("Could not find object \"ic\" in DAQ file!");
96 tree->SetBranchAddress("DET", &DET);
97 tree->SetBranchAddress("SM", &SM);
98 tree->SetBranchAddress("ROW", &ROW);
99 tree->SetBranchAddress("COL", &COL);
100 tree->SetBranchAddress("GAIN", &GAIN);
101 Int_t nEntries = (Int_t) tree->GetEntries();
102 for(Int_t i = 0; i < nEntries; i++)
105 // if(DET>1 || SM>23 || ROW>95 || COL>95) {
106 // printf("Error! gain[%d,%d,%d,%d] = %f\n",DET,SM,ROW,COL,GAIN);
109 calibda->SetGainFact(DET,SM,ROW,COL,GAIN);
115 //Now we have to store the final CDB file
116 AliCDBMetaData metaData;
117 metaData.SetBeamPeriod(0);
118 metaData.SetComment("test PMD preprocessor");
120 result = Store("Calib","Data", calibda, &metaData);