]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Including the run number in the CDH header plus protection against empty events.
authorsrossegg <srossegg@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 15 Nov 2010 16:25:02 +0000 (16:25 +0000)
committersrossegg <srossegg@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 15 Nov 2010 16:25:02 +0000 (16:25 +0000)
This is necessary to run the "normal" reconstruction on the "altered" raw data.

TPC/AliTPCAltroEmulator.cxx
TPC/AliTPCAltroEmulator.h

index 1ca9411f40b15366158bc6425cb71f27174f4c44..0b65e52ae00177c0fd96dcec66b545bc788cf884 100644 (file)
@@ -17,6 +17,7 @@
  *     \verbinclude Altro/Altro.C.log
  *
  */
+
 /////////////////////////////////////////////////////////////////////////////////////////////////////
 //     Class for emulation of the ALTRO chip (Altro digital Chain) in C++                          //
 //     Author: Roland Bramm                                                                        //
@@ -105,6 +106,7 @@ AliTPCAltroEmulator::AliTPCAltroEmulator(Int_t timebins, short* Channel) :
   
   fReader(0),           // for Altro Emulation on Raw Reader
   fDecoder(0),
+  fRunNumber(0), 
   fDDLFolderName("/tmp/"),
   fOutputDateFileName("/tmp/tmp.date"),
   fOutputRootFileName("/tmp/tmp.root"),
@@ -1129,11 +1131,14 @@ Bool_t AliTPCAltroEmulator::ConvertRawFilesToDate(Int_t nevents) {
   
   char command[100];
   FILE *pipe;
-  if (fReader->GetRunNumber()>0)
+
+  printf(" RAW to DATE CONVERSION: Run Number %d\n",fRunNumber);
+
+  if (fRunNumber>0)
     pipe=gSystem->OpenPipe(Form("dateStream -c -s -D -o %s -C -# %d -run %d", 
                                fOutputDateFileName.Data(),
                                nevents,
-                               fReader->GetRunNumber()),
+                               fRunNumber),
                           "w");
   else
     pipe=gSystem->OpenPipe(Form("dateStream -c -s -D -o %s -C -# %d", 
@@ -1144,7 +1149,7 @@ Bool_t AliTPCAltroEmulator::ConvertRawFilesToDate(Int_t nevents) {
     fprintf(stderr,"error: cannot execute command: %s",command);
     return kFALSE;
   }
-  
+
   for (Int_t ievent=0;ievent<nevents;++ievent) {
     UInt_t detectorPattern = 0xFFFFFFFF;
     fprintf(pipe, "GDC DetectorPattern %u\n", detectorPattern);
@@ -1214,6 +1219,8 @@ Bool_t AliTPCAltroEmulator::ConvertDateToRoot() {
 
   // from $ALICE_ROOT/STEER/AliSimulation.cxx
 
+  printf(" DATE to ROOT CONVERSION: Run Number %d\n",fRunNumber);
+
   // ALIMDC setup
   const Int_t kDBSize    = 2000000000; //2GB
   const Int_t kTagDBSize = 1000000000;
@@ -1285,6 +1292,7 @@ void AliTPCAltroEmulator::RunEmulationOnRAWdata(AliRawReader *reader, Int_t plot
   Int_t ievent=0;
   while (fReader->NextEvent()) {
     
+    if (fReader->GetRunNumber()>0) fRunNumber=fReader->GetRunNumber();
     gSystem->Exec(Form("mkdir -p %s/raw%d/",fDDLFolderName.Data(),ievent));
     GDC2DDLs(const_cast<AliRawVEvent*>(fReader->GetEvent()),ievent);
     
@@ -1293,10 +1301,10 @@ void AliTPCAltroEmulator::RunEmulationOnRAWdata(AliRawReader *reader, Int_t plot
       Int_t ddlID=fDecoder->GetDDLNumber();
       printf("ddl: %d (%d/216)\n",ddlID,++ddlC);
      
-      Bool_t  *channelsDDL=fChannels+ddlID*4096     ;
-      Short_t *adcsDDL    =fADCs    +ddlID*4096*1024;
-      UInt_t  *cdhDDL     =fCDHs    +ddlID*8        ;
-      UInt_t  *trailerDDL =fTrailers+ddlID*9        ;
+      Bool_t  *channelsDDL=fChannels+ddlID*4096      ;
+      Short_t *adcsDDL    =fADCs    +ddlID*4096*1024 ;
+      UInt_t  *cdhDDL     =fCDHs    +ddlID*8         ;
+      UInt_t  *trailerDDL =fTrailers+ddlID*9         ;
       
       // CDH 
       for (Int_t i=0;i<8;++i)
@@ -1335,7 +1343,6 @@ void AliTPCAltroEmulator::RunEmulationOnRAWdata(AliRawReader *reader, Int_t plot
        // search end of aquisition
        Int_t tE = 1024; while (adcsChannel[tE]==-1) tE--;
        
-       // SR TEST:
        // channel is complete - Perform Altro Emulation
        if (plotFlag!=0 && !(chanCount%plotFlag) ) {
          for (Int_t t=0; t<1024; t++) {
@@ -1357,7 +1364,6 @@ void AliTPCAltroEmulator::RunEmulationOnRAWdata(AliRawReader *reader, Int_t plot
        for (Int_t t=t0;t<(t0+timebins);t++) 
          adcsChannel[t]=data[t-t0];
          
-       // SR TEST:
        if (plotFlag!=0 && !(chanCount%plotFlag) ) {
          for (Int_t t=0; t<1024; t++)
            hisO.SetBinContent(t+1,adcsChannel[t]);
@@ -1383,7 +1389,7 @@ void AliTPCAltroEmulator::RunEmulationOnRAWdata(AliRawReader *reader, Int_t plot
       
     }
             
-    WriteEvent(ievent++);
+    if (ddlC>0) WriteEvent(ievent++);
   }
 
   delete[] data; // free space
index 82d60a008f5c623216f30a6983af3c4e710907a7..49e7cf4afc398f6aa8b51bd954540b2b121f9fc1 100644 (file)
@@ -177,6 +177,8 @@ class AliTPCAltroEmulator : public TNamed {
   AliRawReader      *fReader ; // RAW reader
   AliTPCRawStreamV3 *fDecoder; // ALTRO decoder
 
+  Int_t fRunNumber;            // Run Number
+
   TString fDDLFolderName;      // folder name for ddl files
   TString fOutputDateFileName; // filename for date output
   TString fOutputRootFileName; // filename for root output