]>
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 | |
d19b6003 | 18 | // ------------------------------ |
19 | // Class AliMUONTransientDigit | |
20 | // ------------------------------ | |
21 | // MUON transient digit | |
22 | // Extends AliMUONDigit with a list of contributing tracks | |
23 | ||
a9e2aefa | 24 | #include <TObjArray.h> |
30178c30 | 25 | #include <TVector.h> |
26 | ||
27 | #include "AliMUONTransientDigit.h" | |
8c343c7c | 28 | #include "AliLog.h" |
a9e2aefa | 29 | |
30 | ClassImp(AliMUONTransientDigit) | |
31 | ||
30178c30 | 32 | //____________________________________________________________________________ |
783ce8a7 | 33 | AliMUONTransientDigit::AliMUONTransientDigit() : |
b357495a | 34 | AliMUONDigit(), |
783ce8a7 | 35 | fChamber(0), |
36 | fTrackList(0) | |
30178c30 | 37 | { |
d19b6003 | 38 | /// Default constructor |
30178c30 | 39 | } |
a9e2aefa | 40 | |
41 | //____________________________________________________________________________ | |
783ce8a7 | 42 | AliMUONTransientDigit::AliMUONTransientDigit(const AliMUONTransientDigit& digit) : |
43 | AliMUONDigit(digit) | |
a9e2aefa | 44 | { |
d19b6003 | 45 | /// Protected copy constructor |
30178c30 | 46 | |
8c343c7c | 47 | AliFatal( "Not implemented."); |
a9e2aefa | 48 | } |
49 | ||
50 | ||
783ce8a7 | 51 | AliMUONTransientDigit::AliMUONTransientDigit(Int_t ich, Int_t *digits) : |
52 | AliMUONDigit(digits), | |
53 | fChamber(ich), | |
54 | fTrackList(new TObjArray(5)) | |
55 | // 5 is arbitrary number, just to decrease default 16 | |
a9e2aefa | 56 | { |
d19b6003 | 57 | /// Creates a MUON digit list object |
a9e2aefa | 58 | } |
59 | ||
4b98e7b8 | 60 | //////////////////////////////////////////////////////////////////////// |
a9e2aefa | 61 | AliMUONTransientDigit::~AliMUONTransientDigit() |
62 | { | |
d19b6003 | 63 | /// Destructor |
64 | ||
4b98e7b8 | 65 | fTrackList->Delete(); |
66 | delete fTrackList; | |
a9e2aefa | 67 | } |
68 | ||
4b98e7b8 | 69 | //////////////////////////////////////////////////////////////////////// |
30178c30 | 70 | AliMUONTransientDigit& |
71 | AliMUONTransientDigit::operator =(const AliMUONTransientDigit& rhs) | |
a9e2aefa | 72 | { |
d19b6003 | 73 | /// Protected assignement operator |
30178c30 | 74 | |
75 | if (this == &rhs) return *this; | |
76 | ||
8c343c7c | 77 | AliFatal("Not implemented."); |
30178c30 | 78 | |
79 | return *this; | |
a9e2aefa | 80 | } |
81 | ||
4b98e7b8 | 82 | //////////////////////////////////////////////////////////////////////// |
83 | void AliMUONTransientDigit::AddToTrackList(Int_t track, Int_t charge) | |
84 | { | |
3351e14b | 85 | TVector *pTrInfo = new TVector(3); |
4b98e7b8 | 86 | TVector &trInfo = *pTrInfo; |
87 | trInfo(0) = track; | |
88 | trInfo(1) = charge; | |
89 | fTrackList->Add(pTrInfo); | |
90 | } | |
91 | ||
92 | //////////////////////////////////////////////////////////////////////// | |
93 | void AliMUONTransientDigit::UpdateTrackList(Int_t track, Int_t charge) | |
94 | { | |
95 | Int_t lastEntry = fTrackList->GetLast(); | |
96 | TVector *pVect = static_cast<TVector*>(fTrackList->At(lastEntry)); | |
97 | if ( static_cast<Int_t>((*pVect)(0)) == track) { | |
98 | (*pVect)(1) += charge; // update charge | |
99 | } else { | |
100 | AddToTrackList(track,charge); | |
101 | } | |
102 | } | |
a9e2aefa | 103 | |
4b98e7b8 | 104 | //////////////////////////////////////////////////////////////////////// |
380da863 | 105 | Int_t AliMUONTransientDigit::GetTrack(Int_t i) const |
4b98e7b8 | 106 | { |
107 | if (i > fTrackList->GetEntriesFast()) return 0; | |
108 | TVector *pVect = static_cast<TVector*>(fTrackList->At(i)); | |
109 | return static_cast<Int_t>((*pVect)(0)); | |
110 | } | |
111 | ||
112 | ||
113 | //////////////////////////////////////////////////////////////////////// | |
380da863 | 114 | Int_t AliMUONTransientDigit::GetCharge(Int_t i) const |
4b98e7b8 | 115 | { |
116 | if (i > fTrackList->GetEntriesFast()) return 0; | |
117 | TVector *pVect = static_cast<TVector*>(fTrackList->At(i)); | |
118 | return static_cast<Int_t>((*pVect)(1)); | |
119 | } | |
3351e14b | 120 |