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