AliPhysics  6cf2591 (6cf2591)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliSPDMCTrackDensity.cxx
Go to the documentation of this file.
1 #include "AliSPDMCTrackDensity.h"
2 #include "AliMCEvent.h"
3 #include "AliTrackReference.h"
4 #include "AliForwardUtil.h"
5 #include <TMath.h>
6 #include <AliLog.h>
7 #include <TROOT.h>
8 #include <TH2D.h>
9 #include <iostream>
10 
11 //____________________________________________________________________
14  fMinR(3.5),
15  fMaxR(4.5),
16  fMinZ(-15), // -14.1),
17  fMaxZ(+15), // +14.1)
18  fStored(0),
19  fOutput(0)
20 {
21  // Default constructor
22 }
23 
24 //____________________________________________________________________
26  : AliBaseMCTrackDensity("spdMCTrackDensity"),
27  fMinR(3.5),
28  fMaxR(4.5),
29  fMinZ(-14.1),
30  fMaxZ(+14.1),
31  fStored(0),
32  fOutput(0)
33 {
34  // Normal constructor constructor
35 }
36 
37 //____________________________________________________________________
40  fMinR(o.fMinR),
41  fMaxR(o.fMaxR),
42  fMinZ(o.fMinZ),
43  fMaxZ(o.fMaxZ),
44  fStored(o.fStored),
45  fOutput(o.fOutput)
46 {
47  // Normal constructor constructor
48 }
49 
50 //____________________________________________________________________
53 {
54  // Assignment operator
55  if (&o == this) return *this;
57  fMinR = o.fMinR;
58  fMaxR = o.fMaxR;
59  fMinZ = o.fMinZ;
60  fMaxZ = o.fMaxZ;
61  fStored = o.fStored;
62  fOutput = o.fOutput;
63 
64  return *this;
65 }
66 
67 //____________________________________________________________________
68 Int_t
70 {
72 }
73 
74 
75 //____________________________________________________________________
76 void
78 {
79  fStored = 0;
80 }
81 
82 //____________________________________________________________________
83 Bool_t
84 AliSPDMCTrackDensity::CheckTrackRef(AliTrackReference* ref) const
85 {
86  // Get radius and z where the track reference was made
87  Double_t r = ref->R();
88  Double_t z = ref->Z();
89  if (r > fMaxR || r < fMinR) return false;
90  if (z > fMaxZ || z < fMinZ) return false;
91 
92  return true;
93 }
94 //____________________________________________________________________
95 AliTrackReference*
96 AliSPDMCTrackDensity::ProcessRef(AliMCParticle* /*particle*/,
97  const AliMCParticle* /*mother*/,
98  AliTrackReference* ref)
99 {
100  if (fStored) return 0;
101 
102  return fStored = ref;
103 }
104 
105 //____________________________________________________________________
106 Double_t
107 AliSPDMCTrackDensity::StoreParticle(AliMCParticle* particle,
108  const AliMCParticle* mother,
109  AliTrackReference* ref) const
110 {
111  Double_t w = AliBaseMCTrackDensity::StoreParticle(particle, mother, ref);
112  // Double_t r = ref->R();
113  Double_t x = ref->X()-fIP.X();
114  Double_t y = ref->Y()-fIP.Y();
115  Double_t z = ref->Z()-fIP.Z();
116  Double_t r = TMath::Sqrt(x*x+y*y);
117 
118  Double_t zr = z; // -fVz;
119  Double_t th = TMath::ATan2(r,zr);
120  if (th < 0) th += 2*TMath::Pi();
121  Double_t et = -TMath::Log(TMath::Tan(th/2));
122  Double_t ph = TMath::ATan2(y,x);
123  if (ph < 0) ph += 2*TMath::Pi();
124  fOutput->Fill(et,ph,w);
125 
126  return w;
127 }
128 
129 
130 //____________________________________________________________________
131 Bool_t
132 AliSPDMCTrackDensity::Calculate(const AliMCEvent& event,
133  const TVector3& ip,
134  TH2D& output,
135  TH2D* primary)
136 {
137  //
138  // Filter the input kinematics and track references, using
139  // some of the ESD information
140  //
141  // Parameters:
142  // input Input ESD event
143  // event Input MC event
144  // vz Vertex position
145  // output Output ESD-like object
146  // primary Per-event histogram of primaries
147  //
148  // Return:
149  // True on succes, false otherwise
150  //
151  fOutput = &output;
152 
153  return ProcessTracks(event, ip, primary);
154 }
155 #define PF(N,V,...) \
156  AliForwardUtil::PrintField(N,V, ## __VA_ARGS__)
157 
158 #define PFV(N,VALUE) \
159  do { \
160  AliForwardUtil::PrintName(N); \
161  std::cout << (VALUE) << std::endl; } while(false)
162 //____________________________________________________________________
163 void
165 {
167  gROOT->IncreaseDirLevel();
168  PF("R range", "[%f,%f]", fMinR, fMaxR);
169  PF("Z range", "[%f,%f]", fMinZ, fMaxZ);
170  gROOT->DecreaseDirLevel();
171 }
172 
173 //____________________________________________________________________
174 //
175 // EOF
176 //
TH2D * fOutput
Last stored.
double Double_t
Definition: External.C:58
void Print(Option_t *option="") const
Bool_t Calculate(const AliMCEvent &event, const TVector3 &ip, TH2D &output, TH2D *primary)
AliSPDMCTrackDensity & operator=(const AliSPDMCTrackDensity &o)
Double_t StoreParticle(AliMCParticle *particle, const AliMCParticle *mother, AliTrackReference *ref) const
virtual Double_t StoreParticle(AliMCParticle *particle, const AliMCParticle *mother, AliTrackReference *ref) const
virtual void Print(Option_t *option="") const
int Int_t
Definition: External.C:63
Various utilities used in PWGLF/FORWARD.
Definition: External.C:228
#define PF(N, V,...)
AliTrackReference * ProcessRef(AliMCParticle *particle, const AliMCParticle *mother, AliTrackReference *ref)
AliBaseMCTrackDensity & operator=(const AliBaseMCTrackDensity &o)
const char Option_t
Definition: External.C:48
Bool_t ProcessTracks(const AliMCEvent &event, const TVector3 &ip, TH2D *primary)
bool Bool_t
Definition: External.C:53
AliTrackReference * fStored
Bool_t CheckTrackRef(AliTrackReference *) const