#include <RecoMuon/MuonIsolationProducers/plugins/MuIsolatorResultProducer.h>
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 | ) | [inline] |
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 190 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.
00190 : 00191 theConfig(par), 00192 theRemoveOtherVetos(par.getParameter<bool>("RemoveOtherVetos")), 00193 theIsolator(0), 00194 theBeam(0,0,0) 00195 { 00196 LogDebug("RecoMuon|MuonIsolation")<<" MuIsolatorResultProducer CTOR"; 00197 00199 std::vector<edm::ParameterSet> depositInputs = 00200 par.getParameter<std::vector<edm::ParameterSet> >("InputMuIsoDeposits"); 00201 00202 std::vector<double> dWeights( depositInputs.size()); 00203 std::vector<double> dThresholds( depositInputs.size()); 00204 00205 for (uint iDep = 0; iDep < depositInputs.size(); ++iDep){ 00206 DepositConf dConf; 00207 dConf.tag = depositInputs[iDep].getParameter<edm::InputTag>("DepositTag"); 00208 dConf.weight = depositInputs[iDep].getParameter<double>("DepositWeight"); 00209 dConf.threshold = depositInputs[iDep].getParameter<double>("DepositThreshold"); 00210 00211 dWeights[iDep] = dConf.weight; 00212 dThresholds[iDep] = dConf.threshold; 00213 00214 theDepositConfs.push_back(dConf); 00215 } 00216 00217 edm::ParameterSet isoPset = par.getParameter<edm::ParameterSet>("IsolatorPSet"); 00219 std::string isolatorType = isoPset.getParameter<std::string>("ComponentName"); 00220 if ( isolatorType == "IsolatorByDeposit"){ 00221 std::string coneSizeType = isoPset.getParameter<std::string>("ConeSizeType"); 00222 if (coneSizeType == "FixedConeSize"){ 00223 float coneSize(isoPset.getParameter<double>("coneSize")); 00224 00225 theIsolator = new IsolatorByDeposit(coneSize, dWeights, dThresholds); 00226 00227 // theIsolator = new IsolatorByDeposit(isoPset); 00228 } else if (coneSizeType == "CutsConeSize"){ 00230 // Cuts cuts(isoPset.getParameter<edm::ParameterSet>("CutsPSet")); 00231 00232 // theIsolator = new IsolatorByDeposit(coneSize, dWeights, dThresholds); 00233 } 00234 } else if ( isolatorType == "IsolatorByNominalEfficiency"){ 00236 theIsolator = new IsolatorByNominalEfficiency("noname", std::vector<std::string>(1,"8:0.97"), dWeights); 00237 } else if ( isolatorType == "IsolatorByDepositCount"){ 00238 std::string coneSizeType = isoPset.getParameter<std::string>("ConeSizeType"); 00239 if (coneSizeType == "FixedConeSize"){ 00240 float coneSize(isoPset.getParameter<double>("coneSize")); 00241 00242 theIsolator = new IsolatorByDepositCount(coneSize, dThresholds); 00243 00244 // theIsolator = new IsolatorByDeposit(isoPset); 00245 } else if (coneSizeType == "CutsConeSize"){ 00246 // Cuts cuts(isoPset.getParameter<edm::ParameterSet>("CutsPSet")); 00247 00248 // theIsolator = new IsolatorByDeposit(coneSize, dWeights, dThresholds); 00249 } 00250 } 00251 00252 if (theIsolator == 0 ){ 00253 edm::LogError("MuonIsolationProducers")<<"Failed to initialize an isolator"; 00254 } 00255 theResultType = theIsolator->resultType(); 00256 00257 callWhatProduces(); 00258 00259 if (theRemoveOtherVetos){ 00260 edm::ParameterSet vetoPSet = par.getParameter<edm::ParameterSet>("VetoPSet"); 00261 theVetoCuts.selectAll = vetoPSet.getParameter<bool>("SelectAll"); 00262 00266 if (! theVetoCuts.selectAll){ 00267 theVetoCuts.muAbsEtaMax = vetoPSet.getParameter<double>("MuAbsEtaMax"); 00268 theVetoCuts.muPtMin = vetoPSet.getParameter<double>("MuPtMin"); 00269 theVetoCuts.muAbsZMax = vetoPSet.getParameter<double>("MuAbsZMax"); 00270 theVetoCuts.muD0Max = vetoPSet.getParameter<double>("MuD0Max"); 00271 theBeamlineOption = par.getParameter<string>("BeamlineOption"); 00272 theBeamSpotLabel = par.getParameter<edm::InputTag>("BeamSpotLabel"); 00273 } 00274 } 00275 }
MuIsolatorResultProducer< BT >::~MuIsolatorResultProducer | ( | ) | [inline, virtual] |
destructor
Definition at line 279 of file MuIsolatorResultProducer.h.
References LogDebug, and MuIsolatorResultProducer< BT >::theIsolator.
00279 { 00280 if (theIsolator) delete theIsolator; 00281 LogDebug("RecoMuon|MuIsolatorResultProducer")<<" MuIsolatorResultProducer DTOR"; 00282 }
void MuIsolatorResultProducer< BT >::callWhatProduces | ( | ) | [inline, private] |
declare what's going to be produced
Definition at line 154 of file MuIsolatorResultProducer.h.
References muonisolation::MuIsoBaseIsolator::ISOL_BOOL_TYPE, muonisolation::MuIsoBaseIsolator::ISOL_FLOAT_TYPE, muonisolation::MuIsoBaseIsolator::ISOL_INT_TYPE, and MuIsolatorResultProducer< BT >::theResultType.
Referenced by MuIsolatorResultProducer< BT >::MuIsolatorResultProducer().
00154 { 00155 if (theResultType == Isolator::ISOL_FLOAT_TYPE) produces<edm::ValueMap<float> >(); 00156 if (theResultType == Isolator::ISOL_INT_TYPE ) produces<edm::ValueMap<int> >(); 00157 if (theResultType == Isolator::ISOL_BOOL_TYPE ) produces<edm::ValueMap<bool> >(); 00158 }
uint MuIsolatorResultProducer< BT >::initAssociation | ( | edm::Event & | event, | |
CandMap & | candMapT | |||
) | const [inline, 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 356 of file MuIsolatorResultProducer.h.
References muisorhelper::CandMap< BT >::get(), edm::Handle< T >::id(), LogDebug, muisorhelper::CandMap< BT >::setHandle(), ecalRecalibSequence_cff::tag, and MuIsolatorResultProducer< BT >::theDepositConfs.
Referenced by MuIsolatorResultProducer< BT >::produce().
00356 { 00357 std::string metname = "RecoMuon|MuonIsolationProducers"; 00358 00359 typedef reco::IsoDepositMap::container CT; 00360 00361 for (uint iMap = 0; iMap < theDepositConfs.size(); ++iMap){ 00362 edm::Handle<reco::IsoDepositMap> depH; 00363 event.getByLabel(theDepositConfs[iMap].tag, depH); 00364 LogDebug(metname) <<"Got Deposits of size "<<depH->size(); 00365 if (depH->size()==0) continue; 00366 00369 typename CandMap::handle_type keyH; 00370 event.get(depH->begin().id(), keyH); 00371 candMapT.setHandle(keyH); 00372 typename CT::const_iterator depHCI = depH->begin().begin(); 00373 typename CT::const_iterator depEnd = depH->begin().end(); 00374 uint keyI=0; 00375 for (; depHCI != depEnd; ++depHCI, ++keyI){ 00376 00377 typename CandMap::key_type muPtr(keyH->refAt(keyI)); 00379 if (iMap == 0) candMapT.get().push_back(typename CandMap::pair_type(muPtr, DepositContainer(theDepositConfs.size()))); 00380 typename CandMap::iterator muI = candMapT.get().begin(); 00381 for (; muI != candMapT.get().end(); ++muI){ 00382 if (muI->first == muPtr) break; 00383 } 00384 if (muI->first != muPtr){ 00385 edm::LogError("MuonIsolationProducers")<<"Failed to align muon map"; 00386 } 00387 muI->second[iMap].dep = &*depHCI; 00388 } 00389 } 00390 00391 LogDebug(metname)<<"Picked and aligned nDeps = "<<candMapT.get().size(); 00392 return candMapT.get().size(); 00393 }
void MuIsolatorResultProducer< BT >::initVetos | ( | std::vector< reco::IsoDeposit::Vetos * > & | vetos, | |
CandMap & | candMap | |||
) | const [inline, private] |
Definition at line 396 of file MuIsolatorResultProducer.h.
References debug_cff::d0, muisorhelper::CandMap< BT >::get(), LogDebug, MuIsolatorResultProducer< BT >::VetoCuts::muAbsEtaMax, MuIsolatorResultProducer< BT >::VetoCuts::muAbsZMax, MuIsolatorResultProducer< BT >::VetoCuts::muD0Max, MuIsolatorResultProducer< BT >::VetoCuts::muPtMin, MuIsolatorResultProducer< BT >::VetoCuts::selectAll, MuIsolatorResultProducer< BT >::theBeam, MuIsolatorResultProducer< BT >::theRemoveOtherVetos, and MuIsolatorResultProducer< BT >::theVetoCuts.
Referenced by MuIsolatorResultProducer< BT >::produce().
00396 { 00397 std::string metname = "RecoMuon|MuonIsolationProducers"; 00398 00399 00400 if (theRemoveOtherVetos){ 00401 LogDebug(metname)<<"Start checking for vetos based on input/expected vetos.size of "<<vetos.size() 00402 <<" passed at "<<&vetos 00403 <<" and an input map.size of "<<candMapT.get().size(); 00404 00405 uint muI = 0; 00406 for (; muI < candMapT.get().size(); ++muI) { 00407 typename CandMap::key_type mu = candMapT.get()[muI].first; 00408 double d0 = ( (mu->vx() - theBeam.x() )* mu->py() - (mu->vy() - theBeam.y())* mu->px() ) / mu->pt(); 00409 LogDebug(metname)<<"Muon at index "<<muI; 00410 if (theVetoCuts.selectAll 00411 || (fabs(mu->eta()) < theVetoCuts.muAbsEtaMax 00412 && mu->pt() > theVetoCuts.muPtMin 00413 && fabs(mu->vz()) < theVetoCuts.muAbsZMax 00414 && fabs(d0) < theVetoCuts.muD0Max 00415 ) 00416 ){ 00417 LogDebug(metname)<<"muon passes the cuts"; 00418 for (uint iDep =0; iDep < candMapT.get()[muI].second.size(); ++iDep){ 00419 if (vetos[iDep] == 0) vetos[iDep] = new reco::IsoDeposit::Vetos(); 00420 00421 vetos[iDep]->push_back(candMapT.get()[muI].second[iDep].dep->veto()); 00422 } 00423 } 00424 } 00425 00426 LogDebug(metname)<<"Assigning vetos"; 00427 muI = 0; 00428 for (; muI < candMapT.get().size(); ++muI) { 00429 for(uint iDep =0; iDep < candMapT.get()[muI].second.size(); ++iDep){ 00430 candMapT.get()[muI].second[iDep].vetos = vetos[iDep]; 00431 } 00432 } 00433 LogDebug(metname)<<"Done with vetos"; 00434 } 00435 }
void MuIsolatorResultProducer< BT >::produce | ( | edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [inline, 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 286 of file MuIsolatorResultProducer.h.
References lat::endl(), muisorhelper::CandMap< BT >::get(), MuIsolatorResultProducer< BT >::initAssociation(), MuIsolatorResultProducer< BT >::initVetos(), edm::Handle< T >::isValid(), LogDebug, LogTrace, muonisolation::MuIsoBaseIsolator::result(), bookConverter::results, muonisolation::MuIsoBaseIsolator::resultType(), MuIsolatorResultProducer< BT >::VetoCuts::selectAll, MuIsolatorResultProducer< BT >::theBeam, MuIsolatorResultProducer< BT >::theBeamlineOption, MuIsolatorResultProducer< BT >::theBeamSpotLabel, MuIsolatorResultProducer< BT >::theDepositConfs, MuIsolatorResultProducer< BT >::theIsolator, MuIsolatorResultProducer< BT >::theRemoveOtherVetos, MuIsolatorResultProducer< BT >::theVetoCuts, and MuIsolatorResultProducer< BT >::writeOut().
00286 { 00287 00288 std::string metname = "RecoMuon|MuonIsolationProducers"; 00289 LogDebug(metname)<<" Muon Deposit producing..." 00290 <<" BEGINING OF EVENT " <<"================================"; 00291 00292 theBeam = reco::TrackBase::Point(0,0, 0); 00293 00295 if(theRemoveOtherVetos && ! theVetoCuts.selectAll){ 00296 if (theBeamlineOption.compare("BeamSpotFromEvent") == 0){ 00297 //pick beamSpot 00298 reco::BeamSpot beamSpot; 00299 edm::Handle<reco::BeamSpot> beamSpotH; 00300 00301 event.getByLabel(theBeamSpotLabel,beamSpotH); 00302 00303 if (beamSpotH.isValid()){ 00304 theBeam = beamSpotH->position(); 00305 LogTrace(metname)<<"Extracted beam point at "<<theBeam<<std::endl; 00306 } 00307 } 00308 } 00309 00315 CandMap candMapT; 00316 00317 uint colSize = initAssociation(event, candMapT); 00318 00320 Results results(colSize); 00321 00323 std::vector<reco::IsoDeposit::Vetos*> vetoDeps(theDepositConfs.size(), 0); 00324 00325 if (colSize != 0){ 00326 if (theRemoveOtherVetos){ 00327 00328 initVetos(vetoDeps, candMapT); 00329 } 00330 00332 for (uint muI=0; muI < colSize; ++muI){ 00333 results[muI] = theIsolator->result(candMapT.get()[muI].second, *(candMapT.get()[muI].first)); 00334 00335 if (results[muI].typeF()!= theIsolator->resultType()){ 00336 edm::LogError("MuonIsolationProducers")<<"Failed to get result from the isolator"; 00337 } 00338 } 00339 00340 } 00341 00342 LogDebug(metname)<<"Ready to write out results of size "<<results.size(); 00343 writeOut(event, candMapT, results); 00344 00345 for(uint iDep = 0; iDep< vetoDeps.size(); ++iDep){ 00347 if (vetoDeps[iDep]){ 00348 delete vetoDeps[iDep]; 00349 vetoDeps[iDep] = 0; 00350 } 00351 } 00352 }
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 muonisolation::MuIsoBaseIsolator::ISOL_BOOL_TYPE, muonisolation::MuIsoBaseIsolator::ISOL_FLOAT_TYPE, muonisolation::MuIsoBaseIsolator::ISOL_INT_TYPE, LogDebug, muonisolation::MuIsoBaseIsolator::resultType(), MuIsolatorResultProducer< BT >::theIsolator, and MuIsolatorResultProducer< BT >::theResultType.
Referenced by MuIsolatorResultProducer< BT >::produce().
00141 { 00142 00143 std::string metname = "RecoMuon|MuonIsolationProducers"; 00144 LogDebug(metname)<<"Before calling writeOutMap with result type "<<theIsolator->resultType(); 00145 00146 if (theResultType == Isolator::ISOL_INT_TYPE) writeOutImpl<int>(event, candMapT, results); 00147 if (theResultType == Isolator::ISOL_FLOAT_TYPE) writeOutImpl<float>(event, candMapT, results); 00148 if (theResultType == Isolator::ISOL_BOOL_TYPE) writeOutImpl<bool>(event, candMapT, results); 00149 }
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 muisorhelper::CandMap< BT >::get(), muisorhelper::CandMap< BT >::handle(), and i.
00120 { 00122 std::vector<RT> resV(results.size()); 00123 for (uint i = 0; i< resV.size(); ++i) resV[i] = results[i].val<RT>(); 00124 std::auto_ptr<edm::ValueMap<RT> > outMap(new edm::ValueMap<RT>()); 00125 typename edm::ValueMap<RT>::Filler filler(*outMap); 00126 00128 if (candMapT.get().size()>0){ 00129 filler.insert(candMapT.handle(), resV.begin(), resV.end()); 00130 filler.fill(); 00131 } 00132 00133 event.put(outMap); 00134 }
reco::TrackBase::Point MuIsolatorResultProducer< BT >::theBeam [private] |
Definition at line 112 of file MuIsolatorResultProducer.h.
Referenced by MuIsolatorResultProducer< BT >::initVetos(), and MuIsolatorResultProducer< BT >::produce().
std::string MuIsolatorResultProducer< BT >::theBeamlineOption [private] |
beam spot
Definition at line 110 of file MuIsolatorResultProducer.h.
Referenced by MuIsolatorResultProducer< BT >::MuIsolatorResultProducer(), and MuIsolatorResultProducer< BT >::produce().
edm::InputTag MuIsolatorResultProducer< BT >::theBeamSpotLabel [private] |
Definition at line 111 of file MuIsolatorResultProducer.h.
Referenced by MuIsolatorResultProducer< BT >::MuIsolatorResultProducer(), and MuIsolatorResultProducer< BT >::produce().
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 >::initAssociation(), MuIsolatorResultProducer< BT >::MuIsolatorResultProducer(), and MuIsolatorResultProducer< BT >::produce().
Isolator* MuIsolatorResultProducer< BT >::theIsolator [private] |
the isolator
Definition at line 105 of file MuIsolatorResultProducer.h.
Referenced by MuIsolatorResultProducer< BT >::MuIsolatorResultProducer(), MuIsolatorResultProducer< BT >::produce(), MuIsolatorResultProducer< BT >::writeOut(), and 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 >::initVetos(), MuIsolatorResultProducer< BT >::MuIsolatorResultProducer(), and MuIsolatorResultProducer< BT >::produce().
ResultType MuIsolatorResultProducer< BT >::theResultType [private] |
Definition at line 106 of file MuIsolatorResultProducer.h.
Referenced by MuIsolatorResultProducer< BT >::callWhatProduces(), MuIsolatorResultProducer< BT >::MuIsolatorResultProducer(), and MuIsolatorResultProducer< BT >::writeOut().
VetoCuts MuIsolatorResultProducer< BT >::theVetoCuts [private] |
Definition at line 102 of file MuIsolatorResultProducer.h.
Referenced by MuIsolatorResultProducer< BT >::initVetos(), MuIsolatorResultProducer< BT >::MuIsolatorResultProducer(), and MuIsolatorResultProducer< BT >::produce().