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 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
 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
 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
 
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_
 
InputTag beamSpot_
 
double beta_
 
int counter
 
string hltPath_
 
InputTag primaryVertices_
 
InputTag src_
 
InputTag zGenParticlesMatch_
 

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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 46 of file ZMuMuOneTrackUserData.cc.

46  :
47  src_( cfg.getParameter<InputTag>( "src" ) ),
48  beamSpot_(cfg.getParameter<InputTag>( "beamSpot" ) ),
49  primaryVertices_(cfg.getParameter<InputTag>( "primaryVertices" ) ),
50  zGenParticlesMatch_(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 }
T getParameter(std::string const &) const

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 57 of file ZMuMuOneTrackUserData.cc.

References pat::PATObject< ObjectType >::addUserFloat(), beamSpot_, gather_cfg::cout, WZMuSkim_cff::dimuons, reco::Candidate::eta(), edm::Event::getByLabel(), i, edm::Ref< C, T, F >::isNonnull(), reco::Candidate::mass(), reco::Candidate::phi(), primaryVertices_, reco::Candidate::pt(), edm::Event::put(), reco::Candidate::rapidity(), src_, detailsBasic3DVector::z, and zGenParticlesMatch_.

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

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

Member Data Documentation

double ZMuMuUserDataOneTrack::alpha_
private

Definition at line 37 of file ZMuMuOneTrackUserData.cc.

InputTag ZMuMuUserDataOneTrack::beamSpot_
private

Definition at line 36 of file ZMuMuOneTrackUserData.cc.

Referenced by produce().

double ZMuMuUserDataOneTrack::beta_
private

Definition at line 37 of file ZMuMuOneTrackUserData.cc.

int ZMuMuUserDataOneTrack::counter
private

Definition at line 39 of file ZMuMuOneTrackUserData.cc.

string ZMuMuUserDataOneTrack::hltPath_
private

Definition at line 38 of file ZMuMuOneTrackUserData.cc.

InputTag ZMuMuUserDataOneTrack::primaryVertices_
private

Definition at line 36 of file ZMuMuOneTrackUserData.cc.

Referenced by produce().

InputTag ZMuMuUserDataOneTrack::src_
private

Definition at line 36 of file ZMuMuOneTrackUserData.cc.

Referenced by produce().

InputTag ZMuMuUserDataOneTrack::zGenParticlesMatch_
private

Definition at line 36 of file ZMuMuOneTrackUserData.cc.

Referenced by produce().