37 #define RESULT_FILE "tpcCalibRaw.root" 38 #define FILE_ID "tpcCalibRaw" 39 #define MAPPING_FILE "tpcMapping.root" 40 #define CONFIG_FILE "TPCRAWda.conf" 41 #define AliDebugLevel() -1 55 #include <TPluginManager.h> 57 #include <TObjString.h> 59 #include <TStopwatch.h> 65 #include "AliRawReader.h" 66 #include "AliRawReaderDate.h" 89 int main(
int argc,
char **argv) {
94 printf(
"TPCRAWda: DA started - %s\n",__FILE__);
97 printf(
"TPCRAWda: Wrong number of arguments\n");
104 gROOT->GetPluginManager()->AddHandler(
"TVirtualStreamerInfo",
112 int status=monitorDeclareMp( __FILE__ );
114 printf(
"TPCRAWda: monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
119 monitorSetNoWaitNetworkTimeout(1000);
124 unsigned long32 runNb=0;
132 printf(
"TPCRAWda: Failed to get mapping file (%s) from DAQdetDB, status=%d\n",
MAPPING_FILE, status);
138 mapping = (
AliTPCmapper*) fileMapping->Get(
"tpcMapping");
156 printf(
"TPCRAWda: Failed to get configuration file (%s) from DAQdetDB, status=%d\n",
CONFIG_FILE, status);
162 Double_t updateInterval=30;
163 TString laserTriggerName(
"C0LSR-ABCE-NOPF-CENT");
164 TString forceLaserTriggerId(
"-1");
165 TString monitorAttributes=Form(
"%d",ATTR_ORIGINAL_EVENT);
166 Bool_t skipAmore=kFALSE;
169 Double_t valConf=config.
GetValue(
"AmoreUpdateInterval");
170 if ( valConf>0 ) updateInterval=valConf;
175 printf(
"TPCRAWda: Laser trigger class name set to: %s.\n",laserTriggerName.Data());
179 forceLaserTriggerId=config.
GetConfigurationMap()->GetValue(
"ForceLaserTriggerId")->GetName();
180 printf(
"TPCRAWda: Force laser trigger Id: %s.\n",forceLaserTriggerId.Data());
184 skipAmore=((TObjString*)config.
GetConfigurationMap()->GetValue(
"SkipAmore"))->GetString().Atoi();
185 printf(
"TPCRAWda: Skip Amore set in config\n");
190 printf(
"TPCRAWda: Monitor attributes set in config: %s\n",monitorAttributes.Data());
195 unsigned char classId=0;
196 int retClassId=daqDA_getClassIdFromName(laserTriggerName.Data(),&classId);
198 if (forceLaserTriggerId!=
"-1"){
200 classId=
static_cast<unsigned char>(forceLaserTriggerId.Atoi());
206 TString triggerClasses;
210 for (
unsigned char iclassId=0; iclassId<50; ++iclassId){
211 if (iclassId==classId)
continue;
212 triggerClasses+=Form(
"%u|",(
unsigned int)iclassId);
214 triggerClasses.Chop();
215 char *table[5] = {
"PHY",
217 const_cast<char*
>(monitorAttributes.Data()),
218 const_cast<char*>(triggerClasses.Data()),NULL};
219 monitorDeclareTableExtended(table);
220 printf(
"TPCRAWda: Using laser trigger class Id: %u\n",(
unsigned int)classId);
221 printf(
"TPCRAWda: Accepted trigger class Ids: %s\n",triggerClasses.Data());
222 printf(
"TPCRAWda: Monitor attributes used: %s\n",monitorAttributes.Data());
232 TStopwatch stopWatch;
238 for(
int i=1;i<argc;i++) {
241 printf(
"TPCRAWda: Processing file %s\n", argv[i]);
242 status=monitorSetDataSource( argv[i] );
244 printf(
"TPCRAWda: monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
250 struct eventHeaderStruct *event;
253 if (daqDA_checkShutdown()) {
break;}
256 status=monitorGetEventDynamic((
void **)&event);
257 if (status==MON_ERR_EOF) {
258 printf (
"TPCRAWda: End of File %d detected\n",i);
263 printf(
"TPCRAWda: monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
273 runNb =
event->eventRunNb;
275 calibRaw.ProcessEvent(event);
277 if (stopWatch.RealTime()>updateInterval){
281 stopWatch.Continue();
293 printf (
"TPCRAWda: %d events processed\n",nevents);
295 TFile * fileTPC =
new TFile (
RESULT_FILE,
"recreate");
296 calibRaw.Write(
"tpcCalibRaw");
310 printf (
"TPCRAWda: AMORE part\n");
320 const char *amoreDANameorig=gSystem->Getenv(
"AMORE_DA_NAME");
329 gSystem->Setenv(
"AMORE_DA_NAME",
"TPC-RAW");
333 TObjString
info(Form(
"Run: %u; Date: %s",runNb,time.AsSQLString()));
335 amore::da::AmoreDA amoreDA(amore::da::AmoreDA::kSender);
337 statusDA+=amoreDA.Send(
"CalibRaw",o);
338 statusDA+=amoreDA.Send(
"Info",&info);
340 printf(
"TPCRAWda: Waring: Failed to write one of the calib objects to the AMORE database\n");
342 if (amoreDANameorig) gSystem->Setenv(
"AMORE_DA_NAME",amoreDANameorig);
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
static void SetClassDebugLevel(const char *className, Int_t level)
const TMap * GetConfigurationMap() const
int main(int argc, char **argv)
void SendToAmoreDB(TObject *o, unsigned long32 runNb)
Float_t GetValue(const char *name) const
static void SetModuleDebugLevel(const char *module, Int_t level)
Class for Parsing simple text configuration files.
AliTPCAltroMapping ** GetAltroMapping()
void SetAltroMapping(AliTPCAltroMapping **mapp)
Implementation of the TPC Raw drift velocity and Altro L1 Phase calibration.