AliPhysics  86877f2 (86877f2)
AliEMCalTriggerClusterAnalysisComponent.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 #include <vector>
18 
19 #include <TAxis.h>
20 #include <TClonesArray.h>
21 #include <THistManager.h>
22 #include <TLinearBinning.h>
23 #include <TLorentzVector.h>
24 
25 #include "AliLog.h"
26 #include "AliVCluster.h"
27 #include "AliVEvent.h"
28 
33 
37 
38 namespace EMCalTriggerPtAnalysis {
39 
43 AliEMCalTriggerClusterAnalysisComponent::AliEMCalTriggerClusterAnalysisComponent() :
45  fEnergyRange()
46 {
47 }
48 
55  fEnergyRange()
56 {
57  fEnergyRange.SetLimits(0., 1000.);
58 }
59 
65 
66  // Create trigger definitions
67  std::map<std::string, std::string> triggerCombinations;
68  GetAllTriggerNamesAndTitles(triggerCombinations);
69 
70  // Create axis definitions
71  const TBinning *ptbinning = fBinning->GetBinning("pt"),
72  *etabinning = fBinning->GetBinning("eta"),
73  *phibinning = fBinning->GetBinning("phi"),
74  *vertexbinning = fBinning->GetBinning("zvertex");
75  /*
76  ptbinning->Print();
77  etabinning->Print();
78  phibinning->Print();
79  vertexbinning->Print();
80  */
81 
82  const TAxis *clusteraxes[5] = {
83  DefineAxis("energy", *ptbinning),
84  DefineAxis("eta", *etabinning),
85  DefineAxis("phi", *phibinning),
86  DefineAxis("zvertex", *vertexbinning),
87  DefineAxis("mbtrigger", TLinearBinning(2, -0.5, 1.5))
88  };
89 
90  // Build histograms
91  for(std::map<std::string,std::string>::iterator it = triggerCombinations.begin(); it != triggerCombinations.end(); ++it){
92  const std::string name = it->first, &title = it->second;
93  fHistos->CreateTHnSparse(Form("hClusterCalibHist%s", name.c_str()), Form("Calib. cluster-based histogram for %s events", title.c_str()), 5, clusteraxes, "s");
94  fHistos->CreateTHnSparse(Form("hClusterUncalibHist%s", name.c_str()), Form("Uncalib. cluster-based histogram for %s events", title.c_str()), 5, clusteraxes, "s");
95  }
96 
97  for(int iaxis = 0; iaxis < 5; iaxis++) delete clusteraxes[iaxis];
98 }
99 
105 
106  // First loop over uncalibrated clusters
107  AliDebug(1, Form("Number of calibrated clusters: %d", data->GetClusterContainer()->GetEntries()));
108 
109  AliVCluster *clust(NULL);
110  AliVEvent *recEv = data->GetRecEvent();
111  std::vector<std::string> triggerNames;
112  GetMachingTriggerNames(triggerNames);
113  for(int iclust = 0; iclust < recEv->GetNumberOfCaloClusters(); iclust++){
114  clust = recEv->GetCaloCluster(iclust);
115  if(!clust->IsEMCAL()) continue;
116  if(!fEnergyRange.IsInRange(clust->E())) continue;
117  for(std::vector<std::string>::iterator name = triggerNames.begin(); name != triggerNames.end(); ++name)
118  FillHistogram(Form("hClusterUncalibHist%s", name->c_str()), clust, recEv, fTriggerClassManager->HasMinBiasTrigger());
119  }
120 
121  // Loop also over calibrated clusters
122  if(!data->GetClusterContainer())
123  printf("Cluster container not found \n");
124  TIter clusterIter(data->GetClusterContainer());
125  while((clust = dynamic_cast<AliVCluster *>(clusterIter()))){
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("hClusterCalibHist%s", name->c_str()), clust, recEv, fTriggerClassManager->HasMinBiasTrigger());
130  }
131 }
132 
140 void AliEMCalTriggerClusterAnalysisComponent::FillHistogram(const TString& histname, const AliVCluster* clust, AliVEvent *ev, Bool_t inMB) {
141  TLorentzVector vec;
142  double xyz[3];
143  ev->GetPrimaryVertex()->GetXYZ(xyz);
144  clust->GetMomentum(vec, xyz);
145  double infs[5] = {clust->E(), vec.Eta(), vec.Phi(), xyz[2], inMB ? 1. : 0.};
146  fHistos->FillTHnSparse(histname.Data(), infs);
147 }
148 
149 
150 } /* namespace EMCalTriggerPtAnalysis */
void FillHistogram(const TString &histname, const AliVCluster *clust, AliVEvent *ev, Bool_t inMB)
const char * title
Definition: MakeQAPdf.C:27
Class creating a linear binning, used in the histogram manager.
void GetMachingTriggerNames(std::vector< std::string > &triggernames) const
AliCutValueRange< double > fEnergyRange
Allowed energy range for the cluster.
Interface for binnings used by the histogram handler.
Definition: TBinning.h:21
Declaration of a management class for trigger classes.
void FillTHnSparse(const char *name, const double *x, double weight=1., Option_t *opt="")
void GetAllTriggerNamesAndTitles(std::map< std::string, std::string > &triggers) const
THistManager * fHistos
Histogram container of the analysis component.
const AliEMCalTriggerAnaClassManager * fTriggerClassManager
Global trigger class manager.
Analysis component for EMCAL clusters.
Base class for analysis components in the analysis of EMCAL-triggered events.
Analysis of high- tracks in triggered events.
Simple event container within the high- track analysis.
bool Bool_t
Definition: External.C:53
THnSparse * CreateTHnSparse(const char *name, const char *title, int ndim, const int *nbins, const double *min, const double *max, Option_t *opt="")
Create a new THnSparse within the container.
const AliEMCalTriggerBinningComponent * fBinning
Global binning handler.
Event Data used in exchange to the different analysis components.