001
002
003
004
005
006
007
008
009
010
011
012 #include "AtlfastAlgs/ClusterMaker.h"
013 #include "AtlfastAlgs/ClusterConeStrategy.h"
014 #include "AtlfastAlgs/ClusterFastJetStrategy.h"
015 #include "AtlfastUtils/FunctionObjects.h"
016 #include "AtlfastUtils/HeaderPrinter.h"
017 #include "AtlfastEvent/Cell.h"
018 #include "AtlfastEvent/TwoCptCell.h"
019 #include "AtlfastEvent/ITwoCptCell.h"
020 #include "AtlfastEvent/Cluster.h"
021 #include "AtlfastUtils/IClusterStrategy.h"
022 #include "AtlfastUtils/TesIO.h"
023 #include "AtlfastAlgs/GlobalEventData.h"
024
025 #include "AtlfastEvent/ContainerDispatcher.h"
026 #include "AtlfastEvent/TypeVisitor.h"
027
028 #include <cmath>
029 #include <algorithm>
030 #include <vector>
031
032
033 #include "GaudiKernel/DataSvc.h"
034 #include "GaudiKernel/ISvcLocator.h"
035 #include "GaudiKernel/MsgStream.h"
036
037
038 #include "CLHEP/Vector/LorentzVector.h"
039
040 namespace Atlfast {
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061 ClusterMaker::ClusterMaker
062 ( const std::string& name, ISvcLocator* pSvcLocator )
063 : Algorithm( name, pSvcLocator ),
064 m_clusterStrategy(0),
065 m_tesIO(0)
066 {
067 m_allowedStrategies.push_back("LegacyCone");
068 m_allowedStrategies.push_back("Cone");
069 m_allowedStrategies.push_back("Kt");
070 m_allowedStrategies.push_back("Cam");
071 m_allowedStrategies.push_back("AntiKt");
072
073
074 m_minClusterET = 5.0*GeV;
075 m_processCells = true;
076 m_processTracks = false;
077 m_inputCellLocation = "/Event/AtlfastCells" ;
078 m_inputTrackLocation = "/Event/AtlfastTracks" ;
079 m_outputLocation = "/Event/AtlfastClusters";
080 m_unusedCellLocation = "/Event/AtlfastUnusedCells";
081 m_unusedTrackLocation = "/Event/AtlfastUnusedTracks";
082 m_strategy = "Cone";
083
084 m_rCone = 0.401;
085 m_overlapThreshold = 0.75;
086
087 m_ktRParameter = 1.0;
088 m_ktAngle = "deltaR";
089 m_ktRecomScheme = "E";
090 m_ktYCut = 0;
091
092 m_rConeBarrel = 0.401;
093 m_rConeForward = 0.401;
094 m_minInitiatorET = 1.5*GeV;
095 m_masslessJets = true;
096
097
098
099 declareProperty( "minClusterET", m_minClusterET ) ;
100 declareProperty( "Strategy", m_strategy ) ;
101 declareProperty( "ProcessCells", m_processCells ) ;
102 declareProperty( "ProcessTracks", m_processTracks ) ;
103 declareProperty( "InputCellLocation", m_inputCellLocation ) ;
104 declareProperty( "InputTrackLocation", m_inputTrackLocation ) ;
105 declareProperty( "OutputLocation", m_outputLocation ) ;
106 declareProperty( "UnusedCellLocation", m_unusedCellLocation ) ;
107 declareProperty( "UnusedTrackLocation", m_unusedTrackLocation ) ;
108
109 declareProperty( "RCone", m_rCone ) ;
110 declareProperty( "OverlapThreshold", m_overlapThreshold ) ;
111
112 declareProperty( "KtRParameter", m_ktRParameter ) ;
113 declareProperty( "KtAngle", m_ktAngle ) ;
114 declareProperty( "KtRecomScheme", m_ktRecomScheme ) ;
115 declareProperty( "KtYCut", m_ktYCut ) ;
116
117 declareProperty( "RConeBarrel", m_rConeBarrel ) ;
118 declareProperty( "RConeForward", m_rConeForward ) ;
119 declareProperty( "minInitiatorET", m_minInitiatorET ) ;
120 declareProperty( "MasslessJets", m_masslessJets ) ;
121
122 }
123
124
125 ClusterMaker::~ClusterMaker() {
126 if(m_tesIO){
127 delete m_tesIO;
128 }
129 if(m_clusterStrategy){
130 delete m_clusterStrategy;
131 }
132 }
133
134
135
136
137
138
139 StatusCode ClusterMaker::initialize(){
140
141 MsgStream log( messageService(), name() ) ;
142 log << MSG::DEBUG<< "Cluster Maker initialising " << endreq;
143
144
145 GlobalEventData* ged = GlobalEventData::Instance();
146 m_mcLocation = ged -> mcLocation();
147
148 m_tesIO = new TesIO(m_mcLocation, ged->justHardScatter());
149
150
151
152
153 if(std::find(m_allowedStrategies.begin(),
154 m_allowedStrategies.end(),
155 m_strategy)==m_allowedStrategies.end()){
156
157 log << MSG::ERROR << "The requested clustering strategy '"<<m_strategy<<"' is not recognised!"<<endreq;
158 log << MSG::ERROR << "Please ensure you have requested one of the following: LegacyCone"<<endreq;
159 log << MSG::ERROR << " (case sensitive) Cone "<<endreq;
160 log << MSG::ERROR << " Kt "<<endreq;
161 log << MSG::ERROR << " Cam "<<endreq;
162 log << MSG::ERROR << " AntiKt "<<endreq;
163 return StatusCode::FAILURE;
164 }
165 if(m_strategy == "LegacyCone"){
166 m_clusterStrategy = new ClusterConeStrategy(
167 m_rConeBarrel,
168 m_rConeForward,
169 m_minInitiatorET,
170 m_minClusterET,
171 m_masslessJets);
172 }
173 else{
174 m_clusterStrategy = new ClusterFastJetStrategy( m_strategy,
175 m_rCone,
176 m_overlapThreshold,
177 m_minClusterET,
178 m_ktRParameter,
179 m_ktAngle,
180 m_ktRecomScheme,
181 m_ktYCut);
182 }
183 HeaderPrinter hp("Atlfast Cluster Maker:", log);
184 hp.add("Cluster Strategy ", m_strategy);
185 if(m_strategy == "Kt"){
186 hp.add( "Kt R-Parameter ", m_ktRParameter ) ;
187 hp.add( "Kt Angle ", m_ktAngle ) ;
188 hp.add( "Kt Recombination Scheme ", m_ktRecomScheme ) ;
189 hp.add( "Kt Y-Merge value ", m_ktYCut ) ;
190 }
191 else if(m_strategy == "LegacyCone"){
192 hp.add("Endcap Cone Size ", m_rConeForward);
193 hp.add("Barrel Cone Size ", m_rConeBarrel);
194 hp.add("Min ET for Cell initiator ", m_minInitiatorET);
195 hp.add("Massless Jets ", m_masslessJets);
196 }
197 else{
198 hp.add("Cone Size ", m_rCone);
199 }
200 hp.add("Min ET for cluster ", m_minClusterET);
201 hp.add("Process Cells ", m_processCells);
202 hp.add("Process Tracks ", m_processTracks);
203 if(m_processCells){
204 hp.add("Input CellLocation ", m_inputCellLocation);
205 }
206 if(m_processTracks) {
207 hp.add("Input TrackLocation ", m_inputTrackLocation);
208 }
209 hp.add("Output Location ", m_outputLocation);
210 hp.add("Unused Cell Location ", m_unusedCellLocation);
211 hp.add("Unused Track Location ", m_unusedTrackLocation);
212 hp.print();
213
214 return StatusCode::SUCCESS ;
215 }
216
217
218
219
220
221 StatusCode ClusterMaker::finalize(){
222 return StatusCode::SUCCESS ;
223 }
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238 StatusCode ClusterMaker::execute( ){
239 MsgStream log( messageService(), name() ) ;
240 std::string message;
241
242
243
244
245 std::vector<IKinematic*> elements;
246
247 TesIoStat stat;
248 if(m_processCells){
249 stat = m_tesIO->copy<ITwoCptCellCollection>(elements,
250 m_inputCellLocation);
251 message = stat? "Found Cells in TES":"No Cells found in TES";
252 log<<MSG::DEBUG << message <<" "<<elements.size()<<endreq;
253 }
254 if(m_processTracks){
255 stat = m_tesIO->copy<TrackCollection>(elements, m_inputTrackLocation);
256 message = stat? "Found Tracks in TES":"No Tracks found in TES";
257 log<<MSG::DEBUG << message <<" "<<elements.size()<<endreq;
258 }
259
260
261
262
263 IClusterCollection* clusters = new IClusterCollection ;
264 IKinematicVector unusedLocalElements;
265
266 log << MSG::DEBUG << "Starting Clustering Strategy" << endreq ;
267
268
269
270 if ( elements.size() ) {
271
272 m_clusterStrategy->makeClusters(
273 log,
274 elements,
275 unusedLocalElements,
276 clusters
277 ) ;
278 }
279
280
281
282
283 log<<MSG::DEBUG
284 <<"Number Of Unused Local Elements "
285 << unusedLocalElements.size()<<endreq;
286
287 TypeVisitor types = ContainerDispatcher(
288 unusedLocalElements.begin(),
289 unusedLocalElements.end(),
290 TypeVisitor()
291 );
292
293
294
295
296 stat = m_tesIO -> store(clusters, m_outputLocation);
297 message = stat ? "Clusters stored":"Failed to store Clusters ";
298 log<<MSG::DEBUG<<message<<endreq;
299
300 stat = m_tesIO -> store(new TwoCptCellVector(types.typeVector(TwoCptCell())),
301 m_unusedCellLocation);
302 message =stat? "unused cells stored":"unused cells store failed";
303 log<<MSG::DEBUG<<message<<endreq;
304
305
306 stat = m_tesIO -> store(new TrackVector(types.typeVector(Track())),
307 m_unusedTrackLocation);
308 message =stat? "unused tracks stored":"unused cells store failed";
309 log<<MSG::DEBUG<<message<<endreq;
310
311 return stat ;
312
313 }
314
315 }
316
317
318
319
320
321
322
323
324
325
326
327
328
| Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems |
|
This page was automatically generated by the
LXR engine.
|
|