]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONTransientDigit.cxx
MUON trigger classes to collaborate with CTP (E. Lopez Torres)
[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
a9e2aefa 18#include <TObjArray.h>
30178c30 19#include <TVector.h>
20
21#include "AliMUONTransientDigit.h"
8c343c7c 22#include "AliLog.h"
a9e2aefa 23
24ClassImp(AliMUONTransientDigit)
25
30178c30 26//____________________________________________________________________________
783ce8a7 27AliMUONTransientDigit::AliMUONTransientDigit() :
b357495a 28 AliMUONDigit(),
783ce8a7 29 fChamber(0),
30 fTrackList(0)
30178c30 31{
783ce8a7 32 // Default constructor
30178c30 33}
a9e2aefa 34
35//____________________________________________________________________________
783ce8a7 36AliMUONTransientDigit::AliMUONTransientDigit(const AliMUONTransientDigit& digit) :
37 AliMUONDigit(digit)
a9e2aefa 38{
30178c30 39// Protected copy constructor
40
8c343c7c 41 AliFatal( "Not implemented.");
a9e2aefa 42}
43
44
783ce8a7 45AliMUONTransientDigit::AliMUONTransientDigit(Int_t ich, Int_t *digits) :
46 AliMUONDigit(digits),
47 fChamber(ich),
48 fTrackList(new TObjArray(5))
49 // 5 is arbitrary number, just to decrease default 16
a9e2aefa 50{
783ce8a7 51 //
52 // Creates a MUON digit list object
53 //
a9e2aefa 54}
55
4b98e7b8 56////////////////////////////////////////////////////////////////////////
a9e2aefa 57AliMUONTransientDigit::~AliMUONTransientDigit()
58{
4b98e7b8 59 fTrackList->Delete();
60 delete fTrackList;
a9e2aefa 61}
62
4b98e7b8 63////////////////////////////////////////////////////////////////////////
30178c30 64AliMUONTransientDigit&
65AliMUONTransientDigit::operator =(const AliMUONTransientDigit& rhs)
a9e2aefa 66{
30178c30 67// Protected assignement operator
68
69 if (this == &rhs) return *this;
70
8c343c7c 71 AliFatal("Not implemented.");
30178c30 72
73 return *this;
a9e2aefa 74}
75
4b98e7b8 76////////////////////////////////////////////////////////////////////////
77void AliMUONTransientDigit::AddToTrackList(Int_t track, Int_t charge)
78{
3351e14b 79 TVector *pTrInfo = new TVector(3);
4b98e7b8 80 TVector &trInfo = *pTrInfo;
81 trInfo(0) = track;
82 trInfo(1) = charge;
83 fTrackList->Add(pTrInfo);
84}
85
86////////////////////////////////////////////////////////////////////////
87void 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}
a9e2aefa 97
4b98e7b8 98////////////////////////////////////////////////////////////////////////
380da863 99Int_t AliMUONTransientDigit::GetTrack(Int_t i) const
4b98e7b8 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////////////////////////////////////////////////////////////////////////
380da863 108Int_t AliMUONTransientDigit::GetCharge(Int_t i) const
4b98e7b8 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}
3351e14b 114