]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliTrackMap.cxx
Coding violations...
[u/mrichter/AliRoot.git] / STEER / AliTrackMap.cxx
CommitLineData
f0a0d075 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
acd84897 16/* $Id$ */
f0a0d075 17
18////////////////////////////////////////////////////////////////////////
19//
20// AliTrackMap.cxx
21// description:
22// contains a relation between track label and it's index
23// in a TreeH.
24// The main method is At, it takes a particle label as an argument
25// and returns the correponding entry in TreeH (many particles
26// are usually stored in 1 TreeH entry, one has to check particle
27// labels for each hit). 'At' returns:
28// kNoEntry = -1 if the particle has no entry in TreeH
29// kOutOfBounds = -2 if the particle label is out of bounds
30//
31// Author: Jiri Chudoba (CERN), 2002
32//
33////////////////////////////////////////////////////////////////////////
34
b16a1b1e 35#include <Riostream.h>
f0a0d075 36
f0a0d075 37#include "AliTrackMap.h"
38
f0a0d075 39ClassImp(AliTrackMap)
40
e2afb3b6 41//_______________________________________________________________________
42AliTrackMap::AliTrackMap():
43 fSize(0),
44 fArray(0)
f0a0d075 45{
e2afb3b6 46 //
47 // default ctor
48 //
f0a0d075 49}
e2afb3b6 50
51//_______________________________________________________________________
52AliTrackMap::AliTrackMap(const AliTrackMap& trm):
53 TNamed(trm),
54 fSize(0),
55 fArray(0)
f0a0d075 56{
e2afb3b6 57 //
58 // default ctor
59 //
60 trm.Copy(*this);
61}
f0a0d075 62
e2afb3b6 63//_______________________________________________________________________
64AliTrackMap::AliTrackMap(Int_t size, Int_t *array):
65 TNamed("AliTrackMap", "AliTrackMap"),
66 fSize(size),
67 fArray(new Int_t[fSize])
68{
69 //
70 // ctor
71 //
f0a0d075 72 for (Int_t i = 0; i < fSize; i++) fArray[i] = array[i];
73}
e2afb3b6 74
75//_______________________________________________________________________
6c4904c2 76void AliTrackMap::Copy(TObject& ) const
f0a0d075 77{
e2afb3b6 78 Fatal("Copy","Not implemented\n");
79}
f0a0d075 80
e2afb3b6 81//_______________________________________________________________________
82AliTrackMap::~AliTrackMap()
83{
84 //
85 // dtor
86 //
f0a0d075 87 delete [] fArray;
88}
89
e2afb3b6 90//_______________________________________________________________________
91Int_t AliTrackMap::At(Int_t label) const
f0a0d075 92{
e2afb3b6 93 //
94 // returns entry number in the TreeH corresponding to particle with
95 // label label
96 //
f0a0d075 97 if (label < 0 || label >= fSize) {
98 cerr<<"AliTrackMap::At: label "<<label<<" out of range, fSize = "<<fSize<<endl;
99 return kOutOfBounds;
100 }
101 return fArray[label];
102}
e2afb3b6 103
104//_______________________________________________________________________
f0a0d075 105void AliTrackMap::SetEventNr(Int_t eventNr)
106{
e2afb3b6 107 //
108 // map is identified by it's name, event number is part of it
109 //
f0a0d075 110 char name[20];
111 sprintf(name,"AliTrackMap_%5.5d",eventNr);
112 SetName(name);
113}
e2afb3b6 114
115//_______________________________________________________________________
116void AliTrackMap::PrintValues() const
f0a0d075 117{
e2afb3b6 118 //
119 // method for debugging
120 //
f0a0d075 121 cout<<this->GetName()<<" contains these values: "<<endl;
122 for (Int_t i = 0; i < fSize; i++) {
123 cout<<i<<"\t"<<fArray[i]<<"\n";
124 }
125}
e2afb3b6 126