24 using namespace muonisolation;
28 constexpr
double dRMax_CandDep = 1.0;
32 : theUseRecHitsFlag(par.getParameter<bool>(
"UseRecHitsFlag")),
33 theDepositLabel(par.getUntrackedParameter<
string>(
"DepositLabel")),
34 theDepositInstanceLabels(par.getParameter<std::
vector<std::
string> >(
"DepositInstanceLabels")),
36 theThreshold_E(par.getParameter<double>(
"Threshold_E")),
37 theThreshold_H(par.getParameter<double>(
"Threshold_H")),
38 theThreshold_HO(par.getParameter<double>(
"Threshold_HO")),
39 theDR_Veto_E(par.getParameter<double>(
"DR_Veto_E")),
40 theDR_Veto_H(par.getParameter<double>(
"DR_Veto_H")),
41 theDR_Veto_HO(par.getParameter<double>(
"DR_Veto_HO")),
42 theCenterConeOnCalIntersection(par.getParameter<bool>(
"CenterConeOnCalIntersection")),
43 theDR_Max(par.getParameter<double>(
"DR_Max")),
44 theNoise_EB(par.getParameter<double>(
"Noise_EB")),
45 theNoise_EE(par.getParameter<double>(
"Noise_EE")),
46 theNoise_HB(par.getParameter<double>(
"Noise_HB")),
47 theNoise_HE(par.getParameter<double>(
"Noise_HE")),
48 theNoise_HO(par.getParameter<double>(
"Noise_HO")),
49 theNoiseTow_EB(par.getParameter<double>(
"NoiseTow_EB")),
50 theNoiseTow_EE(par.getParameter<double>(
"NoiseTow_EE")),
52 theAssociator(nullptr),
54 thePrintTimeReport(par.getUntrackedParameter<bool>(
"PrintTimeReport")) {
88 IsoDeposit::Direction muonDir(muon.
eta(), muon.
phi());
108 LogError(
"MuonIsolation") <<
"Configuration is inconsistent: Need 3 deposit instance labels";
114 <<
"Deposit instance labels do not look like (e*, h*, ho*):"
115 <<
"proceed at your own risk. The extractor interprets lab0=from ecal; lab1=from hcal; lab2=from ho";
118 typedef IsoDeposit::Veto Veto;
121 IsoDeposit::Direction muonDir(muon.
eta(), muon.
phi());
143 double dRtmp = depEcal.veto().dR;
145 depEcal.setVeto(Veto(dirTmp, dRtmp));
148 dRtmp = depHcal.
veto().
dR;
150 depHcal.
setVeto(Veto(dirTmp, dRtmp));
153 dRtmp = depHOcal.
veto().
dR;
155 depHOcal.
setVeto(Veto(dirTmp, dRtmp));
164 std::vector<const EcalRecHit*>::const_iterator eHitCI = mInfo.
ecalRecHits.begin();
165 for (; eHitCI != mInfo.
ecalRecHits.end(); ++eHitCI) {
169 double cosTheta = 1. / cosh(eHitPos.
eta());
171 double et = energy * cosTheta;
176 bool vetoHit =
false;
180 LogDebug(
"RecoMuon|CaloExtractorByAssociator") <<
" >>> Veto ECAL hit: Calo deltaR= " << deltar;
181 LogDebug(
"RecoMuon|CaloExtractorByAssociator")
182 <<
" >>> Calo eta phi ethcal: " << eHitPos.
eta() <<
" " << eHitPos.
phi() <<
" " << et;
187 for (
unsigned int iH = 0; iH < mInfo.
crossedEcalIds.size() && !vetoHit; ++iH) {
198 depEcal.addCandEnergy(et);
205 std::vector<const HBHERecHit*>::const_iterator hHitCI = mInfo.
hcalRecHits.begin();
206 for (; hHitCI != mInfo.
hcalRecHits.end(); ++hHitCI) {
210 double cosTheta = 1. / cosh(hHitPos.
eta());
212 double et = energy * cosTheta;
217 bool vetoHit =
false;
221 LogDebug(
"RecoMuon|CaloExtractorByAssociator") <<
" >>> Veto HBHE hit: Calo deltaR= " << deltar;
222 LogDebug(
"RecoMuon|CaloExtractorByAssociator")
223 <<
" >>> Calo eta phi ethcal: " << hHitPos.
eta() <<
" " << hHitPos.
phi() <<
" " << et;
228 for (
unsigned int iH = 0; iH < mInfo.
crossedHcalIds.size() && !vetoHit; ++iH) {
246 std::vector<const HORecHit*>::const_iterator hoHitCI = mInfo.
hoRecHits.begin();
247 for (; hoHitCI != mInfo.
hoRecHits.end(); ++hoHitCI) {
248 const HORecHit* hoHitCPtr = *hoHitCI;
251 double cosTheta = 1. / cosh(hoHitPos.
eta());
253 double et = energy * cosTheta;
258 bool vetoHit =
false;
262 LogDebug(
"RecoMuon|CaloExtractorByAssociator") <<
" >>> Veto HO hit: Calo deltaR= " << deltar;
263 LogDebug(
"RecoMuon|CaloExtractorByAssociator")
264 <<
" >>> Calo eta phi ethcal: " << hoHitPos.
eta() <<
" " << hoHitPos.
phi() <<
" " << et;
269 for (
unsigned int iH = 0; iH < mInfo.
crossedHOIds.size() && !vetoHit; ++iH) {
288 std::vector<const CaloTower*>::const_iterator calCI = mInfo.
towers.begin();
289 for (; calCI != mInfo.
towers.end(); ++calCI) {
296 double etecal = calCPtr->
emEt();
299 double ethcal = calCPtr->
hadEt();
302 double ethocal = calCPtr->
outerEt();
305 if ((!doEcal) && (!doHcal) && (!doHcal))
308 bool vetoTowerEcal =
false;
312 LogDebug(
"RecoMuon|CaloExtractorByAssociator") <<
" >>> Veto ecal tower: Calo deltaR= " << deltarEcal;
313 LogDebug(
"RecoMuon|CaloExtractorByAssociator")
314 <<
" >>> Calo eta phi ethcal: " << calCPtr->
eta() <<
" " << calCPtr->
phi() <<
" " << ethcal;
315 vetoTowerEcal =
true;
317 bool vetoTowerHcal =
false;
321 LogDebug(
"RecoMuon|CaloExtractorByAssociator") <<
" >>> Veto hcal tower: Calo deltaR= " << deltarHcal;
322 LogDebug(
"RecoMuon|CaloExtractorByAssociator")
323 <<
" >>> Calo eta phi ethcal: " << calCPtr->
eta() <<
" " << calCPtr->
phi() <<
" " << ethcal;
324 vetoTowerHcal =
true;
326 bool vetoTowerHOCal =
false;
330 LogDebug(
"RecoMuon|CaloExtractorByAssociator") <<
" >>> Veto HO tower: Calo deltaR= " << deltarHOcal;
331 LogDebug(
"RecoMuon|CaloExtractorByAssociator")
332 <<
" >>> Calo eta phi ethcal: " << calCPtr->
eta() <<
" " << calCPtr->
phi() <<
" " << ethcal;
333 vetoTowerHOCal =
true;
337 if (!(vetoTowerHOCal && vetoTowerHcal && vetoTowerEcal)) {
340 vetoTowerEcal =
true;
341 vetoTowerHcal =
true;
342 vetoTowerHOCal =
true;
348 if (deltar0 >
theDR_Max && !(vetoTowerEcal || vetoTowerHcal || vetoTowerHOCal))
355 depEcal.addCandEnergy(etecal);
357 depEcal.addDeposit(towerDir, etecal);
374 std::vector<IsoDeposit> resultDeps;
375 resultDeps.push_back(depEcal);
376 resultDeps.push_back(depHcal);
377 resultDeps.push_back(depHOcal);
385 if (fabs(eta) > 1.479)
constexpr float energy() const
bool compare(const P &i, const P &j)
math::XYZPoint trkGlobPosAtHO
const Veto & veto() const
Get veto area.
std::vector< const CaloTower * > towers
void setVeto(const Veto &aVeto)
Set veto.
std::vector< DetId > crossedTowerIds
constexpr const DetId & detid() const
std::vector< const EcalRecHit * > ecalRecHits
hits in the cone
std::vector< DetId > crossedEcalIds
Geom::Phi< T > phi() const
const DetId & detid() const
constexpr uint32_t rawId() const
get the raw id
std::vector< Track > TrackCollection
collection of Tracks
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
double phi() const
azimuthal angle of momentum vector
Log< level::Error, false > LogError
std::vector< DetId > crossedHcalIds
void addDeposit(double dr, double deposit)
Add deposit (ie. transverse energy or pT)
math::XYZPoint trkGlobPosAtHcal
bool getData(T &iHolder) const
double eta() const
pseudorapidity of momentum vector
void setPropagator(const Propagator *)
use a user configured propagator
std::vector< const HBHERecHit * > hcalRecHits
void addCandEnergy(double et)
Set energy or pT attached to cand trajectory.
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::vector< DetId > crossedHOIds
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
FreeTrajectoryState initialFreeState() const
CaloTowerDetId id() const
reco::IsoDeposit IsoDeposit
T getParameter(std::string const &) const
thePropagatorName(iConfig.getParameter< std::string >("Propagator"))
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
tuple TrackAssociatorParameters
math::XYZPoint trkGlobPosAtEcal
Track position at different parts of the calorimeter.
Log< level::Warning, false > LogWarning
std::vector< const HORecHit * > hoRecHits
double phi() const final
momentum azimuthal angle
double outerEnergy() const
constexpr Detector det() const
get the detector field from this detid
double eta() const final
momentum pseudorapidity