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 #include "AliACORDEPreprocessor.h"
21 #include "AliCDBMetaData.h"
22 #include "AliCDBEntry.h"
24 #include "AliACORDECalibModule.h"
25 #include "AliACORDEDataModule.h"
27 #include <TTimeStamp.h>
28 #include <TObjString.h>
32 // This is the first version of ACORDE Preprocessor
33 // It takes data from DAQ and passes it to the class AliACORDECalibModule and
34 // stores reference data.
37 // Pedro Gonzalez pedro.gonzalez@fcfm.buap.mx
38 // Irais Bautista irais@fcfm.buap.mx
39 // Arturo Fernandez Tellez afernan@cern.ch
41 ClassImp(AliACORDEPreprocessor)
43 //______________________________________________________________________________________________
44 AliACORDEPreprocessor::AliACORDEPreprocessor(AliShuttleInterface* shuttle) :
45 AliPreprocessor("ACO", shuttle),
51 //______________________________________________________________________________________________
52 AliACORDEPreprocessor::~AliACORDEPreprocessor()
57 //______________________________________________________________________________________________
58 void AliACORDEPreprocessor::Initialize(Int_t run, UInt_t startTime,
61 // Creates AliACORDECalibModule object
63 AliPreprocessor::Initialize(run, startTime, endTime);
65 Log(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
66 TTimeStamp(startTime).AsString(),
67 TTimeStamp(endTime).AsString()));
69 fCalData = new AliACORDECalibModule();
72 //______________________________________________________________________________________________
73 UInt_t AliACORDEPreprocessor::Process(TMap* /*dcsAliasMap*/)
79 TH1D *histoRate; //Histogram of the rates per module
83 // retrieve the run type from the Shuttle,
86 TString runType = GetRunType();
88 if(runType !="SPD_STANDALONE_CALIBRATION")
91 Log("RunType is not SPD_STANDALONE_CALIBRATION, nothing to do");
97 Log(Form("Run type for run %d: %s", fRun, runType.Data()));
101 //retrieve the list of sources that produced the file with id RATES
103 TList* sourceList = GetFileSources(kDAQ, "RATES");
107 Log("Error: No sources found for id RATES!");
111 // TODO We have the list of sources that produced the files with Id RATES
112 // Now we will loop on the list and we'll query the files one by one.
116 Log("The following sources produced files with the id RATES");
119 TIter iter(sourceList);
120 TObjString *source = 0;
124 while((source=dynamic_cast<TObjString*> (iter.Next())))
127 TString fileName = GetFile(kDAQ, "RATES", source->GetName());
129 if (fileName.Length() > 0)
130 Log(Form("Got the file %s, now we can extract some values.", fileName.Data()));
132 daqFile = new TFile(fileName.Data(),"READ");
133 histoRate =(TH1D *) daqFile->Get("Rates"); //Get Histogram with Rates per module
139 Log(Form("There are not histos"));
147 //Fills data in to AliACORDECalibModule object
149 for(int module=0;module<kNModules;module++)
152 Float_t value = histoRate->At(module);
153 TString name = "aco_hv_module";
157 //if(value>=0&&value<=2.5)
158 fCalData->SetModule(module,value,1,name); //1 module
160 // fCalData->SetModule(module,value,0,name); //0 module
165 fCalData->Create_Histo();
166 //fCalData->Print_Module();
173 //Now we have to store
175 AliCDBMetaData metaData;
176 metaData.SetBeamPeriod(0);
177 metaData.SetResponsible("Pedro and Irais");
178 metaData.SetComment("This preprocessor fills an AliACORDECalibModule object.");
180 Bool_t result = StoreReferenceData("Calib", "Data",fCalData, &metaData);