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