37 #include "AliAODInputHandler.h" 38 #include "AliAnalysisManager.h" 45 #include "AliEventCuts.h" 46 #include "AliInputEventHandler.h" 49 #include "AliMultSelection.h" 50 #include "AliVEvent.h" 61 fTriggerSelectionBits(AliVEvent::kAny),
62 fTriggerSelectionString(
""),
63 fRequireSubsetMB(false),
64 fMinBiasTrigger(AliVEvent::kAny),
65 fNameTriggerDecisionContainer(
"EmcalTriggerDecision"),
66 fUseTriggerSelectionForData(false),
67 fUseDownscaleWeight(false),
68 fNameJetContainer(
"datajets"),
69 fRequestTriggerClusters(true),
70 fRequestCentrality(false),
71 fUseAliEventCuts(false),
72 fCentralityEstimator(
"V0M")
107 AliInfoStream() <<
"Using default pt binning";
110 for(
int istep = 0; istep < 201; istep++) {
116 TLinearBinning centralitybinning(100, 0., 100.), etabinning(100, -1., 1.), phibinning(100., 0., 7.), nefbinning(100, 0., 1.), trgclusterbinning(
kTrgClusterN + 1, -0.5,
kTrgClusterN -0.5);
118 const TBinning *binnings[6] = {¢ralitybinning, &jetptbinning, &etabinning, &phibinning, &nefbinning, &trgclusterbinning};
120 fHistos->
CreateTH1(
"hEventCounter",
"Event counter histogram", 1, 0.5, 1.5);
121 fHistos->
CreateTH1(
"hEventCounterAbs",
"Event counter histogram absolute", 1, 0.5, 1.5);
123 fHistos->
CreateTH1(
"hEventCentralityAbs",
"Event centrality absolute", 100., 0., 100.);
134 fEventCuts->OverrideAutomaticTriggerSelection(AliVEvent::kAny,
true);
143 if(!
fEventCuts->AcceptEvent(fInputEvent))
return false;
152 AliErrorStream() <<
"Jet container " <<
fNameJetContainer <<
" not found" << std::endl;
156 double eventCentrality = 99;
158 AliMultSelection *mult =
dynamic_cast<AliMultSelection *
>(InputEvent()->FindListObject(
"MultSelection"));
160 AliErrorStream() << GetName() <<
": Centrality selection enabled but no centrality estimator found" << std::endl;
163 if(mult->IsEventSelected())
return false;
165 AliDebugStream(1) << GetName() <<
": Centrality " << eventCentrality << std::endl;
167 AliDebugStream(1) << GetName() <<
": No centrality selection applied" << std::endl;
180 for(
auto t : trgclusters) {
184 for(
auto j : datajets->accepted()){
185 if(!maxjet || (j->E() > maxjet->
E())) maxjet = j;
186 double datapoint[6] = {eventCentrality, j->
Pt(), j->Eta(), j->Phi(), j->NEF(), 0.};
187 for(
auto t : trgclusters){
188 datapoint[5] =
static_cast<double>(t);
194 memset(maxdata, 0.,
sizeof(
double) * 5);
195 maxdata[0] = eventCentrality;
197 maxdata[1] = maxjet->
Pt();
198 maxdata[2] = maxjet->
Eta();
199 maxdata[3] = maxjet->
Phi();
200 maxdata[4] = maxjet->
NEF();
202 for(
auto t : trgclusters){
203 maxdata[5] =
static_cast<double>(t);
212 if(downscalehandler->GetCurrentRun() != newrun){
213 downscalehandler->SetRun(newrun);
220 std::vector<TriggerCluster_t> result;
224 std::vector<std::string> clusternames;
226 for(
auto t : triggerinfos) {
227 if(std::find(clusternames.begin(), clusternames.end(), t.Triggercluster()) == clusternames.end()) clusternames.emplace_back(t.Triggercluster());
229 bool isCENT = (std::find(clusternames.begin(), clusternames.end(),
"CENT") != clusternames.end()),
230 isCENTNOTRD = (std::find(clusternames.begin(), clusternames.end(),
"CENTNOTRD") != clusternames.end()),
231 isCALO = (std::find(clusternames.begin(), clusternames.end(),
"CALO") != clusternames.end()),
232 isCALOFAST = (std::find(clusternames.begin(), clusternames.end(),
"CALOFAST") != clusternames.end());
233 if(isCENT || isCENTNOTRD) {
245 if(isCALO || isCALOFAST) {
270 AliDebugStream(1) <<
"Found trigger decision object: " << (trgselresult ?
"yes" :
"no") << std::endl;
272 AliErrorStream() <<
"Trigger decision container with name " <<
fNameTriggerDecisionContainer <<
" not found in event - not possible to select EMCAL triggers" << std::endl;
279 if(!(fInputHandler->IsEventSelected() & AliVEvent::kINT7))
return false;
283 AliDebugStream(1) <<
"Found trigger decision object: " << (mctrigger ?
"yes" :
"no") << std::endl;
285 AliErrorStream() <<
"Trigger decision container with name " <<
fNameTriggerDecisionContainer <<
" not found in event - not possible to select EMCAL triggers" << std::endl;
297 for(
const auto &t : triggerclasses) {
299 if(t.Triggercluster() !=
"CENT")
continue;
301 result = t.ExpandClassName();
308 const std::array<std::string, 8> kEMCALTriggers = {
309 "EJ1",
"EJ2",
"DJ1",
"DJ2",
"EG1",
"EG2",
"DG1",
"DG2" 311 bool isEMCAL =
false;
312 for(
auto emcaltrg : kEMCALTriggers) {
313 if(triggerstring.find(emcaltrg) != std::string::npos) {
325 std::cerr <<
"Analysis manager not initialized" << std::endl;
330 AliInputEventHandler *inputhandler =
static_cast<AliInputEventHandler *
>(mgr->GetInputEventHandler());
332 if(inputhandler->IsA() == AliAODInputHandler::Class()){
333 std::cout <<
"Analysing AOD events\n";
336 std::cout <<
"Analysing ESD events\n";
340 std::string jettypestring;
348 std::stringstream tag, outfilename;
349 tag << jettypestring <<
"_R" << std::setw(2) << std::setfill(
'0') << int(radius * 10.) <<
"_" << trigger;
357 auto contains = [](
const std::string &str,
const std::string &
test) {
358 return str.find(
test) != std::string::npos;
361 std::string trgstr(trigger);
362 if(contains(trgstr,
"INT7")) task->SetTriggerSelection(AliVEvent::kINT7,
"INT7");
363 else if(contains(trgstr,
"EJ1")) task->SetTriggerSelection(AliVEvent::kEMCEJE,
"EJ1");
364 else if(contains(trgstr,
"EJ2")) task->SetTriggerSelection(AliVEvent::kEMCEJE,
"EJ2");
365 else if(contains(trgstr,
"EG1")) task->SetTriggerSelection(AliVEvent::kEMCEGA,
"EG1");
366 else if(contains(trgstr,
"EG2")) task->SetTriggerSelection(AliVEvent::kEMCEGA,
"EG2");
373 tracks->SetMinPt(0.15);
384 jetcont->SetName(
"datajets");
385 task->SetNameJetContainer(
"datajets");
386 std::cout <<
"Adding jet container with underlying array:" << jetcont->GetArrayName() << std::endl;
389 outfilename << mgr->GetCommonFileName() <<
":JetSpectrum_" << tag.str().data();
390 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
391 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)
AliEventCuts * fEventCuts
Event cuts as implemented in AliEventCuts.
Class creating a variable binning, used in the histogram manager.
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)
Bool_t fRequireSubsetMB
Require for triggers to be a subset of Min. Bias (for efficiency studies)
static AliAnalysisTaskEmcalJetEnergySpectrum * AddTaskJetEnergySpectrum(Bool_t isMC, AliJetContainer::EJetType_t jettype, double radius, const char *trigger, const char *suffix="")
static AliEmcalDownscaleFactorsOCDB * Instance()
UInt_t fTriggerSelectionBits
Trigger selection bits.
std::vector< TriggerCluster_t > GetTriggerClusterIndices(const TString &triggerstring) const
Double_t GetDownscaleFactorForTriggerClass(const TString &trigger) 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.
TString fCentralityEstimator
Centrality estimator.
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.
ULong_t fMinBiasTrigger
Min bias trigger for trigger subset (for efficiency studies)
TArrayD fUserPtBinning
User-defined pt-binning.
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 fRequestTriggerClusters
Request distinction of trigger clusters.
virtual void RunChanged(Int_t newrun)
Process tasks relevant when a file with a different run number is processed.
virtual Bool_t IsEventSelected()
Performing event selection.
Bool_t fUseTriggerSelectionForData
Use trigger selection on data (require trigger patch in addition to trigger selection string) ...
Bool_t fUseAliEventCuts
Flag switching on AliEventCuts;.
virtual bool IsTriggerSelected()
Selection of a hardware trigger.
AliEmcalList * fOutput
!output list
Bool_t fRequestCentrality
Request centrality.
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)
virtual bool IsEventSelected()
Performing event selection.
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.
std::string MatchTrigger(const std::string &striggerstring)
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.