DQM histogram ranges updated. Added new methods. More details in class description...
[u/mrichter/AliRoot.git] / MUON / AliMUONESDInterface.cxx
CommitLineData
103e6575 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#include "AliMUONESDInterface.h"
19#include "AliMUONTrack.h"
20#include "AliMUONVTrackStore.h"
21#include "AliMUONVCluster.h"
22#include "AliMUONVClusterStore.h"
23#include "AliMUONVDigit.h"
24#include "AliMUONVDigitStore.h"
b1fea02e 25#include "AliMUONLocalTrigger.h"
67c201be 26#include "AliMUONTriggerTrack.h"
b1fea02e 27#include "AliMUONVTriggerStore.h"
103e6575 28#include "AliMUON2DMapIterator.h"
29#include "AliMUONTrackParam.h"
30#include "AliMUONTrackExtrap.h"
31#include "AliMUONConstants.h"
b1fea02e 32#include "AliMUONTracker.h"
33#include "AliMUONRecoParam.h"
34#include "AliMUONVTrackReconstructor.h"
103e6575 35
630711ed 36#include "AliMpExMapIterator.h"
103e6575 37#include "AliMpVSegmentation.h"
38#include "AliMpSegmentation.h"
103e6575 39#include "AliMpPad.h"
40
41#include "AliESDEvent.h"
42#include "AliESDMuonTrack.h"
43#include "AliESDMuonCluster.h"
44#include "AliESDMuonPad.h"
45#include "AliLog.h"
46
47#include <TClass.h>
48#include <TIterator.h>
49#include <TMath.h>
50#include <TMatrixD.h>
51#include <Riostream.h>
a99c3449 52#include <TGeoGlobalMagField.h>
53#include <TVirtualMagField.h>
103e6575 54
55//-----------------------------------------------------------------------------
56/// \class AliMUONESDInterface
57///
58/// There are 2 way of using thid converter between MUON track/cluster/digit
59/// and ESDMuon track/cluster/pad:
60///
61/// 1) using the static methods converting the objects one by one
62///
b1fea02e 63/// 2) loading a whole ESDEvent and using the finders and/or the iterators
103e6575 64/// to access the corresponding MUON objects
65///
ad3c6eda 66/// note: You can set the recoParam used to refit the MUON track with ResetTracker(...);
67/// By default we use Kalman filter + Smoother
68///
103e6575 69/// \author Philippe Pillot
70//-----------------------------------------------------------------------------
71
72/// \cond CLASSIMP
73ClassImp(AliMUONESDInterface)
74/// \endcond
75
ad3c6eda 76AliMUONRecoParam* AliMUONESDInterface::fgRecoParam = 0x0;
b1fea02e 77AliMUONVTrackReconstructor* AliMUONESDInterface::fgTracker = 0x0;
78
103e6575 79TString AliMUONESDInterface::fgTrackStoreName = "AliMUONTrackStoreV1";
80TString AliMUONESDInterface::fgClusterStoreName = "AliMUONClusterStoreV2";
81TString AliMUONESDInterface::fgDigitStoreName = "AliMUONDigitStoreV2R";
b1fea02e 82TString AliMUONESDInterface::fgTriggerStoreName = "AliMUONTriggerStoreV1";
103e6575 83
84//_____________________________________________________________________________
ad3c6eda 85AliMUONESDInterface::AliMUONESDInterface()
103e6575 86: TObject(),
a0dc65b4 87fTracks(0x0),
88fDigits(0x0),
89fTriggers(0x0),
90fClusterMap(0x0),
91fDigitMap(0x0)
103e6575 92{
93 /// Default constructor
94}
95
96//_____________________________________________________________________________
97AliMUONESDInterface::~AliMUONESDInterface()
98{
99 /// Destructor
100 delete fTracks;
101 delete fDigits;
b1fea02e 102 delete fTriggers;
103e6575 103 delete fClusterMap;
104 delete fDigitMap;
105}
106
107//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
108// methods to play with internal objects //
109//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
110
111//_____________________________________________________________________________
112void AliMUONESDInterface::Clear(Option_t*)
113{
114 /// clear memory
115 delete fTracks; fTracks = 0x0;
116 delete fDigits; fDigits = 0x0;
b1fea02e 117 delete fTriggers; fTriggers = 0x0;
103e6575 118 delete fClusterMap; fClusterMap = 0x0;
119 delete fDigitMap; fDigitMap = 0x0;
120}
121
122//_____________________________________________________________________________
123void AliMUONESDInterface::Reset()
124{
125 /// reset stores and maps
126
127 if (fTracks) fTracks->Clear("C");
128 else fTracks = NewTrackStore();
129
130 if (fDigits) fDigits->Clear("C");
131 else fDigits = NewDigitStore();
132
b1fea02e 133 if (fTriggers) fTriggers->Clear("C");
134 else fTriggers = NewTriggerStore();
135
103e6575 136 if (fClusterMap) fClusterMap->Clear();
630711ed 137 else fClusterMap = new AliMpExMap;
103e6575 138 fClusterMap->SetOwner(kTRUE);
139
630711ed 140 if (fDigitMap) fDigitMap->Clear();
141 else fDigitMap = new AliMpExMap;
142 fDigitMap->SetOwner(kTRUE);
103e6575 143}
144
145//_____________________________________________________________________________
a99c3449 146void AliMUONESDInterface::LoadEvent(AliESDEvent& esdEvent, Bool_t refit)
103e6575 147{
148 /// Extract MUON data from the given ESD event
149
150 // reset data members
151 Reset();
152
153 // loop over ESD tracks and fill the stores
154 Int_t nTracks = (Int_t) esdEvent.GetNumberOfMuonTracks();
155 for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
156
157 // get ESD track
158 AliESDMuonTrack* esdTrack = esdEvent.GetMuonTrack(iTrack);
159
b1fea02e 160 // fill trigger store if related info are availables
161 if (esdTrack->ContainTriggerData()) Add(*esdTrack, *fTriggers);
162
163 // fill tracker data if availables
164 if (!esdTrack->ContainTrackerData()) continue;
165
103e6575 166 // add it to track store
a99c3449 167 AliMUONTrack* track = Add(*esdTrack, *fTracks, refit);
103e6575 168
103e6575 169 // prepare cluster map
630711ed 170 AliMpExMap* cMap = new AliMpExMap;
103e6575 171 cMap->SetOwner(kFALSE);
630711ed 172 fClusterMap->Add(esdTrack->GetUniqueID(), cMap);
103e6575 173
174 // prepare digit maps
630711ed 175 AliMpExMap* dMaps = new AliMpExMap;
103e6575 176 dMaps->SetOwner(kTRUE);
630711ed 177 fDigitMap->Add(esdTrack->GetUniqueID(), dMaps);
103e6575 178
179 // loop over ESD clusters
180 Int_t nClusters = esdTrack->GetNClusters();
181 for (Int_t iCluster = 0; iCluster < nClusters; iCluster++) {
182
183 // get ESD cluster
184 AliESDMuonCluster *esdCluster = (AliESDMuonCluster*) esdTrack->GetClusters().UncheckedAt(iCluster);
185
186 // get the corresponding MUON cluster
187 AliMUONVCluster* cluster = FindClusterInTrack(*track, esdCluster->GetUniqueID());
188
189 // fill cluster map
190 cMap->Add(cluster->GetUniqueID(), cluster);
191
192 // prepare digit map
630711ed 193 AliMpExMap* dMap =new AliMpExMap;
103e6575 194 dMap->SetOwner(kFALSE);
630711ed 195 dMaps->Add(esdCluster->GetUniqueID(), dMap);
103e6575 196
197 // loop over ESD pads
198 Int_t nPads = esdCluster->GetNPads();
b1fea02e 199 for (Int_t iPad = 0; iPad < nPads; iPad++) {
103e6575 200
201 // get ESD pad
202 AliESDMuonPad *esdPad = (AliESDMuonPad*) esdCluster->GetPads().UncheckedAt(iPad);
203
204 // add it to digit store
205 AliMUONVDigit* digit = Add(*esdPad, *fDigits);
206
207 // fill digit map
208 if (digit) dMap->Add(esdPad->GetUniqueID(), digit);
209 else dMap->Add(esdPad->GetUniqueID(), fDigits->FindObject(esdPad->GetUniqueID()));
210
211 } // end of loop over pads
212
213 } // end of loop over clusters
214
215 } // end of loop over tracks
216
217}
218
219//___________________________________________________________________________
220Int_t AliMUONESDInterface::GetNTracks() const
221{
222 /// return the number of tracks
630711ed 223 return fTracks ? fTracks->GetSize() : 0;
103e6575 224}
225
226//___________________________________________________________________________
227Int_t AliMUONESDInterface::GetNClusters() const
228{
229 /// return the number of clusters
230 Int_t nClusters = 0;
630711ed 231 AliMUONTrack *track;
232 TIter next(CreateTrackIterator());
233 while ((track = static_cast<AliMUONTrack*>(next()))) nClusters += track->GetNClusters();
103e6575 234 return nClusters;
235}
236
237//___________________________________________________________________________
630711ed 238Int_t AliMUONESDInterface::GetNClusters(UInt_t trackId) const
103e6575 239{
630711ed 240 /// return the number of clusters in track "trackId"
241 AliMUONTrack* track = FindTrack(trackId);
103e6575 242 return track ? track->GetNClusters() : 0;
243}
244
245//___________________________________________________________________________
246Int_t AliMUONESDInterface::GetNDigits() const
247{
248 /// return the number of digits
249 return fDigits ? fDigits->GetSize() : 0;
250}
251
252//___________________________________________________________________________
630711ed 253Int_t AliMUONESDInterface::GetNDigits(UInt_t trackId) const
103e6575 254{
630711ed 255 /// return the number of digits in all clusters of track "trackId"
103e6575 256 Int_t nDigits = 0;
630711ed 257 AliMUONVCluster *cluster;
258 TIter next(CreateClusterIterator(trackId));
259 while ((cluster = static_cast<AliMUONVCluster*>(next()))) nDigits += cluster->GetNDigits();
103e6575 260 return nDigits;
261}
262
263//___________________________________________________________________________
630711ed 264Int_t AliMUONESDInterface::GetNDigits(UInt_t trackId, UInt_t clusterId) const
103e6575 265{
266 /// return the number of digits in cluster numbered "iCluster" of track "iTrack"
630711ed 267 AliMUONVCluster* cluster = FindCluster(trackId, clusterId);
103e6575 268 return cluster ? cluster->GetNDigits() : 0;
269}
270
271//___________________________________________________________________________
272Int_t AliMUONESDInterface::GetNDigitsInCluster(UInt_t clusterId) const
273{
274 /// return the number of digits in cluster "clusterId"
275 AliMUONVCluster* cluster = FindCluster(clusterId);
276 return cluster ? cluster->GetNDigits() : 0;
277}
278
279//___________________________________________________________________________
b1fea02e 280Int_t AliMUONESDInterface::GetNTriggers() const
281{
282 /// return the number of triggers
283 return fTriggers ? fTriggers->GetSize() : 0;
284}
285
286//___________________________________________________________________________
630711ed 287AliMUONTrack* AliMUONESDInterface::FindTrack(UInt_t trackId) const
103e6575 288{
630711ed 289 /// return track "trackId" (0x0 if not found)
290 AliMUONTrack *track = fTracks ? static_cast<AliMUONTrack*>(fTracks->FindObject(trackId)) : 0x0;
291 if (!track) AliWarning(Form("track %d does not exist",trackId));
103e6575 292 return track;
293}
294
295//___________________________________________________________________________
103e6575 296AliMUONVCluster* AliMUONESDInterface::FindCluster(UInt_t clusterId) const
297{
630711ed 298 /// loop over tracks and return the first cluster "clusterId" found (0x0 if not found)
299 AliMpExMap *cMap;
103e6575 300 AliMUONVCluster* cluster = 0x0;
301
630711ed 302 if (fClusterMap) {
103e6575 303
630711ed 304 TIter next(fClusterMap->CreateIterator());
305 while ((cMap = static_cast<AliMpExMap*>(next()))) {
306
307 cluster = static_cast<AliMUONVCluster*>(cMap->GetValue(clusterId));
308 if (cluster) return cluster;
309
310 }
103e6575 311
312 }
313
314 if (!cluster) AliWarning(Form("cluster %d does not exist",clusterId));
630711ed 315 return 0x0;
316}
317
318//___________________________________________________________________________
319AliMUONVCluster* AliMUONESDInterface::FindCluster(UInt_t trackId, UInt_t clusterId) const
320{
321 /// return cluster "clusterId" in track "trackId" (0x0 if not found)
322 AliMpExMap *cMap = fClusterMap ? static_cast<AliMpExMap*>(fClusterMap->GetValue(trackId)) : 0x0;
323 AliMUONVCluster* cluster = cMap ? static_cast<AliMUONVCluster*>(cMap->GetValue(clusterId)) : 0x0;
324 if (!cluster) AliWarning(Form("cluster %d does not exist in track %d", clusterId, trackId));
103e6575 325 return cluster;
326}
327
328//___________________________________________________________________________
329AliMUONVDigit* AliMUONESDInterface::FindDigit(UInt_t digitId) const
330{
331 /// return digit "digitId" (0x0 if not found)
332 AliMUONVDigit *digit = fDigits ? fDigits->FindObject(digitId) : 0x0;
333 if (!digit) AliWarning(Form("digit %d does not exist",digitId));
334 return digit;
335}
336
337//___________________________________________________________________________
b1fea02e 338AliMUONLocalTrigger* AliMUONESDInterface::FindLocalTrigger(Int_t boardNumber) const
339{
340 /// return MUON local trigger "boardNumber"
341 return (fTriggers) ? fTriggers->FindLocal(boardNumber) : 0x0;
342}
343
344//___________________________________________________________________________
103e6575 345TIterator* AliMUONESDInterface::CreateTrackIterator() const
346{
347 /// return iterator over all tracks
348 return fTracks ? fTracks->CreateIterator() : 0x0;
349}
350
351//___________________________________________________________________________
352TIterator* AliMUONESDInterface::CreateClusterIterator() const
353{
354 /// return iterator over all clusters
355 return fClusterMap ? new AliMUON2DMapIterator(*fClusterMap) : 0x0;
356}
357
358//___________________________________________________________________________
630711ed 359TIterator* AliMUONESDInterface::CreateClusterIterator(UInt_t trackId) const
103e6575 360{
630711ed 361 /// return iterator over clusters of track "trackId"
362 AliMpExMap *cMap = fClusterMap ? static_cast<AliMpExMap*>(fClusterMap->GetValue(trackId)) : 0x0;
363 return cMap ? cMap->CreateIterator() : 0x0;
103e6575 364}
365
366//___________________________________________________________________________
367TIterator* AliMUONESDInterface::CreateDigitIterator() const
368{
369 /// return iterator over all digits
370 return fDigits ? fDigits->CreateIterator() : 0x0;
371}
372
373//___________________________________________________________________________
630711ed 374TIterator* AliMUONESDInterface::CreateDigitIterator(UInt_t trackId) const
103e6575 375{
630711ed 376 /// return iterator over all digits of track "trackId"
377 AliMpExMap* dMaps = fDigitMap ? static_cast<AliMpExMap*>(fDigitMap->GetValue(trackId)) : 0x0;
103e6575 378 return dMaps ? new AliMUON2DMapIterator(*dMaps) : 0x0;
379}
380
381//___________________________________________________________________________
630711ed 382TIterator* AliMUONESDInterface::CreateDigitIterator(UInt_t trackId, UInt_t clusterId) const
103e6575 383{
630711ed 384 /// return iterator over digits of cluster "clusterId" in track "trackId"
385 AliMpExMap* dMaps = fDigitMap ? static_cast<AliMpExMap*>(fDigitMap->GetValue(trackId)) : 0x0;
386 AliMpExMap* dMap = dMaps ? static_cast<AliMpExMap*>(dMaps->GetValue(clusterId)) : 0x0;
387 return dMap ? dMap->CreateIterator() : 0x0;
103e6575 388}
389
390//___________________________________________________________________________
391TIterator* AliMUONESDInterface::CreateDigitIteratorInCluster(UInt_t clusterId) const
392{
630711ed 393 /// return iterator over digits of the first cluster "clusterId" found by looping over all tracks
394 AliMpExMap *dMaps;
103e6575 395 AliMpExMap* dMap = 0x0;
396
630711ed 397 if (fDigitMap) {
103e6575 398
630711ed 399 TIter next(fDigitMap->CreateIterator());
400 while ((dMaps = static_cast<AliMpExMap*>(next()))) {
401
402 dMap = static_cast<AliMpExMap*>(dMaps->GetValue(clusterId));
403 if (dMap) return dMap->CreateIterator();
404
405 }
103e6575 406
407 }
408
630711ed 409 return 0x0;
103e6575 410}
411
412//___________________________________________________________________________
b1fea02e 413TIterator* AliMUONESDInterface::CreateLocalTriggerIterator() const
414{
415 /// return iterator over all local trigger
416 return fTriggers ? fTriggers->CreateLocalIterator() : 0x0;
417}
418
419//___________________________________________________________________________
103e6575 420AliMUONVCluster* AliMUONESDInterface::FindClusterInTrack(const AliMUONTrack& track, UInt_t clusterId) const
421{
422 /// find the cluster with the given Id into the track
423
424 Int_t nClusters = track.GetNClusters();
425 for (Int_t iCluster = 0; iCluster < nClusters; iCluster++) {
426
427 AliMUONVCluster* cluster = ((AliMUONTrackParam*) track.GetTrackParamAtCluster()->UncheckedAt(iCluster))->GetClusterPtr();
428 if (cluster->GetUniqueID() == clusterId) return cluster;
429
430 }
431
432 return 0x0;
433}
434
435//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
436// static methods //
437//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
438
439//_____________________________________________________________________________
a99c3449 440void AliMUONESDInterface::ResetTracker(const AliMUONRecoParam* recoParam, Bool_t info)
ad3c6eda 441{
442 /// Reset the MUON tracker using "recoParam" if provided.
443 /// If not provided, will use Kalman filter + Smoother
444
445 delete fgTracker;
446 delete fgRecoParam;
447
448 if (recoParam) {
449
450 fgRecoParam = new AliMUONRecoParam(*recoParam);
451
a99c3449 452 if (info) cout<<"I-AliMUONESDInterface::ResetTracker: will refit tracks with provided RecoParam:"<<endl;
453
5a240757 454 } else {
ad3c6eda 455
456 fgRecoParam = AliMUONRecoParam::GetLowFluxParam();
4ea3f013 457
458 cout<<"W-AliMUONESDInterface::ResetTracker: RecoParam not provided. Will use default LowFlux parametrization:"<<endl;
a99c3449 459
460 }
461
462 // print useful parameters for refitting
463 if (info) {
4ea3f013 464 cout<<" --> Tracking mode = "<<fgRecoParam->GetTrackingMode()<<endl;
465 if (fgRecoParam->UseSmoother()) cout<<" --> Use Smoother"<<endl;
466 else cout<<" --> Do not use smoother"<<endl;
467 cout<<" --> Vertex dispersion in bending direction = "
a99c3449 468 <<fgRecoParam->GetBendingVertexDispersion()<<" cm"<<endl;
ad3c6eda 469 }
470
a99c3449 471 if (!TGeoGlobalMagField::Instance()->GetField())
472 cout<<"W-AliMUONESDInterface::ResetTracker: Magnetic field has not been set --> assume field is OFF"<<endl;
473
ad3c6eda 474 fgTracker = AliMUONTracker::CreateTrackReconstructor(fgRecoParam,0x0);
475
476}
477
478//_____________________________________________________________________________
103e6575 479AliMUONVTrackStore* AliMUONESDInterface::NewTrackStore()
480{
481 /// Create an empty track store of type fgTrackStoreName
482 TClass* classPtr = TClass::GetClass(fgTrackStoreName);
483 if (!classPtr || !classPtr->InheritsFrom("AliMUONVTrackStore")) {
484 cout<<"E-AliMUONESDInterface::NewTrackStore: Unable to create store of type "<<fgTrackStoreName.Data()<<endl;
485 return 0x0;
486 }
487 return reinterpret_cast<AliMUONVTrackStore*>(classPtr->New());
488}
489
490//_____________________________________________________________________________
491AliMUONVClusterStore* AliMUONESDInterface::NewClusterStore()
492{
493 /// Create an empty cluster store of type fgClusterStoreName
494 TClass* classPtr = TClass::GetClass(fgClusterStoreName);
495 if (!classPtr || !classPtr->InheritsFrom("AliMUONVClusterStore")) {
496 cout<<"E-AliMUONESDInterface::NewClusterStore: Unable to create store of type "<<fgClusterStoreName.Data()<<endl;
497 return 0x0;
498 }
499 return reinterpret_cast<AliMUONVClusterStore*>(classPtr->New());
500}
501
502//_____________________________________________________________________________
503AliMUONVDigitStore* AliMUONESDInterface::NewDigitStore()
504{
505 /// Create an empty digit store of type fgDigitStoreName
506 TClass* classPtr = TClass::GetClass(fgDigitStoreName);
507 if (!classPtr || !classPtr->InheritsFrom("AliMUONVDigitStore")) {
508 cout<<"E-AliMUONESDInterface::NewDigitStore: Unable to create store of type "<<fgDigitStoreName.Data()<<endl;
509 return 0x0;
510 }
511 return reinterpret_cast<AliMUONVDigitStore*>(classPtr->New());
512}
513
b1fea02e 514//_____________________________________________________________________________
515AliMUONVTriggerStore* AliMUONESDInterface::NewTriggerStore()
516{
517 /// Create an empty trigger store of type fgTriggerStoreName
518 TClass* classPtr = TClass::GetClass(fgTriggerStoreName);
519 if (!classPtr || !classPtr->InheritsFrom("AliMUONVTriggerStore")) {
520 cout<<"E-AliMUONESDInterface::NewTriggerStore: Unable to create store of type "<<fgTriggerStoreName.Data()<<endl;
521 return 0x0;
522 }
523 return reinterpret_cast<AliMUONVTriggerStore*>(classPtr->New());
524}
525
103e6575 526//_________________________________________________________________________
527void AliMUONESDInterface::GetParamAtVertex(const AliESDMuonTrack& esdTrack, AliMUONTrackParam& trackParam)
528{
529 /// Get parameters at vertex from ESDMuon track
530 trackParam.SetZ(esdTrack.GetZ());
531 trackParam.SetNonBendingCoor(esdTrack.GetNonBendingCoor());
532 trackParam.SetNonBendingSlope(TMath::Tan(esdTrack.GetThetaX()));
533 trackParam.SetBendingCoor(esdTrack.GetBendingCoor());
534 trackParam.SetBendingSlope(TMath::Tan(esdTrack.GetThetaY()));
535 trackParam.SetInverseBendingMomentum(esdTrack.GetInverseBendingMomentum());
536}
537
538//_________________________________________________________________________
539void AliMUONESDInterface::GetParamAtDCA(const AliESDMuonTrack& esdTrack, AliMUONTrackParam& trackParam)
540{
541 /// Get parameters at DCA from ESDMuon track
542 trackParam.SetZ(esdTrack.GetZ());
543 trackParam.SetNonBendingCoor(esdTrack.GetNonBendingCoorAtDCA());
544 trackParam.SetNonBendingSlope(TMath::Tan(esdTrack.GetThetaXAtDCA()));
545 trackParam.SetBendingCoor(esdTrack.GetBendingCoorAtDCA());
546 trackParam.SetBendingSlope(TMath::Tan(esdTrack.GetThetaYAtDCA()));
547 trackParam.SetInverseBendingMomentum(esdTrack.GetInverseBendingMomentumAtDCA());
548}
549
550//_________________________________________________________________________
551void AliMUONESDInterface::GetParamAtFirstCluster(const AliESDMuonTrack& esdTrack, AliMUONTrackParam& trackParam)
552{
553 /// Get parameters at first cluster from ESDMuon track
554 trackParam.SetZ(esdTrack.GetZUncorrected());
555 trackParam.SetNonBendingCoor(esdTrack.GetNonBendingCoorUncorrected());
556 trackParam.SetNonBendingSlope(TMath::Tan(esdTrack.GetThetaXUncorrected()));
557 trackParam.SetBendingCoor(esdTrack.GetBendingCoorUncorrected());
558 trackParam.SetBendingSlope(TMath::Tan(esdTrack.GetThetaYUncorrected()));
559 trackParam.SetInverseBendingMomentum(esdTrack.GetInverseBendingMomentumUncorrected());
560}
561
562//_________________________________________________________________________
563void AliMUONESDInterface::GetParamCov(const AliESDMuonTrack& esdTrack, AliMUONTrackParam& trackParam)
564{
565 /// Get parameters covariances from ESD track
566
567 // get ESD covariance matrix
568 TMatrixD covariances(5,5);
569 esdTrack.GetCovariances(covariances);
570
571 // compute Jacobian to change the coordinate system
572 // from (X,thetaX,Y,thetaY,c/pYZ) to (X,slopeX,Y,slopeY,c/pYZ)
573 Double_t cosThetaX = TMath::Cos(esdTrack.GetThetaXUncorrected());
574 Double_t cosThetaY = TMath::Cos(esdTrack.GetThetaYUncorrected());
575 TMatrixD jacob(5,5);
576 jacob.Zero();
577 jacob(0,0) = 1.;
578 jacob(1,1) = 1. / cosThetaX / cosThetaX;
579 jacob(2,2) = 1.;
580 jacob(3,3) = 1. / cosThetaY / cosThetaY;
581 jacob(4,4) = 1.;
582
583 // compute covariance matrix in ESD coordinate system
584 TMatrixD tmp(covariances,TMatrixD::kMultTranspose,jacob);
585 trackParam.SetCovariances(TMatrixD(jacob,TMatrixD::kMult,tmp));
586
587}
588
589//_________________________________________________________________________
590void AliMUONESDInterface::SetParamAtVertex(const AliMUONTrackParam& trackParam, AliESDMuonTrack& esdTrack)
591{
592 /// Set parameters in ESD track
593 esdTrack.SetZ(trackParam.GetZ());
594 esdTrack.SetNonBendingCoor(trackParam.GetNonBendingCoor());
595 esdTrack.SetThetaX(TMath::ATan(trackParam.GetNonBendingSlope()));
596 esdTrack.SetBendingCoor(trackParam.GetBendingCoor());
597 esdTrack.SetThetaY(TMath::ATan(trackParam.GetBendingSlope()));
598 esdTrack.SetInverseBendingMomentum(trackParam.GetInverseBendingMomentum());
599}
600
601//_________________________________________________________________________
602void AliMUONESDInterface::SetParamAtDCA(const AliMUONTrackParam& trackParam, AliESDMuonTrack& esdTrack)
603{
604 /// Set parameters in ESD track
605 esdTrack.SetNonBendingCoorAtDCA(trackParam.GetNonBendingCoor());
606 esdTrack.SetThetaXAtDCA(TMath::ATan(trackParam.GetNonBendingSlope()));
607 esdTrack.SetBendingCoorAtDCA(trackParam.GetBendingCoor());
608 esdTrack.SetThetaYAtDCA(TMath::ATan(trackParam.GetBendingSlope()));
609 esdTrack.SetInverseBendingMomentumAtDCA(trackParam.GetInverseBendingMomentum());
610}
611
612//_________________________________________________________________________
613void AliMUONESDInterface::SetParamAtFirstCluster(const AliMUONTrackParam& trackParam, AliESDMuonTrack& esdTrack)
614{
615 /// Set parameters in ESD track
616 esdTrack.SetZUncorrected(trackParam.GetZ());
617 esdTrack.SetNonBendingCoorUncorrected(trackParam.GetNonBendingCoor());
618 esdTrack.SetThetaXUncorrected(TMath::ATan(trackParam.GetNonBendingSlope()));
619 esdTrack.SetBendingCoorUncorrected(trackParam.GetBendingCoor());
620 esdTrack.SetThetaYUncorrected(TMath::ATan(trackParam.GetBendingSlope()));
621 esdTrack.SetInverseBendingMomentumUncorrected(trackParam.GetInverseBendingMomentum());
622}
623
624//_________________________________________________________________________
625void AliMUONESDInterface::SetParamCov(const AliMUONTrackParam& trackParam, AliESDMuonTrack& esdTrack)
626{
627 /// Set parameters covariances in ESD track
628
629 // set null matrix if covariances does not exist
630 if (!trackParam.CovariancesExist()) {
631 TMatrixD tmp(5,5);
632 tmp.Zero();
633 esdTrack.SetCovariances(tmp);
634 return;
635 }
636
637 // compute Jacobian to change the coordinate system
638 // from (X,slopeX,Y,slopeY,c/pYZ) to (X,thetaX,Y,thetaY,c/pYZ)
639 Double_t cosThetaX = TMath::Cos(TMath::ATan(trackParam.GetNonBendingSlope()));
640 Double_t cosThetaY = TMath::Cos(TMath::ATan(trackParam.GetBendingSlope()));
641 TMatrixD jacob(5,5);
642 jacob.Zero();
643 jacob(0,0) = 1.;
644 jacob(1,1) = cosThetaX * cosThetaX;
645 jacob(2,2) = 1.;
646 jacob(3,3) = cosThetaY * cosThetaY;
647 jacob(4,4) = 1.;
648
649 // compute covariance matrix in ESD coordinate system
650 TMatrixD tmp(trackParam.GetCovariances(),TMatrixD::kMultTranspose,jacob);
651 esdTrack.SetCovariances(TMatrixD(jacob,TMatrixD::kMult,tmp));
652
653}
654
655//_____________________________________________________________________________
a99c3449 656void AliMUONESDInterface::ESDToMUON(const AliESDMuonTrack& esdTrack, AliMUONTrack& track, Bool_t refit)
103e6575 657{
c59f70b9 658 /// Transfert data from ESDMuon track to MUON track.
a99c3449 659 /// If refit = kTRUE, the track parameters at each cluster are obtained by refitting the track
c59f70b9 660 /// or by extrapolating the parameters at the first one if the refit failed.
a99c3449 661 /// If refit = kFALSE, only the track parameters at first cluster are valid.
c59f70b9 662 /// note: You can set the recoParam used to refit the MUON track with ResetTracker(...);
663 /// By default we use Kalman filter + Smoother
103e6575 664
b1fea02e 665 // if the ESDMuon track is a ghost then return an empty MUON track
666 if (!esdTrack.ContainTrackerData()) {
667 track.Reset();
668 track.SetUniqueID(esdTrack.GetUniqueID());
669 return;
670 }
671
103e6575 672 track.Clear("C");
673
674 // global info
675 track.SetUniqueID(esdTrack.GetUniqueID());
676 track.FitWithVertex(kFALSE);
677 track.FitWithMCS(kFALSE);
678 track.SetImproved(kFALSE);
679 track.SetVertexErrXY2(0.,0.);
680 track.SetGlobalChi2(esdTrack.GetChi2());
681 track.SetMatchTrigger(esdTrack.GetMatchTrigger());
103e6575 682 track.SetChi2MatchTrigger(esdTrack.GetChi2MatchTrigger());
103e6575 683 track.SetHitsPatternInTrigCh(esdTrack.GetHitsPatternInTrigCh());
684 track.SetLocalTrigger(esdTrack.LoCircuit(), esdTrack.LoStripX(), esdTrack.LoStripY(),
00d46f24 685 esdTrack.LoDev(), esdTrack.LoLpt(), esdTrack.LoHpt(),
686 esdTrack.GetTriggerWithoutChamber());
5c15a68b 687 track.Connected(esdTrack.IsConnected());
103e6575 688
689 // track parameters at vertex
690 AliMUONTrackParam paramAtVertex;
691 GetParamAtVertex(esdTrack, paramAtVertex);
692 track.SetTrackParamAtVertex(&paramAtVertex);
693
694 // track parameters at first cluster
695 AliMUONTrackParam param;
696 GetParamAtFirstCluster(esdTrack, param);
697 GetParamCov(esdTrack, param);
698
699 // create empty cluster
700 AliMUONVClusterStore* cStore = NewClusterStore();
701 if (!cStore) return;
702 AliMUONVCluster* cluster = cStore->CreateCluster(0,0,0);
703
704 // fill TrackParamAtCluster with track parameters at each cluster if available
705 // or with only track parameters at first (fake) cluster if not
706 if(esdTrack.ClustersStored()) {
707
708 // loop over ESD clusters
709 AliESDMuonCluster *esdCluster = (AliESDMuonCluster*) esdTrack.GetClusters().First();
710 while (esdCluster) {
711
712 // copy cluster information
713 ESDToMUON(*esdCluster, *cluster);
714
715 // only set the Z parameter to avoid error in the AddTrackParamAtCluster(...) method
716 param.SetZ(cluster->GetZ());
717
718 // add common track parameters at current cluster
719 track.AddTrackParamAtCluster(param, *cluster, kTRUE);
720
721 esdCluster = (AliESDMuonCluster*) esdTrack.GetClusters().After(esdCluster);
722 }
723
b1fea02e 724 // refit the track to get better parameters and covariances at each cluster (temporary disable track improvement)
a99c3449 725 if (refit) {
726
727 AliMUONTrackParam *firstTrackParam = (AliMUONTrackParam*) track.GetTrackParamAtCluster()->First();
728 AliMUONTrackParam paramSave(*firstTrackParam);
729
730 if (!fgTracker) ResetTracker();
731
732 if (!fgTracker->RefitTrack(track, kFALSE) && track.GetGlobalChi2() < AliMUONTrack::MaxChi2()) {
733 *firstTrackParam = paramSave;
734 track.UpdateCovTrackParamAtCluster();
735 }
736
737 }
103e6575 738
739 } else {
740
c59f70b9 741 // get number of the first hit chamber according to the MUONClusterMap
103e6575 742 Int_t firstCh = 0;
c59f70b9 743 while (firstCh < 10 && !esdTrack.IsInMuonClusterMap(firstCh)) firstCh++;
103e6575 744
745 // produce fake cluster at this chamber
746 cluster->SetUniqueID(AliMUONVCluster::BuildUniqueID(firstCh, 0, 0));
747 cluster->SetXYZ(param.GetNonBendingCoor(), param.GetBendingCoor(), param.GetZ());
748 cluster->SetErrXY(0., 0.);
749
750 // add track parameters at first (fake) cluster
751 track.AddTrackParamAtCluster(param, *cluster, kTRUE);
752
753 }
754
2e2d0c44 755 // set the MC label from ESD track
756 track.SetMCLabel(esdTrack.GetLabel());
757
103e6575 758 delete cluster;
759 delete cStore;
760
761}
762
763//_____________________________________________________________________________
b1fea02e 764void AliMUONESDInterface::ESDToMUON(const AliESDMuonTrack& esdTrack, AliMUONLocalTrigger& locTrg)
765{
766 /// Transfert trigger data from ESDMuon track to the MUONLocalTtrigger object
767
768 // if the ESDMuon track is a ghost then return an empty MUON track
769 if (!esdTrack.ContainTriggerData()) {
770 AliMUONLocalTrigger emptyLocTrg;
771 locTrg = emptyLocTrg;
772 return;
773 }
774
775 locTrg.SetLoCircuit(esdTrack.LoCircuit());
776 locTrg.SetLoStripX(esdTrack.LoStripX());
777 locTrg.SetLoStripY(esdTrack.LoStripY());
5a240757 778 locTrg.SetDeviation(esdTrack.LoDev());
b1fea02e 779 locTrg.SetLoLpt(esdTrack.LoLpt());
780 locTrg.SetLoHpt(esdTrack.LoHpt());
00d46f24 781 locTrg.SetTriggerWithoutChamber(esdTrack.GetTriggerWithoutChamber());
b1fea02e 782 locTrg.SetLoTrigY(1);
783 locTrg.SetX1Pattern(esdTrack.GetTriggerX1Pattern());
784 locTrg.SetX2Pattern(esdTrack.GetTriggerX2Pattern());
785 locTrg.SetX3Pattern(esdTrack.GetTriggerX3Pattern());
786 locTrg.SetX4Pattern(esdTrack.GetTriggerX4Pattern());
787 locTrg.SetY1Pattern(esdTrack.GetTriggerY1Pattern());
788 locTrg.SetY2Pattern(esdTrack.GetTriggerY2Pattern());
789 locTrg.SetY3Pattern(esdTrack.GetTriggerY3Pattern());
790 locTrg.SetY4Pattern(esdTrack.GetTriggerY4Pattern());
791
792}
793
794//_____________________________________________________________________________
103e6575 795void AliMUONESDInterface::ESDToMUON(const AliESDMuonCluster& esdCluster, AliMUONVCluster& cluster)
796{
797 /// Transfert data from ESDMuon cluster to MUON cluster
798
799 cluster.Clear("C");
800
801 cluster.SetUniqueID(esdCluster.GetUniqueID());
802 cluster.SetXYZ(esdCluster.GetX(), esdCluster.GetY(), esdCluster.GetZ());
803 cluster.SetErrXY(esdCluster.GetErrX(),esdCluster.GetErrY());
804 cluster.SetCharge(esdCluster.GetCharge());
805 cluster.SetChi2(esdCluster.GetChi2());
2e2d0c44 806 cluster.SetMCLabel(esdCluster.GetLabel());
103e6575 807
808 if (esdCluster.PadsStored()) {
809 Int_t nPads = esdCluster.GetNPads();
810 for (Int_t iPad = 0; iPad < nPads; iPad++)
811 cluster.AddDigitId(((AliESDMuonPad*)esdCluster.GetPads().UncheckedAt(iPad))->GetUniqueID());
812 }
813
814}
815
816//___________________________________________________________________________
817void AliMUONESDInterface::ESDToMUON(const AliESDMuonPad& esdPad, AliMUONVDigit& digit)
818{
819 /// Transfert data from ESDMuon pad to MUON digit
820
a99c3449 821 if (!AliMpSegmentation::Instance(kFALSE)) {
822 cout<<"E-AliMUONESDInterface::ESDToMUON: need mapping segmentation to convert ESD pad to MUON digit"<<endl;
823 return;
824 }
825
103e6575 826 const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(esdPad.GetDetElemId(), esdPad.GetManuId());
168e9c4d 827 AliMpPad pad = seg->PadByLocation(esdPad.GetManuId(), esdPad.GetManuChannel(), kFALSE);
103e6575 828
b1fea02e 829 digit.Saturated(esdPad.IsSaturated());
103e6575 830 digit.Used(kFALSE);
b1fea02e 831 digit.Calibrated(esdPad.IsCalibrated());
103e6575 832 digit.SetUniqueID(esdPad.GetUniqueID());
833 digit.SetCharge(esdPad.GetCharge());
834 digit.SetADC(esdPad.GetADC());
168e9c4d 835 digit.SetPadXY(pad.GetIx(), pad.GetIy());
103e6575 836
837}
838
839//_____________________________________________________________________________
b1fea02e 840void AliMUONESDInterface::MUONToESD(const AliMUONTrack& track, AliESDMuonTrack& esdTrack, const Double_t vertex[3],
841 const AliMUONVDigitStore* digits, const AliMUONLocalTrigger* locTrg)
103e6575 842{
843 /// Transfert data from MUON track to ESDMuon track
844 /// Incorporate the ESDPads if the digits are provided
b1fea02e 845 /// Add trigger info if the MUON track is matched with a trigger track
846
847 // empty MUON track -> produce a ghost ESDMuon track if trigger info are available otherwise produce an empty track
848 if (track.GetNClusters() == 0) {
67c201be 849 if (locTrg) MUONToESD(*locTrg, esdTrack, track.GetUniqueID());
b1fea02e 850 else {
851 cout<<"W-AliMUONESDInterface::MUONToESD: will produce an empty ESDMuon track"<<endl;
852 esdTrack.Reset();
853 esdTrack.SetUniqueID(0xFFFFFFFF);
854 }
855 return;
856 }
103e6575 857
858 esdTrack.Clear("C");
859
b1fea02e 860 // set global info
861 esdTrack.SetUniqueID(track.GetUniqueID());
862 esdTrack.SetChi2(track.GetGlobalChi2());
863 esdTrack.SetNHit(track.GetNClusters());
2e2d0c44 864 esdTrack.SetLabel(track.GetMCLabel());
b1fea02e 865
103e6575 866 // set param at first cluster
867 AliMUONTrackParam* trackParam = static_cast<AliMUONTrackParam*>((track.GetTrackParamAtCluster())->First());
868 SetParamAtFirstCluster(*trackParam, esdTrack);
869 SetParamCov(*trackParam, esdTrack);
870
f43586f0 871 // set transverse position at the end of the absorber
872 AliMUONTrackParam trackParamAtAbsEnd(*trackParam);
873 AliMUONTrackExtrap::ExtrapToZ(&trackParamAtAbsEnd, AliMUONConstants::AbsZEnd());
874 Double_t xAbs = trackParamAtAbsEnd.GetNonBendingCoor();
875 Double_t yAbs = trackParamAtAbsEnd.GetBendingCoor();
876 esdTrack.SetRAtAbsorberEnd(TMath::Sqrt(xAbs*xAbs + yAbs*yAbs));
877
103e6575 878 // set param at vertex
879 AliMUONTrackParam trackParamAtVtx(*trackParam);
880 AliMUONTrackExtrap::ExtrapToVertex(&trackParamAtVtx, vertex[0], vertex[1], vertex[2], 0., 0.);
881 SetParamAtVertex(trackParamAtVtx, esdTrack);
882
883 // set param at Distance of Closest Approach
884 AliMUONTrackParam trackParamAtDCA(*trackParam);
885 AliMUONTrackExtrap::ExtrapToVertexWithoutBranson(&trackParamAtDCA, vertex[2]);
886 SetParamAtDCA(trackParamAtDCA, esdTrack);
887
103e6575 888 // set muon cluster info
889 AliESDMuonCluster esdCluster;
890 esdTrack.SetMuonClusterMap(0);
891 while (trackParam) {
892 MUONToESD(*(trackParam->GetClusterPtr()), esdCluster, digits);
893 esdTrack.AddCluster(esdCluster);
894 esdTrack.AddInMuonClusterMap(esdCluster.GetChamberId());
895 trackParam = static_cast<AliMUONTrackParam*>(track.GetTrackParamAtCluster()->After(trackParam));
896 }
897
5c15a68b 898 // set connected flag
899 esdTrack.Connected(track.IsConnected());
900
b1fea02e 901 // set trigger info
902 esdTrack.SetLocalTrigger(track.GetLocalTrigger());
903 esdTrack.SetChi2MatchTrigger(track.GetChi2MatchTrigger());
904 esdTrack.SetHitsPatternInTrigCh(track.GetHitsPatternInTrigCh());
905 if (locTrg) {
906 esdTrack.SetTriggerX1Pattern(locTrg->GetX1Pattern());
907 esdTrack.SetTriggerY1Pattern(locTrg->GetY1Pattern());
908 esdTrack.SetTriggerX2Pattern(locTrg->GetX2Pattern());
909 esdTrack.SetTriggerY2Pattern(locTrg->GetY2Pattern());
910 esdTrack.SetTriggerX3Pattern(locTrg->GetX3Pattern());
911 esdTrack.SetTriggerY3Pattern(locTrg->GetY3Pattern());
912 esdTrack.SetTriggerX4Pattern(locTrg->GetX4Pattern());
913 esdTrack.SetTriggerY4Pattern(locTrg->GetY4Pattern());
914 } else {
915 esdTrack.SetTriggerX1Pattern(0);
916 esdTrack.SetTriggerY1Pattern(0);
917 esdTrack.SetTriggerX2Pattern(0);
918 esdTrack.SetTriggerY2Pattern(0);
919 esdTrack.SetTriggerX3Pattern(0);
920 esdTrack.SetTriggerY3Pattern(0);
921 esdTrack.SetTriggerX4Pattern(0);
922 esdTrack.SetTriggerY4Pattern(0);
923 }
924
925}
926
927//_____________________________________________________________________________
67c201be 928void AliMUONESDInterface::MUONToESD(const AliMUONLocalTrigger& locTrg, AliESDMuonTrack& esdTrack,
929 UInt_t trackId, const AliMUONTriggerTrack* triggerTrack)
b1fea02e 930{
931 /// Build ghost ESDMuon track containing only informations about trigger track
932
933 esdTrack.Reset();
934 esdTrack.SetUniqueID(trackId);
935
936 // set trigger info
937 AliMUONTrack muonTrack;
938 muonTrack.SetLocalTrigger(locTrg.LoCircuit(),
939 locTrg.LoStripX(),
940 locTrg.LoStripY(),
98606cfc 941 locTrg.GetDeviation(),
b1fea02e 942 locTrg.LoLpt(),
00d46f24 943 locTrg.LoHpt(),
944 locTrg.GetTriggerWithoutChamber());
b1fea02e 945 esdTrack.SetLocalTrigger(muonTrack.GetLocalTrigger());
946 esdTrack.SetChi2MatchTrigger(0.);
b1fea02e 947 esdTrack.SetTriggerX1Pattern(locTrg.GetX1Pattern());
948 esdTrack.SetTriggerY1Pattern(locTrg.GetY1Pattern());
949 esdTrack.SetTriggerX2Pattern(locTrg.GetX2Pattern());
950 esdTrack.SetTriggerY2Pattern(locTrg.GetY2Pattern());
951 esdTrack.SetTriggerX3Pattern(locTrg.GetX3Pattern());
952 esdTrack.SetTriggerY3Pattern(locTrg.GetY3Pattern());
953 esdTrack.SetTriggerX4Pattern(locTrg.GetX4Pattern());
954 esdTrack.SetTriggerY4Pattern(locTrg.GetY4Pattern());
67c201be 955 UShort_t hitPattern = 0;
956 if(triggerTrack){
957 hitPattern = triggerTrack->GetHitsPatternInTrigCh();
958 esdTrack.SetHitsPatternInTrigCh(hitPattern);
959 esdTrack.SetThetaXUncorrected(triggerTrack->GetThetax());
960 esdTrack.SetThetaYUncorrected(triggerTrack->GetThetay());
961 esdTrack.SetNonBendingCoorUncorrected(triggerTrack->GetX11());
962 esdTrack.SetBendingCoorUncorrected(triggerTrack->GetY11());
bdfb6eef 963 esdTrack.SetZUncorrected(triggerTrack->GetZ11());
67c201be 964 }
103e6575 965}
966
967//_____________________________________________________________________________
968void AliMUONESDInterface::MUONToESD(const AliMUONVCluster& cluster, AliESDMuonCluster& esdCluster, const AliMUONVDigitStore* digits)
969{
970 /// Transfert data from MUON cluster to ESDMuon cluster
971 /// Incorporate the ESDPads if the digits are provided
972
973 esdCluster.Clear("C");
974
975 esdCluster.SetUniqueID(cluster.GetUniqueID());
976 esdCluster.SetXYZ(cluster.GetX(), cluster.GetY(), cluster.GetZ());
977 esdCluster.SetErrXY(cluster.GetErrX(), cluster.GetErrY());
630711ed 978 esdCluster.SetCharge(cluster.GetCharge());
979 esdCluster.SetChi2(cluster.GetChi2());
2e2d0c44 980 esdCluster.SetLabel(cluster.GetMCLabel());
103e6575 981
630711ed 982 if (digits) { // transfert all data if required
103e6575 983
103e6575 984 AliESDMuonPad esdPad;
985 for (Int_t i=0; i<cluster.GetNDigits(); i++) {
986 AliMUONVDigit* digit = digits->FindObject(cluster.GetDigitId(i));
987 if (!digit) {
988 cout<<"E-AliMUONESDInterface::MUONToESD: digit "<<cluster.GetDigitId(i)<<" not found"<<endl;
989 continue;
990 }
991 MUONToESD(*digit, esdPad);
992 esdCluster.AddPad(esdPad);
993 }
994
103e6575 995 }
996
997}
998
999//_____________________________________________________________________________
1000void AliMUONESDInterface::MUONToESD(const AliMUONVDigit& digit, AliESDMuonPad& esdPad)
1001{
1002 /// Transfert data from MUON digit to ESDMuon pad
1003 esdPad.SetUniqueID(digit.GetUniqueID());
1004 esdPad.SetADC(digit.ADC());
1005 esdPad.SetCharge(digit.Charge());
b1fea02e 1006 esdPad.SetCalibrated(digit.IsCalibrated());
1007 esdPad.SetSaturated(digit.IsSaturated());
103e6575 1008}
1009
1010//___________________________________________________________________________
a99c3449 1011AliMUONTrack* AliMUONESDInterface::Add(const AliESDMuonTrack& esdTrack, AliMUONVTrackStore& trackStore, Bool_t refit)
103e6575 1012{
1013 /// Create MUON track from ESDMuon track and add it to the store
a99c3449 1014 /// Track parameters at each clusters are recomputed or not depending on the flag "refit"
b1fea02e 1015 /// return a pointer to the track into the store (0x0 if the track already exist)
1016 if(trackStore.FindObject(esdTrack.GetUniqueID())) return 0x0;
103e6575 1017 AliMUONTrack* track = trackStore.Add(AliMUONTrack());
a99c3449 1018 ESDToMUON(esdTrack, *track, refit);
103e6575 1019 return track;
1020}
1021
1022//___________________________________________________________________________
b1fea02e 1023void AliMUONESDInterface::Add(const AliESDMuonTrack& esdTrack, AliMUONVTriggerStore& triggerStore)
1024{
1025 /// Create MUON local trigger from ESDMuon track and add it to the store if not already there
81d71c13 1026 if (!triggerStore.FindLocal(esdTrack.LoCircuit())->IsNull()) return;
b1fea02e 1027 AliMUONLocalTrigger locTrg;
1028 ESDToMUON(esdTrack, locTrg);
1029 triggerStore.Add(locTrg);
1030}
1031
1032//___________________________________________________________________________
103e6575 1033AliMUONVCluster* AliMUONESDInterface::Add(const AliESDMuonCluster& esdCluster, AliMUONVClusterStore& clusterStore)
1034{
1035 /// Create MUON cluster from ESDMuon cluster and add it to the store
1036 /// return a pointer to the cluster into the store (0x0 if the cluster already exist)
1037 AliMUONVCluster* cluster = clusterStore.Add(esdCluster.GetChamberId(), esdCluster.GetDetElemId(), esdCluster.GetClusterIndex());
1038 if (cluster) ESDToMUON(esdCluster, *cluster);
1039 return cluster;
1040}
1041
1042//___________________________________________________________________________
1043AliMUONVDigit* AliMUONESDInterface::Add(const AliESDMuonPad& esdPad, AliMUONVDigitStore& digitStore)
1044{
1045 /// Create MUON digit from ESDMuon digit and add it to the store
1046 /// return a pointer to the digit into the store (0x0 if the digit already exist)
1047 AliMUONVDigit* digit = digitStore.Add(esdPad.GetDetElemId(), esdPad.GetManuId(), esdPad.GetManuChannel(), esdPad.GetCathode(), AliMUONVDigitStore::kDeny);
1048 if (digit) ESDToMUON(esdPad, *digit);
1049 return digit;
1050}
1051