1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ////////////////////////////////////////////////////////////////////////
22 // contains a relation between track label and it's index
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
31 // Author: Jiri Chudoba (CERN), 2002
33 ////////////////////////////////////////////////////////////////////////
35 #include <Riostream.h>
37 #include "AliTrackMap.h"
41 //_______________________________________________________________________
42 AliTrackMap::AliTrackMap():
51 //_______________________________________________________________________
52 AliTrackMap::AliTrackMap(const AliTrackMap& trm):
63 //_______________________________________________________________________
64 AliTrackMap::AliTrackMap(Int_t size, Int_t *array):
65 TNamed("AliTrackMap", "AliTrackMap"),
67 fArray(new Int_t[fSize])
72 for (Int_t i = 0; i < fSize; i++) fArray[i] = array[i];
75 //_______________________________________________________________________
76 void AliTrackMap::Copy(TObject& ) const
78 Fatal("Copy","Not implemented\n");
81 //_______________________________________________________________________
82 AliTrackMap::~AliTrackMap()
90 //_______________________________________________________________________
91 Int_t AliTrackMap::At(Int_t label) const
94 // returns entry number in the TreeH corresponding to particle with
97 if (label < 0 || label >= fSize) {
98 cerr<<"AliTrackMap::At: label "<<label<<" out of range, fSize = "<<fSize<<endl;
101 return fArray[label];
104 //_______________________________________________________________________
105 void AliTrackMap::SetEventNr(Int_t eventNr)
108 // map is identified by it's name, event number is part of it
111 sprintf(name,"AliTrackMap_%5.5d",eventNr);
115 //_______________________________________________________________________
116 void AliTrackMap::PrintValues() const
119 // method for debugging
121 cout<<this->GetName()<<" contains these values: "<<endl;
122 for (Int_t i = 0; i < fSize; i++) {
123 cout<<i<<"\t"<<fArray[i]<<"\n";