]>
Commit | Line | Data |
---|---|---|
d824c93c | 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 | /* | |
16 | * Analysis component for EMCal clusters. Loops over calibrated and uncalibrated clusters | |
17 | * | |
18 | * Author: Markus Fasel | |
19 | */ | |
20 | #include <map> | |
21 | #include <string> | |
22 | #include <vector> | |
23 | ||
08f5b3a3 | 24 | #include <TAxis.h> |
d824c93c | 25 | #include <TClonesArray.h> |
26 | #include <TLorentzVector.h> | |
27 | ||
bfbaea65 | 28 | #include "AliLog.h" |
d824c93c | 29 | #include "AliVCluster.h" |
30 | #include "AliVEvent.h" | |
31 | ||
d824c93c | 32 | #include "AliEMCalTriggerBinningComponent.h" |
08f5b3a3 | 33 | #include "AliEMCalTriggerAnaTriggerDecision.h" |
d824c93c | 34 | #include "AliEMCalTriggerEventData.h" |
35 | #include "AliEMCalTriggerClusterAnalysisComponent.h" | |
36 | ||
08f5b3a3 | 37 | |
d824c93c | 38 | ClassImp(EMCalTriggerPtAnalysis::AliEMCalTriggerClusterAnalysisComponent) |
39 | ||
40 | namespace EMCalTriggerPtAnalysis { | |
41 | ||
42 | //______________________________________________________________________________ | |
43 | AliEMCalTriggerClusterAnalysisComponent::AliEMCalTriggerClusterAnalysisComponent() : | |
44 | AliEMCalTriggerTracksAnalysisComponent(), | |
45 | fEnergyRange(), | |
46 | fUsePatches(kFALSE) | |
47 | { | |
48 | /* | |
49 | * Dummy (I/O) constructor | |
50 | */ | |
51 | } | |
52 | ||
53 | //______________________________________________________________________________ | |
54 | AliEMCalTriggerClusterAnalysisComponent::AliEMCalTriggerClusterAnalysisComponent(const char* name) : | |
55 | AliEMCalTriggerTracksAnalysisComponent(name), | |
56 | fEnergyRange(), | |
57 | fUsePatches(kFALSE) | |
58 | { | |
59 | /* | |
60 | * Main constructor | |
61 | */ | |
62 | fEnergyRange.SetLimits(0., 1000.); | |
63 | } | |
64 | ||
65 | //______________________________________________________________________________ | |
66 | void AliEMCalTriggerClusterAnalysisComponent::CreateHistos() { | |
67 | /* | |
68 | * Create histos for clusters in different event categories | |
69 | */ | |
70 | AliEMCalTriggerTracksAnalysisComponent::CreateHistos(); | |
71 | ||
72 | // Create trigger definitions | |
73 | std::map<std::string, std::string> triggerCombinations; | |
bfbaea65 | 74 | const char *triggernames[11] = {"MinBias", "EMCJHigh", "EMCJLow", "EMCGHigh", |
75 | "EMCGLow", "EMCHighBoth", "EMCHighGammaOnly", "EMCHighJetOnly", | |
d824c93c | 76 | "EMCLowBoth", "EMCLowGammaOnly", "EMCLowJetOnly"}; |
77 | // Define names and titles for different triggers in the histogram container | |
78 | triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[0], "min. bias events")); | |
79 | triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[1], "jet-triggered events (high threshold)")); | |
80 | triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[2], "jet-triggered events (low threshold)")); | |
81 | triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[3], "gamma-triggered events (high threshold)")); | |
82 | triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[4], "gamma-triggered events (low threshold)")); | |
bfbaea65 | 83 | triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[5], "jet and gamma triggered events (high threshold)")); |
84 | triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[6], "exclusively gamma-triggered events (high threshold)")); | |
85 | triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[7], "exclusively jet-triggered events (high threshold)")); | |
86 | triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[8], "jet and gamma triggered events (low threshold)")); | |
87 | triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[9], "exclusively gamma-triggered events (low threshold)")); | |
88 | triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[10], "exclusively-triggered events (low threshold)")); | |
d824c93c | 89 | |
90 | // Create axis definitions | |
91 | const AliEMCalTriggerBinningDimension *ptbinning = fBinning->GetBinning("pt"), | |
92 | *etabinning = fBinning->GetBinning("eta"), | |
93 | *phibinning = fBinning->GetBinning("phi"), | |
0b065993 | 94 | *vertexbinning = fBinning->GetBinning("zvertex"); |
95 | /* | |
96 | ptbinning->Print(); | |
97 | etabinning->Print(); | |
98 | phibinning->Print(); | |
99 | vertexbinning->Print(); | |
100 | */ | |
d824c93c | 101 | |
102 | const TAxis *clusteraxes[5] = { | |
103 | DefineAxis("energy", ptbinning), | |
104 | DefineAxis("eta", etabinning), | |
105 | DefineAxis("phi", phibinning), | |
106 | DefineAxis("zvertex", vertexbinning), | |
107 | DefineAxis("mbtrigger", 2, -0.5, 1.5) | |
108 | }; | |
109 | ||
110 | // Build histograms | |
111 | for(std::map<std::string,std::string>::iterator it = triggerCombinations.begin(); it != triggerCombinations.end(); ++it){ | |
112 | const std::string name = it->first, &title = it->second; | |
113 | fHistos->CreateTHnSparse(Form("hClusterCalibHist%s", name.c_str()), Form("Calib. cluster-based histogram for %s events", title.c_str()), 5, clusteraxes, "s"); | |
114 | fHistos->CreateTHnSparse(Form("hClusterUncalibHist%s", name.c_str()), Form("Uncalib. cluster-based histogram for %s events", title.c_str()), 5, clusteraxes, "s"); | |
115 | } | |
116 | ||
117 | for(int iaxis = 0; iaxis < 5; iaxis++) delete clusteraxes[iaxis]; | |
118 | } | |
119 | ||
120 | //______________________________________________________________________________ | |
121 | void AliEMCalTriggerClusterAnalysisComponent::Process(const AliEMCalTriggerEventData* const data) { | |
122 | /* | |
123 | * Run loop over calibrated and uncalibrated clusters | |
124 | */ | |
125 | ||
126 | // First loop over uncalibrated clusters | |
bfbaea65 | 127 | AliDebug(1, Form("Number of calibrated clusters: %d", data->GetClusterContainer()->GetEntries())); |
128 | ||
d824c93c | 129 | AliVCluster *clust(NULL); |
130 | AliVEvent *recEv = data->GetRecEvent(); | |
131 | std::vector<std::string> triggerNames; | |
132 | this->GetMachingTriggerNames(triggerNames, fUsePatches); | |
133 | for(int iclust = 0; iclust < recEv->GetNumberOfCaloClusters(); iclust++){ | |
134 | clust = recEv->GetCaloCluster(iclust); | |
135 | if(!clust->IsEMCAL()) continue; | |
136 | if(!fEnergyRange.IsInRange(clust->E())) continue; | |
137 | for(std::vector<std::string>::iterator name = triggerNames.begin(); name != triggerNames.end(); ++name) | |
138 | FillHistogram(Form("hClusterUncalibHist%s", name->c_str()), clust, recEv, fTriggerDecision->IsMinBias()); | |
139 | } | |
140 | ||
141 | // Loop also over calibrated clusters | |
bfbaea65 | 142 | if(!data->GetClusterContainer()) |
143 | printf("Cluster container not found \n"); | |
d824c93c | 144 | TIter clusterIter(data->GetClusterContainer()); |
145 | while((clust = dynamic_cast<AliVCluster *>(clusterIter()))){ | |
146 | if(!clust->IsEMCAL()) continue; | |
147 | if(!fEnergyRange.IsInRange(clust->E())) continue; | |
148 | for(std::vector<std::string>::iterator name = triggerNames.begin(); name != triggerNames.end(); ++name) | |
bfbaea65 | 149 | FillHistogram(Form("hClusterCalibHist%s", name->c_str()), clust, recEv, fTriggerDecision->IsMinBias()); |
d824c93c | 150 | } |
151 | } | |
152 | ||
153 | //______________________________________________________________________________ | |
154 | void AliEMCalTriggerClusterAnalysisComponent::FillHistogram(const TString& histname, const AliVCluster* clust, AliVEvent *ev, Bool_t inMB) { | |
155 | /* | |
156 | * Fill Histogram for cluster | |
157 | * | |
158 | * @param histname: the histogram to fill | |
159 | * @param clust: the cluster analysed | |
160 | * @param event: reconstructed event information | |
161 | * @param inMB: true if event fulfills min bias condition | |
162 | */ | |
163 | TLorentzVector vec; | |
164 | double xyz[3]; | |
165 | ev->GetPrimaryVertex()->GetXYZ(xyz); | |
166 | clust->GetMomentum(vec, xyz); | |
167 | double infs[5] = {clust->E(), vec.Eta(), vec.Phi(), xyz[2], inMB ? 1. : 0.}; | |
168 | fHistos->FillTHnSparse(histname.Data(), infs); | |
169 | } | |
170 | ||
171 | ||
172 | } /* namespace EMCalTriggerPtAnalysis */ |