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 "AliACORDECalibData.h"
26 #include <TTimeStamp.h>
27 #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 AliACORDECalibData();
72 //______________________________________________________________________________________________
73 UInt_t AliACORDEPreprocessor::Process(TMap* /*dcsAliasMap*/)
79 TH1D *fH1,*fH2,*fH3,*fH4; //Histogram of the rates per module
83 // retrieve the run type from the Shuttle,
86 TString runType = GetRunType();
89 //acorde STANDALONE_BC
90 //acorde STANDALONE_PULSER
92 if(runType !="STANDALONE_PULSER")
95 Log("RunType is not STANDALONE_PULSER, nothing to do");
101 Log(Form("Run type for run %d: %s", fRun, runType.Data()));
102 TString SourcesId = "CALIB";
106 //retrieve the list of sources that produced the file with id RATES
108 TList* sourceList = GetFileSources(kDAQ,SourcesId.Data());
112 Log(Form("Error: No sources found for id %s", SourcesId.Data()));
116 // TODO We have the list of sources that produced the files with Id RATES
117 // Now we will loop on the list and we'll query the files one by one.
121 Log(Form("The following sources produced files with the id %s",SourcesId.Data()));
124 TIter iter(sourceList);
125 TObjString *source = 0;
129 while((source=dynamic_cast<TObjString*> (iter.Next())))
132 TString fileName = GetFile(kDAQ,SourcesId.Data(), source->GetName());
134 if (fileName.Length() > 0)
135 Log(Form("Got the file %s, now we can extract some values.", fileName.Data()));
137 daqFile = new TFile(fileName.Data(),"READ");
142 Log(Form("There are not histos 1"));
149 fH1 = (TH1D*)daqFile->Get("fHist1");
150 fH2 = (TH1D*)daqFile->Get("fHist2");
151 fH3 = (TH1D*)daqFile->Get("fHist3");
152 fH4 = (TH1D*)daqFile->Get("fHist4");
156 if(fH1!=NULL&&fH2!=NULL&&fH3!=NULL&&fH4!=NULL)
158 fCalData->AddHHits(fH1);
159 fCalData->AddHTHits(fH2);
160 fCalData->AddHMultiHits(fH3);
161 fCalData->AddHTMultiHits(fH4);
166 Log(Form("There are not histos 2"));
178 //Now we have to store
180 AliCDBMetaData metaData;
181 metaData.SetBeamPeriod(0);
182 metaData.SetResponsible("Pedro and Irais");
183 metaData.SetComment("This preprocessor fills an AliACORDECalibModule object.");
185 Bool_t result = StoreReferenceData("Calib", "Data",fCalData, &metaData);