]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONTransientDigit.cxx
- Adapted comments for Doxygen
[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
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
5398f946 30/// \cond CLASSIMP
a9e2aefa 31ClassImp(AliMUONTransientDigit)
5398f946 32/// \endcond
a9e2aefa 33
30178c30 34//____________________________________________________________________________
783ce8a7 35AliMUONTransientDigit::AliMUONTransientDigit() :
b357495a 36 AliMUONDigit(),
783ce8a7 37 fChamber(0),
38 fTrackList(0)
30178c30 39{
d19b6003 40/// Default constructor
30178c30 41}
a9e2aefa 42
783ce8a7 43AliMUONTransientDigit::AliMUONTransientDigit(Int_t ich, Int_t *digits) :
44 AliMUONDigit(digits),
45 fChamber(ich),
46 fTrackList(new TObjArray(5))
47 // 5 is arbitrary number, just to decrease default 16
a9e2aefa 48{
d19b6003 49/// Creates a MUON digit list object
a9e2aefa 50}
51
4b98e7b8 52////////////////////////////////////////////////////////////////////////
a9e2aefa 53AliMUONTransientDigit::~AliMUONTransientDigit()
54{
d19b6003 55/// Destructor
56
4b98e7b8 57 fTrackList->Delete();
58 delete fTrackList;
a9e2aefa 59}
60
4b98e7b8 61////////////////////////////////////////////////////////////////////////
62void AliMUONTransientDigit::AddToTrackList(Int_t track, Int_t charge)
63{
5398f946 64/// Add track to the track list
65
3351e14b 66 TVector *pTrInfo = new TVector(3);
4b98e7b8 67 TVector &trInfo = *pTrInfo;
68 trInfo(0) = track;
69 trInfo(1) = charge;
70 fTrackList->Add(pTrInfo);
71}
72
73////////////////////////////////////////////////////////////////////////
74void AliMUONTransientDigit::UpdateTrackList(Int_t track, Int_t charge)
75{
5398f946 76/// Update track charge if track already in the track list,
77/// or add the track to the list
78
4b98e7b8 79 Int_t lastEntry = fTrackList->GetLast();
80 TVector *pVect = static_cast<TVector*>(fTrackList->At(lastEntry));
81 if ( static_cast<Int_t>((*pVect)(0)) == track) {
82 (*pVect)(1) += charge; // update charge
83 } else {
84 AddToTrackList(track,charge);
85 }
86}
a9e2aefa 87
4b98e7b8 88////////////////////////////////////////////////////////////////////////
380da863 89Int_t AliMUONTransientDigit::GetTrack(Int_t i) const
4b98e7b8 90{
5398f946 91/// Return \a i th track from the list
92
4b98e7b8 93 if (i > fTrackList->GetEntriesFast()) return 0;
94 TVector *pVect = static_cast<TVector*>(fTrackList->At(i));
95 return static_cast<Int_t>((*pVect)(0));
96}
97
98
99////////////////////////////////////////////////////////////////////////
380da863 100Int_t AliMUONTransientDigit::GetCharge(Int_t i) const
4b98e7b8 101{
5398f946 102/// Return the charge of \a i th track in the list
103
4b98e7b8 104 if (i > fTrackList->GetEntriesFast()) return 0;
105 TVector *pVect = static_cast<TVector*>(fTrackList->At(i));
106 return static_cast<Int_t>((*pVect)(1));
107}
3351e14b 108