]> git.uio.no Git - u/mrichter/AliRoot.git/blame - JETAN/AliJetFinder.cxx
Obsolete code removed.
[u/mrichter/AliRoot.git] / JETAN / AliJetFinder.cxx
CommitLineData
99e5fe42 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 **************************************************************************/
83a444b1 15
52ff852a 16/* $Id$ */
17
99e5fe42 18//---------------------------------------------------------------------
19// Jet finder base class
20// manages the search for jets
7d0f353c 21// Authors: jgcn@mda.cinvestav.mx
22// andreas.morsch@cern.ch
8838ab7a 23// magali.estienne@subatech.in2p3.fr
99e5fe42 24//---------------------------------------------------------------------
25
26#include <Riostream.h>
27#include <TFile.h>
1d27ecd2 28
99e5fe42 29#include "AliJetFinder.h"
1d27ecd2 30#include "AliAODJet.h"
1d27ecd2 31#include "AliAODEvent.h"
8838ab7a 32#include "AliJetUnitArray.h"
99e5fe42 33
be6e5811 34class TProcessID;
35class TClonesArray;
36
99e5fe42 37ClassImp(AliJetFinder)
38
1b7d5d7e 39AliJetFinder::AliJetFinder():
7d0f353c 40 fReader(0x0),
19e6695b 41 fHeader(0x0),
1d27ecd2 42 fAODjets(0x0),
42b0ac89 43 fNAODjets(0)
99e5fe42 44{
8838ab7a 45 //
99e5fe42 46 // Constructor
8838ab7a 47 //
1d27ecd2 48 fAODjets = 0;
99e5fe42 49}
50
99e5fe42 51////////////////////////////////////////////////////////////////////////
99e5fe42 52AliJetFinder::~AliJetFinder()
53{
8838ab7a 54 //
55 // Destructor
56 //
99e5fe42 57}
58
99e5fe42 59
99e5fe42 60
61////////////////////////////////////////////////////////////////////////
99e5fe42 62void AliJetFinder::WriteRHeaderToFile()
63{
64 // write reader header
76c48857 65 AliJetReaderHeader *rh = fReader->GetReaderHeader();
66 rh->Write();
99e5fe42 67}
68
7d0f353c 69
8838ab7a 70////////////////////////////////////////////////////////////////////////
f3f3617d 71void AliJetFinder::ConnectTree(TTree* tree, TObject* data)
7d0f353c 72{
73 // Connect the input file
f3f3617d 74 fReader->ConnectTree(tree, data);
7d0f353c 75}
76
8838ab7a 77////////////////////////////////////////////////////////////////////////
7d0f353c 78void AliJetFinder::WriteHeaders()
79{
80 // Write the Headers
76c48857 81 TFile* f = new TFile("jets_local.root", "recreate");
82 WriteRHeaderToFile();
83 WriteJHeaderToFile();
84 f->Close();
7d0f353c 85}
86
8838ab7a 87////////////////////////////////////////////////////////////////////////
ae24a5a1 88Bool_t AliJetFinder::ProcessEvent()
7d0f353c 89{
8838ab7a 90 //
91 // Process one event
92 // Charged only jets
93 //
94
95 Bool_t ok = fReader->FillMomentumArray();
96 if (!ok) return kFALSE;
8838ab7a 97 // Jets
98 FindJets(); // V1
8838ab7a 99 Reset();
100 return kTRUE;
7d0f353c 101}
102
8838ab7a 103////////////////////////////////////////////////////////////////////////
104Bool_t AliJetFinder::ProcessEvent2()
105{
106 //
107 // Process one event
108 // Charged only or charged+neutral jets
109 //
110
111 TRefArray* ref = new TRefArray();
112 Bool_t procid = kFALSE;
113 Bool_t ok = fReader->ExecTasks(procid,ref);
114
115 // Delete reference pointer
116 if (!ok) {delete ref; return kFALSE;}
8838ab7a 117 // Jets
118 FindJets();
119
42b0ac89 120 Int_t nEntRef = ref->GetEntries();
8838ab7a 121
122 for(Int_t i=0; i<nEntRef; i++)
123 {
124 // Reset the UnitArray content which were referenced
125 ((AliJetUnitArray*)ref->At(i))->SetUnitTrackID(0);
126 ((AliJetUnitArray*)ref->At(i))->SetUnitEnergy(0.);
127 ((AliJetUnitArray*)ref->At(i))->SetUnitCutFlag(kPtSmaller);
128 ((AliJetUnitArray*)ref->At(i))->SetUnitCutFlag2(kPtSmaller);
8838ab7a 129 ((AliJetUnitArray*)ref->At(i))->SetUnitSignalFlag(kBad);
be6e5811 130 ((AliJetUnitArray*)ref->At(i))->SetUnitSignalFlagC(kTRUE,kBad);
8838ab7a 131 ((AliJetUnitArray*)ref->At(i))->SetUnitDetectorFlag(kTpc);
132 ((AliJetUnitArray*)ref->At(i))->SetUnitFlag(kOutJet);
be6e5811 133 ((AliJetUnitArray*)ref->At(i))->ClearUnitTrackRef();
8838ab7a 134
135 // Reset process ID
136 AliJetUnitArray* uA = (AliJetUnitArray*)ref->At(i);
137 uA->ResetBit(kIsReferenced);
138 uA->SetUniqueID(0);
139 }
140
141 // Delete the reference pointer
142 ref->Delete();
143 delete ref;
144
8838ab7a 145 Reset();
146
147 return kTRUE;
148}
149
7d0f353c 150
1d27ecd2 151void AliJetFinder::AddJet(AliAODJet p)
152{
8838ab7a 153// Add new jet to the list
1d27ecd2 154 new ((*fAODjets)[fNAODjets++]) AliAODJet(p);
155}
156
157void AliJetFinder::ConnectAOD(AliAODEvent* aod)
158{
159// Connect to the AOD
1d27ecd2 160 fAODjets = aod->GetJets();
1d27ecd2 161}
4aa71b6f 162
8838ab7a 163////////////////////////////////////////////////////////////////////////
4aa71b6f 164void AliJetFinder::ConnectAODNonStd(AliAODEvent* aod,const char *bname)
165{
166
167 fAODjets = dynamic_cast<TClonesArray*>(aod->FindListObject(bname));
168 // how is this is reset? Cleared?
169}
8838ab7a 170