CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~ConeIsolation ()
 
- 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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)
 

Private Attributes

edm::InputTag beamSpotTag
 
edm::EDGetTokenT< reco::BeamSpotbeamSpotToken
 
edm::InputTag jetTrackTag
 
edm::EDGetTokenT
< reco::JetTracksAssociationCollection
jetTrackToken
 
ConeIsolationAlgorithmm_algo
 
bool usingBeamSpot
 
edm::InputTag vertexTag
 
edm::EDGetTokenT
< reco::VertexCollection
vertexToken
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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

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 edm::ParameterSet::getParameter().

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

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

Implements edm::EDProducer.

Definition at line 95 of file ConeIsolation.cc.

References reco::Vertex::chi2(), alignCSCRings::e, reco::Vertex::error(), edm::Event::getByToken(), i, reco::Vertex::ndof(), AlCaHLTBitMon_ParallelJobs::p, parseEventContent::prod, edm::Event::put(), reco::Vertex::tracksSize(), and reco::Vertex::z().

96 {
97  using namespace edm;
98  //Get jets with tracks
100  iEvent.getByToken(jetTrackToken,jetTracksAssociation);
101 
102  std::auto_ptr<reco::JetTagCollection> tagCollection;
103  std::auto_ptr<reco::IsolatedTauTagInfoCollection> extCollection( new reco::IsolatedTauTagInfoCollection() );
104 if (not jetTracksAssociation->empty()) {
105  RefToBaseProd<reco::Jet> prod( jetTracksAssociation->begin()->first );
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(extCollection);
151  iEvent.put(tagCollection);
152 
153 }
int i
Definition: DBlmapReader.cc:9
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:446
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
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
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)
edm::EDGetTokenT< reco::JetTracksAssociationCollection > jetTrackToken
Definition: ConeIsolation.h:33

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.