36 #include <TLorentzVector.h> 38 #include <TObjString.h> 40 #include "AliAnalysisManager.h" 41 #include "AliAODInputHandler.h" 46 #include "AliInputEventHandler.h" 49 #include "AliVEvent.h" 58 fNamesJetContainers(),
59 fNameClusterContainer(),
62 this->SetUseAliAnaUtils(
true);
65 AliAnalysisTaskEmcalClustersInJets::AliAnalysisTaskEmcalClustersInJets(
const char *name):
68 fNamesJetContainers(),
69 fNameClusterContainer(),
83 TLinearBinning energybinning(200, 0., 100.), etabinning(100, -0.8, 0.8), phibinning(100, 0., TMath::TwoPi());
86 auto contname =
static_cast<TObjString *
>(
c)->String();
87 fHistos->
CreateTH3(Form(
"hClustersAttached%s", contname.Data()), Form(
"Clusters attached to jets %s", contname.Data()), energybinning, etabinning, phibinning);
88 fHistos->
CreateTH3(Form(
"hClustersNotAttached%s", contname.Data()), Form(
"Clusters attached to jets %s", contname.Data()), energybinning, etabinning, phibinning);
96 UInt_t triggersel = AliVEvent::kAny;
103 if(!(fInputHandler->IsEventSelected() && triggersel))
return false;
109 auto contname =
static_cast<TObjString *
>(
c)->String();
111 std::vector<AliVCluster *> attachedclusters;
112 for(
auto j : jetcontainer->accepted()){
113 for(decltype(j->GetNumberOfClusters()) iclust = 0; iclust < j->GetNumberOfClusters(); iclust++){
114 auto clust = j->ClusterAt(iclust, clusters->GetArray());
115 attachedclusters.emplace_back(clust);
118 fHistos->
FillTH3(Form(
"hClustersAttached%s", contname.Data()), clust->GetNonLinCorrEnergy(), pvec.Eta(), pvec.Phi());
123 for(
auto c : clusters->accepted()){
124 if(
c->GetIsExotic())
continue;
125 if(std::find(attachedclusters.begin(), attachedclusters.end(),
c) != attachedclusters.end())
continue;
128 bool isEMCAL = (pvec.Phi() > 0. && pvec.Phi() < 3.5);
129 if((isEMCALAcceptance && !isEMCAL) || (!isEMCAL && isEMCALAcceptance))
continue;
130 fHistos->
FillTH3(Form(
"hClustersNotAttached%s", contname.Data()),
c->GetNonLinCorrEnergy(), pvec.Eta(), pvec.Phi());
142 auto mgr = AliAnalysisManager::GetAnalysisManager();
144 std::cerr <<
"No analysis manager available. Exiting ..." << std::endl;
147 bool isAOD = mgr->GetInputEventHandler()->IsA() == AliAODInputHandler::Class();
155 if(!jetname.length()){
156 std::cerr <<
"Unsuported jet type. Exiting ..." << std::endl;
160 std::stringstream taskname;
161 taskname << jetname <<
"_" << trigger;
169 auto clusters = task->AddClusterContainer(nameclusters);
170 task->SetNameClusterContainer(nameclusters);
171 clusters->SetClusTimeCut(-20e-9, 15e-9);
173 clusters->SetDefaultClusterEnergy(AliVCluster:: kNonLinCorr);
174 clusters->SetClusNonLinCorrEnergyCut(0.3);
175 clusters->SetClusHadCorrEnergyCut(0.);
177 clusters->SetClusHadCorrEnergyCut(0.3);
183 tracks->SetMinPt(0.15);
187 const std::array<double, 4> kJetRadii = {{0.2, 0.3, 0.4, 0.5}};
188 for(
auto r : kJetRadii){
189 std::stringstream namejetcont;
190 namejetcont << jetname <<
"_R" << std::setw(2) << std::setfill(
'0') << int(r*10.);
192 jcont->SetName(namejetcont.str().data());
193 task->AddNameJetContainer(namejetcont.str().data());
198 std::stringstream outfilename;
199 outfilename << mgr->GetCommonFileName() <<
":ClustersInJets_" << taskname.str();
200 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
201 mgr->ConnectOutput(task, 1 , mgr->CreateContainer(Form(
"Histos_%s", taskname.str().data()), TList::Class(), AliAnalysisManager::kOutputContainer, outfilename.str().data()));
static AliAnalysisTaskEmcalClustersInJets * AddTaskEmcalClustersInJets(AliJetContainer::EJetType_t jettype, const char *trigger)
EMCal fiducial acceptance (each eta, phi edge narrowed by jet R)
virtual void UserCreateOutputObjects()
Class creating a linear binning, used in the histogram manager.
AliJetContainer * GetJetContainer(Int_t i=0) const
Container with name, TClonesArray and cuts for particles.
void SetUseAliAnaUtils(Bool_t b, Bool_t bRejPilup=kTRUE)
virtual bool Run()
Run function. This is the core function of the analysis and contains the user code. Therefore users have to implement this function.
void FillTH3(const char *hname, double x, double y, double z, double weight=1., Option_t *opt="")
Fill a 3D histogram within the container.
TObjArray fNamesJetContainers
Names of the jet containers.
AliAnalysisTaskEmcalClustersInJets()
Bool_t GetMomentum(TLorentzVector &mom, Int_t i) const
THashList * GetListOfHistograms() const
Get the list of histograms.
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Create a new TH1 within the container.
TString fNameTriggerClass
Name of the trigger class to be selected.
AliClusterContainer * GetClusterContainer(Int_t i=0) const
Get cluster container attached to this task.
THistManager * fHistos
! Histogram manager
void AddNameJetContainer(const char *name)
AliEmcalList * fOutput
!output list
Double_t fVertex[3]
!event vertex
Base task in the EMCAL jet framework.
Container class for histograms.
void UserCreateOutputObjects()
Main initialization function on the worker.
virtual ~AliAnalysisTaskEmcalClustersInJets()
TH3 * CreateTH3(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, int nbinsz, double zmin, double zmax, Option_t *opt="")
Create a new TH2 within the container.
static TString TrackContainerNameFactory(Bool_t isAOD)
Get name of the default track container.
static TString ClusterContainerNameFactory(Bool_t isAOD)
Get name of the default cluster container.