CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ProduceIsolationMap Class Reference
Inheritance diagram for ProduceIsolationMap:
edm::stream::EDProducer<>

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
 ProduceIsolationMap (const edm::ParameterSet &)
 
 ~ProduceIsolationMap () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

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");
104  edm::ConsumesCollector iC = consumesCollector();
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 
)
override

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.

BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:29
edm
HLT enums.
Definition: AlignableModifier.h:19
TrackDetectorAssociator::useDefaultPropagator
void useDefaultPropagator()
use the default propagator
Definition: TrackDetectorAssociator.cc:81
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
edm::Handle
Definition: AssociativeIterator.h:50
ProduceIsolationMap::inputCollectionToken_
edm::EDGetTokenT< reco::TrackCollection > inputCollectionToken_
Definition: Skim_ProduceIsolationMap.cc:77
TrackDetMatchInfo::EcalRecHits
Definition: TrackDetMatchInfo.h:15
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:47
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
TrackDetectorAssociator::InsideOut
Definition: TrackDetectorAssociator.h:50
TrackDetMatchInfo
Definition: TrackDetMatchInfo.h:13
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
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TrackDetMatchInfo::HcalRecHits
Definition: TrackDetMatchInfo.h:15
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:110
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:45
ProduceIsolationMap::trackAssociator_
TrackDetectorAssociator trackAssociator_
Definition: Skim_ProduceIsolationMap.cc:80