1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
19 Revision 1.1.1.1 2003/05/29 18:56:53 horner
25 //_________________________________________________________________________
26 // Output object for jetfinder
28 //*-- Author: Renan Cabrera (LBL)
29 // Mark Horner (LBL/UCT)
35 #include <TClonesArray.h>
36 #include <TParticle.h>
39 //.....................
40 #include "AliEMCALJet.h"
41 #include "AliEMCALParton.h"
42 #include "AliEMCALJetFinderOutput.h"
43 #include "AliEMCALJetFinderInput.h"
45 ClassImp(AliEMCALJetFinderOutput)
47 //________________________________________________________________________
48 AliEMCALJetFinderOutput::AliEMCALJetFinderOutput()
50 if (fDebug>0) Info("AliEMCALJetFinderOutput","Beginning Constructor");
55 fInitialised = kFALSE;
58 void AliEMCALJetFinderOutput::InitArrays()
61 if (fDebug>1) Info("AliEMCALJetFinderOutput","Beginning InitArrays");
63 fJetsArray = new TClonesArray("AliEMCALJet",fNMaxJets);
65 fPartonsArray = new TClonesArray("AliEMCALParton",fNMaxPartons);
67 fParticlesArray = new TClonesArray("TParticle",fNMaxParticles);
73 //_______________________________________________________________________
74 AliEMCALJetFinderOutput::~AliEMCALJetFinderOutput()
76 if (fDebug>0) Info("~AliEMCALJetFinderOutput","Beginning Destructor");
80 fPartonsArray->Delete();
81 fParticlesArray->Delete();
85 delete fParticlesArray;
89 //_______________________________________________________________________
90 void AliEMCALJetFinderOutput::Reset(AliEMCALJetFinderResetType_t resettype)
92 if (fDebug>1) Info("Reset","Beginning Reset");
93 if (!fInitialised) InitArrays();
94 if ( resettype == kResetAll ||
95 resettype == kResetJets||
96 resettype == kResetData ){
100 if ( resettype == kResetAll ||
101 resettype == kResetPartons||
102 resettype == kResetData ){
103 fPartonsArray->Delete();
106 if ( resettype == kResetAll ||
107 resettype == kResetParticles||
108 resettype == kResetData ){
109 fParticlesArray->Delete();
113 //________________________________________________________________________
114 void AliEMCALJetFinderOutput::AddJet(AliEMCALJet* jet)
116 if (fDebug>1) Info("AddJet","Beginning AddJet");
117 if (!fInitialised) InitArrays();
119 if (fNJets < fNMaxJets){
120 new( (*fJetsArray)[fNJets] ) AliEMCALJet( *jet );
124 Error("AddJet","Cannot AddJet - maximum exceeded");
129 //_______________________________________________________________________
130 void AliEMCALJetFinderOutput::AddParton(AliEMCALParton* parton)
132 if (fDebug>1) Info("AddParton","Beginning AddParton");
133 if (!fInitialised) InitArrays();
135 if (fNPartons < fNMaxPartons){
136 new( (*fPartonsArray)[fNPartons] ) AliEMCALParton( *parton );
140 Error("AddParton","Cannot AddParton - maximum exceeded");
145 //_______________________________________________________________________
146 void AliEMCALJetFinderOutput::AddParticle(TParticle* particle)
148 if (fDebug>1) Info("AddParticle","Beginning AddParticle");
149 if (!fInitialised) InitArrays();
151 if (fNParticles < fNMaxParticles){
152 new( (*fParticlesArray)[fNParticles] ) TParticle( *particle );
156 Error("AddParticle","Cannot AddParticle - maximum exceeded");
161 //______________________________________________________________________
162 AliEMCALJet* AliEMCALJetFinderOutput::GetJet(Int_t jetID)
164 if (fDebug>1) Info("GetJet","Beginning GetJet");
166 if (jetID >= fNJets) return 0;
167 return (AliEMCALJet*)((*fJetsArray)[jetID]);
172 //______________________________________________________________________
173 AliEMCALParton* AliEMCALJetFinderOutput::GetParton(Int_t partonID)
175 if (fDebug>1) Info("GetParton","Beginning GetParton");
177 if (partonID >= fNPartons) return 0;
178 return (AliEMCALParton*)((*fPartonsArray)[partonID]);
183 //______________________________________________________________________
184 TParticle* AliEMCALJetFinderOutput::GetParticle(Int_t particleID)
186 if (fDebug>1) Info("GetParticle","Beginning GetParticle");
188 if (particleID >= fNParticles) return 0;
189 return (TParticle*)((*fParticlesArray)[particleID]);