//
// --- ROOT system ---
-#include "TFile.h"
#include "TTree.h"
#include "TSystem.h"
-#include "TROOT.h"
-#include "TFolder.h"
-#include "TObjString.h"
-#include "TGeometry.h"
#include "TBenchmark.h"
+#include "TRandom.h"
// --- Standard library ---
// --- AliRoot header files ---
-#include "AliRun.h"
-#include "AliHeader.h"
-#include "AliStream.h"
+
#include "AliRunDigitizer.h"
#include "AliPHOSDigit.h"
-#include "AliPHOS.h"
#include "AliPHOSGetter.h"
#include "AliPHOSDigitizer.h"
#include "AliPHOSSDigitizer.h"
}
//____________________________________________________________________________
-AliPHOSDigitizer::AliPHOSDigitizer(const TString alirunFileName, const 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
-
InitParameters() ;
Init() ;
fDefaultInit = kFALSE ;
//____________________________________________________________________________
AliPHOSDigitizer::AliPHOSDigitizer(const AliPHOSDigitizer & d)
+ : AliDigitizer(d)
{
// copyy 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 ;
- SetName(fManager->GetInputFolderName(0)) ;
- // take title as name of stream 0
+ 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 ;
}
//____________________________________________________________________________
-void AliPHOSDigitizer::Digitize(const Int_t event)
+void AliPHOSDigitizer::Digitize(Int_t event)
{
// 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) ;
+ 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()) ;
+ 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() ) ;
+ Fatal("Digitize", "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() ;
+ Info("Digitize", "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) ;
}
ticks->Delete() ;
delete ticks ;
-
//Now CPV digits (different noise and no timing)
for(absID = nEMC+1; absID <= nCPV; absID++){
Float_t noise = gRandom->Gaus(0., fCPVNoise) ;
//____________________________________________________________________________
void AliPHOSDigitizer::Exec(Option_t *option)
{
- // Does the job
+ // Steering method to process digitization for events
+ // in the range from fFirstEvent to fLastEvent.
+ // This range is optionally set by SetEventRange().
+ // 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() ) ;
if(strstr(option,"tim"))
gBenchmark->Start("PHOSDigitizer");
- if (fManager)
- fInput = fManager->GetNinputs() ;
-
- AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
+ AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle()) ;
- Int_t nevents = gime->MaxEvent() ;
-
+ if (fLastEvent == -1)
+ fLastEvent = gime->MaxEvent() - 1 ;
+ else if (fManager)
+ fLastEvent = fFirstEvent ;
+
+ Int_t nEvents = fLastEvent - fFirstEvent + 1;
+
Int_t ievent ;
- for(ievent = 0; ievent < nevents; ievent++){
+ for (ievent = fFirstEvent; ievent <= fLastEvent; ievent++) {
gime->Event(ievent,"S") ;
Digitize(ievent) ; //Add prepared SDigits to digits and add the noise
- WriteDigits(ievent) ;
+ WriteDigits() ;
if(strstr(option,"deb"))
PrintDigits(option);
message = " took %f seconds for Digitizing %f seconds per event\n" ;
Info("Exec", message.Data(),
gBenchmark->GetCpuTime("PHOSDigitizer"),
- gBenchmark->GetCpuTime("PHOSDigitizer")/nevents );
+ gBenchmark->GetCpuTime("PHOSDigitizer")/nEvents );
}
}
// 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 ;
fNADCcpv = (Int_t) TMath::Power(2,12); // number of channels in CPV ADC
fTimeThreshold = 0.001*10000000 ; //Means 1 MeV in terms of SDigits amplitude
+ SetEventRange(0,-1) ;
}
//__________________________________________________________________
-void AliPHOSDigitizer::MixWith(const TString alirunFileName, const TString eventFolderName)
+void AliPHOSDigitizer::MixWith(TString alirunFileName, TString eventFolderName)
{
// Allows to produce digits by superimposing background and signal event.
// It is assumed, that headers file with SIGNAL events is opened in
// 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()) ;
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()) ;
}
digit = (AliPHOSDigit * ) digits->At(index) ;
if(digit->GetNprimary() == 0)
continue;
- printf("\n%6d %8d %6.5e %4d %2d :",
+ printf("%6d %8d %6.5e %4d %2d :",
digit->GetId(), digit->GetAmp(), digit->GetTime(), digit->GetIndexInList(), digit->GetNprimary()) ;
Int_t iprimary;
for (iprimary=0; iprimary<digit->GetNprimary(); iprimary++) {
printf("%d ",digit->GetPrimary(iprimary+1) ) ;
}
+ printf("\n") ;
}
}
for (index = 0 ; index < digits->GetEntriesFast(); index++) {
digit = (AliPHOSDigit * ) digits->At(index) ;
if(digit->GetId() > maxEmc){
- printf("\n%6d %8d %4d %2d :",
+ printf("%6d %8d %4d %2d :",
digit->GetId(), digit->GetAmp(), digit->GetIndexInList(), digit->GetNprimary()) ;
Int_t iprimary;
for (iprimary=0; iprimary<digit->GetNprimary(); iprimary++) {
printf("%d ",digit->GetPrimary(iprimary+1) ) ;
}
+ printf("\n") ;
}
}
}
}
//____________________________________________________________________________
-void AliPHOSDigitizer::WriteDigits(Int_t event)
+void AliPHOSDigitizer::WriteDigits()
{
// Makes TreeD in the output file.