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

Public Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ProduceIsolationMap (const edm::ParameterSet &)
 
 ~ProduceIsolationMap ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 72 of file ProduceIsolationMap.cc.

Constructor & Destructor Documentation

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

Definition at line 102 of file ProduceIsolationMap.cc.

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

103 {
104  TKLabel_ = iConfig.getParameter< edm::InputTag > ("TKLabel");
105  inputCollection_ = iConfig.getParameter< edm::InputTag > ("inputCollection");
106  TKIsolationPtcut_ = iConfig.getParameter< double > ("TkIsolationPtCut");
107  IsolationConeDR_ = iConfig.getParameter< double > ("IsolationConeDR");
108 
109 
110  // TrackAssociator parameters
111  edm::ParameterSet parameters = iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters");
112  parameters_.loadParameters( parameters );
114 
115  //register your products
116  produces<ValueMap<HSCPIsolation> >();
117 }
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 120 of file ProduceIsolationMap.cc.

121 {
122 }

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 125 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().

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

edm::InputTag ProduceIsolationMap::EErecHitsLabel_
private

Definition at line 80 of file ProduceIsolationMap.cc.

edm::InputTag ProduceIsolationMap::HCALrecHitsLabel_
private

Definition at line 81 of file ProduceIsolationMap.cc.

edm::InputTag ProduceIsolationMap::inputCollection_
private

Definition at line 82 of file ProduceIsolationMap.cc.

double ProduceIsolationMap::IsolationConeDR_
private

Definition at line 84 of file ProduceIsolationMap.cc.

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

Definition at line 83 of file ProduceIsolationMap.cc.

edm::InputTag ProduceIsolationMap::TKLabel_
private

Definition at line 78 of file ProduceIsolationMap.cc.

TrackDetectorAssociator ProduceIsolationMap::trackAssociator_
private

Definition at line 85 of file ProduceIsolationMap.cc.