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

virtual void produce (edm::Event &, const edm::EventSetup &) override
 
 ProduceIsolationMap (const edm::ParameterSet &)
 
 ~ProduceIsolationMap ()
 
- 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

edm::InputTag EBrecHitsLabel_
 
edm::InputTag EErecHitsLabel_
 
edm::InputTag HCALrecHitsLabel_
 
edm::InputTag inputCollection_
 
double IsolationConeDR_
 
TrackAssociatorParameters parameters_
 
double TKIsolationPtcut_
 
edm::InputTag TKLabel_
 
TrackDetectorAssociator trackAssociator_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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

Definition at line 71 of file ProduceIsolationMap.cc.

Constructor & Destructor Documentation

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

Definition at line 101 of file ProduceIsolationMap.cc.

References edm::ParameterSet::getParameter(), and Parameters::parameters.

102 {
103  TKLabel_ = iConfig.getParameter< edm::InputTag > ("TKLabel");
104  inputCollection_ = iConfig.getParameter< edm::InputTag > ("inputCollection");
105  TKIsolationPtcut_ = iConfig.getParameter< double > ("TkIsolationPtCut");
106  IsolationConeDR_ = iConfig.getParameter< double > ("IsolationConeDR");
107 
108 
109  // TrackAssociator parameters
110  edm::ParameterSet parameters = iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters");
111  parameters_.loadParameters( parameters );
113 
114  //register your products
115  produces<ValueMap<HSCPIsolation> >();
116 }
T getParameter(std::string const &) const
dictionary parameters
Definition: Parameters.py:2
edm::InputTag inputCollection_
void useDefaultPropagator()
use the default propagator
TrackDetectorAssociator trackAssociator_
TrackAssociatorParameters parameters_
void loadParameters(const edm::ParameterSet &)
ProduceIsolationMap::~ProduceIsolationMap ( )

Definition at line 119 of file ProduceIsolationMap.cc.

120 {
121 }

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 124 of file ProduceIsolationMap.cc.

References TrackDetMatchInfo::coneEnergy(), deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, TrackDetMatchInfo::EcalRecHits, TrackDetMatchInfo::ecalRecHits, edm::helper::Filler< Map >::fill(), edm::Event::getByLabel(), TrackDetMatchInfo::HcalRecHits, TrackDetMatchInfo::hcalRecHits, info(), edm::helper::Filler< Map >::insert(), TrackDetectorAssociator::InsideOut, and edm::Event::put().

125 {
126  using namespace edm;
127  using namespace std;
128 
129  using reco::TrackCollection;
130 
131  Handle<TrackCollection> TKHandle;
132  iEvent.getByLabel(TKLabel_,TKHandle);
133  if(!TKHandle.isValid() ){ edm::LogError("ProduceIsolationMap") << "TK Tracks collection not found"; return; }
134 
135  //Create empty output collections
136  auto_ptr<ValueMap<HSCPIsolation> > trackHSCPIsolMap(new ValueMap<HSCPIsolation> );
137  ValueMap<HSCPIsolation>::Filler filler(*trackHSCPIsolMap);
138 
139  //loop through tracks.
140  Handle<TrackCollection> tkTracks;
141  iEvent.getByLabel(inputCollection_,tkTracks);
142  std::vector<HSCPIsolation> IsolationInfoColl(tkTracks->size());
143 
144  int TkIndex=0;
145  for(TrackCollection::const_iterator itTrack = tkTracks->begin(); itTrack != tkTracks->end(); ++itTrack, TkIndex++) {
147 
148 
149  if(info.ecalRecHits.size()>0){IsolationInfoColl[TkIndex].Set_ECAL_Energy(info.coneEnergy(IsolationConeDR_, TrackDetMatchInfo::EcalRecHits));}
150  if(info.hcalRecHits.size()>0){IsolationInfoColl[TkIndex].Set_HCAL_Energy(info.coneEnergy(IsolationConeDR_, TrackDetMatchInfo::HcalRecHits));}
151 // if(info.hcalRecHits.size()>0){IsolationInfoColl[TkIndex].Set_HCAL_Energy(info.hcalConeEnergy());}
152 // if(info.ecalRecHits.size()>0){IsolationInfoColl[TkIndex].Set_ECAL_Energy(info.ecalConeEnergy());}
153 
154  double SumPt = 0;
155  double Count = 0;
156  double CountHighPt = 0;
157  for(TrackCollection::const_iterator itTrack2 = TKHandle->begin(); itTrack2 != TKHandle->end(); ++itTrack2){
158  if(fabs(itTrack->pt()-itTrack2->pt())<0.1 && fabs(itTrack->eta()-itTrack2->eta())<0.05)continue;
159  float dR = deltaR(itTrack->momentum(), itTrack2->momentum());
160  if(dR>IsolationConeDR_)continue;
161  SumPt+= itTrack2->pt();
162  Count++;
163  if(itTrack2->pt()<TKIsolationPtcut_)continue;
164  CountHighPt++;
165  }
166  IsolationInfoColl[TkIndex].Set_TK_CountHighPt(CountHighPt);
167  IsolationInfoColl[TkIndex].Set_TK_Count (Count);
168  IsolationInfoColl[TkIndex].Set_TK_SumEt (SumPt);
169  }
170 
171  filler.insert(tkTracks, IsolationInfoColl.begin(), IsolationInfoColl.end());
172  filler.fill();
173  iEvent.put(trackHSCPIsolMap);
174 }
double coneEnergy(double dR, EnergyType)
static const TGPicture * info(bool iBackgroundIsBlack)
edm::InputTag inputCollection_
std::vector< const EcalRecHit * > ecalRecHits
hits in the cone
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
TrackDetectorAssociator trackAssociator_
TrackAssociatorParameters parameters_
std::vector< const HBHERecHit * > hcalRecHits
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)

Member Data Documentation

edm::InputTag ProduceIsolationMap::EBrecHitsLabel_
private

Definition at line 78 of file ProduceIsolationMap.cc.

edm::InputTag ProduceIsolationMap::EErecHitsLabel_
private

Definition at line 79 of file ProduceIsolationMap.cc.

edm::InputTag ProduceIsolationMap::HCALrecHitsLabel_
private

Definition at line 80 of file ProduceIsolationMap.cc.

edm::InputTag ProduceIsolationMap::inputCollection_
private

Definition at line 81 of file ProduceIsolationMap.cc.

double ProduceIsolationMap::IsolationConeDR_
private

Definition at line 83 of file ProduceIsolationMap.cc.

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

Definition at line 82 of file ProduceIsolationMap.cc.

edm::InputTag ProduceIsolationMap::TKLabel_
private

Definition at line 77 of file ProduceIsolationMap.cc.

TrackDetectorAssociator ProduceIsolationMap::trackAssociator_
private

Definition at line 84 of file ProduceIsolationMap.cc.