]>
Commit | Line | Data |
---|---|---|
d2b85094 | 1 | #include "AliVZEROPreprocessor.h" |
2 | #include "AliVZEROCalibData.h" | |
fad64858 | 3 | #include "AliVZEROTriggerData.h" |
d2b85094 | 4 | #include "AliCDBMetaData.h" |
5 | #include "AliCDBEntry.h" | |
6 | #include "AliDCSValue.h" | |
7 | #include "AliLog.h" | |
6472f844 | 8 | #include "AliShuttleInterface.h" |
9 | #include "AliVZERODataFEE.h" | |
10 | #include "AliVZERODataDCS.h" | |
11 | ||
d2b85094 | 12 | #include <TFile.h> |
13 | #include <TTimeStamp.h> | |
14 | #include <TObjString.h> | |
15 | #include <TSystem.h> | |
d2b85094 | 16 | |
6472f844 | 17 | |
18 | class Tlist; | |
19 | ||
20 | // | |
21 | // This class is a simple preprocessor for VZERO detector. | |
d2b85094 | 22 | // |
6472f844 | 23 | // It gets High Voltage values for a given run from DCS and Pedestal values from DAQ |
24 | // and writes them as Calibration MetaData into OCDB/VZERO/Calib/Data | |
25 | // It also retrieves FEE parameters from DCS archive | |
26 | // and writes them as Trigger MetaData into OCDB/VZERO/Trigger/Data | |
27 | // (to be used for trigger simulation) | |
d2b85094 | 28 | // |
29 | ||
30 | ClassImp(AliVZEROPreprocessor) | |
31 | ||
32 | //______________________________________________________________________________________________ | |
33 | AliVZEROPreprocessor::AliVZEROPreprocessor(AliShuttleInterface* shuttle) : | |
fad64858 | 34 | AliPreprocessor("V00", shuttle), |
35 | fData(0), | |
36 | fFEEData(0) | |
d2b85094 | 37 | |
38 | { | |
6b6c5c59 | 39 | // constructor |
40 | ||
e58b4e66 | 41 | AddRunType("STANDALONE_PULSER"); |
42 | AddRunType("STANDALONE_BC"); | |
6b6c5c59 | 43 | AddRunType("PHYSICS"); |
44 | ||
d2b85094 | 45 | } |
46 | ||
47 | //______________________________________________________________________________________________ | |
48 | AliVZEROPreprocessor::~AliVZEROPreprocessor() | |
49 | { | |
50 | // destructor | |
fad64858 | 51 | delete fFEEData; |
52 | delete fData; | |
53 | ||
d2b85094 | 54 | } |
55 | ||
56 | //______________________________________________________________________________________________ | |
57 | void AliVZEROPreprocessor::Initialize(Int_t run, UInt_t startTime, | |
58 | UInt_t endTime) | |
59 | { | |
fad64858 | 60 | // Creates AliVZERODataDCS object |
d2b85094 | 61 | |
d1c61c72 | 62 | AliPreprocessor::Initialize(run, startTime, endTime); |
63 | ||
64 | Log(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run, | |
d2b85094 | 65 | TTimeStamp(startTime).AsString(), |
66 | TTimeStamp(endTime).AsString())); | |
67 | ||
d1c61c72 | 68 | fRun = run; |
312388a6 | 69 | // fStartTime = startTime; |
70 | // fEndTime = endTime; | |
71 | fStartTime = GetStartTimeDCSQuery (); | |
72 | fEndTime = GetEndTimeDCSQuery (); | |
3b757990 | 73 | time_t daqStart = (time_t) (((TString)GetRunParameter("DAQ_time_start")).Atoi()); |
74 | time_t daqEnd = (time_t) (((TString)GetRunParameter("DAQ_time_end")).Atoi()); | |
75 | ||
76 | fData = new AliVZERODataDCS(fRun, fStartTime, fEndTime,(UInt_t)daqStart, (UInt_t)daqEnd); | |
fad64858 | 77 | fFEEData = new AliVZERODataFEE(fRun, fStartTime, fEndTime); |
d1c61c72 | 78 | |
d2b85094 | 79 | } |
80 | ||
d2b85094 | 81 | //______________________________________________________________________________________________ |
82 | UInt_t AliVZEROPreprocessor::Process(TMap* dcsAliasMap) | |
83 | { | |
84 | // Fills data retrieved from DCS and DAQ into a AliVZEROCalibData object and | |
85 | // stores it into CalibrationDB | |
86 | ||
87 | ||
88 | // *** GET RUN TYPE *** | |
89 | TString runType = GetRunType(); | |
90 | ||
91 | ||
92 | // *** REFERENCE DATA *** | |
93 | ||
94 | TString fileName; | |
95 | AliVZEROCalibData *calibData = new AliVZEROCalibData(); | |
96 | ||
fad64858 | 97 | // *************** HV From DCS ****************** |
d2b85094 | 98 | // Fills data into a AliVZERODataDCS object |
99 | if(!dcsAliasMap) return 1; | |
100 | ||
fad64858 | 101 | // The Processing of the DCS input data is forwarded to AliVZERODataDCS |
d2b85094 | 102 | fData->ProcessData(*dcsAliasMap); |
d2b85094 | 103 | |
d5deaaa5 | 104 | // Writes VZERO PMs HV values into VZERO calibration object and Timing resolution parameters |
105 | calibData->FillDCSData(fData); | |
7495d2be | 106 | |
d2b85094 | 107 | // *************** From DAQ ****************** |
96da3fe8 | 108 | |
6472f844 | 109 | TString sourcesId = "V00da_results"; |
96da3fe8 | 110 | |
6472f844 | 111 | TList* sourceList = GetFileSources(kDAQ, sourcesId.Data()); |
96da3fe8 | 112 | if (!sourceList) { |
6472f844 | 113 | Log(Form("No sources found for id %s", sourcesId.Data())); |
96da3fe8 | 114 | return 1; } |
6472f844 | 115 | Log(Form("The following sources produced files with the id %s",sourcesId.Data())); |
96da3fe8 | 116 | sourceList->Print(); |
117 | ||
118 | TIter iter(sourceList); | |
119 | TObjString *source = 0; | |
120 | ||
121 | while((source=dynamic_cast<TObjString*> (iter.Next()))){ | |
6472f844 | 122 | fileName = GetFile(kDAQ, sourcesId.Data(), source->GetName()); |
96da3fe8 | 123 | if (fileName.Length() > 0) |
d1c61c72 | 124 | Log(Form("Got the file %s, now we can extract some values.", fileName.Data())); |
96da3fe8 | 125 | FILE *file; |
126 | if((file = fopen(fileName.Data(),"r")) == NULL){ | |
d1c61c72 | 127 | Log(Form("Cannot open file %s",fileName.Data())); |
96da3fe8 | 128 | return 1;} |
6472f844 | 129 | Float_t pedMean[128], pedSigma[128], adcMean[128], adcSigma[128] ; |
982d0603 | 130 | for(Int_t j=0; j<128; j++)fscanf(file,"%f %f %f %f", |
6472f844 | 131 | &pedMean[j], &pedSigma[j], &adcMean[j], &adcSigma[j]); |
96da3fe8 | 132 | fclose(file); |
133 | ||
6472f844 | 134 | calibData->SetPedestal(pedMean); |
135 | calibData->SetSigma(pedSigma); | |
6472f844 | 136 | calibData->SetADCsigma(adcSigma); |
982d0603 | 137 | } |
025eb721 | 138 | |
96da3fe8 | 139 | delete source; |
d2b85094 | 140 | |
141 | // Check that everything was properly transmitted | |
142 | ||
982d0603 | 143 | // for(Int_t j=0; j<128; j++){printf("Pedestal[%d] -> %f \n",j,calibData->GetPedestal(j));} |
6472f844 | 144 | // for(Int_t j=0; j<128; j++){printf("pedSigma[%d] -> %f \n",j,calibData->GetSigma(j));} |
982d0603 | 145 | // for(Int_t j=0; j<128; j++){printf("Gain[%d] -> %f \n",j,calibData->GetGain(j));} |
6472f844 | 146 | // for(Int_t j=0; j<128; j++){printf("adcSigma[%d] -> %f \n",j,calibData->GetADCsigma(j));} |
d2b85094 | 147 | // for(Int_t j=0; j<64; j++){printf("MeanHV[%d] -> %f \n",j,calibData->GetMeanHV(j));} |
148 | // for(Int_t j=0; j<64; j++){printf("WidthHV[%d] -> %f \n",j,calibData->GetWidthHV(j));} | |
96da3fe8 | 149 | |
d1c61c72 | 150 | // Now we store the VZERO Calibration Object into CalibrationDB |
312388a6 | 151 | |
152 | Bool_t resECal=kTRUE; | |
153 | ||
154 | Bool_t result = 0; | |
155 | // if(sourceList && sourceList->GetEntries()>0) | |
156 | // { | |
157 | AliCDBMetaData metaData; | |
158 | metaData.SetBeamPeriod(0); | |
159 | metaData.SetResponsible("Brigitte Cheynis"); | |
160 | metaData.SetComment("This preprocessor fills an AliVZEROCalibData object"); | |
161 | ||
162 | resECal = Store("Calib", "Data", calibData, &metaData, 0, kTRUE); | |
163 | // } | |
164 | if(resECal==kFALSE ) result = 1; | |
d2b85094 | 165 | |
d2b85094 | 166 | |
167 | delete calibData; | |
025eb721 | 168 | delete sourceList; |
d2b85094 | 169 | |
fad64858 | 170 | // ----------------------------------------------------------------------- |
6472f844 | 171 | // Retrieves Front End Electronics Parameters from DCS archive |
fad64858 | 172 | // ----------------------------------------------------------------------- |
173 | AliVZEROTriggerData *triggerData = new AliVZEROTriggerData(); | |
174 | ||
175 | // The processing of the DCS input data is forwarded to AliVZERODataFEE | |
176 | fFEEData->ProcessData(*dcsAliasMap); | |
177 | ||
178 | // Writes VZERO FEE parameters values into VZERO Trigger parametrization object | |
179 | triggerData->FillData(fFEEData); | |
180 | ||
6472f844 | 181 | // Stores the VZERO Trigger Object into TriggerDB |
fad64858 | 182 | |
183 | resECal=kTRUE; | |
184 | ||
185 | result = 0; | |
186 | metaData.SetBeamPeriod(0); | |
187 | metaData.SetResponsible("Brigitte Cheynis"); | |
188 | metaData.SetComment("This preprocessor fills an AliVZEROTriggerData object"); | |
189 | ||
190 | resECal = Store("Trigger", "Data", triggerData, &metaData, 0, kTRUE); | |
191 | if(resECal==kFALSE ) result = 1; | |
192 | ||
193 | ||
5fc81083 | 194 | return result; |
d2b85094 | 195 | } |
196 |