]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/jetfinder/AliEMCALJetFinderOutput.cxx
adding a member for the active CTP trigger mask to the CTP data object and setting...
[u/mrichter/AliRoot.git] / EMCAL / jetfinder / 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   fJetsArray(0),fPartonsArray(0),fNPartons(0),fNJets(0),
42   fParticlesArray(0),fNParticles(0),fNMaxJets(0),fNMaxParticles(0),
43   fNMaxPartons(0),fDebug(0),fInitialised(kFALSE)
44
45         // Default constructor
46         
47         fNMaxJets=10;
48         fNMaxParticles=2000;
49         fNMaxPartons=4;
50         fInitialised=kFALSE;
51         fDebug=0;
52         fNPartons=0;
53         fNJets=0;    
54         fNParticles=0;
55
56         fJetsArray=0;
57         fParticlesArray=0;
58         fPartonsArray=0;
59
60 if (fDebug>0) Info("AliEMCALJetFinderOutput","Beginning Constructor");
61
62
63
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)
70
71   //copy ctor
72 }
73
74 //________________________________________________________________________
75 void AliEMCALJetFinderOutput::InitArrays()
76 {
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);
83  fInitialised=1;
84 }
85
86 //_______________________________________________________________________
87 AliEMCALJetFinderOutput::~AliEMCALJetFinderOutput()
88 {
89         // Default destrucotr
90 if (fDebug>0) Info("~AliEMCALJetFinderOutput","Beginning Destructor");
91  delete fParticlesArray;
92  delete fPartonsArray;
93  delete fJetsArray;
94 }
95
96 //_______________________________________________________________________
97 void AliEMCALJetFinderOutput::Reset(AliEMCALJetFinderResetType_t resettype)
98 {
99 // Reset stored data
100         
101 if (fDebug>1) Info("Reset","Beginning Reset");
102 if (!fInitialised) InitArrays();
103  if (   resettype == kResetAll ||
104         resettype == kResetJets||
105         resettype == kResetData ){
106          fNJets = 0;
107          if (fJetsArray)
108            fJetsArray->Clear();
109  }
110  if (   resettype == kResetAll ||
111         resettype == kResetPartons||              
112         resettype == kResetData ){
113          fNPartons = 0;
114          if (fPartonsArray)
115            fPartonsArray->Clear();
116  }
117  if (   resettype == kResetAll ||    
118         resettype == kResetParticles||              
119         resettype == kResetData ){
120          fNParticles = 0;
121          if (fParticlesArray)
122            fParticlesArray->Clear();
123  }
124 }
125 //________________________________________________________________________
126 void AliEMCALJetFinderOutput::AddJet(AliEMCALJet* jet)
127 {
128 // Add a jet to the array
129         
130 if (fDebug>1) Info("AddJet","Beginning AddJet");
131 if (!fInitialised) InitArrays();
132
133
134         if (fNJets < fNMaxJets){
135                 new(fJetsArray->AddrAt(fNJets))   AliEMCALJet( *jet );
136                 fNJets++;
137         }else
138         {
139                 Error("AddJet","Cannot AddJet - maximum exceeded");
140                 }
141    
142 }
143
144
145 //_______________________________________________________________________
146 void AliEMCALJetFinderOutput::AddParton(AliEMCALParton* parton)
147 {
148 //Add a parton to the array
149         
150 if (fDebug>1) Info("AddParton","Beginning AddParton");
151 if (!fInitialised) InitArrays();
152
153         if (fNPartons < fNMaxPartons){
154                 new(fPartonsArray->AddrAt(fNPartons))  AliEMCALParton( *parton );
155                 fNPartons++;
156         }else
157         {
158                 Error("AddParton","Cannot AddParton - maximum exceeded");
159         }
160  
161 }
162
163 //_______________________________________________________________________
164 void AliEMCALJetFinderOutput::AddParticle(TParticle* particle)
165 {
166 //Add a particle tot he array
167         
168 if (fDebug>1) Info("AddParticle","Beginning AddParticle");
169 if (!fInitialised) InitArrays();
170
171         if (fNParticles < fNMaxParticles){
172                 new(fParticlesArray->AddrAt(fNParticles))  TParticle( *particle );
173                 fNParticles++;
174         }else
175         {
176                 Error("AddParticle","Cannot AddParticle - maximum exceeded");
177                 }
178 }
179
180 //______________________________________________________________________
181 AliEMCALJet* AliEMCALJetFinderOutput::GetJet(Int_t jetID)
182 {
183         // return a jet
184 if (fDebug>1) Info("GetJet","Beginning GetJet");
185         
186   if (jetID >= fNJets) return 0;
187   return (AliEMCALJet*)fJetsArray->At(jetID);
188   
189 }
190
191 //______________________________________________________________________
192 AliEMCALParton* AliEMCALJetFinderOutput::GetParton(Int_t partonID)
193 {
194         //return a parton
195 if (fDebug>1) Info("GetParton","Beginning GetParton");
196
197   if (partonID >= fNPartons) return 0;
198   return (AliEMCALParton*) fPartonsArray->At(partonID);
199 }
200
201 //______________________________________________________________________
202 TParticle* AliEMCALJetFinderOutput::GetParticle(Int_t particleID)
203 {
204 //return a particle
205         
206 if (fDebug>1) Info("GetParticle","Beginning GetParticle");
207
208   if (particleID >= fNParticles) return 0;
209   return (TParticle*) fParticlesArray->At(particleID);
210
211 }
212