]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSDigitizer.cxx
Compilation warnings fixed by T.P.
[u/mrichter/AliRoot.git] / PHOS / AliPHOSDigitizer.cxx
index 3006c1e824344c7065c86fedc4975d5deff61c0c..bb3b29b441f9c49820a15f7027dc906b8277fce3 100644 (file)
 
 /* $Id$ */
 
+/* History of cvs commits:
+ *
+ * $Log$
+ */
 
 //_________________________________________________________________________
 //*-- Author :  Dmitri Peressounko (SUBATECH & Kurchatov Institute) 
@@ -64,7 +68,7 @@
 // --- Standard library ---
 
 // --- AliRoot header files ---
-
+#include "AliLog.h"
 #include "AliRunDigitizer.h"
 #include "AliPHOSDigit.h"
 #include "AliPHOSGetter.h"
@@ -144,8 +148,6 @@ AliPHOSDigitizer::AliPHOSDigitizer(AliRunDigitizer * rd):
   AliPHOSDigitizer::~AliPHOSDigitizer()
 {
   // dtor
-  AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle(),fEventFolderName);
-  gime->PhosLoader()->CleanDigitizer();
   delete [] fInputFileNames ; 
   delete [] fEventNames ; 
  
@@ -162,11 +164,12 @@ void AliPHOSDigitizer::Digitize(Int_t event)
   // This design avoids scanning over the list of digits to add 
   // contribution to new SDigits only.
 
-  AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName) ; 
+  AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle()) ; 
   Int_t ReadEvent = event ; 
   if (fManager) 
     ReadEvent = dynamic_cast<AliStream*>(fManager->GetInputStream(0))->GetCurrentEventNumber() ; 
-  Info("Digitize", "Adding event %d from input stream 0 %s %s", ReadEvent, GetTitle(), fEventFolderName.Data()) ; 
+  AliInfo(Form("Adding event %d from input stream 0 %s %s", 
+              ReadEvent, GetTitle(), fEventFolderName.Data())) ; 
   gime->Event(ReadEvent, "S") ;
   TClonesArray * digits = gime->Digits() ; 
   digits->Clear() ;
@@ -188,7 +191,8 @@ void AliPHOSDigitizer::Digitize(Int_t event)
   AliPHOSSDigitizer * sDigitizer = gime->SDigitizer(); 
 
   if ( !sDigitizer )
-    Fatal("Digitize", "SDigitizer with name %s %s not found", GetTitle(), fEventFolderName.Data() ) ; 
+    AliFatal(Form("SDigitizer with name %s %s not found", 
+                 GetTitle(), fEventFolderName.Data() )) ; 
 
   //take all the inputs to add together and load the SDigits
   TObjArray * sdigArray = new TObjArray(fInput) ;
@@ -200,7 +204,8 @@ void AliPHOSDigitizer::Digitize(Int_t event)
     AliPHOSGetter * gime = AliPHOSGetter::Instance(fInputFileNames[i], tempo) ;
     if (fManager) 
       ReadEvent = dynamic_cast<AliStream*>(fManager->GetInputStream(i))->GetCurrentEventNumber() ; 
-    Info("Digitize", "Adding event %d from input stream %d %s %s", ReadEvent, i, fInputFileNames[i].Data(), tempo.Data()) ; 
+    AliInfo(Form("Adding event %d from input stream %d %s %s", 
+                ReadEvent, i, fInputFileNames[i].Data(), tempo.Data())) ; 
     gime->Event(ReadEvent,"S");
     sdigArray->AddAt(gime->SDigits(), i) ;
   }
@@ -398,7 +403,8 @@ void AliPHOSDigitizer::Exec(Option_t *option)
   // by default fLastEvent = fFirstEvent (process only one event)
 
   if (!fInit) { // to prevent overwrite existing file
-    Error( "Exec", "Give a version name different from %s", fEventFolderName.Data() ) ;
+    AliError(Form("Give a version name different from %s", 
+                 fEventFolderName.Data() )) ;
     return ;
   }   
 
@@ -412,6 +418,9 @@ void AliPHOSDigitizer::Exec(Option_t *option)
   
   AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle()) ;
 
+  // Post Digitizer to the white board
+  gime->PostDigitizer(this) ;
+  
   if (fLastEvent == -1) 
     fLastEvent = gime->MaxEvent() - 1 ;
   else if (fManager) 
@@ -436,13 +445,15 @@ void AliPHOSDigitizer::Exec(Option_t *option)
     fDigitsInRun += gime->Digits()->GetEntriesFast() ;  
  }
   
+  gime->PhosLoader()->CleanDigitizer();
+
   if(strstr(option,"tim")){
     gBenchmark->Stop("PHOSDigitizer");
     TString message ; 
     message = "  took %f seconds for Digitizing %f seconds per event\n" ; 
-    Info("Exec", message.Data(), 
+    AliInfo(Form( message.Data(), 
         gBenchmark->GetCpuTime("PHOSDigitizer"), 
-        gBenchmark->GetCpuTime("PHOSDigitizer")/nEvents ); 
+        gBenchmark->GetCpuTime("PHOSDigitizer")/nEvents ))
   } 
 }
 
@@ -475,7 +486,8 @@ Bool_t AliPHOSDigitizer::Init()
   fInit = kTRUE ; 
   AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName) ; 
   if ( gime == 0 ) {
-    Fatal("Init" ,"Could not obtain the Getter object for file %s and event %s !", GetTitle(), fEventFolderName.Data()) ;  
+    AliFatal(Form("Could not obtain the Getter object for file %s and event %s !", 
+                 GetTitle(), fEventFolderName.Data()));  
     return kFALSE;
   } 
   
@@ -485,13 +497,11 @@ Bool_t AliPHOSDigitizer::Init()
   
   TString opt("Digits") ; 
   if(gime->VersionExists(opt) ) { 
-    Error( "Init", "Give a version name different from %s", fEventFolderName.Data() ) ;
+    AliError(Form("Give a version name different from %s", 
+                 fEventFolderName.Data() )) ;
     fInit = kFALSE ; 
   }
 
-  // Post Digitizer to the white board
-  gime->PostDigitizer(this) ;
-  
   fFirstEvent = 0 ; 
   fLastEvent = fFirstEvent ; 
   if (fManager) 
@@ -565,7 +575,7 @@ void AliPHOSDigitizer::MixWith(TString alirunFileName, TString eventFolderName)
   }
   // looking for file which contains AliRun
   if (gSystem->AccessPathName(alirunFileName)) {// file does not exist
-    Error("MixWith", "File %s does not exist!", alirunFileName.Data()) ;
+    AliError(Form("File %s does not exist!", alirunFileName.Data())) ;
     return ; 
   }
   // looking for the file which contains SDigits
@@ -574,7 +584,7 @@ void AliPHOSDigitizer::MixWith(TString alirunFileName, TString eventFolderName)
     if ( eventFolderName != AliConfig::GetDefaultEventFolderName()) // only if not the default folder name 
       fileName = fileName.ReplaceAll(".root", "") + "_" + eventFolderName + ".root" ;
     if ( (gSystem->AccessPathName(fileName)) ) { 
-      Error("MixWith", "The file %s does not exist!", fileName.Data()) ;
+      AliError(Form("The file %s does not exist!", fileName.Data())) ;
       return ;
     }
     // need to increase the arrays
@@ -594,10 +604,10 @@ void AliPHOSDigitizer::MixWith(TString alirunFileName, TString eventFolderName)
 }
 
 //__________________________________________________________________
-void AliPHOSDigitizer::Print()const 
+void AliPHOSDigitizer::Print(const Option_t *)const 
 {
   // Print Digitizer's parameters
-  Info("Print", "\n------------------- %s -------------", GetName() ) ; 
+  AliInfo(Form("\n------------------- %s -------------", GetName() )) ; 
   if( strcmp(fEventFolderName.Data(), "") != 0 ){
     printf(" Writing Digits to branch with title  %s\n", fEventFolderName.Data()) ;
     
@@ -628,7 +638,7 @@ void AliPHOSDigitizer::Print()const
     printf(" ---------------------------------------------------\n") ;   
   }
   else
-    Info("Print", "AliPHOSDigitizer not initialized" ) ;
+    AliInfo(Form("AliPHOSDigitizer not initialized" )) ;
   
 }
 
@@ -640,7 +650,7 @@ void AliPHOSDigitizer::Print()const
   AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName) ; 
   TClonesArray * digits = gime->Digits() ; 
   
-  Info("PrintDigits", "%d", digits->GetEntriesFast()) ; 
+  AliInfo(Form("%d", digits->GetEntriesFast())) ; 
   printf("\nevent %d", gAlice->GetEvNumber()) ;
   printf("\n       Number of entries in Digits list %d", digits->GetEntriesFast() )  ;  
 
@@ -694,7 +704,7 @@ void AliPHOSDigitizer::Print()const
 //__________________________________________________________________
 Float_t AliPHOSDigitizer::TimeOfNoise(void) const
 {  // Calculates the time signal generated by noise
-  Info("TimeOfNoise", "Change me") ; 
+  //PH  Info("TimeOfNoise", "Change me") ; 
   return gRandom->Rndm() * 1.28E-5;
 }
 
@@ -726,13 +736,13 @@ void AliPHOSDigitizer::WriteDigits()
   //      and branch "AliPHOSDigitizer", with the same title to keep all the parameters
   //      and names of files, from which digits are made.
 
-  AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName) ; 
+  AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle()) ; 
   const TClonesArray * digits = gime->Digits() ; 
   TTree * treeD = gime->TreeD();
 
   // -- create Digits branch
   Int_t bufferSize = 32000 ;    
-  TBranch * digitsBranch = treeD->Branch("PHOS",&digits,bufferSize);
+  TBranch * digitsBranch = treeD->Branch("PHOS","TClonesArray",&digits,bufferSize);
   digitsBranch->SetTitle(fEventFolderName);
   digitsBranch->Fill() ;