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>
31 #include "AliMCEvent.h"
32 #include "AliPicoTrack.h"
33 #include "AliVCluster.h"
34 #include "AliVEvent.h"
35 #include "AliVParticle.h"
36 #include "AliVTrack.h"
38 #include "AliEMCalTriggerAnaTriggerDecision.h"
39 #include "AliEMCalTriggerBinningComponent.h"
40 #include "AliEMCalTriggerEventData.h"
41 #include "AliEMCalTriggerKineCuts.h"
42 #include "AliEMCalPtTaskVTrackSelection.h"
43 #include "AliEMCalTriggerRecTrackAnalysisComponent.h"
45 ClassImp(EMCalTriggerPtAnalysis::AliEMCalTriggerRecTrackAnalysisComponent)
47 namespace EMCalTriggerPtAnalysis {
49 //______________________________________________________________________________
50 AliEMCalTriggerRecTrackAnalysisComponent::AliEMCalTriggerRecTrackAnalysisComponent() :
51 AliEMCalTriggerTracksAnalysisComponent(),
52 fTrackSelection(NULL),
55 fRequestMCtrue(kFALSE)
58 * Dummy (I/O) constructor
62 //______________________________________________________________________________
63 AliEMCalTriggerRecTrackAnalysisComponent::AliEMCalTriggerRecTrackAnalysisComponent(const char *name) :
64 AliEMCalTriggerTracksAnalysisComponent(name),
65 fTrackSelection(NULL),
68 fRequestMCtrue(kFALSE)
75 //______________________________________________________________________________
76 AliEMCalTriggerRecTrackAnalysisComponent::~AliEMCalTriggerRecTrackAnalysisComponent() {
78 * Destructor, taking care of the track selection
80 if(fTrackSelection) delete fTrackSelection;
83 //______________________________________________________________________________
84 void AliEMCalTriggerRecTrackAnalysisComponent::CreateHistos() {
86 * Create histograms of the track analysis component. For each trigger class we have
87 * - tracks with esd information
88 * - tracks with MC information
89 * - tracks with clusters and esd information
90 * - tracks with clusters and MC information
92 AliEMCalTriggerTracksAnalysisComponent::CreateHistos();
94 // Create trigger definitions
95 std::map<std::string, std::string> triggerCombinations;
96 const char *triggernames[11] = {"MinBias", "EMCJHigh", "EMCJLow", "EMCGHigh",
97 "EMCGLow", "EMCHighBoth", "EMCHighGammaOnly", "EMCHighJetOnly",
98 "EMCLowBoth", "EMCLowGammaOnly", "EMCLowJetOnly"};
99 // Define names and titles for different triggers in the histogram container
100 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[0], "min. bias events"));
101 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[1], "jet-triggered events (high threshold)"));
102 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[2], "jet-triggered events (low threshold)"));
103 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[3], "gamma-triggered events (high threshold)"));
104 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[4], "gamma-triggered events (low threshold)"));
105 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[5], "jet and gamma triggered events (high threshold)"));
106 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[6], "exclusively gamma-triggered events (high threshold)"));
107 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[7], "exclusively jet-triggered events (high threshold)"));
108 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[8], "jet and gamma triggered events (low threshold)"));
109 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[9], "exclusively gamma-triggered events (low threshold)"));
110 triggerCombinations.insert(std::pair<std::string,std::string>(triggernames[10], "exclusively-triggered events (low threshold)"));
112 // Create axis definitions
113 const AliEMCalTriggerBinningDimension *ptbinning = fBinning->GetBinning("pt"),
114 *etabinning = fBinning->GetBinning("eta"),
115 *phibinning = fBinning->GetBinning("phi"),
116 *vertexbinning = fBinning->GetBinning("zvertex");
118 const TAxis *trackaxes[5] = {
119 DefineAxis("pt", ptbinning),
120 DefineAxis("eta", etabinning),
121 DefineAxis("phi", phibinning),
122 DefineAxis("zvertex", vertexbinning),
123 DefineAxis("mbtrigger", 2, -0.5, 1.5)
127 for(std::map<std::string,std::string>::iterator it = triggerCombinations.begin(); it != triggerCombinations.end(); ++it){
128 const std::string name = it->first, &title = it->second;
129 fHistos->CreateTHnSparse(Form("hTrackHist%s", name.c_str()), Form("Track-based data for %s events", title.c_str()), 5, trackaxes, "s");
130 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");
131 fHistos->CreateTHnSparse(Form("hMCTrackHist%s", name.c_str()), Form("Track-based data for %s events with MC kinematics", title.c_str()), 5, trackaxes, "s");
132 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");
135 for(int iaxis = 0; iaxis < 5; iaxis++) delete trackaxes[iaxis];
138 //______________________________________________________________________________
139 void AliEMCalTriggerRecTrackAnalysisComponent::Process(const AliEMCalTriggerEventData* const data) {
141 * Run track loop on list of matching tracks
143 * @param data: the event data
145 AliDebug(1, Form("Number of matched tracks: %d", data->GetMatchedTrackContainer()->GetEntries()));
147 std::vector<std::string> triggernames;
148 this->GetMachingTriggerNames(triggernames, fUsePatches);
150 AliVTrack *track(NULL);
151 AliVParticle *assocMC(NULL);
152 TIter trackIter(data->GetMatchedTrackContainer());
153 while((track = dynamic_cast<AliVTrack *>(trackIter()))){
154 // Apply track selection
156 if(fKineCuts && !fKineCuts->IsSelected(track)) continue;
157 if(fTrackSelection && !fTrackSelection->IsTrackAccepted(track)) continue;
159 if(fRequestMCtrue && data->GetMCEvent() && !(assocMC = IsMCTrueTrack(track, data->GetMCEvent()))) continue;
160 // Try to match the cluster
161 Bool_t hasCluster = kFALSE;
162 AliVCluster *clust(NULL);
163 AliVTrack *testtrack = track;
164 AliPicoTrack *pictrack = dynamic_cast<AliPicoTrack *>(track);
165 if(pictrack) testtrack = pictrack->GetTrack();
166 if(testtrack->GetEMCALcluster() >= 0 && (clust = dynamic_cast<AliVCluster *>(data->GetClusterContainer()->At(testtrack->GetEMCALcluster()))))
170 for(std::vector<std::string>::iterator name = triggernames.begin(); name != triggernames.end(); name++){
171 FillHistogram(Form("hTrackHist%s", name->c_str()), track, NULL, data->GetRecEvent(), kFALSE);
172 if(hasCluster) FillHistogram(Form("hTrackInAcceptanceHist%s", name->c_str()), track, NULL, data->GetRecEvent(), kFALSE);
174 FillHistogram(Form("hMCTrackHist%s", name->c_str()), track, assocMC, data->GetRecEvent(), kTRUE);
175 if(hasCluster) FillHistogram(Form("hMCTrackInAcceptanceHist%s", name->c_str()), track, assocMC, data->GetRecEvent(), kTRUE);
181 //______________________________________________________________________________
182 AliVParticle * AliEMCalTriggerRecTrackAnalysisComponent::IsMCTrueTrack(
183 const AliVTrack* const trk, const AliMCEvent* evnt) const {
185 * Check according to the associated MC information whether the track is a MC true track,
186 * and whether it is physical primary
188 * @param trk: track to check
189 * @param evnt: MC event information necessary for the check
191 * @return: the associated MC particle (NULL if not MC true)
193 int label = TMath::Abs(trk->GetLabel());
194 AliVParticle *mcpart = evnt->GetTrack(label);
195 if(!mcpart) return NULL;
196 if(!evnt->IsPhysicalPrimary(label)) return NULL;
200 //______________________________________________________________________________
201 void AliEMCalTriggerRecTrackAnalysisComponent::FillHistogram(
202 const TString& histname, const AliVTrack* const trk,
203 const AliVParticle* assocMC, const AliVEvent* const recev,
208 if(useMCkine && !assocMC) return;
210 data[0] = useMCkine ? TMath::Abs(assocMC->Pt()) : TMath::Abs(trk->Pt());
211 data[1] = (fSwapEta ? -1. : 1.) * (useMCkine ? assocMC->Eta() : trk->Eta());
212 data[2] = useMCkine ? assocMC->Phi() : trk->Phi();
213 data[3] = recev->GetPrimaryVertex()->GetZ();
214 data[4] = fTriggerDecision->IsMinBias();
215 fHistos->FillTHnSparse(histname.Data(), data);
218 } /* namespace EMCalTriggerPtAnalysis */