17 #include <TBenchmark.h> 46 fA(0.),fB(0.),fECPrimThreshold(0.),
63 const char * eventFolderName)
64 : TNamed(
"EMCALSDigitizer", alirunFileName),
83 : TNamed(sd.GetName(),sd.GetTitle()),
102 if (&source ==
this)
return *
this;
131 if ( emcalLoader == 0 )
133 AliFatal(
"Could not obtain the AliEMCALLoader");
145 AliFatal(
"Sampling factor not set!") ;
157 AliWarning(
"Simulation Parameters not available in OCDB?");
177 AliDebug(2,Form(
"Print: \n------------------- %s -------------\n",GetName()));
182 AliDebug(2,Form(
" with digitization parameters A = %f\n",
fA));
186 AliDebug(2,Form(
"---------------------------------------------------\n"));
194 TString o(option); o.ToUpper();
195 if (strstr(option,
"print") )
197 AliDebug(2,Form(
"Print: \n------------------- %s -------------\n",GetName()));
202 AliDebug(2,Form(
" with digitization parameters A = %f\n",
fA));
206 AliDebug(2,Form(
"---------------------------------------------------\n"));
211 if(strstr(option,
"tim"))
236 for (ievent = fFirstEvent; ievent <=
fLastEvent; ievent++)
240 TTree * treeS = emcalLoader->
TreeS();
244 treeS = emcalLoader->
TreeS();
247 TClonesArray * sdigits = emcalLoader->
SDigits() ;
251 Int_t iHit, iTrack, iSDigit;
255 TTree *treeH = emcalLoader->
TreeH();
258 Int_t nTrack = treeH->GetEntries();
259 TBranch * branchH = treeH->GetBranch(
"EMCAL");
261 branchH->SetAddress(&
fHits);
262 for (iTrack = 0; iTrack < nTrack; iTrack++)
264 branchH->GetEntry(iTrack);
268 Int_t nHit =
fHits->GetEntriesFast();
269 for(iHit = 0; iHit< nHit;iHit++)
274 Bool_t newsdigit = kTRUE;
296 Warning(
"Digitize",
" abs id %i is bad \n", hit->
GetId());
303 for(Int_t check= 0; check < nSdigits ; check++)
305 sdigit =
static_cast<AliEMCALDigit *
>(sdigits->UncheckedAt(check)) ;
311 *sdigit = *sdigit + *curSDigit;
340 AliSort::TClonesArraySort<AliEMCALDigit>(sdigits);
342 nSdigits = sdigits->GetEntriesFast() ;
345 for (iSDigit = 0 ; iSDigit < sdigits->GetEntriesFast() ; iSDigit++)
360 Int_t bufferSize = 32000 ;
361 TBranch * sdigitsBranch = treeS->GetBranch(
"EMCAL");
363 sdigitsBranch->SetAddress(&sdigits);
365 treeS->Branch(
"EMCAL",&sdigits,bufferSize);
374 if(strstr(option,
"deb"))
380 if(strstr(option,
"tim"))
383 printf(
"\n Digitize: took %f seconds for SDigitizing %f seconds per event\n",
384 gBenchmark->GetCpuTime(
"EMCALSDigitizer"),
gBenchmark->GetCpuTime(
"EMCALSDigitizer")/nEvents ) ;
403 Double_t aSignal =
fA + energy*
fB;
404 if (TMath::Abs(aSignal)>2147483647.0)
408 AliWarning(Form(
"Too big or too small energy %f",aSignal));
410 aSignal = TMath::Sign((Double_t)2147483647,aSignal);
413 return (Float_t ) aSignal;
432 return (Float_t)(amp -
fA)/
fB;
449 printf(
"Print: \n------------------- %s ------------- option %s\n", GetName() , option) ;
454 printf(
" with digitization parameters A = %f\n",
fA) ;
458 printf(
"---------------------------------------------------\n") ;
482 const TClonesArray * sdigits = rl->
SDigits() ;
486 printf(
" Number of entries in SDigits list %i", sdigits->GetEntriesFast());
488 if(strstr(option,
"all")||strstr(option,
"EMC"))
492 printf(
"\n Id Amplitude Time Index Nprim: Primaries list \n") ;
495 const Int_t bufferSize = 8192;
496 char * tempo =
new char[bufferSize];
498 for (index = 0 ; index < sdigits->GetEntries() ; index++)
500 digit =
dynamic_cast<AliEMCALDigit *
>( sdigits->At(index) ) ;
503 snprintf(tempo, bufferSize,
"\n%6d %8f %6.5e %4d %2d :",
509 for (iprimary=0; iprimary<digit->
GetNprimary(); iprimary++)
511 snprintf(tempo,bufferSize,
"%d ",digit->
GetPrimary(iprimary+1) ) ;
522 else AliFatal(
"EMCALLoader is NULL!");
537 else AliFatal(
"EMCALLoader is NULL!");
Bool_t CheckAbsCellId(Int_t absId) const
virtual ~AliEMCALSDigitizer()
Destructor.
Float_t fB
Slope Digitizition parameters.
static AliRunLoader * Instance()
Int_t GetEventNumber() const
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
Int_t fLastEvent
Last event to process.
Bool_t operator==(const AliEMCALSDigitizer &sd) const
Float_t GetTime(void) const
void Print1(Option_t *option="all")
Print info, call all prints.
Int_t fFirstEvent
First event to process.
void Unload() const
Unload Hits and SDigits from the folder.
TString fEventFolderName
Event folder name.
virtual void Browse(TBrowser *b)
Browse (obsolete?)
AliEMCALSimParam * SimulationParameters()
AliLoader * GetDetectorLoader(const char *detname)
Float_t Calibrate(Float_t amp) const
Convert the amplitude back to energy in GeV.
Int_t fSDigitsInRun
! Total number of sdigits in one run
static AliEMCALSimParam * GetInstance()
Get Instance.
Float_t Digitize(Float_t energy) const
Digitize the energy.
#define AliWarning(message)
Give access to hits, digits, recpoints arrays and OCDB.
Float_t fSampling
See AliEMCALGeometry.
Float_t fECPrimThreshold
To store primary if EC Shower Elos > threshold.
void InitParameters()
Initialize parameters for sdigitization.
virtual void MakeSDigitsContainer() const
virtual Int_t WriteSDigits(Option_t *opt="") const
Int_t GetNprimary() const
AliRunLoader * GetRunLoader()
Container of simulation parameters.
Float_t GetECPrimaryThreshold() const
Int_t GetIndexInList() const
EMCal summable digits maker.
Int_t GetNumberOfEvents()
void SetIndexInList(Int_t val)
#define AliFatal(message)
Bool_t fInit
! Tells if initialisation went OK, will revent exec if not
Int_t GetEvent(Int_t evno)
Bool_t fDefaultInit
! Says if the object was created by defaut ctor (only parameters are initialized) ...
#define AliDebug(logLevel, message)
Float_t GetSampling(void) const
Int_t GetPrimary(Int_t index) const
virtual void Print(Option_t *option="") const
Prints parameters of SDigitizer.
Int_t LoadHits(Option_t *detectors="all", Option_t *opt="READ")
AliEMCALSDigitizer()
Default Constructor.
void PrintSDigits(Option_t *option)
Prints list of digits produced at the current pass of AliEMCALDigitizer.
AliEMCALSDigitizer & operator=(const AliEMCALSDigitizer &source)
Assignment operator; use copy constructor.
void UnloadSDigits() const
Int_t GetIparent(void) const
Int_t GetPrimary(void) const
#define AliError(message)
Float_t GetEnergy(void) const
static AliEMCALGeometry * GetInstance()
Float_t GetTime(void) const
TClonesArray * fHits
Temporal array with hits.
Float_t GetAmplitude() const
EMCal geometry, singleton.
Float_t fA
Pedestal parameter.
Int_t LoadKinematics(Option_t *option="READ")