]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSPreprocessorSPD.cxx
New SPD pre-processor (H. Tydesjo)
[u/mrichter/AliRoot.git] / ITS / AliITSPreprocessorSPD.cxx
CommitLineData
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"
9#include "AliITSOnlineCalibrationSPD.h"
10#include "AliITSOnlineCalibrationSPDhandler.h"
11#include "AliCDBMetaData.h"
12#include "AliLog.h"
13#include <TTimeStamp.h>
14#include <TObjString.h>
3f0e013c 15
b15de2d2 16ClassImp(AliITSPreprocessorSPD)
3f0e013c 17
b15de2d2 18//______________________________________________________________________________________________
19AliITSPreprocessorSPD::AliITSPreprocessorSPD(AliShuttleInterface* shuttle) :
20 AliPreprocessor("SPD", shuttle)
3f0e013c 21{
b15de2d2 22 // constructor
3f0e013c 23}
24
b15de2d2 25//______________________________________________________________________________________________
26AliITSPreprocessorSPD::~AliITSPreprocessorSPD()
3f0e013c 27{
b15de2d2 28 // destructor
3f0e013c 29}
30
b15de2d2 31//______________________________________________________________________________________________
32void AliITSPreprocessorSPD::Initialize(Int_t run, UInt_t startTime,
33 UInt_t endTime)
3f0e013c 34{
b15de2d2 35 // initialize
36 AliPreprocessor::Initialize(run, startTime, endTime);
3f0e013c 37
b15de2d2 38 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
39 TTimeStamp(startTime).AsString(),
40 TTimeStamp(endTime).AsString()));
3f0e013c 41}
fcf95fc7 42
b15de2d2 43//______________________________________________________________________________________________
44UInt_t AliITSPreprocessorSPD::Process(TMap* dcsAliasMap)
fcf95fc7 45{
b15de2d2 46 // Do the actual preprocessing
fcf95fc7 47
b15de2d2 48 // DEAD/NOISY DATA
49 // Create the cdb entry, at first filled with empty cal objects (one for each module)
50 TObjArray *spdEntry = new TObjArray(240);
51 for(Int_t module=0;module<240;module++){
52 AliITSCalibrationSPD* cal = new AliITSCalibrationSPD();
53 spdEntry->Add(cal);
e56160b8 54 }
b15de2d2 55 spdEntry->SetOwner(kTRUE);
56 // Get all the files corresponding to the different modules and fill the dead/noisy lists
57 AliITSOnlineCalibrationSPDhandler* handler = new AliITSOnlineCalibrationSPDhandler();
58 for (Int_t module=0; module<240; module++) {
59 Char_t id[20];
60 sprintf(id,"SPD_%d",module);
61 TList* list = GetFileSources(kDAQ,id); // (the id is actually unique, so always 1 file)
62 if (list) {
63 TObjString* fileNameEntry = (TObjString*) list->First();
64 Char_t* fileName = (Char_t*) GetFile(kDAQ, id, fileNameEntry->GetString().Data());
65 handler->SetModuleNr(module);
66 handler->ReadFromFile(fileName);
67 ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNrDead( handler->GetNrDead() );
68 ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetDeadList( handler->GetDeadArray() );
69 ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNrNoisy( handler->GetNrNoisy() );
70 ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNoisyList( handler->GetNoisyArray() );
5bfe44ce 71 }
fcf95fc7 72 }
b15de2d2 73 delete handler;
74 // Store the cdb entry
75 AliCDBMetaData metaData;
76 metaData.SetBeamPeriod(0);
77 metaData.SetResponsible("Henrik Tydesjo");
78 metaData.SetComment("Preprocessor test for SPD.");
79 UInt_t result = Store("SHUTTLE", "Calib", spdEntry, &metaData, 0, 0);
80 delete spdEntry;
e56160b8 81
b15de2d2 82// // REFERENCE DATA
83// // Store the container files as reference data (one for each equipment)
84// for (UInt_t eq=0; eq<20; eq++) {
85// Char_t id[20];
86// sprintf(id,"SPDref%d",eq);
87// TList* list = GetFileSources(kDAQ,id); // (the id is actually unique, so always 1 file)
88// if (list) {
89// TObjString* fileNameEntry = (TObjString*) list->First();
90// Char_t* fileName = (Char_t*) GetFile(kDAQ, id, fileNameEntry->GetString().Data());
91// AliITSOnlineSPDscan *scan = new AliITSOnlineSPDscan((Char_t*)fileName);
92// TObjArray* arr = scan->GetAsTObjArray();
93// Char_t refCAT[10];
94// sprintf(refCAT,"Ref%d",eq);
95// StoreReferenceData("SHUTTLE", refCAT, arr, &metaData, 0, 0);
96// }
97// }
98
99 return result;
fcf95fc7 100}
b15de2d2 101