30 #include <TClonesArray.h> 35 #include <AliAnalysisManager.h> 36 #include <AliVEventHandler.h> 49 fEventInitialized(false),
51 fOutputCollectionName(
""),
52 fThermalParticlesArray(),
53 fChargedParticleFraction(0.67),
61 fUseGaussianForN(true),
100 DefineOutput(1, TList::Class());
124 TString histname =
"hNvsMeanPt";
125 TString title = histname +
";#it{N}_{particles};<#it{p}_{T}>";
134 histname =
"hEtaPhi";
135 title = histname +
";#eta;#phi";
140 title = histname +
";#it{p}_{T}";
144 histname =
"hLeadingPt";
145 title = histname +
";#it{p}_{T,leading}";
149 histname =
"hBackgroundDensity";
150 title = histname +
";#rho (GeV/#it{c});counts";
154 histname =
"hDeltaPt02";
155 title = histname +
";#delta#it{p}_{T} (GeV/#it{c});counts";
158 histname =
"hDeltaPt04";
159 title = histname +
";#delta#it{p}_{T} (GeV/#it{c});counts";
171 while ((obj = next())) {
185 AliError(
"Could not retrieve event! Returning!");
206 if (existingObject) {
207 AliFatal(TString::Format(
"Attempted to create a new branch, \"%s\", with the same name as an existing branch!",
fOutputCollectionName.c_str()));
247 AliError(Form(
"%s: Could not retrieve array with name %s!", GetName(),
fOutputCollectionName.c_str()));
263 for (
Int_t i=0; i<N; i++) {
309 for (
Int_t i=0; i<N; i++) {
319 histname =
"hEtaPhi";
328 if (
GetDeltaR(eta, phi, etaRC02, phiRC02) < jetR02) {
331 if (
GetDeltaR(eta, phi, etaRC04, phiRC04) < jetR04) {
338 TString histname =
"hNvsMeanPt";
342 histname =
"hLeadingPt";
347 Double_t backgroundDensity = ptSum / area;
348 histname =
"hBackgroundDensity";
352 Double_t deltaPt02 = ptSumRC02 - backgroundDensity * TMath::Pi() * jetR02 * jetR02;
353 histname =
"hDeltaPt02";
356 Double_t deltaPt04 = ptSumRC04 - backgroundDensity * TMath::Pi() * jetR04 * jetR04;
357 histname =
"hDeltaPt04";
367 Double_t deltaPhi = TMath::Abs(phi - phiRef);
368 Double_t deltaEta = TMath::Abs(eta - etaRef);
369 Double_t deltaR = TMath::Sqrt( deltaPhi*deltaPhi + deltaEta*deltaEta );
377 const char *outputCollectionName,
386 ::Error(
"AddTaskGenerateThermalBackgroundMC",
"No analysis manager to connect to.");
392 AliVEventHandler* handler = mgr->GetInputEventHandler();
395 ::Error(
"AddTaskGenerateThermalBackgroundMC",
"This task requires an input event handler");
407 if (handler->InheritsFrom(
"AliESDInputHandler")) {
410 else if (handler->InheritsFrom(
"AliAODInputHandler")) {
417 TString name(
"AliAnalysisTaskGenerateThermalBackgroundMC");
418 if (strcmp(outputCollectionName,
"") != 0) {
420 name += outputCollectionName;
422 if (strcmp(suffix,
"") != 0) {
441 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer() ;
443 contname +=
"_histos";
444 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(),
445 TList::Class(),AliAnalysisManager::kOutputContainer,
446 Form(
"%s", AliAnalysisManager::GetCommonFileName()));
447 mgr->ConnectInput (task, 0, cinput1 );
448 mgr->ConnectOutput (task, 1, coutput1 );
Double_t fNGaussianSigma
Sigma of Gaussian (if enabled)
Double_t fBeta
Value of b in the gamma distribution f_gamma ~ x^(a-1) * e^(-x/b)
std::string fOutputCollectionName
Name of TClonesArray output the thermal particles to the event.
Double_t fMaxEta
Max eta for thermal particles.
Double_t fNGaussianMean
Mean of Gaussian (if enabled)
static AliAnalysisTaskGenerateThermalBackgroundMC * AddTaskGenerateThermalBackgroundMC(const char *outputName="thermalparticles", const Double_t beta=0.3, const char *suffix="")
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
Fill a 2D histogram within the container.
Declaration of class AliTLorentzVector.
void UserCreateOutputObjects()
Double_t fMaxPt
Max pT of thermal particles.
virtual Double_t Pt() const
bool fUseGaussianForN
Use a Gaussian for number of particles per event. Otherwise, use flat distribution.
virtual Double_t Eta() const
Double_t fMinEta
Min eta for thermal particles.
bool fEventInitialized
If the event is initialized properly.
Double_t fMinChargedPt
Min pT of charged thermal particles.
TH2 * CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt="")
Create a new TH2 within the container.
void UserExec(Option_t *option)
THashList * GetListOfHistograms() const
Get the list of histograms.
Double_t GetDeltaR(Double_t eta, Double_t phi, Double_t etaRef, Double_t phiRef)
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Create a new TH1 within the container.
Int_t fMinN
Min number of particles in thermal model (for flat distribution)
void SetOutputCollectionName(std::string name)
This task uses a thermal model of background to generate a collection of truth-level background parti...
TRandom3 fRandom
! Random number generator
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
void CreateNewObjectBranch()
Double_t fAlpha
Value of a in the gamma distribution f_gamma ~ x^(a-1) * e^(-x/b)
TList * fOutput
! Output for histograms
TClonesArray * fThermalParticlesArray
! Thermal particle collection
virtual ~AliAnalysisTaskGenerateThermalBackgroundMC()
AliAnalysisTaskGenerateThermalBackgroundMC()
AliVEvent * fEvent
! Pointer to the current event
Double_t fMinNeutralPt
Min pT of neutral thermal particles.
Int_t fMaxN
Max number of particles in thermal model (for flat distribution)
Double_t fChargedParticleFraction
Fraction of thermal particles set to have nonzero charge.
TF1 * fPtDistribution
! Distribution to sample particle pT from
virtual Double_t Phi() const
THistManager fHistManager
Histogram manager.
TList * OpenFile(const char *fname)