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 // Default constructor
56 if (fDebug>0) Info("AliEMCALJetFinderOutput","Beginning Constructor");
58 } //________________________________________________________________________
59 void AliEMCALJetFinderOutput::InitArrays()
61 // Initialise arrays - legacy from TClones days
62 if (fDebug>1) Info("AliEMCALJetFinderOutput","Beginning InitArrays");
63 fParticlesArray=new TClonesArray("TParticle",fNMaxParticles);
64 fPartonsArray=new TClonesArray("AliEMCALParton",fNMaxPartons);
65 fJetsArray=new TClonesArray("AliEMCALJet",fNMaxJets);
66 //fJetsArray->BypassStreamer(kFALSE);
70 //_______________________________________________________________________
71 AliEMCALJetFinderOutput::~AliEMCALJetFinderOutput()
74 if (fDebug>0) Info("~AliEMCALJetFinderOutput","Beginning Destructor");
75 delete fParticlesArray;
80 //_______________________________________________________________________
81 void AliEMCALJetFinderOutput::Reset(AliEMCALJetFinderResetType_t resettype)
85 if (fDebug>1) Info("Reset","Beginning Reset");
86 if (!fInitialised) InitArrays();
87 if ( resettype == kResetAll ||
88 resettype == kResetJets||
89 resettype == kResetData ){
94 if ( resettype == kResetAll ||
95 resettype == kResetPartons||
96 resettype == kResetData ){
99 fPartonsArray->Clear();
101 if ( resettype == kResetAll ||
102 resettype == kResetParticles||
103 resettype == kResetData ){
106 fParticlesArray->Clear();
109 //________________________________________________________________________
110 void AliEMCALJetFinderOutput::AddJet(AliEMCALJet* jet)
112 // Add a jet to the array
114 if (fDebug>1) Info("AddJet","Beginning AddJet");
115 if (!fInitialised) InitArrays();
118 if (fNJets < fNMaxJets){
119 new(fJetsArray->AddrAt(fNJets)) AliEMCALJet( *jet );
123 Error("AddJet","Cannot AddJet - maximum exceeded");
129 //_______________________________________________________________________
130 void AliEMCALJetFinderOutput::AddParton(AliEMCALParton* parton)
132 //Add a parton to the array
134 if (fDebug>1) Info("AddParton","Beginning AddParton");
135 if (!fInitialised) InitArrays();
137 if (fNPartons < fNMaxPartons){
138 new(fPartonsArray->AddrAt(fNPartons)) AliEMCALParton( *parton );
142 Error("AddParton","Cannot AddParton - maximum exceeded");
147 //_______________________________________________________________________
148 void AliEMCALJetFinderOutput::AddParticle(TParticle* particle)
150 //Add a particle tot he array
152 if (fDebug>1) Info("AddParticle","Beginning AddParticle");
153 if (!fInitialised) InitArrays();
155 if (fNParticles < fNMaxParticles){
156 new(fParticlesArray->AddrAt(fNParticles)) TParticle( *particle );
160 Error("AddParticle","Cannot AddParticle - maximum exceeded");
164 //______________________________________________________________________
165 AliEMCALJet* AliEMCALJetFinderOutput::GetJet(Int_t jetID)
168 if (fDebug>1) Info("GetJet","Beginning GetJet");
170 if (jetID >= fNJets) return 0;
171 return (AliEMCALJet*)fJetsArray->At(jetID);
175 //______________________________________________________________________
176 AliEMCALParton* AliEMCALJetFinderOutput::GetParton(Int_t partonID)
179 if (fDebug>1) Info("GetParton","Beginning GetParton");
181 if (partonID >= fNPartons) return 0;
182 return (AliEMCALParton*) fPartonsArray->At(partonID);
185 //______________________________________________________________________
186 TParticle* AliEMCALJetFinderOutput::GetParticle(Int_t particleID)
190 if (fDebug>1) Info("GetParticle","Beginning GetParticle");
192 if (particleID >= fNParticles) return 0;
193 return (TParticle*) fParticlesArray->At(particleID);