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

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

Definition at line 69 of file Skim_ProduceIsolationMap.cc.

Constructor & Destructor Documentation

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

Definition at line 96 of file Skim_ProduceIsolationMap.cc.

References edm::ParameterSet::getParameter().

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 }
T getParameter(std::string const &) const
void useDefaultPropagator()
use the default propagator
edm::EDGetTokenT< reco::TrackCollection > inputCollectionToken_
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
edm::EDGetTokenT< reco::TrackCollection > TKToken_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
TrackDetectorAssociator trackAssociator_
TrackAssociatorParameters parameters_
ProduceIsolationMap::~ProduceIsolationMap ( )
override

Definition at line 112 of file Skim_ProduceIsolationMap.cc.

112 {}

Member Function Documentation

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

Definition at line 114 of file Skim_ProduceIsolationMap.cc.

References TrackDetMatchInfo::coneEnergy(), DEFINE_FWK_MODULE, PbPb_ZMuSkimMuonDPG_cff::deltaR, HGC3DClusterGenMatchSelector_cfi::dR, TrackDetMatchInfo::EcalRecHits, TrackDetMatchInfo::ecalRecHits, edm::helper::Filler< Map >::fill(), trigObjTnPSource_cfi::filler, edm::Event::getByToken(), TrackDetMatchInfo::HcalRecHits, TrackDetMatchInfo::hcalRecHits, info(), edm::helper::Filler< Map >::insert(), TrackDetectorAssociator::InsideOut, edm::HandleBase::isValid(), eostools::move(), and edm::Event::put().

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 }
double coneEnergy(double dR, EnergyType)
static const TGPicture * info(bool iBackgroundIsBlack)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
std::vector< const EcalRecHit * > ecalRecHits
hits in the cone
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::EDGetTokenT< reco::TrackCollection > inputCollectionToken_
edm::EDGetTokenT< reco::TrackCollection > TKToken_
TrackDetectorAssociator trackAssociator_
TrackAssociatorParameters parameters_
std::vector< const HBHERecHit * > hcalRecHits
bool isValid() const
Definition: HandleBase.h:70
HLT enums.
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

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

Definition at line 77 of file Skim_ProduceIsolationMap.cc.

double ProduceIsolationMap::IsolationConeDR_
private

Definition at line 79 of file Skim_ProduceIsolationMap.cc.

TrackAssociatorParameters ProduceIsolationMap::parameters_
private
double ProduceIsolationMap::TKIsolationPtcut_
private

Definition at line 78 of file Skim_ProduceIsolationMap.cc.

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

Definition at line 76 of file Skim_ProduceIsolationMap.cc.

TrackDetectorAssociator ProduceIsolationMap::trackAssociator_
private

Definition at line 80 of file Skim_ProduceIsolationMap.cc.