]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONESDInterface.cxx
Bug fix for loading the LUT for chambers 1 to 6. (Indra)
[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
b1fea02e 279//___________________________________________________________________________
280Int_t AliMUONESDInterface::GetNTriggers() const
281{
282 /// return the number of triggers
283 return fTriggers ? fTriggers->GetSize() : 0;
284}
285
103e6575 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
103e6575 295//___________________________________________________________________________
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
b1fea02e 337//___________________________________________________________________________
338AliMUONLocalTrigger* AliMUONESDInterface::FindLocalTrigger(Int_t boardNumber) const
339{
340 /// return MUON local trigger "boardNumber"
341 return (fTriggers) ? fTriggers->FindLocal(boardNumber) : 0x0;
342}
343
103e6575 344//___________________________________________________________________________
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
b1fea02e 412//___________________________________________________________________________
413TIterator* AliMUONESDInterface::CreateLocalTriggerIterator() const
414{
415 /// return iterator over all local trigger
416 return fTriggers ? fTriggers->CreateLocalIterator() : 0x0;
417}
418
103e6575 419//___________________________________________________________________________
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
ad3c6eda 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
103e6575 478//_____________________________________________________________________________
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());
103e6575 687
688 // track parameters at vertex
689 AliMUONTrackParam paramAtVertex;
690 GetParamAtVertex(esdTrack, paramAtVertex);
691 track.SetTrackParamAtVertex(&paramAtVertex);
692
693 // track parameters at first cluster
694 AliMUONTrackParam param;
695 GetParamAtFirstCluster(esdTrack, param);
696 GetParamCov(esdTrack, param);
697
698 // create empty cluster
699 AliMUONVClusterStore* cStore = NewClusterStore();
700 if (!cStore) return;
701 AliMUONVCluster* cluster = cStore->CreateCluster(0,0,0);
702
703 // fill TrackParamAtCluster with track parameters at each cluster if available
704 // or with only track parameters at first (fake) cluster if not
705 if(esdTrack.ClustersStored()) {
706
707 // loop over ESD clusters
708 AliESDMuonCluster *esdCluster = (AliESDMuonCluster*) esdTrack.GetClusters().First();
709 while (esdCluster) {
710
711 // copy cluster information
712 ESDToMUON(*esdCluster, *cluster);
713
714 // only set the Z parameter to avoid error in the AddTrackParamAtCluster(...) method
715 param.SetZ(cluster->GetZ());
716
717 // add common track parameters at current cluster
718 track.AddTrackParamAtCluster(param, *cluster, kTRUE);
719
720 esdCluster = (AliESDMuonCluster*) esdTrack.GetClusters().After(esdCluster);
721 }
722
b1fea02e 723 // refit the track to get better parameters and covariances at each cluster (temporary disable track improvement)
a99c3449 724 if (refit) {
725
726 AliMUONTrackParam *firstTrackParam = (AliMUONTrackParam*) track.GetTrackParamAtCluster()->First();
727 AliMUONTrackParam paramSave(*firstTrackParam);
728
729 if (!fgTracker) ResetTracker();
730
731 if (!fgTracker->RefitTrack(track, kFALSE) && track.GetGlobalChi2() < AliMUONTrack::MaxChi2()) {
732 *firstTrackParam = paramSave;
733 track.UpdateCovTrackParamAtCluster();
734 }
735
736 }
103e6575 737
738 } else {
739
c59f70b9 740 // get number of the first hit chamber according to the MUONClusterMap
103e6575 741 Int_t firstCh = 0;
c59f70b9 742 while (firstCh < 10 && !esdTrack.IsInMuonClusterMap(firstCh)) firstCh++;
103e6575 743
744 // produce fake cluster at this chamber
745 cluster->SetUniqueID(AliMUONVCluster::BuildUniqueID(firstCh, 0, 0));
746 cluster->SetXYZ(param.GetNonBendingCoor(), param.GetBendingCoor(), param.GetZ());
747 cluster->SetErrXY(0., 0.);
748
749 // add track parameters at first (fake) cluster
750 track.AddTrackParamAtCluster(param, *cluster, kTRUE);
751
752 }
753
2e2d0c44 754 // set the MC label from ESD track
755 track.SetMCLabel(esdTrack.GetLabel());
756
103e6575 757 delete cluster;
758 delete cStore;
759
760}
761
b1fea02e 762//_____________________________________________________________________________
763void AliMUONESDInterface::ESDToMUON(const AliESDMuonTrack& esdTrack, AliMUONLocalTrigger& locTrg)
764{
765 /// Transfert trigger data from ESDMuon track to the MUONLocalTtrigger object
766
767 // if the ESDMuon track is a ghost then return an empty MUON track
768 if (!esdTrack.ContainTriggerData()) {
769 AliMUONLocalTrigger emptyLocTrg;
770 locTrg = emptyLocTrg;
771 return;
772 }
773
774 locTrg.SetLoCircuit(esdTrack.LoCircuit());
775 locTrg.SetLoStripX(esdTrack.LoStripX());
776 locTrg.SetLoStripY(esdTrack.LoStripY());
5a240757 777 locTrg.SetDeviation(esdTrack.LoDev());
b1fea02e 778 locTrg.SetLoLpt(esdTrack.LoLpt());
779 locTrg.SetLoHpt(esdTrack.LoHpt());
00d46f24 780 locTrg.SetTriggerWithoutChamber(esdTrack.GetTriggerWithoutChamber());
b1fea02e 781 locTrg.SetLoTrigY(1);
782 locTrg.SetX1Pattern(esdTrack.GetTriggerX1Pattern());
783 locTrg.SetX2Pattern(esdTrack.GetTriggerX2Pattern());
784 locTrg.SetX3Pattern(esdTrack.GetTriggerX3Pattern());
785 locTrg.SetX4Pattern(esdTrack.GetTriggerX4Pattern());
786 locTrg.SetY1Pattern(esdTrack.GetTriggerY1Pattern());
787 locTrg.SetY2Pattern(esdTrack.GetTriggerY2Pattern());
788 locTrg.SetY3Pattern(esdTrack.GetTriggerY3Pattern());
789 locTrg.SetY4Pattern(esdTrack.GetTriggerY4Pattern());
790
791}
792
103e6575 793//_____________________________________________________________________________
794void AliMUONESDInterface::ESDToMUON(const AliESDMuonCluster& esdCluster, AliMUONVCluster& cluster)
795{
796 /// Transfert data from ESDMuon cluster to MUON cluster
797
798 cluster.Clear("C");
799
800 cluster.SetUniqueID(esdCluster.GetUniqueID());
801 cluster.SetXYZ(esdCluster.GetX(), esdCluster.GetY(), esdCluster.GetZ());
802 cluster.SetErrXY(esdCluster.GetErrX(),esdCluster.GetErrY());
803 cluster.SetCharge(esdCluster.GetCharge());
804 cluster.SetChi2(esdCluster.GetChi2());
2e2d0c44 805 cluster.SetMCLabel(esdCluster.GetLabel());
103e6575 806
807 if (esdCluster.PadsStored()) {
808 Int_t nPads = esdCluster.GetNPads();
809 for (Int_t iPad = 0; iPad < nPads; iPad++)
810 cluster.AddDigitId(((AliESDMuonPad*)esdCluster.GetPads().UncheckedAt(iPad))->GetUniqueID());
811 }
812
813}
814
815//___________________________________________________________________________
816void AliMUONESDInterface::ESDToMUON(const AliESDMuonPad& esdPad, AliMUONVDigit& digit)
817{
818 /// Transfert data from ESDMuon pad to MUON digit
819
a99c3449 820 if (!AliMpSegmentation::Instance(kFALSE)) {
821 cout<<"E-AliMUONESDInterface::ESDToMUON: need mapping segmentation to convert ESD pad to MUON digit"<<endl;
822 return;
823 }
824
103e6575 825 const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(esdPad.GetDetElemId(), esdPad.GetManuId());
168e9c4d 826 AliMpPad pad = seg->PadByLocation(esdPad.GetManuId(), esdPad.GetManuChannel(), kFALSE);
103e6575 827
b1fea02e 828 digit.Saturated(esdPad.IsSaturated());
103e6575 829 digit.Used(kFALSE);
b1fea02e 830 digit.Calibrated(esdPad.IsCalibrated());
103e6575 831 digit.SetUniqueID(esdPad.GetUniqueID());
832 digit.SetCharge(esdPad.GetCharge());
833 digit.SetADC(esdPad.GetADC());
168e9c4d 834 digit.SetPadXY(pad.GetIx(), pad.GetIy());
103e6575 835
836}
837
838//_____________________________________________________________________________
b1fea02e 839void AliMUONESDInterface::MUONToESD(const AliMUONTrack& track, AliESDMuonTrack& esdTrack, const Double_t vertex[3],
840 const AliMUONVDigitStore* digits, const AliMUONLocalTrigger* locTrg)
103e6575 841{
842 /// Transfert data from MUON track to ESDMuon track
843 /// Incorporate the ESDPads if the digits are provided
b1fea02e 844 /// Add trigger info if the MUON track is matched with a trigger track
845
846 // empty MUON track -> produce a ghost ESDMuon track if trigger info are available otherwise produce an empty track
847 if (track.GetNClusters() == 0) {
67c201be 848 if (locTrg) MUONToESD(*locTrg, esdTrack, track.GetUniqueID());
b1fea02e 849 else {
850 cout<<"W-AliMUONESDInterface::MUONToESD: will produce an empty ESDMuon track"<<endl;
851 esdTrack.Reset();
852 esdTrack.SetUniqueID(0xFFFFFFFF);
853 }
854 return;
855 }
103e6575 856
857 esdTrack.Clear("C");
858
b1fea02e 859 // set global info
860 esdTrack.SetUniqueID(track.GetUniqueID());
861 esdTrack.SetChi2(track.GetGlobalChi2());
862 esdTrack.SetNHit(track.GetNClusters());
2e2d0c44 863 esdTrack.SetLabel(track.GetMCLabel());
b1fea02e 864
103e6575 865 // set param at first cluster
866 AliMUONTrackParam* trackParam = static_cast<AliMUONTrackParam*>((track.GetTrackParamAtCluster())->First());
867 SetParamAtFirstCluster(*trackParam, esdTrack);
868 SetParamCov(*trackParam, esdTrack);
869
870 // set param at vertex
871 AliMUONTrackParam trackParamAtVtx(*trackParam);
872 AliMUONTrackExtrap::ExtrapToVertex(&trackParamAtVtx, vertex[0], vertex[1], vertex[2], 0., 0.);
873 SetParamAtVertex(trackParamAtVtx, esdTrack);
874
875 // set param at Distance of Closest Approach
876 AliMUONTrackParam trackParamAtDCA(*trackParam);
877 AliMUONTrackExtrap::ExtrapToVertexWithoutBranson(&trackParamAtDCA, vertex[2]);
878 SetParamAtDCA(trackParamAtDCA, esdTrack);
879
103e6575 880 // set muon cluster info
881 AliESDMuonCluster esdCluster;
882 esdTrack.SetMuonClusterMap(0);
883 while (trackParam) {
884 MUONToESD(*(trackParam->GetClusterPtr()), esdCluster, digits);
885 esdTrack.AddCluster(esdCluster);
886 esdTrack.AddInMuonClusterMap(esdCluster.GetChamberId());
887 trackParam = static_cast<AliMUONTrackParam*>(track.GetTrackParamAtCluster()->After(trackParam));
888 }
889
b1fea02e 890 // set trigger info
891 esdTrack.SetLocalTrigger(track.GetLocalTrigger());
892 esdTrack.SetChi2MatchTrigger(track.GetChi2MatchTrigger());
893 esdTrack.SetHitsPatternInTrigCh(track.GetHitsPatternInTrigCh());
894 if (locTrg) {
895 esdTrack.SetTriggerX1Pattern(locTrg->GetX1Pattern());
896 esdTrack.SetTriggerY1Pattern(locTrg->GetY1Pattern());
897 esdTrack.SetTriggerX2Pattern(locTrg->GetX2Pattern());
898 esdTrack.SetTriggerY2Pattern(locTrg->GetY2Pattern());
899 esdTrack.SetTriggerX3Pattern(locTrg->GetX3Pattern());
900 esdTrack.SetTriggerY3Pattern(locTrg->GetY3Pattern());
901 esdTrack.SetTriggerX4Pattern(locTrg->GetX4Pattern());
902 esdTrack.SetTriggerY4Pattern(locTrg->GetY4Pattern());
903 } else {
904 esdTrack.SetTriggerX1Pattern(0);
905 esdTrack.SetTriggerY1Pattern(0);
906 esdTrack.SetTriggerX2Pattern(0);
907 esdTrack.SetTriggerY2Pattern(0);
908 esdTrack.SetTriggerX3Pattern(0);
909 esdTrack.SetTriggerY3Pattern(0);
910 esdTrack.SetTriggerX4Pattern(0);
911 esdTrack.SetTriggerY4Pattern(0);
912 }
913
914}
915
916//_____________________________________________________________________________
67c201be 917void AliMUONESDInterface::MUONToESD(const AliMUONLocalTrigger& locTrg, AliESDMuonTrack& esdTrack,
918 UInt_t trackId, const AliMUONTriggerTrack* triggerTrack)
b1fea02e 919{
920 /// Build ghost ESDMuon track containing only informations about trigger track
921
922 esdTrack.Reset();
923 esdTrack.SetUniqueID(trackId);
924
925 // set trigger info
926 AliMUONTrack muonTrack;
927 muonTrack.SetLocalTrigger(locTrg.LoCircuit(),
928 locTrg.LoStripX(),
929 locTrg.LoStripY(),
98606cfc 930 locTrg.GetDeviation(),
b1fea02e 931 locTrg.LoLpt(),
00d46f24 932 locTrg.LoHpt(),
933 locTrg.GetTriggerWithoutChamber());
b1fea02e 934 esdTrack.SetLocalTrigger(muonTrack.GetLocalTrigger());
935 esdTrack.SetChi2MatchTrigger(0.);
b1fea02e 936 esdTrack.SetTriggerX1Pattern(locTrg.GetX1Pattern());
937 esdTrack.SetTriggerY1Pattern(locTrg.GetY1Pattern());
938 esdTrack.SetTriggerX2Pattern(locTrg.GetX2Pattern());
939 esdTrack.SetTriggerY2Pattern(locTrg.GetY2Pattern());
940 esdTrack.SetTriggerX3Pattern(locTrg.GetX3Pattern());
941 esdTrack.SetTriggerY3Pattern(locTrg.GetY3Pattern());
942 esdTrack.SetTriggerX4Pattern(locTrg.GetX4Pattern());
943 esdTrack.SetTriggerY4Pattern(locTrg.GetY4Pattern());
67c201be 944 UShort_t hitPattern = 0;
945 if(triggerTrack){
946 hitPattern = triggerTrack->GetHitsPatternInTrigCh();
947 esdTrack.SetHitsPatternInTrigCh(hitPattern);
948 esdTrack.SetThetaXUncorrected(triggerTrack->GetThetax());
949 esdTrack.SetThetaYUncorrected(triggerTrack->GetThetay());
950 esdTrack.SetNonBendingCoorUncorrected(triggerTrack->GetX11());
951 esdTrack.SetBendingCoorUncorrected(triggerTrack->GetY11());
bdfb6eef 952 esdTrack.SetZUncorrected(triggerTrack->GetZ11());
67c201be 953 }
103e6575 954}
955
956//_____________________________________________________________________________
957void AliMUONESDInterface::MUONToESD(const AliMUONVCluster& cluster, AliESDMuonCluster& esdCluster, const AliMUONVDigitStore* digits)
958{
959 /// Transfert data from MUON cluster to ESDMuon cluster
960 /// Incorporate the ESDPads if the digits are provided
961
962 esdCluster.Clear("C");
963
964 esdCluster.SetUniqueID(cluster.GetUniqueID());
965 esdCluster.SetXYZ(cluster.GetX(), cluster.GetY(), cluster.GetZ());
966 esdCluster.SetErrXY(cluster.GetErrX(), cluster.GetErrY());
630711ed 967 esdCluster.SetCharge(cluster.GetCharge());
968 esdCluster.SetChi2(cluster.GetChi2());
2e2d0c44 969 esdCluster.SetLabel(cluster.GetMCLabel());
103e6575 970
630711ed 971 if (digits) { // transfert all data if required
103e6575 972
103e6575 973 AliESDMuonPad esdPad;
974 for (Int_t i=0; i<cluster.GetNDigits(); i++) {
975 AliMUONVDigit* digit = digits->FindObject(cluster.GetDigitId(i));
976 if (!digit) {
977 cout<<"E-AliMUONESDInterface::MUONToESD: digit "<<cluster.GetDigitId(i)<<" not found"<<endl;
978 continue;
979 }
980 MUONToESD(*digit, esdPad);
981 esdCluster.AddPad(esdPad);
982 }
983
103e6575 984 }
985
986}
987
988//_____________________________________________________________________________
989void AliMUONESDInterface::MUONToESD(const AliMUONVDigit& digit, AliESDMuonPad& esdPad)
990{
991 /// Transfert data from MUON digit to ESDMuon pad
992 esdPad.SetUniqueID(digit.GetUniqueID());
993 esdPad.SetADC(digit.ADC());
994 esdPad.SetCharge(digit.Charge());
b1fea02e 995 esdPad.SetCalibrated(digit.IsCalibrated());
996 esdPad.SetSaturated(digit.IsSaturated());
103e6575 997}
998
999//___________________________________________________________________________
a99c3449 1000AliMUONTrack* AliMUONESDInterface::Add(const AliESDMuonTrack& esdTrack, AliMUONVTrackStore& trackStore, Bool_t refit)
103e6575 1001{
1002 /// Create MUON track from ESDMuon track and add it to the store
a99c3449 1003 /// Track parameters at each clusters are recomputed or not depending on the flag "refit"
b1fea02e 1004 /// return a pointer to the track into the store (0x0 if the track already exist)
1005 if(trackStore.FindObject(esdTrack.GetUniqueID())) return 0x0;
103e6575 1006 AliMUONTrack* track = trackStore.Add(AliMUONTrack());
a99c3449 1007 ESDToMUON(esdTrack, *track, refit);
103e6575 1008 return track;
1009}
1010
b1fea02e 1011//___________________________________________________________________________
1012void AliMUONESDInterface::Add(const AliESDMuonTrack& esdTrack, AliMUONVTriggerStore& triggerStore)
1013{
1014 /// Create MUON local trigger from ESDMuon track and add it to the store if not already there
81d71c13 1015 if (!triggerStore.FindLocal(esdTrack.LoCircuit())->IsNull()) return;
b1fea02e 1016 AliMUONLocalTrigger locTrg;
1017 ESDToMUON(esdTrack, locTrg);
1018 triggerStore.Add(locTrg);
1019}
1020
103e6575 1021//___________________________________________________________________________
1022AliMUONVCluster* AliMUONESDInterface::Add(const AliESDMuonCluster& esdCluster, AliMUONVClusterStore& clusterStore)
1023{
1024 /// Create MUON cluster from ESDMuon cluster and add it to the store
1025 /// return a pointer to the cluster into the store (0x0 if the cluster already exist)
1026 AliMUONVCluster* cluster = clusterStore.Add(esdCluster.GetChamberId(), esdCluster.GetDetElemId(), esdCluster.GetClusterIndex());
1027 if (cluster) ESDToMUON(esdCluster, *cluster);
1028 return cluster;
1029}
1030
1031//___________________________________________________________________________
1032AliMUONVDigit* AliMUONESDInterface::Add(const AliESDMuonPad& esdPad, AliMUONVDigitStore& digitStore)
1033{
1034 /// Create MUON digit from ESDMuon digit and add it to the store
1035 /// return a pointer to the digit into the store (0x0 if the digit already exist)
1036 AliMUONVDigit* digit = digitStore.Add(esdPad.GetDetElemId(), esdPad.GetManuId(), esdPad.GetManuChannel(), esdPad.GetCathode(), AliMUONVDigitStore::kDeny);
1037 if (digit) ESDToMUON(esdPad, *digit);
1038 return digit;
1039}
1040