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