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 **************************************************************************/
17 // Prototype of HMPID Preprocessor
20 #include "TestHMPIDPreprocessor.h"
22 #include "AliCDBMetaData.h"
23 #include "AliDCSValue.h"
25 #include "AliShuttleInterface.h"
27 #include <TTimeStamp.h>
28 #include <TObjString.h>
32 ClassImp(TestHMPIDPreprocessor)
34 //________________________________________________________________________________________
35 TestHMPIDPreprocessor::TestHMPIDPreprocessor():
36 AliPreprocessor("HMP",0)
38 // default constructor - Don't use this!
42 //________________________________________________________________________________________
43 TestHMPIDPreprocessor::TestHMPIDPreprocessor(AliShuttleInterface* shuttle):
44 AliPreprocessor("HMP", shuttle)
46 // constructor - shuttle must be instantiated!
50 //________________________________________________________________________________________
51 void TestHMPIDPreprocessor::Initialize(Int_t run, UInt_t startTime,
54 // Initialize preprocessor
56 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
57 TTimeStamp(startTime).AsString(),
58 TTimeStamp(endTime).AsString()));
61 fStartTime = startTime;
65 //________________________________________________________________________________________
66 Bool_t TestHMPIDPreprocessor::ProcessDCS()
68 // Initialize preprocessor
70 TString runType = GetRunType();
71 if(runType == "LED") return kFALSE;
76 //________________________________________________________________________________________
77 UInt_t TestHMPIDPreprocessor::Process(TMap* /*valueMap*/)
79 // process data retrieved by the Shuttle
81 Bool_t result = kFALSE;
83 // Get run type and start the processing algorithm accordingly
84 TString runType = GetRunType();
85 if (runType.Length()==0)
87 Log("Undefined run type!");
91 Log(Form("Run type: %s", runType.Data()));
93 if (runType == "PHYSICS")
96 TList* filesources = GetFileSources(AliShuttleInterface::kDAQ, "DAQFile");
99 AliError(Form("No sources found for thresholds.txt for run %d !", fRun));
103 AliInfo("Here's the list of sources for thresholds.txt");
104 filesources->Print();
106 TIter iter(filesources);
109 while((source=dynamic_cast<TObjString*> (iter.Next()))){
110 printf("\n\n Getting file #%d\n",++i);
112 //TString filename = GetFile(AliShuttleInterface::kDAQ, "DAQFile", source->GetName());
113 TString filename = "DAQfile.txt";
114 if(!filename.Length()) {
115 AliError(Form("Error: retrieval of file from source %s failed!", source->GetName()));
119 TString command = Form("more %s",filename.Data());
120 gSystem->Exec(command.Data());
122 // STORAGE! The First file name will be stored into CDB, the second into reference storage
123 TObjString filenameObj(filename);
124 AliCDBMetaData metaData;
125 if(i==1) result = Store("Calib", "DAQData", &filenameObj, &metaData);
126 if(i==2) result = StoreReferenceData("Calib", "RefData", &filenameObj, &metaData);
131 } else if (runType == "PEDESTALS")
135 TString filename = GetFile(AliShuttleInterface::kDCS, "DCSFile", 0);
136 if(!filename.Length()) {
137 AliError(Form("Error: retrieval of file from DCS failed!"));
140 TString command = Form("more %s", filename.Data());
141 gSystem->Exec(command.Data());
143 // STORAGE! The First file name will be stored into CDB, the second into reference storage
144 TObjString filenameObj(filename);
145 AliCDBMetaData metaData;
146 result = Store("Calib", "DCSData", &filenameObj, &metaData);
148 } else if (runType == "LED")
152 TList* filesources = GetFileSources(AliShuttleInterface::kHLT, "HLTFile");
155 Log(Form("No sources found for HLTFile for run %d !", fRun));
159 AliInfo("Here's the list of sources for HLTFile");
160 filesources->Print();
162 TIter iter(filesources);
165 while((source=dynamic_cast<TObjString*> (iter.Next()))){
166 printf("\n\n Getting file #%d\n",++i);
168 //TString filename = GetFile(AliShuttleInterface::kHLT, "HLTFile", source->GetName());
169 TString filename="HLTfile.txt";
170 if(!filename.Length()) {
171 AliError(Form("Error: retrieval of file from source %s failed!", source->GetName()));
175 TString command = Form("more %s",filename.Data());
176 gSystem->Exec(command.Data());
178 // STORAGE! The First file name will be stored into CDB, the second into reference storage
179 TObjString filenameObj(filename);
180 AliCDBMetaData metaData;
181 if(i==1) result = Store("Calib", "HLTData", &filenameObj, &metaData);
182 if(i==2) result = StoreReferenceData("Calib", "RefHLTData", &filenameObj, &metaData);
187 Log(Form("Unknown run type: %s", runType.Data()));
192 Log("Storage error!");