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::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ConeIsolation (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~ConeIsolation () override
 
- 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
 
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)
 
 ~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
 
ESProxyIndex const * esGetTokenIndices (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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- 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 wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Private Attributes

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

Additional Inherited Members

- 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
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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>="">

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 24 of file ConeIsolation.h.

Constructor & Destructor Documentation

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

Definition at line 53 of file ConeIsolation.cc.

References AlignmentProducer_cff::beamSpotTag, edm::ParameterSet::getParameter(), and electronIdMVABased_cfi::vertexTag.

54 {
55  jetTrackTag = iConfig.getParameter<InputTag>("JetTrackSrc");
56  jetTrackToken = consumes<reco::JetTracksAssociationCollection>(jetTrackTag);
57  vertexTag = iConfig.getParameter<InputTag>("vertexSrc");
58  vertexToken = consumes<reco::VertexCollection>(vertexTag);
59  beamSpotTag = iConfig.getParameter<edm::InputTag>("BeamSpotProducer");
60  beamSpotToken = consumes<reco::BeamSpot>(beamSpotTag);
61  usingBeamSpot = iConfig.getParameter<bool>("useBeamSpot"); //If false the OfflinePrimaryVertex will be used.
62 
63  m_algo = new ConeIsolationAlgorithm(iConfig);
64 
65  produces<reco::JetTagCollection>();
66  produces<reco::IsolatedTauTagInfoCollection>();
67 
68 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::VertexCollection > vertexToken
Definition: ConeIsolation.h:35
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken
Definition: ConeIsolation.h:37
edm::InputTag jetTrackTag
Definition: ConeIsolation.h:32
edm::InputTag vertexTag
Definition: ConeIsolation.h:34
ConeIsolationAlgorithm * m_algo
Definition: ConeIsolation.h:39
edm::InputTag beamSpotTag
Definition: ConeIsolation.h:36
edm::EDGetTokenT< reco::JetTracksAssociationCollection > jetTrackToken
Definition: ConeIsolation.h:33
ConeIsolation::~ConeIsolation ( )
override

Definition at line 71 of file ConeIsolation.cc.

72 {
73  delete m_algo;
74 }
ConeIsolationAlgorithm * m_algo
Definition: ConeIsolation.h:39

Member Function Documentation

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

Definition at line 83 of file ConeIsolation.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and ConeIsolationAlgorithm::fillDescription().

83  {
85  desc.add<edm::InputTag>("JetTrackSrc",edm::InputTag("ic5JetTracksAssociatorAtVertex"));
86  desc.add<edm::InputTag>("vertexSrc",edm::InputTag("offlinePrimaryVertices"));
87  desc.add<edm::InputTag>("BeamSpotProducer",edm::InputTag("offlineBeamSpot"));
88  desc.add<bool>("useBeamSpot",false);
90  descriptions.add("coneIsolationTauJetTags", desc);
91 }
static void fillDescription(edm::ParameterSetDescription &desc)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void ConeIsolation::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 95 of file ConeIsolation.cc.

References 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(), edm::Event::getByToken(), mps_fire::i, iEvent, edm::makeRefToBaseProdFrom(), eostools::move(), reco::Vertex::ndof(), AlCaHLTBitMon_ParallelJobs::p, parseEventContent::prod, edm::Handle< T >::product(), edm::Event::put(), edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::size(), reco::Vertex::tracksSize(), electrons_cff::vertices, reco::BeamSpot::x0(), reco::BeamSpot::y0(), and reco::Vertex::z().

96 {
97  using namespace edm;
98  //Get jets with tracks
100  iEvent.getByToken(jetTrackToken,jetTracksAssociation);
101 
102  std::unique_ptr<reco::JetTagCollection> tagCollection;
103  std::unique_ptr<reco::IsolatedTauTagInfoCollection> extCollection( new reco::IsolatedTauTagInfoCollection() );
104  if (not jetTracksAssociation->empty()) {
105  RefToBaseProd<reco::Jet> prod( edm::makeRefToBaseProdFrom(jetTracksAssociation->begin()->first, iEvent) );
106  tagCollection.reset( new reco::JetTagCollection(prod) );
107  } else {
108  tagCollection.reset( new reco::JetTagCollection() );
109  }
110 
112  e(0,0)=1;
113  e(1,1)=1;
114  e(2,2)=1;
115  Vertex::Point p(0,0,-1000);
116  Vertex myPVtmp(p,e);//Fake vertex to be used in case no vertex is found
117  Vertex myPV;
118 
119  //Get pixel vertices
121  iEvent.getByToken(vertexToken,vertices);
122  const reco::VertexCollection vertCollection = *(vertices.product());
123  //Check if there is the PV!!!!
124  if(vertCollection.begin() != vertCollection.end())
125  myPVtmp = *(vertCollection.begin());
126 
127  //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
128  reco::BeamSpot vertexBeamSpot;
129  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
130 
131  if(usingBeamSpot)
132  {
133  //Create a new vertex with the information on x0 and Y0 from the beamspot, to be used in HLT.
134  iEvent.getByToken(beamSpotToken,recoBeamSpotHandle);
135  vertexBeamSpot = *recoBeamSpotHandle;
136  Vertex::Point bspoint(vertexBeamSpot.x0(),vertexBeamSpot.y0(),myPVtmp.z());
137  Vertex combinedVertex = Vertex(bspoint,myPVtmp.error(),myPVtmp.chi2(),myPVtmp.ndof(),myPVtmp.tracksSize());
138  myPV = combinedVertex;
139  }else{
140  myPV = myPVtmp;
141  }
142 
143  for (unsigned int i = 0; i < jetTracksAssociation->size(); ++i)
144  {
145  pair<float,IsolatedTauTagInfo> myPair =m_algo->tag(edm::Ref<JetTracksAssociationCollection>(jetTracksAssociation,i),myPV);
146  tagCollection->setValue(i, myPair.first);
147  extCollection->push_back(myPair.second);
148  }
149 
150  iEvent.put(std::move(extCollection));
151  iEvent.put(std::move(tagCollection));
152 
153 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
edm::EDGetTokenT< reco::VertexCollection > vertexToken
Definition: ConeIsolation.h:35
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken
Definition: ConeIsolation.h:37
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:43
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
int iEvent
Definition: GenABIO.cc:224
std::vector< IsolatedTauTagInfo > IsolatedTauTagInfoCollection
ConeIsolationAlgorithm * m_algo
Definition: ConeIsolation.h:39
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
std::pair< float,reco::IsolatedTauTagInfo > tag(const reco::JetTracksAssociationRef &jetTracks, const reco::Vertex &pv)
T const * product() const
Definition: Handle.h:74
RefToBaseProd< T > makeRefToBaseProdFrom(RefToBase< T > const &iRef, Event const &iEvent)
HLT enums.
double y0() const
y coordinate
Definition: BeamSpot.h:66
const_iterator begin() const
def move(src, dest)
Definition: eostools.py:511
size_type size() const
edm::EDGetTokenT< reco::JetTracksAssociationCollection > jetTrackToken
Definition: ConeIsolation.h:33
double x0() const
x coordinate
Definition: BeamSpot.h:64

Member Data Documentation

edm::InputTag ConeIsolation::beamSpotTag
private

Definition at line 36 of file ConeIsolation.h.

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

Definition at line 37 of file ConeIsolation.h.

edm::InputTag ConeIsolation::jetTrackTag
private

Definition at line 32 of file ConeIsolation.h.

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

Definition at line 33 of file ConeIsolation.h.

ConeIsolationAlgorithm* ConeIsolation::m_algo
private

Definition at line 39 of file ConeIsolation.h.

bool ConeIsolation::usingBeamSpot
private

Definition at line 38 of file ConeIsolation.h.

edm::InputTag ConeIsolation::vertexTag
private

Definition at line 34 of file ConeIsolation.h.

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

Definition at line 35 of file ConeIsolation.h.