]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - MUON/AliMUONTransientDigit.cxx
ReadRaw(): TGraphs are created once per event (B.Polichtchouk)
[u/mrichter/AliRoot.git] / MUON / AliMUONTransientDigit.cxx
... / ...
CommitLineData
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// ------------------------------
19// Class AliMUONTransientDigit
20// ------------------------------
21// MUON transient digit
22// Extends AliMUONDigit with a list of contributing tracks
23
24#include <TObjArray.h>
25#include <TVector.h>
26
27#include "AliMUONTransientDigit.h"
28#include "AliLog.h"
29
30/// \cond CLASSIMP
31ClassImp(AliMUONTransientDigit)
32/// \endcond
33
34//____________________________________________________________________________
35AliMUONTransientDigit::AliMUONTransientDigit() :
36 AliMUONDigit(),
37 fChamber(0),
38 fTrackList(0)
39{
40/// Default constructor
41}
42
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
48{
49/// Creates a MUON digit list object
50}
51
52////////////////////////////////////////////////////////////////////////
53AliMUONTransientDigit::~AliMUONTransientDigit()
54{
55/// Destructor
56
57 fTrackList->Delete();
58 delete fTrackList;
59}
60
61////////////////////////////////////////////////////////////////////////
62void AliMUONTransientDigit::AddToTrackList(Int_t track, Int_t charge)
63{
64/// Add track to the track list
65
66 TVector *pTrInfo = new TVector(3);
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{
76/// Update track charge if track already in the track list,
77/// or add the track to the list
78
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}
87
88////////////////////////////////////////////////////////////////////////
89Int_t AliMUONTransientDigit::GetTrack(Int_t i) const
90{
91/// Return \a i th track from the list
92
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////////////////////////////////////////////////////////////////////////
100Int_t AliMUONTransientDigit::GetCharge(Int_t i) const
101{
102/// Return the charge of \a i th track in the list
103
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}
108