1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 // ------------------------------
19 // Class AliMUONTransientDigit
20 // ------------------------------
21 // MUON transient digit
22 // Extends AliMUONDigit with a list of contributing tracks
24 #include <TObjArray.h>
27 #include "AliMUONTransientDigit.h"
31 ClassImp(AliMUONTransientDigit)
34 //____________________________________________________________________________
35 AliMUONTransientDigit::AliMUONTransientDigit() :
40 /// Default constructor
43 AliMUONTransientDigit::AliMUONTransientDigit(Int_t ich, Int_t *digits) :
46 fTrackList(new TObjArray(5))
47 // 5 is arbitrary number, just to decrease default 16
49 /// Creates a MUON digit list object
52 ////////////////////////////////////////////////////////////////////////
53 AliMUONTransientDigit::~AliMUONTransientDigit()
61 ////////////////////////////////////////////////////////////////////////
62 void AliMUONTransientDigit::AddToTrackList(Int_t track, Int_t charge)
64 /// Add track to the track list
66 TVector *pTrInfo = new TVector(3);
67 TVector &trInfo = *pTrInfo;
70 fTrackList->Add(pTrInfo);
73 ////////////////////////////////////////////////////////////////////////
74 void AliMUONTransientDigit::UpdateTrackList(Int_t track, Int_t charge)
76 /// Update track charge if track already in the track list,
77 /// or add the track to the list
79 Int_t lastEntry = fTrackList->GetLast();
80 TVector *pVect = static_cast<TVector*>(fTrackList->At(lastEntry));
81 if ( static_cast<Int_t>((*pVect)(0)) == track) {
82 (*pVect)(1) += charge; // update charge
84 AddToTrackList(track,charge);
88 ////////////////////////////////////////////////////////////////////////
89 Int_t AliMUONTransientDigit::GetTrack(Int_t i) const
91 /// Return \a i th track from the list
93 if (i > fTrackList->GetEntriesFast()) return 0;
94 TVector *pVect = static_cast<TVector*>(fTrackList->At(i));
95 return static_cast<Int_t>((*pVect)(0));
99 ////////////////////////////////////////////////////////////////////////
100 Int_t AliMUONTransientDigit::GetCharge(Int_t i) const
102 /// Return the charge of \a i th track in the list
104 if (i > fTrackList->GetEntriesFast()) return 0;
105 TVector *pVect = static_cast<TVector*>(fTrackList->At(i));
106 return static_cast<Int_t>((*pVect)(1));