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