CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ProduceIsolationMap Class Reference
Inheritance diagram for ProduceIsolationMap:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

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

Private Attributes

edm::EDGetTokenT< reco::TrackCollectioninputCollectionToken_
 
double IsolationConeDR_
 
TrackAssociatorParameters parameters_
 
double TKIsolationPtcut_
 
edm::EDGetTokenT< reco::TrackCollectionTKToken_
 
TrackDetectorAssociator trackAssociator_
 

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
 
- 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 ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 69 of file Skim_ProduceIsolationMap.cc.

Constructor & Destructor Documentation

◆ ProduceIsolationMap()

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

Definition at line 96 of file Skim_ProduceIsolationMap.cc.

96  {
97  TKToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("TKLabel"));
98  inputCollectionToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("inputCollection"));
99  TKIsolationPtcut_ = iConfig.getParameter<double>("TkIsolationPtCut");
100  IsolationConeDR_ = iConfig.getParameter<double>("IsolationConeDR");
101 
102  // TrackAssociator parameters
103  edm::ParameterSet parameters = iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters");
107 
108  //register your products
109  produces<ValueMap<HSCPIsolation> >();
110 }

References edm::ParameterSet::getParameter().

◆ ~ProduceIsolationMap()

ProduceIsolationMap::~ProduceIsolationMap ( )
override

Definition at line 112 of file Skim_ProduceIsolationMap.cc.

112 {}

Member Function Documentation

◆ produce()

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

Implements edm::EDProducer.

Definition at line 114 of file Skim_ProduceIsolationMap.cc.

114  {
115  using namespace edm;
116  using namespace std;
117 
118  using reco::TrackCollection;
119 
120  Handle<TrackCollection> TKHandle;
121  iEvent.getByToken(TKToken_, TKHandle);
122  if (!TKHandle.isValid()) {
123  edm::LogError("ProduceIsolationMap") << "TK Tracks collection not found";
124  return;
125  }
126 
127  //Create empty output collections
128  unique_ptr<ValueMap<HSCPIsolation> > trackHSCPIsolMap(new ValueMap<HSCPIsolation>);
129  ValueMap<HSCPIsolation>::Filler filler(*trackHSCPIsolMap);
130 
131  //loop through tracks.
132  Handle<TrackCollection> tkTracks;
133  iEvent.getByToken(inputCollectionToken_, tkTracks);
134  std::vector<HSCPIsolation> IsolationInfoColl(tkTracks->size());
135 
136  int TkIndex = 0;
137  for (TrackCollection::const_iterator itTrack = tkTracks->begin(); itTrack != tkTracks->end(); ++itTrack, TkIndex++) {
140 
141  if (!info.ecalRecHits.empty()) {
142  IsolationInfoColl[TkIndex].Set_ECAL_Energy(info.coneEnergy(IsolationConeDR_, TrackDetMatchInfo::EcalRecHits));
143  }
144  if (!info.hcalRecHits.empty()) {
145  IsolationInfoColl[TkIndex].Set_HCAL_Energy(info.coneEnergy(IsolationConeDR_, TrackDetMatchInfo::HcalRecHits));
146  }
147  // if(info.hcalRecHits.size()>0){IsolationInfoColl[TkIndex].Set_HCAL_Energy(info.hcalConeEnergy());}
148  // if(info.ecalRecHits.size()>0){IsolationInfoColl[TkIndex].Set_ECAL_Energy(info.ecalConeEnergy());}
149 
150  double SumPt = 0;
151  double Count = 0;
152  double CountHighPt = 0;
153  for (TrackCollection::const_iterator itTrack2 = TKHandle->begin(); itTrack2 != TKHandle->end(); ++itTrack2) {
154  if (fabs(itTrack->pt() - itTrack2->pt()) < 0.1 && fabs(itTrack->eta() - itTrack2->eta()) < 0.05)
155  continue;
156  float dR = deltaR(itTrack->momentum(), itTrack2->momentum());
157  if (dR > IsolationConeDR_)
158  continue;
159  SumPt += itTrack2->pt();
160  Count++;
161  if (itTrack2->pt() < TKIsolationPtcut_)
162  continue;
163  CountHighPt++;
164  }
165  IsolationInfoColl[TkIndex].Set_TK_CountHighPt(CountHighPt);
166  IsolationInfoColl[TkIndex].Set_TK_Count(Count);
167  IsolationInfoColl[TkIndex].Set_TK_SumEt(SumPt);
168  }
169 
170  filler.insert(tkTracks, IsolationInfoColl.begin(), IsolationInfoColl.end());
171  filler.fill();
172  iEvent.put(std::move(trackHSCPIsolMap));
173 }

References PbPb_ZMuSkimMuonDPG_cff::deltaR, HGC3DClusterGenMatchSelector_cfi::dR, TrackDetMatchInfo::EcalRecHits, trigObjTnPSource_cfi::filler, TrackDetMatchInfo::HcalRecHits, iEvent, info(), TrackDetectorAssociator::InsideOut, edm::HandleBase::isValid(), and eostools::move().

Member Data Documentation

◆ inputCollectionToken_

edm::EDGetTokenT<reco::TrackCollection> ProduceIsolationMap::inputCollectionToken_
private

Definition at line 77 of file Skim_ProduceIsolationMap.cc.

◆ IsolationConeDR_

double ProduceIsolationMap::IsolationConeDR_
private

Definition at line 79 of file Skim_ProduceIsolationMap.cc.

◆ parameters_

TrackAssociatorParameters ProduceIsolationMap::parameters_
private

◆ TKIsolationPtcut_

double ProduceIsolationMap::TKIsolationPtcut_
private

Definition at line 78 of file Skim_ProduceIsolationMap.cc.

◆ TKToken_

edm::EDGetTokenT<reco::TrackCollection> ProduceIsolationMap::TKToken_
private

Definition at line 76 of file Skim_ProduceIsolationMap.cc.

◆ trackAssociator_

TrackDetectorAssociator ProduceIsolationMap::trackAssociator_
private

Definition at line 80 of file Skim_ProduceIsolationMap.cc.

edm
HLT enums.
Definition: AlignableModifier.h:19
TrackDetectorAssociator::useDefaultPropagator
void useDefaultPropagator()
use the default propagator
Definition: TrackDetectorAssociator.cc:120
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:71
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:152
edm::Handle
Definition: AssociativeIterator.h:50
parameters
parameters
Definition: BeamSpot_PayloadInspector.cc:14
ProduceIsolationMap::inputCollectionToken_
edm::EDGetTokenT< reco::TrackCollection > inputCollectionToken_
Definition: Skim_ProduceIsolationMap.cc:77
TrackDetMatchInfo::EcalRecHits
Definition: TrackDetMatchInfo.h:16
TrackAssociatorParameters::loadParameters
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
Definition: TrackAssociatorParameters.cc:18
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition: GenABIO.cc:224
TrackDetectorAssociator::InsideOut
Definition: TrackDetectorAssociator.h:55
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
TrackDetMatchInfo
Definition: TrackDetMatchInfo.h:14
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
ProduceIsolationMap::parameters_
TrackAssociatorParameters parameters_
Definition: Skim_ProduceIsolationMap.cc:81
ProduceIsolationMap::TKIsolationPtcut_
double TKIsolationPtcut_
Definition: Skim_ProduceIsolationMap.cc:78
edm::ValueMap
Definition: ValueMap.h:107
ProduceIsolationMap::IsolationConeDR_
double IsolationConeDR_
Definition: Skim_ProduceIsolationMap.cc:79
TrackDetMatchInfo::HcalRecHits
Definition: TrackDetMatchInfo.h:16
ProduceIsolationMap::TKToken_
edm::EDGetTokenT< reco::TrackCollection > TKToken_
Definition: Skim_ProduceIsolationMap.cc:76
edm::helper::Filler
Definition: ValueMap.h:22
TrackDetectorAssociator::associate
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
Definition: TrackDetectorAssociator.cc:154
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::InputTag
Definition: InputTag.h:15
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
ProduceIsolationMap::trackAssociator_
TrackDetectorAssociator trackAssociator_
Definition: Skim_ProduceIsolationMap.cc:80