]>
Commit | Line | Data |
---|---|---|
4cfe53c1 | 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 | // 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 | //--------------------------------------------------------------------- | |
22 | ||
23 | #include <Riostream.h> | |
24 | #include <TTree.h> | |
25 | #include <TFile.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" | |
32 | ||
33 | AliJetSelector::AliJetSelector(TTree*): | |
34 | TSelector(), | |
35 | fJetFinder(0) | |
36 | { | |
37 | // Constructor | |
38 | } | |
39 | ||
40 | //////////////////////////////////////////////////////////////////////// | |
41 | ||
42 | AliJetSelector::~AliJetSelector() | |
43 | { | |
44 | // destructor | |
45 | delete fJetFinder; | |
46 | } | |
47 | ||
48 | void AliJetSelector::Config() | |
49 | { | |
50 | // | |
51 | // Configuration goes here | |
52 | // | |
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); | |
60 | jrh->SetPtCut(0.); | |
61 | jrh->SetReadSignalOnly(kFALSE); | |
62 | // Define reader and set its header | |
63 | AliJetESDReader *er = new AliJetESDReader(); | |
64 | er->SetReaderHeader(jrh); | |
65 | ||
66 | ||
67 | // Define jet header | |
68 | AliUA1JetHeaderV1 *jh=new AliUA1JetHeaderV1(); | |
69 | jh->SetComment("UA1 jet code with default parameters"); | |
70 | jh->BackgMode(0); | |
71 | jh->SetRadius(1.0); | |
72 | jh->SetEtSeed(2.); | |
73 | jh->SetLegoNbinPhi(420.); | |
74 | jh->SetLegoNbinEta(120.); | |
75 | jh->SetLegoEtaMin(-1.9); | |
76 | jh->SetLegoEtaMax(+1.9); | |
77 | jh->SetMinJetEt(5.); | |
78 | ||
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"); | |
85 | } | |
86 | ||
87 | ||
88 | void AliJetSelector::Begin(TTree*) | |
89 | { | |
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(); | |
95 | } | |
96 | ||
97 | void AliJetSelector::SlaveBegin(TTree* tree) | |
98 | { | |
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"); | |
103 | // TSelector::Init | |
104 | Init(tree); | |
105 | // Configuration | |
106 | Config(); | |
107 | // Initialize Jet Finder | |
108 | fJetFinder->Init(); | |
109 | // Connect Tree | |
110 | fJetFinder->ConnectTree(tree); | |
111 | // Write the headers | |
112 | fJetFinder->WriteHeaders(); | |
113 | } | |
114 | ||
115 | void AliJetSelector::Init(TTree* tree) | |
116 | { | |
117 | // | |
118 | // Here the chain has to be assigned to the reader | |
119 | // | |
120 | printf("JetSelector::Init \n"); | |
121 | } | |
122 | ||
123 | Bool_t AliJetSelector::Notify() | |
124 | { | |
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 | |
130 | // user if needed. | |
131 | printf("JetSelector::Notify \n"); | |
132 | return kTRUE; | |
133 | } | |
134 | ||
135 | Bool_t AliJetSelector::Process(Long64_t entry) | |
136 | { | |
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. | |
144 | // | |
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. | |
148 | ||
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)); | |
156 | } | |
157 | ||
158 | void AliJetSelector::SlaveTerminate() | |
159 | { | |
160 | // Finish the run | |
161 | fJetFinder->FinishRun(); | |
162 | } | |
163 | ||
164 | void AliJetSelector::Terminate() | |
165 | { | |
166 | } | |
167 |