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