]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/EMCALJetTasks/Tracks/AliEMCalTriggerMCJetAnalysisComponent.cxx
ATO-91 - join attachment plots for A and C side (Patrick)
[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"),
99 *etabinning = fBinning->GetBinning("eta"),
100 *phibinning = fBinning->GetBinning("phi"),
0b065993 101 *vertexbinning = fBinning->GetBinning("zvertex");
edc6be66 102
103 const TAxis *trackaxes[6] = {
104 DefineAxis("trackpt", ptbinning),
105 DefineAxis("jettpt", ptbinning),
106 DefineAxis("eta", etabinning),
107 DefineAxis("phi", phibinning),
108 DefineAxis("zvertex", vertexbinning),
109 DefineAxis("mbtrigger", 2, -0.5, 1.5)
110 };
111
112 // Build histograms
113 for(std::map<std::string,std::string>::iterator it = triggerCombinations.begin(); it != triggerCombinations.end(); ++it){
114 const std::string name = it->first, &title = it->second;
115 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");
116 }
117
118 for(int iaxis = 0; iaxis < 6; iaxis++) delete trackaxes[iaxis];
119}
120
121//______________________________________________________________________________
122void AliEMCalTriggerMCJetAnalysisComponent::Process(const AliEMCalTriggerEventData* const data) {
123 /*
124 * Analyse particles in a jet with a given minimum jet pt
125 */
5f95099b 126 if(!data->GetJetContainerMC()){
127 AliError("No Jet container for MC found");
128 return;
129 }
edc6be66 130 std::vector<std::string> triggernames;
131 this->GetMachingTriggerNames(triggernames, fUsePatches);
132 TString jetptstring = Form("jetPt%03d", int(fMinimumJetPt));
133
5f95099b 134 AliJetContainer *cont = data->GetJetContainerMC();
edc6be66 135 AliEmcalJet *reconstructedJet = cont->GetNextAcceptJet(0);
5f95099b 136 AliAODMCParticle *foundtrack(NULL);
edc6be66 137 while(reconstructedJet){
138 if(TMath::Abs(reconstructedJet->Pt()) > fMinimumJetPt){
139 // Jet selected, loop over particles
140 for(int ipart = 0; ipart < reconstructedJet->GetNumberOfTracks(); ipart++){
5f95099b 141 foundtrack = dynamic_cast<AliAODMCParticle *>(reconstructedJet->TrackAt(ipart, cont->GetParticleContainer()->GetArray()));
edc6be66 142 if(!fKineCuts->IsSelected(foundtrack)) continue;
143 if(!foundtrack->Charge()) continue;
5f95099b 144 if(!foundtrack->IsPhysicalPrimary()) continue;
edc6be66 145 // track selected, fill histogram
146 for(std::vector<std::string>::iterator name = triggernames.begin(); name != triggernames.end(); ++name){
147 FillHistogram(Form("hParticleJetHist%s%s", jetptstring.Data(), name->c_str()), foundtrack, reconstructedJet, data->GetRecEvent()->GetPrimaryVertex()->GetZ());
148 }
149 }
150 }
151 reconstructedJet = cont->GetNextAcceptJet();
152 }
153}
154
155//______________________________________________________________________________
156void AliEMCalTriggerMCJetAnalysisComponent::FillHistogram(
157 const TString& histname, const AliVParticle* track, const AliEmcalJet* jet,
158 double vz) {
159 /*
160 * Fill Histogram with relevant information
161 */
162 if(!fTriggerDecision) return;
163 double data[6] = {TMath::Abs(track->Pt()), TMath::Abs(jet->Pt()), track->Eta(), track->Phi(), vz, fTriggerDecision->IsMinBias() ? 1. : 0.};
164 fHistos->FillTHnSparse(histname.Data(), data);
165}
166
167} /* namespace EMCalTriggerPtAnalysis */