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 "AliPMDtracker.h"
45 #include "AliESDPmdTrack.h"
49 ClassImp(AliPMDtracker)
51 AliPMDtracker::AliPMDtracker():
53 fRecpoints(new TClonesArray("AliPMDrecpoint1", 1000)),
54 fPMDcontin(new TObjArray()),
55 fPMDcontout(new TObjArray()),
56 fPMDdiscriminator(new AliPMDDiscriminator()),
57 fPMDutil(new AliPMDUtility()),
70 // Default Constructor
73 //--------------------------------------------------------------------//
74 AliPMDtracker::~AliPMDtracker()
91 fPMDcontout->Delete();
96 //--------------------------------------------------------------------//
97 void AliPMDtracker::LoadClusters(TTree *treein)
99 // Load the Reconstructed tree
102 //--------------------------------------------------------------------//
103 void AliPMDtracker::Clusters2Tracks(AliESD *event)
105 // Converts digits to recpoints after running clustering
106 // algorithm on CPV plane and PREshower plane
113 TBranch *branch = fTreeR->GetBranch("PMDRecpoint");
115 branch->SetAddress(&fRecpoints);
117 Int_t nmodules = (Int_t) fTreeR->GetEntries();
118 cout << " nmodules = " << nmodules << endl;
119 for (Int_t imodule = 0; imodule < nmodules; imodule++)
121 fTreeR->GetEntry(imodule);
122 Int_t nentries = fRecpoints->GetLast();
123 // cout << " nentries = " << nentries << endl;
124 for(Int_t ient = 0; ient < nentries+1; ient++)
126 fPMDrecpoint = (AliPMDrecpoint1*)fRecpoints->UncheckedAt(ient);
127 idet = fPMDrecpoint->GetDetector();
128 ismn = fPMDrecpoint->GetSMNumber();
129 clusdata[0] = fPMDrecpoint->GetClusX();
130 clusdata[1] = fPMDrecpoint->GetClusY();
131 clusdata[2] = fPMDrecpoint->GetClusADC();
132 clusdata[3] = fPMDrecpoint->GetClusCells();
133 clusdata[4] = fPMDrecpoint->GetClusRadius();
135 fPMDclin = new AliPMDcluster(idet,ismn,clusdata);
136 fPMDcontin->Add(fPMDclin);
140 fPMDdiscriminator->Discrimination(fPMDcontin,fPMDcontout);
142 const Float_t kzpos = 361.5;
146 Float_t xpad = 0, ypad = 0;
147 Float_t adc, ncell, rad;
148 Float_t xglobal, yglobal;
151 Float_t zglobal = kzpos + (Float_t) fZvertex;
153 Int_t nentries2 = fPMDcontout->GetEntries();
154 cout << " nentries2 = " << nentries2 << endl;
155 for (Int_t ient1 = 0; ient1 < nentries2; ient1++)
157 fPMDclout = (AliPMDclupid*)fPMDcontout->UncheckedAt(ient1);
159 det = fPMDclout->GetDetector();
160 smn = fPMDclout->GetSMN();
161 xpos = fPMDclout->GetClusX();
162 ypos = fPMDclout->GetClusY();
163 adc = fPMDclout->GetClusADC();
164 ncell = fPMDclout->GetClusCells();
165 rad = fPMDclout->GetClusRadius();
166 pid = fPMDclout->GetClusPID();
169 // Now change the xpos and ypos to its original values
170 // for the unit modules which are earlier changed.
171 // xpad and ypad are the real positions.
173 /**********************************************************************
174 * det : Detector, 0: PRE & 1:CPV *
175 * smn : Serial Module Number from which Super Module Number *
176 * and Unit Module Numbers are extracted *
177 * xpos : x-position of the cluster *
178 * ypos : y-position of the cluster *
179 * THESE xpos & ypos are not the true xpos and ypos *
180 * for some of the unit modules. They are rotated. *
181 * adc : ADC contained in the cluster *
182 * ncell : Number of cells contained in the cluster *
183 * rad : radius of the cluster (1d fit) *
184 * ism : Supermodule number extracted from smn *
185 * ium : Unit module number extracted from smn *
186 * xpad : TRUE x-position of the cluster *
187 * ypad : TRUE y-position of the cluster *
188 **********************************************************************/
190 if(det == 0 || det == 1)
199 else if( smn >= 12 && smn < 24)
208 fPMDutil->RectGeomCellPos(ism,ium,xpad,ypad,xglobal,yglobal);
209 fPMDutil->SetXYZ(xglobal,yglobal,zglobal);
210 fPMDutil->CalculateEtaPhi();
211 Float_t theta = fPMDutil->GetTheta();
212 Float_t phi = fPMDutil->GetPhi();
216 AliESDPmdTrack *esdpmdtr = new AliESDPmdTrack();
218 esdpmdtr->SetDetector(det);
219 esdpmdtr->SetTheta(theta);
220 esdpmdtr->SetPhi(phi);
221 esdpmdtr->SetClusterADC(adc);
222 esdpmdtr->SetClusterPID(pid);
224 event->AddPmdTrack(esdpmdtr);
228 //--------------------------------------------------------------------//
229 void AliPMDtracker::SetVertex(Double_t vtx[3], Double_t evtx[3])
238 //--------------------------------------------------------------------//
239 void AliPMDtracker::SetDebug(Int_t idebug)
243 //--------------------------------------------------------------------//
244 void AliPMDtracker::ResetClusters()
246 if (fRecpoints) fRecpoints->Clear();
248 //--------------------------------------------------------------------//