Fixed violations
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALJetFinderOutput.cxx
CommitLineData
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
21//
22//*-- Author: Renan Cabrera (LBL)
23// Mark Horner (LBL/UCT)
24//
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
37ClassImp(AliEMCALJetFinderOutput)
38
39//________________________________________________________________________
42460d75 40AliEMCALJetFinderOutput::AliEMCALJetFinderOutput(){
41 fNMaxJets=10;
42 fNMaxParticles=2000;
43 fNMaxPartons=4;
44 fInitialised=kFALSE;
45 fNPartons=0;
46 fNJets=0;
47 fNParticles=0;
48
49
f7d5860b 50if (fDebug>0) Info("AliEMCALJetFinderOutput","Beginning Constructor");
51
42460d75 52} //________________________________________________________________________
f7d5860b 53void AliEMCALJetFinderOutput::InitArrays()
54{
55
56if (fDebug>1) Info("AliEMCALJetFinderOutput","Beginning InitArrays");
57
f7d5860b 58}
59
60//_______________________________________________________________________
61AliEMCALJetFinderOutput::~AliEMCALJetFinderOutput()
62{
63if (fDebug>0) Info("~AliEMCALJetFinderOutput","Beginning Destructor");
f7d5860b 64}
65
66//_______________________________________________________________________
67void AliEMCALJetFinderOutput::Reset(AliEMCALJetFinderResetType_t resettype)
68{
69if (fDebug>1) Info("Reset","Beginning Reset");
70if (!fInitialised) InitArrays();
71 if ( resettype == kResetAll ||
72 resettype == kResetJets||
73 resettype == kResetData ){
f7d5860b 74 fNJets = 0;
75 }
76 if ( resettype == kResetAll ||
77 resettype == kResetPartons||
78 resettype == kResetData ){
f7d5860b 79 fNPartons = 0;
80 }
81 if ( resettype == kResetAll ||
82 resettype == kResetParticles||
83 resettype == kResetData ){
f7d5860b 84 fNParticles = 0;
85 }
86}
87//________________________________________________________________________
88void AliEMCALJetFinderOutput::AddJet(AliEMCALJet* jet)
89{
90if (fDebug>1) Info("AddJet","Beginning AddJet");
91if (!fInitialised) InitArrays();
92
42460d75 93
94 if (fNJets < fNMaxJets){
95 new( &fJetsArray[fNJets]) AliEMCALJet( *jet );
f7d5860b 96 fNJets++;
97 }else
98 {
99 Error("AddJet","Cannot AddJet - maximum exceeded");
42460d75 100 }
101
f7d5860b 102}
103
104
105//_______________________________________________________________________
106void AliEMCALJetFinderOutput::AddParton(AliEMCALParton* parton)
107{
108if (fDebug>1) Info("AddParton","Beginning AddParton");
109if (!fInitialised) InitArrays();
110
111 if (fNPartons < fNMaxPartons){
42460d75 112 new( &fPartonsArray[fNPartons] ) AliEMCALParton( *parton );
f7d5860b 113 fNPartons++;
114 }else
115 {
116 Error("AddParton","Cannot AddParton - maximum exceeded");
117 }
42460d75 118
f7d5860b 119}
120
121//_______________________________________________________________________
122void AliEMCALJetFinderOutput::AddParticle(TParticle* particle)
123{
124if (fDebug>1) Info("AddParticle","Beginning AddParticle");
125if (!fInitialised) InitArrays();
126
127 if (fNParticles < fNMaxParticles){
42460d75 128 new( &fParticlesArray[fNParticles] ) TParticle( *particle );
f7d5860b 129 fNParticles++;
130 }else
131 {
132 Error("AddParticle","Cannot AddParticle - maximum exceeded");
42460d75 133 }
f7d5860b 134}
135
136//______________________________________________________________________
137AliEMCALJet* AliEMCALJetFinderOutput::GetJet(Int_t jetID)
138{
139if (fDebug>1) Info("GetJet","Beginning GetJet");
140
141 if (jetID >= fNJets) return 0;
42460d75 142 return &(fJetsArray[jetID]);
f7d5860b 143
f7d5860b 144}
145
146//______________________________________________________________________
147AliEMCALParton* AliEMCALJetFinderOutput::GetParton(Int_t partonID)
148{
149if (fDebug>1) Info("GetParton","Beginning GetParton");
150
151 if (partonID >= fNPartons) return 0;
42460d75 152 return &(fPartonsArray[partonID]);
f7d5860b 153}
154
155//______________________________________________________________________
156TParticle* AliEMCALJetFinderOutput::GetParticle(Int_t particleID)
157{
158if (fDebug>1) Info("GetParticle","Beginning GetParticle");
159
160 if (particleID >= fNParticles) return 0;
42460d75 161return &(fParticlesArray[particleID]);
f7d5860b 162
163}
164