CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
TagProbeMassProducer Class Reference

#include <PhysicsTools/TagProbeMassProducer/src/TagProbeMassProducer.cc>

Inheritance diagram for TagProbeMassProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 TagProbeMassProducer (const edm::ParameterSet &)
 
 ~TagProbeMassProducer ()
 
- 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 (const std::string &iProcessName, std::vector< const char * > &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

virtual void beginJob ()
 
virtual void endJob ()
 
bool isPassingProbe (const unsigned int iprobe) const
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

double delRMaxCut_
 
double delRMinCut_
 
double massMaxCut_
 
double massMinCut_
 
edm::InputTag passingProbeCollection_
 
edm::Handle< reco::CandidateViewpassingProbes
 
edm::InputTag probeCollection_
 
edm::Handle< reco::CandidateViewprobes
 
bool requireOS_
 
edm::InputTag tagCollection_
 
edm::Handle< reco::CandidateViewtags
 

Additional Inherited Members

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

Description: <one line="" class="" summary>="">

Usage: <usage>

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 34 of file TagProbeMassProducer.h.

Constructor & Destructor Documentation

TagProbeMassProducer::TagProbeMassProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 37 of file TagProbeMassProducer.cc.

References delRMaxCut_, delRMinCut_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), massMaxCut_, massMinCut_, passingProbeCollection_, probeCollection_, requireOS_, and tagCollection_.

38 {
39  tagCollection_ = iConfig.getParameter<edm::InputTag>("TagCollection");
40  probeCollection_ = iConfig.getParameter<edm::InputTag>("ProbeCollection");
41  passingProbeCollection_ = iConfig.getParameter<edm::InputTag>("PassingProbeCollection");
42 
43  massMinCut_ = iConfig.getUntrackedParameter<double>("MassMinCut",50.0);
44  massMaxCut_ = iConfig.getUntrackedParameter<double>("MassMaxCut",120.0);
45  delRMinCut_ = iConfig.getUntrackedParameter<double>("DelRMinCut",0.0);
46  delRMaxCut_ = iConfig.getUntrackedParameter<double>("DelRMaxCut",10000.0);
47 
48  requireOS_ = iConfig.getUntrackedParameter<bool>("RequireOS",true);
49 
50  produces<std::vector<float> >("TPmass");
51 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag passingProbeCollection_
edm::InputTag probeCollection_
TagProbeMassProducer::~TagProbeMassProducer ( )

Definition at line 54 of file TagProbeMassProducer.cc.

55 {
56 
57 }

Member Function Documentation

void TagProbeMassProducer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 134 of file TagProbeMassProducer.cc.

135 {
136 }
void TagProbeMassProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 140 of file TagProbeMassProducer.cc.

140  {
141 }
bool TagProbeMassProducer::isPassingProbe ( const unsigned int  iprobe) const
private

Definition at line 144 of file TagProbeMassProducer.cc.

References passingProbes, and probes.

Referenced by produce().

144  {
145 
146  if (iProbe > probes->size()) return false;
147 
148  edm::RefToBase<reco::Candidate> probeRef = probes->refAt(iProbe);
149  edm::RefToBase<reco::Candidate> passingProbeRef;
150 
151  unsigned int numPassingProbes = passingProbes->size();
152 
153  for (unsigned int iPassProbe = 0; iPassProbe < numPassingProbes; ++iPassProbe) {
154  passingProbeRef = passingProbes->refAt(iPassProbe);
155  if (passingProbeRef == probeRef) {
156  return true;
157  }
158  }
159  return false;
160 }
edm::Handle< reco::CandidateView > probes
edm::Handle< reco::CandidateView > passingProbes
void TagProbeMassProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 66 of file TagProbeMassProducer.cc.

References edm::RefToBaseVector< T >::begin(), delRMaxCut_, delRMinCut_, edm::RefToBaseVector< T >::end(), edm::Event::getByLabel(), i, reco::tau::disc::InvariantMass(), isPassingProbe(), massMaxCut_, massMinCut_, passingProbeCollection_, passingProbes, probeCollection_, probes, edm::RefToBaseVector< T >::push_back(), edm::Event::put(), requireOS_, jetcorrextractor::sign(), GlobalPosition_Frontier_DevDB_cff::tag, tagCollection_, and tags.

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

67 {
68 
69  // We need the output Muon association collection to fill
70  std::auto_ptr<std::vector<float> > TPmass( new std::vector<float>);
71 
72  if ( !iEvent.getByLabel( tagCollection_, tags ) ) {
73  edm::LogWarning("TagProbe") << "Could not extract tag muons with input tag "
74  << tagCollection_;
75  }
76 
77  if ( !iEvent.getByLabel( probeCollection_, probes ) ) {
78  edm::LogWarning("TagProbe") << "Could not extract probe muons with input tag "
80  }
81 
83  edm::LogWarning("TagProbe") << "Could not extract passing probe muons with input tag "
85  }
86 
87  // Loop over Tag and associate with Probes
88  if( tags.isValid() && probes.isValid() )
89  {
91  for (size_t i = 0; i < tags->size(); ++i) {
92  vtags.push_back(tags->refAt(i));
93  }
95  for (size_t i = 0; i < probes->size(); ++i) {
96  vprobes.push_back(probes->refAt(i));
97  }
98 
99  int itag = 0;
101  for( ; tag != vtags.end(); ++tag, ++itag )
102  {
103  int iprobe = 0;
105  for( ; probe != vprobes.end(); ++probe, ++iprobe )
106  {
107  // Tag-Probe invariant mass cut
108  double invMass = ROOT::Math::VectorUtil::InvariantMass((*tag)->p4(), (*probe)->p4());
109  if( invMass < massMinCut_ ) continue;
110  if( invMass > massMaxCut_ ) continue;
111 
112  // Tag-Probe deltaR cut
113  double delR = reco::deltaR<double>((*tag)->eta(),(*tag)->phi(),(*probe)->eta(),(*probe)->phi());
114  if( delR < delRMinCut_ ) continue;
115  if( delR > delRMaxCut_ ) continue;
116 
117  // Tag-Probe opposite sign
118  int sign = (*tag)->charge() * (*probe)->charge();
119  if( requireOS_ && sign > 0 ) continue;
120 
121  bool isPassing = isPassingProbe (iprobe);
122 
123  if (isPassing) TPmass->push_back(invMass);
124  }
125  }
126  }
127 
128  // Finally put the tag probe collection in the event
129  iEvent.put( TPmass,"TPmass" );
130 }
int i
Definition: DBlmapReader.cc:9
edm::Handle< reco::CandidateView > probes
edm::InputTag passingProbeCollection_
double sign(double x)
const_iterator end() const
edm::InputTag probeCollection_
edm::Handle< reco::CandidateView > tags
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:420
bool isPassingProbe(const unsigned int iprobe) const
const_iterator begin() const
edm::Handle< reco::CandidateView > passingProbes
void push_back(const RefToBase< T > &)

Member Data Documentation

double TagProbeMassProducer::delRMaxCut_
private

Definition at line 60 of file TagProbeMassProducer.h.

Referenced by produce(), and TagProbeMassProducer().

double TagProbeMassProducer::delRMinCut_
private

Definition at line 59 of file TagProbeMassProducer.h.

Referenced by produce(), and TagProbeMassProducer().

double TagProbeMassProducer::massMaxCut_
private

Definition at line 58 of file TagProbeMassProducer.h.

Referenced by produce(), and TagProbeMassProducer().

double TagProbeMassProducer::massMinCut_
private

Definition at line 57 of file TagProbeMassProducer.h.

Referenced by produce(), and TagProbeMassProducer().

edm::InputTag TagProbeMassProducer::passingProbeCollection_
private

Definition at line 51 of file TagProbeMassProducer.h.

Referenced by produce(), and TagProbeMassProducer().

edm::Handle< reco::CandidateView > TagProbeMassProducer::passingProbes
private

Definition at line 55 of file TagProbeMassProducer.h.

Referenced by isPassingProbe(), and produce().

edm::InputTag TagProbeMassProducer::probeCollection_
private

Definition at line 50 of file TagProbeMassProducer.h.

Referenced by produce(), and TagProbeMassProducer().

edm::Handle< reco::CandidateView > TagProbeMassProducer::probes
private

Definition at line 54 of file TagProbeMassProducer.h.

Referenced by isPassingProbe(), and produce().

bool TagProbeMassProducer::requireOS_
private

Definition at line 62 of file TagProbeMassProducer.h.

Referenced by produce(), and TagProbeMassProducer().

edm::InputTag TagProbeMassProducer::tagCollection_
private

Definition at line 49 of file TagProbeMassProducer.h.

Referenced by produce(), and TagProbeMassProducer().

edm::Handle< reco::CandidateView > TagProbeMassProducer::tags
private

Definition at line 53 of file TagProbeMassProducer.h.

Referenced by produce().