]>
Commit | Line | Data |
---|---|---|
f68d9069 | 1 | #include "AliSPDMCTrackDensity.h" |
f53fb4f6 | 2 | #include "AliMCEvent.h" |
3 | #include "AliTrackReference.h" | |
c8b1a7db | 4 | #include "AliForwardUtil.h" |
f68d9069 | 5 | #include <TMath.h> |
6 | #include <AliLog.h> | |
f68d9069 | 7 | #include <TROOT.h> |
4bcdcbc1 | 8 | #include <TH2D.h> |
f68d9069 | 9 | #include <iostream> |
10 | ||
11 | //____________________________________________________________________ | |
12 | AliSPDMCTrackDensity::AliSPDMCTrackDensity() | |
4bcdcbc1 | 13 | : AliBaseMCTrackDensity(), |
f68d9069 | 14 | fMinR(3.5), |
15 | fMaxR(4.5), | |
9ecab72f | 16 | fMinZ(-15), // -14.1), |
4bcdcbc1 | 17 | fMaxZ(+15), // +14.1) |
18 | fStored(0), | |
19 | fOutput(0) | |
f68d9069 | 20 | { |
21 | // Default constructor | |
22 | } | |
23 | ||
24 | //____________________________________________________________________ | |
25 | AliSPDMCTrackDensity::AliSPDMCTrackDensity(const char*) | |
4bcdcbc1 | 26 | : AliBaseMCTrackDensity("spdMCTrackDensity"), |
f68d9069 | 27 | fMinR(3.5), |
28 | fMaxR(4.5), | |
29 | fMinZ(-14.1), | |
30 | fMaxZ(+14.1), | |
4bcdcbc1 | 31 | fStored(0), |
32 | fOutput(0) | |
f68d9069 | 33 | { |
34 | // Normal constructor constructor | |
35 | } | |
36 | ||
37 | //____________________________________________________________________ | |
38 | AliSPDMCTrackDensity::AliSPDMCTrackDensity(const AliSPDMCTrackDensity& o) | |
4bcdcbc1 | 39 | : AliBaseMCTrackDensity(o), |
f68d9069 | 40 | fMinR(o.fMinR), |
41 | fMaxR(o.fMaxR), | |
42 | fMinZ(o.fMinZ), | |
4bcdcbc1 | 43 | fMaxZ(o.fMaxZ), |
44 | fStored(o.fStored), | |
45 | fOutput(o.fOutput) | |
f68d9069 | 46 | { |
47 | // Normal constructor constructor | |
48 | } | |
49 | ||
50 | //____________________________________________________________________ | |
51 | AliSPDMCTrackDensity& | |
52 | AliSPDMCTrackDensity::operator=(const AliSPDMCTrackDensity& o) | |
53 | { | |
54 | // Assignment operator | |
d015ecfe | 55 | if (&o == this) return *this; |
4bcdcbc1 | 56 | AliBaseMCTrackDensity::operator=(o); |
f68d9069 | 57 | fMinR = o.fMinR; |
58 | fMaxR = o.fMaxR; | |
59 | fMinZ = o.fMinZ; | |
60 | fMaxZ = o.fMaxZ; | |
4bcdcbc1 | 61 | fStored = o.fStored; |
62 | fOutput = o.fOutput; | |
63 | ||
f68d9069 | 64 | return *this; |
65 | } | |
66 | ||
4bcdcbc1 | 67 | //____________________________________________________________________ |
68 | Int_t | |
69 | AliSPDMCTrackDensity::GetDetectorId() const | |
70 | { | |
71 | return AliTrackReference::kITS; | |
72 | } | |
73 | ||
74 | ||
f68d9069 | 75 | //____________________________________________________________________ |
76 | void | |
4bcdcbc1 | 77 | AliSPDMCTrackDensity::BeginTrackRefs() |
f68d9069 | 78 | { |
4bcdcbc1 | 79 | fStored = 0; |
80 | } | |
f68d9069 | 81 | |
4bcdcbc1 | 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; | |
f68d9069 | 91 | |
4bcdcbc1 | 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; | |
f68d9069 | 101 | |
4bcdcbc1 | 102 | return fStored = ref; |
f68d9069 | 103 | } |
104 | ||
105 | //____________________________________________________________________ | |
4bcdcbc1 | 106 | Double_t |
f68d9069 | 107 | AliSPDMCTrackDensity::StoreParticle(AliMCParticle* particle, |
108 | const AliMCParticle* mother, | |
4bcdcbc1 | 109 | AliTrackReference* ref) const |
f68d9069 | 110 | { |
4bcdcbc1 | 111 | Double_t w = AliBaseMCTrackDensity::StoreParticle(particle, mother, ref); |
f68d9069 | 112 | Double_t r = ref->R(); |
113 | Double_t x = ref->X(); | |
114 | Double_t y = ref->Y(); | |
115 | Double_t z = ref->Z(); | |
116 | ||
4bcdcbc1 | 117 | Double_t zr = z-fVz; |
f68d9069 | 118 | Double_t th = TMath::ATan2(r,zr); |
119 | if (th < 0) th += 2*TMath::Pi(); | |
120 | Double_t et = -TMath::Log(TMath::Tan(th/2)); | |
121 | Double_t ph = TMath::ATan2(y,x); | |
122 | if (ph < 0) ph += 2*TMath::Pi(); | |
4bcdcbc1 | 123 | fOutput->Fill(et,ph,w); |
f68d9069 | 124 | |
4bcdcbc1 | 125 | return w; |
f68d9069 | 126 | } |
127 | ||
128 | ||
f68d9069 | 129 | //____________________________________________________________________ |
130 | Bool_t | |
131 | AliSPDMCTrackDensity::Calculate(const AliMCEvent& event, | |
132 | Double_t vz, | |
133 | TH2D& output, | |
134 | TH2D* primary) | |
135 | { | |
136 | // | |
137 | // Filter the input kinematics and track references, using | |
138 | // some of the ESD information | |
139 | // | |
140 | // Parameters: | |
141 | // input Input ESD event | |
142 | // event Input MC event | |
143 | // vz Vertex position | |
144 | // output Output ESD-like object | |
145 | // primary Per-event histogram of primaries | |
146 | // | |
147 | // Return: | |
148 | // True on succes, false otherwise | |
149 | // | |
4bcdcbc1 | 150 | fOutput = &output; |
f68d9069 | 151 | |
4bcdcbc1 | 152 | return ProcessTracks(event, vz, primary); |
2b556440 | 153 | } |
c8b1a7db | 154 | #define PF(N,V,...) \ |
155 | AliForwardUtil::PrintField(N,V, ## __VA_ARGS__) | |
2b556440 | 156 | |
c8b1a7db | 157 | #define PFV(N,VALUE) \ |
158 | do { \ | |
159 | AliForwardUtil::PrintName(N); \ | |
160 | std::cout << (VALUE) << std::endl; } while(false) | |
f68d9069 | 161 | //____________________________________________________________________ |
162 | void | |
4bcdcbc1 | 163 | AliSPDMCTrackDensity::Print(Option_t* option) const |
f68d9069 | 164 | { |
4bcdcbc1 | 165 | AliBaseMCTrackDensity::Print(option); |
c8b1a7db | 166 | gROOT->IncreaseDirLevel(); |
167 | PF("R range", "[%f,%f]", fMinR, fMaxR); | |
168 | PF("Z range", "[%f,%f]", fMinZ, fMaxZ); | |
169 | gROOT->DecreaseDirLevel(); | |
f68d9069 | 170 | } |
171 | ||
172 | //____________________________________________________________________ | |
173 | // | |
174 | // EOF | |
175 | // |