]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONTransientDigit.cxx
1ae3889d8c4c2bd145e052d4331148528cd9236b
[u/mrichter/AliRoot.git] / MUON / AliMUONTransientDigit.cxx
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 <TObjArray.h>
19 #include <TVector.h>
20
21 #include "AliMUONTransientDigit.h"
22 #include "AliLog.h"
23
24 ClassImp(AliMUONTransientDigit)
25
26 //____________________________________________________________________________
27 AliMUONTransientDigit::AliMUONTransientDigit() :
28   fChamber(0),
29   fTrackList(0)
30 {
31   // Default constructor
32 }
33  
34 //____________________________________________________________________________
35 AliMUONTransientDigit::AliMUONTransientDigit(const AliMUONTransientDigit& digit) :
36   AliMUONDigit(digit)
37 {
38 // Protected copy constructor
39
40   AliFatal( "Not implemented.");
41 }
42
43
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
49 {
50   //
51   // Creates a MUON digit list object
52   //
53 }
54
55 ////////////////////////////////////////////////////////////////////////
56 AliMUONTransientDigit::~AliMUONTransientDigit() 
57 {
58   fTrackList->Delete();
59   delete fTrackList;
60 }
61
62 ////////////////////////////////////////////////////////////////////////
63 AliMUONTransientDigit& 
64 AliMUONTransientDigit::operator =(const AliMUONTransientDigit& rhs)
65 {
66 // Protected assignement operator
67
68   if (this == &rhs) return *this;
69
70   AliFatal("Not implemented.");
71     
72   return *this;  
73 }
74
75 ////////////////////////////////////////////////////////////////////////
76 void AliMUONTransientDigit::AddToTrackList(Int_t track, Int_t charge)
77 {
78   TVector *pTrInfo = new TVector(3);
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 }
96
97 ////////////////////////////////////////////////////////////////////////
98 Int_t AliMUONTransientDigit::GetTrack(Int_t i) const
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 ////////////////////////////////////////////////////////////////////////
107 Int_t AliMUONTransientDigit::GetCharge(Int_t i) const
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 }
113