AliPhysics  8b695ca (8b695ca)
AliAnalysisTaskEmcalJetHPerformance.cxx
Go to the documentation of this file.
1 
6 
7 #include <map>
8 #include <vector>
9 #include <iostream>
10 
11 #include <TObject.h>
12 #include <TCollection.h>
13 #include <TAxis.h>
14 #include <THnSparse.h>
15 
16 #include <AliAnalysisManager.h>
17 #include <AliLog.h>
18 
19 #include "yaml-cpp/yaml.h"
21 #include "AliTrackContainer.h"
22 #include "AliClusterContainer.h"
23 #include "AliEmcalContainerUtils.h"
24 #include "AliJetContainer.h"
25 #include "AliEmcalJet.h"
26 
28 
30 
31 namespace PWGJE {
32 namespace EMCALJetTasks {
33 
38  AliAnalysisTaskEmcalJet("AliAnalysisTaskEmcalJetHPerformance", kFALSE),
39  fYAMLConfig(),
40  fConfigurationInitialized(false),
41  fEventCuts(),
42  fHistManager(),
43  fEmbeddingQA(),
44  fUseAliEventCuts(true),
45  fCreateQAHists(false),
46  fCreateResponseMatrix(false),
47  fEmbeddedCellsName("emcalCells"),
48  fResponseMatrixFillMap(),
49  fResponseFromThreeJetCollections(true),
50  fMinFractionShared(0.),
51  fLeadingHadronBiasType(AliAnalysisTaskEmcalJetHUtils::kCharged)
52 {
53 }
54 
59  AliAnalysisTaskEmcalJet(name, kTRUE),
60  fYAMLConfig(),
62  fEventCuts(),
63  fHistManager(name),
64  fEmbeddingQA(),
65  fUseAliEventCuts(true),
66  fCreateQAHists(false),
67  fCreateResponseMatrix(false),
68  fEmbeddedCellsName("emcalCells"),
73 {
74  // Ensure that additional general histograms are created
76 }
77 
82  fYAMLConfig(other.fYAMLConfig),
84  //fEventCuts(other.fEventCuts), // Copy constructor is private.
85  fHistManager(other.fHistManager.GetName()),
86  //fEmbeddingQA(other.fEmbeddingQA), // Cannot use because the THistManager (which is in the class) copy constructor is private.
95 {
96  TIter next(other.fHistManager.GetListOfHistograms());
97  TObject* obj = 0;
98  while ((obj = next())) {
99  fHistManager.SetObject(obj, obj->GetName());
100  }
101 }
102 
108 {
109  swap(*this, other);
110  return *this;
111 }
112 
117 {
118  // Base class options
119  // Recycle unused embedded events
120  fYAMLConfig.GetProperty("recycleUnusedEmbeddedEventsMode", fRecycleUnusedEmbeddedEventsMode, false);
121  // Task physics (trigger) selection.
122  std::vector<std::string> physicsSelection;
123  bool res = fYAMLConfig.GetProperty(std::vector<std::string>({"eventCuts", "physicsSelection"}), physicsSelection, false);
124  if (res) {
125  fOfflineTriggerMask = AliEmcalContainerUtils::DeterminePhysicsSelectionFromYAML(physicsSelection);
126  }
127 
128  // Same ordering as in the constructor (for consistency)
129  std::string baseName = "enable";
130  // These are disabled by default.
131  fYAMLConfig.GetProperty({baseName, "QAHists"}, fCreateQAHists, false);
132  fYAMLConfig.GetProperty({baseName, "responseMatrix"}, fCreateResponseMatrix, false);
133 
134  // Event cuts
135  baseName = "eventCuts";
136  // This exceptionally defaults to true.
137  fYAMLConfig.GetProperty({baseName, "enabled"}, fUseAliEventCuts, false);
138  if (fUseAliEventCuts) {
139  // Need to include the namespace so that AliDebug will work properly...
140  std::string taskName = "PWGJE::EMCALJetTasks::";
141  taskName += GetName();
142  AliAnalysisTaskEmcalJetHUtils::ConfigureEventCuts(fEventCuts, fYAMLConfig, fOfflineTriggerMask, baseName, taskName);
143  }
144 
145  // General task options
146  baseName = "general";
147  fYAMLConfig.GetProperty({baseName, "nCentBins"}, fNcentBins, false);
148 
149  // QA options
150  baseName = "QA";
151  // Defaults to "emcalCells" if not set.
152  fYAMLConfig.GetProperty({baseName, "embeddedCellsName"}, fEmbeddedCellsName, false);
153 
154  // Response matrix properties
155  baseName = "responseMatrix";
156  fYAMLConfig.GetProperty({baseName, "useThreeJetCollections"}, fResponseFromThreeJetCollections, false);
157  fYAMLConfig.GetProperty({baseName, "minFractionSharedPt"}, fMinFractionShared, false);
158  std::string hadronBiasStr = "";
159  baseName = "jets";
160  res = fYAMLConfig.GetProperty({baseName, "leadingHadronBiasType"}, hadronBiasStr, false);
161  // Only attempt to set the property if it is retrieved successfully
162  if (res) {
164  }
165 }
166 
171 {
172  std::string baseName = "jets";
173  std::vector <std::string> jetNames = {"hybridLevelJets", "detLevelJets", "partLevelJets", "analysisJets"};
174  for (const auto & jetName : jetNames) {
175  // Retrieve the node just to see if it is exists. If so, then we can proceed
176  YAML::Node node;
177  bool res = fYAMLConfig.GetProperty(std::vector<std::string>({baseName, jetName}), node, false);
178  if (res) {
179  // Retrieve jet container properties
180  std::string collectionName = "", acceptance = "";
181  double R = -1;
182  fYAMLConfig.GetProperty({baseName, jetName, "collection"}, collectionName, true);
183  fYAMLConfig.GetProperty({baseName, jetName, "acceptance"}, acceptance, true);
184  fYAMLConfig.GetProperty({baseName, jetName, "R"}, R, true);
185 
186  // Create jet container and set the name
187  AliDebugStream(1) << "Creating jet from jet collection name " << collectionName << " with acceptance " << acceptance << " and R=" << R << "\n";
188  AliJetContainer * jetCont = AddJetContainer(collectionName.c_str(), acceptance.c_str(), R);
189  jetCont->SetName(jetName.c_str());
190 
191  // Leading hadron type
192  int leadingHadronType = -1;
193  bool res = fYAMLConfig.GetProperty({baseName, jetName, "leadingHadronType"}, leadingHadronType, false);
194  if (res) {
195  AliDebugStream(1) << "Setting leading hadron type of " << leadingHadronType << " for jet cont " << jetName << "\n";
196  jetCont->SetLeadingHadronType(leadingHadronType);
197  }
198  }
199  else {
200  AliInfoStream() << "Unable to find definition of jet container corresponding to \"" << jetName << "\"\n";
201  }
202  }
203 }
204 
209 {
211 
212  // Ensure that we have at least one configuration in the YAML config.
213  if (fYAMLConfig.DoesConfigurationExist(0) == false) {
214  // No configurations exist. Return immediately.
216  }
217 
218  // Always initialize for streaming purposes
220 
221  // Setup task based on the properties defined in the YAML config
222  AliDebugStream(2) << "Configuring task from the YAML configuration.\n";
225  AliDebugStream(2) << "Finished configuring via the YAML configuration.\n";
226 
227  if (fUseAliEventCuts) {
228  // We use the AliEventCuts version implemented here instead of the one from the base class. The base class
229  // won't work because it is configured well after intialization. So it would be reinitialized with the wrong
230  // settings. So we disable it (to do so, we claim to use the default event selection, even though we will just
231  // ignore it).
233  }
234 
235  // Print the results of the initialization
236  // Print outside of the ALICE Log system to ensure that it is always available!
237  std::cout << *this;
238 
241 }
242 
247 {
248  // First call the base class
250 
251  // Check that the task was initialized
253  AliFatal("Task was not initialized. Please ensure that Initialize() was called!");
254  }
255  // Reinitialize the YAML configuration
257 
258  // Setup AliEventCuts output
259  if (fUseAliEventCuts) {
260  // We use a separate list so the output is separated.
261  auto eventCutsList = new TList();
262  eventCutsList->SetOwner(true);
263  eventCutsList->SetName("EventCuts");
264  fEventCuts.AddQAplotsToList(eventCutsList);
265  fOutput->Add(eventCutsList);
266  }
267 
268  // Create histograms
269  if (fCreateQAHists) {
270  SetupQAHists();
271  }
272  if (fCreateResponseMatrix) {
274  }
275 
276  // Store hist manager output in the output list
277  TIter next(fHistManager.GetListOfHistograms());
278  TObject* obj = 0;
279  while ((obj = next())) {
280  fOutput->Add(obj);
281  }
282 
283  // Initialize
285  if (embeddingHelper) {
286  bool res = fEmbeddingQA.Initialize();
287  if (res) {
289  }
290  }
291 
292  // Post the data when finished
293  PostData(1, fOutput);
294 }
295 
300 {
301  // Cell level QA
302  auto embeddingInstance = AliAnalysisTaskEmcalEmbeddingHelper::GetInstance();
303  if (embeddingInstance) {
304  std::string name = "QA/embedding/cells/fHistCellTime";
305  std::string title = name + ";E_{time} (s);counts";
306  fHistManager.CreateTH1(name.c_str(), title.c_str(), 1000, -10e-6, 10e-6);
307  }
308 
309  // Clusters
310  AliEmcalContainer* cont = 0;
311  TIter nextClusColl(&fClusterCollArray);
312  while ((cont = static_cast<AliClusterContainer*>(nextClusColl()))) {
313  // Cluster time vs energy
314  std::string name = "QA/%s/fHistClusterEnergyVsTime";
315  std::string title = name + ";E_{cluster} (GeV);t_{cluster} (s)";
316  fHistManager.CreateTH2(TString::Format(name.c_str(), cont->GetName()), TString::Format(title.c_str(), cont->GetName()), 1000, 0, 100, 300, -300e-9, 300e-9);
317  }
318 
319  // Jets
320  TIter nextJetColl(&fJetCollArray);
321  while ((cont = static_cast<AliJetContainer*>(nextJetColl()))) {
322  // Jet pT
323  std::string name = "QA/%s/fHistJetPt";
324  std::string title = name + ";p_{T} (GeV)";
325  fHistManager.CreateTH1(TString::Format(name.c_str(), cont->GetName()), TString::Format(title.c_str(), cont->GetName()), 500, 0, 250);
326  }
327 }
328 
333 {
334  // Main response matrix THnSparse
335  std::string name = "response/fHistResponseMatrix";
336  std::string title = name;
337 
338  // Retrieve binning from the YAML configuration
339  std::vector<TAxis *> binning;
340  // This structure is designed to preserve the order of the axis in the YAML by using a YAML sequence (decoded into
341  // a vector), while defining a pair of the axis name and axis limts. Using this structure avoids the need to create
342  // a new object and conversion to retrieve the data
343  std::vector<std::pair<std::string, std::vector<double>>> sparseAxes;
344  std::string baseName = "responseMatrix";
345  fYAMLConfig.GetProperty({baseName, "axes"}, sparseAxes, true);
346  for (auto axis : sparseAxes) {
347  auto axisLimits = axis.second;
348  AliDebugStream(3) << "Creating axis " << axis.first << " with nBins " << axisLimits.at(0) << ", min: " << axisLimits.at(1) << ", max: " << axisLimits.at(2) << "\n";
349  binning.emplace_back(new TAxis(axisLimits.at(0), axisLimits.at(1), axisLimits.at(2)));
350  }
351 
352  // "s" ensures that Sumw2() is called
353  // The explicit const_cast is required
354  THnSparse * hist = fHistManager.CreateTHnSparse(name.c_str(), title.c_str(), binning.size(), const_cast<const TAxis **>(binning.data()), "s");
355  // Set the axis titles
356  int axisNumber = 0;
357  for (auto axis = sparseAxes.begin(); axis != sparseAxes.end(); axis++) {
358  AliDebugStream(5) << "ResponseMatrix: Add axis " << axis->first << " to sparse\n";
359  hist->GetAxis(axisNumber)->SetTitle(axis->first.c_str());
360  axisNumber++;
361  }
362 
363  // Define mapping from value name to value (including jet information)
364  for (unsigned int iJet = 1; iJet < 3; iJet++)
365  {
366  // pt
367  // ex: p_{T,1}
368  fResponseMatrixFillMap.insert(std::make_pair(std::string("p_{T,") + std::to_string(iJet) + "}", std::make_pair(iJet, &ResponseMatrixFillWrapper::fPt)));
369  // Area
370  // ex: A_{jet,1}
371  fResponseMatrixFillMap.insert(std::make_pair(std::string("A_{jet,") + std::to_string(iJet) + "}", std::make_pair(iJet, &ResponseMatrixFillWrapper::fArea)));
372  // EP angle
373  // ex: #theta_{jet,1}^{EP}
374  fResponseMatrixFillMap.insert(std::make_pair(std::string("#theta_{jet,") + std::to_string(iJet) + "}^{EP}", std::make_pair(iJet, &ResponseMatrixFillWrapper::fRelativeEPAngle)));
375  // Leading hadron
376  // ex: p_{T,particle,1}^{leading} (GeV/c)
377  fResponseMatrixFillMap.insert(std::make_pair(std::string("p_{T,particle,") + std::to_string(iJet) + "}^{leading} (GeV/c)", std::make_pair(iJet, &ResponseMatrixFillWrapper::fLeadingHadronPt)));
378  }
379  // Distance from one jet to another
380  fResponseMatrixFillMap.insert(std::make_pair("distance", std::make_pair(1, &ResponseMatrixFillWrapper::fDistance)) );
381  // Centrality
382  fResponseMatrixFillMap.insert(std::make_pair("centrality", std::make_pair(1, &ResponseMatrixFillWrapper::fCentrality)) );
383 
384  // Shared momentum fraction
385  name = "fHistFractionSharedPt";
386  title = "Fraction of p_{T} shared between matched jets";
387  // Need to include the bin from 1-1.01 to ensure that jets which shared all of their momentum
388  // due not end up in the overflow bin!
389  fHistManager.CreateTH1(name.c_str(), title.c_str(), 101, 0, 1.01);
390 }
391 
396 {
397  if (fUseAliEventCuts) {
398  if (!fEventCuts.AcceptEvent(InputEvent())) {
399  PostData(1, fOutput);
400  return kFALSE;
401  }
402  }
403  else {
405  }
406  // The event was accepted by AliEventCuts, so we return true.
407  return kTRUE;
408 }
409 
414 {
415  // Only fill the embedding qa plots if:
416  // - We are using the embedding helper
417  // - The class has been initialized
418  if (fEmbeddingQA.IsInitialized()) {
420  }
421 
422  if (fCreateQAHists) {
423  QAHists();
424  }
425  if (fCreateResponseMatrix) {
426  ResponseMatrix();
427  }
428 
429  return kTRUE;
430 }
431 
436 {
437  // No additional processing is necessary
438  // Continue on to filling the histograms
439  FillQAHists();
440 }
441 
446 {
447  // Embedded cells
448  // Need to be retrieved manually since the base class only retrieves the cells in the internal event.
449  auto embeddingInstance = AliAnalysisTaskEmcalEmbeddingHelper::GetInstance();
450  if (embeddingInstance) {
451  auto embeddedCells = dynamic_cast<AliVCaloCells*>(
452  embeddingInstance->GetExternalEvent()->FindListObject(fEmbeddedCellsName.c_str()));
453  if (embeddedCells) {
454  AliDebugStream(4) << "Found embedded cells. N cells:" << embeddedCells->GetNumberOfCells() << "\n";
455  short absId = -1;
456  double eCell = 0;
457  double tCell = 0;
458  double eFrac = 0;
459  int mcLabel = -1;
460 
461  std::string histName = "QA/embedding/cells/fHistCellTime";
462  for (unsigned int iCell = 0; iCell < embeddedCells->GetNumberOfCells(); iCell++) {
463  embeddedCells->GetCell(iCell, absId, eCell, tCell, mcLabel, eFrac);
464 
465  AliDebugStream(5) << "Cell " << iCell << ": absId: " << absId << ", E: " << eCell << ", t: " << tCell
466  << ", mcLabel: " << mcLabel << ", eFrac: " << eFrac << "\n";
467  fHistManager.FillTH1(histName.c_str(), tCell);
468  }
469  }
470  }
471 
472  // Clusters
473  AliClusterContainer* clusCont = 0;
474  TIter nextClusColl(&fClusterCollArray);
475  AliVCluster * cluster = 0;
476  while ((clusCont = static_cast<AliClusterContainer*>(nextClusColl()))) {
477  for (auto clusIter : clusCont->accepted_momentum())
478  {
479  cluster = clusIter.second;
480  // Intentionally plotting against raw energy
481  fHistManager.FillTH2(TString::Format("QA/%s/fHistClusterEnergyVsTime", clusCont->GetName()), cluster->E(), cluster->GetTOF());
482  }
483  }
484 
485  // Jets
486  AliJetContainer * jetCont = 0;
487  TIter nextJetColl(&fJetCollArray);
488  while ((jetCont = static_cast<AliJetContainer*>(nextJetColl()))) {
489  for (auto jet : jetCont->accepted())
490  {
491  fHistManager.FillTH1(TString::Format("QA/%s/fHistJetPt", jetCont->GetName()), jet->Pt());
492  }
493  }
494 }
495 
500 {
501  AliJetContainer * jetsHybrid = GetJetContainer("hybridLevelJets");
502  AliJetContainer * jetsDetLevel = GetJetContainer("detLevelJets");
503  AliJetContainer * jetsPartLevel = GetJetContainer("partLevelJets");
504  if (!jetsHybrid) {
505  AliErrorStream() << "Could not retrieve hybrid jet collection.\n";
506  return;
507  }
508  if (!jetsDetLevel) {
509  AliErrorStream() << "Could not retrieve det level jet collection.\n";
510  return;
511  }
512  if (fResponseFromThreeJetCollections && !jetsPartLevel) {
513  AliErrorStream() << "Could not retrieve part level jet collection.\n";
514  return;
515  }
516 
517  // Handle matching of jets.
518  for (auto jet1 : jetsHybrid->accepted())
519  {
520  // Get jet the det level jet from the hybrid jet
521  AliEmcalJet * jet2 = jet1->ClosestJet();
522  if(!jet2) continue;
523 
524  AliDebugStream(4) << "jet2: " << jet2->toString() << "\n";
525 
526  // Check shared fraction
527  double sharedFraction = jetsHybrid->GetFractionSharedPt(jet1);
528  fHistManager.FillTH1("fHistFractionSharedPt", sharedFraction);
529  if (sharedFraction < fMinFractionShared) {
530  AliDebugStream(4) << "Rejecting jet due to momentum fraction of " << sharedFraction << ", smaller than the minimum.\n";
531  continue;
532  }
533  else {
534  AliDebugStream(4) << "Jet passed momentum fraction cut with value of " << sharedFraction << "\n";
535  }
536 
537  // Apply additional selection to jet 2
538  // TODO: Should we apply acceptance criteria to jet 2 here?
539 
540  // Get MC level jet
541  AliEmcalJet * jetToPass = 0;
543  AliEmcalJet * jet3 = jet2->ClosestJet();
544 
545  // Accept jet 3
546  UInt_t rejectionReason = 0;
547  if (!jetsPartLevel->AcceptJet(jet3, rejectionReason)) {
548  // TODO: Store rejection reasons
549  //fHistRejectionReason2->Fill(jets2->GetRejectionReasonBitPosition(rejectionReason), jet2->Pt());
550  continue;
551  }
552 
553  AliDebugStream(4) << "jet3: " << jet3->toString() << "\n";
554 
555  // Use for the response
556  AliDebugStream(4) << "Using part level jet for response\n";
557  jetToPass = jet3;
558  }
559  else {
560  // Use for the response
561  AliDebugStream(4) << "Using det level jet for response\n";
562  jetToPass = jet2;
563  }
564 
565  // Fill response
566  FillResponseMatrix(jet1, jetToPass);
567  }
568 
569 }
570 
575 {
576  if (!jet1 || !jet2) {
577  AliErrorStream() << "Null jet passed to fill response matrix";
578  }
579 
580  AliDebugStream(3) << "About to create ResponseMatrixFillWrappers\n";
581  AliDebugStream(4) << "jet1: " << jet1->toString() << "\n";
582  AliDebugStream(4) << "jet2: " << jet2->toString() << "\n";
583  // Create map from jetNumber to jet and initialize the objects
584  std::map<unsigned int, ResponseMatrixFillWrapper> jetNumberToJet = {
585  std::make_pair(1, CreateResponseMatrixFillWrapper(jet1)),
586  std::make_pair(2, CreateResponseMatrixFillWrapper(jet2))
587  };
588 
589  // Fill histograms
590  std::string histName = "response/fHistResponseMatrix";
591  std::vector<double> values;
592  THnSparse * response = static_cast<THnSparse*>(fHistManager.FindObject(histName.c_str()));
593  AliDebugStream(3) << "About to fill response matrix values\n";
594  AliDebugStream(4) << "jet1: " << jet1->toString() << "\n";
595  AliDebugStream(4) << "jet2: " << jet2->toString() << "\n";
596  for (unsigned int i = 0; i < response->GetNdimensions(); i++) {
597  std::string title = response->GetAxis(i)->GetTitle();
598 
599  // Retrieve pair of jet and pointer to extract the fill value
600  auto jetPair = fResponseMatrixFillMap.find(title);
601  if (jetPair != fResponseMatrixFillMap.end()) {
602  auto wrapper = jetNumberToJet.at(jetPair->second.first);
603  auto member = jetPair->second.second;
604  AliDebugStream(4) << "Filling value " << wrapper.*member << " into axis " << title << "\n";
605  values.emplace_back(wrapper.*member);
606  }
607  else {
608  AliWarningStream() << "Unable to fill dimension " << title << "!\n";
609  }
610  }
611 
612  fHistManager.FillTHnSparse(histName.c_str(), values.data());
613 }
614 
619 {
621  if (!jet) {
622  AliErrorStream() << "Must pass valid jet to create object.\n";
623  return wrapper;
624  }
625  wrapper.fPt = jet->Pt();
626  wrapper.fArea = jet->Area();
627  wrapper.fPhi = jet->Phi();
628  wrapper.fDistance = jet->ClosestJetDistance();
629  wrapper.fCentrality = fCent;
632 
633  return wrapper;
634 }
635 
642 {
643  // Get the pointer to the existing analysis manager via the static access method.
644  //==============================================================================
645  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
646  if (!mgr)
647  {
648  AliErrorClass("No analysis manager to connect to.");
649  return nullptr;
650  }
651 
652  // Setup task name
653  std::string taskName = "AliAnalysisTaskEmcalJetHPerformance";
654  std::string suffixName(suffix);
655  if (suffixName != "") {
656  taskName += "_";
657  taskName += suffixName;
658  }
659 
660  // Create task and configure as desired.
662  // Set a few general default.
663  task->SetNCentBins(5);
664  // Configuration is via YAML.
665  mgr->AddTask(task);
666 
667  // Create containers for input/output
668  mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer() );
669  AliAnalysisDataContainer * outputContainer = mgr->CreateContainer(task->GetName(),
670  TList::Class(),
671  AliAnalysisManager::kOutputContainer,
672  Form("%s", AliAnalysisManager::GetCommonFileName()));
673  mgr->ConnectOutput(task, 1, outputContainer);
674 
675  return task;
676 }
677 
684 {
685  std::stringstream tempSS;
686  tempSS << std::boolalpha;
687  tempSS << "Recycle unused embedded events: " << fRecycleUnusedEmbeddedEventsMode << "\n";
688  tempSS << "Jet collections:\n";
689  TIter next(&fJetCollArray);
690  AliJetContainer * jetCont;
691  while ((jetCont = static_cast<AliJetContainer *>(next()))) {
692  tempSS << "\t" << jetCont->GetName() << ": " << jetCont->GetArrayName() << "\n";
693  }
694  tempSS << "AliEventCuts\n";
695  tempSS << "\tEnabled: " << fUseAliEventCuts << "\n";
696  // AliEventCuts in the base class needs to be __disabled__ because the implementation isn't compatible with how it's implemented here.
697  tempSS << "\tUse AliAnalysisTaskEmcal event selection (needs to be enabled to use AliEventCuts): " << fUseBuiltinEventSelection << "\n";
698  tempSS << "QA Hists:\n";
699  tempSS << "\tEnabled: " << fCreateQAHists << "\n";
700  tempSS << "Response matrix:\n";
701  tempSS << "\tEnabled: " << fCreateResponseMatrix << "\n";
702  tempSS << "\tConstruct response from 3 jet collections: " << fResponseFromThreeJetCollections << "\n";
703  tempSS << "\tMin fraction shared pt: " << fMinFractionShared << "\n";
704  tempSS << "\tJet leading hadron bias type: " << fLeadingHadronBiasType << "\n";
705  tempSS << "\tResponse matrix fill map: \n";
706  for (auto el : fResponseMatrixFillMap) {
707  tempSS << "\t\tProperty " << el.first << " applied to jet " << el.second.first << "\n";
708  }
709 
710  return tempSS.str();
711 }
712 
719 std::ostream & AliAnalysisTaskEmcalJetHPerformance::Print(std::ostream & in) const {
720  in << toString();
721  return in;
722 }
723 
731 {
732  Printf("%s", toString().c_str());
733 }
734 
735 } /* namespace EMCALJetTasks */
736 } /* namespace PWGJE */
737 
745 std::ostream & operator<<(std::ostream & in, const PWGJE::EMCALJetTasks::AliAnalysisTaskEmcalJetHPerformance & myTask)
746 {
747  std::ostream & result = myTask.Print(in);
748  return result;
749 }
750 
757 {
758  using std::swap;
759 
760  // Same ordering as in the constructors (for consistency)
761  swap(first.fYAMLConfig, second.fYAMLConfig);
763  //swap(first.fEventCuts, second.fEventCuts); // Skip here, because the AliEventCuts copy constructor is private.
764  //swap(first.fHistManager, second.fHistManager); // Skip here, because the THistManager copy constructor is private.
765  //swap(first.fEmbeddingQA, second.fEmbeddingQA); // Skip here, because the THistManager copy constructor is private.
766  swap(first.fUseAliEventCuts, second.fUseAliEventCuts);
767  swap(first.fCreateQAHists, second.fCreateQAHists);
774 }
Double_t Area() const
Definition: AliEmcalJet.h:130
TObjArray fClusterCollArray
cluster collection array
bool fResponseFromThreeJetCollections
If true, the det level jets in collection 2 are only an intermediate step. They are used to get part ...
void SetUseInternalEventSelection(Bool_t doUse)
Use internal (old) event selection.
const char * title
Definition: MakeQAPdf.C:27
AliEmcalJet * ClosestJet() const
Definition: AliEmcalJet.h:327
AliJetContainer * GetJetContainer(Int_t i=0) const
std::map< std::string, std::pair< int, double ResponseMatrixFillWrapper::* > > fResponseMatrixFillMap
! Map from axis title to pair of (jet number, function to retrieve fill value)
Double_t ClosestJetDistance() const
Definition: AliEmcalJet.h:328
const AliClusterIterableMomentumContainer accepted_momentum() const
Bool_t fRecycleUnusedEmbeddedEventsMode
Allows the recycling of embedded events which fail internal event selection. See the embedding helper...
void SetLeadingHadronType(Int_t t)
Double_t Phi() const
Definition: AliEmcalJet.h:117
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
Fill a 2D histogram within the container.
double fCentrality
! Centrality of the given jet (an event level property, but useful to here available here) ...
Double_t fEPV0
!event plane V0
Declaration of class AliAnalysisTaskEmcalEmbeddingHelper.
virtual Bool_t AcceptJet(Int_t i, UInt_t &rejectionReason) const
AliJetContainer * AddJetContainer(const char *n, TString defaultCutType, Float_t jetRadius=0.4)
AliAnalysisTaskEmcalJetHPerformance & operator=(AliAnalysisTaskEmcalJetHPerformance other)
bool GetProperty(std::vector< std::string > propertyPath, const std::string &propertyName, T &property, const bool requiredProperty) const
AliEmcalEmbeddingQA fEmbeddingQA
! Embedding QA hists (will only be added if embedding).
void SetObject(TObject *const o, const char *group="/")
Set a new group into the container into the parent group.
ResponseMatrixFillWrapper CreateResponseMatrixFillWrapper(AliEmcalJet *jet) const
PWG::Tools::AliYAMLConfiguration fYAMLConfig
YAML configuration file.
bool fCreateResponseMatrix
If true, create a response matrix with the available jet collections.
Bool_t fUseBuiltinEventSelection
Use builtin event selection of the AliAnalysisTaskEmcal instead of AliEventCuts.
bool DoesConfigurationExist(const int i) const
bool AddQAPlotsToList(TList *list)
std::string fEmbeddedCellsName
Set the embedded cells collection name.
AliAnalysisTaskEmcalJetHUtils::ELeadingHadronBiasType_t fLeadingHadronBiasType
Leading hadron in jet bias type (either charged, neutral, or both)
static void ConfigureEventCuts(AliEventCuts &eventCuts, PWG::Tools::AliYAMLConfiguration &yamlConfig, const UInt_t offlineTriggerMask, const std::string &baseName, const std::string &taskName)
void FillTHnSparse(const char *name, const double *x, double weight=1., Option_t *opt="")
bool IsInitialized() const
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.
static UInt_t DeterminePhysicsSelectionFromYAML(const std::vector< std::string > &selections)
TObject * FindObject(const char *name) const
Find an object inside the container.
bool fConfigurationInitialized
True if the task configuration has been successfully initialized.
unsigned int UInt_t
Definition: External.C:33
THashList * GetListOfHistograms() const
Get the list of histograms.
Definition: THistManager.h:671
AliEventCuts fEventCuts
AliEventCuts to handle event selection.
Implementation of task to embed external events.
TString toString() 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.
Int_t fNcentBins
how many centrality bins
Double_t fCent
!event centrality
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
static AliAnalysisTaskEmcalJetHPerformance * AddTaskEmcalJetHPerformance(const char *suffix="")
static double RelativeEPAngle(double jetAngle, double epAngle)
TObjArray fJetCollArray
jet collection array
virtual void SetNCentBins(Int_t n)
static double GetLeadingHadronPt(AliEmcalJet *jet, ELeadingHadronBiasType_t leadingHadronType)
Double_t Pt() const
Definition: AliEmcalJet.h:109
virtual Bool_t IsEventSelected()
Performing event selection.
AliEmcalList * fOutput
!output list
void SetMakeGeneralHistograms(Bool_t g)
Base task in the EMCAL jet framework.
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:51
Double_t GetFractionSharedPt(const AliEmcalJet *jet, AliParticleContainer *cont2=0x0) const
const char Option_t
Definition: External.C:48
void UserCreateOutputObjects()
Main initialization function on the worker.
const AliJetIterableContainer accepted() const
bool Bool_t
Definition: External.C:53
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 swap(PWGJE::EMCALJetTasks::AliAnalysisTaskEmcalJetHPerformance &first, PWGJE::EMCALJetTasks::AliAnalysisTaskEmcalJetHPerformance &second)
double fMinFractionShared
Minimum fraction of shared jet pt required for matching a hybrid jet to detector level.
bool fUseAliEventCuts
If true, use AliEventCuts for event selection instead of IsEventSelected.
Container for jet within the EMCAL jet framework.
static const std::map< std::string, ELeadingHadronBiasType_t > fgkLeadingHadronBiasMap
! Map from name to leading hadron bias used with the YAML config
friend std::ostream & operator<<(std::ostream &in, const AliAnalysisTaskEmcalJetHPerformance &myTask)
static const AliAnalysisTaskEmcalEmbeddingHelper * GetInstance()