]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/TPCCEda.cxx
change binning rhom histograms
[u/mrichter/AliRoot.git] / TPC / TPCCEda.cxx
index cd1f38b401bf3c1cffb70ac462b786d89a341c74..f805f62e06d75df9b31342218ff0beae4e318928 100644 (file)
@@ -60,7 +60,6 @@ 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"
@@ -79,7 +78,7 @@ and save results in a file (named from RESULT_FILE define - see below).
 
 
 //functios, implementation below
-void SendToAmoreDB(AliTPCCalibCE &calibCE, unsigned long32 runNb);
+void SendToAmoreDB(AliTPCCalibCE *calibCE, unsigned long32 runNb);
 //for threaded processing
 
 
@@ -95,7 +94,6 @@ int main(int argc, char **argv) {
     return -1;
   }
   
-  AliLog::SetClassDebugLevel("AliTPCRawStream",-5);
   AliLog::SetClassDebugLevel("AliRawReaderDate",-5);
   AliLog::SetClassDebugLevel("AliTPCAltroMapping",-5);
   AliLog::SetModuleDebugLevel("RAW",-5);
@@ -137,6 +135,8 @@ int main(int argc, char **argv) {
   TString laserTriggerName("C0LSR-ABCE-NOPF-CENT");
   TString monitoringType("YES");
   Int_t   forceTriggerId=-1;
+  Int_t   saveOption=2; // how to store the object. See AliTPCCalibCE::DumpToFile
+  Bool_t  skipAmore=kFALSE;
   
   if ( config.GetConfigurationMap()->GetValue("LaserTriggerName") ) {
     laserTriggerName=config.GetConfigurationMap()->GetValue("LaserTriggerName")->GetName();
@@ -153,6 +153,15 @@ int main(int argc, char **argv) {
     printf("TPCCEda: Only processing triggers with Id: %d.\n",forceTriggerId);
   }
   
+  if ( config.GetConfigurationMap()->GetValue("SaveOption") ) {
+    saveOption=TMath::Nint(config.GetValue("SaveOption"));
+    printf("TPCCEda: Saving option set to: %d.\n",saveOption);
+  }
+
+  if ( config.GetConfigurationMap()->GetValue("SkipAmore") ) {
+    skipAmore=((TObjString*)config.GetConfigurationMap()->GetValue("SkipAmore"))->GetString().Atoi();
+    printf("TPCCEda: Skip Amore set in config\n");
+  }
   
   //subsribe to laser triggers only in physics partition
   //if the trigger class is not available the return value is -1
@@ -217,8 +226,8 @@ int main(int argc, char **argv) {
   
     
   //create calibration object
-  AliTPCCalibCE calibCE(config.GetConfigurationMap());   // central electrode calibration
-  calibCE.SetAltroMapping(mapping->GetAltroMapping()); // Use altro mapping we got from daqDetDb
+  AliTPCCalibCE *calibCE=new AliTPCCalibCE(config.GetConfigurationMap());   // central electrode calibration
+  calibCE->SetAltroMapping(mapping->GetAltroMapping()); // Use altro mapping we got from daqDetDb
 
   //amore update interval
   Double_t updateInterval=300; //seconds
@@ -243,7 +252,7 @@ int main(int argc, char **argv) {
       return -1;
     }
 
-    
+    Bool_t hasNewData=kFALSE;
     /* read until EOF */
     while (true) {
       struct eventHeaderStruct *event;
@@ -267,19 +276,19 @@ int main(int argc, char **argv) {
       if (event==NULL){
         //use time in between bursts to
         // send the data to AMOREdb
-        if (stopWatch.RealTime()>updateInterval){
-          calibCE.Analyse();
-          SendToAmoreDB(calibCE,runNb);
+        if (stopWatch.RealTime()>updateInterval && hasNewData){
+          calibCE->Analyse();
+          if (!skipAmore) SendToAmoreDB(calibCE,runNb);
           stopWatch.Start();
         } else {
           stopWatch.Continue();
         }
         //debug output
         if (nevents>neventsOld){
-          printf ("TPCCEda: %d events processed, %d used\n",nevents,calibCE.GetNeventsProcessed());
+          printf ("TPCCEda: %d events processed, %d used\n",nevents,calibCE->GetNeventsProcessed());
           neventsOld=nevents;
         }
-        
+        hasNewData=kFALSE;
         continue;
       }
       
@@ -294,7 +303,8 @@ int main(int argc, char **argv) {
       runNb = event->eventRunNb;
       
       // CE calibration
-      calibCE.ProcessEvent(event);
+      calibCE->ProcessEvent(event);
+      hasNewData=kTRUE;
       
       /* free resources */
       free(event);
@@ -305,28 +315,30 @@ int main(int argc, char **argv) {
   //
   // Analyse CE data and write them to rootfile
   //
-  calibCE.Analyse();
-  printf ("TPCCEda: %d events processed, %d used\n",nevents,calibCE.GetNeventsProcessed());
-  
-  TFile * fileTPC = new TFile (RESULT_FILE,"recreate");
-  calibCE.Write("tpcCalibCE");
-  delete fileTPC;
+  printf ("TPCCEda: %d events processed, %d used\n",nevents,calibCE->GetNeventsProcessed());
+
+  //save data to file
+  calibCE->DumpToFile(RESULT_FILE,Form("name=tpcCalibCE,type=%d",saveOption));
   printf("TPCCEda: Wrote %s\n",RESULT_FILE);
   
   /* store the result file on FES */
-  
   status=daqDA_FES_storeFile(RESULT_FILE,FILE_ID);
   if (status) {
     status = -2;
   }
+
+  if (!skipAmore){
+    printf("TPCCEda: Amore part\n");
+    calibCE->Analyse();
+    SendToAmoreDB(calibCE,runNb);
+  }
   
-  SendToAmoreDB(calibCE,runNb);
-  
+  delete calibCE;
   return status;
 }
 
 
-void SendToAmoreDB(AliTPCCalibCE &calibCE, unsigned long32 runNb)
+void SendToAmoreDB(AliTPCCalibCE *calibCE, unsigned long32 runNb)
 {
   //AMORE
 //   printf ("AMORE part\n");
@@ -341,15 +353,15 @@ void SendToAmoreDB(AliTPCCalibCE &calibCE, unsigned long32 runNb)
   gSystem->Setenv("AMORE_DA_NAME",Form("TPC-%s",FILE_ID));
   //
   // end cheet
-  TGraph *grA=calibCE.MakeGraphTimeCE(-1,0,2);
-  TGraph *grC=calibCE.MakeGraphTimeCE(-2,0,2);
+  TGraph *grA=calibCE->MakeGraphTimeCE(-1,0,2);
+  TGraph *grC=calibCE->MakeGraphTimeCE(-2,0,2);
   TDatime time;
   TObjString info(Form("Run: %u; Date: %s",runNb,time.AsSQLString()));
   amore::da::AmoreDA amoreDA(amore::da::AmoreDA::kSender);
   Int_t statusDA=0;
-  statusDA+=amoreDA.Send("CET0",calibCE.GetCalPadT0());
-  statusDA+=amoreDA.Send("CEQ",calibCE.GetCalPadQ());
-  statusDA+=amoreDA.Send("CERMS",calibCE.GetCalPadRMS());
+  statusDA+=amoreDA.Send("CET0",calibCE->GetCalPadT0());
+  statusDA+=amoreDA.Send("CEQ",calibCE->GetCalPadQ());
+  statusDA+=amoreDA.Send("CERMS",calibCE->GetCalPadRMS());
   statusDA+=amoreDA.Send("DriftA",grA);
   statusDA+=amoreDA.Send("DriftC",grC);
   statusDA+=amoreDA.Send("Info",&info);