]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PMD/AliPMDtracker.cxx
Apply manu mask to motifPositionID
[u/mrichter/AliRoot.git] / PMD / AliPMDtracker.cxx
CommitLineData
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>
27#include <TBRIK.h>
28#include <TNode.h>
29#include <TTree.h>
30#include <TGeometry.h>
31#include <TObjArray.h>
32#include <TClonesArray.h>
33#include <TFile.h>
34#include <TBranch.h>
35#include <TNtuple.h>
36#include <TParticle.h>
37
38#include "AliPMDcluster.h"
39#include "AliPMDclupid.h"
40#include "AliPMDrecpoint1.h"
41#include "AliPMDUtility.h"
42#include "AliPMDDiscriminator.h"
26f1ae17 43#include "AliPMDEmpDiscriminator.h"
7dcaf913 44#include "AliPMDtracker.h"
45
46#include "AliESDPmdTrack.h"
47#include "AliESD.h"
ecee2a1a 48#include "AliLog.h"
7dcaf913 49
50ClassImp(AliPMDtracker)
51
52AliPMDtracker::AliPMDtracker():
53 fTreeR(0),
54 fRecpoints(new TClonesArray("AliPMDrecpoint1", 1000)),
55 fPMDcontin(new TObjArray()),
56 fPMDcontout(new TObjArray()),
7dcaf913 57 fPMDutil(new AliPMDUtility()),
58 fPMDrecpoint(0),
59 fPMDclin(0),
60 fPMDclout(0),
7dcaf913 61 fXvertex(0.),
62 fYvertex(0.),
63 fZvertex(0.),
64 fSigmaX(0.),
65 fSigmaY(0.),
66 fSigmaZ(0.)
67{
68 //
69 // Default Constructor
70 //
71}
72//--------------------------------------------------------------------//
73AliPMDtracker::~AliPMDtracker()
74{
75 // Destructor
76 if (fRecpoints)
77 {
78 fRecpoints->Delete();
79 delete fRecpoints;
80 fRecpoints=0;
81 }
82 if (fPMDcontin)
83 {
84 fPMDcontin->Delete();
85 delete fPMDcontin;
86 fPMDcontin=0;
87 }
88 if (fPMDcontout)
89 {
90 fPMDcontout->Delete();
91 delete fPMDcontout;
92 fPMDcontout=0;
93 }
94}
95//--------------------------------------------------------------------//
96void AliPMDtracker::LoadClusters(TTree *treein)
97{
98 // Load the Reconstructed tree
99 fTreeR = treein;
100}
101//--------------------------------------------------------------------//
102void AliPMDtracker::Clusters2Tracks(AliESD *event)
103{
104 // Converts digits to recpoints after running clustering
105 // algorithm on CPV plane and PREshower plane
106 //
107
108 Int_t idet;
109 Int_t ismn;
26f1ae17 110 Float_t clusdata[6];
7dcaf913 111
112 TBranch *branch = fTreeR->GetBranch("PMDRecpoint");
ecee2a1a 113 if (!branch)
114 {
115 AliError("PMDRecpoint branch not found");
116 return;
117 }
7dcaf913 118 branch->SetAddress(&fRecpoints);
119
26f1ae17 120 Int_t nmodules = (Int_t) branch->GetEntries();
121
ecee2a1a 122 AliDebug(1,Form("Number of modules filled in treeR = %d",nmodules));
7dcaf913 123 for (Int_t imodule = 0; imodule < nmodules; imodule++)
124 {
26f1ae17 125 branch->GetEntry(imodule);
7dcaf913 126 Int_t nentries = fRecpoints->GetLast();
ecee2a1a 127 AliDebug(2,Form("Number of clusters per modules filled in treeR = %d"
128 ,nentries));
7dcaf913 129 for(Int_t ient = 0; ient < nentries+1; ient++)
130 {
131 fPMDrecpoint = (AliPMDrecpoint1*)fRecpoints->UncheckedAt(ient);
132 idet = fPMDrecpoint->GetDetector();
133 ismn = fPMDrecpoint->GetSMNumber();
134 clusdata[0] = fPMDrecpoint->GetClusX();
135 clusdata[1] = fPMDrecpoint->GetClusY();
136 clusdata[2] = fPMDrecpoint->GetClusADC();
137 clusdata[3] = fPMDrecpoint->GetClusCells();
26f1ae17 138 clusdata[4] = fPMDrecpoint->GetClusSigmaX();
139 clusdata[5] = fPMDrecpoint->GetClusSigmaY();
140
141 fPMDclin = new AliPMDrecpoint1(idet,ismn,clusdata);
7dcaf913 142 fPMDcontin->Add(fPMDclin);
143 }
144 }
145
26f1ae17 146 AliPMDDiscriminator *pmddiscriminator = new AliPMDEmpDiscriminator();
147 pmddiscriminator->Discrimination(fPMDcontin,fPMDcontout);
7dcaf913 148
26f1ae17 149 const Float_t kzpos0 = 361.5; // for PREshower plane BKN
150 const Float_t kzpos1 = 361.5; // for CPV plane
7dcaf913 151 Int_t ism =0, ium=0;
152 Int_t det,smn;
153 Float_t xpos,ypos;
154 Float_t xpad = 0, ypad = 0;
155 Float_t adc, ncell, rad;
26f1ae17 156 Float_t xglobal, yglobal, zglobal;
7dcaf913 157 Float_t pid;
158
7dcaf913 159
160 Int_t nentries2 = fPMDcontout->GetEntries();
ecee2a1a 161 AliDebug(1,Form("Number of clusters coming after discrimination = %d"
162 ,nentries2));
7dcaf913 163 for (Int_t ient1 = 0; ient1 < nentries2; ient1++)
164 {
165 fPMDclout = (AliPMDclupid*)fPMDcontout->UncheckedAt(ient1);
166
167 det = fPMDclout->GetDetector();
168 smn = fPMDclout->GetSMN();
169 xpos = fPMDclout->GetClusX();
170 ypos = fPMDclout->GetClusY();
171 adc = fPMDclout->GetClusADC();
172 ncell = fPMDclout->GetClusCells();
173 rad = fPMDclout->GetClusRadius();
174 pid = fPMDclout->GetClusPID();
175
176 //
177 // Now change the xpos and ypos to its original values
178 // for the unit modules which are earlier changed.
179 // xpad and ypad are the real positions.
180 //
181 /**********************************************************************
182 * det : Detector, 0: PRE & 1:CPV *
183 * smn : Serial Module Number from which Super Module Number *
184 * and Unit Module Numbers are extracted *
185 * xpos : x-position of the cluster *
186 * ypos : y-position of the cluster *
187 * THESE xpos & ypos are not the true xpos and ypos *
188 * for some of the unit modules. They are rotated. *
189 * adc : ADC contained in the cluster *
190 * ncell : Number of cells contained in the cluster *
191 * rad : radius of the cluster (1d fit) *
192 * ism : Supermodule number extracted from smn *
193 * ium : Unit module number extracted from smn *
194 * xpad : TRUE x-position of the cluster *
195 * ypad : TRUE y-position of the cluster *
196 **********************************************************************/
197 //
198 if(det == 0 || det == 1)
199 {
200 if(smn < 12)
201 {
202 ism = smn/6;
203 ium = smn - ism*6;
204 xpad = ypos;
205 ypad = xpos;
206 }
207 else if( smn >= 12 && smn < 24)
208 {
209 ism = smn/6;
210 ium = smn - ism*6;
211 xpad = xpos;
212 ypad = ypos;
213 }
214 }
215
216 fPMDutil->RectGeomCellPos(ism,ium,xpad,ypad,xglobal,yglobal);
26f1ae17 217
218 if (det == 0)
219 {
220 zglobal = kzpos0 + 0.5; // to be found out
221 }
222 else if (det == 1)
223 {
224 zglobal = kzpos1 - 0.5; // to be found out BKN
225 }
226
7dcaf913 227
228 // Fill ESD
229
230 AliESDPmdTrack *esdpmdtr = new AliESDPmdTrack();
231
232 esdpmdtr->SetDetector(det);
26f1ae17 233 esdpmdtr->SetClusterX(xglobal);
234 esdpmdtr->SetClusterY(yglobal);
235 esdpmdtr->SetClusterZ(zglobal);
7dcaf913 236 esdpmdtr->SetClusterADC(adc);
26f1ae17 237 esdpmdtr->SetClusterCells(ncell);
7dcaf913 238 esdpmdtr->SetClusterPID(pid);
239
240 event->AddPmdTrack(esdpmdtr);
241 }
242
243}
244//--------------------------------------------------------------------//
245void AliPMDtracker::SetVertex(Double_t vtx[3], Double_t evtx[3])
246{
247 fXvertex = vtx[0];
248 fYvertex = vtx[1];
249 fZvertex = vtx[2];
250 fSigmaX = evtx[0];
251 fSigmaY = evtx[1];
252 fSigmaZ = evtx[2];
253}
254//--------------------------------------------------------------------//
7dcaf913 255void AliPMDtracker::ResetClusters()
256{
257 if (fRecpoints) fRecpoints->Clear();
258}
259//--------------------------------------------------------------------//