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

Definition at line 71 of file Skim_ProduceIsolationMap.cc.

Constructor & Destructor Documentation

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

Definition at line 98 of file Skim_ProduceIsolationMap.cc.

References edm::ParameterSet::getParameter().

99 {
100  TKToken_ = consumes<reco::TrackCollection>(iConfig.getParameter< edm::InputTag > ("TKLabel"));
101  inputCollectionToken_ = consumes<reco::TrackCollection>(iConfig.getParameter< edm::InputTag > ("inputCollection"));
102  TKIsolationPtcut_ = iConfig.getParameter< double > ("TkIsolationPtCut");
103  IsolationConeDR_ = iConfig.getParameter< double > ("IsolationConeDR");
104 
105 
106  // TrackAssociator parameters
107  edm::ParameterSet parameters = iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters");
111 
112  //register your products
113  produces<ValueMap<HSCPIsolation> >();
114 }
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 117 of file Skim_ProduceIsolationMap.cc.

118 {
119 }

Member Function Documentation

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

Definition at line 122 of file Skim_ProduceIsolationMap.cc.

References TrackDetMatchInfo::coneEnergy(), DEFINE_FWK_MODULE, deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, TrackDetMatchInfo::EcalRecHits, TrackDetMatchInfo::ecalRecHits, edm::helper::Filler< Map >::fill(), objects.autophobj::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().

123 {
124  using namespace edm;
125  using namespace std;
126 
127  using reco::TrackCollection;
128 
129  Handle<TrackCollection> TKHandle;
130  iEvent.getByToken(TKToken_,TKHandle);
131  if(!TKHandle.isValid() ){ edm::LogError("ProduceIsolationMap") << "TK Tracks collection not found"; return; }
132 
133  //Create empty output collections
134  unique_ptr<ValueMap<HSCPIsolation> > trackHSCPIsolMap(new ValueMap<HSCPIsolation> );
135  ValueMap<HSCPIsolation>::Filler filler(*trackHSCPIsolMap);
136 
137  //loop through tracks.
138  Handle<TrackCollection> tkTracks;
139  iEvent.getByToken(inputCollectionToken_,tkTracks);
140  std::vector<HSCPIsolation> IsolationInfoColl(tkTracks->size());
141 
142  int TkIndex=0;
143  for(TrackCollection::const_iterator itTrack = tkTracks->begin(); itTrack != tkTracks->end(); ++itTrack, TkIndex++) {
145 
146 
147  if(!info.ecalRecHits.empty()){IsolationInfoColl[TkIndex].Set_ECAL_Energy(info.coneEnergy(IsolationConeDR_, TrackDetMatchInfo::EcalRecHits));}
148  if(!info.hcalRecHits.empty()){IsolationInfoColl[TkIndex].Set_HCAL_Energy(info.coneEnergy(IsolationConeDR_, TrackDetMatchInfo::HcalRecHits));}
149 // if(info.hcalRecHits.size()>0){IsolationInfoColl[TkIndex].Set_HCAL_Energy(info.hcalConeEnergy());}
150 // if(info.ecalRecHits.size()>0){IsolationInfoColl[TkIndex].Set_ECAL_Energy(info.ecalConeEnergy());}
151 
152  double SumPt = 0;
153  double Count = 0;
154  double CountHighPt = 0;
155  for(TrackCollection::const_iterator itTrack2 = TKHandle->begin(); itTrack2 != TKHandle->end(); ++itTrack2){
156  if(fabs(itTrack->pt()-itTrack2->pt())<0.1 && fabs(itTrack->eta()-itTrack2->eta())<0.05)continue;
157  float dR = deltaR(itTrack->momentum(), itTrack2->momentum());
158  if(dR>IsolationConeDR_)continue;
159  SumPt+= itTrack2->pt();
160  Count++;
161  if(itTrack2->pt()<TKIsolationPtcut_)continue;
162  CountHighPt++;
163  }
164  IsolationInfoColl[TkIndex].Set_TK_CountHighPt(CountHighPt);
165  IsolationInfoColl[TkIndex].Set_TK_Count (Count);
166  IsolationInfoColl[TkIndex].Set_TK_SumEt (SumPt);
167  }
168 
169  filler.insert(tkTracks, IsolationInfoColl.begin(), IsolationInfoColl.end());
170  filler.fill();
171  iEvent.put(std::move(trackHSCPIsolMap));
172 }
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:137
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
std::vector< const EcalRecHit * > ecalRecHits
hits in the cone
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:15
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:74
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
HLT enums.
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

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

Definition at line 78 of file Skim_ProduceIsolationMap.cc.

double ProduceIsolationMap::IsolationConeDR_
private

Definition at line 80 of file Skim_ProduceIsolationMap.cc.

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

Definition at line 79 of file Skim_ProduceIsolationMap.cc.

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

Definition at line 77 of file Skim_ProduceIsolationMap.cc.

TrackDetectorAssociator ProduceIsolationMap::trackAssociator_
private

Definition at line 81 of file Skim_ProduceIsolationMap.cc.