CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
ZMuMuUserDataOneTrack Class Reference
Inheritance diagram for ZMuMuUserDataOneTrack:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef math::XYZVector Vector
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 ZMuMuUserDataOneTrack (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

double alpha_
 
EDGetTokenT< BeamSpotbeamSpotToken_
 
double beta_
 
int counter
 
string hltPath_
 
EDGetTokenT< VertexCollectionprimaryVerticesToken_
 
EDGetTokenT< std::vector< reco::CompositeCandidate > > srcToken_
 
EDGetTokenT< GenParticleMatchzGenParticlesMatchToken_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 29 of file ZMuMuOneTrackUserData.cc.

Member Typedef Documentation

Definition at line 32 of file ZMuMuOneTrackUserData.cc.

Constructor & Destructor Documentation

ZMuMuUserDataOneTrack::ZMuMuUserDataOneTrack ( const edm::ParameterSet cfg)

Definition at line 49 of file ZMuMuOneTrackUserData.cc.

49  :
50  srcToken_(consumes<std::vector<reco::CompositeCandidate> > ( cfg.getParameter<InputTag>( "src" ) ) ),
51  beamSpotToken_(consumes<BeamSpot> (cfg.getParameter<InputTag>( "beamSpot" ) ) ),
52  primaryVerticesToken_(consumes<VertexCollection> (cfg.getParameter<InputTag>( "primaryVertices" ) ) ),
53  zGenParticlesMatchToken_(consumes<GenParticleMatch> (cfg.getParameter<InputTag>( "zGenParticlesMatch" ) ) ),
54  alpha_(cfg.getParameter<double>("alpha") ),
55  beta_(cfg.getParameter<double>("beta") ),
56  hltPath_(cfg.getParameter<std::string >("hltPath") ){
57  produces<vector<pat::CompositeCandidate> >();
58 }
T getParameter(std::string const &) const
EDGetTokenT< GenParticleMatch > zGenParticlesMatchToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
EDGetTokenT< VertexCollection > primaryVerticesToken_
EDGetTokenT< BeamSpot > beamSpotToken_
EDGetTokenT< std::vector< reco::CompositeCandidate > > srcToken_

Member Function Documentation

void ZMuMuUserDataOneTrack::produce ( edm::Event evt,
const edm::EventSetup  
)
overrideprivate

Definition at line 60 of file ZMuMuOneTrackUserData.cc.

References pat::PATObject< ObjectType >::addUserFloat(), beamSpotToken_, gather_cfg::cout, DEFINE_FWK_MODULE, reco::Candidate::eta(), edm::Event::getByToken(), mps_fire::i, edm::Ref< C, T, F >::isNonnull(), reco::Candidate::mass(), eostools::move(), reco::Candidate::phi(), jets_cff::primaryVertices, primaryVerticesToken_, reco::Candidate::pt(), edm::Event::put(), reco::Candidate::rapidity(), srcToken_, z, and zGenParticlesMatchToken_.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

60  {
62  evt.getByToken(srcToken_,dimuons);
63 
64  Handle<BeamSpot> beamSpotHandle;
65  if (!evt.getByToken(beamSpotToken_, beamSpotHandle)) {
66  std::cout << ">>> No beam spot found !!!"<<std::endl;
67  }
68 
69  Handle<VertexCollection> primaryVertices; // Collection of primary Vertices
70  if (!evt.getByToken(primaryVerticesToken_, primaryVertices)){
71  std::cout << ">>> No primary vertices found !!!"<<std::endl;
72  }
73 
74  bool isMCMatchTrue=false;
75 
76  Handle<GenParticleMatch> zGenParticlesMatch;
77  if(evt.getByToken( zGenParticlesMatchToken_, zGenParticlesMatch )){
78  isMCMatchTrue=true;
79  }
80 
81  //cout<<"isMCMatchTrue"<<isMCMatchTrue <<endl;
82  unique_ptr<vector<pat::CompositeCandidate> > dimuonColl( new vector<pat::CompositeCandidate> () );
83 
84 
85  for (unsigned int i = 0; i< dimuons->size();++i){
86  const CompositeCandidate & z = (*dimuons)[i];
87  //CandidateBaseRef zRef = dimuons ->refAt(i);
89  pat::CompositeCandidate dimuon(z);
90 
91  float trueMass,truePt,trueEta,truePhi,trueY;
92  if (isMCMatchTrue){
93  GenParticleRef trueZRef = (*zGenParticlesMatch)[zRef];
94  //CandidateRef trueZRef = trueZIter->val;
95  if( trueZRef.isNonnull() ) {
96  const Candidate & z = * trueZRef;
97  trueMass = z.mass();
98  truePt = z.pt();
99  trueEta = z.eta();
100  truePhi = z.phi();
101  trueY = z.rapidity();
102  } else {
103  trueMass = -100;
104  truePt = -100;
105  trueEta = -100;
106  truePhi = -100;
107  trueY = -100;
108  }
109 
110  dimuon.addUserFloat("TrueMass",trueMass);
111  dimuon.addUserFloat("TruePt",truePt);
112  dimuon.addUserFloat("TrueEta",trueEta);
113  dimuon.addUserFloat("TruePhi",truePhi);
114  dimuon.addUserFloat("TrueY",trueY);
115 
116  }
117 
118  dimuonColl->push_back(dimuon);
119 
120  }
121 
122  evt.put(std::move(dimuonColl));
123 }
Analysis-level particle class.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:253
EDGetTokenT< GenParticleMatch > zGenParticlesMatchToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
EDGetTokenT< VertexCollection > primaryVerticesToken_
EDGetTokenT< BeamSpot > beamSpotToken_
EDGetTokenT< std::vector< reco::CompositeCandidate > > srcToken_
virtual double eta() const =0
momentum pseudorapidity
primaryVertices
Definition: jets_cff.py:50
virtual double pt() const =0
transverse momentum
virtual double mass() const =0
mass
virtual double rapidity() const =0
rapidity
virtual double phi() const =0
momentum azimuthal angle
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

double ZMuMuUserDataOneTrack::alpha_
private

Definition at line 40 of file ZMuMuOneTrackUserData.cc.

EDGetTokenT<BeamSpot> ZMuMuUserDataOneTrack::beamSpotToken_
private

Definition at line 37 of file ZMuMuOneTrackUserData.cc.

Referenced by produce().

double ZMuMuUserDataOneTrack::beta_
private

Definition at line 40 of file ZMuMuOneTrackUserData.cc.

int ZMuMuUserDataOneTrack::counter
private

Definition at line 42 of file ZMuMuOneTrackUserData.cc.

Referenced by counter.Counters::__getitem__().

string ZMuMuUserDataOneTrack::hltPath_
private

Definition at line 41 of file ZMuMuOneTrackUserData.cc.

EDGetTokenT<VertexCollection> ZMuMuUserDataOneTrack::primaryVerticesToken_
private

Definition at line 38 of file ZMuMuOneTrackUserData.cc.

Referenced by produce().

EDGetTokenT<std::vector<reco::CompositeCandidate> > ZMuMuUserDataOneTrack::srcToken_
private

Definition at line 36 of file ZMuMuOneTrackUserData.cc.

Referenced by produce().

EDGetTokenT<GenParticleMatch> ZMuMuUserDataOneTrack::zGenParticlesMatchToken_
private

Definition at line 39 of file ZMuMuOneTrackUserData.cc.

Referenced by produce().