]>
Commit | Line | Data |
---|---|---|
7dcaf913 | 1 | /*************************************************************************** |
2 | * Copyright(c) 1998-1999, 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 | //-----------------------------------------------------// | |
17 | // // | |
18 | // Date : March 25 2004 // | |
19 | // This reads the file PMD.RecPoints.root(TreeR), // | |
20 | // calls the Clustering algorithm and stores the // | |
21 | // clustering output in PMD.RecPoints.root(TreeR) // | |
22 | // // | |
23 | //-----------------------------------------------------// | |
24 | ||
25 | #include <Riostream.h> | |
26 | #include <TMath.h> | |
7dcaf913 | 27 | #include <TTree.h> |
7dcaf913 | 28 | #include <TObjArray.h> |
29 | #include <TClonesArray.h> | |
30 | #include <TFile.h> | |
31 | #include <TBranch.h> | |
32 | #include <TNtuple.h> | |
33 | #include <TParticle.h> | |
34 | ||
35 | #include "AliPMDcluster.h" | |
36 | #include "AliPMDclupid.h" | |
37 | #include "AliPMDrecpoint1.h" | |
38 | #include "AliPMDUtility.h" | |
39 | #include "AliPMDDiscriminator.h" | |
26f1ae17 | 40 | #include "AliPMDEmpDiscriminator.h" |
7dcaf913 | 41 | #include "AliPMDtracker.h" |
42 | ||
43 | #include "AliESDPmdTrack.h" | |
af885e0f | 44 | #include "AliESDEvent.h" |
ecee2a1a | 45 | #include "AliLog.h" |
7dcaf913 | 46 | |
47 | ClassImp(AliPMDtracker) | |
48 | ||
49 | AliPMDtracker::AliPMDtracker(): | |
50 | fTreeR(0), | |
722ccc67 | 51 | fRecpoints(new TClonesArray("AliPMDrecpoint1", 10)), |
7dcaf913 | 52 | fPMDcontin(new TObjArray()), |
53 | fPMDcontout(new TObjArray()), | |
7dcaf913 | 54 | fPMDutil(new AliPMDUtility()), |
55 | fPMDrecpoint(0), | |
56 | fPMDclin(0), | |
57 | fPMDclout(0), | |
7dcaf913 | 58 | fXvertex(0.), |
59 | fYvertex(0.), | |
60 | fZvertex(0.), | |
61 | fSigmaX(0.), | |
62 | fSigmaY(0.), | |
63 | fSigmaZ(0.) | |
64 | { | |
65 | // | |
66 | // Default Constructor | |
67 | // | |
68 | } | |
a48edddd | 69 | //--------------------------------------------------------------------// |
70 | AliPMDtracker:: AliPMDtracker(const AliPMDtracker & /* tracker */): | |
2332574a | 71 | TObject(/* tracker */), |
72 | fTreeR(0), | |
73 | fRecpoints(NULL), | |
74 | fPMDcontin(NULL), | |
75 | fPMDcontout(NULL), | |
76 | fPMDutil(NULL), | |
77 | fPMDrecpoint(0), | |
78 | fPMDclin(0), | |
79 | fPMDclout(0), | |
80 | fXvertex(0.), | |
81 | fYvertex(0.), | |
82 | fZvertex(0.), | |
83 | fSigmaX(0.), | |
84 | fSigmaY(0.), | |
85 | fSigmaZ(0.) | |
a48edddd | 86 | { |
87 | // copy constructor | |
88 | AliError("Copy constructor not allowed"); | |
89 | } | |
90 | ||
91 | //--------------------------------------------------------------------// | |
92 | AliPMDtracker& AliPMDtracker::operator=(const AliPMDtracker & /* tracker */) | |
93 | { | |
94 | // assignment operator | |
95 | AliError("Assignment operator not allowed"); | |
96 | return *this; | |
97 | } | |
98 | ||
7dcaf913 | 99 | //--------------------------------------------------------------------// |
100 | AliPMDtracker::~AliPMDtracker() | |
101 | { | |
102 | // Destructor | |
103 | if (fRecpoints) | |
104 | { | |
722ccc67 | 105 | fRecpoints->Clear(); |
7dcaf913 | 106 | } |
107 | if (fPMDcontin) | |
108 | { | |
109 | fPMDcontin->Delete(); | |
110 | delete fPMDcontin; | |
111 | fPMDcontin=0; | |
a1e9ac09 | 112 | |
7dcaf913 | 113 | } |
114 | if (fPMDcontout) | |
722ccc67 | 115 | { |
7dcaf913 | 116 | fPMDcontout->Delete(); |
117 | delete fPMDcontout; | |
118 | fPMDcontout=0; | |
a1e9ac09 | 119 | |
7dcaf913 | 120 | } |
316c6cd9 | 121 | delete fPMDutil; |
7dcaf913 | 122 | } |
123 | //--------------------------------------------------------------------// | |
124 | void AliPMDtracker::LoadClusters(TTree *treein) | |
125 | { | |
126 | // Load the Reconstructed tree | |
127 | fTreeR = treein; | |
128 | } | |
129 | //--------------------------------------------------------------------// | |
af885e0f | 130 | void AliPMDtracker::Clusters2Tracks(AliESDEvent *event) |
7dcaf913 | 131 | { |
132 | // Converts digits to recpoints after running clustering | |
133 | // algorithm on CPV plane and PREshower plane | |
134 | // | |
135 | ||
136 | Int_t idet; | |
137 | Int_t ismn; | |
26f1ae17 | 138 | Float_t clusdata[6]; |
7dcaf913 | 139 | |
140 | TBranch *branch = fTreeR->GetBranch("PMDRecpoint"); | |
ecee2a1a | 141 | if (!branch) |
142 | { | |
143 | AliError("PMDRecpoint branch not found"); | |
144 | return; | |
145 | } | |
7dcaf913 | 146 | branch->SetAddress(&fRecpoints); |
147 | ||
26f1ae17 | 148 | Int_t nmodules = (Int_t) branch->GetEntries(); |
149 | ||
ecee2a1a | 150 | AliDebug(1,Form("Number of modules filled in treeR = %d",nmodules)); |
7dcaf913 | 151 | for (Int_t imodule = 0; imodule < nmodules; imodule++) |
152 | { | |
26f1ae17 | 153 | branch->GetEntry(imodule); |
7dcaf913 | 154 | Int_t nentries = fRecpoints->GetLast(); |
ecee2a1a | 155 | AliDebug(2,Form("Number of clusters per modules filled in treeR = %d" |
156 | ,nentries)); | |
7dcaf913 | 157 | for(Int_t ient = 0; ient < nentries+1; ient++) |
158 | { | |
159 | fPMDrecpoint = (AliPMDrecpoint1*)fRecpoints->UncheckedAt(ient); | |
160 | idet = fPMDrecpoint->GetDetector(); | |
161 | ismn = fPMDrecpoint->GetSMNumber(); | |
162 | clusdata[0] = fPMDrecpoint->GetClusX(); | |
163 | clusdata[1] = fPMDrecpoint->GetClusY(); | |
164 | clusdata[2] = fPMDrecpoint->GetClusADC(); | |
165 | clusdata[3] = fPMDrecpoint->GetClusCells(); | |
26f1ae17 | 166 | clusdata[4] = fPMDrecpoint->GetClusSigmaX(); |
167 | clusdata[5] = fPMDrecpoint->GetClusSigmaY(); | |
168 | ||
169 | fPMDclin = new AliPMDrecpoint1(idet,ismn,clusdata); | |
7dcaf913 | 170 | fPMDcontin->Add(fPMDclin); |
171 | } | |
172 | } | |
173 | ||
26f1ae17 | 174 | AliPMDDiscriminator *pmddiscriminator = new AliPMDEmpDiscriminator(); |
175 | pmddiscriminator->Discrimination(fPMDcontin,fPMDcontout); | |
7dcaf913 | 176 | |
50555ba1 | 177 | const Float_t kzpos = 361.5; // middle of the PMD |
01c4d84a | 178 | |
7dcaf913 | 179 | Int_t det,smn; |
180 | Float_t xpos,ypos; | |
7dcaf913 | 181 | Float_t adc, ncell, rad; |
01c4d84a | 182 | Float_t xglobal = 0., yglobal = 0., zglobal = 0; |
7dcaf913 | 183 | Float_t pid; |
184 | ||
7dcaf913 | 185 | |
186 | Int_t nentries2 = fPMDcontout->GetEntries(); | |
ecee2a1a | 187 | AliDebug(1,Form("Number of clusters coming after discrimination = %d" |
188 | ,nentries2)); | |
7dcaf913 | 189 | for (Int_t ient1 = 0; ient1 < nentries2; ient1++) |
190 | { | |
191 | fPMDclout = (AliPMDclupid*)fPMDcontout->UncheckedAt(ient1); | |
192 | ||
193 | det = fPMDclout->GetDetector(); | |
194 | smn = fPMDclout->GetSMN(); | |
195 | xpos = fPMDclout->GetClusX(); | |
196 | ypos = fPMDclout->GetClusY(); | |
197 | adc = fPMDclout->GetClusADC(); | |
198 | ncell = fPMDclout->GetClusCells(); | |
199 | rad = fPMDclout->GetClusRadius(); | |
200 | pid = fPMDclout->GetClusPID(); | |
201 | ||
7dcaf913 | 202 | // |
203 | /********************************************************************** | |
204 | * det : Detector, 0: PRE & 1:CPV * | |
01c4d84a | 205 | * smn : Serial Module Number 0 to 23 for each plane * |
7dcaf913 | 206 | * xpos : x-position of the cluster * |
207 | * ypos : y-position of the cluster * | |
208 | * THESE xpos & ypos are not the true xpos and ypos * | |
209 | * for some of the unit modules. They are rotated. * | |
210 | * adc : ADC contained in the cluster * | |
211 | * ncell : Number of cells contained in the cluster * | |
212 | * rad : radius of the cluster (1d fit) * | |
7dcaf913 | 213 | **********************************************************************/ |
214 | // | |
01c4d84a | 215 | |
216 | fPMDutil->RectGeomCellPos(smn,xpos,ypos,xglobal,yglobal); | |
26f1ae17 | 217 | |
218 | if (det == 0) | |
219 | { | |
50555ba1 | 220 | zglobal = kzpos + 1.6; // PREshower plane |
26f1ae17 | 221 | } |
222 | else if (det == 1) | |
223 | { | |
50555ba1 | 224 | zglobal = kzpos - 1.7; // CPV plane |
26f1ae17 | 225 | } |
226 | ||
7dcaf913 | 227 | // Fill ESD |
228 | ||
229 | AliESDPmdTrack *esdpmdtr = new AliESDPmdTrack(); | |
230 | ||
231 | esdpmdtr->SetDetector(det); | |
26f1ae17 | 232 | esdpmdtr->SetClusterX(xglobal); |
233 | esdpmdtr->SetClusterY(yglobal); | |
234 | esdpmdtr->SetClusterZ(zglobal); | |
7dcaf913 | 235 | esdpmdtr->SetClusterADC(adc); |
26f1ae17 | 236 | esdpmdtr->SetClusterCells(ncell); |
7dcaf913 | 237 | esdpmdtr->SetClusterPID(pid); |
238 | ||
239 | event->AddPmdTrack(esdpmdtr); | |
240 | } | |
a1e9ac09 | 241 | |
242 | fPMDcontin->Delete(); | |
243 | fPMDcontout->Delete(); | |
244 | ||
7dcaf913 | 245 | } |
246 | //--------------------------------------------------------------------// | |
247 | void AliPMDtracker::SetVertex(Double_t vtx[3], Double_t evtx[3]) | |
248 | { | |
249 | fXvertex = vtx[0]; | |
250 | fYvertex = vtx[1]; | |
251 | fZvertex = vtx[2]; | |
252 | fSigmaX = evtx[0]; | |
253 | fSigmaY = evtx[1]; | |
254 | fSigmaZ = evtx[2]; | |
255 | } | |
256 | //--------------------------------------------------------------------// | |
7dcaf913 | 257 | void AliPMDtracker::ResetClusters() |
258 | { | |
259 | if (fRecpoints) fRecpoints->Clear(); | |
260 | } | |
261 | //--------------------------------------------------------------------// |