]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSSDigitizer.cxx
fRefVolumeId for reference volume identification added.
[u/mrichter/AliRoot.git] / PHOS / AliPHOSSDigitizer.cxx
index 704809538b63338202ace406c418d51e4ef18f91..79caf80d7001942d13bd4520c4c25e26f18be816 100644 (file)
 
 // --- ROOT system ---
 #include "TFile.h"
-#include "TTask.h"
-#include "TTree.h"
-#include "TSystem.h"
 #include "TROOT.h"
-#include "TFolder.h"
 #include "TBenchmark.h"
-#include "TGeometry.h"
 
 // --- Standard library ---
-#include <iomanip.h>
 
 // --- AliRoot header files ---
 #include "AliRun.h"
-#include "AliHeader.h"
 #include "AliPHOSDigit.h"
-#include "AliPHOSGeometry.h"
 #include "AliPHOSGetter.h"
 #include "AliPHOSHit.h"
 #include "AliPHOSSDigitizer.h"
@@ -94,6 +86,18 @@ TTask(sDigitsTitle, headerFile)
   fDefaultInit = kFALSE ; 
 }
 
+//____________________________________________________________________________ 
+AliPHOSSDigitizer::AliPHOSSDigitizer(const AliPHOSSDigitizer & sd) {
+  //cpy ctor 
+
+  fA             = sd.fA ;
+  fB             = sd.fB ;
+  fPrimThreshold = sd.fPrimThreshold ;
+  fSDigitsInRun  = sd.fSDigitsInRun ;
+  fSplitFile     = new TFile( (sd.fSplitFile)->GetName(), "new")  ; 
+  fToSplit       = sd.fToSplit ;
+}
+
 //____________________________________________________________________________ 
 AliPHOSSDigitizer::~AliPHOSSDigitizer()
 {
@@ -117,8 +121,7 @@ void AliPHOSSDigitizer::Init()
 
   AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), GetName(),fToSplit) ;  
   if ( gime == 0 ) {
-    cerr << "ERROR: AliPHOSSDigitizer::Init -> Could not obtain the Getter object !" 
-        << endl ; 
+    Error("Init" ,"Could not obtain the Getter object !") ;  
     return ;
   } 
   
@@ -157,6 +160,7 @@ void AliPHOSSDigitizer::Init()
 //____________________________________________________________________________ 
 void AliPHOSSDigitizer::InitParameters()
 { 
+  // initializes the parameters for difitization
   fA             = 0;
   fB             = 10000000.;
   fPrimThreshold = 0.01 ;
@@ -266,10 +270,8 @@ void AliPHOSSDigitizer::Exec(Option_t *option)
   
   if(strstr(option,"tim")){
     gBenchmark->Stop("PHOSSDigitizer");
-    cout << "AliPHOSSDigitizer:" << endl ;
-    cout << "   took " << gBenchmark->GetCpuTime("PHOSSDigitizer") << " seconds for SDigitizing " 
-        <<  gBenchmark->GetCpuTime("PHOSSDigitizer")/nevents << " seconds per event " << endl ;
-    cout << endl ;
+    Info("Exec","   took %f seconds for SDigitizing  %f seconds per event",
+        gBenchmark->GetCpuTime("PHOSSDigitizer"), gBenchmark->GetCpuTime("PHOSSDigitizer")/nevents) ;
   }
 }
 
@@ -288,11 +290,11 @@ void AliPHOSSDigitizer::SetSDigitsBranch(const char * title )
   const char * sdigitsTitle    = sdigitsBranch ->GetTitle() ;  
   const char * sdigitizerTitle = sdigitizerBranch ->GetTitle() ;
   if ( stitle.CompareTo(sdigitsTitle)==0 || stitle.CompareTo(sdigitizerTitle)==0 ){
-    cerr << "ERROR: AliPHOSSdigitizer::SetSDigitsBranch -> Cannot overwrite existing branch with title " << title << endl ;
+    Error("SetSDigitsBranch", "Cannot overwrite existing branch with title %s", title) ;
     return ;
   }
   
-  cout << "AliPHOSSdigitizer::SetSDigitsBranch -> Changing SDigits file from " << GetName() << " to " << title << endl ;
+  Info("SetSDigitsBranch", "-> Changing SDigits file from %s to %s", GetName(), title) ;
 
   SetName(title) ; 
     
@@ -306,12 +308,14 @@ void AliPHOSSDigitizer::SetSDigitsBranch(const char * title )
 void AliPHOSSDigitizer::Print(Option_t* option)const
 {
   // Prints parameters of SDigitizer
-  cout << "------------------- "<< GetName() << " -------------" << endl ;
-  cout << "   Writing SDigits to branch with title  " << GetName() << endl ;
-  cout << "   with digitization parameters  A = " << fA << endl ;
-  cout << "                                 B = " << fB << endl ;
-  cout << "   Threshold for Primary assignment= " << fPrimThreshold << endl ; 
-  cout << "---------------------------------------------------"<<endl ;
+  TString message ; 
+  message  = "\n------------------- %s -------------\n" ;  
+  message += "   Writing SDigits to branch with title  %s\n" ;
+  message += "   with digitization parameters  A = %f\n" ; 
+  message += "                                 B = %f\n" ;
+  message += "   Threshold for Primary assignment= %f\n" ; 
+  message += "---------------------------------------------------\n" ;
+  Info("Print", message.Data(),  GetName(),  GetName(), fA, fB, fPrimThreshold ) ;
   
 }
 
@@ -336,58 +340,64 @@ void AliPHOSSDigitizer::PrintSDigits(Option_t * option)
   AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; 
   TString sdname(GetName()) ;
   sdname.Remove(sdname.Index(GetTitle())-1) ;
-  const TClonesArray * sdigits = gime->SDigits(sdname.Data()) ; 
-
-  cout << "AliPHOSSDigitiser: event " << gAlice->GetEvNumber() << endl ;
-  cout << "      Number of entries in SDigits list " << sdigits->GetEntriesFast() << endl ;
-  cout << endl ;
+  const TClonesArray * sdigits = gime->SDigits(sdname.Data()) ;
+
+  TString message ; 
+  message  = "\nAliPHOSSDigitiser: event " ;
+  message += gAlice->GetEvNumber(); 
+  message += "\n      Number of entries in SDigits list " ;  
+  message += sdigits->GetEntriesFast() ; 
+  char * tempo = new char[8192]; 
+  
   if(strstr(option,"all")||strstr(option,"EMC")){
     
     //loop over digits
     AliPHOSDigit * digit;
-    cout << "EMC sdigits " << endl ;
-    cout << "Digit Id    Amplitude     Index     Nprim  Primaries list " <<  endl;      
+    message += "\nEMC sdigits\n" ;
+    message += "\n   Id  Amplitude    Time          Index Nprim: Primaries list \n" ;    
     Int_t maxEmc = gime->PHOSGeometry()->GetNModules()*gime->PHOSGeometry()->GetNCristalsInModule() ;
     Int_t index ;
     for (index = 0 ; (index < sdigits->GetEntriesFast()) && 
         ((dynamic_cast<AliPHOSDigit *> (sdigits->At(index)))->GetId() <= maxEmc) ; index++) {
       digit = dynamic_cast<AliPHOSDigit *>( sdigits->At(index) ) ;
-      if(digit->GetNprimary() == 0) continue;
-      cout << setw(6)  <<  digit->GetId() << "   "  <<         setw(10)  <<  digit->GetAmp() <<   "    "  
-          << setw(6)  <<  digit->GetIndexInList() << "    "   
-          << setw(5)  <<  digit->GetNprimary() <<"    ";
-      
+      if(digit->GetNprimary() == 0) 
+       continue;
+      sprintf(tempo, "\n%6d  %8d    %6.5e %4d      %2d :",
+             digit->GetId(), digit->GetAmp(), digit->GetTime(), digit->GetIndexInList(), digit->GetNprimary()) ;  
+      message += tempo ; 
       Int_t iprimary;
-      for (iprimary=0; iprimary<digit->GetNprimary(); iprimary++)
-       cout << setw(5)  <<  digit->GetPrimary(iprimary+1) << "    ";
-      cout << endl;     
+      for (iprimary=0; iprimary<digit->GetNprimary(); iprimary++) {
+       sprintf(tempo, "%d ",digit->GetPrimary(iprimary+1) ) ; 
+       message += tempo ; 
+      }  
     }    
-    cout << endl;
   }
 
   if(strstr(option,"all")||strstr(option,"CPV")){
     
     //loop over CPV digits
     AliPHOSDigit * digit;
-    cout << "CPV sdigits " << endl ;
-    cout << "Digit Id    Amplitude     Index     Nprim  Primaries list " <<  endl;      
+    
+    message += "CPV sdigits\n" ;
+    message += "\n   Id  Amplitude    Index Nprim: Primaries list \n" ;    
     Int_t maxEmc = gime->PHOSGeometry()->GetNModules()*gime->PHOSGeometry()->GetNCristalsInModule() ;
     Int_t index ;
     for (index = 0 ; index < sdigits->GetEntriesFast(); index++) {
       digit = dynamic_cast<AliPHOSDigit *>( sdigits->At(index) ) ;
       if(digit->GetId() > maxEmc){
-       cout << setw(6)  <<  digit->GetId() << "   "  <<        setw(10)  <<  digit->GetAmp() <<   "    "  
-            << setw(6)  <<  digit->GetIndexInList() << "    "   
-            << setw(5)  <<  digit->GetNprimary() <<"    ";
-       
+       sprintf(tempo, "\n%6d  %8d    %4d      %2d :",
+               digit->GetId(), digit->GetAmp(), digit->GetIndexInList(), digit->GetNprimary()) ;  
+       message += tempo ; 
        Int_t iprimary;
-       for (iprimary=0; iprimary<digit->GetNprimary(); iprimary++)
-         cout << setw(5)  <<  digit->GetPrimary(iprimary+1) << "    ";
-       cout << endl;    
+       for (iprimary=0; iprimary<digit->GetNprimary(); iprimary++) {
+         sprintf(tempo, "%d ",digit->GetPrimary(iprimary+1) ) ; 
+         message += tempo ; 
+       }
       }    
     }
   }
-
+  delete tempo ; 
+  Info("PrintSDigits", message.Data() ) ;
 }
 
 //____________________________________________________________________________