1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ///////////////////////////////////////////////
19 // Author: Henrik Tydesjo //
20 // Preprocessor Class for the SPD //
22 ///////////////////////////////////////////////
25 #include <TObjString.h>
26 #include <TTimeStamp.h>
28 #include "AliITSPreprocessorSPD.h"
29 #include "AliITSCalibrationSPD.h"
30 #include "AliITSOnlineCalibrationSPD.h"
31 #include "AliITSOnlineCalibrationSPDhandler.h"
32 #include "AliCDBMetaData.h"
35 ClassImp(AliITSPreprocessorSPD)
37 //______________________________________________________________________________________________
38 AliITSPreprocessorSPD::AliITSPreprocessorSPD(AliShuttleInterface* shuttle) :
39 AliPreprocessor("SPD", shuttle)
44 //______________________________________________________________________________________________
45 AliITSPreprocessorSPD::~AliITSPreprocessorSPD()
50 //______________________________________________________________________________________________
51 void AliITSPreprocessorSPD::Initialize(Int_t run, UInt_t startTime,
55 AliPreprocessor::Initialize(run, startTime, endTime);
57 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
58 TTimeStamp(startTime).AsString(),
59 TTimeStamp(endTime).AsString()));
62 //______________________________________________________________________________________________
63 UInt_t AliITSPreprocessorSPD::Process(TMap* dcsAliasMap)
65 // Do the actual preprocessing
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();
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++) {
79 sprintf(id,"SPD_%d",module);
80 TList* list = GetFileSources(kDAQ,id); // (the id is actually unique, so always 1 file)
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() );
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);
102 // // Store the container files as reference data (one for each equipment)
103 // for (UInt_t eq=0; eq<20; eq++) {
105 // sprintf(id,"SPDref%d",eq);
106 // TList* list = GetFileSources(kDAQ,id); // (the id is actually unique, so always 1 file)
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);