]>
Commit | Line | Data |
---|---|---|
237c933d | 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 | ||
803d1ab0 | 16 | /* $Id$ */ |
237c933d | 17 | |
18 | #include "AliRICHTransientDigit.h" | |
19 | #include <TObjArray.h> | |
b762c2f6 | 20 | #include "TVector.h" |
237c933d | 21 | |
22 | ClassImp(AliRICHTransientDigit) | |
23 | ||
24 | //____________________________________________________________________________ | |
25 | AliRICHTransientDigit::AliRICHTransientDigit(Int_t ich, Int_t *digits): | |
26 | AliRICHDigit(digits) | |
27 | { | |
28 | // | |
29 | // Creates a RICH digit list object | |
30 | // | |
31 | ||
32 | fChamber = ich; | |
33 | fTrackList = new TObjArray; | |
34 | ||
35 | } | |
36 | //_____________________________________________________________________________ | |
37 | ||
4dd8aa3e | 38 | AliRICHTransientDigit::~AliRICHTransientDigit() |
39 | { | |
b762c2f6 | 40 | fTrackList->Delete(); |
41 | delete fTrackList; | |
42 | } | |
43 | ||
44 | //////////////////////////////////////////////////////////////////////// | |
45 | void AliRICHTransientDigit::AddToTrackList(Int_t track, Int_t charge) | |
46 | { | |
47 | TVector *pTrInfo = new TVector(2); | |
48 | TVector &trInfo = *pTrInfo; | |
49 | trInfo(0) = track; | |
50 | trInfo(1) = charge; | |
51 | fTrackList->Add(pTrInfo); | |
52 | } | |
53 | ||
54 | //////////////////////////////////////////////////////////////////////// | |
55 | void AliRICHTransientDigit::UpdateTrackList(Int_t track, Int_t charge) | |
56 | { | |
57 | Int_t lastEntry = fTrackList->GetLast(); | |
58 | TVector *pVect = static_cast<TVector*>(fTrackList->At(lastEntry)); | |
59 | if ( static_cast<Int_t>((*pVect)(0)) == track) { | |
60 | (*pVect)(1) += charge; // update charge | |
61 | } else { | |
62 | AddToTrackList(track,charge); | |
2682e810 | 63 | } |
4dd8aa3e | 64 | } |
b762c2f6 | 65 | |
66 | //////////////////////////////////////////////////////////////////////// | |
67 | Int_t AliRICHTransientDigit::GetTrack(Int_t i) const | |
68 | { | |
69 | if (i > fTrackList->GetEntriesFast()) return 0; | |
70 | TVector *pVect = static_cast<TVector*>(fTrackList->At(i)); | |
71 | return static_cast<Int_t>((*pVect)(0)); | |
72 | } | |
73 | ||
74 | ||
75 | //////////////////////////////////////////////////////////////////////// | |
76 | Int_t AliRICHTransientDigit::GetCharge(Int_t i) const | |
77 | { | |
78 | if (i > fTrackList->GetEntriesFast()) return 0; | |
79 | TVector *pVect = static_cast<TVector*>(fTrackList->At(i)); | |
80 | return static_cast<Int_t>((*pVect)(1)); | |
81 | } |