]>
Commit | Line | Data |
---|---|---|
b69620f8 | 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 | /* $Id: AliITSUReconstructor.cxx 58442 2012-09-04 17:17:06Z masera $ */ | |
17 | ||
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // class for ITS reconstruction // | |
21 | // // | |
22 | /////////////////////////////////////////////////////////////////////////////// | |
23 | ||
24 | #include "Riostream.h" | |
25 | #include "AliITSUReconstructor.h" | |
3d4dc3e2 | 26 | #include "AliITSURecoDet.h" |
b69620f8 | 27 | #include "AliRun.h" |
28 | #include "AliRawReader.h" | |
29 | #include "AliESDEvent.h" | |
30 | ||
31 | #include "AliTracker.h" | |
c64acbbe | 32 | #include "AliITSUTrackerCooked.h" |
30f37073 | 33 | #include "AliITSUCATracker.h" |
b69620f8 | 34 | |
35 | #include "AliITSUGeomTGeo.h" | |
36 | #include "AliITSUSegmentationPix.h" | |
37 | #include "AliITSUDigitPix.h" | |
38 | #include "AliITSUClusterizer.h" | |
5e375bb4 | 39 | #include "AliITSUClusterPix.h" |
b824a5f5 | 40 | #include "AliITSUVertexer.h" |
889b1493 | 41 | #include "AliMagF.h" |
b69620f8 | 42 | |
43 | ClassImp(AliITSUReconstructor) | |
44 | ||
45 | //___________________________________________________________________________ | |
46 | AliITSUReconstructor::AliITSUReconstructor() | |
47 | : AliReconstructor() | |
889b1493 | 48 | ,fGeom(0) |
3d4dc3e2 | 49 | ,fITS(0) |
b69620f8 | 50 | ,fClusterFinders(0) |
889b1493 | 51 | ,fClusters(0) |
b69620f8 | 52 | { |
53 | // Default constructor | |
54 | ||
55 | } | |
56 | ||
57 | //___________________________________________________________________________ | |
58 | AliITSUReconstructor::~AliITSUReconstructor() | |
59 | { | |
60 | // destructor | |
61 | // | |
889b1493 | 62 | if (!fGeom) return; // was not initialized |
b69620f8 | 63 | // |
64 | // same cluster finders and recpoint arrays might be attached to different layers | |
889b1493 | 65 | for (int i=fGeom->GetNLayers();i--;) { |
b69620f8 | 66 | TObject* clFinder = fClusterFinders.At(i); |
67 | if (clFinder) { | |
68 | while (fClusterFinders.Remove(clFinder)) {} | |
69 | delete clFinder; | |
70 | } | |
71 | // | |
44785f3e | 72 | delete fClusters[i]; |
b69620f8 | 73 | } |
44785f3e | 74 | delete[] fClusters; |
b69620f8 | 75 | // |
3d4dc3e2 | 76 | delete fITS; |
889b1493 | 77 | delete fGeom; |
b69620f8 | 78 | } |
79 | ||
80 | //______________________________________________________________________ | |
81 | void AliITSUReconstructor::Init() | |
82 | { | |
3d4dc3e2 | 83 | // Initalize this reconstructor |
84 | // Note: fITS cannot be initialized here since it requires RecoParams (not available ar | |
85 | // the moment of reconstructors initialization) | |
86 | // | |
889b1493 | 87 | AliInfo("Initializing"); |
88 | if (fGeom) AliFatal("was already done, something is wrong..."); | |
b69620f8 | 89 | // |
889b1493 | 90 | fGeom = new AliITSUGeomTGeo(kTRUE,kTRUE); |
91 | AliITSUClusterPix::SetGeom(fGeom); | |
b69620f8 | 92 | // |
93 | AliITSUClusterizer* clusPIX = 0; | |
889b1493 | 94 | fClusters = new TClonesArray*[fGeom->GetNLayers()]; |
b69620f8 | 95 | // |
889b1493 | 96 | for (int ilr=fGeom->GetNLayers();ilr--;) { |
97 | fClusters[ilr] = 0; | |
852af72e | 98 | int tpDet = fGeom->GetLayerChipTypeID(ilr)/AliITSUGeomTGeo::kMaxSegmPerChipType; |
99 | if (tpDet == AliITSUGeomTGeo::kChipTypePix) { | |
b69620f8 | 100 | if (!clusPIX) clusPIX = new AliITSUClusterizer(); |
b69620f8 | 101 | fClusterFinders.AddAtAndExpand(clusPIX, ilr); |
889b1493 | 102 | fClusters[ilr] = new TClonesArray(AliITSUClusterPix::Class()); |
b69620f8 | 103 | // |
546d00d8 | 104 | // to expand the buffers to max.size |
889b1493 | 105 | clusPIX->SetSegmentation((AliITSUSegmentationPix*)fGeom->GetSegmentation(ilr)); |
b69620f8 | 106 | continue; |
107 | } | |
108 | else { | |
109 | AliFatal(Form("ClusterFinder for detector type %d is not defined",tpDet)); | |
110 | } | |
111 | } | |
112 | // | |
113 | return; | |
b69620f8 | 114 | } |
115 | ||
116 | //_____________________________________________________________________________ | |
117 | void AliITSUReconstructor::Reconstruct(TTree *digitsTree, TTree *clustersTree) const | |
118 | { | |
1f9b6041 | 119 | // reconstruct clusters. If clustersTree is provided, write the tree |
120 | if (!digitsTree) return; | |
b69620f8 | 121 | AliDebug(1,"ITSU Cluster finder (from digits tree) is initiated here \n"); |
122 | // | |
123 | // At the moment only pixel digits | |
124 | TClonesArray *digArrPix = 0; | |
125 | digitsTree->SetBranchAddress("ITSDigitsPix",&digArrPix); | |
126 | // | |
127 | // a new tree is created for each event: add each layer as separate branch | |
889b1493 | 128 | TBranch *lrBranch[fGeom->GetNLayers()]; |
b69620f8 | 129 | // |
889b1493 | 130 | for (int ilr=0;ilr<fGeom->GetNLayers();ilr++) { |
44785f3e | 131 | lrBranch[ilr] = 0; |
1f9b6041 | 132 | if (clustersTree) { // do we write clusters tree? |
852af72e | 133 | int tp = fGeom->GetLayerChipTypeID(ilr)/AliITSUGeomTGeo::kMaxSegmPerChipType; |
134 | if (tp==AliITSUGeomTGeo::kChipTypePix) { | |
889b1493 | 135 | lrBranch[ilr] = clustersTree->Bronch(Form("ITSRecPoints%d",ilr),"TClonesArray",&fClusters[ilr]); |
1f9b6041 | 136 | } |
137 | else { | |
138 | AliFatal(Form("Detector type %d is not defined",tp)); | |
139 | } | |
b69620f8 | 140 | } |
141 | } | |
142 | // | |
143 | AliITSUClusterizer* clFinder = 0; | |
889b1493 | 144 | AliMagF* field = dynamic_cast<AliMagF*>(TGeoGlobalMagField::Instance()->GetField()); |
145 | double bz = 0; | |
146 | if (field == 0) AliError("Cannot get magnetic field from TGeoGlobalMagField"); | |
147 | else bz = field->SolenoidField(); | |
ee58ce21 | 148 | const AliITSURecoParam* recPar = GetRecoParam(); |
b69620f8 | 149 | // |
889b1493 | 150 | for (int ilr=0;ilr<fGeom->GetNLayers();ilr++) { |
b69620f8 | 151 | // |
889b1493 | 152 | fClusters[ilr]->Clear(); |
b69620f8 | 153 | clFinder = (AliITSUClusterizer*)fClusterFinders[ilr]; |
889b1493 | 154 | clFinder->SetSegmentation((AliITSUSegmentationPix*)fGeom->GetSegmentation(ilr)); |
155 | clFinder->SetLayerID(ilr); | |
156 | clFinder->SetClusters(fClusters[ilr]); | |
ee58ce21 | 157 | clFinder->SetRecoParam(recPar); // RS: Do we need to set it for every event? |
158 | clFinder->SetAllowDiagonalClusterization(recPar->GetAllowDiagonalClusterization(ilr)); | |
889b1493 | 159 | clFinder->PrepareLorentzAngleCorrection(bz); |
b69620f8 | 160 | // |
852af72e | 161 | int modF=fGeom->GetFirstChipIndex(ilr); |
162 | int modL=fGeom->GetLastChipIndex(ilr)+1; | |
b69620f8 | 163 | for (int imod=modF;imod<modL;imod++) { |
164 | digitsTree->GetEntry(imod); | |
165 | int ndig = digArrPix->GetEntries(); | |
166 | if (!ndig) continue; | |
167 | clFinder->SetVolID(imod); | |
168 | clFinder->SetDigits(digArrPix); | |
169 | clFinder->Clusterize(); | |
170 | } | |
171 | // | |
1f9b6041 | 172 | AliITSUClusterPix::SetSortMode( AliITSUClusterPix::SortModeIdTrkYZ()); |
889b1493 | 173 | fClusters[ilr]->Sort(); |
174 | AliDebug(1,Form(" -> Lr%d : %d Cluster",ilr,fClusters[ilr]->GetEntries())); | |
1f9b6041 | 175 | if (clustersTree) lrBranch[ilr]->Fill(); |
b69620f8 | 176 | } |
1f9b6041 | 177 | if (clustersTree) clustersTree->SetEntries(); |
b69620f8 | 178 | // |
179 | } | |
180 | ||
181 | //_____________________________________________________________________________ | |
182 | AliTracker* AliITSUReconstructor::CreateTracker() const | |
183 | { | |
184 | // create a ITS tracker | |
c64acbbe | 185 | Int_t opt = GetRecoParam()->GetTracker(); |
186 | Bool_t sa = GetRecoParam()->GetSAonly(); | |
187 | ||
188 | Info("CreateTracker","Creating the ITSU tracker %d in mode %d",opt,sa); | |
189 | ||
190 | AliTracker *tracker=0; | |
191 | switch (opt) { | |
192 | case 0: | |
193 | tracker = new AliITSUTrackerGlo((AliITSUReconstructor*)this); | |
194 | break; | |
195 | case 1: | |
196 | tracker = new AliITSUTrackerCooked((AliITSUReconstructor*)this); | |
197 | ((AliITSUTrackerCooked*)tracker)->SetSAonly(sa); | |
198 | break; | |
30f37073 | 199 | case 2: |
200 | tracker = new AliITSUCATracker((AliITSUReconstructor*)this); | |
201 | ((AliITSUCATracker*)tracker)->SetSAonly(sa); | |
202 | break; | |
c64acbbe | 203 | default: |
204 | AliFatal("Undefined ITSU tracker type !"); | |
205 | } | |
b69620f8 | 206 | |
b69620f8 | 207 | return tracker; |
dde91d5d | 208 | |
b69620f8 | 209 | } |
210 | ||
211 | //_____________________________________________________________________________ | |
212 | AliVertexer* AliITSUReconstructor::CreateVertexer() const | |
213 | { | |
214 | // create a ITS vertexer | |
ccbf0464 | 215 | // |
216 | AliInfo("Creating vertexer using tracklets with the first 3 ITS layers"); | |
aa582b42 | 217 | |
218 | if (GetRecoParam()->GetEventSpecie() & AliRecoParam::kHighMult) { | |
30f37073 | 219 | return new AliITSUVertexer(); |
220 | } else { | |
221 | return new AliITSUVertexer(0.05,0.003,0.04,0.8,3); | |
222 | } | |
b69620f8 | 223 | } |
224 | ||
225 | //_____________________________________________________________________________ | |
226 | AliTrackleter* AliITSUReconstructor::CreateMultFinder() const | |
227 | { | |
228 | // create the SPD trackeleter for mult. reconstruction | |
229 | // to be implemented for the upgrade | |
230 | ||
231 | AliDebug(1,"ITSU MultFinder should be initiated here\n"); | |
232 | return 0; | |
233 | ||
234 | } | |
235 | ||
236 | //_____________________________________________________________________________ | |
237 | AliTracker* AliITSUReconstructor::CreateTrackleter() const | |
238 | { | |
239 | // create the SPD trackeleter (for SPD PlaneEfficiency evaluation) | |
240 | // to be implemented for the upgrade | |
241 | ||
242 | AliDebug(1,"ITSU Trackleter should be initiated here\n"); | |
243 | return 0; | |
244 | ||
245 | } | |
246 | ||
ee52e7b5 | 247 | /* |
889b1493 | 248 | //_____________________________________________________________________________ |
249 | Int_t AliITSUReconstructor::LoadClusters(TTree* treeRP) | |
250 | { | |
251 | // read clusters from the tree, if it is provided | |
889b1493 | 252 | for (int ilr=fGeom->GetNLayers();ilr--;) { |
253 | if (!fClusters[ilr]) AliFatal(Form("Clusters array for layer %d is not defined",ilr)); | |
254 | TBranch* br = treeRP->GetBranch(Form("ITSRecPoints%d",ilr)); | |
255 | if (!br) AliFatal(Form("Provided cluster tree does not contain branch for layer %d",ilr)); | |
256 | br->SetAddress(&fClusters[ilr]); | |
257 | } | |
258 | treeRP->GetEntry(0); // we are still in 1 ev/tree mode... | |
259 | return 1; | |
260 | } | |
ee52e7b5 | 261 | */ |
262 | ||
3d4dc3e2 | 263 | |
264 | //_____________________________________________________________________________ | |
265 | AliITSURecoDet* AliITSUReconstructor::GetITSInterface() | |
266 | { | |
267 | // Create reco oriented interface to geometry | |
268 | if (fITS) return fITS; | |
269 | // | |
270 | fITS = new AliITSURecoDet(fGeom,"ITSURecoInterface"); | |
271 | int nLr = fITS->GetNLayersActive(); | |
272 | for (int ilr=nLr;ilr--;) fITS->GetLayerActive(ilr)->SetClusters(GetClusters(ilr)); | |
273 | return fITS; | |
274 | } |