AliPhysics  vAN-20150924 (e816f45)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AliEMCalTriggerMCJetAnalysisComponent.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 <string>
16 #include <vector>
17 
18 #include <TMath.h>
19 #include <TString.h>
20 
21 #include "AliAODMCParticle.h"
22 #include "AliEmcalJet.h"
23 #include "AliJetContainer.h"
24 #include "AliLog.h"
25 #include "AliMCParticle.h"
26 #include "AliMCEvent.h"
27 #include "AliParticleContainer.h"
28 #include "AliVEvent.h"
29 #include "AliVParticle.h"
30 #include "AliVVertex.h"
31 
32 #include "AliEMCalHistoContainer.h"
39 
43 
44 namespace EMCalTriggerPtAnalysis {
45 
49 AliEMCalTriggerMCJetAnalysisComponent::AliEMCalTriggerMCJetAnalysisComponent():
51  fMinimumJetPt(20.)
52 {
53 }
54 
61  fMinimumJetPt(20.)
62 {
63 }
64 
70 
71  TString jetptstring = Form("jetPt%03d", int(fMinimumJetPt));
72  // Create trigger definitions
73  std::map<std::string, std::string> triggerCombinations;
74  GetAllTriggerNamesAndTitles(triggerCombinations);
75 
76  // Create axis definitions
77  const AliEMCalTriggerBinningDimension *ptbinning = fBinning->GetBinning("pt"),
78  *jetptbinning = fBinning->GetBinning("jetpt"),
79  *etabinning = fBinning->GetBinning("eta"),
80  *phibinning = fBinning->GetBinning("phi"),
81  *vertexbinning = fBinning->GetBinning("zvertex");
82 
83  const TAxis *trackaxes[6] = {
84  DefineAxis("trackpt", ptbinning),
85  DefineAxis("jettpt", jetptbinning ? jetptbinning : ptbinning),
86  DefineAxis("eta", etabinning),
87  DefineAxis("phi", phibinning),
88  DefineAxis("zvertex", vertexbinning),
89  DefineAxis("mbtrigger", 2, -0.5, 1.5)
90  };
91 
92  const TAxis *jetaxes[4] = {
93  DefineAxis("jetpt", jetptbinning ? jetptbinning : ptbinning),
94  DefineAxis("jeteta", etabinning),
95  DefineAxis("jetphi", phibinning),
96  DefineAxis("zvertex", vertexbinning)
97  };
98 
99  // Build histograms
100  for(std::map<std::string,std::string>::iterator it = triggerCombinations.begin(); it != triggerCombinations.end(); ++it){
101  const std::string name = it->first, &title = it->second;
102  fHistos->CreateTHnSparse(Form("hParticleJetHist%s%s", jetptstring.Data(), name.c_str()), Form("Track-based data for tracks in jets in %s events", title.c_str()), 6, trackaxes, "s");
103  fHistos->CreateTHnSparse(Form("hMCJetHist%s%s", jetptstring.Data(), name.c_str()), Form("Reconstructed jets in %s-triggered events", name.c_str()), 4, jetaxes);
104  }
105 
106  for(int iaxis = 0; iaxis < 6; iaxis++) delete trackaxes[iaxis];
107 }
108 
116  if(!data->GetJetContainerMC()){
117  AliError("No Jet container for MC found");
118  return;
119  }
120  std::vector<std::string> triggernames;
121  this->GetMachingTriggerNames(triggernames);
122  TString jetptstring = Form("jetPt%03d", int(fMinimumJetPt));
123 
124  double weight = 1.;
125  if(fWeightHandler && data->GetMCEvent()){
126  weight = fWeightHandler->GetEventWeight(data->GetMCEvent());
127  }
128 
129  AliJetContainer *cont = data->GetJetContainerMC();
130  AliEmcalJet *reconstructedJet = cont->GetNextAcceptJet(0);
131  AliAODMCParticle *foundtrack(NULL);
132  while(reconstructedJet){
133  if(TMath::Abs(reconstructedJet->Pt()) > fMinimumJetPt){
134  for(std::vector<std::string>::iterator name = triggernames.begin(); name != triggernames.end(); ++name)
135  FillJetHistogram(Form("hMCJetHist%s%s", jetptstring.Data(), name->c_str()), reconstructedJet, data->GetRecEvent()->GetPrimaryVertex()->GetZ(), weight);
136  // Jet selected, loop over particles
137  for(int ipart = 0; ipart < reconstructedJet->GetNumberOfTracks(); ipart++){
138  foundtrack = dynamic_cast<AliAODMCParticle *>(reconstructedJet->TrackAt(ipart, cont->GetParticleContainer()->GetArray()));
139  if(!fKineCuts->IsSelected(foundtrack)) continue;
140  if(!foundtrack->Charge()) continue;
141  if(!foundtrack->IsPhysicalPrimary()) continue;
142  // track selected, fill histogram
143  for(std::vector<std::string>::iterator name = triggernames.begin(); name != triggernames.end(); ++name){
144  FillHistogram(Form("hParticleJetHist%s%s", jetptstring.Data(), name->c_str()), foundtrack, reconstructedJet, data->GetRecEvent()->GetPrimaryVertex()->GetZ(), weight);
145  }
146  }
147  }
148  reconstructedJet = cont->GetNextAcceptJet();
149  }
150 }
151 
161  const TString& histname, const AliVParticle* track, const AliEmcalJet* jet,
162  double vz, double weight) {
163  if(!fTriggerClassManager) return;
164  double data[6] = {TMath::Abs(track->Pt()), TMath::Abs(jet->Pt()), track->Eta(), track->Phi(), vz, fTriggerClassManager->HasMinBiasTrigger() ? 1. : 0.};
165  fHistos->FillTHnSparse(histname.Data(), data, weight);
166 }
167 
176  const TString& histname, const AliEmcalJet* recjet, double vz, double weight) {
177  double data[4] = {TMath::Abs(recjet->Pt()), recjet->Eta(), recjet->Phi(), vz};
178  fHistos->FillTHnSparse(histname.Data(), data, weight);
179 }
180 } /* namespace EMCalTriggerPtAnalysis */
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
Weight handler for the analysis of high- tracks in EMCAL-triggered events.
const char * title
Definition: MakeQAPdf.C:26
void GetMachingTriggerNames(std::vector< std::string > &triggernames) const
const AliEMCalTriggerWeightHandler * fWeightHandler
Event weight handler.
TAxis * DefineAxis(const char *name, const AliEMCalTriggerBinningDimension *binning)
void FillTHnSparse(const char *name, const double *x, double weight=1.)
Declaration of a management class for trigger classes.
void CreateTHnSparse(const char *name, const char *title, int ndim, const int *nbins, const double *min, const double *max, Option_t *opt="")
void GetAllTriggerNamesAndTitles(std::map< std::string, std::string > &triggers) const
void FillJetHistogram(const TString &histname, const AliEmcalJet *recjet, double vz, double weight)
Declarartion of class AliEMCalHistoContainer.
Analysis component for particles in jets at generator level.
AliEMCalHistoContainer * fHistos
Histogram container of the analysis component.
const AliEMCalTriggerAnaClassManager * fTriggerClassManager
Global trigger class manager.
Definition of class AliEMCalTriggerMCJetAnalysisComponent.
AliEMCalTriggerBinningDimension * GetBinning(const char *name) const
const AliEMCalTriggerKineCuts * fKineCuts
Kinematical cuts for tracks and particle selection.
Base class for analysis components in the analysis of EMCAL-triggered events.
double GetEventWeight(const AliMCEvent *const event) const
Declaration of the classes AliEMCalTriggerBinningComponent and AliEMCalTriggerBinningDimension.
Simple event container within the high- track analysis.
void FillHistogram(const TString &histname, const AliVParticle *track, const AliEmcalJet *jet, double vz, double weight)
const AliEMCalTriggerBinningComponent * fBinning
Global binning handler.
Event Data used in exchange to the different analysis components.