]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSPreprocessorSPD.cxx
Updated misalignment macro (Raffaele)
[u/mrichter/AliRoot.git] / ITS / AliITSPreprocessorSPD.cxx
1 ///////////////////////////////////////////////
2 //  Author: Henrik Tydesjo                   //
3 //  Preprocessor Class for the SPD           //
4 //                                           //
5 ///////////////////////////////////////////////
6
7 #include "AliITSPreprocessorSPD.h"
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>
15
16 ClassImp(AliITSPreprocessorSPD)
17
18 //______________________________________________________________________________________________
19 AliITSPreprocessorSPD::AliITSPreprocessorSPD(AliShuttleInterface* shuttle) :
20   AliPreprocessor("SPD", shuttle)
21 {
22   // constructor
23 }
24
25 //______________________________________________________________________________________________
26 AliITSPreprocessorSPD::~AliITSPreprocessorSPD()
27 {
28   // destructor
29 }
30
31 //______________________________________________________________________________________________
32 void AliITSPreprocessorSPD::Initialize(Int_t run, UInt_t startTime,
33         UInt_t endTime)
34 {
35   // initialize
36   AliPreprocessor::Initialize(run, startTime, endTime);
37
38   AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
39                TTimeStamp(startTime).AsString(),
40                TTimeStamp(endTime).AsString()));
41 }
42
43 //______________________________________________________________________________________________
44 UInt_t AliITSPreprocessorSPD::Process(TMap* dcsAliasMap)
45 {
46   // Do the actual preprocessing
47
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);
54   }
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() );
71     }
72   }
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;
81   
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;
100 }
101