]>
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 | ||
16 | /* | |
17 | $Log$ | |
e2afb3b6 | 18 | Revision 1.3 2002/10/22 15:02:15 alibrary |
19 | Introducing Riostream.h | |
20 | ||
b16a1b1e | 21 | Revision 1.2 2002/10/14 14:57:33 hristov |
22 | Merging the VirtualMC branch to the main development branch (HEAD) | |
23 | ||
b9d0a01d | 24 | Revision 1.1.2.1 2002/10/14 09:45:57 hristov |
25 | Updating VirtualMC to v3-09-02 | |
26 | ||
27 | Revision 1.1 2002/09/17 08:37:12 jchudoba | |
28 | Classes to create and store tracks maps - correcpondence between track label and entry number in the TreeH | |
29 | ||
f0a0d075 | 30 | */ |
31 | ||
32 | //////////////////////////////////////////////////////////////////////// | |
33 | // | |
34 | // AliTrackMap.cxx | |
35 | // description: | |
36 | // contains a relation between track label and it's index | |
37 | // in a TreeH. | |
38 | // The main method is At, it takes a particle label as an argument | |
39 | // and returns the correponding entry in TreeH (many particles | |
40 | // are usually stored in 1 TreeH entry, one has to check particle | |
41 | // labels for each hit). 'At' returns: | |
42 | // kNoEntry = -1 if the particle has no entry in TreeH | |
43 | // kOutOfBounds = -2 if the particle label is out of bounds | |
44 | // | |
45 | // Author: Jiri Chudoba (CERN), 2002 | |
46 | // | |
47 | //////////////////////////////////////////////////////////////////////// | |
48 | ||
b16a1b1e | 49 | #include <Riostream.h> |
f0a0d075 | 50 | |
51 | #include "TTree.h" | |
52 | #include "TROOT.h" | |
53 | ||
54 | #include "AliTrackMap.h" | |
55 | ||
56 | #include "AliRun.h" | |
57 | ||
58 | ClassImp(AliTrackMap) | |
59 | ||
e2afb3b6 | 60 | //_______________________________________________________________________ |
61 | AliTrackMap::AliTrackMap(): | |
62 | fSize(0), | |
63 | fArray(0) | |
f0a0d075 | 64 | { |
e2afb3b6 | 65 | // |
66 | // default ctor | |
67 | // | |
f0a0d075 | 68 | } |
e2afb3b6 | 69 | |
70 | //_______________________________________________________________________ | |
71 | AliTrackMap::AliTrackMap(const AliTrackMap& trm): | |
72 | TNamed(trm), | |
73 | fSize(0), | |
74 | fArray(0) | |
f0a0d075 | 75 | { |
e2afb3b6 | 76 | // |
77 | // default ctor | |
78 | // | |
79 | trm.Copy(*this); | |
80 | } | |
f0a0d075 | 81 | |
e2afb3b6 | 82 | //_______________________________________________________________________ |
83 | AliTrackMap::AliTrackMap(Int_t size, Int_t *array): | |
84 | TNamed("AliTrackMap", "AliTrackMap"), | |
85 | fSize(size), | |
86 | fArray(new Int_t[fSize]) | |
87 | { | |
88 | // | |
89 | // ctor | |
90 | // | |
f0a0d075 | 91 | for (Int_t i = 0; i < fSize; i++) fArray[i] = array[i]; |
92 | } | |
e2afb3b6 | 93 | |
94 | //_______________________________________________________________________ | |
95 | void AliTrackMap::Copy(AliTrackMap& ) const | |
f0a0d075 | 96 | { |
e2afb3b6 | 97 | Fatal("Copy","Not implemented\n"); |
98 | } | |
f0a0d075 | 99 | |
e2afb3b6 | 100 | //_______________________________________________________________________ |
101 | AliTrackMap::~AliTrackMap() | |
102 | { | |
103 | // | |
104 | // dtor | |
105 | // | |
f0a0d075 | 106 | delete [] fArray; |
107 | } | |
108 | ||
e2afb3b6 | 109 | //_______________________________________________________________________ |
110 | Int_t AliTrackMap::At(Int_t label) const | |
f0a0d075 | 111 | { |
e2afb3b6 | 112 | // |
113 | // returns entry number in the TreeH corresponding to particle with | |
114 | // label label | |
115 | // | |
f0a0d075 | 116 | if (label < 0 || label >= fSize) { |
117 | cerr<<"AliTrackMap::At: label "<<label<<" out of range, fSize = "<<fSize<<endl; | |
118 | return kOutOfBounds; | |
119 | } | |
120 | return fArray[label]; | |
121 | } | |
e2afb3b6 | 122 | |
123 | //_______________________________________________________________________ | |
f0a0d075 | 124 | void AliTrackMap::SetEventNr(Int_t eventNr) |
125 | { | |
e2afb3b6 | 126 | // |
127 | // map is identified by it's name, event number is part of it | |
128 | // | |
f0a0d075 | 129 | char name[20]; |
130 | sprintf(name,"AliTrackMap_%5.5d",eventNr); | |
131 | SetName(name); | |
132 | } | |
e2afb3b6 | 133 | |
134 | //_______________________________________________________________________ | |
135 | void AliTrackMap::PrintValues() const | |
f0a0d075 | 136 | { |
e2afb3b6 | 137 | // |
138 | // method for debugging | |
139 | // | |
f0a0d075 | 140 | cout<<this->GetName()<<" contains these values: "<<endl; |
141 | for (Int_t i = 0; i < fSize; i++) { | |
142 | cout<<i<<"\t"<<fArray[i]<<"\n"; | |
143 | } | |
144 | } | |
e2afb3b6 | 145 |