1 #include "AliVZEROPreprocessor.h"
2 #include "AliVZEROCalibData.h"
3 #include "AliCDBMetaData.h"
4 #include "AliCDBEntry.h"
5 #include "AliDCSValue.h"
8 #include <TTimeStamp.h>
9 #include <TObjString.h>
14 // This class is a simple preprocessor for V0.
17 ClassImp(AliVZEROPreprocessor)
19 //______________________________________________________________________________________________
20 AliVZEROPreprocessor::AliVZEROPreprocessor(AliShuttleInterface* shuttle) :
21 AliPreprocessor("V00", shuttle),
28 //______________________________________________________________________________________________
29 AliVZEROPreprocessor::~AliVZEROPreprocessor()
34 //______________________________________________________________________________________________
35 void AliVZEROPreprocessor::Initialize(Int_t run, UInt_t startTime,
38 // Creates AliZDCDataDCS object
40 AliPreprocessor::Initialize(run, startTime, endTime);
42 Log(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
43 TTimeStamp(startTime).AsString(),
44 TTimeStamp(endTime).AsString()));
47 fStartTime = startTime;
50 fData = new AliVZERODataDCS(fRun, fStartTime, fEndTime);
55 //______________________________________________________________________________________________
56 UInt_t AliVZEROPreprocessor::Process(TMap* dcsAliasMap)
58 // Fills data retrieved from DCS and DAQ into a AliVZEROCalibData object and
59 // stores it into CalibrationDB
62 // *** GET RUN TYPE ***
63 TString runType = GetRunType();
66 // *** REFERENCE DATA ***
69 AliVZEROCalibData *calibData = new AliVZEROCalibData();
71 // *************** From DCS ******************
72 // Fills data into a AliVZERODataDCS object
73 if(!dcsAliasMap) return 1;
75 // The processing of the DCS input data is forwarded to AliVZERODataDCS
77 fData->ProcessData(*dcsAliasMap);
78 //fData->Draw(""); // Draw the HV values as a function of time
79 //dcsAliasMap->Print(""); // Print out the HV values
81 // Writing VZERO PMs HV values into calibration object
82 calibData->SetMeanHV(fData->GetMeanHV());
83 calibData->SetWidthHV(fData->GetWidthHV());
86 // *************** From DAQ ******************
88 SourcesId[0] = "PEDESTALS";
89 SourcesId[1] = "GAINS";
90 SourcesId[2] = "SIGMAS";
92 for(int iSource=0;iSource<3;iSource++){
93 TList* sourceList = GetFileSources(kDAQ, SourcesId[iSource].Data());
95 AliError(Form("No sources found for id %s", SourcesId[iSource].Data()));
98 AliInfo(Form("The following sources produced files with the id %s",SourcesId[iSource].Data()));
101 TIter iter(sourceList);
102 TObjString *source = 0;
104 while((source=dynamic_cast<TObjString*> (iter.Next()))){
105 fileName = GetFile(kDAQ, SourcesId[iSource].Data(), source->GetName());
106 if (fileName.Length() > 0)
107 AliInfo(Form("Got the file %s, now we can extract some values.", fileName.Data()));
109 if((file = fopen(fileName.Data(),"r")) == NULL){
110 AliError(Form("Cannot open file %s",fileName.Data()));
114 for(Int_t j=0; j<128; j++)fscanf(file,"%f",&Values[j]);
118 calibData->SetPedestal(Values);
121 calibData->SetGain(Values);
124 calibData->SetSigma(Values);
133 // Check that everything was properly transmitted
135 // for(Int_t j=0; j<128; j++){printf("ADCPedestal[%d] -> %f \n",j,calibData->GetPedestal(j));}
136 // for(Int_t j=0; j<128; j++){printf("ADCGain[%d] -> %f \n",j,calibData->GetGain(j));}
137 // for(Int_t j=0; j<128; j++){printf("ADCSigma[%d] -> %f \n",j,calibData->GetSigma(j));}
138 // for(Int_t j=0; j<64; j++){printf("MeanHV[%d] -> %f \n",j,calibData->GetMeanHV(j));}
139 // for(Int_t j=0; j<64; j++){printf("WidthHV[%d] -> %f \n",j,calibData->GetWidthHV(j));}
141 // Now we store the VZERO Calibration Object into CalibrationDB
143 AliCDBMetaData metaData;
144 metaData.SetBeamPeriod(0);
145 metaData.SetResponsible("Brigitte Cheynis");
146 metaData.SetComment("This preprocessor fills an AliVZEROCalibData object");
148 Bool_t result = Store("Calib", "Data", calibData, &metaData, 0, kTRUE);
152 if (!result) return 1;