AliRoot Core  edcc906 (edcc906)
AliMUONTracker.cxx
Go to the documentation of this file.
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$ */
17 
18 //-----------------------------------------------------------------------------
30 //-----------------------------------------------------------------------------
31 
32 #include "AliMUONTracker.h"
33 
34 #include "AliCodeTimer.h"
35 #include "AliESDEvent.h"
36 #include "AliESDMuonTrack.h"
37 #include "AliESDVertex.h"
38 #include "AliLog.h"
39 #include "AliMUONClusterStoreV2.h"
40 #include "AliMUONESDInterface.h"
42 #include "AliMUONRecoParam.h"
43 #include "AliMUONReconstructor.h"
44 #include "AliMUONTrack.h"
45 #include "AliMUONTrackExtrap.h"
46 #include "AliMUONTrackHitPattern.h"
47 #include "AliMUONTrackParam.h"
50 #include "AliMUONTrackStoreV1.h"
52 #include "AliMUONTriggerTrack.h"
53 #include "AliMUONLocalTrigger.h"
54 #include "AliMUONVClusterServer.h"
55 #include "AliMUONVDigitStore.h"
56 #include "AliMUONVTriggerStore.h"
58 #include <Riostream.h>
59 #include <TRandom.h>
60 #include <TTree.h>
61 #include "AliLog.h"
62 
64 ClassImp(AliMUONTracker)
66 
67 
68 //_____________________________________________________________________________
70  AliMUONVClusterServer* clusterServer,
71  AliMUONVDigitStore& digitStore,
72  const AliMUONGeometryTransformer* transformer,
73  const AliMUONTriggerCircuit* triggerCircuit,
74  const AliMUONTriggerUtilities* triggerUtilities)
75 : AliTracker(),
76 fkTransformer(transformer), // not owner
77 fkTriggerCircuit(triggerCircuit), // not owner
78 fTrackHitPatternMaker(0x0),
79 fTrackReco(0x0),
80 fClusterStore(0x0),
81 fTriggerStore(0x0),
82 fClusterServer(clusterServer),
83 fIsOwnerOfClusterServer(kFALSE),
84 fkDigitStore(digitStore), // not owner
85 fInputClusterStore(0x0),
86 fTriggerTrackStore(0x0),
87 fkRecoParam(recoParam),
88 fInternalTrackStore(0x0)
89 {
91 
92  if (fkTransformer)
93  fTrackHitPatternMaker = new AliMUONTrackHitPattern(recoParam,*fkTransformer,fkDigitStore,triggerUtilities);
94 
95  if (!fClusterServer)
96  {
97  AliDebug(1,"No cluster server given. Will use AliMUONLegacyClusterServer");
98  fIsOwnerOfClusterServer = kTRUE;
99  }
100  else
101  {
102  TIter next(fkDigitStore.CreateIterator());
103  fClusterServer->UseDigits(next,&digitStore);
104 
105  SetupClusterServer(*fClusterServer);
106  }
107 }
108 
109 //_____________________________________________________________________________
111 {
113 
114  delete fTrackReco;
115  delete fTrackHitPatternMaker;
116  delete fClusterStore;
117  delete fTriggerStore;
119  delete fInputClusterStore;
120  delete fTriggerTrackStore;
121  delete fInternalTrackStore;
122 }
123 
124 //_____________________________________________________________________________
127 {
129  if (!fClusterStore)
130  {
132  }
133  return fClusterStore;
134 }
135 
136 //_____________________________________________________________________________
139 {
141  if (!fTriggerTrackStore)
142  {
144  }
145  return fTriggerTrackStore;
146 }
147 
148 //_____________________________________________________________________________
149 Int_t AliMUONTracker::LoadClusters(TTree* clustersTree)
150 {
152 
153  if ( ! clustersTree ) {
154  AliFatal("No clustersTree");
155  return 1;
156  }
157 
158  if ( !fTriggerStore )
159  {
161  }
162 
163  if (!fTriggerStore)
164  {
165  AliError("Could not get triggerStore");
166  return 2;
167  }
168 
169  if (!fInputClusterStore)
170  {
172  if (!fInputClusterStore)
173  {
174  AliError("Could not get clusterStore");
175  return 3;
176  }
177  AliDebug(1,Form("Created %s from cluster tree",fInputClusterStore->ClassName()));
178  }
179 
181  {
182  if ( !fClusterServer )
183  {
185  GetRecoParam()->BypassSt4(),
186  GetRecoParam()->BypassSt5());
188  }
189 
190  }
191 
193  fInputClusterStore->Connect(*clustersTree,kFALSE);
194  fTriggerStore->Clear();
195  fTriggerStore->Connect(*clustersTree,kFALSE);
196 
197  clustersTree->GetEvent(0);
198 
199  return 0;
200 }
201 
202 //_____________________________________________________________________________
204 {
214 
215  AliCodeTimerAuto("",0)
216 
217  if (!fTrackReco)
218  {
221  }
222 
223  // if the required tracking mode does not exist
224  if (!fTrackReco) return 1;
225 
226  if ( ! ClusterStore() )
227  {
228  AliError("ClusterStore is NULL");
229  return 2;
230  }
231 
232  if (!fTriggerStore) {
233  AliError("TriggerStore is NULL");
234  return 3;
235  }
236 
237  // Make trigger tracks
238  if ( fkTriggerCircuit )
239  {
242  }
243 
244  if ( TriggerTrackStore()->GetSize() > GetRecoParam()->GetMaxTriggerTracks() )
245  {
246  // cut to reject shower events
247 
248  AliCodeTimerAuto("MUON Shower events",1);
249 
250  AliWarning(Form("Probably got a shower event (%d trigger tracks). Will not reconstruct tracks.",
251  TriggerTrackStore()->GetSize()));
252 
253  return 0;
254  }
255 
257 
258  // Match tracker/trigger tracks
259  if ( fTrackHitPatternMaker )
260  {
262  }
263 
264  // Fill ESD
266 
268  ClusterStore()->Clear();
269 
270  return 0;
271 }
272 
273 //_____________________________________________________________________________
274 void AliMUONTracker::FillESD(const AliMUONVTrackStore& trackStore, AliESDEvent* esd) const
275 {
277  AliDebug(1,"");
278  AliCodeTimerAuto("",0)
279 
280  // get ITS vertex
281  Double_t vertex[3] = {0., 0., 0.};
282  const AliESDVertex* esdVert = esd->GetVertex();
283  if (esdVert->GetNContributors() > 0 || !strcmp(esdVert->GetTitle(),"vertexer: smearMC")) {
284  esdVert->GetXYZ(vertex);
285  AliDebug(1,Form("found vertex (%e,%e,%e)",vertex[0],vertex[1],vertex[2]));
286  }
287 
288  // fill ESD event including all info in ESD cluster if required and only for the given fraction of events
290  AliMUONLocalTrigger* locTrg;
291  TIter next(trackStore.CreateIterator());
293  gRandom->Uniform(100.) <= GetRecoParam()->GetPercentOfFullClusterInESD()) {
294 
295  while ( ( track = static_cast<AliMUONTrack*>(next()) ) ) {
296 
297  if (track->GetMatchTrigger() > 0) {
298  locTrg = static_cast<AliMUONLocalTrigger*>(fTriggerStore->FindLocal(track->LoCircuit()));
299  AliMUONESDInterface::MUONToESD(*track, *esd, vertex, &fkDigitStore, locTrg);
300  } else AliMUONESDInterface::MUONToESD(*track, *esd, vertex, &fkDigitStore);
301 
302  }
303 
304  } else {
305 
306  while ( ( track = static_cast<AliMUONTrack*>(next()) ) ) {
307 
308  if (track->GetMatchTrigger() > 0) {
309  locTrg = static_cast<AliMUONLocalTrigger*>(fTriggerStore->FindLocal(track->LoCircuit()));
310  AliMUONESDInterface::MUONToESD(*track, *esd, vertex, 0x0, locTrg);
311  } else AliMUONESDInterface::MUONToESD(*track, *esd, vertex);
312 
313  }
314 
315  }
316 
317  // fill the local trigger decisions not matched with tracks (associate them to "ghost" tracks)
318  UInt_t ghostId = 0xFFFFFFFF - 1;
319  Bool_t matched = kFALSE;
320  AliMUONTriggerTrack *triggerTrack;
321  TIter itTriggerTrack(fTriggerTrackStore->CreateIterator());
322  while ( ( triggerTrack = static_cast<AliMUONTriggerTrack*>(itTriggerTrack()) ) ) {
323 
324  locTrg = static_cast<AliMUONLocalTrigger*>(fTriggerStore->FindLocal(triggerTrack->GetLoTrgNum()));
325 
326  // check if this local trigger has already been matched
327  TIter itTrack(trackStore.CreateIterator());
328  while ( ( track = static_cast<AliMUONTrack*>(itTrack()) ) ) {
329  matched = (track->LoCircuit() == locTrg->LoCircuit());
330  if (matched) break;
331  }
332  if (matched) continue;
333 
334  AliMUONESDInterface::MUONToESD(*locTrg, *esd, ghostId, triggerTrack);
335 
336  ghostId -= 1;
337  }
338 
339 }
340 
341 //_____________________________________________________________________________
343  AliMUONVClusterServer* clusterServer,
344  const AliMUONGeometryTransformer* transformer)
345 {
347 
348  AliMUONVTrackReconstructor* trackReco(0x0);
349 
350  TString opt(recoParam->GetTrackingMode());
351  opt.ToUpper();
352 
353  if (strstr(opt,"ORIGINAL"))
354  {
355  trackReco = new AliMUONTrackReconstructor(recoParam,clusterServer,transformer);
356  }
357  else if (strstr(opt,"KALMAN"))
358  {
359  trackReco = new AliMUONTrackReconstructorK(recoParam,clusterServer,transformer);
360  }
361  else
362  {
363  AliErrorClass(Form("tracking mode \"%s\" does not exist",opt.Data()));
364  return 0x0;
365  }
366 
367  AliDebugClass(1,Form("Will use %s for tracking",trackReco->ClassName()));
368 
369  return trackReco;
370 }
371 
372 //_____________________________________________________________________________
374 {
376 
378 }
379 
380 
381 //_____________________________________________________________________________
382 void
384 {
386 
387  if ( GetRecoParam()->BypassSt4() ||
388  GetRecoParam()->BypassSt5() )
389  {
390  Bool_t ok = clusterServer.UseTriggerTrackStore(TriggerTrackStore());
391 
392  TString msg1;
393  TString msg2;
394 
395  if ( GetRecoParam()->BypassSt45() )
396  {
397  msg1 = "STATIONS 4 AND 5";
398  msg2 = "THOSE TWO STATIONS";
399  }
400  else if ( GetRecoParam()->BypassSt4() )
401  {
402  msg1 = "STATION 4";
403  msg2 = "THAT STATION";
404  }
405  else if ( GetRecoParam()->BypassSt5() )
406  {
407  msg1 = "STATION 5";
408  msg2 = "THAT STATION";
409  }
410 
411  if ( ok )
412  {
413  AliWarning(Form("WILL USE TRIGGER TRACKS TO GENERATE CLUSTERS IN %s, "
414  "THUS BYPASSING REAL CLUSTERS IN %s!!!",msg1.Data(),msg2.Data()));
415  }
416  else
417  {
418  AliWarning("BYPASSING OF ST4 AND/OR 5 REQUESTED, BUT CLUSTERSERVER DOES NOT SEEM TO SUPPORT IT !!!");
419  }
420  }
421 }
422 
423 
virtual ~AliMUONTracker()
Base class of a track container.
void SetupClusterServer(AliMUONVClusterServer &clusterServer)
Virtual class for the MUON track reconstruction.
static void MUONToESD(const AliMUONTrack &track, AliESDEvent &esd, const Double_t vertex[3], const AliMUONVDigitStore *digits=0x0, const AliMUONLocalTrigger *locTrg=0x0)
virtual Bool_t UseTriggerTrackStore(AliMUONVTriggerTrackStore *)
Use trigger tracks. Return kFALSE if not used.
Interface for a digit container.
virtual TIterator * CreateIterator() const =0
Iterator to loop over tracks.
Int_t GetMatchTrigger(void) const
return 1,2,3 if track matches with trigger track, 0 if not
Definition: AliMUONTrack.h:79
virtual void GetXYZ(Double_t position[3]) const
Definition: AliVertex.cxx:119
Bool_t fIsOwnerOfClusterServer
! whether we are owner of the cluster server
virtual TIterator * CreateIterator() const =0
Create an iterator to loop over tracks.
void ValidateTracksWithTrigger(AliMUONVTrackStore &trackStore, const AliMUONVTriggerTrackStore &triggerTrackStore, const AliMUONVTriggerStore &triggerStore, const AliMUONTrackHitPattern &trackHitPattern)
Top container class for geometry transformations.
Int_t GetLoTrgNum() const
Return local trigger number.
const AliMUONVDigitStore & fkDigitStore
! digit info to fill in ESD
Interface of a cluster finder for combined tracking.
AliMUONVClusterStore * ClusterStore() const
Implementation of AliMUONVTriggerTrackStore.
AliMUONVTriggerTrackStore * TriggerTrackStore() const
void SaveFullClusterInESD(Bool_t flag, Double_t percentOfEvent=100.)
save all cluster info (including pads) in ESD, for the given percentage of events ...
const AliMUONGeometryTransformer * fkTransformer
! geometry transformer (not owner)
virtual void Clear(Option_t *opt="")=0
Clear container.
Class with MUON reconstruction parameters.
AliTPCfastTrack * track
Reconstructed trigger track in ALICE dimuon spectrometer.
MUON base Tracker.
Utilities for trigger (check if pad is masked)
Implementation of VClusterStore.
Option_t * GetTrackingMode() const
get the tracking mode
Class for the MUON track reconstruction using kalman filter.
#define AliWarning(message)
Definition: AliLog.h:541
AliMUONVTriggerTrackStore * fTriggerTrackStore
! trigger track store
AliMUONVTrackReconstructor * fTrackReco
! track reconstructor
virtual Int_t Clusters2Tracks(AliESDEvent *esd)
Double_t GetPercentOfFullClusterInESD() const
return the percentage of events for which all cluster info are stored in ESD
#define AliErrorClass(message)
Definition: AliLog.h:596
#define AliDebugClass(logLevel, message)
Definition: AliLog.h:313
virtual void UnloadClusters()
Reconstructed Local Trigger object.
MUON Trigger circuit.
void FillESD(const AliMUONVTrackStore &trackStore, AliESDEvent *esd) const
virtual AliMUONVStore * Create() const =0
Create an empty copy of this.
Int_t LoCircuit(void) const
number of triggering circuit
Definition: AliMUONTrack.h:115
Class for the MUON track hit pattern.
AliMUONVTrackStore * fInternalTrackStore
! internal track store
#define AliCodeTimerAuto(message, counter)
Definition: AliCodeTimer.h:137
const AliMUONTriggerCircuit * fkTriggerCircuit
! trigger circuit (not owner)
Interface of a cluster container.
Base class of a trigger track store.
AliMUONTrackHitPattern * fTrackHitPatternMaker
! trigger hit pattern maker
Cluster server that always clusterize everything.
Implementation of AliMUONVTrackStore.
#define AliFatal(message)
Definition: AliLog.h:640
AliMUONVClusterServer * fClusterServer
! to get clusters
AliMUONVTriggerStore * fTriggerStore
! trigger information
#define AliDebug(logLevel, message)
Definition: AliLog.h:300
const AliESDVertex * GetVertex() const
Definition: AliESDEvent.h:308
virtual Int_t GetNContributors() const
Definition: AliVertex.h:42
virtual Int_t LoadClusters(TTree *clustersTree)
Standard class for the MUON track reconstruction.
virtual void Clear(Option_t *opt="")=0
Clear ourselves (i.e. Reset)
const AliMUONRecoParam * GetRecoParam() const
Return reco parameters.
void EventReconstructTrigger(const AliMUONTriggerCircuit &triggerCircuit, const AliMUONVTriggerStore &triggerStore, AliMUONVTriggerTrackStore &triggerTrackStore)
Reconstructed track in ALICE dimuon spectrometer.
Definition: AliMUONTrack.h:24
#define AliError(message)
Definition: AliLog.h:591
static AliMUONVTrackReconstructor * CreateTrackReconstructor(const AliMUONRecoParam *recoParam, AliMUONVClusterServer *clusterServer, const AliMUONGeometryTransformer *transformer)
virtual Bool_t Connect(TTree &tree, Bool_t alone=kTRUE) const
Connect us to a TTree (only valid if CanConnect()==kTRUE)
virtual AliMUONLocalTrigger * FindLocal(Int_t boardNumber) const =0
Find a local trigger by the board number (not an index, it is a number really)
void EventReconstruct(AliMUONVClusterStore &clusterStore, AliMUONVTrackStore &trackStore)
Int_t LoCircuit() const
Return Circuit number.
AliMUONVClusterStore * fInputClusterStore
! cluster container
AliMUONVClusterStore * fClusterStore
! cluster container