TWiki
>
CMSPublic Web
>
SWGuide
>
SWGuideDataFormatTable
>
SWGuideDataFormatGeneratorInterface
(2020-04-17,
MaximilianMariaHorzela
)
(raw view)
E
dit
A
ttach
P
DF
%COMPLETE4% ---+!! Data Formats in %SUBSYSTEM% %TOC{title="Contents"}% %EVENTCONTENTS% ---++ !RECO Data Formats <!-- %INCLUDE{"SWGuideDataFormatTable" pattern="(?:.*?<!--STOPTitleDF-->){0}.*? 1<.*?>2 .*"}% --> %INCLUDE{"SWGuideDataFormatTable" pattern="(?:.*?<!--STOPTitleDF-->){0}.*?<!--STARTTitleDF-->(.*?)<!--STOPTitleDF-->.*"}% <!--STARTGeneratorInterfaceDF--> <!--STARTGeneratorInterfaceAOD--> %TABLEDEFAODSIM% | __%SUBSYSTEM% collections (in RECOSIM and AODSIM)__ ||| | generator | [[%DOXY%r=7_1_14&c=LHEEventProduct][LHEEventProduct]] | General characteristics of a generated event (only present if the event starts from LHE events) | | generator | [[%DOXY%r=7_1_14&c=GenEventInfoProduct][GenEventInfoProduct]] | General characteristics of a generated event. | | generator | [[%DOXY%r=7_1_14&c=GenRunInfoProduct][GenRunInfoProduct]] | Run-specific parameters that define event generation, such as cross-sections, etc. | <!--STOPGeneratorInterfaceAOD--> <!--STARTGeneratorInterfaceRECOSIM--> %TABLEDEFRECOSIM% | __%SUBSYSTEM% collections (in RECOSIM only)__ ||| | generator | [[%DOXY%r=7_1_14&c=HepMCProduct][edm::HepMCProduct]] | A tree of final-state particles that form a generated event. | | generator | [[%DOXY%r=7_1_14&c=LHEEventProduct][LHEEventProduct]] | General characteristics of a generated event (only present if the event starts from LHE events) | | generator | [[%DOXY%r=7_1_14&c=GenEventInfoProduct][GenEventInfoProduct]] | General characteristics of a generated event. | | generator | [[%DOXY%r=7_1_14&c=GenRunInfoProduct][GenRunInfoProduct]] | Run-specific parameters that define event generation, such as cross-sections, etc. | <!--STOPGeneratorInterfaceRECOSIM--> <!--STOPGeneratorInterfaceDF--> ---++ How to use the table In the header of your analyzer you should have the header(s) of the data format(s) you will access. Generator data formats belong to the in the %CVSL%SimDataFormats/GeneratorProducts][SimDataFormats/GeneratorProducts]]; the headers are located in the =/interface= subdirectory. Thus, your <b>EDAnalyzer</b> should contain all or one of the following: <verbatim> #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" #include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" #include "SimDataFormats/GeneratorProducts/interface/GenRunInfoProduct.h" </verbatim> ---++ Using the HepMCProduct directly (only works with GEN/GENSIM) Note that =edm::HepMCProduct= is a wrapper on top of =HepMC::GenEvent= class of the standard LCG package [[http://lcgapp.cern.ch/project/simu/HepMC][HepMC]].<br> For details about features and access methods of the =HepMC::GenEvent= class please refer to the [[http://lcgapp.cern.ch/project/simu/HepMC][HepMC documentation]] for details. Here we would like to show how to access the generated event particle tree and to use 2 of the =GenEvent::HepMC= access methods.<br> In the =analyze(const Event& e, const !EventSetup& )= method of your <b>EDAnalyzer</b> you can do something like the following: <verbatim> edm::Handle<edm:: HepMCProduct > genEvtHandle; e.getByLabel( "generator", genEvtHandle) ; const HepMC::GenEvent* Evt = genEvtHandle->GetEvent() ; // // this is an example loop over the hierarchy of vertices // for ( HepMC::GenEvent::vertex_const_iterator itVtx=Evt->vertices_begin(); itVtx!=Evt->vertices_end(); ++itVtx ) { // // this is an example loop over particles coming out of each vertex in the loop // for ( HepMC::GenVertex::particles_out_const_iterator itPartOut=(*itVtx)->particles_out_const_begin(); itPartOut!=(*itVtx)->particles_out_const_end(); ++itPartOut ) { // and more of your code... } } </verbatim> Out of the event size consideration, in the AOD event content the =edm::HepMCProduct= format of the is generated event is replaced by the "lighter" record called =reco::GenParticleCollection=. Formally, it is outside the GeneratorInterface domain, and belongs to the %CVSL%PhysicsTools][CMS.PhysicsTools]] of CMSSW. For more details, please visit [[WorkBookGenParticleCandidate]] and related materials. ---+++ Using other products (AODSIM) If you wish to analyze general characteristics of an event rather than specific generated particles, in the =analyze(const Event& e, const !EventSetup& )= of your <b>EDAnalyzer</b> do the following: <verbatim> edm::Handle<GenEventInfoProduct> genEvtInfo; e.getByLabel( "generator", genEvtInfo ); double qScale = genEvtInfo->qScale(); // in case of Pythia6, this will be pypars/pari(23) const std::vector<double>& binningValues = genEvtInfo->binningValues(); // in case of Pythia6, this will be pypars/pari(17) </verbatim> *Particularly important is the use of weights*, which must *always* be activated otherwise events with generators like !Madgraph5_aMCatNLO will give wrong results. <verbatim> std::vector<double>& evtWeights = genEvtInfo->weights(); double theWeight = genEvtInfo->weight(); // and some more of your code again... </verbatim> Please note that the =weights()= return the container of the associated event weights, where there may be 1 or more elements. For example, in the case of running Pythia6 generators there'll be 2 elements; please see [[SWGuidePythia6Interface#Example_8_CSA_mode_with_Event_Re]] for more details.<br> The =weight()= method returns the first element of the weights container and is normally the one to be used as nominal weight (see [[https://github.com/cms-sw/cmssw/blob/master/SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h][definition of GenEventInfoProduct]]). If you wish to access run-specific information about event generation, you can do so via =GenRunInfoProduct=. Please be advised that this product <ul> <li>belongs to =edm::Run= rather than =edm::Event= </li> <li>is not finalized until the end of run</li> </ul> Thus you may want to implement =endRun(const Run& r, const !EventSetup& )= method in your <b>EDAnalyzer</b> and analyze !GenRunInfoProduct there: <verbatim> edm::Handle<GenRunInfoProduct> genRunInfo; r.getByLabel( "generator", genRunInfo ); </verbatim> ---+++ Retrieving information on LHE event (AODSIM) *Only in case the generation started from LHE events* the GenEventInfo will contain information on matching like the number of original partons before hadronization: <verbatim> int nAllPartons = genEvtInfo->nMEPartons(); int nPartonsEnteringMatching = genEvtInfo->nMEPartonsFiltered(); // and some more of your code again... </verbatim> Also, if the LHE was produced by !Madgraph5_aMCatNLO or POWHEG in official production weights from scale variations, PDFs etc. are stored in the relative product. Notice that to be used they need to be renormalized to the central event weight *at LHE level* which may be different from =genEvtInfo->weight()= . <verbatim> edm::Handle<LHEEventProduct> EvtHandle ; e.getByLabel( theSrc , EvtHandle ) ; int whichWeight = XXX; theWeight *= EvtHandle->weights()[whichWeight].wgt/EvtHandle->originalXWGTUP(); </verbatim> To know which integer XXX corresponds to which weight you can use: <verbatim> edm::Handle<LHERunInfoProduct> run; typedef std::vector<LHERunInfoProduct::Header>::const_iterator headers_const_iterator; iRun.getByLabel( "externalLHEProducer", run ); LHERunInfoProduct myLHERunInfoProduct = *(run.product()); for (headers_const_iterator iter=myLHERunInfoProduct.headers_begin(); iter!=myLHERunInfoProduct.headers_end(); iter++){ std::cout << iter->tag() << std::endl; std::vector<std::string> lines = iter->lines(); for (unsigned int iLine = 0; iLine<lines.size(); iLine++) { std::cout << lines.at(iLine); } } </verbatim> Some commonly used weights for samples: * QCD scales variations: all combinations of mu_R x2 - x0.5 and mu_F x2 - x0.5, except mu_R x2, mu_F x0.5 and mu_R x0.5, mu_F x2 (see [[https://twiki.cern.ch/twiki/bin/viewauth/CMS/CitationsForGenerators][CitationsForGenerators]]) * Members of NNPDF3.0LO or NLO (default PDF, central + 100 variations, alpha_s = 0.130). Numbers are different if the sample uses the 4-flavor version of PDFs. * NNPDF3.0 with alpha_s varied to 0.118 * NNPDF3.0 with alpha_s varied to 0.119 * !CTEQ6L1 or !CT10 (alternative PDF) * Members of MMHT14lo68cl or nlo or nnlo (alternative PDF, central + 50 variations) * Members of !HERAPDF15 (alternative PDF, central + 20 variations) #ReviewStatus ---++!! Review status <!-- Add your review status in this table structure with 2 columns delineated by three vertical bars --> | *Reviewer/Editor and Date (copy from screen)* | *Comments* | | Main.RobertoCovarelli - 2015-03-27 | update | | Main.JuliaYarba - 13 Aug 2009 | filled up page with basic information | | Main.KatiLassilaPerini - 22 Jul 2008 | created template page | <!-- In the following line, be sure to put a blank space AFTER your name; otherwise the Summary doesn't come out right. --> %RESPONSIBLE% %BR% %REVIEW%
E
dit
|
A
ttach
|
Watch
|
P
rint version
|
H
istory
: r16
<
r15
<
r14
<
r13
<
r12
|
B
acklinks
|
V
iew topic
|
WYSIWYG
|
M
ore topic actions
Topic revision: r16 - 2020-04-17
-
MaximilianMariaHorzela
Log In
CMSPublic
CMSPublic Web
CMSPrivate Web
Create New Topic
Index
Search
Changes
Notifications
Statistics
Preferences
Create
a LeftBar
Public webs
Public webs
ABATBEA
ACPP
ADCgroup
AEGIS
AfricaMap
AgileInfrastructure
ALICE
AliceEbyE
AliceSPD
AliceSSD
AliceTOF
AliFemto
ALPHA
Altair
ArdaGrid
ASACUSA
AthenaFCalTBAna
Atlas
AtlasLBNL
AXIALPET
CAE
CALICE
CDS
CENF
CERNSearch
CLIC
Cloud
CloudServices
CMS
Controls
CTA
CvmFS
DB
DefaultWeb
DESgroup
DPHEP
DM-LHC
DSSGroup
EGEE
EgeePtf
ELFms
EMI
ETICS
FIOgroup
FlukaTeam
Frontier
Gaudi
GeneratorServices
GuidesInfo
HardwareLabs
HCC
HEPIX
ILCBDSColl
ILCTPC
IMWG
Inspire
IPv6
IT
ItCommTeam
ITCoord
ITdeptTechForum
ITDRP
ITGT
ITSDC
LAr
LCG
LCGAAWorkbook
Leade
LHCAccess
LHCAtHome
LHCb
LHCgas
LHCONE
LHCOPN
LinuxSupport
Main
Medipix
Messaging
MPGD
NA49
NA61
NA62
NTOF
Openlab
PDBService
Persistency
PESgroup
Plugins
PSAccess
PSBUpgrade
R2Eproject
RCTF
RD42
RFCond12
RFLowLevel
ROXIE
Sandbox
SocialActivities
SPI
SRMDev
SSM
Student
SuperComputing
Support
SwfCatalogue
TMVA
TOTEM
TWiki
UNOSAT
Virtualization
VOBox
WITCH
XTCA
Cern Search
TWiki Search
Google Search
CMSPublic
All webs
Copyright &© 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use
Discourse
or
Send feedback