]>
Commit | Line | Data |
---|---|---|
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 | |
21bf7095 | 37 | #include "AliLog.h" |
f0a0d075 | 38 | #include "AliTrackMap.h" |
39 | ||
f0a0d075 | 40 | ClassImp(AliTrackMap) |
41 | ||
e2afb3b6 | 42 | //_______________________________________________________________________ |
43 | AliTrackMap::AliTrackMap(): | |
44 | fSize(0), | |
45 | fArray(0) | |
f0a0d075 | 46 | { |
e2afb3b6 | 47 | // |
48 | // default ctor | |
49 | // | |
f0a0d075 | 50 | } |
e2afb3b6 | 51 | |
52 | //_______________________________________________________________________ | |
53 | AliTrackMap::AliTrackMap(const AliTrackMap& trm): | |
54 | TNamed(trm), | |
55 | fSize(0), | |
56 | fArray(0) | |
f0a0d075 | 57 | { |
e2afb3b6 | 58 | // |
59 | // default ctor | |
60 | // | |
61 | trm.Copy(*this); | |
62 | } | |
f0a0d075 | 63 | |
e2afb3b6 | 64 | //_______________________________________________________________________ |
65 | AliTrackMap::AliTrackMap(Int_t size, Int_t *array): | |
66 | TNamed("AliTrackMap", "AliTrackMap"), | |
67 | fSize(size), | |
68 | fArray(new Int_t[fSize]) | |
69 | { | |
70 | // | |
71 | // ctor | |
72 | // | |
f0a0d075 | 73 | for (Int_t i = 0; i < fSize; i++) fArray[i] = array[i]; |
74 | } | |
e2afb3b6 | 75 | |
76 | //_______________________________________________________________________ | |
6c4904c2 | 77 | void AliTrackMap::Copy(TObject& ) const |
f0a0d075 | 78 | { |
21bf7095 | 79 | AliFatal("Not implemented"); |
e2afb3b6 | 80 | } |
f0a0d075 | 81 | |
e2afb3b6 | 82 | //_______________________________________________________________________ |
83 | AliTrackMap::~AliTrackMap() | |
84 | { | |
85 | // | |
86 | // dtor | |
87 | // | |
f0a0d075 | 88 | delete [] fArray; |
89 | } | |
90 | ||
e2afb3b6 | 91 | //_______________________________________________________________________ |
92 | Int_t AliTrackMap::At(Int_t label) const | |
f0a0d075 | 93 | { |
e2afb3b6 | 94 | // |
95 | // returns entry number in the TreeH corresponding to particle with | |
96 | // label label | |
97 | // | |
f0a0d075 | 98 | if (label < 0 || label >= fSize) { |
21bf7095 | 99 | AliError(Form("label %d out of range, fSize = %d", label, fSize)); |
f0a0d075 | 100 | return kOutOfBounds; |
101 | } | |
102 | return fArray[label]; | |
103 | } | |
e2afb3b6 | 104 | |
105 | //_______________________________________________________________________ | |
f0a0d075 | 106 | void AliTrackMap::SetEventNr(Int_t eventNr) |
107 | { | |
e2afb3b6 | 108 | // |
109 | // map is identified by it's name, event number is part of it | |
110 | // | |
f0a0d075 | 111 | char name[20]; |
112 | sprintf(name,"AliTrackMap_%5.5d",eventNr); | |
113 | SetName(name); | |
114 | } | |
e2afb3b6 | 115 | |
116 | //_______________________________________________________________________ | |
117 | void AliTrackMap::PrintValues() const | |
f0a0d075 | 118 | { |
e2afb3b6 | 119 | // |
120 | // method for debugging | |
121 | // | |
f0a0d075 | 122 | cout<<this->GetName()<<" contains these values: "<<endl; |
123 | for (Int_t i = 0; i < fSize; i++) { | |
124 | cout<<i<<"\t"<<fArray[i]<<"\n"; | |
125 | } | |
126 | } | |
e2afb3b6 | 127 |