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