///_________________________________________________________________________________
// --- 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"
// --- Standard library ---
// --- AliRoot header files ---
-#include "AliRun.h"
-#include "AliHeader.h"
-#include "AliStream.h"
#include "AliRunDigitizer.h"
#include "AliEMCALDigit.h"
#include "AliEMCAL.h"
}
//____________________________________________________________________________
-AliEMCALDigitizer::AliEMCALDigitizer(const TString alirunFileName, const TString eventFolderName):
- AliDigitizer("EMCAL"+AliConfig::fgkDigitizerTaskName, alirunFileName),
+AliEMCALDigitizer::AliEMCALDigitizer(TString alirunFileName, TString eventFolderName):
+ AliDigitizer("EMCAL"+AliConfig::Instance()->GetDigitizerTaskName(), alirunFileName),
fInputFileNames(0), fEventNames(0), fEventFolderName(eventFolderName)
{
// ctor
//____________________________________________________________________________
AliEMCALDigitizer::AliEMCALDigitizer(AliRunDigitizer * rd):
- AliDigitizer(rd,"EMCAL"+AliConfig::fgkDigitizerTaskName),
+ AliDigitizer(rd,"EMCAL"+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 ;
}
//____________________________________________________________________________
AliEMCALDigitizer::~AliEMCALDigitizer()
{
- // dtor
- AliEMCALGetter * gime =AliEMCALGetter::Instance(GetTitle(),fEventFolderName);
- gime->EmcalLoader()->CleanDigitizer();
+ AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle()) ;
+
+ // Clean Digitizer from the white board
+ gime->EmcalLoader()->CleanDigitizer() ;
+
delete [] fInputFileNames ;
delete [] fEventNames ;
}
//____________________________________________________________________________
-void AliEMCALDigitizer::Digitize(const Int_t event)
+void AliEMCALDigitizer::Digitize(Int_t event)
{
// Makes the digitization of the collected summable digits
// helps to avoid scanning over the list of digits to add
// contribution of any new SDigit.
- AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName) ;
+ AliEMCALGetter * gime = AliEMCALGetter::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()) ;
+ gime->Event(ReadEvent, "S") ;
TClonesArray * digits = gime->Digits() ;
digits->Clear() ;
const AliEMCALGeometry *geom = gime->EMCALGeometry() ;
- //Making digits from noise first
- Int_t nEMC = 0 ;
- nEMC = geom->GetNPhi()*geom->GetNZ(); //max number of digits possible
+ Int_t nEMC = geom->GetNPhi()*geom->GetNZ(); //max number of digits possible
Int_t absID ;
TString tempo(fEventNames[i]) ;
tempo += i ;
AliEMCALGetter * gime = AliEMCALGetter::Instance(fInputFileNames[i], tempo) ;
- gime->Event(event,"S");
+ 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) ;
}
Int_t channel = -999;
channel = static_cast<Int_t> (TMath::Ceil( (energy + fADCpedestalEC)/fADCchannelEC )) ;
if(channel > fNADCEC )
- channel = fNADCEC ;
+ channel = fNADCEC ;
return channel ;
}
//____________________________________________________________________________
void AliEMCALDigitizer::Exec(Option_t *option)
{
- // Managing method
+ // 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("EMCALDigitizer");
-
- if (fManager)
- fInput = fManager->GetNinputs() ;
- AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
+ AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle()) ;
+
+ // Post Digitizer to the white board
+ gime->PostDigitizer(this) ;
- 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
fDigitsInRun += gime->Digits()->GetEntriesFast() ;
}
+ gime->EmcalLoader()->CleanDigitizer() ;
+
if(strstr(option,"tim")){
gBenchmark->Stop("EMCALDigitizer");
printf("Exec: took %f seconds for Digitizing %f seconds per event",
- gBenchmark->GetCpuTime("EMCALDigitizer"), gBenchmark->GetCpuTime("EMCALDigitizer")/nevents ) ;
+ gBenchmark->GetCpuTime("EMCALDigitizer"), gBenchmark->GetCpuTime("EMCALDigitizer")/nEvents ) ;
}
}
Error("Init", "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() ) ;
fInit = kFALSE ;
}
- // Post Digitizer to the white board
- gime->PostDigitizer(this) ;
-
+ fFirstEvent = 0 ;
+ fLastEvent = fFirstEvent ;
+
if(fManager)
fInput = fManager->GetNinputs() ;
else
//____________________________________________________________________________
void AliEMCALDigitizer::InitParameters()
{
- fMeanPhotonElectron = 1250 ; // electrons per GeV
- fPinNoise = 0.001 ; // noise equivalent GeV (random choice)
+ fMeanPhotonElectron = 18200 ; // electrons per GeV
+ fPinNoise = 0.003 ; // noise equivalent GeV (random choice)
if (fPinNoise == 0. )
Warning("InitParameters", "No noise added\n") ;
fDigitThreshold = fPinNoise * 3; //2 sigma
- fTimeResolution = 0.5e-9 ;
+ fTimeResolution = 1.0e-9 ;
fTimeSignalLength = 1.0e-9 ;
- fADCchannelEC = 0.000220; // width of one ADC channel in GeV
+ fADCchannelEC = 0.00305; // width of one ADC channel in GeV - HG fix so that we see 200 GeV gammas
fADCpedestalEC = 0.005 ; // GeV
fNADCEC = (Int_t) TMath::Power(2,16) ; // number of channels in Tower ADC
}
//__________________________________________________________________
-void AliEMCALDigitizer::MixWith(const TString alirunFileName, const TString eventFolderName)
+void AliEMCALDigitizer::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
AliEMCALGetter * gime = AliEMCALGetter::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 ;
AliEMCALGetter * gime = AliEMCALGetter::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()) ;
}
//__________________________________________________________________
Float_t AliEMCALDigitizer::TimeOfNoise(void)
-{ // Calculates the time signal generated by noise
- //to be rewritten, now returns just big number
- return 1. ;
-
+{
+ // Calculates the time signal generated by noise
+ //PH Info("TimeOfNoise", "Change me") ;
+ return gRandom->Rndm() * 1.28E-5;
}
//__________________________________________________________________
// and branch "AliEMCALDigitizer", with the same title to keep all the parameters
// and names of files, from which digits are made.
- AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName) ;
+ AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle()) ;
const TClonesArray * digits = gime->Digits() ;
TTree * treeD = gime->TreeD();
// -- create Digits branch
Int_t bufferSize = 32000 ;
- TBranch * digitsBranch = treeD->Branch("EMCAL",&digits,bufferSize);
+ TBranch * digitsBranch = treeD->Branch("EMCAL","TClonesArray",&digits,bufferSize);
digitsBranch->SetTitle(fEventFolderName);
digitsBranch->Fill() ;