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 /* $Id: AliITSUReconstructor.cxx 58442 2012-09-04 17:17:06Z masera $ */
18 ///////////////////////////////////////////////////////////////////////////////
20 // class for ITS reconstruction //
22 ///////////////////////////////////////////////////////////////////////////////
24 #include "Riostream.h"
25 #include "AliITSUReconstructor.h"
27 #include "AliRawReader.h"
28 #include "AliESDEvent.h"
30 #include "AliTracker.h"
31 #include "AliITStrackerMI.h"
33 #include "AliITSUGeomTGeo.h"
34 #include "AliITSUSegmentationPix.h"
35 #include "AliITSUDigitPix.h"
36 #include "AliITSUClusterizer.h"
38 ClassImp(AliITSUReconstructor)
40 //___________________________________________________________________________
41 AliITSUReconstructor::AliITSUReconstructor()
48 // Default constructor
52 //___________________________________________________________________________
53 AliITSUReconstructor::~AliITSUReconstructor()
57 if (!fGM) return; // was not initialized
59 // same cluster finders and recpoint arrays might be attached to different layers
60 for (int i=fGM->GetNLayers();i--;) {
61 TObject* clFinder = fClusterFinders.At(i);
63 while (fClusterFinders.Remove(clFinder)) {}
67 TObject* arrRP = fRecPoints.At(i);
69 while (fRecPoints.Remove(arrRP)) {}
78 //______________________________________________________________________
79 void AliITSUReconstructor::Init()
82 // Initalize this constructor
83 if (fGM) AliFatal("was already done, something is wrong...");
85 fGM = new AliITSUGeomTGeo(kTRUE);
86 AliITSUSegmentationPix::LoadSegmentations(&fSegmArr, AliITSUGeomTGeo::GetITSsegmentationFileName());
88 AliITSUClusterizer* clusPIX = 0;
89 TClonesArray* rpArrayPix = 0;
91 for (int ilr=fGM->GetNLayers();ilr--;) {
92 int tp = fGM->GetLayerDetTypeID(ilr);
93 int tpDet = tp/AliITSUGeomTGeo::kMaxSegmPerDetType;
94 if (tpDet == AliITSUGeomTGeo::kDetTypePix) {
95 if (!clusPIX) clusPIX = new AliITSUClusterizer();
96 if (!rpArrayPix) rpArrayPix = new TClonesArray(AliCluster::Class());
98 fClusterFinders.AddAtAndExpand(clusPIX, ilr);
99 fRecPoints.AddAtAndExpand(rpArrayPix, ilr);
101 AliITSUSegmentationPix* sg = (AliITSUSegmentationPix*)fSegmArr.At(tp);
102 clusPIX->SetSegmentation(sg); // to expand the buffers to max.size
106 AliFatal(Form("ClusterFinder for detector type %d is not defined",tpDet));
114 //_____________________________________________________________________________
115 void AliITSUReconstructor::Reconstruct(TTree *digitsTree, TTree *clustersTree) const
117 // reconstruct clusters
118 if (!digitsTree || !clustersTree) return;
119 AliDebug(1,"ITSU Cluster finder (from digits tree) is initiated here \n");
121 // At the moment only pixel digits
122 TClonesArray *digArrPix = 0;
123 digitsTree->SetBranchAddress("ITSDigitsPix",&digArrPix);
125 // a new tree is created for each event: add each layer as separate branch
126 TBranch *lrBranch[fGM->GetNLayers()];
127 TClonesArray *rpClones[fGM->GetNLayers()];
129 for (int ilr=0;ilr<fGM->GetNLayers();ilr++) {
130 rpClones[ilr] = (TClonesArray*)fRecPoints.At(ilr);
131 int tp = fGM->GetLayerDetTypeID(ilr)/AliITSUGeomTGeo::kMaxSegmPerDetType;
132 if (tp==AliITSUGeomTGeo::kDetTypePix) {
133 lrBranch[ilr] = clustersTree->Bronch(Form("ITSRecPoints%d",ilr),"TClonesArray",&rpClones[ilr]);
136 AliFatal(Form("Detector type %d is not defined",tp));
140 AliITSUClusterizer* clFinder = 0;
142 for (int ilr=0;ilr<fGM->GetNLayers();ilr++) {
144 int tp = fGM->GetLayerDetTypeID(ilr)/AliITSUGeomTGeo::kMaxSegmPerDetType;
145 AliITSUSegmentationPix* segm = (AliITSUSegmentationPix*)fSegmArr.At(tp);
147 clFinder = (AliITSUClusterizer*)fClusterFinders[ilr];
148 clFinder->SetSegmentation(segm);
149 clFinder->SetClusters(rpClones[ilr]);
151 int modF=fGM->GetFirstModIndex(ilr);
152 int modL=fGM->GetLastModIndex(ilr)+1;
153 for (int imod=modF;imod<modL;imod++) {
154 digitsTree->GetEntry(imod);
155 int ndig = digArrPix->GetEntries();
157 clFinder->SetVolID(imod);
158 clFinder->SetDigits(digArrPix);
159 clFinder->Clusterize();
162 AliDebug(1,Form(" -> Lr%d : %d Cluster",ilr,rpClones[ilr]->GetEntries()));
163 lrBranch[ilr]->Fill();
164 rpClones[ilr]->Clear();
166 clustersTree->SetEntries();
170 //_____________________________________________________________________________
171 AliTracker* AliITSUReconstructor::CreateTracker() const
173 // create a ITS tracker
175 AliDebug(1,"ITSU tracking initialization will be done here\n");
179 /* // from Current ITS
180 Int_t trackerOpt = GetRecoParam()->GetTracker();
183 tracker = new AliITStrackerMI(0);
184 AliITStrackerMI *mit=(AliITStrackerMI*)tracker;
185 mit->SetDetTypeRec(fDetTypeRec);
187 else if (trackerOpt==2) {
188 tracker = new AliITStrackerV2(0);
191 tracker = new AliITStrackerSA(0); // inherits from AliITStrackerMI
192 AliITStrackerSA *sat=(AliITStrackerSA*)tracker;
193 sat->SetDetTypeRec(fDetTypeRec);
194 if(GetRecoParam()->GetTrackerSAOnly()) sat->SetSAFlag(kTRUE);
195 if(sat->GetSAFlag())AliDebug(1,"Tracking Performed in ITS only\n");
196 if(GetRecoParam()->GetInwardFindingSA()){
197 sat->SetInwardFinding();
198 sat->SetInnerStartLayer(GetRecoParam()->GetInnerStartLayerSA());
200 sat->SetOutwardFinding();
201 sat->SetOuterStartLayer(GetRecoParam()->GetOuterStartLayerSA());
203 sat->SetMinNPoints(GetRecoParam()->GetMinNPointsSA());
211 //_____________________________________________________________________________
212 AliVertexer* AliITSUReconstructor::CreateVertexer() const
214 // create a ITS vertexer
215 // to be implemented for the upgrade
217 AliDebug(1,"ITSU vertexer should be initiated here\n");
222 //_____________________________________________________________________________
223 AliTrackleter* AliITSUReconstructor::CreateMultFinder() const
225 // create the SPD trackeleter for mult. reconstruction
226 // to be implemented for the upgrade
228 AliDebug(1,"ITSU MultFinder should be initiated here\n");
233 //_____________________________________________________________________________
234 AliTracker* AliITSUReconstructor::CreateTrackleter() const
236 // create the SPD trackeleter (for SPD PlaneEfficiency evaluation)
237 // to be implemented for the upgrade
239 AliDebug(1,"ITSU Trackleter should be initiated here\n");