]>
Commit | Line | Data |
---|---|---|
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 | //____________________________________________________________________ | |
12 | AliSPDMCTrackDensity::AliSPDMCTrackDensity() | |
13 | : AliBaseMCTrackDensity(), | |
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 | //____________________________________________________________________ | |
25 | AliSPDMCTrackDensity::AliSPDMCTrackDensity(const char*) | |
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 | //____________________________________________________________________ | |
38 | AliSPDMCTrackDensity::AliSPDMCTrackDensity(const AliSPDMCTrackDensity& o) | |
39 | : AliBaseMCTrackDensity(o), | |
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 | //____________________________________________________________________ | |
51 | AliSPDMCTrackDensity& | |
52 | AliSPDMCTrackDensity::operator=(const AliSPDMCTrackDensity& o) | |
53 | { | |
54 | // Assignment operator | |
55 | if (&o == this) return *this; | |
56 | AliBaseMCTrackDensity::operator=(o); | |
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 | |
69 | AliSPDMCTrackDensity::GetDetectorId() const | |
70 | { | |
71 | return AliTrackReference::kITS; | |
72 | } | |
73 | ||
74 | ||
75 | //____________________________________________________________________ | |
76 | void | |
77 | AliSPDMCTrackDensity::BeginTrackRefs() | |
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(); | |
114 | Double_t y = ref->Y(); | |
115 | Double_t z = ref->Z(); | |
116 | ||
117 | Double_t zr = z-fVz; | |
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(); | |
123 | fOutput->Fill(et,ph,w); | |
124 | ||
125 | return w; | |
126 | } | |
127 | ||
128 | ||
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 | // | |
150 | fOutput = &output; | |
151 | ||
152 | return ProcessTracks(event, vz, primary); | |
153 | } | |
154 | #define PF(N,V,...) \ | |
155 | AliForwardUtil::PrintField(N,V, ## __VA_ARGS__) | |
156 | ||
157 | #define PFV(N,VALUE) \ | |
158 | do { \ | |
159 | AliForwardUtil::PrintName(N); \ | |
160 | std::cout << (VALUE) << std::endl; } while(false) | |
161 | //____________________________________________________________________ | |
162 | void | |
163 | AliSPDMCTrackDensity::Print(Option_t* option) const | |
164 | { | |
165 | AliBaseMCTrackDensity::Print(option); | |
166 | gROOT->IncreaseDirLevel(); | |
167 | PF("R range", "[%f,%f]", fMinR, fMaxR); | |
168 | PF("Z range", "[%f,%f]", fMinZ, fMaxZ); | |
169 | gROOT->DecreaseDirLevel(); | |
170 | } | |
171 | ||
172 | //____________________________________________________________________ | |
173 | // | |
174 | // EOF | |
175 | // |