16 #include "AliAnalysisManager.h" 17 #include "AliVEventHandler.h" 18 #include "AliMCEventHandler.h" 99 fMaxJetDmesonDistance(0),
103 fCurrentJetInfoReco(0),
104 fCurrentJetInfoTruth(0),
204 classname =
"AliAnalysisTaskDmesonJetsDetectorResponse::AliD0MatchInfoSummary";
208 classname =
"AliAnalysisTaskDmesonJetsDetectorResponse::AliDStarMatchInfoSummary";
258 for (
auto& dmeson_reco : recoDmesons) {
259 if (dmeson_reco.second.fMCLabel < 0) {
260 hname = TString::Format(
"%s/fHistGeneratedDMesonNotFoundRecoPt",
GetName());
263 hname = TString::Format(
"%s/fHistGeneratedDMesonNotFoundRecoEta",
GetName());
266 hname = TString::Format(
"%s/fHistGeneratedDMesonNotFoundRecoPhi",
GetName());
283 Int_t accRecJets = 0;
284 Int_t accGenJets = 0;
296 std::map<int, AliDmesonJetInfo>::iterator it = truthDmesons.find(dmeson_reco.second.fMCLabel);
297 if (it != truthDmesons.end()) {
298 std::pair<const int, AliDmesonJetInfo>& dmeson_truth = (*it);
300 dmeson_truth.second.fReconstructed = kTRUE;
313 hname = TString::Format(
"%s/fHistGeneratedDMesonOutsideAccRecoPt",
GetName());
316 hname = TString::Format(
"%s/fHistGeneratedDMesonOutsideAccRecoEta",
GetName());
319 hname = TString::Format(
"%s/fHistGeneratedDMesonOutsideAccRecoPhi",
GetName());
325 if (accRecJets > 0 || accGenJets > 0)
fTree->Fill();
333 for (
auto& dmeson_truth : truthDmesons) {
335 if (dmeson_truth.second.fReconstructed)
continue;
344 Int_t accGenJets = 0;
354 if (accGenJets > 0)
fTree->Fill();
357 for (
auto& dmeson_truth : truthDmesons) {
358 dmeson_truth.second.fReconstructed = kFALSE;
393 ::Info(
"UserCreateOutputObjects",
"CreateOutputObjects of task %s", GetName());
398 if (param.IsInhibit())
continue;
407 for (
auto ¶m : fAnalysisEngines) {
408 if (param.IsInhibit())
continue;
409 if (param.GetMCMode() !=
kMCTruth)
continue;
410 if (resp.fRecontructed->GetCandidateType() != param.GetCandidateType())
continue;
412 resp.SetGeneratedAnalysisEngine(¶m);
422 for (
auto &resp : fResponseEngines) {
423 if (!resp.CheckInit())
continue;
425 resp.BuildTree(GetName());
427 resp.AssignDataSlot(treeSlot+2);
432 AliError(Form(
"Number of data output slots %d not sufficient. Tree of response engine %s will not be posted!",
fNOutputTrees, resp.GetName()));
437 hname = TString::Format(
"%s/fHistGeneratedDMesonNotFoundRecoPt", resp.GetName());
438 htitle = hname +
";#it{p}_{T,D} (GeV/#it{c});counts";
441 hname = TString::Format(
"%s/fHistGeneratedDMesonNotFoundRecoEta", resp.GetName());
442 htitle = hname +
";#eta_{D};counts";
445 hname = TString::Format(
"%s/fHistGeneratedDMesonNotFoundRecoPhi", resp.GetName());
446 htitle = hname +
";#phi_{D};counts";
449 hname = TString::Format(
"%s/fHistGeneratedDMesonOutsideAccRecoPt", resp.GetName());
450 htitle = hname +
";#it{p}_{T,D} (GeV/#it{c});counts";
453 hname = TString::Format(
"%s/fHistGeneratedDMesonOutsideAccRecoEta", resp.GetName());
454 htitle = hname +
";#eta_{D};counts";
457 hname = TString::Format(
"%s/fHistGeneratedDMesonOutsideAccRecoPhi", resp.GetName());
458 htitle = hname +
";#phi_{D};counts";
488 if (resp.IsInhibit())
continue;
496 if (
ana.IsInhibit())
continue;
512 AliWarning(
"This class only provides a tree output.");
548 ::Error(
"AddTaskDmesonJetsDetectorResponse",
"No analysis manager to connect to.");
553 AliVEventHandler* handler = mgr->GetInputEventHandler();
555 ::Error(
"AddTaskDmesonJetsDetectorResponse",
"This task requires an input event handler");
561 if (handler->InheritsFrom(
"AliESDInputHandler")) {
564 else if (handler->InheritsFrom(
"AliAODInputHandler")) {
569 if (trackName ==
"usedefault") {
570 if (dataType ==
kESD) {
571 trackName =
"Tracks";
573 else if (dataType ==
kAOD) {
574 trackName =
"tracks";
581 if (clusName ==
"usedefault") {
582 if (dataType ==
kESD) {
583 clusName =
"CaloClusters";
585 else if (dataType ==
kAOD) {
586 clusName =
"caloClusters";
593 if (mcPartName ==
"usedefault") {
594 mcPartName =
"mcparticles";
597 TString name(
"AliAnalysisTaskDmesonJetsDetectorResponse");
598 if (!suffix.IsNull()) {
599 name += TString::Format(
"_%s", suffix.Data());
604 if (!trackName.IsNull()) {
606 jetTask->AdoptParticleContainer(trackCont);
609 if (!mcPartName.IsNull()) {
611 partCont->SetEtaLimits(-1.5, 1.5);
612 partCont->SetPtLimits(0, 1000);
613 jetTask->AdoptParticleContainer(partCont);
616 jetTask->AddClusterContainer(clusName.Data());
619 mgr->AddTask(jetTask);
622 AliAnalysisDataContainer* cinput1 = mgr->GetCommonInputContainer();
624 contname1 +=
"_histos";
625 AliAnalysisDataContainer* coutput1 = mgr->CreateContainer(contname1.Data(),
626 TList::Class(), AliAnalysisManager::kOutputContainer,
627 Form(
"%s", AliAnalysisManager::GetCommonFileName()));
629 mgr->ConnectInput(jetTask, 0, cinput1);
630 mgr->ConnectOutput(jetTask, 1, coutput1);
632 for (
Int_t i = 0; i < nMaxTrees; i++) {
633 TString contname = TString::Format(
"%s_tree_%d", name.Data(), i);
634 AliAnalysisDataContainer *coutput = mgr->CreateContainer(contname.Data(),
635 TTree::Class(),AliAnalysisManager::kOutputContainer,
636 Form(
"%s", AliAnalysisManager::GetCommonFileName()));
637 mgr->ConnectOutput(jetTask, 2+i, coutput);
virtual void SetGenerated(const AliDmesonJetInfo &truth)
std::list< AnalysisEngine > fAnalysisEngines
Array of analysis parameters.
static AliAnalysisTaskDmesonJetsDetectorResponse * AddTaskDmesonJetsDetectorResponse(TString trackName, TString clusName, TString mcPartName, Int_t nMaxTrees, TString suffix)
Int_t PostDataFromResponseEngine(const ResponseEngine &eng)
Analysis task for D meson jets.
Lightweight class that encapsulates matching between reconstructed and generated D0 mesons...
virtual void Reset()
Reset the object.
Bool_t fInhibit
!inhibit execution of the task
TList * fOutput
!output list
virtual void SetGenerated(const AliDmesonJetInfo &truth)=0
EDataType_t
Switch for the data type.
Analysis task used to build a detector response for D meson jets.
Bool_t FillTree(Bool_t applyKinCuts)
virtual void Set(const AliDmesonJetInfo &source)
Lightweight class that encapsulates D meson jets.
Int_t fDataSlotNumber
! Data slot where the tree output is posted
AliHFAODMCParticleContainer * fMCContainer
! MC particle container
AliD0InfoSummary fReconstructed
Reconstructed D meson.
virtual void SetReconstructed(const AliDmesonJetInfo &reco)
AliJetInfoSummary ** fCurrentJetInfoReco
! Tree branch
Analysis engine to produce detector response matrix in the D meson jet analysis.
virtual void UserCreateOutputObjects()
Creates the output containers.
void FillPartonLevelHistograms()
Fill histograms with parton-level information.
virtual void Reset()
Reset the object.
void ana(anaModes mode=mLocal)
std::vector< AliAnalysisTaskDmesonJets::AliHFJetDefinition > & GetJetDefinitions()
const char * GetName() const
virtual void Reset()
Reset the object.
THistManager * fHistManagerResponse
! Histogram manager for response
virtual void UserCreateOutputObjects()
Creates the output containers.
Bool_t fInhibit
Inhibit the task.
TTree * BuildTree(const char *taskName)
void SetReconstructedAnalysisEngine(AnalysisEngine *reco)
AliAnalysisTaskDmesonJetsDetectorResponse()
This is the default constructor, used for ROOT I/O purposes.
AnalysisEngine * fRecontructed
! Reconstructed level analysis engine
const char * GetName() const
Lightweight class that encapsulates matching between reconstructed and generated D mesons...
Select tracks based on specific prescriptions of HF analysis.
friend bool operator==(const ResponseEngine &lhs, const ResponseEngine &rhs)
virtual void Set(const AliDmesonJetInfo &source)
TString fName
! D meson candidate name
THashList * GetListOfHistograms() const
Get the list of histograms.
virtual void Reset()
Reset the current object.
Lightweight class that encapsulates D meson jets for PbPb analysis.
AliDmesonMatchInfoSummary * fCurrentDmeson
! Tree branch
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Create a new TH1 within the container.
Double_t fMaxJetDmesonDistance
Maximum distance between a generated D meson and a reconstructed jet, used for geometrical matching (...
virtual void SetReconstructed(const AliDmesonJetInfo &reco)
THistManager fHistManagerResponse
Histogram manager for response.
AliJetInfoSummary ** fCurrentJetInfoTruth
! Tree branch
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
TTree * fTree
! Output tree
ResponseEngine()
Default constructor, for ROOT I/O.
virtual void SetReconstructed(const AliDmesonJetInfo &reco)=0
Select MC particles based on specific prescriptions of HF analysis.
Lightweight class that encapsulates matching between reconstructed and generated D* mesons...
virtual void SetOutputTypeInternal(EOutputType_t b)
ResponseEngine & operator=(const ResponseEngine &source)
AliDmesonMCInfoSummary fGenerated
Generated D meson.
Int_t GetDataSlotNumber() const
Class that encapsulates jets.
std::map< int, AliDmesonJetInfo > & GetDmesons()
Bool_t fApplyKinematicCuts
Apply jet kinematic cuts.
std::vector< ResponseEngine > fResponseEngines
! Response engines
virtual void Reset()
Reset the object.
EOutputType_t fOutputType
Output type: none, TTree or THnSparse.
friend bool operator<(const ResponseEngine &lhs, const ResponseEngine &rhs)
Int_t fNOutputTrees
Maximum number of output trees.
AnalysisEngine * fGenerated
! Generated level analysis engine
Container for MC-true particles within the EMCAL framework.
virtual Bool_t FillHistograms()
void RunAnalysis()
Run the requested analysis for the current event.
ECandidateType_t fCandidateType
D meson candidate type.
virtual void SetGenerated(const AliDmesonJetInfo &truth)
virtual void Set(const AliDmesonJetInfo &source, std::string n)