]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSPreprocessorSPD.cxx
Includes required by ROOT head
[u/mrichter/AliRoot.git] / ITS / AliITSPreprocessorSPD.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18 ///////////////////////////////////////////////
19 //  Author: Henrik Tydesjo                   //
20 //  Preprocessor Class for the SPD           //
21 //                                           //
22 ///////////////////////////////////////////////
23
24 #include <TList.h>
25 #include <TObjString.h>
26 #include <TTimeStamp.h>
27
28 #include "AliITSPreprocessorSPD.h"
29 #include "AliITSCalibrationSPD.h"
30 #include "AliITSOnlineCalibrationSPD.h"
31 #include "AliITSOnlineCalibrationSPDhandler.h"
32 #include "AliCDBMetaData.h"
33 #include "AliLog.h"
34
35 ClassImp(AliITSPreprocessorSPD)
36
37 //______________________________________________________________________________________________
38 AliITSPreprocessorSPD::AliITSPreprocessorSPD(AliShuttleInterface* shuttle) :
39   AliPreprocessor("SPD", shuttle)
40 {
41   // constructor
42 }
43
44 //______________________________________________________________________________________________
45 AliITSPreprocessorSPD::~AliITSPreprocessorSPD()
46 {
47   // destructor
48 }
49
50 //______________________________________________________________________________________________
51 void AliITSPreprocessorSPD::Initialize(Int_t run, UInt_t startTime,
52         UInt_t endTime)
53 {
54   // initialize
55   AliPreprocessor::Initialize(run, startTime, endTime);
56
57   AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
58                TTimeStamp(startTime).AsString(),
59                TTimeStamp(endTime).AsString()));
60 }
61
62 //______________________________________________________________________________________________
63 UInt_t AliITSPreprocessorSPD::Process(TMap* dcsAliasMap)
64 {
65   // Do the actual preprocessing
66
67   // DEAD/NOISY DATA
68   // Create the cdb entry, at first filled with empty cal objects (one for each module)
69   TObjArray *spdEntry = new TObjArray(240);
70   for(Int_t module=0;module<240;module++){
71     AliITSCalibrationSPD* cal = new AliITSCalibrationSPD();
72     spdEntry->Add(cal);
73   }
74   spdEntry->SetOwner(kTRUE);
75   // Get all the files corresponding to the different modules and fill the dead/noisy lists
76   AliITSOnlineCalibrationSPDhandler* handler = new AliITSOnlineCalibrationSPDhandler();
77   for (Int_t module=0; module<240; module++) {
78     Char_t id[20];
79     sprintf(id,"SPD_%d",module);
80     TList* list = GetFileSources(kDAQ,id); // (the id is actually unique, so always 1 file)
81     if (list) {
82       TObjString* fileNameEntry = (TObjString*) list->First();
83       Char_t* fileName = (Char_t*) GetFile(kDAQ, id, fileNameEntry->GetString().Data());
84       handler->SetModuleNr(module);
85       handler->ReadFromFile(fileName);
86       ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNrDead( handler->GetNrDead() );
87       ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetDeadList( handler->GetDeadArray() );
88       ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNrNoisy( handler->GetNrNoisy() );
89       ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNoisyList( handler->GetNoisyArray() );
90     }
91   }
92   delete handler;
93   // Store the cdb entry
94   AliCDBMetaData metaData;
95   metaData.SetBeamPeriod(0);
96   metaData.SetResponsible("Henrik Tydesjo");
97   metaData.SetComment("Preprocessor test for SPD.");  
98   UInt_t result = Store("SHUTTLE", "Calib", spdEntry, &metaData, 0, 0);
99   delete spdEntry;
100   
101 //  // REFERENCE DATA
102 //  // Store the container files as reference data (one for each equipment)
103 //  for (UInt_t eq=0; eq<20; eq++) {
104 //    Char_t id[20];
105 //    sprintf(id,"SPDref%d",eq);
106 //    TList* list = GetFileSources(kDAQ,id); // (the id is actually unique, so always 1 file)
107 //    if (list) {
108 //      TObjString* fileNameEntry = (TObjString*) list->First();
109 //      Char_t* fileName = (Char_t*) GetFile(kDAQ, id, fileNameEntry->GetString().Data());
110 //      AliITSOnlineSPDscan *scan = new AliITSOnlineSPDscan((Char_t*)fileName);
111 //      TObjArray* arr = scan->GetAsTObjArray();
112 //      Char_t refCAT[10];
113 //      sprintf(refCAT,"Ref%d",eq);
114 //      StoreReferenceData("SHUTTLE", refCAT, arr, &metaData, 0, 0);
115 //    }
116 //  }
117
118   return result;
119 }
120