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 ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 29 of file ZMuMuOneTrackUserData.cc.

Member Typedef Documentation

◆ Vector

Definition at line 32 of file ZMuMuOneTrackUserData.cc.

Constructor & Destructor Documentation

◆ ZMuMuUserDataOneTrack()

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

Definition at line 46 of file ZMuMuOneTrackUserData.cc.

47  : srcToken_(consumes<std::vector<reco::CompositeCandidate> >(cfg.getParameter<InputTag>("src"))),
48  beamSpotToken_(consumes<BeamSpot>(cfg.getParameter<InputTag>("beamSpot"))),
49  primaryVerticesToken_(consumes<VertexCollection>(cfg.getParameter<InputTag>("primaryVertices"))),
50  zGenParticlesMatchToken_(consumes<GenParticleMatch>(cfg.getParameter<InputTag>("zGenParticlesMatch"))),
51  alpha_(cfg.getParameter<double>("alpha")),
52  beta_(cfg.getParameter<double>("beta")),
53  hltPath_(cfg.getParameter<std::string>("hltPath")) {
54  produces<vector<pat::CompositeCandidate> >();
55 }

Member Function Documentation

◆ produce()

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

Implements edm::EDProducer.

Definition at line 57 of file ZMuMuOneTrackUserData.cc.

57  {
60 
61  Handle<BeamSpot> beamSpotHandle;
62  if (!evt.getByToken(beamSpotToken_, beamSpotHandle)) {
63  std::cout << ">>> No beam spot found !!!" << std::endl;
64  }
65 
66  Handle<VertexCollection> primaryVertices; // Collection of primary Vertices
68  std::cout << ">>> No primary vertices found !!!" << std::endl;
69  }
70 
71  bool isMCMatchTrue = false;
72 
75  isMCMatchTrue = true;
76  }
77 
78  //cout<<"isMCMatchTrue"<<isMCMatchTrue <<endl;
79  unique_ptr<vector<pat::CompositeCandidate> > dimuonColl(new vector<pat::CompositeCandidate>());
80 
81  for (unsigned int i = 0; i < dimuons->size(); ++i) {
82  const CompositeCandidate &z = (*dimuons)[i];
83  //CandidateBaseRef zRef = dimuons ->refAt(i);
85  pat::CompositeCandidate dimuon(z);
86 
87  float trueMass, truePt, trueEta, truePhi, trueY;
88  if (isMCMatchTrue) {
89  GenParticleRef trueZRef = (*zGenParticlesMatch)[zRef];
90  //CandidateRef trueZRef = trueZIter->val;
91  if (trueZRef.isNonnull()) {
92  const Candidate &z = *trueZRef;
93  trueMass = z.mass();
94  truePt = z.pt();
95  trueEta = z.eta();
96  truePhi = z.phi();
97  trueY = z.rapidity();
98  } else {
99  trueMass = -100;
100  truePt = -100;
101  trueEta = -100;
102  truePhi = -100;
103  trueY = -100;
104  }
105 
106  dimuon.addUserFloat("TrueMass", trueMass);
107  dimuon.addUserFloat("TruePt", truePt);
108  dimuon.addUserFloat("TrueEta", trueEta);
109  dimuon.addUserFloat("TruePhi", truePhi);
110  dimuon.addUserFloat("TrueY", trueY);
111  }
112 
113  dimuonColl->push_back(dimuon);
114  }
115 
116  evt.put(std::move(dimuonColl));
117 }

References pat::PATObject< ObjectType >::addUserFloat(), beamSpotToken_, gather_cfg::cout, WZMuSkim_cff::dimuons, edm::Event::getByToken(), mps_fire::i, edm::Ref< C, T, F >::isNonnull(), eostools::move(), zMuMuMuonUserData::primaryVertices, primaryVerticesToken_, edm::Event::put(), srcToken_, z, zMuMu_SubskimPathsWithMCTruth_cff::zGenParticlesMatch, and zGenParticlesMatchToken_.

Member Data Documentation

◆ alpha_

double ZMuMuUserDataOneTrack::alpha_
private

Definition at line 41 of file ZMuMuOneTrackUserData.cc.

◆ beamSpotToken_

EDGetTokenT<BeamSpot> ZMuMuUserDataOneTrack::beamSpotToken_
private

Definition at line 38 of file ZMuMuOneTrackUserData.cc.

Referenced by produce().

◆ beta_

double ZMuMuUserDataOneTrack::beta_
private

Definition at line 41 of file ZMuMuOneTrackUserData.cc.

◆ counter

int ZMuMuUserDataOneTrack::counter
private

Definition at line 43 of file ZMuMuOneTrackUserData.cc.

Referenced by counter.Counters::__getitem__().

◆ hltPath_

string ZMuMuUserDataOneTrack::hltPath_
private

Definition at line 42 of file ZMuMuOneTrackUserData.cc.

◆ primaryVerticesToken_

EDGetTokenT<VertexCollection> ZMuMuUserDataOneTrack::primaryVerticesToken_
private

Definition at line 39 of file ZMuMuOneTrackUserData.cc.

Referenced by produce().

◆ srcToken_

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

Definition at line 37 of file ZMuMuOneTrackUserData.cc.

Referenced by produce().

◆ zGenParticlesMatchToken_

EDGetTokenT<GenParticleMatch> ZMuMuUserDataOneTrack::zGenParticlesMatchToken_
private

Definition at line 40 of file ZMuMuOneTrackUserData.cc.

Referenced by produce().

mps_fire.i
i
Definition: mps_fire.py:428
ZMuMuUserDataOneTrack::alpha_
double alpha_
Definition: ZMuMuOneTrackUserData.cc:41
pat::CompositeCandidate
Analysis-level particle class.
Definition: CompositeCandidate.h:31
gather_cfg.cout
cout
Definition: gather_cfg.py:144
ZMuMuUserDataOneTrack::primaryVerticesToken_
EDGetTokenT< VertexCollection > primaryVerticesToken_
Definition: ZMuMuOneTrackUserData.cc:39
edm::Handle
Definition: AssociativeIterator.h:50
edm::Ref
Definition: AssociativeIterator.h:58
WZMuSkim_cff.dimuons
dimuons
Definition: WZMuSkim_cff.py:26
DDAxes::z
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:531
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
zMuMuMuonUserData.primaryVertices
primaryVertices
Definition: zMuMuMuonUserData.py:12
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
zMuMu_SubskimPathsWithMCTruth_cff.zGenParticlesMatch
zGenParticlesMatch
Definition: zMuMu_SubskimPathsWithMCTruth_cff.py:23
ZMuMuUserDataOneTrack::beta_
double beta_
Definition: ZMuMuOneTrackUserData.cc:41
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
ZMuMuUserDataOneTrack::beamSpotToken_
EDGetTokenT< BeamSpot > beamSpotToken_
Definition: ZMuMuOneTrackUserData.cc:38
looper.cfg
cfg
Definition: looper.py:297
reco::Candidate
Definition: Candidate.h:27
eostools.move
def move(src, dest)
Definition: eostools.py:511
ZMuMuUserDataOneTrack::hltPath_
string hltPath_
Definition: ZMuMuOneTrackUserData.cc:42
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:153
ZMuMuUserDataOneTrack::zGenParticlesMatchToken_
EDGetTokenT< GenParticleMatch > zGenParticlesMatchToken_
Definition: ZMuMuOneTrackUserData.cc:40
edm::InputTag
Definition: InputTag.h:15
reco::CompositeCandidate
Definition: CompositeCandidate.h:21
ZMuMuUserDataOneTrack::srcToken_
EDGetTokenT< std::vector< reco::CompositeCandidate > > srcToken_
Definition: ZMuMuOneTrackUserData.cc:37