]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/TRDVDRIFTda.cxx
Some hick-up with common blocks solved.
[u/mrichter/AliRoot.git] / TRD / TRDVDRIFTda.cxx
index 985ad0f8f298773beaf6eed94e3ed63640b2ef1f..7c3c6257cfbf3ae49ac90df1115f483f9d44999d 100644 (file)
@@ -1,27 +1,19 @@
 /*
 
-
-TRDda.cxx - calibration algorithm to be run on monitoring server
-DAcase2.c
-
-AliTRDCalibraFillHisto - average pulse height/ vdrift calibration
-AliTRDCalibPadStatus - pad status calibration
-
-
-This program connects to the DAQ data source passed as argument
-and populates local "./result.txt" file with the ids of events received
-during the run.
-
-The program exits when being asked to shut down (daqDA_checkshutdown)
-or End of Run event.
-
-Messages on stdout are exported to DAQ log system.
-
-contact: alice-datesupport@cern.ch
+Contact: r.bailhache@gsi.de
+Link:
+Reference run: 25909
+Run Type: PHYSICS STANDALONE
+DA Type: MON
+Number of events needed: many
+Input Files:  TRD raw files
+Output Files: trdCalibrationv.root
+Trigger types used: PHYSICS_EVENT
 
 */
 
-#define RESULT_FILE "trdCalibrationv.root"
+#define RESULT_FILE  "trdVdrift.root"
+#define FILE_ID "VDRIFT"
 
 
 extern "C" {
@@ -40,17 +32,19 @@ extern "C" {
 #include <TObjArray.h>
 #include <TString.h>
 #include <TVectorF.h>
-#include <TROOT.h>
 #include <TDirectory.h>
 #include <TSystem.h>
 #include <TFile.h>
+#include "TROOT.h"
+#include "TPluginManager.h"
 //
 //AliRoot includes
 //
 #include "AliRawReader.h"
 #include "AliRawReaderDate.h"
-#include "AliTRDRawStream.h"
-#include "AliCDBManager.h"
+#include "AliTRDrawStream.h"
+#include "AliTRDrawStreamBase.h"
+
 
 //
 // TRD calibration algorithm includes
@@ -66,6 +60,12 @@ extern "C" {
 */
 int main(int argc, char **argv) {
 
+  /* magic line from Rene */
+  gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
+                                       "*",
+                                       "TStreamerInfo",
+                                       "RIO",
+                                       "TStreamerInfo()");
   int status;
 
   if (argc!=2) {
@@ -100,19 +100,34 @@ int main(int argc, char **argv) {
 
 
   /* init some counters */
-  int nevents_physics=0;
-  int nevents_total=0;
+  int neventsphysics=0;
+  int neventstotal=0;
 
-  //Instance of AliCDBManager: needed by AliTRDRawStream
-  AliCDBManager *man = AliCDBManager::Instance();
-  man->SetDefaultStorage("local://$ALICE_ROOT");
-  man->SetRun(0);
+  //Instance of AliCDBManager: needed by AliTRDrawStream
+  //AliCDBManager *man = AliCDBManager::Instance();
+  //man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+  //man->SetRun(0);
   //Instance of AliTRDCalibraFillHisto
   AliTRDCalibraFillHisto *calibra      = AliTRDCalibraFillHisto::Instance();
   // everythings are okey for vdrift
   Bool_t passvdrift  = kTRUE;    // if timebin okey
   Int_t  nbvdrift    = 0;     // number of events with entries for vdrift
 
+   // setting
+  // AliTRDrawStream::SetNoDebug();
+  AliTRDrawStream::DisableSkipData();
+  AliTRDrawStream::SetNoErrorWarning();
+  //AliTRDrawStream::SetSubtractBaseline(0); 
+  //AliTRDrawStream::SetForceCleanDataOnly();
+  //AliTRDrawStream::AllowCorruptedData();
+  //AliTRDrawStream::DisableStackNumberChecker();
+  //AliTRDrawStream::DisableStackLinkNumberChecker();
+  //AliTRDrawStream::SetSkipCDH();
+  //AliTRDrawStream::SetExtraWordsFix();
+  //AliTRDrawStream::EnableDebugStream();
+  //AliTRDrawStream::SetDumpHead(320);
+  //AliTRDrawStream::SetDumpHead(80);
+
   
   /* main loop (infinite) */
   for(;;) {
@@ -140,7 +155,7 @@ int main(int argc, char **argv) {
       continue;
     }
 
-    if( ((Int_t)nevents_total)%100 == 0 ) printf(" event number %d (physic event number %d) will be processed\n",(Int_t) nevents_total,(Int_t) nevents_physics);  
+    if( ((Int_t)neventstotal)%1000 == 0 ) printf(" event number %d (physic event number %d) will be processed\n",(Int_t) neventstotal,(Int_t) neventsphysics);  
 
 
     /* use event - here, just write event id to result file */
@@ -152,23 +167,24 @@ int main(int argc, char **argv) {
     if ((eventT==PHYSICS_EVENT) && (passvdrift)) {
       //if (eventT==PHYSICS_EVENT) {
       AliRawReader *rawReader = new AliRawReaderDate((void*)event);
-      AliTRDRawStream *trdRawStream = new AliTRDRawStream((AliRawReader *) rawReader);
-      Int_t result = calibra->ProcessEventDAQ(trdRawStream,(Bool_t)nevents_physics);
+      rawReader->Select("TRD");
+      AliTRDrawStream *trdRawStream = new AliTRDrawStream((AliRawReader *) rawReader);
+      Int_t result = calibra->ProcessEventDAQ((AliTRDrawStreamBase *) trdRawStream,(Bool_t)nbvdrift);
       if(!result) passvdrift = kFALSE;
       else nbvdrift += (Int_t) result/2;
              
-      
       delete trdRawStream;
       delete rawReader;
+    
     } 
    
     if(eventT==PHYSICS_EVENT){
  
-      nevents_physics++;
+      neventsphysics++;
      
     }
     
-    nevents_total++;
+    neventstotal++;
 
 
     /* free resources */
@@ -183,7 +199,7 @@ int main(int argc, char **argv) {
 
 
   /* report progress */
-  printf("%d events processed and %d used\n",nevents_total,nbvdrift);
+  printf("%d events processed and %d used\n",neventstotal,nbvdrift);
   
   //
   // Write a local file and put it on the FX 
@@ -200,9 +216,10 @@ int main(int argc, char **argv) {
   fileTRD->Close();
   status=0;
   // Export the file in any case to see if problems
-  if(daqDA_FES_storeFile(RESULT_FILE,RESULT_FILE)) status = -2;
+  if(daqDA_FES_storeFile(RESULT_FILE,FILE_ID)) status = -2;
   
   delete fileTRD;  
 
   return status;
 }
+