CMS 3D CMS Logo

Public Member Functions | Private Attributes

muonisolation::JetExtractor Class Reference

#include <JetExtractor.h>

Inheritance diagram for muonisolation::JetExtractor:
reco::isodeposit::IsoDepositExtractor

List of all members.

Public Member Functions

virtual reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const
virtual void fillVetos (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackCollection &tracks)
 JetExtractor (const edm::ParameterSet &par)
 JetExtractor ()
virtual ~JetExtractor ()

Private Attributes

TrackDetectorAssociatortheAssociator
TrackAssociatorParameterstheAssociatorParameters
double theDR_Max
double theDR_Veto
bool theExcludeMuonVeto
edm::InputTag theJetCollectionLabel
bool thePrintTimeReport
std::string thePropagatorName
MuonServiceProxytheService
 the event setup proxy, it takes care the services update
double theThreshold

Detailed Description

Definition at line 36 of file JetExtractor.h.


Constructor & Destructor Documentation

muonisolation::JetExtractor::JetExtractor ( ) [inline]

Definition at line 40 of file JetExtractor.h.

{};
JetExtractor::JetExtractor ( const edm::ParameterSet par)

Definition at line 37 of file JetExtractor.cc.

References edm::ParameterSet::getParameter(), MuonServiceProxy_cff::MuonServiceProxy, theAssociator, theAssociatorParameters, theService, and example_cfg::TrackAssociatorParameters.

                                                  :
  theJetCollectionLabel(par.getParameter<edm::InputTag>("JetCollectionLabel")),
  thePropagatorName(par.getParameter<std::string>("PropagatorName")),
  theThreshold(par.getParameter<double>("Threshold")),
  theDR_Veto(par.getParameter<double>("DR_Veto")),
  theDR_Max(par.getParameter<double>("DR_Max")),
  theExcludeMuonVeto(par.getParameter<bool>("ExcludeMuonVeto")),
  theService(0),
  theAssociator(0),
  thePrintTimeReport(par.getUntrackedParameter<bool>("PrintTimeReport"))
{
  ParameterSet serviceParameters = par.getParameter<ParameterSet>("ServiceParameters");
  theService = new MuonServiceProxy(serviceParameters);

  theAssociatorParameters = new TrackAssociatorParameters(par.getParameter<edm::ParameterSet>("TrackAssociatorParameters"));
  theAssociator = new TrackDetectorAssociator();
}
JetExtractor::~JetExtractor ( ) [virtual]

Member Function Documentation

IsoDeposit JetExtractor::deposit ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::Track track 
) const [virtual]

make single IsoDeposit based on track as input purely virtual: have to implement in concrete implementations

Implements reco::isodeposit::IsoDepositExtractor.

Definition at line 70 of file JetExtractor.cc.

References TrackDetectorAssociator::associate(), ecalTB2006H4_GenSimDigiReco_cfg::bField, TrackDetMatchInfo::crossedTowerIds, TrackDetMatchInfo::crossedTowers, deltaR(), reco::TrackBase::eta(), edm::EventSetup::get(), reco::TransientTrack::initialFreeState(), reco::TrackBase::phi(), TrackDetectorAssociator::setPropagator(), theAssociator, theAssociatorParameters, theDR_Max, theDR_Veto, theExcludeMuonVeto, theJetCollectionLabel, thePropagatorName, theService, theThreshold, and TrackDetMatchInfo::trkGlobPosAtHcal.

{

  theService->update(eventSetup);
  theAssociator->setPropagator(&*(theService->propagator(thePropagatorName)));
 
  typedef IsoDeposit::Veto Veto;
  IsoDeposit::Direction muonDir(muon.eta(), muon.phi());
  
  IsoDeposit depJet(muonDir);

  edm::ESHandle<MagneticField> bField;
  eventSetup.get<IdealMagneticFieldRecord>().get(bField);


  reco::TransientTrack tMuon(muon, &*bField);
  FreeTrajectoryState iFTS = tMuon.initialFreeState();
  TrackDetMatchInfo mInfo = theAssociator->associate(event, eventSetup, iFTS, *theAssociatorParameters);

  reco::isodeposit::Direction vetoDirection(mInfo.trkGlobPosAtHcal.eta(), mInfo.trkGlobPosAtHcal.phi());
  depJet.setVeto(Veto(vetoDirection, theDR_Veto));


  edm::Handle<CaloJetCollection> caloJetsH;
  event.getByLabel(theJetCollectionLabel, caloJetsH);

  //use calo towers    
  CaloJetCollection::const_iterator jetCI = caloJetsH->begin();
  for (; jetCI != caloJetsH->end(); ++jetCI){
    double deltar0 = reco::deltaR(muon,*jetCI);
    if (deltar0>theDR_Max) continue;
    if (jetCI->et() < theThreshold ) continue;

    //should I make a separate config option for this?
    std::vector<CaloTowerPtr> jetConstituents = jetCI->getCaloConstituents();

    std::vector<DetId>::const_iterator crossedCI =  mInfo.crossedTowerIds.begin();
    std::vector<CaloTowerPtr>::const_iterator jetTowCI = jetConstituents.begin();
    
    double sumEtExcluded = 0;
    for (;jetTowCI != jetConstituents.end(); ++ jetTowCI){
      bool isExcluded = false;
      double deltaRLoc = reco::deltaR(vetoDirection, *jetCI);
      if (deltaRLoc < theDR_Veto){
        isExcluded = true;
      }
      for(; ! isExcluded && crossedCI != mInfo.crossedTowerIds.end(); ++crossedCI){
        if (crossedCI->rawId() == (*jetTowCI)->id().rawId()){
          isExcluded = true;
        }
      }
      if (isExcluded) sumEtExcluded += (*jetTowCI)->et();
    }
    if (theExcludeMuonVeto){
      if (jetCI->et() - sumEtExcluded < theThreshold ) continue;
    }

    double depositEt = jetCI->et();
    if (theExcludeMuonVeto) depositEt = depositEt - sumEtExcluded;

    reco::isodeposit::Direction jetDir(jetCI->eta(), jetCI->phi());
    depJet.addDeposit(jetDir, depositEt);
    
  }

  std::vector<const CaloTower*>::const_iterator crossedCI =  mInfo.crossedTowers.begin();
  double muSumEt = 0;
  for (; crossedCI != mInfo.crossedTowers.end(); ++crossedCI){
    muSumEt += (*crossedCI)->et();
  }
  depJet.addCandEnergy(muSumEt);

  return depJet;

}
void JetExtractor::fillVetos ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::TrackCollection tracks 
) [virtual]

fill vetoes: to exclude deposits at IsoDeposit creation stage check concrete extractors if it's no-op !

Implements reco::isodeposit::IsoDepositExtractor.

Definition at line 62 of file JetExtractor.cc.

{
//   LogWarning("JetExtractor")
//     <<"fillVetos does nothing now: IsoDeposit provides enough functionality\n"
//     <<"to remove a deposit at/around given (eta, phi)";

}

Member Data Documentation

Definition at line 66 of file JetExtractor.h.

Referenced by deposit(), JetExtractor(), and ~JetExtractor().

Definition at line 65 of file JetExtractor.h.

Referenced by deposit(), JetExtractor(), and ~JetExtractor().

Definition at line 57 of file JetExtractor.h.

Referenced by deposit().

Definition at line 56 of file JetExtractor.h.

Referenced by deposit().

Definition at line 60 of file JetExtractor.h.

Referenced by deposit().

Definition at line 50 of file JetExtractor.h.

Referenced by deposit().

Definition at line 68 of file JetExtractor.h.

Referenced by ~JetExtractor().

Definition at line 52 of file JetExtractor.h.

Referenced by deposit().

the event setup proxy, it takes care the services update

Definition at line 63 of file JetExtractor.h.

Referenced by deposit(), JetExtractor(), and ~JetExtractor().

Definition at line 55 of file JetExtractor.h.

Referenced by deposit().