]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/TRDPEDESTALda.cxx
Coding rules
[u/mrichter/AliRoot.git] / TRD / TRDPEDESTALda.cxx
index 5604520005fdb94c12e44a452adb36c92395a599..50967eed9fb674b91356a09f0ef89b252c1c72ca 100644 (file)
@@ -8,11 +8,12 @@ DA Type: LDC
 Number of events needed: 100
 Input Files: TRD raw files
 Output Files: trdCalibration.root
-Trigger types used:
+Trigger types used: PHYSICS_EVENT
 
 */
 
-#define RESULT_FILE "trdCalibration.root"
+#define RESULT_FILE  "trdPedestal.root"
+#define FILE_ID "PADSTATUS"
 
 extern "C" {
 #include <daqDA.h>
@@ -35,7 +36,7 @@ extern "C" {
 //
 #include "AliRawReader.h"
 #include "AliRawReaderDate.h"
-#include "AliTRDrawStreamTB.h"
+#include "AliTRDrawStream.h"
 #include "AliTRDrawStreamBase.h"
 #include "AliCDBManager.h"
 //
@@ -85,22 +86,24 @@ int main(int argc, char **argv) {
  
   //Instance of AliCDBManager: needed by AliTRDRawStream
   //AliCDBManager *man = AliCDBManager::Instance();
-  //man->SetDefaultStorage("local://$ALICE_ROOT");
+  //man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
   //man->SetRun(0);
   // AliTRDCalibPadStatus object
   AliTRDCalibPadStatus calipad = AliTRDCalibPadStatus();
   Bool_t passpadstatus = kTRUE;
 
   // setting
-  // AliTRDrawStreamTB::SetNoDebug();
-  AliTRDrawStreamTB::SetNoErrorWarning();
-  AliTRDrawStreamTB::SetForceCleanDataOnly();
-  AliTRDrawStreamTB::AllowCorruptedData();
-  //AliTRDrawStreamTB::SetSkipCDH();
-  //AliTRDrawStreamTB::SetExtraWordsFix();
-  //AliTRDrawStreamTB::EnableDebugStream();
-  //AliTRDrawStreamTB::SetDumpHead(320);
-  //AliTRDrawStreamTB::SetDumpHead(80);
+  // AliTRDrawStream::SetNoDebug();
+  AliTRDrawStream::SetNoErrorWarning();
+  //AliTRDrawStream::SetForceCleanDataOnly();
+  AliTRDrawStream::AllowCorruptedData();
+  AliTRDrawStream::DisableStackNumberChecker();
+  AliTRDrawStream::DisableStackLinkNumberChecker();
+  //AliTRDrawStream::SetSkipCDH();
+  //AliTRDrawStream::SetExtraWordsFix();
+  //AliTRDrawStream::EnableDebugStream();
+  //AliTRDrawStream::SetDumpHead(320);
+  //AliTRDrawStream::SetDumpHead(80);
 
   /* read the data files */
   int n;
@@ -117,6 +120,7 @@ int main(int argc, char **argv) {
     /* read the file  until EOF */
     for(;;) {
       struct eventHeaderStruct *event;
+      eventTypeType eventT;
       
       /* get next event */
       status=monitorGetEventDynamic((void **)&event);
@@ -134,17 +138,21 @@ int main(int argc, char **argv) {
         break;
       }
 
-      if(passpadstatus){
+      /* use event - here, just write event id to result file */
+      eventT=event->eventType;
+
+      if((eventT==PHYSICS_EVENT) && (passpadstatus)){
 
        AliRawReader *rawReader = new AliRawReaderDate((void*)event);
        rawReader->Select("TRD");
-       AliTRDrawStreamTB *trdRawStream = new AliTRDrawStreamTB((AliRawReader *)rawReader);
-       //trdRawStream->Init();
-       if(!calipad.ProcessEvent((AliTRDrawStreamBase *)trdRawStream,(Bool_t)nevents_total)) passpadstatus = kFALSE;
-       nevents++;
+       AliTRDrawStream *trdRawStream = new AliTRDrawStream((AliRawReader *)rawReader);
+       Int_t result = calipad.ProcessEvent((AliTRDrawStreamBase *)trdRawStream,0);
+       // 0 error, 1 no input, 2 output
+       if(result == 2) nevents++;
+       if(result == 0) passpadstatus = kFALSE;
        delete trdRawStream;
        delete rawReader;
-     
+      
       }
 
       nevents_total++;
@@ -160,12 +168,13 @@ int main(int argc, char **argv) {
 
   /* write file in any case to see what happens in case of problems*/
   TFile *fileTRD = new TFile(RESULT_FILE,"recreate");
+  if(nevents < 30) calipad.Destroy();
   calipad.AnalyseHisto();
   calipad.Write("calibpadstatus");
   fileTRD->Close();   
      
   /* store the result file on FES */
-  status=daqDA_FES_storeFile(RESULT_FILE,RESULT_FILE);
+  status=daqDA_FES_storeFile(RESULT_FILE,FILE_ID);
   if (status) {
     printf("Failed to export file : %d\n",status);
     return -1;