]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONPedestalEventGenerator.cxx
Fixing OVERRUN_STATIC defect reported by Coverity
[u/mrichter/AliRoot.git] / MUON / AliMUONPedestalEventGenerator.cxx
index f05cc2051aba12a50ae08d4988de59d0fcace149..f7365f9663a47fff5b17c8210f94d3ea526496c9 100644 (file)
 
 #include "AliMUONPedestalEventGenerator.h"
 
+#include "AliCodeTimer.h"
+#include "AliDAQ.h"
 #include "AliHeader.h"
 #include "AliLog.h"
 #include "AliMUONCalibrationData.h"
-#include "AliMUONVDigitStore.h"
 #include "AliMUONRawWriter.h"
-#include "AliCodeTimer.h"
 #include "AliMUONVCalibParam.h"
 #include "AliMUONVDigit.h"
+#include "AliMUONVDigitStore.h"
 #include "AliMUONVStore.h"
 #include "AliMpCathodType.h"
 #include "AliMpConstants.h"
 #include "AliMpDEStore.h"
 #include "AliMpDetElement.h"
-#include "AliMpIntPair.h"
 #include "AliMpPlaneType.h"
+#include "AliRawDataHeaderSim.h"
 #include "AliRunLoader.h"
 #include <TClonesArray.h>
 #include <TMath.h>
@@ -39,9 +40,8 @@
 #include <TRandom.h>
 #include <TStopwatch.h>
 #include <TSystem.h>
-#include "AliDAQ.h"
 
-///
+//-----------------------------------------------------------------------------
 /// \class AliMUONPedestalEventGenerator
 ///
 /// Generate simulated pedestal events for MUON TRK, to be able to e.g. test
@@ -56,7 +56,7 @@
 /// + raw (date files, one per LDC), depending of ctor and MakeDDL() method.
 ///
 /// \author L. Aphecetche
-///
+//-----------------------------------------------------------------------------
 
 /// \cond CLASSIMP
 ClassImp(AliMUONPedestalEventGenerator)
@@ -146,13 +146,13 @@ AliMUONPedestalEventGenerator::ConvertRawFilesToDate()
   /// convert raw data DDL files to DATE files with the program "dateStream".
   /// we make one file per LDC
   
-  AliCodeTimerAuto("")
+  AliCodeTimerAuto("",0)
   
   AliInfo("Converting raw to date");
   
   const Int_t kIDet = AliDAQ::DetectorID("MUONTRK");
   
-  const Int_t kNLDCs = TMath::CeilNint(AliDAQ::NumberOfLdcs(kIDet));
+  const Int_t kNLDCs = 5;//TMath::CeilNint(AliDAQ::NumberOfLdcs(kIDet));
   
   char* path = gSystem->Which(gSystem->Getenv("PATH"), "dateStream");
   if (!path) 
@@ -174,7 +174,7 @@ AliMUONPedestalEventGenerator::ConvertRawFilesToDate()
     char command[256];
     // Note the option -s. It is used in order to avoid
     // the generation of SOR/EOR events.
-    sprintf(command, "dateStream -s -D -o %s.LDC%d -# %d -C", 
+    sprintf(command, "dateStream -c -D -o %s.LDC%d -# %d -C", 
             fDateFileName.Data(), iFile, runLoader->GetNumberOfEvents());
     pipe[iFile] = gSystem->OpenPipe(command, "w");
   }
@@ -246,7 +246,7 @@ AliMUONPedestalEventGenerator::Exec(Option_t*)
 {  
   /// Main steering method
   
-  AliCodeTimerAuto("")
+  AliCodeTimerAuto("",0)
   
   if (!fPedestals)
   {
@@ -290,7 +290,7 @@ AliMUONPedestalEventGenerator::Exec(Option_t*)
     
     if ( fMakeDDL )
     {
-      AliCodeTimerAuto("Digits2Raw");
+      AliCodeTimerAuto("Digits2Raw",1);
       Digits2Raw(i);
     }
   }
@@ -302,11 +302,11 @@ AliMUONPedestalEventGenerator::Exec(Option_t*)
   // Finally, if instructed to do so, convert DDL files to DATE file(s)
   if ( fMakeDDL && fDateFileName.Length() > 0 ) 
   {
-    AliCodeTimerAuto("ConvertRawFilesToDate")
+    AliCodeTimerAuto("ConvertRawFilesToDate",1)
     Bool_t dateOutput = ConvertRawFilesToDate();
     if (!dateOutput) 
     {
-      AliError("DATE output failed. Aborting.");
+      AliError("DATE output failed. Exiting.");
       return;
     }    
   }
@@ -318,9 +318,14 @@ AliMUONPedestalEventGenerator::Digits2Raw(Int_t event)
 {
   /// Converts digits (from MUON.Digits.root file) to Raw DDL ascii files.
   
-  AliCodeTimerAuto("")
+  AliCodeTimerAuto("",0)
   
-  if (!fRawWriter) fRawWriter = new AliMUONRawWriter;
+  if (!fRawWriter) 
+  {
+      AliRawDataHeaderSim header;
+      fRawWriter = new AliMUONRawWriter;
+      fRawWriter->SetHeader(header);
+  }
   
   // Generate RAW data from the digits
   // Be carefull to create&change to the correct directory first...
@@ -348,7 +353,7 @@ AliMUONPedestalEventGenerator::GenerateDigits(AliMUONVDigitStore& digitStore)
   /// Generate digits (where ADC is set to pedestal value) for all MUON TRK
   /// and for 1 event.
   
-  AliCodeTimerAuto("")
+  AliCodeTimerAuto("",0)
 
   digitStore.Clear();
   
@@ -379,7 +384,7 @@ AliMUONPedestalEventGenerator::GenerateDigits(AliMUONVDigitStore& digitStore)
       {
         // This is a poor's man way of knowing if that channel really exists.
         // Better and safer way (but much slower too) would be to check pad existence
-        // using AliMpVSegmentation::PadByLocation(AliMpIntPair(manuId,manuChannel))
+        // using AliMpVSegmentation::PadByLocation(manuId,manuChannel)
         continue;
       }
       else if ( mean < 1 || mean >  4095 ) 
@@ -430,10 +435,10 @@ AliRunLoader*
 AliMUONPedestalEventGenerator::LoadRun(const char* mode)
 {
   /// Get access to AliRunLoader object
-  while (AliRunLoader::GetRunLoader()) 
+  while (AliRunLoader::Instance()) 
   {
-    AliDebug(1,Form("Deleting AliRunLoader %p",AliRunLoader::GetRunLoader()));
-    delete AliRunLoader::GetRunLoader();
+    AliDebug(1,Form("Deleting AliRunLoader %p",AliRunLoader::Instance()));
+    delete AliRunLoader::Instance();
   }
   
   AliRunLoader* runLoader =