36 #include "AliAODInputHandler.h" 37 #include "AliAnalysisManager.h" 43 #include "AliInputEventHandler.h" 46 #include "AliVEvent.h" 56 fTriggerSelectionBits(AliVEvent::kAny),
57 fTriggerSelectionString(
""),
58 fNameTriggerDecisionContainer(
"EmcalTriggerDecision"),
59 fUseTriggerSelectionForData(false),
60 fUseDownscaleWeight(false),
61 fNameJetContainer(
"datajets")
87 TLinearBinning jetptbinning(200, 0., 200.), etabinning(100, -1., 1.), phibinning(100., 0., 7.), nefbinning(100, 0., 1.), trgclusterbinning(
kTrgClusterN + 1, -0.5,
kTrgClusterN -0.5);
88 const TBinning *binnings[5] = {&jetptbinning, &etabinning, &phibinning, &nefbinning, &trgclusterbinning};
102 AliErrorStream() <<
"Jet container " <<
fNameJetContainer <<
" not found" << std::endl;
111 for(
auto j : datajets->accepted()){
112 if(!maxjet || (j->E() > maxjet->
E())) maxjet = j;
113 double datapoint[5] = {j->
Pt(), j->Eta(), j->Phi(), j->NEF(), 0.};
114 for(
auto t : trgclusters){
115 datapoint[4] =
static_cast<double>(t);
121 memset(maxdata, 0.,
sizeof(
double) * 5);
123 maxdata[0] = maxjet->
Pt();
124 maxdata[1] = maxjet->
Eta();
125 maxdata[2] = maxjet->
Phi();
126 maxdata[3] = maxjet->
NEF();
127 for(
auto t : trgclusters){
128 maxdata[4] =
static_cast<double>(t);
137 std::vector<TriggerCluster_t> result;
141 std::vector<std::string> clusternames;
143 for(
auto t : triggerinfos) {
144 if(std::find(clusternames.begin(), clusternames.end(), t.Triggercluster()) == clusternames.end()) clusternames.emplace_back(t.Triggercluster());
146 bool isCENT = (std::find(clusternames.begin(), clusternames.end(),
"CENT") != clusternames.end()),
147 isCENTNOTRD = (std::find(clusternames.begin(), clusternames.end(),
"CENTNOTRD") != clusternames.end()),
148 isCALO = (std::find(clusternames.begin(), clusternames.end(),
"CALO") != clusternames.end()),
149 isCALOFAST = (std::find(clusternames.begin(), clusternames.end(),
"CALOFAST") != clusternames.end());
150 if(isCENT || isCENTNOTRD) {
162 if(isCALO || isCALOFAST) {
186 AliDebugStream(1) <<
"Found trigger decision object: " << (trgselresult ?
"yes" :
"no") << std::endl;
188 AliErrorStream() <<
"Trigger decision container with name " <<
fNameTriggerDecisionContainer <<
" not found in event - not possible to select EMCAL triggers" << std::endl;
195 if(!(fInputHandler->IsEventSelected() & AliVEvent::kINT7))
return false;
199 AliDebugStream(1) <<
"Found trigger decision object: " << (mctrigger ?
"yes" :
"no") << std::endl;
201 AliErrorStream() <<
"Trigger decision container with name " <<
fNameTriggerDecisionContainer <<
" not found in event - not possible to select EMCAL triggers" << std::endl;
211 const std::array<std::string, 8> kEMCALTriggers = {
212 "EJ1",
"EJ2",
"DJ1",
"DJ2",
"EG1",
"EG2",
"DG1",
"DG2" 214 bool isEMCAL =
false;
215 for(
auto emcaltrg : kEMCALTriggers) {
216 if(triggerstring.find(emcaltrg) != std::string::npos) {
228 std::cerr <<
"Analysis manager not initialized" << std::endl;
233 AliInputEventHandler *inputhandler =
static_cast<AliInputEventHandler *
>(mgr->GetInputEventHandler());
235 if(inputhandler->IsA() == AliAODInputHandler::Class()){
236 std::cout <<
"Analysing AOD events\n";
239 std::cout <<
"Analysing ESD events\n";
243 std::string jettypestring;
251 std::stringstream tag, outfilename;
252 tag << jettypestring <<
"_R" << std::setw(2) << std::setfill(
'0') << int(radius * 10.) <<
"_" << trigger;
260 auto contains = [](
const std::string &str,
const std::string &
test) {
261 return str.find(
test) != std::string::npos;
264 std::string trgstr(trigger);
265 if(contains(trgstr,
"INT7")) task->SetTriggerSelection(AliVEvent::kINT7,
"INT7");
266 else if(contains(trgstr,
"EJ1")) task->SetTriggerSelection(AliVEvent::kEMCEJE,
"EJ1");
267 else if(contains(trgstr,
"EJ2")) task->SetTriggerSelection(AliVEvent::kEMCEJE,
"EJ2");
268 else if(contains(trgstr,
"EG1")) task->SetTriggerSelection(AliVEvent::kEMCEGA,
"EG1");
269 else if(contains(trgstr,
"EG2")) task->SetTriggerSelection(AliVEvent::kEMCEGA,
"EG2");
276 tracks->SetMinPt(0.15);
287 jetcont->SetName(
"datajets");
288 task->SetNameJetContainer(
"datajets");
289 std::cout <<
"Adding jet container with underlying array:" << jetcont->GetArrayName() << std::endl;
292 outfilename << mgr->GetCommonFileName() <<
":JetSpectrum_" << tag.str().data();
293 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
294 mgr->ConnectOutput(task, 1, mgr->CreateContainer(Form(
"JetSpectrum_%s", tag.str().data()), TList::Class(), AliAnalysisManager::kOutputContainer, outfilename.str().data()));
virtual ~AliAnalysisTaskEmcalJetEnergySpectrum()
EMCal fiducial acceptance (each eta, phi edge narrowed by jet R)
Class creating a linear binning, used in the histogram manager.
AliJetContainer * GetJetContainer(Int_t i=0) const
THistManager * fHistos
Histogram manager.
Container with name, TClonesArray and cuts for particles.
void SetUseAliAnaUtils(Bool_t b, Bool_t bRejPilup=kTRUE)
static AliAnalysisTaskEmcalJetEnergySpectrum * AddTaskJetEnergySpectrum(Bool_t isMC, AliJetContainer::EJetType_t jettype, double radius, const char *trigger, const char *suffix="")
UInt_t fTriggerSelectionBits
Trigger selection bits.
std::vector< TriggerCluster_t > GetTriggerClusterIndices(const TString &triggerstring) const
bool TriggerSelection() const
Interface for binnings used by the histogram handler.
static std::vector< PWG::EMCAL::Triggerinfo > DecodeTriggerString(const std::string &triggerstring)
Decoding trigger string.
Bool_t fIsMC
Running on simulated events.
void FillTHnSparse(const char *name, const double *x, double weight=1., Option_t *opt="")
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.
THashList * GetListOfHistograms() const
Get the list of histograms.
bool IsSelectEmcalTriggers(const std::string &triggerstring) const
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 fTriggerSelectionString
Trigger selection string.
TPC fiducial acceptance (each eta edge narrowed by jet R)
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
virtual void UserCreateOutputObjects()
Container for trigger decision object.
TString fNameTriggerDecisionContainer
Global trigger decision container.
Bool_t fUseTriggerSelectionForData
Use trigger selection on data (require trigger patch in addition to trigger selection string) ...
AliEmcalList * fOutput
!output list
AliAnalysisTaskEmcalJetEnergySpectrum()
Base task in the EMCAL jet framework.
Represent a jet reconstructed using the EMCal jet framework.
Container class for histograms.
void test(int runnumber=195345)
void UserCreateOutputObjects()
Main initialization function on the worker.
Bool_t fUseDownscaleWeight
Use 1/downscale as weight.
TString fNameJetContainer
Name of the jet container.
void SetDefaultClusterEnergy(Int_t d)
THnSparse * CreateTHnSparse(const char *name, const char *title, int ndim, const int *nbins, const double *min, const double *max, Option_t *opt="")
Create a new THnSparse within the container.
Container structure for EMCAL clusters.
void SetClusHadCorrEnergyCut(Double_t cut)
static TString ClusterContainerNameFactory(Bool_t isAOD)
Get name of the default cluster container.
static TString TrackContainerNameFactory(Bool_t isAOD)
Get name of the default track container.