37 #define RESULT_FILE "tpcCEnew.root" 38 #define FILE_ID "CEnew" 39 #define MAPPING_FILE "tpcMapping.root" 40 #define CONFIG_FILE "TPCCEda.conf" 41 #define LASER_TRACK_FILE "LaserTracks.root" 54 #include "TPluginManager.h" 57 #include "TObjString.h" 59 #include "TStopwatch.h" 66 #include "AliRawReader.h" 67 #include "AliRawReaderDate.h" 91 int main(
int argc,
char **argv) {
96 printf(
"TPCCEda: DA started - %s\n",__FILE__);
99 printf(
"TPCCEda: Wrong number of arguments\n");
107 gROOT->GetPluginManager()->AddHandler(
"TVirtualStreamerInfo",
115 status=monitorDeclareMp( __FILE__ );
117 printf(
"TPCCEnewda: monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
121 monitorSetNoWaitNetworkTimeout(1000);
126 unsigned long32 runNb=0;
136 printf(
"TPCCEda: Failed to get configuration file (%s) from DAQdetDB, status=%d\n",
CONFIG_FILE, status);
141 TString laserTriggerName(
"C0LSR-ABCE-NOPF-CENT");
142 TString monitoringType(
"YES");
143 TString cdb(
"local:///local/cdb");
144 Int_t forceTriggerId=-1;
145 Bool_t skipAmore=kFALSE;
149 printf(
"TPCCEnewda: Laser trigger class name set to: %s.\n",laserTriggerName.Data());
154 printf(
"TPCCEnewda: Monitoring type set to: %s.\n",monitoringType.Data());
158 forceTriggerId=TMath::Nint(config.
GetValue(
"ForceLaserTriggerId"));
159 printf(
"TPCCEnewda: Only processing triggers with Id: %d.\n",forceTriggerId);
163 skipAmore=((TObjString*)config.
GetConfigurationMap()->GetValue(
"SkipAmore"))->GetString().Atoi();
164 printf(
"TPCCENEWda: Skip Amore set in config\n");
171 unsigned char classIdptr=0;
172 int retClassId=daqDA_getClassIdFromName(laserTriggerName.Data(),&classIdptr);
177 snprintf(c,
sizeof(c),
"%u",(
unsigned int)classIdptr);
178 char *table[5] = {
"PHY",
const_cast<char*
>(monitoringType.Data()),
"*",c,NULL};
179 monitorDeclareTableExtended(table);
180 printf(
"TPCCEnewda: Using monitoring table: (PHY, %s, *, %s)\n",monitoringType.Data(),c);
181 }
else if (retClassId==-1){
184 printf(
"TPCCEnewda: Laser trigger class '%s' was not found among trigger class names. Will stop processing.\n",laserTriggerName.Data());
186 }
else if (retClassId==-2){
188 char *table[5] = {
"PHY",
"Y",
"*",
"*",NULL};
189 monitorDeclareTableExtended(table);
190 printf(
"TPCCEnewda: Using all trigger class Ids\n");
192 printf(
"TPCCEnewda: Unknown return value of 'daqDA_getClassIdFromName': %d\n",retClassId);
197 if (forceTriggerId>-1){
199 sprintf(c,
"%d",forceTriggerId);
200 char *table[5] = {
"PHY",
"Y",
"*",c,NULL};
201 monitorDeclareTableExtended(table);
211 printf(
"TPCCEnewda: Failed to get mapping file (%s) from DAQdetDB, status=%d\n",
MAPPING_FILE, status);
217 mapping = (
AliTPCmapper*) fileMapping->Get(
"tpcMapping");
232 printf(
"TPCCEnewda: Failed to get the laser track file (%s) from DAQdetDB, status=%d\n",
MAPPING_FILE, status);
240 calibCE.SetProcessOld(kFALSE);
241 calibCE.SetProcessNew();
244 Double_t updateInterval=300;
245 Double_t valConf=config.
GetValue(
"AmoreUpdateInterval");
246 if ( valConf>0 ) updateInterval=valConf;
248 TStopwatch stopWatch;
256 for ( i=1; i<argc; i++) {
259 printf(
"TPCCEnewda: Processing file %s\n", argv[i]);
260 status=monitorSetDataSource( argv[i] );
262 printf(
"TPCCEnewda: monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
269 struct eventHeaderStruct *event;
272 if (daqDA_checkShutdown()) {
break;}
275 status=monitorGetEventDynamic((
void **)&event);
276 if (status==MON_ERR_EOF) {
277 printf (
"TPCCEnewda: End of File %d detected\n",i);
282 printf(
"TPCCEnewda: monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
290 if (stopWatch.RealTime()>updateInterval){
295 stopWatch.Continue();
298 if (nevents>neventsOld){
299 printf (
"TPCCEnewda: %d events processed, %d used\n",nevents,calibCE.GetNeventsProcessed());
307 if ( (event->eventType != physicsEvent) && (
event->eventType != calibrationEvent) ){
314 runNb =
event->eventRunNb;
317 calibCE.ProcessEvent(event);
329 printf (
"TPCCEnewda: %d events processed, %d used\n",nevents,calibCE.GetNeventsProcessed());
335 calibCE.DumpToFile(
RESULT_FILE,
"name=tpcCalibCE,type=4");
358 const char *amoreDANameorig=gSystem->Getenv(
"AMORE_DA_NAME");
366 gSystem->Setenv(
"AMORE_DA_NAME",Form(
"TPC-%s",
FILE_ID));
372 TObjString
info(Form(
"Run: %u; Date: %s",runNb,time.AsSQLString()));
373 amore::da::AmoreDA amoreDA(amore::da::AmoreDA::kSender);
381 statusDA+=amoreDA.Send(
"Info",&info);
383 printf(
"TPCCEnewda: Waring: Failed to write one of the calib objects to the AMORE database\n");
385 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
void SendToAmoreDB(AliTPCCalibCE &calibCE, unsigned long32 runNb)
Float_t GetValue(const char *name) const
static void SetModuleDebugLevel(const char *module, Int_t level)
const TObjArray * GetArrFitGraphs() const
Class for Parsing simple text configuration files.
int main(int argc, char **argv)
Implementation of the TPC Central Electrode calibration.
AliTPCAltroMapping ** GetAltroMapping()
void SetAltroMapping(AliTPCAltroMapping **mapp)
TGraph * MakeGraphTimeCE(Int_t sector, Int_t xVariable=0, Int_t fitType=0, Int_t fitParameter=0)