]>
Commit | Line | Data |
---|---|---|
b15de2d2 | 1 | /////////////////////////////////////////////// |
2 | // Author: Henrik Tydesjo // | |
3 | // Preprocessor Class for the SPD // | |
4 | // // | |
5 | /////////////////////////////////////////////// | |
3f0e013c | 6 | |
3f0e013c | 7 | #include "AliITSPreprocessorSPD.h" |
b15de2d2 | 8 | #include "AliITSCalibrationSPD.h" |
b15de2d2 | 9 | #include "AliITSOnlineCalibrationSPDhandler.h" |
03fc6773 | 10 | #include "AliCDBEntry.h" |
b15de2d2 | 11 | #include "AliCDBMetaData.h" |
03fc6773 | 12 | #include "AliShuttleInterface.h" |
b15de2d2 | 13 | #include "AliLog.h" |
03fc6773 | 14 | #include <TTimeStamp.h> |
15 | #include <TObjString.h> | |
16 | #include <TSystem.h> | |
53ae21ce | 17 | #include <TList.h> |
3f0e013c | 18 | |
b15de2d2 | 19 | ClassImp(AliITSPreprocessorSPD) |
3f0e013c | 20 | |
b15de2d2 | 21 | //______________________________________________________________________________________________ |
22 | AliITSPreprocessorSPD::AliITSPreprocessorSPD(AliShuttleInterface* shuttle) : | |
23 | AliPreprocessor("SPD", shuttle) | |
3f0e013c | 24 | { |
b15de2d2 | 25 | // constructor |
3f0e013c | 26 | } |
27 | ||
b15de2d2 | 28 | //______________________________________________________________________________________________ |
29 | AliITSPreprocessorSPD::~AliITSPreprocessorSPD() | |
3f0e013c | 30 | { |
b15de2d2 | 31 | // destructor |
3f0e013c | 32 | } |
33 | ||
b15de2d2 | 34 | //______________________________________________________________________________________________ |
35 | void AliITSPreprocessorSPD::Initialize(Int_t run, UInt_t startTime, | |
36 | UInt_t endTime) | |
3f0e013c | 37 | { |
b15de2d2 | 38 | // initialize |
39 | AliPreprocessor::Initialize(run, startTime, endTime); | |
3f0e013c | 40 | |
b15de2d2 | 41 | AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run, |
42 | TTimeStamp(startTime).AsString(), | |
43 | TTimeStamp(endTime).AsString())); | |
3f0e013c | 44 | } |
fcf95fc7 | 45 | |
b15de2d2 | 46 | //______________________________________________________________________________________________ |
0c0426a2 | 47 | UInt_t AliITSPreprocessorSPD::Process(TMap* /*dcsAliasMap*/) |
fcf95fc7 | 48 | { |
b15de2d2 | 49 | // Do the actual preprocessing |
fcf95fc7 | 50 | |
03fc6773 | 51 | |
53ae21ce | 52 | // *** GET RUN TYPE *** |
ad18504e | 53 | |
54 | TString runType = GetRunType(); | |
03fc6773 | 55 | |
ad18504e | 56 | |
53ae21ce | 57 | |
58 | // *** REFERENCE DATA *** // | |
59 | ||
60 | // Standalone runs: | |
61 | if (runType == "DAQ_MIN_TH_SCAN" || | |
62 | runType == "DAQ_MEAN_TH_SCAN" || | |
63 | runType == "DAQ_UNIFORMITY_SCAN" || | |
64 | runType == "DAQ_NOISY_PIX_SCAN" || | |
65 | runType == "DAQ_PIX_DELAY_SCAN" || | |
66 | runType == "DAQ_FO_UNIF_SCAN") { | |
67 | // Store the scan container files as reference data (one file for each equipment) | |
68 | for (UInt_t eq=0; eq<20; eq++) { | |
69 | TString id = Form("SPD_reference_%d",eq); | |
70 | TList* list = GetFileSources(kDAQ,id.Data()); // (the id should be unique, so always 1 file) | |
71 | if (list) { | |
72 | TObjString* fileNameEntry = (TObjString*) list->First(); | |
73 | if (fileNameEntry!=NULL) { | |
74 | TString fileName = GetFile(kDAQ, id, fileNameEntry->GetString().Data()); | |
75 | TString refCAT = Form("SPDref_eq_%d.root",eq); | |
76 | if (!StoreReferenceFile(fileName.Data(),refCAT.Data())) { | |
77 | Log(Form("Failed to store reference file %s.",fileName.Data())); | |
78 | return 1; | |
79 | } | |
0c0426a2 | 80 | } |
81 | } | |
82 | } | |
83 | } | |
03fc6773 | 84 | |
53ae21ce | 85 | // Physics runs (online monitoring): |
86 | if (runType == "PHYSICS") { | |
87 | // *** code to be written *** // | |
88 | } | |
03fc6773 | 89 | |
03fc6773 | 90 | |
03fc6773 | 91 | |
53ae21ce | 92 | // *** NOISY AND DEAD DATA *** // |
03fc6773 | 93 | |
53ae21ce | 94 | if (runType == "DAQ_NOISY_PIX_SCAN" || runType == "PHYSICS") { |
95 | // Read old calibration | |
96 | AliCDBEntry* cdbEntry = GetFromOCDB("Calib", "CalibSPD"); | |
97 | TObjArray* spdEntry; | |
98 | if(cdbEntry) { | |
99 | spdEntry = (TObjArray*)cdbEntry->GetObject(); | |
100 | if(!spdEntry) return 1; | |
03fc6773 | 101 | } |
53ae21ce | 102 | else { |
103 | Log("Old calibration not found in database. This is required for further processing."); | |
0c0426a2 | 104 | return 1; |
105 | } | |
53ae21ce | 106 | |
107 | // Standalone runs: | |
108 | if (runType == "DAQ_NOISY_PIX_SCAN") { | |
109 | UInt_t nrUpdatedMods = 0; | |
110 | // Retrieve and unpack tared calibration files from FXS | |
111 | TList* list = GetFileSources(kDAQ,"SPD_noisy"); | |
112 | if (list) { | |
113 | UInt_t index = 0; | |
114 | while (list->At(index)!=NULL) { | |
115 | TObjString* fileNameEntry = (TObjString*) list->At(index); | |
116 | TString fileName = GetFile(kDAQ, "SPD_noisy", fileNameEntry->GetString().Data()); | |
117 | TString command = Form("tar -xf %s",fileName.Data()); | |
118 | gSystem->Exec(command.Data()); | |
119 | index++; | |
120 | } | |
121 | } | |
122 | // Update the database entries for the modules that were scanned | |
123 | AliITSOnlineCalibrationSPDhandler* handler = new AliITSOnlineCalibrationSPDhandler(); | |
124 | TString fileLoc = "."; | |
125 | handler->SetFileLocation(fileLoc.Data()); | |
126 | for (Int_t module=0; module<240; module++) { | |
127 | if (handler->ReadFromFile(module)) { | |
128 | ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNrNoisy( handler->GetNrNoisy(module) ); | |
129 | ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNoisyList( handler->GetNoisyArray(module) ); | |
130 | nrUpdatedMods++; | |
131 | } | |
132 | } | |
133 | delete handler; | |
134 | // Store the new calibration objects (if any modifications were made) in OCDB | |
135 | if (nrUpdatedMods>0) { | |
136 | Log(Form("Noisy lists for %d modules will be updated and stored...",nrUpdatedMods)); | |
137 | AliCDBMetaData metaData; | |
138 | metaData.SetBeamPeriod(0); | |
139 | metaData.SetResponsible("Henrik Tydesjo"); | |
140 | metaData.SetComment("Preprocessor test for SPD."); | |
141 | if (!Store("Calib", "CalibSPD", spdEntry, &metaData, 0, kTRUE)) { | |
142 | Log("Failed to store calibration data."); | |
143 | return 1; | |
144 | } | |
145 | Log("Database updated."); | |
146 | } | |
147 | } | |
148 | ||
149 | // Physics runs (online monitoring): | |
150 | if (runType == "PHYSICS") { | |
151 | // *** code to be written *** // | |
152 | } | |
153 | ||
154 | ||
03fc6773 | 155 | } |
156 | ||
03fc6773 | 157 | |
158 | ||
53ae21ce | 159 | return 0; // 0 means success |
03fc6773 | 160 | |
fcf95fc7 | 161 | } |
b15de2d2 | 162 |