AliPhysics  15d9304 (15d9304)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliEmcalEmbeddingQA.cxx
Go to the documentation of this file.
1 
6 #include <TString.h>
7 #include <TList.h>
8 
9 #include <AliLog.h>
10 
12 #include "AliEmcalEmbeddingQA.h"
13 
17 
22  fInitialized(false),
23  fHistManager("AliEmcalEmbeddingQA")
24 {
25 }
26 
33 {
34  if (fInitialized) {
35  AliError("QA histograms are already initialized!");
36  return fInitialized;
37  }
38 
39  // Create histograms
40  // Determine and define properties to create the histograms
42  if (!embeddingHelper) {
43  AliError("The embedding helper is not available!");
44  return fInitialized;
45  }
46  TString histName;
47  TString histTitle;
48  // Extract the value from embedding helper for convenience
49  int nPtHardBins = embeddingHelper->GetNPtHardBins();
50 
51  // Cross section
52  histName = "fHistXsectionAfterSel";
53  histTitle = "Pythia Cross Section After Event Selection;p_{T} hard bin; XSection";
54  fHistManager.CreateTProfile(histName, histTitle, nPtHardBins, 0, nPtHardBins);
55 
56  // Trials
57  histName = "fHistTrialsAfterSel";
58  histTitle = "Number of Pythia Trials After Event Selecdtion;p_{T} hard bin;Trials";
59  fHistManager.CreateTH1(histName, histTitle, nPtHardBins, 0, nPtHardBins);
60 
61  // Pt hard spectra
62  histName = "fHistPtHardAfterSel";
63  histTitle = "p_{T} Hard Spectra After Event Selection;p_{T} hard;Counts";
64  fHistManager.CreateTH1(histName, histTitle, 500, 0, 1000);
65 
66  fInitialized = true;
67  return fInitialized;
68 }
69 
76 {
77  if (!list) {
78  AliError("Output list is null!");
79  return false;
80  }
81 
82  if (!fInitialized) {
83  AliWarning("Embedding QA histograms are not initialized! Attempting to initialize...");
84  bool res = Initialize();
85  if (!fInitialized) {
86  AliFatal("Unable to initialize the embedding QA hists!");
87  // No need to return here, as it will crash anyway
88  }
89  }
90 
91  // Add all histograms to output list
92  TIter next(fHistManager.GetListOfHistograms());
93  TObject* obj = 0;
94  while ((obj = next())) {
95  list->Add(obj);
96  }
97 
98  return true;
99 }
100 
106 {
108  double ptHardBin = embeddingHelper->GetPtHardBin();
109 
110  // Fill trials, xsec, pt hard
111  fHistManager.FillTH1("fHistTrialsAfterSel", ptHardBin, embeddingHelper->GetPythiaTrials());
112  fHistManager.FillProfile("fHistXsectionAfterSel", ptHardBin, embeddingHelper->GetPythiaXSection());
113  fHistManager.FillTH1("fHistPtHardAfterSel", embeddingHelper->GetPythiaPtHard());
114 }
115 
TList * list
TDirectory file where lists per trigger are stored in train ouput.
Declaration of class AliAnalysisTaskEmcalEmbeddingHelper.
QA Class for EMCal Embedding Framework.
bool AddQAPlotsToList(TList *list)
bool fInitialized
Notes whether the QA hists have been created.
void CreateTProfile(const char *name, const char *title, int nbinsX, double xmin, double xmax, Option_t *opt="")
Create a new TProfile within the container.
THashList * GetListOfHistograms() const
Get the list of histograms.
Definition: THistManager.h:671
Implementation of task to embed external events.
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Create a new TH1 within the container.
void FillProfile(const char *name, double x, double y, double weight=1.)
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
THistManager fHistManager
Hist manager.
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
static const AliAnalysisTaskEmcalEmbeddingHelper * GetInstance()