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");
55 //______________________________________________________________________________________________
56 AliACORDEPreprocessor::~AliACORDEPreprocessor()
61 //______________________________________________________________________________________________
62 void AliACORDEPreprocessor::Initialize(Int_t run, UInt_t startTime,
65 // Creates AliACORDECalibModule object
67 AliPreprocessor::Initialize(run, startTime, endTime);
69 Log(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
70 TTimeStamp(startTime).AsString(),
71 TTimeStamp(endTime).AsString()));
73 fCalData = new AliACORDECalibData();
74 fDataDCS = new AliACORDEDataDCS();
77 //______________________________________________________________________________________________
78 UInt_t AliACORDEPreprocessor::Process(TMap* dcsAliasMap)
82 // TH1D *fH1,*fH2,*fH3,*fH4; //Histogram of the rates per module
89 // retrieve the run type from the Shuttle,
94 Log(Form("Error there isn't dcsAliasMap"));
100 fDataDCS->ProcessData(*dcsAliasMap);
104 AliCDBMetaData metaData1;
105 metaData1.SetBeamPeriod(0);
106 metaData1.SetResponsible("Pedro and Irais");
107 metaData1.SetComment("This preprocessor fills an AliACORDECalibModule object.");
109 Bool_t result1 = StoreReferenceData("Calib", "DataDCS",fDataDCS, &metaData1);
114 TString runType = GetRunType();
117 Log(Form("Run type for run %d: %s", fRun, runType.Data()));
118 TString SourcesId = "CALIB";
123 //retrieve the list of sources that produced the file with id RATES
125 TList* sourceList = GetFileSources(kDAQ,SourcesId.Data());
129 Log(Form("Error: No sources found for id %s", SourcesId.Data()));
133 // TODO We have the list of sources that produced the files with Id RATES
134 // Now we will loop on the list and we'll query the files one by one.
138 Log(Form("The following sources produced files with the id %s",SourcesId.Data()));
141 TIter iter(sourceList);
142 TObjString *source = 0;
146 while((source=dynamic_cast<TObjString*> (iter.Next())))
149 TString fileName = GetFile(kDAQ,SourcesId.Data(), source->GetName());
151 if (fileName.Length() > 0)
152 Log(Form("Got the file %s, now we can extract some values.", fileName.Data()));
154 daqFile = new TFile(fileName.Data(),"READ");
159 Log(Form("There are not histos 1"));
166 fH[0] = (TH1D*)daqFile->Get("fHist1");
167 fH[1] = (TH1D*)daqFile->Get("fHist2");
168 fH[2] = (TH1D*)daqFile->Get("fHist3");
169 fH[3] = (TH1D*)daqFile->Get("fHist4");
173 if(fH[0]!=NULL&&fH[1]!=NULL&&fH[2]!=NULL&&fH[3]!=NULL)
175 fCalData->AddHHits(fH[0]);
176 fCalData->AddHTHits(fH[1]);
177 fCalData->AddHMultiHits(fH[2]);
178 fCalData->AddHTMultiHits(fH[3]);
183 Log(Form("There are not histos 2"));
195 //Now we have to store
197 AliCDBMetaData metaData;
198 metaData.SetBeamPeriod(0);
199 metaData.SetResponsible("Pedro and Irais");
200 metaData.SetComment("This preprocessor fills an AliACORDECalibModule object.");
202 Bool_t result2 = StoreReferenceData("Calib", "Data",fCalData, &metaData);