1 /**************************************************************************
2 * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 * Analysis component counting events for different trigger classes. Task needs
17 * to be grouped with a global event selection
19 * Author: Markus Fasel
24 #include "AliVEvent.h"
25 #include "AliVVertex.h"
27 #include "AliEMCalTriggerAnaTriggerDecision.h"
28 #include "AliEMCalTriggerBinningComponent.h"
29 #include "AliEMCalTriggerEventData.h"
30 #include "AliEMCalHistoContainer.h"
31 #include "AliEMCalTriggerEventCounterAnalysisComponent.h"
33 ClassImp(EMCalTriggerPtAnalysis::AliEMCalTriggerEventCounterAnalysisComponent)
35 namespace EMCalTriggerPtAnalysis {
37 //______________________________________________________________________________
38 AliEMCalTriggerEventCounterAnalysisComponent::AliEMCalTriggerEventCounterAnalysisComponent():
39 AliEMCalTriggerTracksAnalysisComponent(),
43 * Default (I/O) constructor, not to be used
47 //______________________________________________________________________________
48 AliEMCalTriggerEventCounterAnalysisComponent::AliEMCalTriggerEventCounterAnalysisComponent(const char *name):
49 AliEMCalTriggerTracksAnalysisComponent(name),
57 //______________________________________________________________________________
58 void AliEMCalTriggerEventCounterAnalysisComponent::CreateHistos() {
60 * Create event counter histograms
62 AliEMCalTriggerTracksAnalysisComponent::CreateHistos();
64 // Create trigger definitions
65 std::map<std::string, std::string> triggerCombinations;
66 const char *triggernames[11] = {"MinBias", "EMCJHigh", "EMCJLow", "EMCGHigh",
67 "EMCGLow", "EMCHighBoth", "EMCHighGammaOnly", "EMCHighJetOnly",
68 "EMCLowBoth", "EMCLowGammaOnly", "EMCLowJetOnly"};
69 // Define names and titles for different triggers in the histogram container
70 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[0], "min. bias events"));
71 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[1], "jet-triggered events (high threshold)"));
72 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[2], "jet-triggered events (low threshold)"));
73 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[3], "gamma-triggered events (high threshold)"));
74 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[4], "gamma-triggered events (low threshold)"));
75 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[5], "jet and gamma triggered events (high threshold)"));
76 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[6], "exclusively gamma-triggered events (high threshold)"));
77 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[7], "exclusively jet-triggered events (high threshold)"));
78 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[8], "jet and gamma triggered events (low threshold)"));
79 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[9], "exclusively gamma-triggered events (low threshold)"));
80 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[10], "exclusively-triggered events (low threshold)"));
82 AliEMCalTriggerBinningDimension *vertexbinning = fBinning->GetBinning("zvertex");
84 for(std::map<std::string,std::string>::iterator it = triggerCombinations.begin(); it != triggerCombinations.end(); ++it){
85 const std::string name = it->first, &title = it->second;
86 // Create event-based histogram
87 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());
90 // Make correlation histogram for different trigger classes
91 const TAxis *triggeraxis[5]; memset(triggeraxis, 0, sizeof(const TAxis *) * 5);
92 const char *binlabels[2] = {"OFF", "ON"};
94 for(int itrg = 0; itrg < 5; ++itrg){
95 DefineAxis(mytrgaxis[itrg], triggernames[itrg], triggernames[itrg], 2, -0.5, 1.5, binlabels);
96 triggeraxis[itrg] = mytrgaxis+itrg;
98 fHistos->CreateTHnSparse("hEventTriggers", "Trigger type per event", 5, triggeraxis);
101 //______________________________________________________________________________
102 void AliEMCalTriggerEventCounterAnalysisComponent::Process(const AliEMCalTriggerEventData* const data) {
106 if(!fTriggerDecision) return;
108 double vz = data->GetRecEvent()->GetPrimaryVertex()->GetZ();
109 double triggerCorrelation[5]; memset(triggerCorrelation, 0, sizeof(double) * 5);
111 if(fTriggerDecision->IsMinBias()){
112 triggerCorrelation[0] = 1.;
113 fHistos->FillTH1("hEventHistMinBias", vz);
115 if(fTriggerDecision->IsTriggered(AliEMCalTriggerAnaTriggerDecision::kTAEMCJHigh, fUsePatches)){
116 triggerCorrelation[2] = 1.;
117 fHistos->FillTH1("hEventHistEMCJHigh", vz);
118 // Check whether also the gamma high-threshold trigger fired
119 if(fTriggerDecision->IsTriggered(AliEMCalTriggerAnaTriggerDecision::kTAEMCGHigh, fUsePatches)){
120 fHistos->FillTH1("hEventHistEMCHighBoth", vz);
122 fHistos->FillTH1("hEventHistEMCHighJetOnly", vz);
125 if(fTriggerDecision->IsTriggered(AliEMCalTriggerAnaTriggerDecision::kTAEMCJLow, fUsePatches)){
126 triggerCorrelation[1] = 1.;
127 fHistos->FillTH1("hEventHistEMCJLow", vz);
128 // Check whether also the gamma high-threshold trigger fired
129 if(fTriggerDecision->IsTriggered(AliEMCalTriggerAnaTriggerDecision::kTAEMCGLow, fUsePatches)){
130 fHistos->FillTH1("hEventHistEMCLowBoth", vz);
132 fHistos->FillTH1("hEventHistEMCLowJetOnly", vz);
135 if(fTriggerDecision->IsTriggered(AliEMCalTriggerAnaTriggerDecision::kTAEMCGHigh, fUsePatches)){
136 triggerCorrelation[3] = 1.;
137 fHistos->FillTH1("hEventHistEMCGHigh", vz);
138 if(!fTriggerDecision->IsTriggered(AliEMCalTriggerAnaTriggerDecision::kTAEMCJHigh, fUsePatches))
139 fHistos->FillTH1("hEventHistEMCHighGammaOnly", vz);
141 if(fTriggerDecision->IsTriggered(AliEMCalTriggerAnaTriggerDecision::kTAEMCGLow, fUsePatches)){
142 triggerCorrelation[4] = 1.;
143 fHistos->FillTH1("hEventHistEMCGLow", vz);
144 if(!fTriggerDecision->IsTriggered(AliEMCalTriggerAnaTriggerDecision::kTAEMCJLow, fUsePatches))
145 fHistos->FillTH1("hEventHistEMCLowGammaOnly", vz);
148 fHistos->FillTHnSparse("hEventTriggers", triggerCorrelation);
151 //______________________________________________________________________________
152 void AliEMCalTriggerEventCounterAnalysisComponent::DefineAxis(TAxis& axis, const char* name,
153 const char* title, int nbins, double min, double max,
154 const char** labels) const {
156 * Define an axis with number of bins from min to max
158 * @param axis: Axis to be defined
159 * @param name: Name of the axis
160 * @param title: Title of the axis
161 * @param nbins: Number of bins
162 * @param min: lower limit of the axis
163 * @param max: upper limit of the axis
164 * @param labels (@optional): array of bin labels
166 axis.Set(nbins, min, max);
168 axis.SetTitle(title);
170 for(int ib = 1; ib <= axis.GetNbins(); ++ib)
171 axis.SetBinLabel(ib, labels[ib-1]);
175 } /* namespace EMCalTriggerPtAnalysis */