]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONPedestalEventGenerator.cxx
o add Reset function to CalPad and CalROC o Add functionality to AliTPCdataQA - Reset...
[u/mrichter/AliRoot.git] / MUON / AliMUONPedestalEventGenerator.cxx
index 6ee2958cecf146d1eebee87a54bf3e5e65719cfb..3d4b80b759f8eb896f3a4b82f9da7a9dfa8c0fbc 100644 (file)
@@ -33,6 +33,7 @@
 #include "AliMpDetElement.h"
 #include "AliMpPlaneType.h"
 #include "AliRawDataHeaderSim.h"
+#include "AliLoader.h"
 #include "AliRunLoader.h"
 #include <TClonesArray.h>
 #include <TMath.h>
@@ -40,6 +41,9 @@
 #include <TRandom.h>
 #include <TStopwatch.h>
 #include <TSystem.h>
+#include <TTree.h>
+
+#include <cstdio>
 
 //-----------------------------------------------------------------------------
 /// \class AliMUONPedestalEventGenerator
@@ -102,15 +106,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");
 
@@ -174,7 +177,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 +194,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 +223,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);
   }
   
@@ -333,7 +336,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)) 
   {