1 /***************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //-----------------------------------------------------//
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) //
23 //-----------------------------------------------------//
25 #include <Riostream.h>
30 #include <TGeometry.h>
31 #include <TObjArray.h>
32 #include <TClonesArray.h>
36 #include <TParticle.h>
38 #include "AliPMDcluster.h"
39 #include "AliPMDclupid.h"
40 #include "AliPMDrecpoint1.h"
41 #include "AliPMDUtility.h"
42 #include "AliPMDDiscriminator.h"
43 #include "AliPMDEmpDiscriminator.h"
44 #include "AliPMDtracker.h"
46 #include "AliESDPmdTrack.h"
50 ClassImp(AliPMDtracker)
52 AliPMDtracker::AliPMDtracker():
54 fRecpoints(new TClonesArray("AliPMDrecpoint1", 1000)),
55 fPMDcontin(new TObjArray()),
56 fPMDcontout(new TObjArray()),
57 fPMDutil(new AliPMDUtility()),
69 // Default Constructor
72 //--------------------------------------------------------------------//
73 AliPMDtracker::~AliPMDtracker()
90 fPMDcontout->Delete();
95 //--------------------------------------------------------------------//
96 void AliPMDtracker::LoadClusters(TTree *treein)
98 // Load the Reconstructed tree
101 //--------------------------------------------------------------------//
102 void AliPMDtracker::Clusters2Tracks(AliESD *event)
104 // Converts digits to recpoints after running clustering
105 // algorithm on CPV plane and PREshower plane
112 TBranch *branch = fTreeR->GetBranch("PMDRecpoint");
115 AliError("PMDRecpoint branch not found");
118 branch->SetAddress(&fRecpoints);
120 Int_t nmodules = (Int_t) branch->GetEntries();
122 AliDebug(1,Form("Number of modules filled in treeR = %d",nmodules));
123 for (Int_t imodule = 0; imodule < nmodules; imodule++)
125 branch->GetEntry(imodule);
126 Int_t nentries = fRecpoints->GetLast();
127 AliDebug(2,Form("Number of clusters per modules filled in treeR = %d"
129 for(Int_t ient = 0; ient < nentries+1; ient++)
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();
138 clusdata[4] = fPMDrecpoint->GetClusSigmaX();
139 clusdata[5] = fPMDrecpoint->GetClusSigmaY();
141 fPMDclin = new AliPMDrecpoint1(idet,ismn,clusdata);
142 fPMDcontin->Add(fPMDclin);
146 AliPMDDiscriminator *pmddiscriminator = new AliPMDEmpDiscriminator();
147 pmddiscriminator->Discrimination(fPMDcontin,fPMDcontout);
149 const Float_t kzpos = 361.5; // middle of the PMD
153 Float_t xpad = 0, ypad = 0;
154 Float_t adc, ncell, rad;
155 Float_t xglobal, yglobal, zglobal = 0;
159 Int_t nentries2 = fPMDcontout->GetEntries();
160 AliDebug(1,Form("Number of clusters coming after discrimination = %d"
162 for (Int_t ient1 = 0; ient1 < nentries2; ient1++)
164 fPMDclout = (AliPMDclupid*)fPMDcontout->UncheckedAt(ient1);
166 det = fPMDclout->GetDetector();
167 smn = fPMDclout->GetSMN();
168 xpos = fPMDclout->GetClusX();
169 ypos = fPMDclout->GetClusY();
170 adc = fPMDclout->GetClusADC();
171 ncell = fPMDclout->GetClusCells();
172 rad = fPMDclout->GetClusRadius();
173 pid = fPMDclout->GetClusPID();
176 // Now change the xpos and ypos to its original values
177 // for the unit modules which are earlier changed.
178 // xpad and ypad are the real positions.
180 /**********************************************************************
181 * det : Detector, 0: PRE & 1:CPV *
182 * smn : Serial Module Number from which Super Module Number *
183 * and Unit Module Numbers are extracted *
184 * xpos : x-position of the cluster *
185 * ypos : y-position of the cluster *
186 * THESE xpos & ypos are not the true xpos and ypos *
187 * for some of the unit modules. They are rotated. *
188 * adc : ADC contained in the cluster *
189 * ncell : Number of cells contained in the cluster *
190 * rad : radius of the cluster (1d fit) *
191 * ism : Supermodule number extracted from smn *
192 * ium : Unit module number extracted from smn *
193 * xpad : TRUE x-position of the cluster *
194 * ypad : TRUE y-position of the cluster *
195 **********************************************************************/
197 if(det == 0 || det == 1)
206 else if( smn >= 12 && smn < 24)
215 fPMDutil->RectGeomCellPos(ism,ium,xpad,ypad,xglobal,yglobal);
219 zglobal = kzpos + 1.6; // PREshower plane
223 zglobal = kzpos - 1.7; // CPV plane
229 AliESDPmdTrack *esdpmdtr = new AliESDPmdTrack();
231 esdpmdtr->SetDetector(det);
232 esdpmdtr->SetClusterX(xglobal);
233 esdpmdtr->SetClusterY(yglobal);
234 esdpmdtr->SetClusterZ(zglobal);
235 esdpmdtr->SetClusterADC(adc);
236 esdpmdtr->SetClusterCells(ncell);
237 esdpmdtr->SetClusterPID(pid);
239 event->AddPmdTrack(esdpmdtr);
242 //--------------------------------------------------------------------//
243 void AliPMDtracker::SetVertex(Double_t vtx[3], Double_t evtx[3])
252 //--------------------------------------------------------------------//
253 void AliPMDtracker::ResetClusters()
255 if (fRecpoints) fRecpoints->Clear();
257 //--------------------------------------------------------------------//