]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/EMCALJetTasks/Tracks/AliEMCalTriggerMCParticleAnalysisComponent.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / Tracks / AliEMCalTriggerMCParticleAnalysisComponent.cxx
CommitLineData
5b1df951 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 simple Monte-Carlo particles. Loops over all particles, selects
17 * those which are physical primary, and fills a THnSparse with them.
18 *
19 * Author: Markus Fasel
20 */
21#include <TAxis.h>
22#include <TMath.h>
23
24#include "AliMCEvent.h"
25#include "AliVParticle.h"
26#include "AliVEvent.h"
27#include "AliVVertex.h"
28
5b1df951 29#include "AliEMCalTriggerBinningComponent.h"
30#include "AliEMCalTriggerEventData.h"
31#include "AliEMCalTriggerKineCuts.h"
08f5b3a3 32#include "AliEMCalTriggerEventData.h"
5b1df951 33#include "AliEMCalTriggerMCParticleAnalysisComponent.h"
34
08f5b3a3 35
5b1df951 36ClassImp(EMCalTriggerPtAnalysis::AliEMCalTriggerMCParticleAnalysisComponent)
37
38namespace EMCalTriggerPtAnalysis {
39
40//______________________________________________________________________________
41AliEMCalTriggerMCParticleAnalysisComponent::AliEMCalTriggerMCParticleAnalysisComponent() :
42 AliEMCalTriggerTracksAnalysisComponent()
43{
44 /*
45 * Dummy Constructor for I/O
46 */
47}
48
49//______________________________________________________________________________
50AliEMCalTriggerMCParticleAnalysisComponent::AliEMCalTriggerMCParticleAnalysisComponent(const char* name) :
51 AliEMCalTriggerTracksAnalysisComponent(name)
52{
53 /*
54 * Main Constructor, to be called by the users
55 */
56}
57
58 //______________________________________________________________________________
59void AliEMCalTriggerMCParticleAnalysisComponent::CreateHistos() {
60 /*
61 * Create histograms for the MC truth analysis component
62 */
63
64 const AliEMCalTriggerBinningDimension *ptbinning = fBinning->GetBinning("pt"),
65 *etabinning = fBinning->GetBinning("eta"),
66 *phibinning = fBinning->GetBinning("phi"),
0b065993 67 *vertexbinning = fBinning->GetBinning("zvertex");
5b1df951 68 AliEMCalTriggerTracksAnalysisComponent::CreateHistos();
69 const TAxis *trackaxes[4] = {
70 DefineAxis("pt", ptbinning),
71 DefineAxis("eta", etabinning),
72 DefineAxis("phi", phibinning),
73 DefineAxis("zvertex", vertexbinning)
74 };
75 fHistos->CreateTHnSparse("hMCtrueParticles", "Particle-based histogram for MC-true particles", 4, trackaxes, "s");
76}
77
78//______________________________________________________________________________
79void AliEMCalTriggerMCParticleAnalysisComponent::Process(const AliEMCalTriggerEventData* const data) {
80 AliMCEvent *mc = data->GetMCEvent();
81 if(!mc) return;
82 AliVEvent *rec = data->GetRecEvent();
83 Double_t values[4];
84 for(int itrk = 0; itrk < mc->GetNumberOfTracks(); itrk++){
85 AliVParticle *track = mc->GetTrack(itrk);
86 if(!track->Charge()) continue;
87 if(!mc->IsPhysicalPrimary(itrk)) continue;
88 if(!fKineCuts->IsSelected(track)) continue;
89
90 values[0] = TMath::Abs(track->Pt());
91 values[1] = track->Eta();
92 values[2] = track->Phi();
93 values[3] = rec->GetPrimaryVertex()->GetZ();
94 fHistos->FillTHnSparse("hMCtrueParticles", values);
95 }
96}
97
5b1df951 98} /* namespace EMCalTriggerPtAnalysis */