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 **************************************************************************/
18 //---------------------------------------------------------------------
19 // Jet finder base class
20 // manages the search for jets
21 // Authors: jgcn@mda.cinvestav.mx
22 // andreas.morsch@cern.ch
23 // magali.estienne@subatech.in2p3.fr
24 //---------------------------------------------------------------------
26 #include <Riostream.h>
29 #include "AliJetFinder.h"
30 #include "AliAODJet.h"
31 #include "AliAODEvent.h"
32 #include "AliJetUnitArray.h"
33 #include "AliJetReaderHeader.h"
34 #include "AliJetHeader.h"
35 #include "AliJetReader.h"
36 #include "AliAODJetEventBackground.h"
38 ClassImp(AliJetFinder)
40 AliJetFinder::AliJetFinder():
53 ////////////////////////////////////////////////////////////////////////
54 AliJetFinder::~AliJetFinder()
63 ////////////////////////////////////////////////////////////////////////
64 void AliJetFinder::WriteRHeaderToFile()
66 // write reader header
67 AliJetReaderHeader *rh = fReader->GetReaderHeader();
72 ////////////////////////////////////////////////////////////////////////
73 void AliJetFinder::ConnectTree(TTree* tree, TObject* data)
75 // Connect the input file
76 fReader->ConnectTree(tree, data);
79 ////////////////////////////////////////////////////////////////////////
80 void AliJetFinder::WriteHeaders()
83 TFile* f = new TFile("jets_local.root", "recreate");
89 ////////////////////////////////////////////////////////////////////////
90 Bool_t AliJetFinder::ProcessEvent()
97 Bool_t ok = fReader->FillMomentumArray();
98 if (!ok) return kFALSE;
105 ////////////////////////////////////////////////////////////////////////
106 Bool_t AliJetFinder::ProcessEvent2()
110 // Charged only or charged+neutral jets
113 TRefArray* ref = new TRefArray();
114 Bool_t procid = kFALSE;
115 Bool_t ok = fReader->ExecTasks(procid,ref);
117 // Delete reference pointer
118 if (!ok) {delete ref; return kFALSE;}
122 Int_t nEntRef = ref->GetEntries();
124 for(Int_t i=0; i<nEntRef; i++)
126 // Reset the UnitArray content which were referenced
127 ((AliJetUnitArray*)ref->At(i))->SetUnitTrackID(0);
128 ((AliJetUnitArray*)ref->At(i))->SetUnitEnergy(0.);
129 ((AliJetUnitArray*)ref->At(i))->SetUnitCutFlag(kPtSmaller);
130 ((AliJetUnitArray*)ref->At(i))->SetUnitCutFlag2(kPtSmaller);
131 ((AliJetUnitArray*)ref->At(i))->SetUnitSignalFlag(kBad);
132 ((AliJetUnitArray*)ref->At(i))->SetUnitSignalFlagC(kTRUE,kBad);
133 ((AliJetUnitArray*)ref->At(i))->SetUnitDetectorFlag(kTpc);
134 ((AliJetUnitArray*)ref->At(i))->SetUnitFlag(kOutJet);
135 ((AliJetUnitArray*)ref->At(i))->ClearUnitTrackRef();
138 AliJetUnitArray* uA = (AliJetUnitArray*)ref->At(i);
139 uA->ResetBit(kIsReferenced);
143 // Delete the reference pointer
153 void AliJetFinder::AddJet(AliAODJet p)
155 // Add new jet to the list
156 new ((*fAODjets)[fNAODjets++]) AliAODJet(p);
159 void AliJetFinder::ConnectAOD(AliAODEvent* aod)
161 // Connect to the AOD
162 fAODjets = aod->GetJets();
163 fAODEvBkg = (AliAODJetEventBackground*)(aod->FindListObject(AliAODJetEventBackground::StdBranchName()));
166 ////////////////////////////////////////////////////////////////////////
167 void AliJetFinder::ConnectAODNonStd(AliAODEvent* aod,const char *bname)
170 fAODjets = dynamic_cast<TClonesArray*>(aod->FindListObject(bname));
171 fAODEvBkg = (AliAODJetEventBackground*)(aod->FindListObject(Form("%s_%s",AliAODJetEventBackground::StdBranchName(),bname)));
172 // how is this is reset? Cleared? -> by the UserExec!!