AliPhysics  vAN-20150425 (2dcf1b0)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AliEMCalTriggerEventCounterAnalysisComponent.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 #include <map>
16 #include <string>
17 
18 #include "AliVEvent.h"
19 #include "AliVVertex.h"
20 
24 #include "AliEMCalHistoContainer.h"
26 
30 
31 namespace EMCalTriggerPtAnalysis {
32 
36 AliEMCalTriggerEventCounterAnalysisComponent::AliEMCalTriggerEventCounterAnalysisComponent():
38  fTriggerMethod(kTriggerString)
39 {
40 }
41 
47  fTriggerMethod(kTriggerString)
48 {
49 }
50 
56 
57  // Create trigger definitions
58  std::map<std::string, std::string> triggerCombinations;
59  const char *triggernames[11] = {"MinBias", "EMCJHigh", "EMCJLow", "EMCGHigh",
60  "EMCGLow", "EMCHighBoth", "EMCHighGammaOnly", "EMCHighJetOnly",
61  "EMCLowBoth", "EMCLowGammaOnly", "EMCLowJetOnly"};
62  // Define names and titles for different triggers in the histogram container
63  triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[0], "min. bias events"));
64  triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[1], "jet-triggered events (high threshold)"));
65  triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[2], "jet-triggered events (low threshold)"));
66  triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[3], "gamma-triggered events (high threshold)"));
67  triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[4], "gamma-triggered events (low threshold)"));
68  triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[5], "jet and gamma triggered events (high threshold)"));
69  triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[6], "exclusively gamma-triggered events (high threshold)"));
70  triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[7], "exclusively jet-triggered events (high threshold)"));
71  triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[8], "jet and gamma triggered events (low threshold)"));
72  triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[9], "exclusively gamma-triggered events (low threshold)"));
73  triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[10], "exclusively-triggered events (low threshold)"));
74 
75  AliEMCalTriggerBinningDimension *vertexbinning = fBinning->GetBinning("zvertex");
76 
77  for(std::map<std::string,std::string>::iterator it = triggerCombinations.begin(); it != triggerCombinations.end(); ++it){
78  const std::string name = it->first, &title = it->second;
79  // Create event-based histogram
80  fHistos->CreateTH1(Form("hEventHist%s", name.c_str()), Form("Event-based data for %s events; pileup rejection; z_{V} (cm)", title.c_str()), vertexbinning->GetNumberOfBins(), vertexbinning->GetBinLimits());
81  }
82 
83  // Make correlation histogram for different trigger classes
84  const TAxis *triggeraxis[5]; memset(triggeraxis, 0, sizeof(const TAxis *) * 5);
85  const char *binlabels[2] = {"OFF", "ON"};
86  TAxis mytrgaxis[5];
87  for(int itrg = 0; itrg < 5; ++itrg){
88  DefineAxis(mytrgaxis[itrg], triggernames[itrg], triggernames[itrg], 2, -0.5, 1.5, binlabels);
89  triggeraxis[itrg] = mytrgaxis+itrg;
90  }
91  fHistos->CreateTHnSparse("hEventTriggers", "Trigger type per event", 5, triggeraxis);
92 }
93 
100  if(!fTriggerDecision) return;
101 
102  double vz = data->GetRecEvent()->GetPrimaryVertex()->GetZ();
103  double triggerCorrelation[5]; memset(triggerCorrelation, 0, sizeof(double) * 5);
104 
105  if(fComponentDebugLevel > 2)
107 
109  triggerCorrelation[0] = 1.;
110  fHistos->FillTH1("hEventHistMinBias", vz);
111  }
113  triggerCorrelation[2] = 1.;
114  fHistos->FillTH1("hEventHistEMCJHigh", vz);
115  // Check whether also the gamma high-threshold trigger fired
117  fHistos->FillTH1("hEventHistEMCHighBoth", vz);
118  } else {
119  fHistos->FillTH1("hEventHistEMCHighJetOnly", vz);
120  }
121  }
123  triggerCorrelation[1] = 1.;
124  fHistos->FillTH1("hEventHistEMCJLow", vz);
125  // Check whether also the gamma high-threshold trigger fired
127  fHistos->FillTH1("hEventHistEMCLowBoth", vz);
128  } else {
129  fHistos->FillTH1("hEventHistEMCLowJetOnly", vz);
130  }
131  }
133  triggerCorrelation[3] = 1.;
134  fHistos->FillTH1("hEventHistEMCGHigh", vz);
136  fHistos->FillTH1("hEventHistEMCHighGammaOnly", vz);
137  }
139  triggerCorrelation[4] = 1.;
140  fHistos->FillTH1("hEventHistEMCGLow", vz);
142  fHistos->FillTH1("hEventHistEMCLowGammaOnly", vz);
143  }
144 
145  fHistos->FillTHnSparse("hEventTriggers", triggerCorrelation);
146 }
147 
160  const char* title, int nbins, double min, double max,
161  const char** labels) const {
162  axis.Set(nbins, min, max);
163  axis.SetName(name);
164  axis.SetTitle(title);
165  if(labels){
166  for(int ib = 1; ib <= axis.GetNbins(); ++ib)
167  axis.SetBinLabel(ib, labels[ib-1]);
168  }
169 }
170 
171 } /* namespace EMCalTriggerPtAnalysis */
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
Declaration of class AliEMCalTriggerAnaTriggerDecision, a container for trigger decision in EMCAL-tri...
void CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
void FillTHnSparse(const char *name, const double *x, double weight=1.)
Bool_t IsTriggered(ETATriggerType trigger, ETriggerMethod_t method=kTriggerString) const
void CreateTHnSparse(const char *name, const char *title, int ndim, const int *nbins, const double *min, const double *max, Option_t *opt="")
Declarartion of class AliEMCalHistoContainer.
AliEMCalHistoContainer * fHistos
Histogram container of the analysis component.
const AliEMCalTriggerAnaTriggerDecision * fTriggerDecision
Trigger decision handler.
AliEMCalTriggerBinningDimension * GetBinning(const char *name) const
Base class for analysis components in the analysis of EMCAL-triggered events.
Declaration of the classes AliEMCalTriggerBinningComponent and AliEMCalTriggerBinningDimension.
void FillTH1(const char *hname, double x, double weight=1.)
void DefineAxis(TAxis &axis, const char *name, const char *title, int nbins, double min, double max, const char **labels) const
const AliEMCalTriggerBinningComponent * fBinning
Global binning handler.