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