Report problems to ATLAS LXR Team (with time and IP address indicated)

The LXR Cross Referencer

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Architecture: linux ]
Version: head ] [ nightly ] [ GaudiDev ]
  Links to LXR source navigation pages for stable releases [ 12.*.* ]   [ 13.*.* ]   [ 14.*.* ]   [ 15.*.* ] 

001 // ================================================
002 //        ClusterMaker class Implementation
003 //
004 //  + PreCluster helper class
005 //
006 // ================================================
007 //
008 // Namespace Atlfast
009 //
010 
011 // This package includes
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 //#include "AtlfastAlgs/TypeRecoverer.h"
025 #include "AtlfastEvent/ContainerDispatcher.h"
026 #include "AtlfastEvent/TypeVisitor.h"
027 
028 #include <cmath> 
029 #include <algorithm>
030 #include <vector>
031 
032 // Gaudi includes
033 #include "GaudiKernel/DataSvc.h"
034 #include "GaudiKernel/ISvcLocator.h"
035 #include "GaudiKernel/MsgStream.h"
036 
037 //Other
038 #include "CLHEP/Vector/LorentzVector.h"
039 
040 namespace Atlfast {
041 
042   /** @brief Creates Atlfast::Clusters from Atlfast::IKinematic inputs.
043    *
044    * ClusterMaking is currently defined as a process which uses Cells
045    * from the TES and forms Clusters from them. The strategy employed
046    * is to sum all Cells in
047    * a given R-cone around an initiator.<BR>
048    * [Note: This might be more correctly called pre-jet
049    * formation as the R-cones are of jet size and therefore this algorithm
050    * does not really correspond to the normal notion of forming
051    * clusters from,say, adjacent energy deposits.]
052    *
053    * @image html ClusterMaker.jpg "ClusterMaker sequence"
054    */
055 
056 
057   //--------------------------------
058   // Constructors and destructors
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     // Setting the parameter defaults.
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; //+.001 avoids grid problem
085     m_overlapThreshold    = 0.75;  // Value currently used by CDF 
086     //=====================
087     m_ktRParameter        = 1.0;
088     m_ktAngle             = "deltaR";
089     m_ktRecomScheme       = "E";
090     m_ktYCut              = 0;
091     //=====================
092     m_rConeBarrel         = 0.401; //+.001 avoids grid problem
093     m_rConeForward        = 0.401;
094     m_minInitiatorET      = 1.5*GeV;
095     m_masslessJets        = true;
096     // Declare the paramemters to Gaudi so that
097     // they can be over-written via the job options file
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   // Destructor
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   // initialise() 
137   //---------------------------------
138   
139   StatusCode ClusterMaker::initialize(){
140  
141    MsgStream log( messageService(), name() ) ;
142    log << MSG::DEBUG<< "Cluster Maker initialising " << endreq;
143  
144    //moved this before TesIO
145    GlobalEventData* ged = GlobalEventData::Instance();
146    m_mcLocation  = ged -> mcLocation();
147 
148    m_tesIO = new TesIO(m_mcLocation, ged->justHardScatter());
149 
150    // Currently pass everything into the FastJet interface
151    // Options Cone and Kt will work here (everything else
152    // defaults to Cone)
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   // finalise() 
219   //---------------------------------
220   
221   StatusCode ClusterMaker::finalize(){
222     return StatusCode::SUCCESS ;
223   }
224   
225 
226   //----------------------------------------------
227   // execute() method called once per event
228   //----------------------------------------------
229   //
230   // This execute method is written to take care of the administration
231   // only (accessing TES, etc).
232   //
233   // The actual clustering strategy is delegated to a further method
234   // (to become an object at some point)
235   //
236   // All Clusters created are output to the TES
237   
238   StatusCode ClusterMaker::execute( ){
239     MsgStream log( messageService(), name() ) ;
240     std::string message;
241     //.........................................................
242     // Extract the elements (cells, tracks..) from the TES 
243     //
244     //copy to vector -cannot use DataVector fo r type change!
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     // Make a containers to store the new Cluster pointers,
261     // and unused elements
262     
263     IClusterCollection* clusters = new IClusterCollection ;
264     IKinematicVector unusedLocalElements;
265 
266     log << MSG::DEBUG << "Starting Clustering Strategy"  << endreq ;
267     
268     // FastJet throws an error when the input elements vector is empty
269     // (spotted in single muon events)
270     if ( elements.size() ) {
271 
272       m_clusterStrategy->makeClusters( 
273                                       log, 
274                                       elements, 
275                                       unusedLocalElements, 
276                                       clusters
277                                       ) ;
278     }
279 
280     //......................................
281     // Set up for conversions of unused IKinematics back to concrete types
282     //
283       log<<MSG::DEBUG
284        <<"Number Of Unused Local Elements "
285          << unusedLocalElements.size()<<endreq;
286     //    TypeRecoverer atr(unusedLocalElements);
287     TypeVisitor types = ContainerDispatcher(
288                                           unusedLocalElements.begin(),
289                                           unusedLocalElements.end(),
290                                           TypeVisitor()
291                                           );
292     //log<<MSG::DEBUG <<"Recovered Types "<<endreq;
293 
294 
295     //Register the newly made clusters
296     stat = m_tesIO -> store(clusters, m_outputLocation);
297     message = stat ?  "Clusters stored":"Failed to store Clusters ";
298     log<<MSG::DEBUG<<message<<endreq;
299     //  Register the any unused IKs if they are Cells
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     //log<<MSG::DEBUG<<"Number Of Unused Cells "<< atr.cells()->size()<<endreq;
305     //  Register the any unused IKs if they are Tracks
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     //log<<MSG::DEBUG<<"Number Of Unused Tracks "<< atr.tracks()->size()<<endreq;
311     return stat ;
312     
313   }
314   
315 } // end of namespace bracket
316 
317 
318 
319 
320 
321 
322 
323 
324 
325 
326 
327 
328 

source navigation ] diff markup ] identifier search ] general search ]

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. Valid HTML 4.01!