How to Access PAT Candidate Information PAT Tutorial CERN December 2012 lecturer: Andreas Hinzmann (CERN) tutors: Guillermo Breto (UCD), Sudhir Malik (Nebraska) and the PAT tutorial team Access PAT candidates The Pat Tuple In the morning section you have learned: how to find documentation how to produce PAT Tuples how to inspect your configuration file how to customize the PAT Tuple workflow how to look at the PAT Tuple Event Content Now you will learn how to access to PAT Tuples produced in order to perform you analysis. Access PAT candidates The Pat Tuple A PAT Tuple is and EDM file: Root file with predifined file structure Trees of CMS customized DataFormats (Muon, Electron, Track) TBrowser Access PAT candidates edmDumpEventContent Example pat::Muon Typical class structures for HEP Collaborations http://cmssdt.cern.ch/SDT/doxygen Access PAT candidates Access PAT Tuple Access is as to normal Root file. PAT provides also more appropriate access methods: Analysis performed directly on PAT Tuples (BasicAnalyzer concept) Within the Full Framework (EDAnalyzer) With FW Lite (FWLiteAnalyzer) Production of flat ntuples (again EDM files ) Analysis performed with your root macros or FW/FWLite analyzer EDMTuple PAT Tuple EDAnalyzer Full framework FWLiteAnalyzer FWLite Access PAT candidates BasicAnalyzer Concept Decide late whether you want to use FWLite or full framework Write the code to be compatible with both BasicAnalyzer PAT Tuple EDAnalyzer Full framework FWLiteAnalyzer FWLite https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookFWLiteExamples#ExampleFive Access PAT candidates Example PatMuonAnalyzer Class declaration: Your class inherits from BasicAnalyzer class http://cmssw.cvs.cern.ch/cgibin/cmssw.cgi/CMSSW/PhysicsTools/PatExamples/interface/PatMuonAnalyzer.h?r evision=1.1&view=markup&pathrev=V00-05-26 Access PAT candidates Example PatMuonAnalyzer Class implementation: http://cmssw.cvs.cern.ch/cgibin/cmssw.cgi/CMSSW/PhysicsTools/PatExamples/src/PatMuonAnalyzer.cc?revision=1.1 8 &view=markup&pathrev=V00-05-26 Access PAT candidates FWLite or Full Framework? BasicAnalyzer ... Access PAT candidates Very easy to wrap the same code into one or the other Keep both if you like and use what fits best to the current purposes Recommendations FWLite: Use this if you need quick turn around, when the analysis task is not too complex (would also fit to a single EDAnalyzer), when you can still handle all objects that you create and destroy on your way... Full Framework: Use this when the analysis tasks grow complex, when you intend to use crab or batch systems, when you intend to use the edm::Event to manage the amount of objects that you create and use on the way, when you want flexible (plugin-wise) use of your code... Advantage of both over you private solution: Easy implementation, easy to learn and to understand, easy to maintain, maximal use of CMSSW infrastructure (i.e. DataFormats, TFileServise, Event management e.g. no event double counting)... 10 Access PAT candidates How to run the examples: Full Framework: FWLite: https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookPATAccessExercise Access PAT candidates The EDM-Tupleizer The Analysis Tools Group (AT) also provides pre-written tools and recommendations to make fully EDM complient flat ntuples: the CandViewNtpProducer: It is a generic ntuple dumper Easy to configure Don‘t need to write c++ code to produce your flat ntuples from your PAT Tuples More info and examples in the Twiki: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideEDMNtuples Access PAT candidates The EDM-Tupleizer Easy access via string parsing to variables you want to store in your flat ntuple https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideEDMNtuples Access PAT candidates The EDM-Tupleizer Output The output is a full edm compliant edm Tuple, you can inspect it as it was a standard PAT Tuple... It is still and EDM file : TBrowser edmDumpEventContent Access PAT candidates The EDM-Tupleizer Output Analyze your EDM flat ntuple with an interactive/compiled root macro Or use FWLite/full framwork to make use of full CMSSW capabilities. In the Exercise 4 you will find a guideline to deal with EDM flat ntuples Access PAT candidates Remark General Remark: As you see AT covers a broad bunch of use cases for analysis from smallest scale/complexity to largest scale/complexity. You can make use of easy access to data information, and a whole bunch of Services and tools (TFileService, PAT features, Candidate Tools, HepMC tools, POG tools) All these tools are established, accepted collaboration wide, tested, maintained, ... ~50 people are working hard to make CMSSW your analysis software (compare this to the manpower situation in your university) Don't waist your time on the re-invention, re-developement, maintainance of you own private framework, spent your time on physics! On the other hand there is always room for developments/improvement. Joining AT developments is rewarded (Credit by points).. So, don‘t hesitate if you wish to contribute Access PAT candidates Final Remark Everything which has been discussed here is part of Exercise 4. Take your time to go through it and enjoy! Access PAT candidates