]>
Commit | Line | Data |
---|---|---|
f7d5860b | 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 | ||
42460d75 | 16 | |
ee6b678f | 17 | /* $Id$ */ |
f7d5860b | 18 | |
19 | //_________________________________________________________________________ | |
20 | // Output object for jetfinder | |
44f59d68 | 21 | // -- |
f7d5860b | 22 | //*-- Author: Renan Cabrera (LBL) |
23 | // Mark Horner (LBL/UCT) | |
44f59d68 | 24 | // -- |
f7d5860b | 25 | |
26 | ||
f7d5860b | 27 | #include <stdio.h> |
f7d5860b | 28 | #include <TParticle.h> |
29 | #include <TTree.h> | |
30 | ||
31 | //..................... | |
32 | #include "AliEMCALJet.h" | |
33 | #include "AliEMCALParton.h" | |
34 | #include "AliEMCALJetFinderOutput.h" | |
35 | #include "AliEMCALJetFinderInput.h" | |
36 | ||
37 | ClassImp(AliEMCALJetFinderOutput) | |
38 | ||
39 | //________________________________________________________________________ | |
42460d75 | 40 | AliEMCALJetFinderOutput::AliEMCALJetFinderOutput(){ |
880c5eb1 | 41 | // Default constructor |
42 | ||
42460d75 | 43 | fNMaxJets=10; |
44 | fNMaxParticles=2000; | |
45 | fNMaxPartons=4; | |
46 | fInitialised=kFALSE; | |
5bf42aa6 | 47 | fDebug=0; |
42460d75 | 48 | fNPartons=0; |
49 | fNJets=0; | |
50 | fNParticles=0; | |
5bf42aa6 | 51 | |
52 | fJetsArray=0; | |
53 | fParticlesArray=0; | |
54 | fPartonsArray=0; | |
42460d75 | 55 | |
f7d5860b | 56 | if (fDebug>0) Info("AliEMCALJetFinderOutput","Beginning Constructor"); |
57 | ||
42460d75 | 58 | } //________________________________________________________________________ |
f7d5860b | 59 | void AliEMCALJetFinderOutput::InitArrays() |
60 | { | |
880c5eb1 | 61 | // Initialise arrays - legacy from TClones days |
f7d5860b | 62 | if (fDebug>1) Info("AliEMCALJetFinderOutput","Beginning InitArrays"); |
5bf42aa6 | 63 | fParticlesArray=new TClonesArray("TParticle",fNMaxParticles); |
64 | fPartonsArray=new TClonesArray("AliEMCALParton",fNMaxPartons); | |
65 | fJetsArray=new TClonesArray("AliEMCALJet",fNMaxJets); | |
66 | //fJetsArray->BypassStreamer(kFALSE); | |
67 | fInitialised=1; | |
f7d5860b | 68 | } |
69 | ||
70 | //_______________________________________________________________________ | |
71 | AliEMCALJetFinderOutput::~AliEMCALJetFinderOutput() | |
72 | { | |
880c5eb1 | 73 | // Default destrucotr |
f7d5860b | 74 | if (fDebug>0) Info("~AliEMCALJetFinderOutput","Beginning Destructor"); |
5bf42aa6 | 75 | delete fParticlesArray; |
76 | delete fPartonsArray; | |
77 | delete fJetsArray; | |
f7d5860b | 78 | } |
79 | ||
80 | //_______________________________________________________________________ | |
81 | void AliEMCALJetFinderOutput::Reset(AliEMCALJetFinderResetType_t resettype) | |
82 | { | |
880c5eb1 | 83 | // Reset stored data |
84 | ||
f7d5860b | 85 | if (fDebug>1) Info("Reset","Beginning Reset"); |
86 | if (!fInitialised) InitArrays(); | |
87 | if ( resettype == kResetAll || | |
88 | resettype == kResetJets|| | |
89 | resettype == kResetData ){ | |
f7d5860b | 90 | fNJets = 0; |
5bf42aa6 | 91 | if (fJetsArray) |
92 | fJetsArray->Clear(); | |
f7d5860b | 93 | } |
94 | if ( resettype == kResetAll || | |
95 | resettype == kResetPartons|| | |
96 | resettype == kResetData ){ | |
f7d5860b | 97 | fNPartons = 0; |
5bf42aa6 | 98 | if (fPartonsArray) |
99 | fPartonsArray->Clear(); | |
f7d5860b | 100 | } |
101 | if ( resettype == kResetAll || | |
102 | resettype == kResetParticles|| | |
103 | resettype == kResetData ){ | |
f7d5860b | 104 | fNParticles = 0; |
5bf42aa6 | 105 | if (fParticlesArray) |
106 | fParticlesArray->Clear(); | |
f7d5860b | 107 | } |
108 | } | |
109 | //________________________________________________________________________ | |
110 | void AliEMCALJetFinderOutput::AddJet(AliEMCALJet* jet) | |
111 | { | |
880c5eb1 | 112 | // Add a jet to the array |
113 | ||
f7d5860b | 114 | if (fDebug>1) Info("AddJet","Beginning AddJet"); |
115 | if (!fInitialised) InitArrays(); | |
116 | ||
42460d75 | 117 | |
118 | if (fNJets < fNMaxJets){ | |
5bf42aa6 | 119 | new(fJetsArray->AddrAt(fNJets)) AliEMCALJet( *jet ); |
f7d5860b | 120 | fNJets++; |
121 | }else | |
122 | { | |
123 | Error("AddJet","Cannot AddJet - maximum exceeded"); | |
42460d75 | 124 | } |
125 | ||
f7d5860b | 126 | } |
127 | ||
128 | ||
129 | //_______________________________________________________________________ | |
130 | void AliEMCALJetFinderOutput::AddParton(AliEMCALParton* parton) | |
131 | { | |
880c5eb1 | 132 | //Add a parton to the array |
133 | ||
f7d5860b | 134 | if (fDebug>1) Info("AddParton","Beginning AddParton"); |
135 | if (!fInitialised) InitArrays(); | |
136 | ||
137 | if (fNPartons < fNMaxPartons){ | |
5bf42aa6 | 138 | new(fPartonsArray->AddrAt(fNPartons)) AliEMCALParton( *parton ); |
f7d5860b | 139 | fNPartons++; |
140 | }else | |
141 | { | |
142 | Error("AddParton","Cannot AddParton - maximum exceeded"); | |
143 | } | |
42460d75 | 144 | |
f7d5860b | 145 | } |
146 | ||
147 | //_______________________________________________________________________ | |
148 | void AliEMCALJetFinderOutput::AddParticle(TParticle* particle) | |
149 | { | |
880c5eb1 | 150 | //Add a particle tot he array |
151 | ||
f7d5860b | 152 | if (fDebug>1) Info("AddParticle","Beginning AddParticle"); |
153 | if (!fInitialised) InitArrays(); | |
154 | ||
155 | if (fNParticles < fNMaxParticles){ | |
5bf42aa6 | 156 | new(fParticlesArray->AddrAt(fNParticles)) TParticle( *particle ); |
f7d5860b | 157 | fNParticles++; |
158 | }else | |
159 | { | |
160 | Error("AddParticle","Cannot AddParticle - maximum exceeded"); | |
42460d75 | 161 | } |
f7d5860b | 162 | } |
163 | ||
164 | //______________________________________________________________________ | |
165 | AliEMCALJet* AliEMCALJetFinderOutput::GetJet(Int_t jetID) | |
166 | { | |
880c5eb1 | 167 | // return a jet |
f7d5860b | 168 | if (fDebug>1) Info("GetJet","Beginning GetJet"); |
169 | ||
170 | if (jetID >= fNJets) return 0; | |
5bf42aa6 | 171 | return (AliEMCALJet*)fJetsArray->At(jetID); |
f7d5860b | 172 | |
f7d5860b | 173 | } |
174 | ||
175 | //______________________________________________________________________ | |
176 | AliEMCALParton* AliEMCALJetFinderOutput::GetParton(Int_t partonID) | |
177 | { | |
880c5eb1 | 178 | //return a parton |
f7d5860b | 179 | if (fDebug>1) Info("GetParton","Beginning GetParton"); |
180 | ||
181 | if (partonID >= fNPartons) return 0; | |
5bf42aa6 | 182 | return (AliEMCALParton*) fPartonsArray->At(partonID); |
f7d5860b | 183 | } |
184 | ||
185 | //______________________________________________________________________ | |
186 | TParticle* AliEMCALJetFinderOutput::GetParticle(Int_t particleID) | |
187 | { | |
880c5eb1 | 188 | //return a particle |
189 | ||
f7d5860b | 190 | if (fDebug>1) Info("GetParticle","Beginning GetParticle"); |
191 | ||
192 | if (particleID >= fNParticles) return 0; | |
5bf42aa6 | 193 | return (TParticle*) fParticlesArray->At(particleID); |
f7d5860b | 194 | |
195 | } | |
196 |