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"
25 #include "AliACORDEDataDCS.h"
27 #include <TTimeStamp.h>
28 #include <TObjString.h>
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),
50 AddRunType("STANDALONE_BC");
51 AddRunType("STANDALONE_PULSER");
52 AddRunType("PHYSICS");
56 //______________________________________________________________________________________________
57 AliACORDEPreprocessor::~AliACORDEPreprocessor()
62 //______________________________________________________________________________________________
63 void AliACORDEPreprocessor::Initialize(Int_t run, UInt_t startTime,
66 // Creates AliACORDECalibModule object
68 AliPreprocessor::Initialize(run, startTime, endTime);
70 Log(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
71 TTimeStamp(startTime).AsString(),
72 TTimeStamp(endTime).AsString()));
74 fCalData = new AliACORDECalibData();
75 fDataDCS = new AliACORDEDataDCS();
78 //______________________________________________________________________________________________
79 UInt_t AliACORDEPreprocessor::Process(TMap* dcsAliasMap)
83 // TH1D *fH1,*fH2,*fH3,*fH4; //Histogram of the rates per module
90 // retrieve the run type from the Shuttle,
95 Log(Form("Error there isn't dcsAliasMap"));
101 fDataDCS->ProcessData(*dcsAliasMap);
105 AliCDBMetaData metaData1;
106 metaData1.SetBeamPeriod(0);
107 metaData1.SetResponsible("Pedro and Irais");
108 metaData1.SetComment("This preprocessor fills an AliACORDECalibModule object.");
110 Bool_t result1 = StoreReferenceData("Calib", "DataDCS",fDataDCS, &metaData1);
115 TString runType = GetRunType();
118 Log(Form("Run type for run %d: %s", fRun, runType.Data()));
119 TString SourcesId = "CALIB";
124 //retrieve the list of sources that produced the file with id RATES
126 TList* sourceList = GetFileSources(kDAQ,SourcesId.Data());
130 Log(Form("Error: No sources found for id %s", SourcesId.Data()));
134 // TODO We have the list of sources that produced the files with Id RATES
135 // Now we will loop on the list and we'll query the files one by one.
139 Log(Form("The following sources produced files with the id %s",SourcesId.Data()));
142 TIter iter(sourceList);
143 TObjString *source = 0;
147 while((source=dynamic_cast<TObjString*> (iter.Next())))
150 TString fileName = GetFile(kDAQ,SourcesId.Data(), source->GetName());
152 if (fileName.Length() > 0)
153 Log(Form("Got the file %s, now we can extract some values.", fileName.Data()));
155 daqFile = new TFile(fileName.Data(),"READ");
160 Log(Form("There are not histos 1"));
167 fH[0] = (TH1D*)daqFile->Get("fHist1");
168 fH[1] = (TH1D*)daqFile->Get("fHist2");
169 fH[2] = (TH1D*)daqFile->Get("fHist3");
170 fH[3] = (TH1D*)daqFile->Get("fHist4");
174 if(fH[0]!=NULL&&fH[1]!=NULL&&fH[2]!=NULL&&fH[3]!=NULL)
176 fCalData->AddHHits(fH[0]);
177 fCalData->AddHTHits(fH[1]);
178 fCalData->AddHMultiHits(fH[2]);
179 fCalData->AddHTMultiHits(fH[3]);
184 Log(Form("There are not histos 2"));
196 //Now we have to store
198 AliCDBMetaData metaData;
199 metaData.SetBeamPeriod(0);
200 metaData.SetResponsible("Pedro and Irais");
201 metaData.SetComment("This preprocessor fills an AliACORDECalibModule object.");
203 Bool_t result2 = StoreReferenceData("Calib", "Data",fCalData, &metaData);