CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
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
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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)
 
- 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  
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 60 of file ZMuMuOneTrackUserData.cc.

References pat::PATObject< ObjectType >::addUserFloat(), beamSpotToken_, gather_cfg::cout, hotlineSkims_cff::dimuons, reco::Candidate::eta(), edm::Event::getByToken(), i, edm::Ref< C, T, F >::isNonnull(), reco::Candidate::mass(), reco::Candidate::phi(), HLT_25ns10e33_v2_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  auto_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( dimuonColl);
123 }
Analysis-level particle class.
int i
Definition: DBlmapReader.cc:9
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
EDGetTokenT< GenParticleMatch > zGenParticlesMatchToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
virtual double pt() const =0
transverse momentum
virtual double mass() const =0
mass
virtual double rapidity() const =0
rapidity
EDGetTokenT< VertexCollection > primaryVerticesToken_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
EDGetTokenT< BeamSpot > beamSpotToken_
EDGetTokenT< std::vector< reco::CompositeCandidate > > srcToken_
tuple cout
Definition: gather_cfg.py:145
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity

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().