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 * Track analysis component: Loops over tracks from the EMCal track container and
17 * counts the tracks in histograms
19 * Author: Markus Fasel
26 #include <TClonesArray.h>
30 #include "AliMCEvent.h"
31 #include "AliVCluster.h"
32 #include "AliVEvent.h"
33 #include "AliVParticle.h"
34 #include "AliVTrack.h"
36 #include "AliEMCalTriggerAnaTriggerDecision.h"
37 #include "AliEMCalTriggerBinningComponent.h"
38 #include "AliEMCalTriggerEventData.h"
39 #include "AliEMCalTriggerKineCuts.h"
40 #include "AliEMCalPtTaskVTrackSelection.h"
41 #include "AliEMCalTriggerRecTrackAnalysisComponent.h"
43 ClassImp(EMCalTriggerPtAnalysis::AliEMCalTriggerRecTrackAnalysisComponent)
45 namespace EMCalTriggerPtAnalysis {
47 //______________________________________________________________________________
48 AliEMCalTriggerRecTrackAnalysisComponent::AliEMCalTriggerRecTrackAnalysisComponent() :
49 AliEMCalTriggerTracksAnalysisComponent(),
50 fTrackSelection(NULL),
53 fRequestMCtrue(kFALSE)
56 * Dummy (I/O) constructor
60 //______________________________________________________________________________
61 AliEMCalTriggerRecTrackAnalysisComponent::AliEMCalTriggerRecTrackAnalysisComponent(const char *name) :
62 AliEMCalTriggerTracksAnalysisComponent(name),
63 fTrackSelection(NULL),
66 fRequestMCtrue(kFALSE)
73 //______________________________________________________________________________
74 AliEMCalTriggerRecTrackAnalysisComponent::~AliEMCalTriggerRecTrackAnalysisComponent() {
76 * Destructor, taking care of the track selection
78 if(fTrackSelection) delete fTrackSelection;
81 //______________________________________________________________________________
82 void AliEMCalTriggerRecTrackAnalysisComponent::CreateHistos() {
84 * Create histograms of the track analysis component. For each trigger class we have
85 * - tracks with esd information
86 * - tracks with MC information
87 * - tracks with clusters and esd information
88 * - tracks with clusters and MC information
90 AliEMCalTriggerTracksAnalysisComponent::CreateHistos();
92 // Create trigger definitions
93 std::map<std::string, std::string> triggerCombinations;
94 const char *triggernames[11] = {"MinBias", "EMCJHigh", "EMCJLow", "EMCGHigh",
95 "EMCGLow", "EMCHighBoth", "EMCHighGammaOnly", "EMCHighJetOnly",
96 "EMCLowBoth", "EMCLowGammaOnly", "EMCLowJetOnly"};
97 // Define names and titles for different triggers in the histogram container
98 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[0], "min. bias events"));
99 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[1], "jet-triggered events (high threshold)"));
100 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[2], "jet-triggered events (low threshold)"));
101 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[3], "gamma-triggered events (high threshold)"));
102 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[4], "gamma-triggered events (low threshold)"));
103 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[5], "jet and gamma triggered events (high threshold)"));
104 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[6], "exclusively gamma-triggered events (high threshold)"));
105 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[7], "exclusively jet-triggered events (high threshold)"));
106 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[8], "jet and gamma triggered events (low threshold)"));
107 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[9], "exclusively gamma-triggered events (low threshold)"));
108 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[10], "exclusively-triggered events (low threshold)"));
110 // Create axis definitions
111 const AliEMCalTriggerBinningDimension *ptbinning = fBinning->GetBinning("pt"),
112 *etabinning = fBinning->GetBinning("eta"),
113 *phibinning = fBinning->GetBinning("phi"),
114 *vertexbinning = fBinning->GetBinning("vertex");
116 const TAxis *trackaxes[5] = {
117 DefineAxis("pt", ptbinning),
118 DefineAxis("eta", etabinning),
119 DefineAxis("phi", phibinning),
120 DefineAxis("zvertex", vertexbinning),
121 DefineAxis("mbtrigger", 2, -0.5, 1.5)
125 for(std::map<std::string,std::string>::iterator it = triggerCombinations.begin(); it != triggerCombinations.end(); ++it){
126 const std::string name = it->first, &title = it->second;
127 fHistos->CreateTHnSparse(Form("hTrackHist%s", name.c_str()), Form("Track-based data for %s events", title.c_str()), 5, trackaxes, "s");
128 fHistos->CreateTHnSparse(Form("hTrackInAcceptanceHist%s", name.c_str()), Form("Track-based data for %s events for tracks matched to EMCal clusters", title.c_str()), 5, trackaxes, "s");
129 fHistos->CreateTHnSparse(Form("hMCTrackHist%s", name.c_str()), Form("Track-based data for %s events with MC kinematics", title.c_str()), 5, trackaxes, "s");
130 fHistos->CreateTHnSparse(Form("hMCTrackInAcceptanceHist%s", name.c_str()), Form("Track-based data for %s events with MC kinematics for tracks matched to EMCal clusters", title.c_str()), 5, trackaxes, "s");
133 for(int iaxis = 0; iaxis < 5; iaxis++) delete trackaxes[iaxis];
136 //______________________________________________________________________________
137 void AliEMCalTriggerRecTrackAnalysisComponent::Process(const AliEMCalTriggerEventData* const data) {
139 * Run track loop on list of matching tracks
141 * @param data: the event data
144 std::vector<std::string> triggernames;
145 this->GetMachingTriggerNames(triggernames, fUsePatches);
147 AliVTrack *track(NULL);
148 AliVParticle *assocMC(NULL);
149 TIter trackIter(data->GetMatchedTrackContainer());
150 while((track = dynamic_cast<AliVTrack *>(trackIter()))){
151 // Apply track selection
153 if(fKineCuts && !fKineCuts->IsSelected(track)) continue;
154 if(fTrackSelection && !fTrackSelection->IsTrackAccepted(track)) continue;
155 if(fRequestMCtrue && data->GetMCEvent() && !(assocMC = IsMCTrueTrack(track, data->GetMCEvent()))) continue;
157 // Try to match the cluster
158 Bool_t hasCluster = kFALSE;
159 AliVCluster *clust(NULL);
160 if(track->GetEMCALcluster() >= 0 && (clust = dynamic_cast<AliVCluster *>(data->GetClusterContainer()->At(track->GetEMCALcluster()))))
164 for(std::vector<std::string>::iterator name = triggernames.begin(); name != triggernames.end(); name++){
165 FillHistogram(Form("hTrackHist%s", name->c_str()), track, NULL, data->GetRecEvent(), kFALSE);
166 if(hasCluster) FillHistogram(Form("hTrackInAcceptanceHist%s", name->c_str()), track, NULL, data->GetRecEvent(), kFALSE);
168 FillHistogram(Form("hMCTrackHist%s", name->c_str()), track, NULL, data->GetRecEvent(), kTRUE);
169 if(hasCluster) FillHistogram(Form("hMCTrackInAcceptanceHist%s", name->c_str()), track, NULL, data->GetRecEvent(), kTRUE);
175 //______________________________________________________________________________
176 AliVParticle * AliEMCalTriggerRecTrackAnalysisComponent::IsMCTrueTrack(
177 const AliVTrack* const trk, const AliMCEvent* evnt) const {
179 * Check according to the associated MC information whether the track is a MC true track,
180 * and whether it is physical primary
182 * @param trk: track to check
183 * @param evnt: MC event information necessary for the check
185 * @return: the associated MC particle (NULL if not MC true)
187 int label = TMath::Abs(trk->GetLabel());
188 AliVParticle *mcpart = evnt->GetTrack(label);
189 if(!mcpart) return NULL;
190 if(!evnt->IsPhysicalPrimary(label)) return NULL;
194 //______________________________________________________________________________
195 void AliEMCalTriggerRecTrackAnalysisComponent::FillHistogram(
196 const TString& histname, const AliVTrack* const trk,
197 const AliVParticle* assocMC, const AliVEvent* const recev,
202 if(useMCkine && !assocMC) return;
204 data[0] = useMCkine ? TMath::Abs(assocMC->Pt()) : TMath::Abs(trk->Pt());
205 data[1] = (fSwapEta ? -1. : 1.) * (useMCkine ? assocMC->Eta() : trk->Eta());
206 data[2] = useMCkine ? assocMC->Phi() : trk->Phi();
207 data[3] = recev->GetPrimaryVertex()->GetZ();
208 data[4] = fTriggerDecision->IsMinBias();
209 fHistos->FillTHnSparse(histname.Data(), data);
212 } /* namespace EMCalTriggerPtAnalysis */