]>
Commit | Line | Data |
---|---|---|
a9e2aefa | 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 | /* | |
17 | $Log$ | |
8832c7b4 | 18 | Revision 1.10 2000/09/19 09:49:50 gosset |
19 | AliMUONEventReconstructor package | |
20 | * track extrapolation independent from reco_muon.F, use of AliMagF... | |
21 | * possibility to use new magnetic field (automatic from generated root file) | |
22 | ||
a6f03ddb | 23 | Revision 1.9 2000/07/20 12:45:27 gosset |
24 | New "EventReconstructor..." structure, | |
25 | hopefully more adapted to tree/streamer. | |
26 | "AliMUONEventReconstructor::RemoveDoubleTracks" | |
27 | to keep only one track among similar ones. | |
28 | ||
8429a5e4 | 29 | Revision 1.8 2000/07/18 16:04:06 gosset |
30 | AliMUONEventReconstructor package: | |
31 | * a few minor modifications and more comments | |
32 | * a few corrections | |
33 | * right sign for Z of raw clusters | |
34 | * right loop over chambers inside station | |
35 | * symmetrized covariance matrix for measurements (TrackChi2MCS) | |
36 | * right sign of charge in extrapolation (ExtrapToZ) | |
37 | * right zEndAbsorber for Branson correction below 3 degrees | |
38 | * use of TVirtualFitter instead of TMinuit for AliMUONTrack::Fit | |
39 | * no parameter for AliMUONTrack::Fit() but more fit parameters in Track object | |
40 | ||
956019b6 | 41 | Revision 1.7 2000/07/03 12:28:06 gosset |
42 | Printout at the right place after extrapolation to vertex | |
43 | ||
6ae236ee | 44 | Revision 1.6 2000/06/30 12:01:06 gosset |
45 | Correction for hit search in the right chamber (JPC) | |
46 | ||
d82671a0 | 47 | Revision 1.5 2000/06/30 10:15:48 gosset |
48 | Changes to EventReconstructor...: | |
49 | precision fit with multiple Coulomb scattering; | |
50 | extrapolation to vertex with Branson correction in absorber (JPC) | |
51 | ||
04b5ea16 | 52 | Revision 1.4 2000/06/27 14:11:36 gosset |
53 | Corrections against violations of coding conventions | |
54 | ||
9cbdf048 | 55 | Revision 1.3 2000/06/16 07:27:08 gosset |
56 | To remove problem in running RuleChecker, like in MUON-dev | |
57 | ||
79e1e601 | 58 | Revision 1.1.2.5 2000/06/16 07:00:26 gosset |
59 | To remove problem in running RuleChecker | |
60 | ||
a9e2aefa | 61 | Revision 1.1.2.4 2000/06/12 08:00:07 morsch |
62 | Dummy streamer to solve CINT compilation problem (to be investigated !) | |
63 | ||
64 | Revision 1.1.2.3 2000/06/09 20:59:57 morsch | |
65 | Make includes consistent with new file structure. | |
66 | ||
67 | Revision 1.1.2.2 2000/06/09 12:58:05 gosset | |
68 | Removed comment beginnings in Log sections of .cxx files | |
69 | Suppressed most violations of coding rules | |
70 | ||
71 | Revision 1.1.2.1 2000/06/07 14:44:53 gosset | |
72 | Addition of files for track reconstruction in C++ | |
73 | */ | |
74 | ||
75 | //__________________________________________________________________________ | |
76 | // | |
77 | // MUON event reconstructor in ALICE | |
78 | // | |
79 | // This class contains as data: | |
80 | // * the parameters for the event reconstruction | |
81 | // * a pointer to the array of hits to be reconstructed (the event) | |
82 | // * a pointer to the array of segments made with these hits inside each station | |
83 | // * a pointer to the array of reconstructed tracks | |
84 | // | |
85 | // It contains as methods, among others: | |
86 | // * MakeEventToBeReconstructed to build the array of hits to be reconstructed | |
87 | // * MakeSegments to build the segments | |
88 | // * MakeTracks to build the tracks | |
89 | //__________________________________________________________________________ | |
90 | ||
91 | #include <iostream.h> | |
92 | ||
93 | #include <TRandom.h> | |
94 | #include <TFile.h> | |
95 | ||
a9e2aefa | 96 | #include "AliMUONEventReconstructor.h" |
97 | #include "AliMUON.h" | |
98 | #include "AliMUONHitForRec.h" | |
99 | #include "AliMUONSegment.h" | |
100 | #include "AliMUONHit.h" | |
101 | #include "AliMUONRawCluster.h" | |
102 | #include "AliMUONTrack.h" | |
103 | #include "AliMUONChamber.h" | |
104 | #include "AliMUONTrackHit.h" | |
105 | #include "AliRun.h" | |
04b5ea16 | 106 | #include "TParticle.h" |
a9e2aefa | 107 | |
a9e2aefa | 108 | //************* Defaults parameters for reconstruction |
9cbdf048 | 109 | static const Double_t kDefaultMinBendingMomentum = 3.0; |
110 | static const Double_t kDefaultMaxSigma2Distance = 16.0; | |
111 | static const Double_t kDefaultBendingResolution = 0.01; | |
112 | static const Double_t kDefaultNonBendingResolution = 0.144; | |
113 | static const Double_t kDefaultChamberThicknessInX0 = 0.03; | |
a9e2aefa | 114 | // Simple magnetic field: |
115 | // Value taken from macro MUONtracking.C: 0.7 T, hence 7 kG | |
116 | // Length and Position from reco_muon.F, with opposite sign: | |
117 | // Length = ZMAGEND-ZCOIL | |
118 | // Position = (ZMAGEND+ZCOIL)/2 | |
119 | // to be ajusted differently from real magnetic field ???? | |
9cbdf048 | 120 | static const Double_t kDefaultSimpleBValue = 7.0; |
121 | static const Double_t kDefaultSimpleBLength = 428.0; | |
122 | static const Double_t kDefaultSimpleBPosition = 1019.0; | |
123 | static const Int_t kDefaultRecGeantHits = 0; | |
124 | static const Double_t kDefaultEfficiency = 0.95; | |
a9e2aefa | 125 | |
9cbdf048 | 126 | static const Int_t kDefaultPrintLevel = 0; |
a9e2aefa | 127 | |
128 | ClassImp(AliMUONEventReconstructor) // Class implementation in ROOT context | |
129 | ||
130 | //__________________________________________________________________________ | |
131 | AliMUONEventReconstructor::AliMUONEventReconstructor(void) | |
132 | { | |
133 | // Constructor for class AliMUONEventReconstructor | |
134 | SetReconstructionParametersToDefaults(); | |
135 | // Memory allocation for the TClonesArray of hits for reconstruction | |
136 | // Is 10000 the right size ???? | |
137 | fHitsForRecPtr = new TClonesArray("AliMUONHitForRec", 10000); | |
138 | fNHitsForRec = 0; // really needed or GetEntriesFast sufficient ???? | |
139 | // Memory allocation for the TClonesArray's of segments in stations | |
140 | // Is 2000 the right size ???? | |
9cbdf048 | 141 | for (Int_t st = 0; st < kMaxMuonTrackingStations; st++) { |
a9e2aefa | 142 | fSegmentsPtr[st] = new TClonesArray("AliMUONSegment", 2000); |
143 | fNSegments[st] = 0; // really needed or GetEntriesFast sufficient ???? | |
144 | } | |
145 | // Memory allocation for the TClonesArray of reconstructed tracks | |
146 | // Is 10 the right size ???? | |
147 | fRecTracksPtr = new TClonesArray("AliMUONTrack", 10); | |
148 | fNRecTracks = 0; // really needed or GetEntriesFast sufficient ???? | |
8429a5e4 | 149 | // Memory allocation for the TClonesArray of hits on reconstructed tracks |
150 | // Is 100 the right size ???? | |
151 | fRecTrackHitsPtr = new TClonesArray("AliMUONTrack", 100); | |
152 | fNRecTrackHits = 0; // really needed or GetEntriesFast sufficient ???? | |
a9e2aefa | 153 | |
a6f03ddb | 154 | // Sign of fSimpleBValue according to sign of value at (50,50,950). |
155 | Float_t b[3], x[3]; | |
156 | x[0] = 50.; x[1] = 50.; x[2] = 950.; | |
157 | gAlice->Field()->Field(x, b); | |
8832c7b4 | 158 | fSimpleBValue = TMath::Sign(fSimpleBValue,(Double_t) b[2]); |
a6f03ddb | 159 | // See how to get fSimple(BValue, BLength, BPosition) |
160 | // automatically calculated from the actual magnetic field ???? | |
a9e2aefa | 161 | |
162 | if (fPrintLevel >= 0) { | |
a6f03ddb | 163 | cout << "AliMUONEventReconstructor constructed with defaults" << endl; Dump(); |
164 | cout << endl << "Magnetic field from root file:" << endl; | |
165 | gAlice->Field()->Dump(); | |
166 | cout << endl; | |
167 | } | |
a9e2aefa | 168 | return; |
169 | } | |
170 | ||
9cbdf048 | 171 | AliMUONEventReconstructor::AliMUONEventReconstructor (const AliMUONEventReconstructor& Reconstructor) |
172 | { | |
173 | // Dummy copy constructor | |
174 | } | |
175 | ||
176 | AliMUONEventReconstructor & AliMUONEventReconstructor::operator=(const AliMUONEventReconstructor& Reconstructor) | |
177 | { | |
178 | // Dummy assignment operator | |
179 | return *this; | |
180 | } | |
181 | ||
a9e2aefa | 182 | //__________________________________________________________________________ |
183 | AliMUONEventReconstructor::~AliMUONEventReconstructor(void) | |
184 | { | |
185 | // Destructor for class AliMUONEventReconstructor | |
186 | delete fHitsForRecPtr; // Correct destruction of everything ???? or delete [] ???? | |
9cbdf048 | 187 | for (Int_t st = 0; st < kMaxMuonTrackingStations; st++) |
a9e2aefa | 188 | delete fSegmentsPtr[st]; // Correct destruction of everything ???? |
189 | return; | |
190 | } | |
191 | ||
192 | //__________________________________________________________________________ | |
193 | void AliMUONEventReconstructor::SetReconstructionParametersToDefaults(void) | |
194 | { | |
195 | // Set reconstruction parameters to default values | |
196 | // Would be much more convenient with a structure (or class) ???? | |
9cbdf048 | 197 | fMinBendingMomentum = kDefaultMinBendingMomentum; |
198 | fMaxSigma2Distance = kDefaultMaxSigma2Distance; | |
a9e2aefa | 199 | |
9cbdf048 | 200 | AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON"); |
a9e2aefa | 201 | // ******** Parameters for making HitsForRec |
202 | // minimum radius, | |
203 | // like in TRACKF_STAT: | |
204 | // 2 degrees for stations 1 and 2, or ch(0...) from 0 to 3; | |
205 | // 30 cm for stations 3 to 5, or ch(0...) from 4 to 9 | |
9cbdf048 | 206 | for (Int_t ch = 0; ch < kMaxMuonTrackingChambers; ch++) { |
207 | if (ch < 4) fRMin[ch] = TMath::Abs((&(pMUON->Chamber(ch)))->Z()) * | |
a9e2aefa | 208 | 2.0 * TMath::Pi() / 180.0; |
209 | else fRMin[ch] = 30.0; | |
210 | } | |
211 | // maximum radius | |
212 | // like in TRACKF_STAT (10 degrees ????) | |
213 | fRMax[0] = fRMax[1] = 91.5; | |
214 | fRMax[2] = fRMax[3] = 122.5; | |
215 | fRMax[4] = fRMax[5] = 158.3; | |
216 | fRMax[6] = fRMax[7] = 260.0; | |
217 | fRMax[8] = fRMax[9] = 260.0; | |
218 | ||
219 | // ******** Parameters for making segments | |
220 | // should be parametrized ???? | |
221 | // according to interval between chambers in a station ???? | |
222 | // Maximum distance in non bending plane | |
223 | // 5 * 0.22 just to remember the way it was made in TRACKF_STAT | |
224 | // SIGCUT*DYMAX(IZ) | |
9cbdf048 | 225 | for (Int_t st = 0; st < kMaxMuonTrackingStations; st++) |
a9e2aefa | 226 | fSegmentMaxDistNonBending[st] = 5. * 0.22; |
227 | // Maximum distance in bending plane | |
228 | // values from TRACKF_STAT corresponding to (J psi 20cm) | |
229 | fSegmentMaxDistBending[0] = 1.5; | |
230 | fSegmentMaxDistBending[1] = 1.5; | |
231 | fSegmentMaxDistBending[2] = 3.0; | |
232 | fSegmentMaxDistBending[3] = 6.0; | |
233 | fSegmentMaxDistBending[4] = 6.0; | |
234 | ||
9cbdf048 | 235 | fBendingResolution = kDefaultBendingResolution; |
236 | fNonBendingResolution = kDefaultNonBendingResolution; | |
237 | fChamberThicknessInX0 = kDefaultChamberThicknessInX0; | |
238 | fSimpleBValue = kDefaultSimpleBValue; | |
239 | fSimpleBLength = kDefaultSimpleBLength; | |
240 | fSimpleBPosition = kDefaultSimpleBPosition; | |
241 | fRecGeantHits = kDefaultRecGeantHits; | |
242 | fEfficiency = kDefaultEfficiency; | |
243 | fPrintLevel = kDefaultPrintLevel; | |
a9e2aefa | 244 | return; |
245 | } | |
246 | ||
247 | //__________________________________________________________________________ | |
248 | Double_t AliMUONEventReconstructor::GetImpactParamFromBendingMomentum(Double_t BendingMomentum) | |
249 | { | |
250 | // Returns impact parameter at vertex in bending plane (cm), | |
251 | // from the signed bending momentum "BendingMomentum" in bending plane (GeV/c), | |
252 | // using simple values for dipole magnetic field. | |
253 | // The sign is the sign of the charge. | |
254 | return (-0.0003 * fSimpleBValue * fSimpleBLength * fSimpleBPosition / | |
255 | BendingMomentum); | |
256 | } | |
257 | ||
258 | //__________________________________________________________________________ | |
259 | Double_t AliMUONEventReconstructor::GetBendingMomentumFromImpactParam(Double_t ImpactParam) | |
260 | { | |
261 | // Returns signed bending momentum in bending plane (GeV/c), | |
262 | // from the impact parameter "ImpactParam" at vertex in bending plane (cm), | |
263 | // using simple values for dipole magnetic field. | |
264 | // The sign is the sign of the charge. | |
265 | return (-0.0003 * fSimpleBValue * fSimpleBLength * fSimpleBPosition / | |
266 | ImpactParam); | |
267 | } | |
268 | ||
269 | //__________________________________________________________________________ | |
270 | void AliMUONEventReconstructor::SetBkgGeantFile(Text_t *BkgGeantFileName) | |
271 | { | |
272 | // Set background file ... for GEANT hits | |
273 | // Must be called after having loaded the firts signal event | |
274 | if (fPrintLevel >= 0) { | |
275 | cout << "Enter SetBkgGeantFile with BkgGeantFileName ``" | |
276 | << BkgGeantFileName << "''" << endl;} | |
277 | if (strlen(BkgGeantFileName)) { | |
278 | // BkgGeantFileName not empty: try to open the file | |
279 | if (fPrintLevel >= 2) {cout << "Before File(Bkg)" << endl; gDirectory->Dump();} | |
280 | fBkgGeantFile = new TFile(BkgGeantFileName); | |
281 | if (fPrintLevel >= 2) {cout << "After File(Bkg)" << endl; gDirectory->Dump();} | |
282 | if (fBkgGeantFile-> IsOpen()) { | |
283 | if (fPrintLevel >= 0) { | |
284 | cout << "Background for GEANT hits in file: ``" << BkgGeantFileName | |
285 | << "'' successfully opened" << endl;} | |
286 | } | |
287 | else { | |
288 | cout << "Background for GEANT hits in file: " << BkgGeantFileName << endl; | |
289 | cout << "NOT FOUND: EXIT" << endl; | |
290 | exit(0); // right instruction for exit ???? | |
291 | } | |
292 | // Arrays for "particles" and "hits" | |
293 | fBkgGeantParticles = new TClonesArray("TParticle", 200); | |
294 | fBkgGeantHits = new TClonesArray("AliMUONHit", 2000); | |
295 | // Event number to -1 for initialization | |
296 | fBkgGeantEventNumber = -1; | |
297 | // Back to the signal file: | |
298 | // first signal event must have been loaded previously, | |
299 | // otherwise, Segmentation violation at the next instruction | |
300 | // How is it possible to do smething better ???? | |
301 | ((gAlice->TreeK())->GetCurrentFile())->cd(); | |
302 | if (fPrintLevel >= 2) {cout << "After cd(gAlice)" << endl; gDirectory->Dump();} | |
303 | } | |
304 | return; | |
305 | } | |
306 | ||
307 | //__________________________________________________________________________ | |
308 | void AliMUONEventReconstructor::NextBkgGeantEvent(void) | |
309 | { | |
310 | // Get next event in background file for GEANT hits | |
311 | // Goes back to event number 0 when end of file is reached | |
312 | char treeName[20]; | |
313 | TBranch *branch; | |
314 | if (fPrintLevel >= 0) { | |
315 | cout << "Enter NextBkgGeantEvent" << endl;} | |
316 | // Clean previous event | |
317 | if(fBkgGeantTK) delete fBkgGeantTK; | |
318 | fBkgGeantTK = NULL; | |
319 | if(fBkgGeantParticles) fBkgGeantParticles->Clear(); | |
320 | if(fBkgGeantTH) delete fBkgGeantTH; | |
321 | fBkgGeantTH = NULL; | |
322 | if(fBkgGeantHits) fBkgGeantHits->Clear(); | |
323 | // Increment event number | |
324 | fBkgGeantEventNumber++; | |
325 | // Get access to Particles and Hits for event from background file | |
326 | if (fPrintLevel >= 2) {cout << "Before cd(Bkg)" << endl; gDirectory->Dump();} | |
327 | fBkgGeantFile->cd(); | |
328 | if (fPrintLevel >= 2) {cout << "After cd(Bkg)" << endl; gDirectory->Dump();} | |
329 | // Particles: TreeK for event and branch "Particles" | |
330 | sprintf(treeName, "TreeK%d", fBkgGeantEventNumber); | |
331 | fBkgGeantTK = (TTree*)gDirectory->Get(treeName); | |
332 | if (!fBkgGeantTK) { | |
333 | if (fPrintLevel >= 0) { | |
334 | cout << "Cannot find Kine Tree for background event: " << | |
335 | fBkgGeantEventNumber << endl; | |
336 | cout << "Goes back to event 0" << endl; | |
337 | } | |
338 | fBkgGeantEventNumber = 0; | |
339 | sprintf(treeName, "TreeK%d", fBkgGeantEventNumber); | |
340 | fBkgGeantTK = (TTree*)gDirectory->Get(treeName); | |
341 | if (!fBkgGeantTK) { | |
342 | cout << "ERROR: cannot find Kine Tree for background event: " << | |
343 | fBkgGeantEventNumber << endl; | |
344 | exit(0); | |
345 | } | |
346 | } | |
347 | if (fBkgGeantTK) | |
348 | fBkgGeantTK->SetBranchAddress("Particles", &fBkgGeantParticles); | |
349 | fBkgGeantTK->GetEvent(0); // why event 0 ???? necessary ???? | |
350 | // Hits: TreeH for event and branch "MUON" | |
351 | sprintf(treeName, "TreeH%d", fBkgGeantEventNumber); | |
352 | fBkgGeantTH = (TTree*)gDirectory->Get(treeName); | |
353 | if (!fBkgGeantTH) { | |
354 | cout << "ERROR: cannot find Hits Tree for background event: " << | |
355 | fBkgGeantEventNumber << endl; | |
356 | exit(0); | |
357 | } | |
358 | if (fBkgGeantTH && fBkgGeantHits) { | |
359 | branch = fBkgGeantTH->GetBranch("MUON"); | |
360 | if (branch) branch->SetAddress(&fBkgGeantHits); | |
361 | } | |
362 | fBkgGeantTH->GetEntries(); // necessary ???? | |
363 | // Back to the signal file | |
364 | ((gAlice->TreeK())->GetCurrentFile())->cd(); | |
365 | if (fPrintLevel >= 2) {cout << "After cd(gAlice)" << endl; gDirectory->Dump();} | |
366 | return; | |
367 | } | |
368 | ||
369 | //__________________________________________________________________________ | |
370 | void AliMUONEventReconstructor::EventReconstruct(void) | |
371 | { | |
372 | // To reconstruct one event | |
373 | if (fPrintLevel >= 1) cout << "enter EventReconstruct" << endl; | |
374 | MakeEventToBeReconstructed(); | |
375 | MakeSegments(); | |
376 | MakeTracks(); | |
377 | return; | |
378 | } | |
379 | ||
380 | //__________________________________________________________________________ | |
381 | void AliMUONEventReconstructor::ResetHitsForRec(void) | |
382 | { | |
383 | // To reset the array and the number of HitsForRec, | |
384 | // and also the number of HitsForRec | |
385 | // and the index of the first HitForRec per chamber | |
386 | if (fHitsForRecPtr) fHitsForRecPtr->Clear(); | |
387 | fNHitsForRec = 0; | |
9cbdf048 | 388 | for (Int_t ch = 0; ch < kMaxMuonTrackingChambers; ch++) |
a9e2aefa | 389 | fNHitsForRecPerChamber[ch] = fIndexOfFirstHitForRecPerChamber[ch] = 0; |
390 | return; | |
391 | } | |
392 | ||
393 | //__________________________________________________________________________ | |
394 | void AliMUONEventReconstructor::ResetSegments(void) | |
395 | { | |
396 | // To reset the TClonesArray of segments and the number of Segments | |
397 | // for all stations | |
9cbdf048 | 398 | for (Int_t st = 0; st < kMaxMuonTrackingStations; st++) { |
a9e2aefa | 399 | if (fSegmentsPtr[st]) fSegmentsPtr[st]->Clear(); |
400 | fNSegments[st] = 0; | |
401 | } | |
402 | return; | |
403 | } | |
404 | ||
405 | //__________________________________________________________________________ | |
406 | void AliMUONEventReconstructor::ResetTracks(void) | |
407 | { | |
408 | // To reset the TClonesArray of reconstructed tracks | |
8429a5e4 | 409 | if (fRecTracksPtr) fRecTracksPtr->Delete(); |
410 | // Delete in order that the Track destructors are called, | |
411 | // hence the space for the TClonesArray of pointers to TrackHit's is freed | |
a9e2aefa | 412 | fNRecTracks = 0; |
413 | return; | |
414 | } | |
415 | ||
8429a5e4 | 416 | //__________________________________________________________________________ |
417 | void AliMUONEventReconstructor::ResetTrackHits(void) | |
418 | { | |
419 | // To reset the TClonesArray of hits on reconstructed tracks | |
420 | if (fRecTrackHitsPtr) fRecTrackHitsPtr->Clear(); | |
421 | fNRecTrackHits = 0; | |
422 | return; | |
423 | } | |
424 | ||
a9e2aefa | 425 | //__________________________________________________________________________ |
426 | void AliMUONEventReconstructor::MakeEventToBeReconstructed(void) | |
427 | { | |
428 | // To make the list of hits to be reconstructed, | |
429 | // either from the GEANT hits or from the raw clusters | |
430 | // according to the parameter set for the reconstructor | |
431 | if (fPrintLevel >= 1) cout << "enter MakeEventToBeReconstructed" << endl; | |
432 | ResetHitsForRec(); | |
433 | if (fRecGeantHits == 1) { | |
434 | // Reconstruction from GEANT hits | |
435 | // Back to the signal file | |
436 | ((gAlice->TreeK())->GetCurrentFile())->cd(); | |
437 | // Signal hits | |
438 | // AliMUON *MUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ???? | |
439 | // Security on MUON ???? | |
440 | AddHitsForRecFromGEANT(gAlice->TreeH()); | |
441 | // Background hits | |
442 | AddHitsForRecFromBkgGEANT(fBkgGeantTH, fBkgGeantHits); | |
443 | // Sort HitsForRec in increasing order with respect to chamber number | |
444 | SortHitsForRecWithIncreasingChamber(); | |
445 | } | |
446 | else { | |
447 | // Reconstruction from raw clusters | |
448 | // AliMUON *MUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ???? | |
449 | // Security on MUON ???? | |
450 | // TreeR assumed to be be "prepared" in calling function | |
451 | // by "MUON->GetTreeR(nev)" ???? | |
9cbdf048 | 452 | TTree *treeR = gAlice->TreeR(); |
453 | AddHitsForRecFromRawClusters(treeR); | |
a9e2aefa | 454 | // No sorting: it is done automatically in the previous function |
455 | } | |
456 | if (fPrintLevel >= 10) { | |
457 | cout << "end of MakeEventToBeReconstructed" << endl; | |
458 | cout << "NHitsForRec: " << fNHitsForRec << endl; | |
9cbdf048 | 459 | for (Int_t ch = 0; ch < kMaxMuonTrackingChambers; ch++) { |
a9e2aefa | 460 | cout << "chamber(0...): " << ch |
461 | << " NHitsForRec: " << fNHitsForRecPerChamber[ch] | |
462 | << " index(first HitForRec): " << fIndexOfFirstHitForRecPerChamber[ch] | |
463 | << endl; | |
464 | for (Int_t hit = fIndexOfFirstHitForRecPerChamber[ch]; | |
465 | hit < fIndexOfFirstHitForRecPerChamber[ch] + fNHitsForRecPerChamber[ch]; | |
466 | hit++) { | |
467 | cout << "HitForRec index(0...): " << hit << endl; | |
468 | ((*fHitsForRecPtr)[hit])->Dump(); | |
469 | } | |
470 | } | |
471 | } | |
472 | return; | |
473 | } | |
474 | ||
475 | //__________________________________________________________________________ | |
476 | void AliMUONEventReconstructor::AddHitsForRecFromGEANT(TTree *TH) | |
477 | { | |
478 | // To add to the list of hits for reconstruction | |
479 | // the GEANT signal hits from a hit tree TH. | |
480 | if (fPrintLevel >= 2) | |
481 | cout << "enter AddHitsForRecFromGEANT with TH: " << TH << endl; | |
482 | if (TH == NULL) return; | |
9cbdf048 | 483 | AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ???? |
a9e2aefa | 484 | // Security on MUON ???? |
485 | // See whether it could be the same for signal and background ???? | |
486 | // Loop over tracks in tree | |
487 | Int_t ntracks = (Int_t) TH->GetEntries(); | |
488 | if (fPrintLevel >= 2) | |
489 | cout << "ntracks: " << ntracks << endl; | |
490 | for (Int_t track = 0; track < ntracks; track++) { | |
491 | gAlice->ResetHits(); | |
492 | TH->GetEvent(track); | |
493 | // Loop over hits | |
494 | Int_t hit = 0; | |
9cbdf048 | 495 | for (AliMUONHit* mHit = (AliMUONHit*) pMUON->FirstHit(-1); |
a9e2aefa | 496 | mHit; |
9cbdf048 | 497 | mHit = (AliMUONHit*) pMUON->NextHit(), hit++) { |
a9e2aefa | 498 | NewHitForRecFromGEANT(mHit,track, hit, 1); |
499 | } // end of hit loop | |
500 | } // end of track loop | |
501 | return; | |
502 | } | |
503 | ||
504 | //__________________________________________________________________________ | |
505 | void AliMUONEventReconstructor::AddHitsForRecFromBkgGEANT(TTree *TH, TClonesArray *Hits) | |
506 | { | |
507 | // To add to the list of hits for reconstruction | |
508 | // the GEANT background hits from a hit tree TH and a pointer Hits to a hit list. | |
509 | // How to have only one function "AddHitsForRecFromGEANT" ???? | |
510 | if (fPrintLevel >= 2) | |
511 | cout << "enter AddHitsForRecFromBkgGEANT with TH: " << TH << endl; | |
512 | if (TH == NULL) return; | |
513 | // Loop over tracks in tree | |
514 | Int_t ntracks = (Int_t) TH->GetEntries(); | |
515 | if (fPrintLevel >= 2) | |
516 | cout << "ntracks: " << ntracks << endl; | |
517 | for (Int_t track = 0; track < ntracks; track++) { | |
518 | if (Hits) Hits->Clear(); | |
519 | TH->GetEvent(track); | |
520 | // Loop over hits | |
521 | for (Int_t hit = 0; hit < Hits->GetEntriesFast(); hit++) { | |
522 | NewHitForRecFromGEANT((AliMUONHit*) (*Hits)[hit], track, hit, 0); | |
523 | } // end of hit loop | |
524 | } // end of track loop | |
525 | return; | |
526 | } | |
527 | ||
528 | //__________________________________________________________________________ | |
529 | AliMUONHitForRec* AliMUONEventReconstructor::NewHitForRecFromGEANT(AliMUONHit* Hit, Int_t TrackNumber, Int_t HitNumber, Int_t Signal) | |
530 | { | |
531 | // To make a new hit for reconstruction from a GEANT hit pointed to by "Hit", | |
532 | // with hit number "HitNumber" in the track numbered "TrackNumber", | |
533 | // either from signal ("Signal" = 1) or background ("Signal" = 0) event. | |
534 | // Selects hits in tracking (not trigger) chambers. | |
535 | // Takes into account the efficiency (fEfficiency) | |
536 | // and the smearing from resolution (fBendingResolution and fNonBendingResolution). | |
537 | // Adds a condition on the radius between RMin and RMax | |
538 | // to better simulate the real chambers. | |
539 | // Returns the pointer to the new hit for reconstruction, | |
540 | // or NULL in case of inefficiency or non tracking chamber or bad radius. | |
541 | // No condition on at most 20 cm from a muon from a resonance | |
542 | // like in Fortran TRACKF_STAT. | |
543 | AliMUONHitForRec* hitForRec; | |
544 | Double_t bendCoor, nonBendCoor, radius; | |
545 | Int_t chamber = Hit->fChamber - 1; // chamber(0...) | |
546 | // only in tracking chambers (fChamber starts at 1) | |
9cbdf048 | 547 | if (chamber >= kMaxMuonTrackingChambers) return NULL; |
a9e2aefa | 548 | // only if hit is efficient (keep track for checking ????) |
549 | if (gRandom->Rndm() > fEfficiency) return NULL; | |
550 | // only if radius between RMin and RMax | |
551 | bendCoor = Hit->fY; | |
552 | nonBendCoor = Hit->fX; | |
553 | radius = TMath::Sqrt((bendCoor * bendCoor) + (nonBendCoor * nonBendCoor)); | |
554 | if ((radius < fRMin[chamber]) || (radius > fRMax[chamber])) return NULL; | |
555 | // new AliMUONHitForRec from GEANT hit and increment number of AliMUONHitForRec's | |
556 | hitForRec = new ((*fHitsForRecPtr)[fNHitsForRec]) AliMUONHitForRec(Hit); | |
557 | fNHitsForRec++; | |
558 | // add smearing from resolution | |
559 | hitForRec->SetBendingCoor(bendCoor + gRandom->Gaus(0., fBendingResolution)); | |
560 | hitForRec->SetNonBendingCoor(nonBendCoor | |
561 | + gRandom->Gaus(0., fNonBendingResolution)); | |
562 | // more information into HitForRec | |
563 | // resolution: angular effect to be added here ???? | |
564 | hitForRec->SetBendingReso2(fBendingResolution * fBendingResolution); | |
565 | hitForRec->SetNonBendingReso2(fNonBendingResolution * fNonBendingResolution); | |
566 | // GEANT track info | |
567 | hitForRec->SetHitNumber(HitNumber); | |
568 | hitForRec->SetTHTrack(TrackNumber); | |
569 | hitForRec->SetGeantSignal(Signal); | |
570 | if (fPrintLevel >= 10) { | |
571 | cout << "track: " << TrackNumber << " hit: " << HitNumber << endl; | |
572 | Hit->Dump(); | |
573 | cout << "AliMUONHitForRec number (1...): " << fNHitsForRec << endl; | |
574 | hitForRec->Dump();} | |
575 | return hitForRec; | |
576 | } | |
577 | ||
578 | //__________________________________________________________________________ | |
579 | void AliMUONEventReconstructor::SortHitsForRecWithIncreasingChamber() | |
580 | { | |
581 | // Sort HitsForRec's in increasing order with respect to chamber number. | |
582 | // Uses the function "Compare". | |
583 | // Update the information for HitsForRec per chamber too. | |
584 | Int_t ch, nhits, prevch; | |
585 | fHitsForRecPtr->Sort(); | |
9cbdf048 | 586 | for (ch = 0; ch < kMaxMuonTrackingChambers; ch++) { |
a9e2aefa | 587 | fNHitsForRecPerChamber[ch] = 0; |
588 | fIndexOfFirstHitForRecPerChamber[ch] = 0; | |
589 | } | |
590 | prevch = 0; // previous chamber | |
591 | nhits = 0; // number of hits in current chamber | |
592 | // Loop over HitsForRec | |
593 | for (Int_t hit = 0; hit < fNHitsForRec; hit++) { | |
594 | // chamber number (0...) | |
595 | ch = ((AliMUONHitForRec*) ((*fHitsForRecPtr)[hit]))->GetChamberNumber(); | |
596 | // increment number of hits in current chamber | |
597 | (fNHitsForRecPerChamber[ch])++; | |
598 | // update index of first HitForRec in current chamber | |
599 | // if chamber number different from previous one | |
600 | if (ch != prevch) { | |
601 | fIndexOfFirstHitForRecPerChamber[ch] = hit; | |
602 | prevch = ch; | |
603 | } | |
604 | } | |
605 | return; | |
606 | } | |
607 | ||
608 | // //__________________________________________________________________________ | |
609 | // void AliMUONEventReconstructor::AddHitsForRecFromCathodeCorrelations(TTree* TC) | |
610 | // { | |
611 | // // OLD VERSION WHEN ONE ONE WAS USING SO CALLED CATHODE CORRELATIONS | |
612 | // // To add to the list of hits for reconstruction | |
613 | // // the (cathode correlated) raw clusters | |
614 | // // No condition added, like in Fortran TRACKF_STAT, | |
615 | // // on the radius between RMin and RMax. | |
616 | // AliMUONHitForRec *hitForRec; | |
617 | // if (fPrintLevel >= 1) cout << "enter AddHitsForRecFromCathodeCorrelations" << endl; | |
618 | // AliMUON *MUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ???? | |
619 | // // Security on MUON ???? | |
620 | // // Loop over tracking chambers | |
9cbdf048 | 621 | // for (Int_t ch = 0; ch < kMaxMuonTrackingChambers; ch++) { |
a9e2aefa | 622 | // // number of HitsForRec to 0 for the chamber |
623 | // fNHitsForRecPerChamber[ch] = 0; | |
624 | // // index of first HitForRec for the chamber | |
625 | // if (ch == 0) fIndexOfFirstHitForRecPerChamber[ch] = 0; | |
626 | // else fIndexOfFirstHitForRecPerChamber[ch] = fNHitsForRec; | |
627 | // TClonesArray *reconst_hits = MUON->ReconstHitsAddress(ch); | |
628 | // MUON->ResetReconstHits(); | |
629 | // TC->GetEvent(); | |
630 | // Int_t ncor = (Int_t)reconst_hits->GetEntries(); | |
631 | // // Loop over (cathode correlated) raw clusters | |
632 | // for (Int_t cor = 0; cor < ncor; cor++) { | |
633 | // AliMUONReconstHit * mCor = | |
634 | // (AliMUONReconstHit*) reconst_hits->UncheckedAt(cor); | |
635 | // // new AliMUONHitForRec from (cathode correlated) raw cluster | |
636 | // // and increment number of AliMUONHitForRec's (total and in chamber) | |
637 | // hitForRec = new ((*fHitsForRecPtr)[fNHitsForRec]) AliMUONHitForRec(mCor); | |
638 | // fNHitsForRec++; | |
639 | // (fNHitsForRecPerChamber[ch])++; | |
640 | // // more information into HitForRec | |
641 | // hitForRec->SetChamberNumber(ch); | |
642 | // hitForRec->SetHitNumber(cor); | |
643 | // // Z coordinate of the chamber (cm) with sign opposite to GEANT sign | |
644 | // // could (should) be more exact from chamber geometry ???? | |
645 | // hitForRec->SetZ(-(&(MUON->Chamber(ch)))->Z()); | |
646 | // if (fPrintLevel >= 10) { | |
647 | // cout << "chamber (0...): " << ch << | |
648 | // " cathcorrel (0...): " << cor << endl; | |
649 | // mCor->Dump(); | |
650 | // cout << "AliMUONHitForRec number (1...): " << fNHitsForRec << endl; | |
651 | // hitForRec->Dump();} | |
652 | // } // end of cluster loop | |
653 | // } // end of chamber loop | |
654 | // return; | |
655 | // } | |
656 | ||
657 | //__________________________________________________________________________ | |
658 | void AliMUONEventReconstructor::AddHitsForRecFromRawClusters(TTree* TR) | |
659 | { | |
660 | // To add to the list of hits for reconstruction all the raw clusters | |
661 | // No condition added, like in Fortran TRACKF_STAT, | |
662 | // on the radius between RMin and RMax. | |
663 | AliMUONHitForRec *hitForRec; | |
664 | AliMUONRawCluster *clus; | |
665 | Int_t iclus, nclus; | |
666 | TClonesArray *rawclusters; | |
667 | if (fPrintLevel >= 1) cout << "enter AddHitsForRecFromRawClusters" << endl; | |
9cbdf048 | 668 | AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ???? |
a9e2aefa | 669 | // Security on MUON ???? |
670 | // Loop over tracking chambers | |
9cbdf048 | 671 | for (Int_t ch = 0; ch < kMaxMuonTrackingChambers; ch++) { |
a9e2aefa | 672 | // number of HitsForRec to 0 for the chamber |
673 | fNHitsForRecPerChamber[ch] = 0; | |
674 | // index of first HitForRec for the chamber | |
675 | if (ch == 0) fIndexOfFirstHitForRecPerChamber[ch] = 0; | |
676 | else fIndexOfFirstHitForRecPerChamber[ch] = fNHitsForRec; | |
9cbdf048 | 677 | rawclusters = pMUON->RawClustAddress(ch); |
678 | pMUON->ResetRawClusters(); | |
a9e2aefa | 679 | TR->GetEvent((Int_t) (TR->GetEntries()) - 1); // to be checked ???? |
680 | nclus = (Int_t) (rawclusters->GetEntries()); | |
681 | // Loop over (cathode correlated) raw clusters | |
682 | for (iclus = 0; iclus < nclus; iclus++) { | |
683 | clus = (AliMUONRawCluster*) rawclusters->UncheckedAt(iclus); | |
684 | // new AliMUONHitForRec from raw cluster | |
685 | // and increment number of AliMUONHitForRec's (total and in chamber) | |
686 | hitForRec = new ((*fHitsForRecPtr)[fNHitsForRec]) AliMUONHitForRec(clus); | |
687 | fNHitsForRec++; | |
688 | (fNHitsForRecPerChamber[ch])++; | |
689 | // more information into HitForRec | |
690 | // resolution: info should be already in raw cluster and taken from it ???? | |
691 | hitForRec->SetBendingReso2(fBendingResolution * fBendingResolution); | |
692 | hitForRec->SetNonBendingReso2(fNonBendingResolution * fNonBendingResolution); | |
693 | // original raw cluster | |
694 | hitForRec->SetChamberNumber(ch); | |
695 | hitForRec->SetHitNumber(iclus); | |
956019b6 | 696 | // Z coordinate of the chamber (cm) |
a9e2aefa | 697 | // could (should) be more exact from chamber geometry ???? |
956019b6 | 698 | hitForRec->SetZ((&(pMUON->Chamber(ch)))->Z()); |
a9e2aefa | 699 | if (fPrintLevel >= 10) { |
700 | cout << "chamber (0...): " << ch << | |
701 | " raw cluster (0...): " << iclus << endl; | |
702 | clus->Dump(); | |
703 | cout << "AliMUONHitForRec number (1...): " << fNHitsForRec << endl; | |
704 | hitForRec->Dump();} | |
705 | } // end of cluster loop | |
706 | } // end of chamber loop | |
707 | return; | |
708 | } | |
709 | ||
710 | //__________________________________________________________________________ | |
711 | void AliMUONEventReconstructor::MakeSegments(void) | |
712 | { | |
713 | // To make the list of segments in all stations, | |
714 | // from the list of hits to be reconstructed | |
715 | if (fPrintLevel >= 1) cout << "enter MakeSegments" << endl; | |
716 | ResetSegments(); | |
717 | // Loop over stations | |
9cbdf048 | 718 | for (Int_t st = 0; st < kMaxMuonTrackingStations; st++) |
a9e2aefa | 719 | MakeSegmentsPerStation(st); |
720 | if (fPrintLevel >= 10) { | |
721 | cout << "end of MakeSegments" << endl; | |
9cbdf048 | 722 | for (Int_t st = 0; st < kMaxMuonTrackingStations; st++) { |
a9e2aefa | 723 | cout << "station(0...): " << st |
724 | << " Segments: " << fNSegments[st] | |
725 | << endl; | |
726 | for (Int_t seg = 0; | |
727 | seg < fNSegments[st]; | |
728 | seg++) { | |
729 | cout << "Segment index(0...): " << seg << endl; | |
730 | ((*fSegmentsPtr[st])[seg])->Dump(); | |
731 | } | |
732 | } | |
733 | } | |
734 | return; | |
735 | } | |
736 | ||
737 | //__________________________________________________________________________ | |
738 | void AliMUONEventReconstructor::MakeSegmentsPerStation(Int_t Station) | |
739 | { | |
740 | // To make the list of segments in station number "Station" (0...) | |
741 | // from the list of hits to be reconstructed. | |
742 | // Updates "fNSegments"[Station]. | |
743 | // Segments in stations 4 and 5 are sorted | |
744 | // according to increasing absolute value of "impact parameter" | |
745 | AliMUONHitForRec *hit1Ptr, *hit2Ptr; | |
746 | AliMUONSegment *segment; | |
747 | Bool_t last2st; | |
748 | Double_t bendingSlope, distBend, distNonBend, extBendCoor, extNonBendCoor, | |
749 | impactParam, maxImpactParam; | |
9cbdf048 | 750 | AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ???? |
a9e2aefa | 751 | if (fPrintLevel >= 1) |
752 | cout << "enter MakeSegmentsPerStation (0...) " << Station << endl; | |
753 | // first and second chambers (0...) in the station | |
754 | Int_t ch1 = 2 * Station; | |
755 | Int_t ch2 = ch1 + 1; | |
756 | // variable true for stations downstream of the dipole: | |
757 | // Station(0..4) equal to 3 or 4 | |
758 | if ((Station == 3) || (Station == 4)) { | |
759 | last2st = kTRUE; | |
760 | // maximum impact parameter (cm) according to fMinBendingMomentum... | |
761 | maxImpactParam = | |
762 | TMath::Abs(GetImpactParamFromBendingMomentum(fMinBendingMomentum)); | |
763 | } | |
764 | else last2st = kFALSE; | |
765 | // extrapolation factor from Z of first chamber to Z of second chamber | |
766 | // dZ to be changed to take into account fine structure of chambers ???? | |
767 | Double_t extrapFact = | |
9cbdf048 | 768 | (&(pMUON->Chamber(ch2)))->Z() / (&(pMUON->Chamber(ch1)))->Z(); |
a9e2aefa | 769 | // index for current segment |
770 | Int_t segmentIndex = 0; | |
771 | // Loop over HitsForRec in the first chamber of the station | |
772 | for (Int_t hit1 = fIndexOfFirstHitForRecPerChamber[ch1]; | |
773 | hit1 < fIndexOfFirstHitForRecPerChamber[ch1] + fNHitsForRecPerChamber[ch1]; | |
774 | hit1++) { | |
775 | // pointer to the HitForRec | |
776 | hit1Ptr = (AliMUONHitForRec*) ((*fHitsForRecPtr)[hit1]); | |
777 | // extrapolation, | |
778 | // on the straight line joining the HitForRec to the vertex (0,0,0), | |
779 | // to the Z of the second chamber of the station | |
780 | extBendCoor = extrapFact * hit1Ptr->GetBendingCoor(); | |
781 | extNonBendCoor = extrapFact * hit1Ptr->GetNonBendingCoor(); | |
782 | // Loop over HitsForRec in the second chamber of the station | |
783 | for (Int_t hit2 = fIndexOfFirstHitForRecPerChamber[ch2]; | |
784 | hit2 < fIndexOfFirstHitForRecPerChamber[ch2] + fNHitsForRecPerChamber[ch2]; | |
785 | hit2++) { | |
786 | // pointer to the HitForRec | |
787 | hit2Ptr = (AliMUONHitForRec*) ((*fHitsForRecPtr)[hit2]); | |
788 | // absolute values of distances, in bending and non bending planes, | |
789 | // between the HitForRec in the second chamber | |
790 | // and the previous extrapolation | |
791 | distBend = TMath::Abs(hit2Ptr->GetBendingCoor() - extBendCoor); | |
792 | distNonBend = TMath::Abs(hit2Ptr->GetNonBendingCoor() - extNonBendCoor); | |
793 | if (last2st) { | |
794 | // bending slope | |
795 | bendingSlope = (hit1Ptr->GetBendingCoor() - hit2Ptr->GetBendingCoor()) / | |
796 | (hit1Ptr->GetZ() - hit2Ptr->GetZ()); | |
797 | // absolute value of impact parameter | |
798 | impactParam = | |
799 | TMath::Abs(hit1Ptr->GetBendingCoor() - hit2Ptr->GetZ() * bendingSlope); | |
800 | } | |
801 | // check for distances not too large, | |
802 | // and impact parameter not too big if stations downstream of the dipole. | |
803 | // Conditions "distBend" and "impactParam" correlated for these stations ???? | |
804 | if ((distBend < fSegmentMaxDistBending[Station]) && | |
805 | (distNonBend < fSegmentMaxDistNonBending[Station]) && | |
806 | (!last2st || (impactParam < maxImpactParam))) { | |
807 | // make new segment | |
808 | segment = new ((*fSegmentsPtr[Station])[segmentIndex]) | |
809 | AliMUONSegment(hit1Ptr, hit2Ptr); | |
810 | // update "link" to this segment from the hit in the first chamber | |
811 | if (hit1Ptr->GetNSegments() == 0) | |
812 | hit1Ptr->SetIndexOfFirstSegment(segmentIndex); | |
813 | hit1Ptr->SetNSegments(hit1Ptr->GetNSegments() + 1); | |
814 | if (fPrintLevel >= 10) { | |
815 | cout << "segmentIndex(0...): " << segmentIndex | |
816 | << " distBend: " << distBend | |
817 | << " distNonBend: " << distNonBend | |
818 | << endl; | |
819 | segment->Dump(); | |
820 | cout << "HitForRec in first chamber" << endl; | |
821 | hit1Ptr->Dump(); | |
822 | cout << "HitForRec in second chamber" << endl; | |
823 | hit2Ptr->Dump(); | |
824 | }; | |
825 | // increment index for current segment | |
826 | segmentIndex++; | |
827 | } | |
828 | } //for (Int_t hit2 | |
829 | } // for (Int_t hit1... | |
830 | fNSegments[Station] = segmentIndex; | |
831 | // Sorting according to "impact parameter" if station(1..5) 4 or 5, | |
832 | // i.e. Station(0..4) 3 or 4, using the function "Compare". | |
833 | // After this sorting, it is impossible to use | |
834 | // the "fNSegments" and "fIndexOfFirstSegment" | |
835 | // of the HitForRec in the first chamber to explore all segments formed with it. | |
836 | // Is this sorting really needed ???? | |
837 | if ((Station == 3) || (Station == 4)) (fSegmentsPtr[Station])->Sort(); | |
838 | if (fPrintLevel >= 1) cout << "Station: " << Station << " NSegments: " | |
839 | << fNSegments[Station] << endl; | |
840 | return; | |
841 | } | |
842 | ||
843 | //__________________________________________________________________________ | |
844 | void AliMUONEventReconstructor::MakeTracks(void) | |
845 | { | |
846 | // To make the tracks, | |
847 | // from the list of segments and points in all stations | |
848 | if (fPrintLevel >= 1) cout << "enter MakeTracks" << endl; | |
8429a5e4 | 849 | // The order may be important for the following Reset's |
a9e2aefa | 850 | ResetTracks(); |
8429a5e4 | 851 | ResetTrackHits(); |
a9e2aefa | 852 | // Look for candidates from at least 3 aligned points in stations(1..) 4 and 5 |
853 | MakeTrackCandidates(); | |
854 | // Follow tracks in stations(1..) 3, 2 and 1 | |
855 | FollowTracks(); | |
8429a5e4 | 856 | // Remove double tracks |
857 | RemoveDoubleTracks(); | |
a9e2aefa | 858 | return; |
859 | } | |
860 | ||
861 | //__________________________________________________________________________ | |
862 | Int_t AliMUONEventReconstructor::MakeTrackCandidatesWithTwoSegments(AliMUONSegment *BegSegment) | |
863 | { | |
864 | // To make track candidates with two segments in stations(1..) 4 and 5, | |
865 | // the first segment being pointed to by "BegSegment". | |
866 | // Returns the number of such track candidates. | |
867 | Int_t endStation, iEndSegment, nbCan2Seg; | |
868 | AliMUONSegment *endSegment, *extrapSegment; | |
869 | AliMUONTrack *recTrack; | |
870 | Double_t mcsFactor; | |
871 | if (fPrintLevel >= 1) cout << "enter MakeTrackCandidatesWithTwoSegments" << endl; | |
872 | // Station for the end segment | |
873 | endStation = 7 - (BegSegment->GetHitForRec1())->GetChamberNumber() / 2; | |
874 | // multiple scattering factor corresponding to one chamber | |
875 | mcsFactor = 0.0136 / | |
876 | GetBendingMomentumFromImpactParam(BegSegment->GetBendingImpact()); | |
877 | mcsFactor = fChamberThicknessInX0 * mcsFactor * mcsFactor; | |
878 | // linear extrapolation to end station | |
879 | extrapSegment = | |
880 | BegSegment->CreateSegmentFromLinearExtrapToStation(endStation, mcsFactor); | |
881 | // number of candidates with 2 segments to 0 | |
882 | nbCan2Seg = 0; | |
883 | // Loop over segments in the end station | |
884 | for (iEndSegment = 0; iEndSegment < fNSegments[endStation]; iEndSegment++) { | |
885 | // pointer to segment | |
886 | endSegment = (AliMUONSegment*) ((*fSegmentsPtr[endStation])[iEndSegment]); | |
887 | // test compatibility between current segment and "extrapSegment" | |
04b5ea16 | 888 | // 4 because 4 quantities in chi2 |
a9e2aefa | 889 | if ((endSegment-> |
890 | NormalizedChi2WithSegment(extrapSegment, | |
891 | fMaxSigma2Distance)) <= 4.0) { | |
892 | // both segments compatible: | |
893 | // make track candidate from "begSegment" and "endSegment" | |
894 | if (fPrintLevel >= 2) | |
895 | cout << "TrackCandidate with Segment " << iEndSegment << | |
896 | " in Station(0..) " << endStation << endl; | |
897 | // flag for both segments in one track: | |
898 | // to be done in track constructor ???? | |
899 | BegSegment->SetInTrack(kTRUE); | |
900 | endSegment->SetInTrack(kTRUE); | |
901 | recTrack = new ((*fRecTracksPtr)[fNRecTracks]) | |
902 | AliMUONTrack(BegSegment, endSegment, this); | |
903 | fNRecTracks++; | |
904 | if (fPrintLevel >= 10) recTrack->RecursiveDump(); | |
905 | // increment number of track candidates with 2 segments | |
906 | nbCan2Seg++; | |
907 | } | |
908 | } // for (iEndSegment = 0;... | |
909 | delete extrapSegment; // should not delete HitForRec's it points to !!!! | |
910 | return nbCan2Seg; | |
911 | } | |
912 | ||
913 | //__________________________________________________________________________ | |
914 | Int_t AliMUONEventReconstructor::MakeTrackCandidatesWithOneSegmentAndOnePoint(AliMUONSegment *BegSegment) | |
915 | { | |
916 | // To make track candidates with one segment and one point | |
917 | // in stations(1..) 4 and 5, | |
918 | // the segment being pointed to by "BegSegment". | |
919 | Int_t ch, ch1, ch2, endStation, iHit, iHitMax, iHitMin, nbCan1Seg1Hit; | |
920 | AliMUONHitForRec *extrapHitForRec, *hit; | |
921 | AliMUONTrack *recTrack; | |
922 | Double_t mcsFactor; | |
923 | if (fPrintLevel >= 1) | |
924 | cout << "enter MakeTrackCandidatesWithOneSegmentAndOnePoint" << endl; | |
925 | // station for the end point | |
926 | endStation = 7 - (BegSegment->GetHitForRec1())->GetChamberNumber() / 2; | |
927 | // multiple scattering factor corresponding to one chamber | |
928 | mcsFactor = 0.0136 / | |
929 | GetBendingMomentumFromImpactParam(BegSegment->GetBendingImpact()); | |
930 | mcsFactor = fChamberThicknessInX0 * mcsFactor * mcsFactor; | |
931 | // first and second chambers(0..) in the end station | |
932 | ch1 = 2 * endStation; | |
933 | ch2 = ch1 + 1; | |
934 | // number of candidates to 0 | |
935 | nbCan1Seg1Hit = 0; | |
936 | // Loop over chambers of the end station | |
937 | for (ch = ch2; ch >= ch1; ch--) { | |
938 | // linear extrapolation to chamber | |
939 | extrapHitForRec = | |
940 | BegSegment->CreateHitForRecFromLinearExtrapToChamber(ch, mcsFactor); | |
941 | // limits for the hit index in the loop | |
942 | iHitMin = fIndexOfFirstHitForRecPerChamber[ch]; | |
943 | iHitMax = iHitMin + fNHitsForRecPerChamber[ch]; | |
944 | // Loop over HitForRec's in the chamber | |
945 | for (iHit = iHitMin; iHit < iHitMax; iHit++) { | |
946 | // pointer to HitForRec | |
947 | hit = (AliMUONHitForRec*) ((*fHitsForRecPtr)[iHit]); | |
948 | // test compatibility between current HitForRec and "extrapHitForRec" | |
04b5ea16 | 949 | // 2 because 2 quantities in chi2 |
a9e2aefa | 950 | if ((hit-> |
951 | NormalizedChi2WithHitForRec(extrapHitForRec, | |
952 | fMaxSigma2Distance)) <= 2.0) { | |
953 | // both HitForRec's compatible: | |
954 | // make track candidate from begSegment and current HitForRec | |
955 | if (fPrintLevel >= 2) | |
956 | cout << "TrackCandidate with HitForRec " << iHit << | |
957 | " in Chamber(0..) " << ch << endl; | |
958 | // flag for beginning segments in one track: | |
959 | // to be done in track constructor ???? | |
960 | BegSegment->SetInTrack(kTRUE); | |
961 | recTrack = new ((*fRecTracksPtr)[fNRecTracks]) | |
962 | AliMUONTrack(BegSegment, hit, this); | |
963 | // the right place to eliminate "double counting" ???? how ???? | |
964 | fNRecTracks++; | |
965 | if (fPrintLevel >= 10) recTrack->RecursiveDump(); | |
966 | // increment number of track candidates | |
967 | nbCan1Seg1Hit++; | |
968 | } | |
969 | } // for (iHit = iHitMin;... | |
970 | delete extrapHitForRec; | |
971 | } // for (ch = ch2;... | |
972 | return nbCan1Seg1Hit; | |
973 | } | |
974 | ||
975 | //__________________________________________________________________________ | |
976 | void AliMUONEventReconstructor::MakeTrackCandidates(void) | |
977 | { | |
978 | // To make track candidates | |
979 | // with at least 3 aligned points in stations(1..) 4 and 5 | |
980 | // (two Segment's or one Segment and one HitForRec) | |
981 | Int_t begStation, iBegSegment, nbCan1Seg1Hit, nbCan2Seg; | |
982 | AliMUONSegment *begSegment; | |
983 | if (fPrintLevel >= 1) cout << "enter MakeTrackCandidates" << endl; | |
984 | // Loop over stations(1..) 5 and 4 for the beginning segment | |
985 | for (begStation = 4; begStation > 2; begStation--) { | |
986 | // Loop over segments in the beginning station | |
987 | for (iBegSegment = 0; iBegSegment < fNSegments[begStation]; iBegSegment++) { | |
988 | // pointer to segment | |
989 | begSegment = (AliMUONSegment*) ((*fSegmentsPtr[begStation])[iBegSegment]); | |
990 | if (fPrintLevel >= 2) | |
991 | cout << "look for TrackCandidate's with Segment " << iBegSegment << | |
992 | " in Station(0..) " << begStation << endl; | |
993 | // Look for track candidates with two segments, | |
994 | // "begSegment" and all compatible segments in other station. | |
995 | // Only for beginning station(1..) 5 | |
996 | // because candidates with 2 segments have to looked for only once. | |
997 | if (begStation == 4) | |
998 | nbCan2Seg = MakeTrackCandidatesWithTwoSegments(begSegment); | |
956019b6 | 999 | // Look for track candidates with one segment and one point, |
a9e2aefa | 1000 | // "begSegment" and all compatible HitForRec's in other station. |
1001 | // Only if "begSegment" does not belong already to a track candidate. | |
1002 | // Is that a too strong condition ???? | |
1003 | if (!(begSegment->GetInTrack())) | |
1004 | nbCan1Seg1Hit = MakeTrackCandidatesWithOneSegmentAndOnePoint(begSegment); | |
1005 | } // for (iBegSegment = 0;... | |
1006 | } // for (begStation = 4;... | |
1007 | return; | |
1008 | } | |
1009 | ||
1010 | //__________________________________________________________________________ | |
1011 | void AliMUONEventReconstructor::FollowTracks(void) | |
1012 | { | |
1013 | // Follow tracks in stations(1..) 3, 2 and 1 | |
04b5ea16 | 1014 | // too long: should be made more modular !!!! |
a9e2aefa | 1015 | AliMUONHitForRec *bestHit, *extrapHit, *hit; |
1016 | AliMUONSegment *bestSegment, *extrapSegment, *segment; | |
04b5ea16 | 1017 | AliMUONTrack *track, *nextTrack; |
1018 | AliMUONTrackParam *trackParam1, trackParam[2], trackParamVertex; | |
d82671a0 | 1019 | Int_t ch, chInStation, chBestHit, iHit, iSegment, station, trackIndex; |
04b5ea16 | 1020 | Double_t bestChi2, chi2, dZ1, dZ2, dZ3, maxSigma2Distance, mcsFactor; |
9cbdf048 | 1021 | AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ???? |
04b5ea16 | 1022 | // local maxSigma2Distance, for easy increase in testing |
1023 | maxSigma2Distance = fMaxSigma2Distance; | |
a9e2aefa | 1024 | if (fPrintLevel >= 2) |
1025 | cout << "enter FollowTracks" << endl; | |
1026 | // Loop over track candidates | |
04b5ea16 | 1027 | track = (AliMUONTrack*) fRecTracksPtr->First(); |
1028 | trackIndex = -1; | |
1029 | while (track) { | |
1030 | // Follow function for each track candidate ???? | |
1031 | trackIndex++; | |
1032 | nextTrack = (AliMUONTrack*) fRecTracksPtr->After(track); // prepare next track | |
a9e2aefa | 1033 | if (fPrintLevel >= 2) |
1034 | cout << "FollowTracks: track candidate(0..): " << trackIndex << endl; | |
956019b6 | 1035 | // Fit track candidate |
1036 | track->SetFitMCS(0); // without multiple Coulomb scattering | |
1037 | track->SetFitNParam(3); // with 3 parameters (X = Y = 0) | |
1038 | track->SetFitStart(0); // from parameters at vertex | |
1039 | track->Fit(); | |
a9e2aefa | 1040 | if (fPrintLevel >= 10) { |
1041 | cout << "FollowTracks: track candidate(0..): " << trackIndex | |
956019b6 | 1042 | << " after fit in stations(0..) 3 and 4" << endl; |
a9e2aefa | 1043 | track->RecursiveDump(); |
1044 | } | |
1045 | // Loop over stations(1..) 3, 2 and 1 | |
04b5ea16 | 1046 | // something SPECIAL for stations 2 and 1 for majority 3 coincidence ???? |
1047 | // otherwise: majority coincidence 2 !!!! | |
a9e2aefa | 1048 | for (station = 2; station >= 0; station--) { |
1049 | // Track parameters at first track hit (smallest Z) | |
1050 | trackParam1 = ((AliMUONTrackHit*) | |
1051 | (track->GetTrackHitsPtr()->First()))->GetTrackParam(); | |
1052 | // extrapolation to station | |
1053 | trackParam1->ExtrapToStation(station, trackParam); | |
79e1e601 | 1054 | extrapSegment = new AliMUONSegment(); // empty segment |
a9e2aefa | 1055 | // multiple scattering factor corresponding to one chamber |
1056 | // and momentum in bending plane (not total) | |
1057 | mcsFactor = 0.0136 * trackParam1->GetInverseBendingMomentum(); | |
1058 | mcsFactor = fChamberThicknessInX0 * mcsFactor * mcsFactor; | |
1059 | // Z difference from previous station | |
9cbdf048 | 1060 | dZ1 = (&(pMUON->Chamber(2 * station)))->Z() - |
1061 | (&(pMUON->Chamber(2 * station + 2)))->Z(); | |
a9e2aefa | 1062 | // Z difference between the two previous stations |
9cbdf048 | 1063 | dZ2 = (&(pMUON->Chamber(2 * station + 2)))->Z() - |
1064 | (&(pMUON->Chamber(2 * station + 4)))->Z(); | |
04b5ea16 | 1065 | // Z difference between the two chambers in the previous station |
1066 | dZ3 = (&(pMUON->Chamber(2 * station)))->Z() - | |
1067 | (&(pMUON->Chamber(2 * station + 1)))->Z(); | |
1068 | extrapSegment->SetBendingCoorReso2(fBendingResolution * fBendingResolution); | |
1069 | extrapSegment-> | |
1070 | SetNonBendingCoorReso2(fNonBendingResolution * fNonBendingResolution); | |
1071 | extrapSegment->UpdateFromStationTrackParam | |
1072 | (trackParam, mcsFactor, dZ1, dZ2, dZ3, station, | |
1073 | trackParam1->GetInverseBendingMomentum()); | |
a9e2aefa | 1074 | bestChi2 = 5.0; |
1075 | bestSegment = NULL; | |
1076 | if (fPrintLevel >= 10) { | |
1077 | cout << "FollowTracks: track candidate(0..): " << trackIndex | |
1078 | << " Look for segment in station(0..): " << station << endl; | |
1079 | } | |
1080 | // Loop over segments in station | |
1081 | for (iSegment = 0; iSegment < fNSegments[station]; iSegment++) { | |
1082 | // Look for best compatible Segment in station | |
1083 | // should consider all possibilities ???? | |
1084 | // multiple scattering ???? | |
1085 | // separation in 2 functions: Segment and HitForRec ???? | |
1086 | segment = (AliMUONSegment*) ((*fSegmentsPtr[station])[iSegment]); | |
1087 | chi2 = segment->NormalizedChi2WithSegment(extrapSegment, maxSigma2Distance); | |
1088 | if (chi2 < bestChi2) { | |
1089 | // update best Chi2 and Segment if better found | |
1090 | bestSegment = segment; | |
1091 | bestChi2 = chi2; | |
1092 | } | |
1093 | } | |
1094 | if (bestSegment) { | |
1095 | // best segment found: add it to track candidate | |
1096 | track->AddSegment(bestSegment); | |
1097 | // set track parameters at these two TrakHit's | |
1098 | track->SetTrackParamAtHit(track->GetNTrackHits() - 2, &(trackParam[0])); | |
1099 | track->SetTrackParamAtHit(track->GetNTrackHits() - 1, &(trackParam[1])); | |
1100 | if (fPrintLevel >= 10) { | |
1101 | cout << "FollowTracks: track candidate(0..): " << trackIndex | |
1102 | << " Added segment in station(0..): " << station << endl; | |
1103 | track->RecursiveDump(); | |
1104 | } | |
1105 | } | |
1106 | else { | |
1107 | // No best segment found: | |
1108 | // Look for best compatible HitForRec in station: | |
1109 | // should consider all possibilities ???? | |
1110 | // multiple scattering ???? do about like for extrapSegment !!!! | |
79e1e601 | 1111 | extrapHit = new AliMUONHitForRec(); // empty hit |
a9e2aefa | 1112 | bestChi2 = 3.0; |
1113 | bestHit = NULL; | |
1114 | if (fPrintLevel >= 10) { | |
1115 | cout << "FollowTracks: track candidate(0..): " << trackIndex | |
1116 | << " Segment not found, look for hit in station(0..): " << station | |
1117 | << endl; | |
1118 | } | |
1119 | // Loop over chambers of the station | |
d82671a0 | 1120 | for (chInStation = 0; chInStation < 2; chInStation++) { |
a9e2aefa | 1121 | // coordinates of extrapolated hit |
d82671a0 | 1122 | extrapHit-> |
1123 | SetBendingCoor((&(trackParam[chInStation]))->GetBendingCoor()); | |
1124 | extrapHit-> | |
1125 | SetNonBendingCoor((&(trackParam[chInStation]))->GetNonBendingCoor()); | |
a9e2aefa | 1126 | // resolutions from "extrapSegment" |
1127 | extrapHit->SetBendingReso2(extrapSegment->GetBendingCoorReso2()); | |
1128 | extrapHit->SetNonBendingReso2(extrapSegment->GetNonBendingCoorReso2()); | |
1129 | // Loop over hits in the chamber | |
956019b6 | 1130 | ch = 2 * station + chInStation; |
a9e2aefa | 1131 | for (iHit = fIndexOfFirstHitForRecPerChamber[ch]; |
1132 | iHit < fIndexOfFirstHitForRecPerChamber[ch] + | |
1133 | fNHitsForRecPerChamber[ch]; | |
1134 | iHit++) { | |
1135 | hit = (AliMUONHitForRec*) ((*fHitsForRecPtr)[iHit]); | |
1136 | // condition for hit not already in segment ???? | |
1137 | chi2 = hit->NormalizedChi2WithHitForRec(extrapHit, maxSigma2Distance); | |
1138 | if (chi2 < bestChi2) { | |
1139 | // update best Chi2 and HitForRec if better found | |
1140 | bestHit = hit; | |
1141 | bestChi2 = chi2; | |
d82671a0 | 1142 | chBestHit = chInStation; |
a9e2aefa | 1143 | } |
1144 | } | |
1145 | } | |
1146 | if (bestHit) { | |
1147 | // best hit found: add it to track candidate | |
1148 | track->AddHitForRec(bestHit); | |
956019b6 | 1149 | // set track parameters at this TrackHit |
a9e2aefa | 1150 | track->SetTrackParamAtHit(track->GetNTrackHits() - 1, |
1151 | &(trackParam[chBestHit])); | |
1152 | if (fPrintLevel >= 10) { | |
1153 | cout << "FollowTracks: track candidate(0..): " << trackIndex | |
1154 | << " Added hit in station(0..): " << station << endl; | |
1155 | track->RecursiveDump(); | |
1156 | } | |
1157 | } | |
1158 | else { | |
8429a5e4 | 1159 | // Remove current track candidate |
1160 | // and corresponding TrackHit's, ... | |
1161 | track->Remove(); | |
04b5ea16 | 1162 | delete extrapSegment; |
a9e2aefa | 1163 | break; // stop the search for this candidate: |
1164 | // exit from the loop over station | |
1165 | } | |
1166 | } | |
04b5ea16 | 1167 | delete extrapSegment; |
a9e2aefa | 1168 | // Sort track hits according to increasing Z |
1169 | track->GetTrackHitsPtr()->Sort(); | |
1170 | // Update track parameters at first track hit (smallest Z) | |
1171 | trackParam1 = ((AliMUONTrackHit*) | |
1172 | (track->GetTrackHitsPtr()->First()))->GetTrackParam(); | |
956019b6 | 1173 | // Track fit |
04b5ea16 | 1174 | // with multiple Coulomb scattering if all stations |
1175 | if (station == 0) track->SetFitMCS(1); | |
956019b6 | 1176 | // without multiple Coulomb scattering if not all stations |
04b5ea16 | 1177 | else track->SetFitMCS(0); |
956019b6 | 1178 | track->SetFitNParam(5); // with 5 parameters (momentum and position) |
1179 | track->SetFitStart(1); // from parameters at first hit | |
1180 | track->Fit(); | |
a9e2aefa | 1181 | if (fPrintLevel >= 10) { |
1182 | cout << "FollowTracks: track candidate(0..): " << trackIndex | |
1183 | << " after fit from station(0..): " << station << " to 4" << endl; | |
1184 | track->RecursiveDump(); | |
1185 | } | |
04b5ea16 | 1186 | // Track extrapolation to the vertex through the absorber (Branson) |
956019b6 | 1187 | // after going through the first station |
04b5ea16 | 1188 | if (station == 0) { |
1189 | trackParamVertex = *trackParam1; | |
1190 | (&trackParamVertex)->ExtrapToVertex(); | |
1191 | track->SetTrackParamAtVertex(&trackParamVertex); | |
6ae236ee | 1192 | if (fPrintLevel >= 1) { |
1193 | cout << "FollowTracks: track candidate(0..): " << trackIndex | |
1194 | << " after extrapolation to vertex" << endl; | |
1195 | track->RecursiveDump(); | |
1196 | } | |
04b5ea16 | 1197 | } |
a9e2aefa | 1198 | } // for (station = 2;... |
04b5ea16 | 1199 | // go really to next track |
1200 | track = nextTrack; | |
1201 | } // while (track) | |
1202 | // Compression of track array (necessary after Remove ????) | |
1203 | fRecTracksPtr->Compress(); | |
1204 | return; | |
1205 | } | |
1206 | ||
1207 | //__________________________________________________________________________ | |
8429a5e4 | 1208 | void AliMUONEventReconstructor::RemoveDoubleTracks(void) |
1209 | { | |
1210 | // To remove double tracks. | |
1211 | // Tracks are considered identical | |
1212 | // if they have at least half of their hits in common. | |
1213 | // Among two identical tracks, one keeps the track with the larger number of hits | |
1214 | // or, if these numbers are equal, the track with the minimum Chi2. | |
1215 | AliMUONTrack *track1, *track2, *trackToRemove; | |
1216 | Bool_t identicalTracks; | |
1217 | Int_t hitsInCommon, nHits1, nHits2; | |
1218 | identicalTracks = kTRUE; | |
1219 | while (identicalTracks) { | |
1220 | identicalTracks = kFALSE; | |
1221 | // Loop over first track of the pair | |
1222 | track1 = (AliMUONTrack*) fRecTracksPtr->First(); | |
1223 | while (track1 && (!identicalTracks)) { | |
1224 | nHits1 = track1->GetNTrackHits(); | |
1225 | // Loop over second track of the pair | |
1226 | track2 = (AliMUONTrack*) fRecTracksPtr->After(track1); | |
1227 | while (track2 && (!identicalTracks)) { | |
1228 | nHits2 = track2->GetNTrackHits(); | |
1229 | // number of hits in common between two tracks | |
1230 | hitsInCommon = track1->HitsInCommon(track2); | |
1231 | // check for identical tracks | |
1232 | if ((4 * hitsInCommon) >= (nHits1 + nHits2)) { | |
1233 | identicalTracks = kTRUE; | |
1234 | // decide which track to remove | |
1235 | if (nHits1 > nHits2) trackToRemove = track2; | |
1236 | else if (nHits1 < nHits2) trackToRemove = track1; | |
1237 | else if ((track1->GetFitFMin()) < (track2->GetFitFMin())) | |
1238 | trackToRemove = track2; | |
1239 | else trackToRemove = track1; | |
1240 | // remove it | |
1241 | trackToRemove->Remove(); | |
1242 | } | |
1243 | track2 = (AliMUONTrack*) fRecTracksPtr->After(track2); | |
1244 | } // track2 | |
1245 | track1 = (AliMUONTrack*) fRecTracksPtr->After(track1); | |
1246 | } // track1 | |
1247 | } | |
1248 | return; | |
1249 | } | |
1250 | ||
1251 | //__________________________________________________________________________ | |
04b5ea16 | 1252 | void AliMUONEventReconstructor::EventDump(void) |
1253 | { | |
1254 | // Dump reconstructed event (track parameters at vertex and at first hit), | |
1255 | // and the particle parameters | |
1256 | ||
1257 | AliMUONTrack *track; | |
1258 | AliMUONTrackParam *trackParam, *trackParam1; | |
1259 | TClonesArray *particles; // pointer to the particle list | |
1260 | TParticle *p; | |
1261 | Double_t bendingSlope, nonBendingSlope, pYZ; | |
1262 | Double_t pX, pY, pZ, x, y, z, c; | |
1263 | Int_t np, trackIndex, nTrackHits; | |
1264 | ||
1265 | if (fPrintLevel >= 1) cout << "****** enter EventDump ******" << endl; | |
1266 | if (fPrintLevel >= 1) { | |
1267 | cout << " Number of Reconstructed tracks :" << fNRecTracks << endl; | |
1268 | } | |
1269 | fRecTracksPtr->Compress(); // for simple loop without "Next" since no hole | |
1270 | // Loop over reconstructed tracks | |
1271 | for (trackIndex = 0; trackIndex < fNRecTracks; trackIndex++) { | |
1272 | if (fPrintLevel >= 1) | |
1273 | cout << " track number: " << trackIndex << endl; | |
1274 | // function for each track for modularity ???? | |
1275 | track = (AliMUONTrack*) ((*fRecTracksPtr)[trackIndex]); | |
1276 | nTrackHits = track->GetNTrackHits(); | |
1277 | if (fPrintLevel >= 1) | |
1278 | cout << " number of track hits: " << nTrackHits << endl; | |
1279 | // track parameters at Vertex | |
1280 | trackParam = track->GetTrackParamAtVertex(); | |
1281 | x = trackParam->GetNonBendingCoor(); | |
1282 | y = trackParam->GetBendingCoor(); | |
1283 | z = trackParam->GetZ(); | |
1284 | bendingSlope = trackParam->GetBendingSlope(); | |
1285 | nonBendingSlope = trackParam->GetNonBendingSlope(); | |
1286 | pYZ = 1/TMath::Abs(trackParam->GetInverseBendingMomentum()); | |
1287 | pZ = pYZ/TMath::Sqrt(1+bendingSlope*bendingSlope); | |
1288 | pX = pZ * nonBendingSlope; | |
1289 | pY = pZ * bendingSlope; | |
1290 | c = TMath::Sign(1.0, trackParam->GetInverseBendingMomentum()); | |
1291 | if (fPrintLevel >= 1) | |
1292 | printf(" track parameters at Vertex z= %f: X= %f Y= %f pX= %f pY= %f pZ= %f c= %f\n", | |
1293 | z, x, y, pX, pY, pZ, c); | |
1294 | ||
1295 | // track parameters at first hit | |
1296 | trackParam1 = ((AliMUONTrackHit*) | |
1297 | (track->GetTrackHitsPtr()->First()))->GetTrackParam(); | |
1298 | x = trackParam1->GetNonBendingCoor(); | |
1299 | y = trackParam1->GetBendingCoor(); | |
1300 | z = trackParam1->GetZ(); | |
1301 | bendingSlope = trackParam1->GetBendingSlope(); | |
1302 | nonBendingSlope = trackParam1->GetNonBendingSlope(); | |
1303 | pYZ = 1/TMath::Abs(trackParam1->GetInverseBendingMomentum()); | |
1304 | pZ = pYZ/TMath::Sqrt(1.0 + bendingSlope * bendingSlope); | |
1305 | pX = pZ * nonBendingSlope; | |
1306 | pY = pZ * bendingSlope; | |
1307 | c = TMath::Sign(1.0, trackParam1->GetInverseBendingMomentum()); | |
1308 | if (fPrintLevel >= 1) | |
1309 | printf(" track parameters at z= %f: X= %f Y= %f pX= %f pY= %f pZ= %f c= %f\n", | |
1310 | z, x, y, pX, pY, pZ, c); | |
1311 | } | |
1312 | // informations about generated particles | |
1313 | particles = gAlice->Particles(); | |
1314 | np = particles->GetEntriesFast(); | |
1315 | printf(" **** number of generated particles: %d \n", np); | |
1316 | ||
1317 | for (Int_t iPart = 0; iPart < np; iPart++) { | |
1318 | p = (TParticle*) particles->UncheckedAt(iPart); | |
1319 | printf(" particle %d: type= %d px= %f py= %f pz= %f pdg= %d\n", | |
1320 | iPart, p->GetPdgCode(), p->Px(), p->Py(), p->Pz(), p->GetPdgCode()); | |
1321 | } | |
a9e2aefa | 1322 | return; |
1323 | } | |
1324 | ||
1325 | void AliMUONEventReconstructor::Streamer(TBuffer &R__b) | |
1326 | { | |
1327 | ; | |
1328 | } |