CMS 3D CMS Logo

Public Member Functions | Private Attributes

ProduceIsolationMap Class Reference

Inheritance diagram for ProduceIsolationMap:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 ProduceIsolationMap (const edm::ParameterSet &)
 ~ProduceIsolationMap ()

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_

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.

{
   TKLabel_          = iConfig.getParameter< edm::InputTag > ("TKLabel");
   inputCollection_  = iConfig.getParameter< edm::InputTag > ("inputCollection");
   TKIsolationPtcut_ = iConfig.getParameter< double >        ("TkIsolationPtCut");
   IsolationConeDR_  = iConfig.getParameter< double >        ("IsolationConeDR");


   // TrackAssociator parameters
   edm::ParameterSet parameters = iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters");
   parameters_.loadParameters( parameters );
   trackAssociator_.useDefaultPropagator();

   //register your products
    produces<ValueMap<HSCPIsolation> >();
}
ProduceIsolationMap::~ProduceIsolationMap ( )

Definition at line 120 of file ProduceIsolationMap.cc.

{
}

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

{
   using namespace edm;
   using namespace std;

   using reco::TrackCollection;

   Handle<TrackCollection> TKHandle;
   iEvent.getByLabel(TKLabel_,TKHandle);
   if(!TKHandle.isValid() ){  edm::LogError("ProduceIsolationMap") << "TK Tracks collection not found";    return;   }

   //Create empty output collections
   auto_ptr<ValueMap<HSCPIsolation> > trackHSCPIsolMap(new ValueMap<HSCPIsolation> );  
   ValueMap<HSCPIsolation>::Filler    filler(*trackHSCPIsolMap);
  
   //loop through tracks. 
   Handle<TrackCollection> tkTracks;
   iEvent.getByLabel(inputCollection_,tkTracks);
   std::vector<HSCPIsolation> IsolationInfoColl(tkTracks->size());

   int TkIndex=0;
   for(TrackCollection::const_iterator itTrack = tkTracks->begin(); itTrack != tkTracks->end(); ++itTrack, TkIndex++) {
      TrackDetMatchInfo info = trackAssociator_.associate(iEvent, iSetup, *itTrack, parameters_, TrackDetectorAssociator::InsideOut);


      if(info.ecalRecHits.size()>0){IsolationInfoColl[TkIndex].Set_ECAL_Energy(info.coneEnergy(IsolationConeDR_, TrackDetMatchInfo::EcalRecHits));}
      if(info.hcalRecHits.size()>0){IsolationInfoColl[TkIndex].Set_HCAL_Energy(info.coneEnergy(IsolationConeDR_, TrackDetMatchInfo::HcalRecHits));}
//      if(info.hcalRecHits.size()>0){IsolationInfoColl[TkIndex].Set_HCAL_Energy(info.hcalConeEnergy());}
//      if(info.ecalRecHits.size()>0){IsolationInfoColl[TkIndex].Set_ECAL_Energy(info.ecalConeEnergy());}

      double SumPt       = 0;
      double Count       = 0;
      double CountHighPt = 0;
      for(TrackCollection::const_iterator itTrack2 = TKHandle->begin(); itTrack2 != TKHandle->end(); ++itTrack2){
         if(fabs(itTrack->pt()-itTrack2->pt())<0.1 && fabs(itTrack->eta()-itTrack2->eta())<0.05)continue;
         float dR = deltaR(itTrack->momentum(), itTrack2->momentum());
         if(dR>IsolationConeDR_)continue;
         SumPt+= itTrack2->pt();
         Count++;
         if(itTrack2->pt()<TKIsolationPtcut_)continue;
         CountHighPt++;
      }
      IsolationInfoColl[TkIndex].Set_TK_CountHighPt(CountHighPt);
      IsolationInfoColl[TkIndex].Set_TK_Count      (Count);
      IsolationInfoColl[TkIndex].Set_TK_SumEt      (SumPt);
   }

   filler.insert(tkTracks, IsolationInfoColl.begin(), IsolationInfoColl.end());
   filler.fill();
   iEvent.put(trackHSCPIsolMap); 
}

Member Data Documentation

Definition at line 79 of file ProduceIsolationMap.cc.

Definition at line 80 of file ProduceIsolationMap.cc.

Definition at line 81 of file ProduceIsolationMap.cc.

Definition at line 82 of file ProduceIsolationMap.cc.

Definition at line 84 of file ProduceIsolationMap.cc.

Definition at line 86 of file ProduceIsolationMap.cc.

Definition at line 83 of file ProduceIsolationMap.cc.

Definition at line 78 of file ProduceIsolationMap.cc.

Definition at line 85 of file ProduceIsolationMap.cc.