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