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