]>
Commit | Line | Data |
---|---|---|
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" |
952b368c | 33 | #include "AliJetReaderHeader.h" |
34 | #include "AliJetHeader.h" | |
35 | #include "AliJetReader.h" | |
b8bf1e90 | 36 | #include "AliAODJetEventBackground.h" |
be6e5811 | 37 | |
99e5fe42 | 38 | ClassImp(AliJetFinder) |
39 | ||
1b7d5d7e | 40 | AliJetFinder::AliJetFinder(): |
7d0f353c | 41 | fReader(0x0), |
19e6695b | 42 | fHeader(0x0), |
1d27ecd2 | 43 | fAODjets(0x0), |
952b368c | 44 | fNAODjets(0), |
45 | fAODEvBkg(0) | |
99e5fe42 | 46 | { |
8838ab7a | 47 | // |
99e5fe42 | 48 | // Constructor |
8838ab7a | 49 | // |
1d27ecd2 | 50 | fAODjets = 0; |
99e5fe42 | 51 | } |
52 | ||
99e5fe42 | 53 | //////////////////////////////////////////////////////////////////////// |
99e5fe42 | 54 | AliJetFinder::~AliJetFinder() |
55 | { | |
8838ab7a | 56 | // |
57 | // Destructor | |
58 | // | |
99e5fe42 | 59 | } |
60 | ||
99e5fe42 | 61 | |
99e5fe42 | 62 | |
63 | //////////////////////////////////////////////////////////////////////// | |
99e5fe42 | 64 | void AliJetFinder::WriteRHeaderToFile() |
65 | { | |
66 | // write reader header | |
76c48857 | 67 | AliJetReaderHeader *rh = fReader->GetReaderHeader(); |
68 | rh->Write(); | |
99e5fe42 | 69 | } |
70 | ||
7d0f353c | 71 | |
8838ab7a | 72 | //////////////////////////////////////////////////////////////////////// |
f3f3617d | 73 | void AliJetFinder::ConnectTree(TTree* tree, TObject* data) |
7d0f353c | 74 | { |
75 | // Connect the input file | |
f3f3617d | 76 | fReader->ConnectTree(tree, data); |
7d0f353c | 77 | } |
78 | ||
8838ab7a | 79 | //////////////////////////////////////////////////////////////////////// |
7d0f353c | 80 | void AliJetFinder::WriteHeaders() |
81 | { | |
82 | // Write the Headers | |
76c48857 | 83 | TFile* f = new TFile("jets_local.root", "recreate"); |
84 | WriteRHeaderToFile(); | |
85 | WriteJHeaderToFile(); | |
86 | f->Close(); | |
7d0f353c | 87 | } |
88 | ||
8838ab7a | 89 | //////////////////////////////////////////////////////////////////////// |
ae24a5a1 | 90 | Bool_t AliJetFinder::ProcessEvent() |
7d0f353c | 91 | { |
8838ab7a | 92 | // |
93 | // Process one event | |
94 | // Charged only jets | |
95 | // | |
96 | ||
97 | Bool_t ok = fReader->FillMomentumArray(); | |
98 | if (!ok) return kFALSE; | |
8838ab7a | 99 | // Jets |
100 | FindJets(); // V1 | |
8838ab7a | 101 | Reset(); |
102 | return kTRUE; | |
7d0f353c | 103 | } |
104 | ||
8838ab7a | 105 | //////////////////////////////////////////////////////////////////////// |
106 | Bool_t AliJetFinder::ProcessEvent2() | |
107 | { | |
108 | // | |
109 | // Process one event | |
110 | // Charged only or charged+neutral jets | |
111 | // | |
112 | ||
113 | TRefArray* ref = new TRefArray(); | |
114 | Bool_t procid = kFALSE; | |
115 | Bool_t ok = fReader->ExecTasks(procid,ref); | |
116 | ||
117 | // Delete reference pointer | |
118 | if (!ok) {delete ref; return kFALSE;} | |
8838ab7a | 119 | // Jets |
120 | FindJets(); | |
121 | ||
42b0ac89 | 122 | Int_t nEntRef = ref->GetEntries(); |
8838ab7a | 123 | |
124 | for(Int_t i=0; i<nEntRef; i++) | |
125 | { | |
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); | |
8838ab7a | 131 | ((AliJetUnitArray*)ref->At(i))->SetUnitSignalFlag(kBad); |
be6e5811 | 132 | ((AliJetUnitArray*)ref->At(i))->SetUnitSignalFlagC(kTRUE,kBad); |
8838ab7a | 133 | ((AliJetUnitArray*)ref->At(i))->SetUnitDetectorFlag(kTpc); |
134 | ((AliJetUnitArray*)ref->At(i))->SetUnitFlag(kOutJet); | |
be6e5811 | 135 | ((AliJetUnitArray*)ref->At(i))->ClearUnitTrackRef(); |
8838ab7a | 136 | |
137 | // Reset process ID | |
138 | AliJetUnitArray* uA = (AliJetUnitArray*)ref->At(i); | |
139 | uA->ResetBit(kIsReferenced); | |
140 | uA->SetUniqueID(0); | |
141 | } | |
142 | ||
143 | // Delete the reference pointer | |
144 | ref->Delete(); | |
145 | delete ref; | |
146 | ||
8838ab7a | 147 | Reset(); |
148 | ||
149 | return kTRUE; | |
150 | } | |
151 | ||
7d0f353c | 152 | |
1d27ecd2 | 153 | void AliJetFinder::AddJet(AliAODJet p) |
154 | { | |
8838ab7a | 155 | // Add new jet to the list |
1d27ecd2 | 156 | new ((*fAODjets)[fNAODjets++]) AliAODJet(p); |
157 | } | |
158 | ||
159 | void AliJetFinder::ConnectAOD(AliAODEvent* aod) | |
160 | { | |
161 | // Connect to the AOD | |
1d27ecd2 | 162 | fAODjets = aod->GetJets(); |
bcec7a80 | 163 | fAODEvBkg = (AliAODJetEventBackground*)(aod->FindListObject(AliAODJetEventBackground::StdBranchName())); |
1d27ecd2 | 164 | } |
4aa71b6f | 165 | |
8838ab7a | 166 | //////////////////////////////////////////////////////////////////////// |
4aa71b6f | 167 | void AliJetFinder::ConnectAODNonStd(AliAODEvent* aod,const char *bname) |
168 | { | |
169 | ||
170 | fAODjets = dynamic_cast<TClonesArray*>(aod->FindListObject(bname)); | |
bcec7a80 | 171 | fAODEvBkg = (AliAODJetEventBackground*)(aod->FindListObject(Form("%s_%s",AliAODJetEventBackground::StdBranchName(),bname))); |
172 | // how is this is reset? Cleared? -> by the UserExec!! | |
4aa71b6f | 173 | } |
8838ab7a | 174 |