]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/TPCCEda.cxx
Adding stream level and debug streamer to the base class
[u/mrichter/AliRoot.git] / TPC / TPCCEda.cxx
index 36ebdc8eb1046e694e41dbe3fe3270f716521b9a..ba40d97a02e536cecfb5781da678729edc1227b6 100644 (file)
@@ -1,3 +1,18 @@
+/*
+TPC DA for online calibration
+
+Contact: Haavard.Helstrup@cern.ch
+Link: 
+Run Type: PHYSICS_RUN STANDALONE DAQ
+DA Type: MON
+Number of events needed: 500
+Input Files: 
+Output Files: tpcCE.root, to be exported to the DAQ FXS
+fileId:   CE
+Trigger types used: PHYSICS_EVENT
+
+*/
+
 /*
 
 TPCCEda.cxx - calibration algorithm for TPC Central Electrode events
@@ -13,7 +28,9 @@ and save results in a file (named from RESULT_FILE define - see below).
 
 */
 
-#define RESULT_FILE "tpcPulser.root"
+#define RESULT_FILE "tpcCE.root"
+#define FILE_ID "CE"
+#define MAPPING_FILE "tpcMapping.root"
 
 
 #include <daqDA.h>
@@ -33,12 +50,15 @@ and save results in a file (named from RESULT_FILE define - see below).
 //
 #include "AliRawReader.h"
 #include "AliRawReaderDate.h"
+#include "AliTPCmapper.h"
 #include "AliTPCRawStream.h"
 #include "AliTPCROC.h"
 #include "AliTPCCalROC.h"
 #include "AliTPCCalPad.h"
 #include "AliMathBase.h"
 #include "TTreeStream.h"
+#include "AliLog.h"
+#include "TSystem.h"
 
 //
 // TPC calibration algorithm includes
@@ -59,8 +79,38 @@ int main(int argc, char **argv) {
                                          "RIO",
                                          "TStreamerInfo()");
 
+  AliLog::SetClassDebugLevel("AliTPCRawStream",-5);
+  AliLog::SetClassDebugLevel("AliRawReaderDate",-5);
+  AliLog::SetClassDebugLevel("AliTPCAltroMapping",-5);
+  AliLog::SetModuleDebugLevel("RAW",-5);
 
   int i,status;
+  AliTPCmapper *mapping = 0;   // The TPC mapping
+  // if  test setup get parameters from $DAQDA_TEST_DIR 
+  
+  if (!mapping){
+    /* copy locally the mapping file from daq detector config db */
+    status = daqDA_DB_getFile(MAPPING_FILE,"./tpcMapping.root");
+    if (status) {
+      printf("Failed to get mapping file (%s) from DAQdetDB, status=%d\n", MAPPING_FILE, status);
+      printf("Continue anyway ... maybe it works?\n");              // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+      return -1;   // temporarily uncommented for testing on pcald47 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    }
+
+    /* open the mapping file and retrieve mapping object */
+    TFile *fileMapping = new TFile(MAPPING_FILE, "read");
+    mapping = (AliTPCmapper*) fileMapping->Get("tpcMapping");
+    delete fileMapping;
+  }
+
+  if (mapping == 0) {
+    printf("Failed to get mapping object from %s.  ...\n", MAPPING_FILE);
+    //return -1;
+  } else {
+    printf("Got mapping object from %s\n", MAPPING_FILE);
+  }
+
+
   AliTPCCalibCE calibCE;   // pedestal and noise calibration
 
   if (argc<2) {
@@ -73,6 +123,10 @@ int main(int argc, char **argv) {
   printf("TPC CE DA started - %s\n",__FILE__);
 
 
+  /* set time bin range */
+  calibCE.SetRangeTime(800,940);
+  calibCE.SetAltroMapping(mapping->GetAltroMapping()); // Use altro mapping we got from daqDetDb
+
   /* declare monitoring program */
   status=monitorDeclareMp( __FILE__ );
   if (status!=0) {
@@ -133,9 +187,16 @@ int main(int argc, char **argv) {
   printf ("%d events processed\n",nevents);
 
   TFile * fileTPC = new TFile (RESULT_FILE,"recreate");
-  calibCE.Write("calibCE");
+  calibCE.Write("tpcCalibCE");
   delete fileTPC;
   printf("Wrote %s\n",RESULT_FILE);
 
+  /* store the result file on FES */
+
+  status=daqDA_FES_storeFile(RESULT_FILE,FILE_ID);
+  if (status) {
+    status = -2;
+  }
+
   return status;
 }