Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Dual-use prototype for analysis tools David Adams BNL October 16, 2013 ASG tools working group."— Presentation transcript:

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

2 Introduction Trying to understand how to structure run 2 analysis tools Analysis tools must run in both Athena and Root o Call these “dual-use” o With minimal code duplication (to ease maintenance) Jet/Etmiss expanding definition of analysis tools o Any useful tool that can be run without Athena-specific services o Services means geometry, magnetic field, conditions DB o 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 o Requirements for user interface and tool developers interface o Plus supporting software Here discuss the current implementation: AsgEx o See the AsgEx Twiki for additional informationAsgEx Twiki D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 20132

3 Tool user requirements Tool interfaces Different tools have different interfaces Expect to switch to object (e.g. Jet) based interface o Instead of a long list of floats (pT, eta, NPV, …) Tools intended to read and write event data can have no arguments o Configured with names of input and output collections Configuration Users should have means to configure tools in both Athena and ROOT o 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 o Same as current job options? More on this later. Configuration should support tools using other tools o So individual tools can be simple and interchangeable o 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, 20133

4 Tool developer requirements Want to make it easy to develop tools Not just by expert programmers Allow development in either Athena or Root o 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, 20134

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 o https://indico.cern.ch/conferenceDisplay.py?confId=271522 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 o declareProperty(), evtStore()->retrieve(), ToolHandle, ATH_MSG_XXX,… Requires some supporting software o 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, 20135

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

7 AsgEx status Status of the AsgEx prototype Both low- and high-level tool examples working o High-level = tool that uses other configured tools o Same tools (JetDumper, AsgRunner) code run in Athena and Root o 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++ o 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, 20137

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

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

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

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 o Assuming the user and developer interface are close to what we want o Allow development of physics tools to start very soon o Modular design makes it easy to substitute pieces (e.g. event store) o 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 o When xAOD is available o 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, 201311

12 Example tool Code follows for an example analysis tool Creates fast jet inputs from an input collection o 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 o 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, 201312

13 Example tool header 1/2 // PseudoJetGetter.h #ifndef jetreco_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 { D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 201313 public: typedef std::vector PseudoJetList; // Constructor. PseudoJetGetter(); // Append from a collection to a list of PseudoJets. template int append(const TList& 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; Tool must be in a namespace Inherit both interface and implementation Ctor takes no arguments. User interface Configuration parameters From IProcessTool

14 Example tool header 2/2 }; } // end namespace jetreco #ifndef __CINT__ template int jetreco::PseudoJetGetter:: append(const TList& inputs, PseudoJetList& psjs) const { for ( typename TList::const_iterator iinp=inputs.begin(); iinp!=inputs.end(); ++iinp ) { const JetAnalysisEDM::Particle* ppar = *iinp; fastjet::PseudoJet psj(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 D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 201314 Templated method: constructs fastjet PseudoVector’s from particles using four-vector interface

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; StatusCode sc = 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); } D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 2013 15 Properties declared in ctor Athena-style message logging Data retrieved from event store Athena-style return code

16 Example tool source 2/2 //********************************************************************** int PseudoJetGetter::process() const { ATH_MSG_VERBOSE("Entering process()..."); PseudoJetList* ppsjs; const PseudoJetList* ppsjs_const; ppsjs_const = evtStore()->retrieve (m_outcoll); ppsjs = const_cast (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()); } D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 201316 Common tool interface includes print method to show properties Recording transient data in event store

17 Conclusions Dual-use tool example (AsgEx) in place See the AsgEx Twiki for detailsAsgEx Twiki Example tools JetDumper and AsgRunner run in Root and Athena o Syntax very similar to Athena o 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 o New package AsgEx/AsgExJetReco Migrate to xAOD o When xAOD specified (at least for jets and jet inputs: cluster, track, truth) o 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, 201317

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, 201318

19 Run 2 jet analysis use cases D. Adams, BNL Dual-use tool prototype for run 2 ASG tools working group October 16, 201319 Tier0TrainPost-train Athena Root xAOD ntuple Apply jet calibrationyes no Systematic variation of jet calibno yes yes? (Re)calculate jet moment(s)yes no? Create new jet coll. for physicsyes no Perf. study varying jet parsno yes no Tool code developmentno yes no


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

Similar presentations


Ads by Google