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 //_________________________________________________________________________
20 // Output object for jetfinder
22 //*-- Author: Renan Cabrera (LBL)
23 // Mark Horner (LBL/UCT)
28 #include <TParticle.h>
31 //.....................
32 #include "AliEMCALJet.h"
33 #include "AliEMCALParton.h"
34 #include "AliEMCALJetFinderOutput.h"
35 #include "AliEMCALJetFinderInput.h"
37 ClassImp(AliEMCALJetFinderOutput)
39 //________________________________________________________________________
40 AliEMCALJetFinderOutput::AliEMCALJetFinderOutput() :
41 fJetsArray(0),fPartonsArray(0),fNPartons(0),fNJets(0),
42 fParticlesArray(0),fNParticles(0),fNMaxJets(0),fNMaxParticles(0),
43 fNMaxPartons(0),fDebug(0),fInitialised(kFALSE)
45 // Default constructor
60 if (fDebug>0) Info("AliEMCALJetFinderOutput","Beginning Constructor");
64 //________________________________________________________________________
65 AliEMCALJetFinderOutput::AliEMCALJetFinderOutput(const AliEMCALJetFinderOutput& jfo)
66 : TObject(jfo), fJetsArray(jfo.fJetsArray),fPartonsArray(jfo.fPartonsArray),fNPartons(jfo.fNPartons),
67 fNJets(jfo.fNJets), fParticlesArray(jfo.fParticlesArray),fNParticles(jfo.fNParticles),
68 fNMaxJets(jfo.fNMaxJets),fNMaxParticles(jfo.fNMaxParticles),fNMaxPartons(jfo.fNMaxPartons),
69 fDebug(jfo.fDebug),fInitialised(jfo.fInitialised)
74 //________________________________________________________________________
75 void AliEMCALJetFinderOutput::InitArrays()
77 // Initialise arrays - legacy from TClones days
78 if (fDebug>1) Info("AliEMCALJetFinderOutput","Beginning InitArrays");
79 fParticlesArray=new TClonesArray("TParticle",fNMaxParticles);
80 fPartonsArray=new TClonesArray("AliEMCALParton",fNMaxPartons);
81 fJetsArray=new TClonesArray("AliEMCALJet",fNMaxJets);
82 //fJetsArray->BypassStreamer(kFALSE);
86 //_______________________________________________________________________
87 AliEMCALJetFinderOutput::~AliEMCALJetFinderOutput()
90 if (fDebug>0) Info("~AliEMCALJetFinderOutput","Beginning Destructor");
91 delete fParticlesArray;
96 //_______________________________________________________________________
97 void AliEMCALJetFinderOutput::Reset(AliEMCALJetFinderResetType_t resettype)
101 if (fDebug>1) Info("Reset","Beginning Reset");
102 if (!fInitialised) InitArrays();
103 if ( resettype == kResetAll ||
104 resettype == kResetJets||
105 resettype == kResetData ){
110 if ( resettype == kResetAll ||
111 resettype == kResetPartons||
112 resettype == kResetData ){
115 fPartonsArray->Clear();
117 if ( resettype == kResetAll ||
118 resettype == kResetParticles||
119 resettype == kResetData ){
122 fParticlesArray->Clear();
125 //________________________________________________________________________
126 void AliEMCALJetFinderOutput::AddJet(AliEMCALJet* jet)
128 // Add a jet to the array
130 if (fDebug>1) Info("AddJet","Beginning AddJet");
131 if (!fInitialised) InitArrays();
134 if (fNJets < fNMaxJets){
135 new(fJetsArray->AddrAt(fNJets)) AliEMCALJet( *jet );
139 Error("AddJet","Cannot AddJet - maximum exceeded");
145 //_______________________________________________________________________
146 void AliEMCALJetFinderOutput::AddParton(AliEMCALParton* parton)
148 //Add a parton to the array
150 if (fDebug>1) Info("AddParton","Beginning AddParton");
151 if (!fInitialised) InitArrays();
153 if (fNPartons < fNMaxPartons){
154 new(fPartonsArray->AddrAt(fNPartons)) AliEMCALParton( *parton );
158 Error("AddParton","Cannot AddParton - maximum exceeded");
163 //_______________________________________________________________________
164 void AliEMCALJetFinderOutput::AddParticle(TParticle* particle)
166 //Add a particle tot he array
168 if (fDebug>1) Info("AddParticle","Beginning AddParticle");
169 if (!fInitialised) InitArrays();
171 if (fNParticles < fNMaxParticles){
172 new(fParticlesArray->AddrAt(fNParticles)) TParticle( *particle );
176 Error("AddParticle","Cannot AddParticle - maximum exceeded");
180 //______________________________________________________________________
181 AliEMCALJet* AliEMCALJetFinderOutput::GetJet(Int_t jetID)
184 if (fDebug>1) Info("GetJet","Beginning GetJet");
186 if (jetID >= fNJets) return 0;
187 return (AliEMCALJet*)fJetsArray->At(jetID);
191 //______________________________________________________________________
192 AliEMCALParton* AliEMCALJetFinderOutput::GetParton(Int_t partonID)
195 if (fDebug>1) Info("GetParton","Beginning GetParton");
197 if (partonID >= fNPartons) return 0;
198 return (AliEMCALParton*) fPartonsArray->At(partonID);
201 //______________________________________________________________________
202 TParticle* AliEMCALJetFinderOutput::GetParticle(Int_t particleID)
206 if (fDebug>1) Info("GetParticle","Beginning GetParticle");
208 if (particleID >= fNParticles) return 0;
209 return (TParticle*) fParticlesArray->At(particleID);