]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONTransientDigit.cxx
Fixed bug in parent assignment and implemented Birk's law in the Step Manager
[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
23 ClassImp(AliMUONTransientDigit)
24
25 //____________________________________________________________________________
26 AliMUONTransientDigit::AliMUONTransientDigit()
27   : AliMUONDigit()
28 {
29 // Constructor
30
31   fTrackList=0;
32 }
33  
34 //____________________________________________________________________________
35
36   AliMUONTransientDigit::AliMUONTransientDigit(const AliMUONTransientDigit& digit)
37     : AliMUONDigit(digit)
38 {
39 // Protected copy constructor
40
41   Fatal("AliMUONFTransientDigit", "Not implemented.");
42 }
43
44
45 AliMUONTransientDigit::AliMUONTransientDigit(Int_t ich, Int_t *digits): 
46     AliMUONDigit(digits)
47 {
48     //
49     // Creates a MUON digit list object
50     //
51     fChamber     = ich;
52     fTrackList   = new TObjArray(5);   
53     // 5 is arbitrary number, just to decrease default 16
54 }
55
56 ////////////////////////////////////////////////////////////////////////
57 AliMUONTransientDigit::~AliMUONTransientDigit() 
58 {
59   fTrackList->Delete();
60   delete fTrackList;
61 }
62
63 ////////////////////////////////////////////////////////////////////////
64 AliMUONTransientDigit& 
65 AliMUONTransientDigit::operator =(const AliMUONTransientDigit& rhs)
66 {
67 // Protected assignement operator
68
69   if (this == &rhs) return *this;
70
71   Fatal("operator=", "Not implemented.");
72     
73   return *this;  
74 }
75
76 ////////////////////////////////////////////////////////////////////////
77 void AliMUONTransientDigit::AddToTrackList(Int_t track, Int_t charge)
78 {
79   TVector *pTrInfo = new TVector(3);
80   TVector &trInfo = *pTrInfo;
81   trInfo(0) = track;
82   trInfo(1) = charge;
83   fTrackList->Add(pTrInfo);
84 }
85
86 ////////////////////////////////////////////////////////////////////////
87 void AliMUONTransientDigit::UpdateTrackList(Int_t track, Int_t charge)
88 {
89   Int_t lastEntry = fTrackList->GetLast();
90   TVector *pVect = static_cast<TVector*>(fTrackList->At(lastEntry));
91   if ( static_cast<Int_t>((*pVect)(0)) == track) {
92     (*pVect)(1) += charge;  // update charge
93   } else {
94     AddToTrackList(track,charge);
95   }
96 }
97
98 ////////////////////////////////////////////////////////////////////////
99 Int_t AliMUONTransientDigit::GetTrack(Int_t i) const
100 {
101   if (i > fTrackList->GetEntriesFast()) return 0;
102   TVector *pVect = static_cast<TVector*>(fTrackList->At(i));
103   return static_cast<Int_t>((*pVect)(0));
104 }
105
106
107 ////////////////////////////////////////////////////////////////////////
108 Int_t AliMUONTransientDigit::GetCharge(Int_t i) const
109 {
110   if (i > fTrackList->GetEntriesFast()) return 0;
111   TVector *pVect = static_cast<TVector*>(fTrackList->At(i));
112   return static_cast<Int_t>((*pVect)(1));
113 }
114