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