]> git.uio.no Git - u/mrichter/AliRoot.git/blame - SHUTTLE/test/TestHMPIDPreprocessor.cxx
Adding the option to zero shared entries below threshold
[u/mrichter/AliRoot.git] / SHUTTLE / test / TestHMPIDPreprocessor.cxx
CommitLineData
84090f85 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16//
f4b3bbb7 17// Prototype of HMPID Preprocessor
84090f85 18//
19
f4b3bbb7 20#include "TestHMPIDPreprocessor.h"
84090f85 21
22#include "AliCDBMetaData.h"
23#include "AliDCSValue.h"
24#include "AliLog.h"
25#include "AliShuttleInterface.h"
26
27#include <TTimeStamp.h>
28#include <TObjString.h>
29#include <TSystem.h>
886d60e6 30#include <TList.h>
84090f85 31
f4b3bbb7 32ClassImp(TestHMPIDPreprocessor)
84090f85 33
34//________________________________________________________________________________________
f4b3bbb7 35TestHMPIDPreprocessor::TestHMPIDPreprocessor():
eba76848 36 AliPreprocessor("HMP",0)
84090f85 37{
38// default constructor - Don't use this!
39
40}
41
42//________________________________________________________________________________________
f4b3bbb7 43TestHMPIDPreprocessor::TestHMPIDPreprocessor(AliShuttleInterface* shuttle):
be48e3ea 44 AliPreprocessor("HMP", shuttle)
84090f85 45{
46// constructor - shuttle must be instantiated!
47
48}
49
50//________________________________________________________________________________________
f4b3bbb7 51void TestHMPIDPreprocessor::Initialize(Int_t run, UInt_t startTime,
84090f85 52 UInt_t endTime)
53{
54// Initialize preprocessor
55
56 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
57 TTimeStamp(startTime).AsString(),
58 TTimeStamp(endTime).AsString()));
59
60 fRun = run;
61 fStartTime = startTime;
62 fEndTime = endTime;
63}
64
886d60e6 65//________________________________________________________________________________________
66Bool_t TestHMPIDPreprocessor::ProcessDCS()
67{
68// Initialize preprocessor
69
70 TString runType = GetRunType();
71 if(runType == "LED") return kFALSE;
72 return kTRUE;
73}
74
75
84090f85 76//________________________________________________________________________________________
f4b3bbb7 77UInt_t TestHMPIDPreprocessor::Process(TMap* /*valueMap*/)
84090f85 78{
79// process data retrieved by the Shuttle
80
886d60e6 81 Bool_t result = kFALSE;
84090f85 82
441b0e9c 83 // Get run type and start the processing algorithm accordingly
84 TString runType = GetRunType();
85 if (runType.Length()==0)
86 {
87 Log("Undefined run type!");
886d60e6 88 return 1;
84090f85 89 }
90
441b0e9c 91 Log(Form("Run type: %s", runType.Data()));
92
93 if (runType == "PHYSICS")
94 {
95 // DAQ
96 TList* filesources = GetFileSources(AliShuttleInterface::kDAQ, "DAQFile");
97
98 if(!filesources) {
99 AliError(Form("No sources found for thresholds.txt for run %d !", fRun));
886d60e6 100 return 2;
441b0e9c 101 }
102
103 AliInfo("Here's the list of sources for thresholds.txt");
104 filesources->Print();
105
106 TIter iter(filesources);
107 TObjString* source;
108 int i=0;
109 while((source=dynamic_cast<TObjString*> (iter.Next()))){
110 printf("\n\n Getting file #%d\n",++i);
111 //if(i==1) continue;
886d60e6 112 //TString filename = GetFile(AliShuttleInterface::kDAQ, "DAQFile", source->GetName());
113 TString filename = "DAQfile.txt";
441b0e9c 114 if(!filename.Length()) {
115 AliError(Form("Error: retrieval of file from source %s failed!", source->GetName()));
116 delete filesources;
886d60e6 117 return 3;
441b0e9c 118 }
119 TString command = Form("more %s",filename.Data());
120 gSystem->Exec(command.Data());
121
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);
127
128 }
129 delete filesources;
130
131 } else if (runType == "PEDESTALS")
132 {
133
134 // DCS
135 TString filename = GetFile(AliShuttleInterface::kDCS, "DCSFile", 0);
be48e3ea 136 if(!filename.Length()) {
441b0e9c 137 AliError(Form("Error: retrieval of file from DCS failed!"));
886d60e6 138 return 4;
84090f85 139 }
441b0e9c 140 TString command = Form("more %s", filename.Data());
84090f85 141 gSystem->Exec(command.Data());
142
143 // STORAGE! The First file name will be stored into CDB, the second into reference storage
144 TObjString filenameObj(filename);
145 AliCDBMetaData metaData;
441b0e9c 146 result = Store("Calib", "DCSData", &filenameObj, &metaData);
147
886d60e6 148 } else if (runType == "LED")
441b0e9c 149 {
84090f85 150
441b0e9c 151 // HLT
152 TList* filesources = GetFileSources(AliShuttleInterface::kHLT, "HLTFile");
153
154 if(!filesources) {
155 Log(Form("No sources found for HLTFile for run %d !", fRun));
886d60e6 156 return 5;
441b0e9c 157 }
158
159 AliInfo("Here's the list of sources for HLTFile");
160 filesources->Print();
161
162 TIter iter(filesources);
163 int i = 0;
164 TObjString* source;
165 while((source=dynamic_cast<TObjString*> (iter.Next()))){
166 printf("\n\n Getting file #%d\n",++i);
167 //if(i==1) continue;
886d60e6 168 //TString filename = GetFile(AliShuttleInterface::kHLT, "HLTFile", source->GetName());
169 TString filename="HLTfile.txt";
441b0e9c 170 if(!filename.Length()) {
171 AliError(Form("Error: retrieval of file from source %s failed!", source->GetName()));
172 delete filesources;
886d60e6 173 return 6;
441b0e9c 174 }
175 TString command = Form("more %s",filename.Data());
176 gSystem->Exec(command.Data());
177
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);
183
184 }
185 delete filesources;
186 } else {
187 Log(Form("Unknown run type: %s", runType.Data()));
84090f85 188 }
886d60e6 189
190 if(!result)
191 {
192 Log("Storage error!");
193 return 100;
194 }
195
196 return 0;
84090f85 197}
198