CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
ConeIsolation Class Reference

#include <RecoBTag/ConeIsolation/src/ConeIsolation.cc>

Inheritance diagram for ConeIsolation:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ConeIsolation (const edm::ParameterSet &)
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::InputTag beamSpotTag
 
edm::EDGetTokenT< reco::BeamSpotbeamSpotToken
 
edm::InputTag jetTrackTag
 
edm::EDGetTokenT< reco::JetTracksAssociationCollectionjetTrackToken
 
ConeIsolationAlgorithm m_algo
 
bool usingBeamSpot
 
edm::InputTag vertexTag
 
edm::EDGetTokenT< reco::VertexCollectionvertexToken
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

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

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

EDProducer of the tagged TauJet with the ConeIsolationAlgorithm. It returns two collections: base collection is the JetTag, and extended Collection which is the IsolatedTauTagInfo. The method implemented in the IsolatedTauTagInfo class are used to compute the discriminator variable. A trick is used to link the IsolatedTauTagInfo to a smart reference to the JetTag.

Author
Simone Gennai

Definition at line 21 of file ConeIsolation.h.

Constructor & Destructor Documentation

◆ ConeIsolation()

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

Definition at line 52 of file ConeIsolation.cc.

52  : m_algo{iConfig} {
53  jetTrackTag = iConfig.getParameter<InputTag>("JetTrackSrc");
54  jetTrackToken = consumes<reco::JetTracksAssociationCollection>(jetTrackTag);
55  vertexTag = iConfig.getParameter<InputTag>("vertexSrc");
56  vertexToken = consumes<reco::VertexCollection>(vertexTag);
57  beamSpotTag = iConfig.getParameter<edm::InputTag>("BeamSpotProducer");
58  beamSpotToken = consumes<reco::BeamSpot>(beamSpotTag);
59  usingBeamSpot = iConfig.getParameter<bool>("useBeamSpot"); //If false the OfflinePrimaryVertex will be used.
60 
61  produces<reco::JetTagCollection>();
62  produces<reco::IsolatedTauTagInfoCollection>();
63 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< reco::VertexCollection > vertexToken
Definition: ConeIsolation.h:32
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken
Definition: ConeIsolation.h:34
edm::InputTag jetTrackTag
Definition: ConeIsolation.h:29
edm::InputTag vertexTag
Definition: ConeIsolation.h:31
ConeIsolationAlgorithm m_algo
Definition: ConeIsolation.h:36
edm::InputTag beamSpotTag
Definition: ConeIsolation.h:33
edm::EDGetTokenT< reco::JetTracksAssociationCollection > jetTrackToken
Definition: ConeIsolation.h:30

Member Function Documentation

◆ fillDescriptions()

void ConeIsolation::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 69 of file ConeIsolation.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, ConeIsolationAlgorithm::fillDescription(), and ProducerED_cfi::InputTag.

69  {
71  desc.add<edm::InputTag>("JetTrackSrc", edm::InputTag("ic5JetTracksAssociatorAtVertex"));
72  desc.add<edm::InputTag>("vertexSrc", edm::InputTag("offlinePrimaryVertices"));
73  desc.add<edm::InputTag>("BeamSpotProducer", edm::InputTag("offlineBeamSpot"));
74  desc.add<bool>("useBeamSpot", false);
76  descriptions.add("coneIsolationTauJetTags", desc);
77 }
static void fillDescription(edm::ParameterSetDescription &desc)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void ConeIsolation::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 80 of file ConeIsolation.cc.

References beamSpotToken, edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::begin(), reco::Vertex::chi2(), MillePedeFileConverter_cfg::e, edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::empty(), reco::Vertex::error(), mps_fire::i, iEvent, jetTrackToken, m_algo, edm::makeRefToBaseProdFrom(), eostools::move(), reco::Vertex::ndof(), AlCaHLTBitMon_ParallelJobs::p, dumpMFGeometry_cfg::prod, edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::size(), ConeIsolationAlgorithm::tag(), reco::Vertex::tracksSize(), usingBeamSpot, HltBtagValidation_cff::Vertex, vertexToken, AlignmentTracksFromVertexSelector_cfi::vertices, reco::BeamSpot::x0(), reco::BeamSpot::y0(), and reco::Vertex::z().

80  {
81  using namespace edm;
82  //Get jets with tracks
84  iEvent.getByToken(jetTrackToken, jetTracksAssociation);
85 
86  std::unique_ptr<reco::JetTagCollection> tagCollection;
87  std::unique_ptr<reco::IsolatedTauTagInfoCollection> extCollection(new reco::IsolatedTauTagInfoCollection());
88  if (not jetTracksAssociation->empty()) {
89  RefToBaseProd<reco::Jet> prod(edm::makeRefToBaseProdFrom(jetTracksAssociation->begin()->first, iEvent));
90  tagCollection = std::make_unique<reco::JetTagCollection>(prod);
91  } else {
92  tagCollection = std::make_unique<reco::JetTagCollection>();
93  }
94 
96  e(0, 0) = 1;
97  e(1, 1) = 1;
98  e(2, 2) = 1;
99  Vertex::Point p(0, 0, -1000);
100  Vertex myPVtmp(p, e); //Fake vertex to be used in case no vertex is found
101  Vertex myPV;
102 
103  //Get pixel vertices
105  iEvent.getByToken(vertexToken, vertices);
106  const reco::VertexCollection vertCollection = *(vertices.product());
107  //Check if there is the PV!!!!
108  if (vertCollection.begin() != vertCollection.end())
109  myPVtmp = *(vertCollection.begin());
110 
111  //In case the beam spot is used, the Z of the vertex still comes from the PV, while the (x,y) is taken from the beamspot
112  reco::BeamSpot vertexBeamSpot;
113  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
114 
115  if (usingBeamSpot) {
116  //Create a new vertex with the information on x0 and Y0 from the beamspot, to be used in HLT.
117  iEvent.getByToken(beamSpotToken, recoBeamSpotHandle);
118  vertexBeamSpot = *recoBeamSpotHandle;
119  Vertex::Point bspoint(vertexBeamSpot.x0(), vertexBeamSpot.y0(), myPVtmp.z());
120  Vertex combinedVertex = Vertex(bspoint, myPVtmp.error(), myPVtmp.chi2(), myPVtmp.ndof(), myPVtmp.tracksSize());
121  myPV = combinedVertex;
122  } else {
123  myPV = myPVtmp;
124  }
125 
126  for (unsigned int i = 0; i < jetTracksAssociation->size(); ++i) {
127  pair<float, IsolatedTauTagInfo> myPair =
128  m_algo.tag(edm::Ref<JetTracksAssociationCollection>(jetTracksAssociation, i), myPV);
129  tagCollection->setValue(i, myPair.first);
130  extCollection->push_back(myPair.second);
131  }
132 
133  iEvent.put(std::move(extCollection));
134  iEvent.put(std::move(tagCollection));
135 }
size_type size() const
edm::EDGetTokenT< reco::VertexCollection > vertexToken
Definition: ConeIsolation.h:32
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken
Definition: ConeIsolation.h:34
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:45
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
const_iterator begin() const
std::pair< float, reco::IsolatedTauTagInfo > tag(const reco::JetTracksAssociationRef &jetTracks, const reco::Vertex &pv) const
double x0() const
x coordinate
Definition: BeamSpot.h:61
int iEvent
Definition: GenABIO.cc:224
ConeIsolationAlgorithm m_algo
Definition: ConeIsolation.h:36
std::vector< IsolatedTauTagInfo > IsolatedTauTagInfoCollection
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
double y0() const
y coordinate
Definition: BeamSpot.h:63
RefToBaseProd< T > makeRefToBaseProdFrom(RefToBase< T > const &iRef, Event const &iEvent)
HLT enums.
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< reco::JetTracksAssociationCollection > jetTrackToken
Definition: ConeIsolation.h:30

Member Data Documentation

◆ beamSpotTag

edm::InputTag ConeIsolation::beamSpotTag
private

Definition at line 33 of file ConeIsolation.h.

◆ beamSpotToken

edm::EDGetTokenT<reco::BeamSpot> ConeIsolation::beamSpotToken
private

Definition at line 34 of file ConeIsolation.h.

Referenced by produce().

◆ jetTrackTag

edm::InputTag ConeIsolation::jetTrackTag
private

Definition at line 29 of file ConeIsolation.h.

◆ jetTrackToken

edm::EDGetTokenT<reco::JetTracksAssociationCollection> ConeIsolation::jetTrackToken
private

Definition at line 30 of file ConeIsolation.h.

Referenced by produce().

◆ m_algo

ConeIsolationAlgorithm ConeIsolation::m_algo
private

Definition at line 36 of file ConeIsolation.h.

Referenced by produce().

◆ usingBeamSpot

bool ConeIsolation::usingBeamSpot
private

Definition at line 35 of file ConeIsolation.h.

Referenced by produce().

◆ vertexTag

edm::InputTag ConeIsolation::vertexTag
private

Definition at line 31 of file ConeIsolation.h.

◆ vertexToken

edm::EDGetTokenT<reco::VertexCollection> ConeIsolation::vertexToken
private

Definition at line 32 of file ConeIsolation.h.

Referenced by produce().