]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/TPCPULSERda.cxx
Updated run type specification (CALIBRATION_PULSER)
[u/mrichter/AliRoot.git] / TPC / TPCPULSERda.cxx
index 9bd752cb9e0ec3cfa72f27c77e15736f81110689..0aeaa021ab419057df55562fff628f811dbcd730 100644 (file)
@@ -3,11 +3,12 @@ TPC DA for online calibration
 
 Contact: Haavard.Helstrup@cern.ch
 Link:
-Run Type: PULSER_RUN
+Run Type: CALIBRATION_PULSER
 DA Type: LDC
 Number of events needed: 100
 Input Files: 
 Output Files: tpcPulser.root, to be exported to the DAQ FXS
+fileId:   pulser
 Trigger types used: CALIBRATION_EVENT
 
 */
@@ -28,6 +29,9 @@ and save results in a file (named from RESULT_FILE define - see below).
 */
 
 #define RESULT_FILE "tpcPulser.root"
+#define FILE_ID "pulser"
+#define MAPPING_FILE "tpcMapping.root"
+#define AliDebugLevel() -1
 
 
 #include <daqDA.h>
@@ -47,12 +51,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
@@ -66,6 +73,10 @@ and save results in a file (named from RESULT_FILE define - see below).
       Arguments: list of DATE raw data files
 */
 int main(int argc, char **argv) {
+  AliLog::SetClassDebugLevel("AliTPCRawStream",-5);
+  AliLog::SetClassDebugLevel("AliRawReaderDate",-5);
+  AliLog::SetClassDebugLevel("AliTPCAltroMapping",-5);
+  AliLog::SetModuleDebugLevel("RAW",-5);
 
  gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
                                          "*",
@@ -75,6 +86,32 @@ int main(int argc, char **argv) {
 
 
   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);
+  }
+
+
   AliTPCCalibPulser calibPulser;   // pedestal and noise calibration
 
   if (argc<2) {
@@ -86,7 +123,9 @@ int main(int argc, char **argv) {
   /* log start of process */
   printf("TPC Pulser DA started - %s\n",__FILE__);
 
-
+  /* set time bin range */
+  calibPulser.SetRangeTime(400,500);
+  calibPulser.SetAltroMapping(mapping->GetAltroMapping()); // Use altro mapping we got from daqDetDb
   /* declare monitoring program */
   status=monitorDeclareMp( __FILE__ );
   if (status!=0) {
@@ -135,7 +174,8 @@ int main(int argc, char **argv) {
       //  Pulser calibration
 
       AliRawReader *rawReader = new AliRawReaderDate((void*)event);
-      calibPulser.ProcessEvent(rawReader);
+//      calibPulser.ProcessEvent(rawReader);
+      calibPulser.ProcessEventFast(rawReader);
       delete rawReader;
 
       /* free resources */
@@ -147,9 +187,16 @@ int main(int argc, char **argv) {
   printf ("%d events processed\n",nevents);
 
   TFile * fileTPC = new TFile (RESULT_FILE,"recreate");
-  calibPulser.Write("calibPulser");
+  calibPulser.Write("tpcCalibPulser");
   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;
 }