]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/EMCALJetTasks/Tracks/AliEMCalTriggerMCJetAnalysisComponent.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / Tracks / AliEMCalTriggerMCJetAnalysisComponent.cxx
CommitLineData
edc6be66 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 tracks in jets of MC particles where the jet has a given
17 * minimum pt
18 *
19 * Author: Markus Fasel
20 */
21#include <string>
22#include <vector>
23
24#include <TMath.h>
25#include <TString.h>
26
5f95099b 27#include "AliAODMCParticle.h"
edc6be66 28#include "AliEmcalJet.h"
29#include "AliJetContainer.h"
5f95099b 30#include "AliLog.h"
edc6be66 31#include "AliMCParticle.h"
32#include "AliMCEvent.h"
33#include "AliParticleContainer.h"
34#include "AliVEvent.h"
35#include "AliVParticle.h"
36#include "AliVVertex.h"
37
38#include "AliEMCalHistoContainer.h"
39#include "AliEMCalTriggerAnaTriggerDecision.h"
40#include "AliEMCalTriggerBinningComponent.h"
41#include "AliEMCalTriggerKineCuts.h"
42#include "AliEMCalTriggerEventData.h"
43#include "AliEMCalTriggerMCJetAnalysisComponent.h"
44
45ClassImp(EMCalTriggerPtAnalysis::AliEMCalTriggerMCJetAnalysisComponent)
46
47namespace EMCalTriggerPtAnalysis {
48
49//______________________________________________________________________________
50AliEMCalTriggerMCJetAnalysisComponent::AliEMCalTriggerMCJetAnalysisComponent():
51 AliEMCalTriggerTracksAnalysisComponent(),
52 fMinimumJetPt(20.),
53 fUsePatches(kFALSE)
54{
55 /*
56 * Dummy (I/O) constructor, not to be used
57 */
58}
59
60//______________________________________________________________________________
61AliEMCalTriggerMCJetAnalysisComponent::AliEMCalTriggerMCJetAnalysisComponent(const char* name) :
62 AliEMCalTriggerTracksAnalysisComponent(name),
63 fMinimumJetPt(20.),
64 fUsePatches(kFALSE)
65{
66 /*
67 * Main constructor, to be used
68 */
69}
70
71//______________________________________________________________________________
72void AliEMCalTriggerMCJetAnalysisComponent::CreateHistos() {
73 /*
74 * Create histograms for the MC jet analysis
75 */
76 AliEMCalTriggerTracksAnalysisComponent::CreateHistos();
77
78 TString jetptstring = Form("jetPt%03d", int(fMinimumJetPt));
79 // Create trigger definitions
80 std::map<std::string, std::string> triggerCombinations;
81 const char *triggernames[11] = {"MinBias", "EMCJHigh", "EMCJLow", "EMCGHigh",
82 "EMCGLow", "EMCHighBoth", "EMCHighGammaOnly", "EMCHighJetOnly",
83 "EMCLowBoth", "EMCLowGammaOnly", "EMCLowJetOnly"};
84 // Define names and titles for different triggers in the histogram container
85 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[0], "min. bias events"));
86 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[1], "jet-triggered events (high threshold)"));
87 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[2], "jet-triggered events (low threshold)"));
88 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[3], "gamma-triggered events (high threshold)"));
89 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[4], "gamma-triggered events (low threshold)"));
90 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[5], "jet and gamma triggered events (high threshold)"));
91 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[6], "exclusively gamma-triggered events (high threshold)"));
92 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[7], "exclusively jet-triggered events (high threshold)"));
93 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[8], "jet and gamma triggered events (low threshold)"));
94 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[9], "exclusively gamma-triggered events (low threshold)"));
95 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[10], "exclusively-triggered events (low threshold)"));
96
97 // Create axis definitions
98 const AliEMCalTriggerBinningDimension *ptbinning = fBinning->GetBinning("pt"),
b22ca299 99 *jetptbinning = fBinning->GetBinning("jetpt"),
edc6be66 100 *etabinning = fBinning->GetBinning("eta"),
101 *phibinning = fBinning->GetBinning("phi"),
0b065993 102 *vertexbinning = fBinning->GetBinning("zvertex");
edc6be66 103
104 const TAxis *trackaxes[6] = {
105 DefineAxis("trackpt", ptbinning),
b22ca299 106 DefineAxis("jettpt", jetptbinning ? jetptbinning : ptbinning),
edc6be66 107 DefineAxis("eta", etabinning),
108 DefineAxis("phi", phibinning),
109 DefineAxis("zvertex", vertexbinning),
110 DefineAxis("mbtrigger", 2, -0.5, 1.5)
111 };
112
b22ca299 113 const TAxis *jetaxes[4] = {
114 DefineAxis("jetpt", jetptbinning ? jetptbinning : ptbinning),
115 DefineAxis("jeteta", etabinning),
116 DefineAxis("jetphi", phibinning),
117 DefineAxis("zvertex", vertexbinning)
118 };
119
edc6be66 120 // Build histograms
121 for(std::map<std::string,std::string>::iterator it = triggerCombinations.begin(); it != triggerCombinations.end(); ++it){
122 const std::string name = it->first, &title = it->second;
123 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");
b22ca299 124 fHistos->CreateTHnSparse(Form("hMCJetHist%s%s", jetptstring.Data(), name.c_str()), Form("Reconstructed jets in %s-triggered events", name.c_str()), 4, jetaxes);
edc6be66 125 }
126
127 for(int iaxis = 0; iaxis < 6; iaxis++) delete trackaxes[iaxis];
128}
129
130//______________________________________________________________________________
131void AliEMCalTriggerMCJetAnalysisComponent::Process(const AliEMCalTriggerEventData* const data) {
132 /*
133 * Analyse particles in a jet with a given minimum jet pt
134 */
5f95099b 135 if(!data->GetJetContainerMC()){
136 AliError("No Jet container for MC found");
137 return;
138 }
edc6be66 139 std::vector<std::string> triggernames;
140 this->GetMachingTriggerNames(triggernames, fUsePatches);
141 TString jetptstring = Form("jetPt%03d", int(fMinimumJetPt));
142
5f95099b 143 AliJetContainer *cont = data->GetJetContainerMC();
edc6be66 144 AliEmcalJet *reconstructedJet = cont->GetNextAcceptJet(0);
5f95099b 145 AliAODMCParticle *foundtrack(NULL);
edc6be66 146 while(reconstructedJet){
147 if(TMath::Abs(reconstructedJet->Pt()) > fMinimumJetPt){
b22ca299 148 for(std::vector<std::string>::iterator name = triggernames.begin(); name != triggernames.end(); ++name)
149 FillJetHistogram(Form("hMCJetHist%s%s", jetptstring.Data(), name->c_str()), reconstructedJet, data->GetRecEvent()->GetPrimaryVertex()->GetZ());
edc6be66 150 // Jet selected, loop over particles
151 for(int ipart = 0; ipart < reconstructedJet->GetNumberOfTracks(); ipart++){
5f95099b 152 foundtrack = dynamic_cast<AliAODMCParticle *>(reconstructedJet->TrackAt(ipart, cont->GetParticleContainer()->GetArray()));
edc6be66 153 if(!fKineCuts->IsSelected(foundtrack)) continue;
154 if(!foundtrack->Charge()) continue;
5f95099b 155 if(!foundtrack->IsPhysicalPrimary()) continue;
edc6be66 156 // track selected, fill histogram
157 for(std::vector<std::string>::iterator name = triggernames.begin(); name != triggernames.end(); ++name){
158 FillHistogram(Form("hParticleJetHist%s%s", jetptstring.Data(), name->c_str()), foundtrack, reconstructedJet, data->GetRecEvent()->GetPrimaryVertex()->GetZ());
159 }
160 }
161 }
162 reconstructedJet = cont->GetNextAcceptJet();
163 }
164}
165
166//______________________________________________________________________________
167void AliEMCalTriggerMCJetAnalysisComponent::FillHistogram(
168 const TString& histname, const AliVParticle* track, const AliEmcalJet* jet,
169 double vz) {
170 /*
171 * Fill Histogram with relevant information
172 */
173 if(!fTriggerDecision) return;
174 double data[6] = {TMath::Abs(track->Pt()), TMath::Abs(jet->Pt()), track->Eta(), track->Phi(), vz, fTriggerDecision->IsMinBias() ? 1. : 0.};
175 fHistos->FillTHnSparse(histname.Data(), data);
176}
177
b22ca299 178//______________________________________________________________________________
179void AliEMCalTriggerMCJetAnalysisComponent::FillJetHistogram(
180 const TString& histname, const AliEmcalJet* recjet, double vz) {
181 /*
182 * Fill histogram for reconstructed jets with the relevant information
183 */
184 double data[4] = {TMath::Abs(recjet->Pt()), recjet->Eta(), recjet->Phi(), vz};
185 fHistos->FillTHnSparse(histname.Data(), data);
186}
edc6be66 187} /* namespace EMCalTriggerPtAnalysis */