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 **************************************************************************/
16 //---------------------------------------------------------------------
17 // Jet finder analysis class deriving from TSelector
18 // and using AliJetFinder.cxx
19 // manages the search for jets
20 // Author: andreas.morsch@cern.ch
21 //---------------------------------------------------------------------
23 #include <Riostream.h>
26 #include "AliJetSelector.h"
27 #include "AliJetESDReaderHeader.h"
28 #include "AliJetESDReader.h"
29 #include "AliUA1JetHeaderV1.h"
30 #include "AliUA1JetFinderV1.h"
31 #include "AliJetFinder.h"
33 AliJetSelector::AliJetSelector(TTree*):
40 ////////////////////////////////////////////////////////////////////////
42 AliJetSelector::~AliJetSelector()
48 void AliJetSelector::Config()
51 // Configuration goes here
53 printf("JetSelector::Config\n");
54 AliJetESDReaderHeader *jrh = new AliJetESDReaderHeader();
55 jrh->SetComment("Testing");
56 jrh->SetDirectory("/home/morsch/analysis/AliEn/PDC06/");
57 jrh->SetPattern("00");
58 jrh->SetFirstEvent(0);
59 jrh->SetLastEvent(1000);
61 jrh->SetReadSignalOnly(kFALSE);
62 // Define reader and set its header
63 AliJetESDReader *er = new AliJetESDReader();
64 er->SetReaderHeader(jrh);
68 AliUA1JetHeaderV1 *jh=new AliUA1JetHeaderV1();
69 jh->SetComment("UA1 jet code with default parameters");
73 jh->SetLegoNbinPhi(420.);
74 jh->SetLegoNbinEta(120.);
75 jh->SetLegoEtaMin(-1.9);
76 jh->SetLegoEtaMax(+1.9);
79 // Define jet finder. Set its header and reader
80 fJetFinder = new AliUA1JetFinderV1();
81 fJetFinder->SetJetHeader(jh);
82 fJetFinder->SetJetReader(er);
83 fJetFinder->SetPlotMode(kTRUE);
84 fJetFinder->SetOutputFile("jets.root");
88 void AliJetSelector::Begin(TTree*)
90 // The Begin() function is called at the start of the query.
91 // When running with PROOF Begin() is only called on the client.
92 // The tree argument is deprecated (on PROOF 0 is passed).
93 printf("JetSelector::Begin \n");
94 TString option = GetOption();
97 void AliJetSelector::SlaveBegin(TTree* tree)
99 // The SlaveBegin() function is called after the Begin() function.
100 // When running with PROOF SlaveBegin() is called on each slave server.
101 // The tree argument is deprecated (on PROOF 0 is passed).
102 printf("JetSelector::SlaveBegin \n");
107 // Initialize Jet Finder
110 fJetFinder->ConnectTree(tree);
112 fJetFinder->WriteHeaders();
115 void AliJetSelector::Init(TTree* tree)
118 // Here the chain has to be assigned to the reader
120 printf("JetSelector::Init \n");
123 Bool_t AliJetSelector::Notify()
125 // The Notify() function is called when a new file is opened. This
126 // can be either for a new TTree in a TChain or when when a new TTree
127 // is started when using PROOF. Typically here the branch pointers
128 // will be retrieved. It is normaly not necessary to make changes
129 // to the generated code, but the routine can be extended by the
131 printf("JetSelector::Notify \n");
135 Bool_t AliJetSelector::Process(Long64_t entry)
137 // The Process() function is called for each entry in the tree (or possibly
138 // keyed object in the case of PROOF) to be processed. The entry argument
139 // specifies which entry in the currently loaded tree is to be processed.
140 // It can be passed to either TTree::GetEntry() or TBranch::GetEntry()
141 // to read either all or the required parts of the data. When processing
142 // keyed objects with PROOF, the object is already loaded and is available
143 // via the fObject pointer.
145 // This function should contain the "body" of the analysis. It can contain
146 // simple or elaborate selection criteria, run algorithms on the data
147 // of the event and typically fill histograms.
149 // WARNING when a selector is used with a TChain, you must use
150 // the pointer to the current TTree to call GetEntry(entry).
151 // The entry is always the local entry number in the current tree.
152 // Assuming that fChain is the pointer to the TChain being processed,
153 // use fChain->GetEntry(entry).
154 printf("JetSelector::Process \n");
155 return (fJetFinder->ProcessEvent(entry));
158 void AliJetSelector::SlaveTerminate()
161 fJetFinder->FinishRun();
164 void AliJetSelector::Terminate()