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 for EMCal clusters. Loops over calibrated and uncalibrated clusters
18 * Author: Markus Fasel
25 #include <TClonesArray.h>
26 #include <TLorentzVector.h>
29 #include "AliVCluster.h"
30 #include "AliVEvent.h"
32 #include "AliEMCalTriggerBinningComponent.h"
33 #include "AliEMCalTriggerAnaTriggerDecision.h"
34 #include "AliEMCalTriggerEventData.h"
35 #include "AliEMCalTriggerClusterAnalysisComponent.h"
38 ClassImp(EMCalTriggerPtAnalysis::AliEMCalTriggerClusterAnalysisComponent)
40 namespace EMCalTriggerPtAnalysis {
42 //______________________________________________________________________________
43 AliEMCalTriggerClusterAnalysisComponent::AliEMCalTriggerClusterAnalysisComponent() :
44 AliEMCalTriggerTracksAnalysisComponent(),
49 * Dummy (I/O) constructor
53 //______________________________________________________________________________
54 AliEMCalTriggerClusterAnalysisComponent::AliEMCalTriggerClusterAnalysisComponent(const char* name) :
55 AliEMCalTriggerTracksAnalysisComponent(name),
62 fEnergyRange.SetLimits(0., 1000.);
65 //______________________________________________________________________________
66 void AliEMCalTriggerClusterAnalysisComponent::CreateHistos() {
68 * Create histos for clusters in different event categories
70 AliEMCalTriggerTracksAnalysisComponent::CreateHistos();
72 // Create trigger definitions
73 std::map<std::string, std::string> triggerCombinations;
74 const char *triggernames[11] = {"MinBias", "EMCJHigh", "EMCJLow", "EMCGHigh",
75 "EMCGLow", "EMCHighBoth", "EMCHighGammaOnly", "EMCHighJetOnly",
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)"));
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)"));
90 // Create axis definitions
91 const AliEMCalTriggerBinningDimension *ptbinning = fBinning->GetBinning("pt"),
92 *etabinning = fBinning->GetBinning("eta"),
93 *phibinning = fBinning->GetBinning("phi"),
94 *vertexbinning = fBinning->GetBinning("zvertex");
99 vertexbinning->Print();
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)
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");
117 for(int iaxis = 0; iaxis < 5; iaxis++) delete clusteraxes[iaxis];
120 //______________________________________________________________________________
121 void AliEMCalTriggerClusterAnalysisComponent::Process(const AliEMCalTriggerEventData* const data) {
123 * Run loop over calibrated and uncalibrated clusters
126 // First loop over uncalibrated clusters
127 AliDebug(1, Form("Number of calibrated clusters: %d", data->GetClusterContainer()->GetEntries()));
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());
141 // Loop also over calibrated clusters
142 if(!data->GetClusterContainer())
143 printf("Cluster container not found \n");
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)
149 FillHistogram(Form("hClusterCalibHist%s", name->c_str()), clust, recEv, fTriggerDecision->IsMinBias());
153 //______________________________________________________________________________
154 void AliEMCalTriggerClusterAnalysisComponent::FillHistogram(const TString& histname, const AliVCluster* clust, AliVEvent *ev, Bool_t inMB) {
156 * Fill Histogram for cluster
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
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);
172 } /* namespace EMCalTriggerPtAnalysis */