]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/TRDVDRIFTda.cxx
New reader for the pedestal run and vdrift (Julian) and some bug fixing (Raphaelle)
[u/mrichter/AliRoot.git] / TRD / TRDVDRIFTda.cxx
index 818826323ca5741a3b98e6aac1afedc05bb3ccb1..b7dd72641c37748486fd51bb0ddd00f57b4d3ff9 100644 (file)
@@ -42,15 +42,21 @@ extern "C" {
 //
 #include "AliRawReader.h"
 #include "AliRawReaderDate.h"
-#include "AliTRDrawStreamTB.h"
+#include "AliTRDrawStream.h"
+#include "AliTRDrawStreamBase.h"
 
+//
+//AMORE
+//
+#include <AmoreDA.h>
 
 //
 // TRD calibration algorithm includes
 //
 #include "AliTRDCalibraFillHisto.h"
 
-
+//functions, implementation below
+//void SendToAmoreDB(TObject *o, unsigned long32 runNb);
 
 
 /* Main routine
@@ -101,29 +107,33 @@ int main(int argc, char **argv) {
   /* init some counters */
   int nevents_physics=0;
   int nevents_total=0;
+  //unsigned long32 runNb=0;      //run number
 
-  //Instance of AliCDBManager: needed by AliTRDRawStreamV2
+  //Instance of AliCDBManager: needed by AliTRDrawStream
   //AliCDBManager *man = AliCDBManager::Instance();
-  //man->SetDefaultStorage("local://$ALICE_ROOT");
+  //man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
   //man->SetRun(0);
   //Instance of AliTRDCalibraFillHisto
   AliTRDCalibraFillHisto *calibra      = AliTRDCalibraFillHisto::Instance();
+  calibra->SetNumberClustersProcent(0.9);
+
   // everythings are okey for vdrift
   Bool_t passvdrift  = kTRUE;    // if timebin okey
   Int_t  nbvdrift    = 0;     // number of events with entries for vdrift
 
    // setting
-  // AliTRDrawStreamTB::SetNoDebug();
-  AliTRDrawStreamTB::SetNoErrorWarning();
-  //AliTRDrawStreamTB::SetForceCleanDataOnly();
-  AliTRDrawStreamTB::AllowCorruptedData();
-  AliTRDrawStreamTB::DisableStackNumberChecker();
-  AliTRDrawStreamTB::DisableStackLinkNumberChecker();
-  //AliTRDrawStreamTB::SetSkipCDH();
-  //AliTRDrawStreamTB::SetExtraWordsFix();
-  //AliTRDrawStreamTB::EnableDebugStream();
-  //AliTRDrawStreamTB::SetDumpHead(320);
-  //AliTRDrawStreamTB::SetDumpHead(80);
+  // AliTRDrawStream::SetNoDebug();
+  AliTRDrawStream::DisableSkipData();
+  AliTRDrawStream::SetNoErrorWarning();
+  //AliTRDrawStream::SetForceCleanDataOnly();
+  //AliTRDrawStream::AllowCorruptedData();
+  //AliTRDrawStream::DisableStackNumberChecker();
+  //AliTRDrawStream::DisableStackLinkNumberChecker();
+  //AliTRDrawStream::SetSkipCDH();
+  //AliTRDrawStream::SetExtraWordsFix();
+  //AliTRDrawStream::EnableDebugStream();
+  //AliTRDrawStream::SetDumpHead(320);
+  //AliTRDrawStream::SetDumpHead(80);
 
   
   /* main loop (infinite) */
@@ -155,6 +165,7 @@ int main(int argc, char **argv) {
     if( ((Int_t)nevents_total)%1000 == 0 ) printf(" event number %d (physic event number %d) will be processed\n",(Int_t) nevents_total,(Int_t) nevents_physics);  
 
 
+
     /* use event - here, just write event id to result file */
     eventT=event->eventType;
     
@@ -164,15 +175,19 @@ int main(int argc, char **argv) {
     if ((eventT==PHYSICS_EVENT) && (passvdrift)) {
       //if (eventT==PHYSICS_EVENT) {
       AliRawReader *rawReader = new AliRawReaderDate((void*)event);
-      AliTRDrawStreamTB *trdRawStream = new AliTRDrawStreamTB((AliRawReader *) rawReader);
-      Int_t result = calibra->ProcessEventDAQ(trdRawStream,(Bool_t)nevents_physics);
+      rawReader->Select("TRD");
+
+      Int_t result = calibra->ProcessEventDAQ2((AliTRDrawReader *) rawReader);
       if(!result) passvdrift = kFALSE;
       else nbvdrift += (Int_t) result/2;
              
-      
-      delete trdRawStream;
+
       delete rawReader;
+    
     } 
+
+    // get the run number
+    //runNb = event->eventRunNb;
    
     if(eventT==PHYSICS_EVENT){
  
@@ -180,6 +195,13 @@ int main(int argc, char **argv) {
      
     }
     
+    /*
+      if( ((Int_t)nevents_physics)%100 == 0 ) {
+      SendToAmoreDB(&calibra);
+      }
+    */
+
+    
     nevents_total++;
 
 
@@ -217,4 +239,24 @@ int main(int argc, char **argv) {
   delete fileTRD;  
 
   return status;
+
+  /*
+    void SendToAmoreDB(TObject *o)
+    {
+    //AMORE
+    const char *amoreDANameorig=gSystem->Getenv("AMORE_DA_NAME");
+    gSystem->Setenv("AMORE_DA_NAME","TRD-dataQA");
+    
+    amore::da::AmoreDA amoreDA(amore::da::AmoreDA::kSender);
+    Int_t statusDA=0;
+    statusDA+=amoreDA.Send("DataQA-VDRIFT",o);
+    if ( statusDA!=0 )
+    printf("Waring: Failed to write one of the calib objects to the AMORE database\n");
+    // reset env var
+    if (amoreDANameorig) gSystem->Setenv("AMORE_DA_NAME",amoreDANameorig);
+    } 
+  */
+
 }
+
+