]>
Commit | Line | Data |
---|---|---|
a9e2aefa | 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 | ||
88cb7938 | 16 | /* $Id$ */ |
a9e2aefa | 17 | |
18 | #include "AliMUONTransientDigit.h" | |
19 | #include <TObjArray.h> | |
4b98e7b8 | 20 | #include "TVector.h" |
a9e2aefa | 21 | |
22 | ClassImp(AliMUONTransientDigit) | |
23 | ||
24 | ||
25 | //____________________________________________________________________________ | |
26 | ||
d9a3473d | 27 | AliMUONTransientDigit::AliMUONTransientDigit(const AliMUONTransientDigit& digit):AliMUONDigit(digit) |
a9e2aefa | 28 | { |
29 | // dummy copy constructor | |
30 | } | |
31 | ||
32 | ||
33 | AliMUONTransientDigit::AliMUONTransientDigit(Int_t ich, Int_t *digits): | |
34 | AliMUONDigit(digits) | |
35 | { | |
36 | // | |
37 | // Creates a MUON digit list object | |
38 | // | |
a9e2aefa | 39 | fChamber = ich; |
4b98e7b8 | 40 | fTrackList = new TObjArray(5); |
41 | // 5 is arbitrary number, just to decrease default 16 | |
a9e2aefa | 42 | } |
43 | ||
4b98e7b8 | 44 | //////////////////////////////////////////////////////////////////////// |
a9e2aefa | 45 | AliMUONTransientDigit::~AliMUONTransientDigit() |
46 | { | |
4b98e7b8 | 47 | fTrackList->Delete(); |
48 | delete fTrackList; | |
a9e2aefa | 49 | } |
50 | ||
4b98e7b8 | 51 | //////////////////////////////////////////////////////////////////////// |
d9a3473d | 52 | AliMUONTransientDigit& AliMUONTransientDigit::operator =(const AliMUONTransientDigit& /*rhs*/) |
a9e2aefa | 53 | { |
54 | // Dummy assignment operator | |
55 | return *this; | |
56 | } | |
57 | ||
4b98e7b8 | 58 | //////////////////////////////////////////////////////////////////////// |
59 | void AliMUONTransientDigit::AddToTrackList(Int_t track, Int_t charge) | |
60 | { | |
3351e14b | 61 | TVector *pTrInfo = new TVector(3); |
4b98e7b8 | 62 | TVector &trInfo = *pTrInfo; |
63 | trInfo(0) = track; | |
64 | trInfo(1) = charge; | |
65 | fTrackList->Add(pTrInfo); | |
66 | } | |
67 | ||
68 | //////////////////////////////////////////////////////////////////////// | |
69 | void AliMUONTransientDigit::UpdateTrackList(Int_t track, Int_t charge) | |
70 | { | |
71 | Int_t lastEntry = fTrackList->GetLast(); | |
72 | TVector *pVect = static_cast<TVector*>(fTrackList->At(lastEntry)); | |
73 | if ( static_cast<Int_t>((*pVect)(0)) == track) { | |
74 | (*pVect)(1) += charge; // update charge | |
75 | } else { | |
76 | AddToTrackList(track,charge); | |
77 | } | |
78 | } | |
a9e2aefa | 79 | |
4b98e7b8 | 80 | //////////////////////////////////////////////////////////////////////// |
380da863 | 81 | Int_t AliMUONTransientDigit::GetTrack(Int_t i) const |
4b98e7b8 | 82 | { |
83 | if (i > fTrackList->GetEntriesFast()) return 0; | |
84 | TVector *pVect = static_cast<TVector*>(fTrackList->At(i)); | |
85 | return static_cast<Int_t>((*pVect)(0)); | |
86 | } | |
87 | ||
88 | ||
89 | //////////////////////////////////////////////////////////////////////// | |
380da863 | 90 | Int_t AliMUONTransientDigit::GetCharge(Int_t i) const |
4b98e7b8 | 91 | { |
92 | if (i > fTrackList->GetEntriesFast()) return 0; | |
93 | TVector *pVect = static_cast<TVector*>(fTrackList->At(i)); | |
94 | return static_cast<Int_t>((*pVect)(1)); | |
95 | } | |
3351e14b | 96 |