BT == base type. More...
#include <MuIsolatorResultProducer.h>
Classes | |
struct | DepositConf |
struct | VetoCuts |
Public Member Functions | |
MuIsolatorResultProducer (const edm::ParameterSet &) | |
constructor with config | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
virtual | ~MuIsolatorResultProducer () |
destructor | |
Private Types | |
typedef muisorhelper::CandMap< BT > | CandMap |
typedef muisorhelper::DepositContainer | DepositContainer |
typedef muisorhelper::Isolator | Isolator |
typedef muisorhelper::Result | Result |
typedef muisorhelper::Results | Results |
typedef muisorhelper::ResultType | ResultType |
Private Member Functions | |
void | callWhatProduces () |
declare what's going to be produced | |
unsigned int | initAssociation (edm::Event &event, CandMap &candMapT) const |
void | initVetos (std::vector< reco::IsoDeposit::Vetos * > &vetos, CandMap &candMap) const |
void | writeOut (edm::Event &event, const CandMap &candMap, const Results &results) const |
choose which result type to write here | |
template<typename RT > | |
void | writeOutImpl (edm::Event &event, const CandMap &candMapT, const Results &results) const |
actually do the writing here | |
Private Attributes | |
reco::TrackBase::Point | theBeam |
std::string | theBeamlineOption |
beam spot | |
edm::InputTag | theBeamSpotLabel |
edm::ParameterSet | theConfig |
std::vector< DepositConf > | theDepositConfs |
Isolator * | theIsolator |
the isolator | |
bool | theRemoveOtherVetos |
choose which muon vetos should be removed from all deposits | |
ResultType | theResultType |
VetoCuts | theVetoCuts |
BT == base type.
Definition at line 52 of file MuIsolatorResultProducer.h.
typedef muisorhelper::CandMap<BT> MuIsolatorResultProducer< BT >::CandMap [private] |
Definition at line 68 of file MuIsolatorResultProducer.h.
typedef muisorhelper::DepositContainer MuIsolatorResultProducer< BT >::DepositContainer [private] |
Definition at line 66 of file MuIsolatorResultProducer.h.
typedef muisorhelper::Isolator MuIsolatorResultProducer< BT >::Isolator [private] |
Definition at line 62 of file MuIsolatorResultProducer.h.
typedef muisorhelper::Result MuIsolatorResultProducer< BT >::Result [private] |
Definition at line 63 of file MuIsolatorResultProducer.h.
typedef muisorhelper::Results MuIsolatorResultProducer< BT >::Results [private] |
Definition at line 65 of file MuIsolatorResultProducer.h.
typedef muisorhelper::ResultType MuIsolatorResultProducer< BT >::ResultType [private] |
Definition at line 64 of file MuIsolatorResultProducer.h.
MuIsolatorResultProducer< BT >::MuIsolatorResultProducer | ( | const edm::ParameterSet & | par | ) |
constructor with config
read input config for deposit types and weights and thresholds to apply to them
will switch to a factory at some point
FIXME
FIXME: need to get the file name here
"other vetoes" is limited to the same collection now for non-trivial choice an external map with pre-made selection flags can be a better choice
Definition at line 186 of file MuIsolatorResultProducer.h.
References MuIsolatorResultProducer< BT >::callWhatProduces(), edm::ParameterSet::getParameter(), LogDebug, MuIsolatorResultProducer< BT >::VetoCuts::muAbsEtaMax, MuIsolatorResultProducer< BT >::VetoCuts::muAbsZMax, MuIsolatorResultProducer< BT >::VetoCuts::muD0Max, MuIsolatorResultProducer< BT >::VetoCuts::muPtMin, muonisolation::MuIsoBaseIsolator::resultType(), MuIsolatorResultProducer< BT >::VetoCuts::selectAll, MuIsolatorResultProducer< BT >::DepositConf::tag, MuIsolatorResultProducer< BT >::theBeamlineOption, MuIsolatorResultProducer< BT >::theBeamSpotLabel, MuIsolatorResultProducer< BT >::theDepositConfs, MuIsolatorResultProducer< BT >::theIsolator, MuIsolatorResultProducer< BT >::theRemoveOtherVetos, MuIsolatorResultProducer< BT >::theResultType, MuIsolatorResultProducer< BT >::theVetoCuts, MuIsolatorResultProducer< BT >::DepositConf::threshold, and MuIsolatorResultProducer< BT >::DepositConf::weight.
: theConfig(par), theRemoveOtherVetos(par.getParameter<bool>("RemoveOtherVetos")), theIsolator(0), theBeam(0,0,0) { LogDebug("RecoMuon|MuonIsolation")<<" MuIsolatorResultProducer CTOR"; std::vector<edm::ParameterSet> depositInputs = par.getParameter<std::vector<edm::ParameterSet> >("InputMuIsoDeposits"); std::vector<double> dWeights( depositInputs.size()); std::vector<double> dThresholds( depositInputs.size()); for (unsigned int iDep = 0; iDep < depositInputs.size(); ++iDep){ DepositConf dConf; dConf.tag = depositInputs[iDep].getParameter<edm::InputTag>("DepositTag"); dConf.weight = depositInputs[iDep].getParameter<double>("DepositWeight"); dConf.threshold = depositInputs[iDep].getParameter<double>("DepositThreshold"); dWeights[iDep] = dConf.weight; dThresholds[iDep] = dConf.threshold; theDepositConfs.push_back(dConf); } edm::ParameterSet isoPset = par.getParameter<edm::ParameterSet>("IsolatorPSet"); std::string isolatorType = isoPset.getParameter<std::string>("ComponentName"); if ( isolatorType == "IsolatorByDeposit"){ std::string coneSizeType = isoPset.getParameter<std::string>("ConeSizeType"); if (coneSizeType == "FixedConeSize"){ float coneSize(isoPset.getParameter<double>("coneSize")); theIsolator = new muonisolation::IsolatorByDeposit(coneSize, dWeights, dThresholds); // theIsolator = new IsolatorByDeposit(isoPset); } else if (coneSizeType == "CutsConeSize"){ // Cuts cuts(isoPset.getParameter<edm::ParameterSet>("CutsPSet")); // theIsolator = new IsolatorByDeposit(coneSize, dWeights, dThresholds); } } else if ( isolatorType == "IsolatorByNominalEfficiency"){ theIsolator = new muonisolation::IsolatorByNominalEfficiency("noname", std::vector<std::string>(1,"8:0.97"), dWeights); } else if ( isolatorType == "IsolatorByDepositCount"){ std::string coneSizeType = isoPset.getParameter<std::string>("ConeSizeType"); if (coneSizeType == "FixedConeSize"){ float coneSize(isoPset.getParameter<double>("coneSize")); theIsolator = new muonisolation::IsolatorByDepositCount(coneSize, dThresholds); // theIsolator = new IsolatorByDeposit(isoPset); } else if (coneSizeType == "CutsConeSize"){ // Cuts cuts(isoPset.getParameter<edm::ParameterSet>("CutsPSet")); // theIsolator = new IsolatorByDeposit(coneSize, dWeights, dThresholds); } } if (theIsolator == 0 ){ edm::LogError("MuonIsolationProducers")<<"Failed to initialize an isolator"; } theResultType = theIsolator->resultType(); callWhatProduces(); if (theRemoveOtherVetos){ edm::ParameterSet vetoPSet = par.getParameter<edm::ParameterSet>("VetoPSet"); theVetoCuts.selectAll = vetoPSet.getParameter<bool>("SelectAll"); if (! theVetoCuts.selectAll){ theVetoCuts.muAbsEtaMax = vetoPSet.getParameter<double>("MuAbsEtaMax"); theVetoCuts.muPtMin = vetoPSet.getParameter<double>("MuPtMin"); theVetoCuts.muAbsZMax = vetoPSet.getParameter<double>("MuAbsZMax"); theVetoCuts.muD0Max = vetoPSet.getParameter<double>("MuD0Max"); theBeamlineOption = par.getParameter<std::string>("BeamlineOption"); theBeamSpotLabel = par.getParameter<edm::InputTag>("BeamSpotLabel"); } } }
MuIsolatorResultProducer< BT >::~MuIsolatorResultProducer | ( | ) | [virtual] |
destructor
Definition at line 275 of file MuIsolatorResultProducer.h.
References LogDebug.
{ if (theIsolator) delete theIsolator; LogDebug("RecoMuon|MuIsolatorResultProducer")<<" MuIsolatorResultProducer DTOR"; }
void MuIsolatorResultProducer< BT >::callWhatProduces | ( | ) | [inline, private] |
declare what's going to be produced
Definition at line 154 of file MuIsolatorResultProducer.h.
Referenced by MuIsolatorResultProducer< BT >::MuIsolatorResultProducer().
{ if (theResultType == Isolator::ISOL_FLOAT_TYPE) produces<edm::ValueMap<float> >(); if (theResultType == Isolator::ISOL_INT_TYPE ) produces<edm::ValueMap<int> >(); if (theResultType == Isolator::ISOL_BOOL_TYPE ) produces<edm::ValueMap<bool> >(); }
unsigned int MuIsolatorResultProducer< BT >::initAssociation | ( | edm::Event & | event, |
CandMap & | candMapT | ||
) | const [private] |
WARNING: the input ValueMaps are better be for a single key product ID no effort is done (FIXME) for more complex cases
init {muon, {[deposit,veto]_type}} container
Definition at line 352 of file MuIsolatorResultProducer.h.
References muisorhelper::CandMap< BT >::get(), edm::HandleBase::id(), LogDebug, metname, muisorhelper::CandMap< BT >::setHandle(), and GlobalPosition_Frontier_DevDB_cff::tag.
{ std::string metname = "RecoMuon|MuonIsolationProducers"; typedef reco::IsoDepositMap::container CT; for (unsigned int iMap = 0; iMap < theDepositConfs.size(); ++iMap){ edm::Handle<reco::IsoDepositMap> depH; event.getByLabel(theDepositConfs[iMap].tag, depH); LogDebug(metname) <<"Got Deposits of size "<<depH->size(); if (depH->size()==0) continue; typename CandMap::handle_type keyH; event.get(depH->begin().id(), keyH); candMapT.setHandle(keyH); typename CT::const_iterator depHCI = depH->begin().begin(); typename CT::const_iterator depEnd = depH->begin().end(); unsigned int keyI=0; for (; depHCI != depEnd; ++depHCI, ++keyI){ typename CandMap::key_type muPtr(keyH->refAt(keyI)); if (iMap == 0) candMapT.get().push_back(typename CandMap::pair_type(muPtr, DepositContainer(theDepositConfs.size()))); typename CandMap::iterator muI = candMapT.get().begin(); for (; muI != candMapT.get().end(); ++muI){ if (muI->first == muPtr) break; } if (muI->first != muPtr){ edm::LogError("MuonIsolationProducers")<<"Failed to align muon map"; } muI->second[iMap].dep = &*depHCI; } } LogDebug(metname)<<"Picked and aligned nDeps = "<<candMapT.get().size(); return candMapT.get().size(); }
void MuIsolatorResultProducer< BT >::initVetos | ( | std::vector< reco::IsoDeposit::Vetos * > & | vetos, |
CandMap & | candMap | ||
) | const [private] |
Definition at line 392 of file MuIsolatorResultProducer.h.
References muisorhelper::CandMap< BT >::get(), LogDebug, metname, and RPCpg::mu.
{ std::string metname = "RecoMuon|MuonIsolationProducers"; if (theRemoveOtherVetos){ LogDebug(metname)<<"Start checking for vetos based on input/expected vetos.size of "<<vetos.size() <<" passed at "<<&vetos <<" and an input map.size of "<<candMapT.get().size(); unsigned int muI = 0; for (; muI < candMapT.get().size(); ++muI) { typename CandMap::key_type mu = candMapT.get()[muI].first; double d0 = ( (mu->vx() - theBeam.x() )* mu->py() - (mu->vy() - theBeam.y())* mu->px() ) / mu->pt(); LogDebug(metname)<<"Muon at index "<<muI; if (theVetoCuts.selectAll || (fabs(mu->eta()) < theVetoCuts.muAbsEtaMax && mu->pt() > theVetoCuts.muPtMin && fabs(mu->vz()) < theVetoCuts.muAbsZMax && fabs(d0) < theVetoCuts.muD0Max ) ){ LogDebug(metname)<<"muon passes the cuts"; for (unsigned int iDep =0; iDep < candMapT.get()[muI].second.size(); ++iDep){ if (vetos[iDep] == 0) vetos[iDep] = new reco::IsoDeposit::Vetos(); vetos[iDep]->push_back(candMapT.get()[muI].second[iDep].dep->veto()); } } } LogDebug(metname)<<"Assigning vetos"; muI = 0; for (; muI < candMapT.get().size(); ++muI) { for(unsigned int iDep =0; iDep < candMapT.get()[muI].second.size(); ++iDep){ candMapT.get()[muI].second[iDep].vetos = vetos[iDep]; } } LogDebug(metname)<<"Done with vetos"; } }
void MuIsolatorResultProducer< BT >::produce | ( | edm::Event & | event, |
const edm::EventSetup & | eventSetup | ||
) | [virtual] |
do it only if needed
"smart" container used to repackage deposits_type_candIndex into deposits_candIndex_type have to have it for veto removal (could do away without it otherwise) IMPORTANT: ALL THE REFERENCING BUSINESS IS DONE THROUGH POINTERS Access to the mapped values as reference type HAS TO BE AVAILABLE
isolator results will be here
extra vetos will be filled here
call the isolator result, passing {[deposit,vetos]_type} set and the candidate
do cleanup
Implements edm::EDProducer.
Definition at line 282 of file MuIsolatorResultProducer.h.
References SiPixelRawToDigiRegional_cfi::beamSpot, muisorhelper::CandMap< BT >::get(), edm::HandleBase::isValid(), LogDebug, LogTrace, metname, and python::entryComment::results.
{ std::string metname = "RecoMuon|MuonIsolationProducers"; LogDebug(metname)<<" Muon Deposit producing..." <<" BEGINING OF EVENT " <<"================================"; theBeam = reco::TrackBase::Point(0,0, 0); if(theRemoveOtherVetos && ! theVetoCuts.selectAll){ if (theBeamlineOption.compare("BeamSpotFromEvent") == 0){ //pick beamSpot reco::BeamSpot beamSpot; edm::Handle<reco::BeamSpot> beamSpotH; event.getByLabel(theBeamSpotLabel,beamSpotH); if (beamSpotH.isValid()){ theBeam = beamSpotH->position(); LogTrace(metname)<<"Extracted beam point at "<<theBeam<<std::endl; } } } CandMap candMapT; unsigned int colSize = initAssociation(event, candMapT); Results results(colSize); std::vector<reco::IsoDeposit::Vetos*> vetoDeps(theDepositConfs.size(), 0); if (colSize != 0){ if (theRemoveOtherVetos){ initVetos(vetoDeps, candMapT); } for (unsigned int muI=0; muI < colSize; ++muI){ results[muI] = theIsolator->result(candMapT.get()[muI].second, *(candMapT.get()[muI].first)); if (results[muI].typeF()!= theIsolator->resultType()){ edm::LogError("MuonIsolationProducers")<<"Failed to get result from the isolator"; } } } LogDebug(metname)<<"Ready to write out results of size "<<results.size(); writeOut(event, candMapT, results); for(unsigned int iDep = 0; iDep< vetoDeps.size(); ++iDep){ if (vetoDeps[iDep]){ delete vetoDeps[iDep]; vetoDeps[iDep] = 0; } } }
void MuIsolatorResultProducer< BT >::writeOut | ( | edm::Event & | event, |
const CandMap & | candMap, | ||
const Results & | results | ||
) | const [inline, private] |
choose which result type to write here
Definition at line 139 of file MuIsolatorResultProducer.h.
References event(), LogDebug, metname, and python::entryComment::results.
{ std::string metname = "RecoMuon|MuonIsolationProducers"; LogDebug(metname)<<"Before calling writeOutMap with result type "<<theIsolator->resultType(); if (theResultType == Isolator::ISOL_INT_TYPE) writeOutImpl<int>(event, candMapT, results); if (theResultType == Isolator::ISOL_FLOAT_TYPE) writeOutImpl<float>(event, candMapT, results); if (theResultType == Isolator::ISOL_BOOL_TYPE) writeOutImpl<bool>(event, candMapT, results); }
void MuIsolatorResultProducer< BT >::writeOutImpl | ( | edm::Event & | event, |
const CandMap & | candMapT, | ||
const Results & | results | ||
) | const [inline, private] |
actually do the writing here
make an output vec of what's to be written with a concrete type
fill/insert of non-empty values only
Definition at line 119 of file MuIsolatorResultProducer.h.
References edm::helper::Filler< Map >::fill(), muisorhelper::CandMap< BT >::get(), muisorhelper::CandMap< BT >::handle(), i, and edm::helper::Filler< Map >::insert().
{ std::vector<RT> resV(results.size()); for (unsigned int i = 0; i< resV.size(); ++i) resV[i] = results[i].val<RT>(); std::auto_ptr<edm::ValueMap<RT> > outMap(new edm::ValueMap<RT>()); typename edm::ValueMap<RT>::Filler filler(*outMap); if (candMapT.get().size()>0){ filler.insert(candMapT.handle(), resV.begin(), resV.end()); filler.fill(); } event.put(outMap); }
reco::TrackBase::Point MuIsolatorResultProducer< BT >::theBeam [private] |
Definition at line 112 of file MuIsolatorResultProducer.h.
std::string MuIsolatorResultProducer< BT >::theBeamlineOption [private] |
beam spot
Definition at line 110 of file MuIsolatorResultProducer.h.
Referenced by MuIsolatorResultProducer< BT >::MuIsolatorResultProducer().
edm::InputTag MuIsolatorResultProducer< BT >::theBeamSpotLabel [private] |
Definition at line 111 of file MuIsolatorResultProducer.h.
Referenced by MuIsolatorResultProducer< BT >::MuIsolatorResultProducer().
edm::ParameterSet MuIsolatorResultProducer< BT >::theConfig [private] |
Definition at line 97 of file MuIsolatorResultProducer.h.
std::vector<DepositConf> MuIsolatorResultProducer< BT >::theDepositConfs [private] |
Definition at line 98 of file MuIsolatorResultProducer.h.
Referenced by MuIsolatorResultProducer< BT >::MuIsolatorResultProducer().
Isolator* MuIsolatorResultProducer< BT >::theIsolator [private] |
the isolator
Definition at line 105 of file MuIsolatorResultProducer.h.
Referenced by MuIsolatorResultProducer< BT >::MuIsolatorResultProducer().
bool MuIsolatorResultProducer< BT >::theRemoveOtherVetos [private] |
choose which muon vetos should be removed from all deposits
Definition at line 101 of file MuIsolatorResultProducer.h.
Referenced by MuIsolatorResultProducer< BT >::MuIsolatorResultProducer().
ResultType MuIsolatorResultProducer< BT >::theResultType [private] |
Definition at line 106 of file MuIsolatorResultProducer.h.
Referenced by MuIsolatorResultProducer< BT >::MuIsolatorResultProducer().
VetoCuts MuIsolatorResultProducer< BT >::theVetoCuts [private] |
Definition at line 102 of file MuIsolatorResultProducer.h.
Referenced by MuIsolatorResultProducer< BT >::MuIsolatorResultProducer().