/* $Id$ */
+/* History of cvs commits:
+ *
+ * $Log$
+ */
//_________________________________________________________________________
//*-- Author : Dmitri Peressounko (SUBATECH & Kurchatov Institute)
// --- Standard library ---
// --- AliRoot header files ---
-
+#include "AliLog.h"
#include "AliRunDigitizer.h"
#include "AliPHOSDigit.h"
#include "AliPHOSGetter.h"
}
//____________________________________________________________________________
-AliPHOSDigitizer::AliPHOSDigitizer(TString alirunFileName, TString eventFolderName):
- AliDigitizer("PHOS"+AliConfig::fgkDigitizerTaskName, alirunFileName),
+AliPHOSDigitizer::AliPHOSDigitizer(TString alirunFileName,
+ TString eventFolderName):
+ AliDigitizer("PHOS"+AliConfig::Instance()->GetDigitizerTaskName(),
+ alirunFileName),
fInputFileNames(0), fEventNames(0), fEventFolderName(eventFolderName)
{
// ctor
//____________________________________________________________________________
AliPHOSDigitizer::AliPHOSDigitizer(AliRunDigitizer * rd):
- AliDigitizer(rd,"PHOS"+AliConfig::fgkDigitizerTaskName),
+ AliDigitizer(rd,"PHOS"+AliConfig::Instance()->GetDigitizerTaskName()),
fEventFolderName(0)
{
- // ctor
+ // ctor Init() is called by RunDigitizer
fManager = rd ;
fEventFolderName = fManager->GetInputFolderName(0) ;
SetTitle(dynamic_cast<AliStream*>(fManager->GetInputStream(0))->GetFileName(0));
InitParameters() ;
- Init() ;
fDefaultInit = kFALSE ;
}
AliPHOSDigitizer::~AliPHOSDigitizer()
{
// dtor
- AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle(),fEventFolderName);
- gime->PhosLoader()->CleanDigitizer();
delete [] fInputFileNames ;
delete [] fEventNames ;
// Makes the digitization of the collected summable digits.
// It first creates the array of all PHOS modules
- // filled with noise (different for EMC, CPV and PPSD) and
+ // filled with noise (different for EMC, and CPV) and
// then adds contributions from SDigits.
// 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() ;
+ 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() ;
AliPHOSSDigitizer * sDigitizer = gime->SDigitizer();
if ( !sDigitizer )
- Fatal("Digitize", "SDigitizer with name %s %s not found", fEventFolderName.Data(), GetTitle() ) ;
+ 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) ;
for(i = 1 ; i < fInput ; i++){
TString tempo(fEventNames[i]) ;
tempo += i ;
- AliPHOSGetter * gime = AliPHOSGetter::Instance(fInputFileNames[i], tempo) ;
- gime->Event(event,"S");
+ AliPHOSGetter * gime = AliPHOSGetter::Instance(fInputFileNames[i], tempo) ;
+ if (fManager)
+ ReadEvent = dynamic_cast<AliStream*>(fManager->GetInputStream(i))->GetCurrentEventNumber() ;
+ 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) ;
}
// Steering method to process digitization for events
// in the range from fFirstEvent to fLastEvent.
// This range is optionally set by SetEventRange().
- // if fLastEvent=-1 (by default), then process events until the end.
+ // if fLastEvent=-1, then process events until the end.
+ // 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 ;
}
if(strstr(option,"tim"))
gBenchmark->Start("PHOSDigitizer");
- if (fManager)
- fInput = fManager->GetNinputs() ;
-
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
+ AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle()) ;
+ // Post Digitizer to the white board
+ gime->PostDigitizer(this) ;
+
if (fLastEvent == -1)
fLastEvent = gime->MaxEvent() - 1 ;
- else
- fLastEvent = TMath::Min(fLastEvent,gime->MaxEvent());
+ else if (fManager)
+ fLastEvent = fFirstEvent ;
+
Int_t nEvents = fLastEvent - fFirstEvent + 1;
Int_t ievent ;
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 ));
}
}
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;
}
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)
fInput = fManager->GetNinputs() ;
else
for (index = 1 ; index < fInput ; index++) {
fInputFileNames[index] = dynamic_cast<AliStream*>(fManager->GetInputStream(index))->GetFileName(0);
TString tempo = fManager->GetInputFolderName(index) ;
- fEventNames[index] = tempo.Remove(tempo.Length()-1) ; // strip of the stream number added bt fManager
+ fEventNames[index] = tempo.Remove(tempo.Length()-1) ; // strip of the stream number added by fManager
}
//to prevent cleaning of this object while GetEvent is called
//____________________________________________________________________________
void AliPHOSDigitizer::InitParameters()
{
- // Set initial parameters for Digitizer
+ // Set initial parameters Digitizer
fPinNoise = 0.004 ;
fEMCDigitThreshold = 0.012 ;
}
// 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
AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
TString fileName( gime->GetSDigitsFileName() ) ;
- if ( eventFolderName != AliConfig::fgkDefaultEventFolderName) // only if not the default folder name
+ 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
}
//__________________________________________________________________
-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()) ;
tempo += index ;
AliPHOSGetter * gime = AliPHOSGetter::Instance(fInputFileNames[index], tempo) ;
TString fileName( gime->GetSDigitsFileName() ) ;
- if ( fEventNames[index] != AliConfig::fgkDefaultEventFolderName) // only if not the default folder name
+ if ( fEventNames[index] != AliConfig::GetDefaultEventFolderName()) // only if not the default folder name
fileName = fileName.ReplaceAll(".root", "") + "_" + fEventNames[index] + ".root" ;
printf ("Adding SDigits from %s %s\n", fInputFileNames[index].Data(), fileName.Data()) ;
}
printf(" ---------------------------------------------------\n") ;
}
else
- Info("Print", "AliPHOSDigitizer not initialized" ) ;
+ AliInfo(Form("AliPHOSDigitizer not initialized" )) ;
}
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() ) ;
//__________________________________________________________________
Float_t AliPHOSDigitizer::TimeOfNoise(void) const
{ // Calculates the time signal generated by noise
- //to be rewritten, now returns just big number
- return 1. ;
-
+ //PH Info("TimeOfNoise", "Change me") ;
+ return gRandom->Rndm() * 1.28E-5;
}
//__________________________________________________________________
// 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() ;