1 / 19

Dual-use prototype for analysis tools

Dual-use prototype for analysis tools. ASG tools working group. David Adams BNL October 16 , 2013. Introduction. T rying to understand how to structure run 2 analysis tools Analysis tools must run in both Athena and Root Call these “dual-use”

dunn
Download Presentation

Dual-use prototype for analysis tools

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Dual-use prototype for analysis tools ASG tools working group David Adams BNL October 16, 2013

  2. Introduction Trying to understand how to structure run 2 analysis tools • Analysis tools must run in both Athena and Root • Call these “dual-use” • With minimal code duplication (to ease maintenance) • Jet/Etmiss expanding definition of analysis tools • Any useful tool that can be run without Athena-specific services • Services means geometry, magnetic field, conditions DB • Useful means useful to late-stage analysis, e.g.: • Jet moment calculators: JVF, jet area, … • Association calculators: calo-track, calo-truth, … • Jet finding, grooming, … • Expect tool standards to be specified by the ASG tools working group • Requirements for user interface and tool developers interface • Plus supporting software • Here discuss the current implementation: AsgEx • See theAsgEx Twiki for additional information D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 2013

  3. Tool user requirements Tool interfaces • Different tools have different interfaces • Expect to switch to object (e.g. Jet) based interface • Instead of a long list of floats (pT, eta, NPV, …) • Tools intended to read and write event data can have no arguments • Configured with names of input and output collections Configuration • Users should have means to configure tools in both Athena and ROOT • For Athena, integrate with job options (or keep current syntax) • For Root, nice to have a C++ interface • Also like to have a common Python interface for Athena and Root • Same as current job options? More on this later. • Configuration should support tools using other tools • So individual tools can be simple and interchangeable • Job options support this with ToolHandle as developer interface D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 2013

  4. Tool developer requirements Want to make it easy to develop tools • Not just by expert programmers • Allow development in either Athena or Root • With easy port to the other environment • Implies we should establish coding conventions and provide supporting software to enable the above Configuration • Common means to access the configuration info discussed earlier Event data • Common means to read and write collections in current event • Common way to access the objects in those collections: xAOD Status codes • StatusCode in Root but tools can decide to use or not Logging messages • Enable Athena-like message service and ATH_MSG_XXX macros D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 2013

  5. Prototypes Jet/Etmiss has been developing dual-use prototypes • To help determine requirements (previous pages) • To see what is possible Prototype 1: JetEx • D. Adams talk in September • https://indico.cern.ch/conferenceDisplay.py?confId=271522 • Simple interface with wrappers for Athena • Criticized as too different from Athena Prototype 2: AsgEx • Latest version of this evolving SW described here • Code in SVN: user-dadams/AsgEx (5 packages) • Interface very similar to Athena • declareProperty(), evtStore()->retrieve(), ToolHandle, ATH_MSG_XXX ,… • Requires some supporting software • To give appearance of Athena property and event services in Root D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 2013

  6. AsgEx Python configuration Provide Python-based job configuration in AsgEx • As in Athena—try to use Athena syntax • See example code fragment below • Configures low-level tool JetDumper and then • High-level tool AsgRunner which uses the first tool • Work in progress (PA) to provide the same syntax in Root D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 2013

  7. AsgEx status Status of the AsgEx prototype • Both low- and high-level tool examples working • High-level = tool that uses other configured tools • Same tools (JetDumper, AsgRunner) code run in Athena and Root • Script-generated wrappers provided to allow configuration and event access in Root using Athena interfaces • Athena configuration with standard job options (previous page) • Root configuration with setProperty in C++ • Work in progress to add Python wrapper (job options syntax) • Separate interface and implementation classes (as in Athena) Class diagrams follow • Athena only, AsgEx in Root, AsgEx in Athena • Two example tools: low-level JetDumper, high-level AsgRunner • Legend: White = Athena, Red = ASG support, Green = user-supplied, Blue = automatically-generated Athena wrappers D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 2013

  8. Athena only (run 1 model for comparison) Tool interface Low-level tool High-level tool D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 2013

  9. AsgEx Root classes ASG support, mostly replacements for Athena ToolHandle typedefs Classes supplied by the tool developer D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 2013

  10. AsgEx Athena classes AsgEx general support classes Athena classes ToolHandle typedefs AsgEx Athena toolclasses (generated automatically) D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 2013

  11. Comments on AsgEx Intended to be prototype • Used to identify requirements and aid in design of final system • Propose we use this as the starting point for development • Assuming the user and developer interface are close to what we want • Allow development of physics tools to start very soon • Modular design makes it easy to substitute pieces (e.g. event store) • If we want to re-implement, we should start ASAP Event access is based on JetAnalysisEDM • Subset of jet AOD interface to either AOD or D3PD • Need to switch this to xAOD • When xAOD is available • Do we need/want access to D3PD or AOD with same interface? Python-based configuration under development • Likely to extend PropertyMgr, add ToolSvc • Latter might be nice to have in C++ world D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 2013

  12. Example tool Code follows for an example analysis tool • Creates fast jet inputs from an input collection • E.g. from clusters, tracks or truth particles • Just written yesterday—may have some problems • Illustrates the features of the developer interface • Header and source file on following pages • Code in AsgEx/AsgExJetReco • This package is not (yet) tested in Athena D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 2013

  13. Example tool header 1/2 // PseudoJetGetter.h #ifndefjetreco_PseudoJetGetter #define jetreco_PseudoJetGetter // David Adams // October 2013 // // Tool to fetch pseudo jets. #include "AsgExTool/AsgTool.h" #include "AsgExToolInterface/IProcessTool.h" #include "fastjet/PseudoJet.hh" #include "JetAnalysisEDM/JetDualUseEDMInclude.h" namespace jetreco { class PseudoJetGetter : virtual public asgex::IProcessTool, virtual public asg::AsgTool{ Ctor takes no arguments. From IProcessTool Tool must be in a namespace User interface Configuration parameters Inherit both interface and implementation D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 2013 public: typedefstd::vector<fastjet::PseudoJet> PseudoJetList; // Constructor. PseudoJetGetter(); // Append from a collection to a list of PseudoJets. template<typenameTList> int append(constTList& inputs, PseudoJetList& psjs) const; // Append from named collection to a list of PseudoJets. int appendTo(PseudoJetList& psjs) const; // Append from named input collection to named output collection. int process() const; // Dump to log. void print() const; private: //data // Job options. std::string m_incoll; std::string m_outcoll;

  14. Example tool header 2/2 }; } // end namespace jetreco #ifndef __CINT__ template<typenameTList> int jetreco::PseudoJetGetter:: append(constTList& inputs, PseudoJetList& psjs) const { for ( typenameTList::const_iteratoriinp=inputs.begin(); iinp!=inputs.end(); ++iinp ) { const JetAnalysisEDM::Particle* ppar = *iinp; fastjet::PseudoJetpsj(ppar->px(), ppar->py(), ppar->pz(), ppar->e()); psjs.push_back(psj); } ATH_MSG_DEBUG("After append, PseudoJet count is " << psjs.size()); return 0; } #endif // CINT #endif Templated method: constructs fastjet PseudoVector’s from particles using four-vector interface D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 2013

  15. Example tool source 1/2 // PseudoJetGetter.cxx #include "AsgExJetReco/PseudoJetGetter.h" using jetreco::PseudoJetGetter; //********************************************************************** PseudoJetGetter::PseudoJetGetter() { declareProperty("Input", m_incoll); declareProperty("Output", m_outcoll); } //********************************************************************** int PseudoJetGetter::appendTo(PseudoJetList& psjs) const { ATH_MSG_VERBOSE("Entering appendTo(PseudoJetList)..."); const JetCollection* pjets = 0; StatusCodesc = evtStore()->retrieve(pjets, m_incoll); if ( sc.isFailure() || pjets == 0 ) { ATH_MSG_ERROR("Unable to find input collection: " << m_incoll); return 1; } return append(*pjets, psjs); } Properties declared in ctor Athena-style message logging Data retrieved from event store Athena-style return code D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 2013

  16. Example tool source 2/2 //********************************************************************** int PseudoJetGetter::process() const { ATH_MSG_VERBOSE("Entering process()..."); PseudoJetList* ppsjs; constPseudoJetList* ppsjs_const; ppsjs_const = evtStore()->retrieve<PseudoJetList>(m_outcoll); ppsjs = const_cast<PseudoJetList*>(ppsjs_const); if ( ppsjs == 0 ) { ATH_MSG_VERBOSE("Creating new PseudoJet collection"); ppsjs = new PseudoJetList; evtStore()->record(m_outcoll, ppsjs); } else { ATH_MSG_VERBOSE("Using existing PseudoJet collection"); } return appendTo(*ppsjs); } //********************************************************************** void PseudoJetGetter::print() const { ATH_MSG_INFO(" Input collection: " << m_incoll); ATH_MSG_INFO(" Output collection: " << m_outcoll); ATH_MSG_INFO(" Output level: " << msg_level_name()); } Recording transient data in event store Common tool interface includes print method to show properties D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 2013

  17. Conclusions Dual-use tool example (AsgEx) in place • See the AsgEx Twikifor details • Example tools JetDumper and AsgRunner run in Root and Athena • Syntax very similar to Athena • No #ifdef or CPP macros in tool developer code Plans • ASG working group should decide whether to use AsgEx as the basis for future development or to re-implement • Starting to adding jet reconstruction tools based on AsgEx • New package AsgEx/AsgExJetReco • Migrate to xAOD • When xAOD specified (at least for jets and jet inputs: cluster, track, truth) • And data is available in xAOD or means provided to access common D3PD through xAOD interface • Add Python configuration for Root using Athena job options syntax D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 2013

  18. Extras Updated run 2 jet analysis use cases D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 2013

  19. Run 2 jet analysis use cases D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 2013

More Related