]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/EMCALLEDda.cxx
Fix warning passing float to int (Javier)
[u/mrichter/AliRoot.git] / EMCAL / EMCALLEDda.cxx
index 7ef10f8524c1bc1ea03fbd916518fe669378b895..670aaef71986d807d30ea83e699e05165597f914 100644 (file)
@@ -20,7 +20,6 @@
 #define RESULT_FILE  "EMCALLED.root"
 #define FILE_ID "signal"
 #define AliDebugLevel() -1
-#define FILE_PEDClassName "emcCalibPedestal"
 #define FILE_SIGClassName "emcCalibSignal"
 const int kNRCU = 4;
 /* LOCAL_DEBUG is used to bypass daq* calls that do not work locally */
@@ -53,7 +52,6 @@ extern "C" {
 //
 // EMC calibration-helper algorithm includes
 //
-#include "AliCaloCalibPedestal.h"
 #include "AliCaloCalibSignal.h"
 
 /*
@@ -78,12 +76,12 @@ int main(int argc, char **argv) {
                                        "TStreamerInfo",
                                        "RIO",
                                        "TStreamerInfo()"); 
-
+  
   int i, status;
-
+  
   /* log start of process */
   printf("EMCAL DA started - %s\n",__FILE__);
-
+  
   /* declare monitoring program */
   status=monitorDeclareMp( __FILE__ );
   if (status!=0) {
@@ -93,10 +91,10 @@ int main(int argc, char **argv) {
   /* define wait event timeout - 1s max */
   monitorSetNowait();
   monitorSetNoWaitNetworkTimeout(1000);
-
+  
   /* Retrieve mapping files from DAQ DB */ 
- const char* mapFiles[kNRCU] = {"RCU0A.data","RCU1A.data","RCU0C.data","RCU1C.data"};
-
 const char* mapFiles[kNRCU] = {"RCU0A.data","RCU1A.data","RCU0C.data","RCU1C.data"};
+  
   for(Int_t iFile=0; iFile<kNRCU; iFile++) {
     int failed = daqDA_DB_getFile(mapFiles[iFile], mapFiles[iFile]);
     if(failed) { 
@@ -114,29 +112,41 @@ int main(int argc, char **argv) {
   TString path = "./";
   path += "RCU";
   TString path2;
-TString side[] = {"A","C"};//+ and - pseudorapidity supermodules
- for(Int_t j = 0; j < 2; j++){
-  for(Int_t i = 0; i < 2; i++) {
-    path2 = path;
-    path2 += i;
-    path2 += side[j]; 
-    path2 += ".data";
-    mapping[j*2 + i] = new AliCaloAltroMapping(path2.Data());
+  TString side[] = {"A","C"};//+ and - pseudorapidity supermodules
+  for(Int_t j = 0; j < 2; j++){
+    for(Int_t i = 0; i < 2; i++) {
+      path2 = path;
+      path2 += i;
+      path2 += side[j]; 
+      path2 += ".data";
+      mapping[j*2 + i] = new AliCaloAltroMapping(path2.Data());
+    }
   }
- }
-
+  
+  /* Retrieve cut=parameter file from DAQ DB */ 
+  const char* parameterFile = {"EMCALLEDda.dat"};
+  
+  int failed = daqDA_DB_getFile(parameterFile, parameterFile);
+  if (failed) { 
+    printf("Cannot retrieve file : %s from DAQ DB. Exit now..\n",
+          parameterFile);
+#ifdef LOCAL_DEBUG
+#else
+    return -1;
+#endif
+  }
+  
   /* set up our analysis classes */  
-  AliCaloCalibPedestal * calibPedestal = new AliCaloCalibPedestal(AliCaloCalibPedestal::kEmCal); 
-  calibPedestal->SetAltroMapping( mapping );
   AliCaloCalibSignal * calibSignal = new AliCaloCalibSignal(AliCaloCalibSignal::kEmCal); 
   calibSignal->SetAltroMapping( mapping );
-
+  calibSignal->SetParametersFromFile( parameterFile );
+  
   AliRawReader *rawReader = NULL;
   int nevents=0;
-
+  
   /* loop over RAW data files */
   for ( i=1; i<argc; i++ ) {
-
+    
     /* define data source : this is argument i */
     printf("Processing file %s\n", argv[i]);
     status=monitorSetDataSource( argv[i] );
@@ -144,16 +154,16 @@ TString side[] = {"A","C"};//+ and - pseudorapidity supermodules
       printf("monitorSetDataSource() failed. Error=%s. Exiting ...\n", monitorDecodeError(status));
       return -1;
     }
-
+    
     /* read until EOF */
     struct eventHeaderStruct *event;
     eventTypeType eventT;
-
+    
     for ( ; ; ) { // infinite loop
-
+      
       /* check shutdown condition */
       if (daqDA_checkShutdown()) {break;}
-
+      
       /* get next event (blocking call until timeout) */
       status=monitorGetEventDynamic((void **)&event);
       if (status==MON_ERR_EOF) {
@@ -164,37 +174,36 @@ TString side[] = {"A","C"};//+ and - pseudorapidity supermodules
        printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
        break;
       }
-
+      
       /* retry if got no event */
       if (event==NULL) {
        continue;
       }
       eventT = event->eventType; /* just convenient shorthand */
-
+      
       /* skip start/end of run events */
       if ( (eventT != physicsEvent) && (eventT != calibrationEvent) ) {
        continue;
       }
-
+      
       nevents++; // count how many acceptable events we have
-
+      
       //  Signal calibration
       rawReader = new AliRawReaderDate((void*)event);
+      calibSignal->SetRunNumber(event->eventRunNb);
       calibSignal->ProcessEvent(rawReader);
-      rawReader->Reset();
-      calibPedestal->ProcessEvent(rawReader);
       delete rawReader;
-
+      
       /* free resources */
       free(event);    
-
+      
     } //until EOF
   } // loop over files
-
+  
   // calculate average values also, for the LED info
   calibSignal->SetUseAverage(kTRUE);
   calibSignal->Analyze();
-
+  
   // by default, we only save the full info in debug mode  
 #ifdef LOCAL_DEBUG
 #else
@@ -202,41 +211,39 @@ TString side[] = {"A","C"};//+ and - pseudorapidity supermodules
   calibSignal->GetTreeAmpVsTime()->Reset();
   calibSignal->GetTreeLEDAmpVsTime()->Reset();
 #endif
-
+  
   //
   // write class to rootfile
   //
-
+  
   printf ("%d physics/calibration events processed.\n",nevents);
-
+  
   TFile f(RESULT_FILE, "recreate");
   if (!f.IsZombie()) { 
     f.cd();
-    calibPedestal->Write(FILE_PEDClassName);
     calibSignal->Write(FILE_SIGClassName);
     f.Close();
-    printf("Objects saved to file \"%s\" as \"%s\" and \"%s\".\n", 
-          RESULT_FILE, FILE_PEDClassName, FILE_SIGClassName); 
+    printf("Objects saved to file \"%s\" as \"%s\".\n", 
+          RESULT_FILE, FILE_SIGClassName); 
   } 
   else {
     printf("Could not save the object to file \"%s\".\n", 
           RESULT_FILE);
   }
-
+  
   //
   // closing down; see if we can delete our analysis helper(s) also
   //
-  delete calibPedestal;
   delete calibSignal;
   for(Int_t iFile=0; iFile<kNRCU; iFile++) {
     if (mapping[iFile]) delete mapping[iFile];
   }
-
+  
   /* store the result file on FES */
 #ifdef LOCAL_DEBUG
 #else
   status = daqDA_FES_storeFile(RESULT_FILE, FILE_ID);
 #endif
-
+  
   return status;
 }