]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONPedestalEventGenerator.cxx
(hopefully) Last tweaks to have the embedding straight : the charge of sdigits is...
[u/mrichter/AliRoot.git] / MUON / AliMUONPedestalEventGenerator.cxx
index d6c7958b1dcf48ba1e05e229f127749f4459b486..4aba434bf400614dd4163082bc19f2daa1c6b789 100644 (file)
@@ -41,6 +41,8 @@
 #include <TStopwatch.h>
 #include <TSystem.h>
 
+#include <cstdio>
+
 //-----------------------------------------------------------------------------
 /// \class AliMUONPedestalEventGenerator
 ///
@@ -102,15 +104,14 @@ fRawWriter(0x0)
   }
   
   AliRunLoader* runLoader = LoadRun("recreate");
-  
-  runLoader->SetNumberOfEventsPerFile(nevents);
-  
   if (!runLoader)
   {
     AliError("Could not create RunLoader");
     return;
   }
   
+  runLoader->SetNumberOfEventsPerFile(nevents);
+  
   // Initialize event headers.
   runLoader->MakeTree("E");
 
@@ -146,7 +147,7 @@ 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");
   
@@ -174,7 +175,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 -c -D -o %s.LDC%d -# %d -C", 
+    snprintf(command, 256, "dateStream -c -D -o %s.LDC%d -# %d -C", 
             fDateFileName.Data(), iFile, runLoader->GetNumberOfEvents());
     pipe[iFile] = gSystem->OpenPipe(command, "w");
   }
@@ -191,7 +192,7 @@ AliMUONPedestalEventGenerator::ConvertRawFilesToDate()
       ldc += AliDAQ::NumberOfLdcs(kIDet) / AliDAQ::NumberOfDdls(kIDet);
       
       char rawFileName[256];
-      sprintf(rawFileName, "raw%d/%s", 
+      snprintf(rawFileName, 256, "raw%d/%s", 
               iEvent, AliDAQ::DdlFileName(kIDet,iDDL));
       
       // check existence and size of raw data file
@@ -220,7 +221,7 @@ AliMUONPedestalEventGenerator::ConvertRawFilesToDate()
   for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); ++iEvent) 
   {
     char command[256];
-    sprintf(command, "rm -r raw%d", iEvent);
+    snprintf(command, 256, "rm -r raw%d", iEvent);
     gSystem->Exec(command);
   }
   
@@ -246,7 +247,7 @@ AliMUONPedestalEventGenerator::Exec(Option_t*)
 {  
   /// Main steering method
   
-  AliCodeTimerAuto("",)
+  AliCodeTimerAuto("",0)
   
   if (!fPedestals)
   {
@@ -290,7 +291,7 @@ AliMUONPedestalEventGenerator::Exec(Option_t*)
     
     if ( fMakeDDL )
     {
-      AliCodeTimerAuto("Digits2Raw",0);
+      AliCodeTimerAuto("Digits2Raw",1);
       Digits2Raw(i);
     }
   }
@@ -306,7 +307,7 @@ AliMUONPedestalEventGenerator::Exec(Option_t*)
     Bool_t dateOutput = ConvertRawFilesToDate();
     if (!dateOutput) 
     {
-      AliError("DATE output failed. Aborting.");
+      AliError("DATE output failed. Exiting.");
       return;
     }    
   }
@@ -318,7 +319,7 @@ AliMUONPedestalEventGenerator::Digits2Raw(Int_t event)
 {
   /// Converts digits (from MUON.Digits.root file) to Raw DDL ascii files.
   
-  AliCodeTimerAuto("",)
+  AliCodeTimerAuto("",0)
   
   if (!fRawWriter) 
   {
@@ -333,7 +334,7 @@ AliMUONPedestalEventGenerator::Digits2Raw(Int_t event)
   TString baseDir = gSystem->WorkingDirectory();
   
   char dirName[256];
-  sprintf(dirName, "raw%d", event);
+  snprintf(dirName, 256, "raw%d", event);
   gSystem->MakeDirectory(dirName);
   if (!gSystem->ChangeDirectory(dirName)) 
   {
@@ -353,7 +354,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();
   
@@ -450,6 +451,7 @@ AliMUONPedestalEventGenerator::LoadRun(const char* mode)
   if (!runLoader) 
   {
     AliError("No run loader found in file galice.root");
+    return 0x0;
   }
     
   TString smode(mode);