CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
muonisolation::CaloExtractorByAssociator Class Reference

#include <CaloExtractorByAssociator.h>

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

Public Member Functions

 CaloExtractorByAssociator ()
 constructors More...
 
 CaloExtractorByAssociator (const edm::ParameterSet &par, edm::ConsumesCollector &&iC)
 
reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const override
 no-op: by design of this extractor the deposits are pulled out all at a time More...
 
std::vector< reco::IsoDepositdeposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const override
 return deposits for 3 calorimeter subdetectors (ecal, hcal, ho) – in this order More...
 
void fillVetos (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackCollection &tracks) override
 allows to set extra vetoes (in addition to the muon) – no-op at this point More...
 
 ~CaloExtractorByAssociator () override
 destructor More...
 
- Public Member Functions inherited from reco::isodeposit::IsoDepositExtractor
virtual reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackBaseRef &track) const
 make single IsoDeposit based on trackRef as input More...
 
virtual reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Candidate &track) const
 
virtual reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::CandidateBaseRef &track) const
 make single IsoDeposit based on a CandidateBaseRef as input More...
 
virtual std::vector< reco::IsoDepositdeposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackBaseRef &track) const
 
virtual std::vector< reco::IsoDepositdeposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Candidate &track) const
 
virtual std::vector< reco::IsoDepositdeposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::CandidateBaseRef &track) const
 
virtual void initEvent (const edm::Event &, const edm::EventSetup &)
 perform some constly initialization More...
 
virtual ~IsoDepositExtractor ()
 Destructor. More...
 

Private Member Functions

double noiseEcal (const CaloTower &tower) const
 Determine noise for HCAL and ECAL (take some defaults for the time being) More...
 
double noiseHcal (const CaloTower &tower) const
 
double noiseHOcal (const CaloTower &tower) const
 
double noiseRecHit (const DetId &detId) const
 

Private Attributes

edm::ESGetToken< MagneticField, IdealMagneticFieldRecordbFieldToken_
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordcaloGeomToken_
 
edm::ESGetToken< EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcdecalPFRechitThresholdsToken_
 
bool ecalRecHitThresh_
 
EcalPFRecHitThresholdsecalThresholds = nullptr
 
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcdhcalChannelQualityToken_
 
HcalChannelQualityhcalChStatus_
 
HcalPFCutshcalCuts = nullptr
 
bool hcalCutsFromDB_
 
edm::ESGetToken< HcalPFCuts, HcalPFCutsRcdhcalCutsToken_
 
HcalSeverityLevelComputerhcalSevLvlComputer_
 
edm::ESGetToken< HcalSeverityLevelComputer, HcalSeverityLevelComputerRcdhcalSevLvlComputerToken_
 
HcalTopologyhcalTopology_
 
edm::ESGetToken< HcalTopology, HcalRecNumberingRecordhcalTopologyToken_
 
TrackDetectorAssociatortheAssociator
 
TrackAssociatorParameterstheAssociatorParameters
 associator, its' parameters and the propagator More...
 
bool theCenterConeOnCalIntersection
 
std::vector< std::string > theDepositInstanceLabels
 multiple deposits: labels – expect 3 labels beginning with "e", "h", "ho" More...
 
std::string theDepositLabel
 Label of deposit – suggest to set to "" (all info is in collection name anyways) More...
 
double theDR_Max
 max cone size in which towers are considered More...
 
double theDR_Veto_E
 cone sizes inside which the Et (towers) are not counted More...
 
double theDR_Veto_H
 
double theDR_Veto_HO
 
int theMaxSeverityHB
 
int theMaxSeverityHE
 
double theNoise_EB
 
double theNoise_EE
 
double theNoise_HB
 
double theNoise_HE
 
double theNoise_HO
 
double theNoiseTow_EB
 
double theNoiseTow_EE
 
bool thePrintTimeReport
 flag to turn on/off printing of a time report More...
 
std::string thePropagatorName
 propagator name to feed into the track associator More...
 
MuonServiceProxytheService
 the event setup proxy, it takes care the services update More...
 
double theThreshold_E
 
double theThreshold_H
 
double theThreshold_HO
 
bool theUseEcalRecHitsFlag
 use towers or rec hits More...
 
bool theUseHcalRecHitsFlag
 
bool theUseHORecHitsFlag
 
std::vector< DetIdtheVetoCollection
 Vector of calo Ids to veto – not used. More...
 

Detailed Description

Definition at line 49 of file CaloExtractorByAssociator.h.

Constructor & Destructor Documentation

◆ CaloExtractorByAssociator() [1/2]

muonisolation::CaloExtractorByAssociator::CaloExtractorByAssociator ( )
inline

constructors

Definition at line 52 of file CaloExtractorByAssociator.h.

52 {};

◆ CaloExtractorByAssociator() [2/2]

CaloExtractorByAssociator::CaloExtractorByAssociator ( const edm::ParameterSet par,
edm::ConsumesCollector &&  iC 
)

Definition at line 40 of file CaloExtractorByAssociator.cc.

References caloGeomToken_, ecalPFRechitThresholdsToken_, ecalRecHitThresh_, edm::ParameterSet::getParameter(), hcalChannelQualityToken_, hcalCutsFromDB_, hcalCutsToken_, hcalSevLvlComputerToken_, hcalTopologyToken_, TrackAssociatorParameters::loadParameters(), MuonServiceProxy_cff::MuonServiceProxy, theAssociator, theAssociatorParameters, theService, and HLT_2024v14_cff::TrackAssociatorParameters.

41  : theUseEcalRecHitsFlag(par.getParameter<bool>("UseEcalRecHitsFlag")),
42  theUseHcalRecHitsFlag(par.getParameter<bool>("UseHcalRecHitsFlag")),
43  theUseHORecHitsFlag(par.getParameter<bool>("UseHORecHitsFlag")),
44  theDepositLabel(par.getUntrackedParameter<string>("DepositLabel")),
45  theDepositInstanceLabels(par.getParameter<std::vector<std::string> >("DepositInstanceLabels")),
46  thePropagatorName(par.getParameter<std::string>("PropagatorName")),
47  theThreshold_E(par.getParameter<double>("Threshold_E")),
48  theThreshold_H(par.getParameter<double>("Threshold_H")),
49  theThreshold_HO(par.getParameter<double>("Threshold_HO")),
50  theMaxSeverityHB(par.getParameter<int>("MaxSeverityHB")),
51  theMaxSeverityHE(par.getParameter<int>("MaxSeverityHE")),
52  theDR_Veto_E(par.getParameter<double>("DR_Veto_E")),
53  theDR_Veto_H(par.getParameter<double>("DR_Veto_H")),
54  theDR_Veto_HO(par.getParameter<double>("DR_Veto_HO")),
55  theCenterConeOnCalIntersection(par.getParameter<bool>("CenterConeOnCalIntersection")),
56  theDR_Max(par.getParameter<double>("DR_Max")),
57  theNoise_EB(par.getParameter<double>("Noise_EB")),
58  theNoise_EE(par.getParameter<double>("Noise_EE")),
59  theNoise_HB(par.getParameter<double>("Noise_HB")),
60  theNoise_HE(par.getParameter<double>("Noise_HE")),
61  theNoise_HO(par.getParameter<double>("Noise_HO")),
62  theNoiseTow_EB(par.getParameter<double>("NoiseTow_EB")),
63  theNoiseTow_EE(par.getParameter<double>("NoiseTow_EE")),
64  theService(nullptr),
65  theAssociator(nullptr),
67  thePrintTimeReport(par.getUntrackedParameter<bool>("PrintTimeReport")) {
68  ParameterSet serviceParameters = par.getParameter<ParameterSet>("ServiceParameters");
69  theService = new MuonServiceProxy(serviceParameters, edm::ConsumesCollector(iC));
70 
71  //theAssociatorParameters = new TrackAssociatorParameters(par.getParameter<edm::ParameterSet>("TrackAssociatorParameters"), iC);
73  theAssociatorParameters->loadParameters(par.getParameter<edm::ParameterSet>("TrackAssociatorParameters"), iC);
75 
76  ecalRecHitThresh_ = par.getParameter<bool>("EcalRecHitThresh");
77  hcalCutsFromDB_ = par.getParameter<bool>("HcalCutsFromDB");
78 
85 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > bFieldToken_
edm::ESGetToken< HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd > hcalSevLvlComputerToken_
std::string thePropagatorName
propagator name to feed into the track associator
std::string theDepositLabel
Label of deposit – suggest to set to "" (all info is in collection name anyways) ...
double theDR_Max
max cone size in which towers are considered
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > hcalChannelQualityToken_
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
edm::ESGetToken< HcalPFCuts, HcalPFCutsRcd > hcalCutsToken_
edm::ESGetToken< EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd > ecalPFRechitThresholdsToken_
std::vector< std::string > theDepositInstanceLabels
multiple deposits: labels – expect 3 labels beginning with "e", "h", "ho"
double theDR_Veto_E
cone sizes inside which the Et (towers) are not counted
TrackAssociatorParameters * theAssociatorParameters
associator, its&#39; parameters and the propagator
T getUntrackedParameter(std::string const &, T const &) const
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > hcalTopologyToken_
bool thePrintTimeReport
flag to turn on/off printing of a time report
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_

◆ ~CaloExtractorByAssociator()

CaloExtractorByAssociator::~CaloExtractorByAssociator ( )
override

destructor

Definition at line 87 of file CaloExtractorByAssociator.cc.

References theAssociator, theAssociatorParameters, and theService.

87  {
90  if (theService)
91  delete theService;
92  if (theAssociator)
93  delete theAssociator;
94 }
TrackAssociatorParameters * theAssociatorParameters
associator, its&#39; parameters and the propagator
MuonServiceProxy * theService
the event setup proxy, it takes care the services update

Member Function Documentation

◆ deposit()

IsoDeposit CaloExtractorByAssociator::deposit ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::Track track 
) const
overridevirtual

no-op: by design of this extractor the deposits are pulled out all at a time

Implements reco::isodeposit::IsoDepositExtractor.

Definition at line 104 of file CaloExtractorByAssociator.cc.

106  {
107  IsoDeposit::Direction muonDir(muon.eta(), muon.phi());
108  IsoDeposit dep(muonDir);
109 
110  // LogWarning("CaloExtractorByAssociator")
111  // <<"single deposit is not an option here\n"
112  // <<"use ::deposits --> extract all and reweight as necessary";
113 
114  return dep;
115 }

◆ deposits()

std::vector< IsoDeposit > CaloExtractorByAssociator::deposits ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::Track track 
) const
overridevirtual

return deposits for 3 calorimeter subdetectors (ecal, hcal, ho) – in this order

Make separate deposits: for ECAL, HCAL, HO.

check configuration consistency could've been made at construction stage (fix later?)













this should be (eventually) set to the eta-phi of the crossing point of a straight line tangent to a muon at IP and the calorimeter












each deposit type veto is at the point of intersect with that detector

first check if the hit is inside the veto cone by dR-alone

and now pitch those in the crossed list

first check if the hit is inside the veto cone by dR-alone

and now pitch those in the crossed list

first check if the hit is inside the veto cone by dR-alone

and now pitch those in the crossed list

use calo towers

first check if the tower is inside the veto cone by dR-alone

first check if the tower is inside the veto cone by dR-alone

first check if the tower is inside the veto cone by dR-alone

and now pitch those in the crossed list

add the Et of the tower to deposits if it's not a vetoed; put into muonEnergy otherwise

Reimplemented from reco::isodeposit::IsoDepositExtractor.

Definition at line 118 of file CaloExtractorByAssociator.cc.

References reco::IsoDeposit::addCandEnergy(), reco::IsoDeposit::addDeposit(), TrackDetectorAssociator::associate(), Calorimetry_cff::bField, bFieldToken_, caloGeomToken_, compare(), TrackDetMatchInfo::crossedEcalIds, TrackDetMatchInfo::crossedHcalIds, TrackDetMatchInfo::crossedHOIds, TrackDetMatchInfo::crossedTowerIds, reco::deltaR2(), HLTMuonOfflineAnalyzer_cfi::deltaR2, CaloRecHit::detid(), EcalRecHit::detid(), reco::IsoDeposit::Veto::dR, ecalPFRechitThresholdsToken_, TrackDetMatchInfo::ecalRecHits, ecalThresholds, CaloTower::emEnergy(), CaloTower::emEt(), hcalRecHitTable_cff::energy, CaloRecHit::energy(), EcalRecHit::energy(), l1tnanotables_cff::et, PV3DBase< T, PVType, FrameType >::eta(), reco::LeafCandidate::eta(), options_cfi::eventSetup, RemoveAddSevLevel::flag, CaloRecHit::flags(), HcalSeverityLevelComputer::getSeverityLevel(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), CaloTower::hadEnergy(), CaloTower::hadEt(), HcalBarrel, hcalChannelQualityToken_, hcalChStatus_, hcalCuts, hcalCutsToken_, HcalEndcap, TrackDetMatchInfo::hcalRecHits, hcalSevLvlComputer_, hcalSevLvlComputerToken_, hcalTopology_, hcalTopologyToken_, TrackDetMatchInfo::hoRecHits, HBHERecHit::id(), CaloTower::id(), HcalTopology::idFront(), reco::TransientTrack::initialFreeState(), B2GTnPMonitor_cfi::item, LogDebug, SiStripPI::max, noiseEcal(), noiseHcal(), noiseHOcal(), noiseRecHit(), l1tHGCalVFEProducer_cfi::noiseThreshold, or, CaloTower::outerEnergy(), CaloTower::outerEt(), PV3DBase< T, PVType, FrameType >::phi(), reco::LeafCandidate::phi(), funct::pow(), DetId::rawId(), HcalSeverityLevelComputer::recoveredRecHit(), TrackDetectorAssociator::setPropagator(), reco::IsoDeposit::setVeto(), ErrorSummaryFilter_cfi::severity, AlCaHLTBitMon_QueryRunRegistry::string, theAssociator, theAssociatorParameters, theCenterConeOnCalIntersection, theDepositInstanceLabels, theDR_Max, theDR_Veto_E, theDR_Veto_H, theDR_Veto_HO, theMaxSeverityHB, theMaxSeverityHE, thePropagatorName, theService, theThreshold_E, theThreshold_H, theThreshold_HO, theUseEcalRecHitsFlag, theUseHcalRecHitsFlag, theUseHORecHitsFlag, TrackDetMatchInfo::towers, TrackDetMatchInfo::trkGlobPosAtEcal, TrackDetMatchInfo::trkGlobPosAtHcal, TrackDetMatchInfo::trkGlobPosAtHO, reco::IsoDeposit::veto(), and reco::IsoDeposit::Veto::vetoDir.

120  {
121  theService->update(eventSetup);
123 
125  const HcalPFCuts* hcalCuts = &eventSetup.getData(hcalCutsToken_);
129 
132  if (theDepositInstanceLabels.size() != 3) {
133  LogError("MuonIsolation") << "Configuration is inconsistent: Need 3 deposit instance labels";
134  }
135  if (!(theDepositInstanceLabels[0].compare(0, 1, std::string("e")) == 0) ||
136  !(theDepositInstanceLabels[1].compare(0, 1, std::string("h")) == 0) ||
137  !(theDepositInstanceLabels[2].compare(0, 2, std::string("ho")) == 0)) {
138  LogWarning("MuonIsolation")
139  << "Deposit instance labels do not look like (e*, h*, ho*):"
140  << "proceed at your own risk. The extractor interprets lab0=from ecal; lab1=from hcal; lab2=from ho";
141  }
142 
143  typedef IsoDeposit::Veto Veto;
146  IsoDeposit::Direction muonDir(muon.eta(), muon.phi());
147 
148  IsoDeposit depEcal(muonDir);
149  IsoDeposit depHcal(muonDir);
150  IsoDeposit depHOcal(muonDir);
151 
152  auto const& bField = eventSetup.getData(bFieldToken_);
153 
155  FreeTrajectoryState iFTS = tMuon.initialFreeState();
157 
159  depEcal.setVeto(
161  depHcal.setVeto(
163  depHOcal.setVeto(
165 
167  reco::isodeposit::Direction dirTmp = depEcal.veto().vetoDir;
168  double dRtmp = depEcal.veto().dR;
169  depEcal = IsoDeposit(dirTmp);
170  depEcal.setVeto(Veto(dirTmp, dRtmp));
171 
172  dirTmp = depHcal.veto().vetoDir;
173  dRtmp = depHcal.veto().dR;
174  depHcal = IsoDeposit(dirTmp);
175  depHcal.setVeto(Veto(dirTmp, dRtmp));
176 
177  dirTmp = depHOcal.veto().vetoDir;
178  dRtmp = depHOcal.veto().dR;
179  depHOcal = IsoDeposit(dirTmp);
180  depHOcal.setVeto(Veto(dirTmp, dRtmp));
181  }
182 
183  if (theUseEcalRecHitsFlag) {
184  //Ecal
185  auto const& caloGeom = eventSetup.getData(caloGeomToken_);
186  std::vector<const EcalRecHit*>::const_iterator eHitCI = mInfo.ecalRecHits.begin();
187  for (; eHitCI != mInfo.ecalRecHits.end(); ++eHitCI) {
188  const EcalRecHit* eHitCPtr = *eHitCI;
189  GlobalPoint eHitPos = caloGeom.getPosition(eHitCPtr->detid());
190  double deltaR2 = reco::deltaR2(muon, eHitPos);
191  double cosTheta = 1. / cosh(eHitPos.eta());
192  double energy = eHitCPtr->energy();
193  double et = energy * cosTheta;
194  if (deltaR2 > std::max(dRMax_CandDep * dRMax_CandDep, theDR_Max * theDR_Max))
195  continue;
196 
197  if (ecalThresholds != nullptr) { // use thresholds from rechit
198  float rhThres = (ecalThresholds != nullptr) ? (*ecalThresholds)[eHitCPtr->detid()] : 0.f;
199  if (energy <= rhThres)
200  continue;
201  } else { // use thresholds from config
202  if (et <= theThreshold_E || energy <= 3 * noiseRecHit(eHitCPtr->detid()))
203  continue;
204  }
205 
206  bool vetoHit = false;
208  if (deltaR2 < std::pow(theDR_Veto_E, 2)) {
209  LogDebug("RecoMuon|CaloExtractorByAssociator") << " >>> Veto ECAL hit: Calo deltaR2= " << deltaR2;
210  LogDebug("RecoMuon|CaloExtractorByAssociator")
211  << " >>> Calo eta phi ethcal: " << eHitPos.eta() << " " << eHitPos.phi() << " " << et;
212  vetoHit = true;
213  }
215  if (!vetoHit) {
216  for (unsigned int iH = 0; iH < mInfo.crossedEcalIds.size() && !vetoHit; ++iH) {
217  if (mInfo.crossedEcalIds[iH].rawId() == eHitCPtr->detid().rawId())
218  vetoHit = true;
219  }
220  }
221 
222  //check theDR_Max only here to keep vetoHits being added to the veto energy
223  if (deltaR2 > std::pow(theDR_Max, 2) && !vetoHit)
224  continue;
225 
226  if (vetoHit) {
227  depEcal.addCandEnergy(et);
228  } else {
229  depEcal.addDeposit(reco::isodeposit::Direction(eHitPos.eta(), eHitPos.phi()), et);
230  }
231  }
232  }
233 
234  if (theUseHcalRecHitsFlag) {
235  //Hcal
236  auto const& caloGeom = eventSetup.getData(caloGeomToken_);
237  std::vector<const HBHERecHit*>::const_iterator hHitCI = mInfo.hcalRecHits.begin();
238  for (; hHitCI != mInfo.hcalRecHits.end(); ++hHitCI) {
239  const HBHERecHit* hHitCPtr = *hHitCI;
240  GlobalPoint hHitPos = caloGeom.getPosition(hHitCPtr->detid());
241  double deltaR2 = reco::deltaR2(muon, hHitPos);
242  double cosTheta = 1. / cosh(hHitPos.eta());
243  double energy = hHitCPtr->energy();
244  double et = energy * cosTheta;
245  if (deltaR2 > std::max(dRMax_CandDep * dRMax_CandDep, theDR_Max * theDR_Max))
246  continue;
247 
248  // check Hcal Cuts from DB
249  if (hcalCuts != nullptr) {
250  const HcalPFCut* item = hcalCuts->getValues(hHitCPtr->id().rawId());
251  if (energy <= item->noiseThreshold())
252  continue;
253  } else {
254  if (et <= theThreshold_H || energy <= 3 * noiseRecHit(hHitCPtr->detid()))
255  continue;
256  }
257 
258  const HcalDetId hid(hHitCPtr->detid());
259  DetId did = hcalTopology_->idFront(hid);
260  const uint32_t flag = hHitCPtr->flags();
261  const uint32_t dbflag = hcalChStatus_->getValues(did)->getValue();
262  bool recovered = hcalSevLvlComputer_->recoveredRecHit(did, flag);
263  int severity = hcalSevLvlComputer_->getSeverityLevel(did, flag, dbflag);
264 
265  const bool goodHB = hid.subdet() == HcalBarrel and (severity <= theMaxSeverityHB or recovered);
266  const bool goodHE = hid.subdet() == HcalEndcap and (severity <= theMaxSeverityHE or recovered);
267  if (!goodHB and !goodHE)
268  continue;
269 
270  bool vetoHit = false;
272  if (deltaR2 < std::pow(theDR_Veto_H, 2)) {
273  LogDebug("RecoMuon|CaloExtractorByAssociator") << " >>> Veto HBHE hit: Calo deltaR2= " << deltaR2;
274  LogDebug("RecoMuon|CaloExtractorByAssociator")
275  << " >>> Calo eta phi ethcal: " << hHitPos.eta() << " " << hHitPos.phi() << " " << et;
276  vetoHit = true;
277  }
279  if (!vetoHit) {
280  for (unsigned int iH = 0; iH < mInfo.crossedHcalIds.size() && !vetoHit; ++iH) {
281  if (mInfo.crossedHcalIds[iH].rawId() == hHitCPtr->detid().rawId())
282  vetoHit = true;
283  }
284  }
285 
286  //check theDR_Max only here to keep vetoHits being added to the veto energy
287  if (deltaR2 > std::pow(theDR_Max, 2) && !vetoHit)
288  continue;
289 
290  if (vetoHit) {
291  depHcal.addCandEnergy(et);
292  } else {
293  depHcal.addDeposit(reco::isodeposit::Direction(hHitPos.eta(), hHitPos.phi()), et);
294  }
295  }
296  }
297 
298  if (theUseHORecHitsFlag) {
299  //HOcal
300  auto const& caloGeom = eventSetup.getData(caloGeomToken_);
301  std::vector<const HORecHit*>::const_iterator hoHitCI = mInfo.hoRecHits.begin();
302  for (; hoHitCI != mInfo.hoRecHits.end(); ++hoHitCI) {
303  const HORecHit* hoHitCPtr = *hoHitCI;
304  GlobalPoint hoHitPos = caloGeom.getPosition(hoHitCPtr->detid());
305  double deltaR2 = reco::deltaR2(muon, hoHitPos);
306  double cosTheta = 1. / cosh(hoHitPos.eta());
307  double energy = hoHitCPtr->energy();
308  double et = energy * cosTheta;
309  if (deltaR2 > std::max(dRMax_CandDep * dRMax_CandDep, theDR_Max * theDR_Max) ||
310  !(et > theThreshold_HO && energy > 3 * noiseRecHit(hoHitCPtr->detid())))
311  continue;
312 
313  bool vetoHit = false;
315  if (deltaR2 < std::pow(theDR_Veto_HO, 2)) {
316  LogDebug("RecoMuon|CaloExtractorByAssociator") << " >>> Veto HO hit: Calo deltaR2= " << deltaR2;
317  LogDebug("RecoMuon|CaloExtractorByAssociator")
318  << " >>> Calo eta phi ethcal: " << hoHitPos.eta() << " " << hoHitPos.phi() << " " << et;
319  vetoHit = true;
320  }
322  if (!vetoHit) {
323  for (unsigned int iH = 0; iH < mInfo.crossedHOIds.size() && !vetoHit; ++iH) {
324  if (mInfo.crossedHOIds[iH].rawId() == hoHitCPtr->detid().rawId())
325  vetoHit = true;
326  }
327  }
328 
329  //check theDR_Max only here to keep vetoHits being added to the veto energy
330  if (deltaR2 > std::pow(theDR_Max, 2) && !vetoHit)
331  continue;
332 
333  if (vetoHit) {
334  depHOcal.addCandEnergy(et);
335  } else {
336  depHOcal.addDeposit(reco::isodeposit::Direction(hoHitPos.eta(), hoHitPos.phi()), et);
337  }
338  }
339  }
340 
343  std::vector<const CaloTower*>::const_iterator calCI = mInfo.towers.begin();
344  for (; calCI != mInfo.towers.end(); ++calCI) {
345  const CaloTower* calCPtr = *calCI;
346  double deltaR2 = reco::deltaR2(muon, *calCPtr);
347  if (deltaR2 > std::max(dRMax_CandDep * dRMax_CandDep, theDR_Max * theDR_Max))
348  continue;
349 
350  //even more copy-pasting .. need to refactor
351  double etecal = calCPtr->emEt();
352  double eecal = calCPtr->emEnergy();
353  bool doEcal = etecal > theThreshold_E && eecal > 3 * noiseEcal(*calCPtr);
354  double ethcal = calCPtr->hadEt();
355  double ehcal = calCPtr->hadEnergy();
356  bool doHcal = ethcal > theThreshold_H && ehcal > 3 * noiseHcal(*calCPtr);
357  double ethocal = calCPtr->outerEt();
358  double ehocal = calCPtr->outerEnergy();
359  bool doHOcal = ethocal > theThreshold_HO && ehocal > 3 * noiseHOcal(*calCPtr);
360  if ((!doEcal) && (!doHcal) && (!doHcal))
361  continue;
362 
363  bool vetoTowerEcal = false;
364  double deltar2Ecal = reco::deltaR2(mInfo.trkGlobPosAtEcal, *calCPtr);
366  if (deltar2Ecal < std::pow(theDR_Veto_E, 2)) {
367  LogDebug("RecoMuon|CaloExtractorByAssociator") << " >>> Veto ecal tower: Calo deltaR= " << deltar2Ecal;
368  LogDebug("RecoMuon|CaloExtractorByAssociator")
369  << " >>> Calo eta phi ethcal: " << calCPtr->eta() << " " << calCPtr->phi() << " " << ethcal;
370  vetoTowerEcal = true;
371  }
372  bool vetoTowerHcal = false;
373  double deltar2Hcal = reco::deltaR2(mInfo.trkGlobPosAtHcal, *calCPtr);
375  if (deltar2Hcal < std::pow(theDR_Veto_H, 2)) {
376  LogDebug("RecoMuon|CaloExtractorByAssociator") << " >>> Veto hcal tower: Calo deltaR= " << deltar2Hcal;
377  LogDebug("RecoMuon|CaloExtractorByAssociator")
378  << " >>> Calo eta phi ethcal: " << calCPtr->eta() << " " << calCPtr->phi() << " " << ethcal;
379  vetoTowerHcal = true;
380  }
381  bool vetoTowerHOCal = false;
382  double deltar2HOcal = reco::deltaR2(mInfo.trkGlobPosAtHO, *calCPtr);
384  if (deltar2HOcal < std::pow(theDR_Veto_HO, 2)) {
385  LogDebug("RecoMuon|CaloExtractorByAssociator") << " >>> Veto HO tower: Calo deltaR= " << deltar2HOcal;
386  LogDebug("RecoMuon|CaloExtractorByAssociator")
387  << " >>> Calo eta phi ethcal: " << calCPtr->eta() << " " << calCPtr->phi() << " " << ethcal;
388  vetoTowerHOCal = true;
389  }
390 
392  if (!(vetoTowerHOCal && vetoTowerHcal && vetoTowerEcal)) {
393  for (unsigned int iH = 0; iH < mInfo.crossedTowerIds.size(); ++iH) {
394  if (mInfo.crossedTowerIds[iH].rawId() == calCPtr->id().rawId()) {
395  vetoTowerEcal = true;
396  vetoTowerHcal = true;
397  vetoTowerHOCal = true;
398  break;
399  }
400  }
401  }
402 
403  if (deltaR2 > std::pow(theDR_Max, 2) && !(vetoTowerEcal || vetoTowerHcal || vetoTowerHOCal))
404  continue;
405 
406  reco::isodeposit::Direction towerDir(calCPtr->eta(), calCPtr->phi());
408  if (doEcal and !theUseEcalRecHitsFlag) {
409  if (vetoTowerEcal)
410  depEcal.addCandEnergy(etecal);
411  else if (deltaR2 <= std::pow(theDR_Max, 2))
412  depEcal.addDeposit(towerDir, etecal);
413  }
414  if (doHcal and !theUseHcalRecHitsFlag) {
415  if (vetoTowerHcal)
416  depHcal.addCandEnergy(ethcal);
417  else if (deltaR2 <= std::pow(theDR_Max, 2))
418  depHcal.addDeposit(towerDir, ethcal);
419  }
420  if (doHOcal and !theUseHORecHitsFlag) {
421  if (vetoTowerHOCal)
422  depHOcal.addCandEnergy(ethocal);
423  else if (deltaR2 <= std::pow(theDR_Max, 2))
424  depHOcal.addDeposit(towerDir, ethocal);
425  }
426  }
427  }
428 
429  std::vector<IsoDeposit> resultDeps;
430  resultDeps.push_back(depEcal);
431  resultDeps.push_back(depHcal);
432  resultDeps.push_back(depHOcal);
433 
434  return resultDeps;
435 }
double noiseHcal(const CaloTower &tower) const
bool compare(const P &i, const P &j)
math::XYZPoint trkGlobPosAtHO
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > bFieldToken_
constexpr const DetId & detid() const
Definition: CaloRecHit.h:33
double outerEnergy() const
Definition: CaloTower.h:132
edm::ESGetToken< HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd > hcalSevLvlComputerToken_
std::vector< const CaloTower * > towers
std::vector< DetId > crossedTowerIds
std::string thePropagatorName
propagator name to feed into the track associator
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
bool recoveredRecHit(const DetId &myid, const uint32_t &myflag) const
std::vector< const EcalRecHit * > ecalRecHits
hits in the cone
std::vector< DetId > crossedEcalIds
double theDR_Max
max cone size in which towers are considered
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > hcalChannelQualityToken_
T eta() const
Definition: PV3DBase.h:73
double hadEt() const
Definition: CaloTower.h:136
edm::ESGetToken< HcalPFCuts, HcalPFCutsRcd > hcalCutsToken_
edm::ESGetToken< EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd > ecalPFRechitThresholdsToken_
std::vector< std::string > theDepositInstanceLabels
multiple deposits: labels – expect 3 labels beginning with "e", "h", "ho"
double theDR_Veto_E
cone sizes inside which the Et (towers) are not counted
TrackAssociatorParameters * theAssociatorParameters
associator, its&#39; parameters and the propagator
Log< level::Error, false > LogError
std::vector< DetId > crossedHcalIds
double outerEt() const
Definition: CaloTower.h:137
math::XYZPoint trkGlobPosAtHcal
const Item * getValues(DetId fId, bool throwOnFail=true) const
constexpr float energy() const
Definition: CaloRecHit.h:29
constexpr uint32_t flags() const
Definition: CaloRecHit.h:34
HcalDetId idFront(const HcalDetId &id) const
Definition: HcalTopology.h:170
void setPropagator(const Propagator *)
use a user configured propagator
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
std::vector< const HBHERecHit * > hcalRecHits
std::vector< DetId > crossedHOIds
uint32_t getValue() const
Definition: DetId.h:17
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
constexpr HcalDetId id() const
get the id
Definition: HBHERecHit.h:41
reco::IsoDeposit IsoDeposit
Definition: Isolation.h:7
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
double emEnergy() const
Definition: CaloTower.h:130
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
double noiseEcal(const CaloTower &tower) const
Determine noise for HCAL and ECAL (take some defaults for the time being)
double hadEnergy() const
Definition: CaloTower.h:131
const DetId & detid() const
Definition: EcalRecHit.h:73
double emEt() const
Definition: CaloTower.h:135
int getSeverityLevel(const DetId &myid, const uint32_t &myflag, const uint32_t &mystatus) const
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
math::XYZPoint trkGlobPosAtEcal
Track position at different parts of the calorimeter.
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > hcalTopologyToken_
Log< level::Warning, false > LogWarning
float energy() const
Definition: EcalRecHit.h:69
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
std::vector< const HORecHit * > hoRecHits
double phi() const final
momentum azimuthal angle
double noiseHOcal(const CaloTower &tower) const
CaloTowerDetId id() const
Definition: CaloTower.h:123
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
Definition: event.py:1
#define LogDebug(id)
double eta() const final
momentum pseudorapidity

◆ fillVetos()

void CaloExtractorByAssociator::fillVetos ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::TrackCollection tracks 
)
overridevirtual

allows to set extra vetoes (in addition to the muon) – no-op at this point

Implements reco::isodeposit::IsoDepositExtractor.

Definition at line 96 of file CaloExtractorByAssociator.cc.

98  {
99  // LogWarning("CaloExtractorByAssociator")
100  // <<"fillVetos does nothing now: IsoDeposit provides enough functionality\n"
101  // <<"to remove a deposit at/around given (eta, phi)";
102 }

◆ noiseEcal()

double CaloExtractorByAssociator::noiseEcal ( const CaloTower tower) const
private

Determine noise for HCAL and ECAL (take some defaults for the time being)

Definition at line 437 of file CaloExtractorByAssociator.cc.

References PVValHelper::eta, hgchebackDigitizer_cfi::noise, theNoiseTow_EB, theNoiseTow_EE, and l1tHGCalTowerProducer_cfi::tower.

Referenced by deposits().

◆ noiseHcal()

double CaloExtractorByAssociator::noiseHcal ( const CaloTower tower) const
private

◆ noiseHOcal()

double CaloExtractorByAssociator::noiseHOcal ( const CaloTower tower) const
private

Definition at line 450 of file CaloExtractorByAssociator.cc.

References hgchebackDigitizer_cfi::noise, and theNoise_HO.

Referenced by deposits().

◆ noiseRecHit()

double CaloExtractorByAssociator::noiseRecHit ( const DetId detId) const
private

Definition at line 455 of file CaloExtractorByAssociator.cc.

References hcalRecHitTable_cff::detId, DetId::Ecal, EcalBarrel, EcalEndcap, DetId::Hcal, HcalBarrel, HcalEndcap, HcalOuter, hgchebackDigitizer_cfi::noise, theNoise_EB, theNoise_EE, theNoise_HB, theNoise_HE, and theNoise_HO.

Referenced by deposits().

455  {
456  double noise = 100;
457  DetId::Detector det = detId.det();
458  if (det == DetId::Ecal) {
459  EcalSubdetector subDet = (EcalSubdetector)(detId.subdetId());
460  if (subDet == EcalBarrel) {
461  noise = theNoise_EB;
462  } else if (subDet == EcalEndcap) {
463  noise = theNoise_EE;
464  }
465  } else if (det == DetId::Hcal) {
466  HcalSubdetector subDet = (HcalSubdetector)(detId.subdetId());
467  if (subDet == HcalBarrel) {
468  noise = theNoise_HB;
469  } else if (subDet == HcalEndcap) {
470  noise = theNoise_HE;
471  } else if (subDet == HcalOuter) {
472  noise = theNoise_HO;
473  }
474  }
475  return noise;
476 }
HcalSubdetector
Definition: HcalAssistant.h:31
Detector
Definition: DetId.h:24
EcalSubdetector

Member Data Documentation

◆ bFieldToken_

edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> muonisolation::CaloExtractorByAssociator::bFieldToken_
private

Definition at line 122 of file CaloExtractorByAssociator.h.

Referenced by deposits().

◆ caloGeomToken_

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> muonisolation::CaloExtractorByAssociator::caloGeomToken_
private

Definition at line 123 of file CaloExtractorByAssociator.h.

Referenced by CaloExtractorByAssociator(), and deposits().

◆ ecalPFRechitThresholdsToken_

edm::ESGetToken<EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd> muonisolation::CaloExtractorByAssociator::ecalPFRechitThresholdsToken_
private

Definition at line 126 of file CaloExtractorByAssociator.h.

Referenced by CaloExtractorByAssociator(), and deposits().

◆ ecalRecHitThresh_

bool muonisolation::CaloExtractorByAssociator::ecalRecHitThresh_
private

Definition at line 127 of file CaloExtractorByAssociator.h.

Referenced by CaloExtractorByAssociator().

◆ ecalThresholds

EcalPFRecHitThresholds* muonisolation::CaloExtractorByAssociator::ecalThresholds = nullptr
private

Definition at line 128 of file CaloExtractorByAssociator.h.

Referenced by deposits().

◆ hcalChannelQualityToken_

edm::ESGetToken<HcalChannelQuality, HcalChannelQualityRcd> muonisolation::CaloExtractorByAssociator::hcalChannelQualityToken_
private

Definition at line 136 of file CaloExtractorByAssociator.h.

Referenced by CaloExtractorByAssociator(), and deposits().

◆ hcalChStatus_

HcalChannelQuality* muonisolation::CaloExtractorByAssociator::hcalChStatus_
private

Definition at line 139 of file CaloExtractorByAssociator.h.

Referenced by deposits().

◆ hcalCuts

HcalPFCuts* muonisolation::CaloExtractorByAssociator::hcalCuts = nullptr
private

Definition at line 133 of file CaloExtractorByAssociator.h.

Referenced by deposits().

◆ hcalCutsFromDB_

bool muonisolation::CaloExtractorByAssociator::hcalCutsFromDB_
private

Definition at line 132 of file CaloExtractorByAssociator.h.

Referenced by CaloExtractorByAssociator().

◆ hcalCutsToken_

edm::ESGetToken<HcalPFCuts, HcalPFCutsRcd> muonisolation::CaloExtractorByAssociator::hcalCutsToken_
private

Definition at line 131 of file CaloExtractorByAssociator.h.

Referenced by CaloExtractorByAssociator(), and deposits().

◆ hcalSevLvlComputer_

HcalSeverityLevelComputer* muonisolation::CaloExtractorByAssociator::hcalSevLvlComputer_
private

Definition at line 140 of file CaloExtractorByAssociator.h.

Referenced by deposits().

◆ hcalSevLvlComputerToken_

edm::ESGetToken<HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd> muonisolation::CaloExtractorByAssociator::hcalSevLvlComputerToken_
private

Definition at line 137 of file CaloExtractorByAssociator.h.

Referenced by CaloExtractorByAssociator(), and deposits().

◆ hcalTopology_

HcalTopology* muonisolation::CaloExtractorByAssociator::hcalTopology_
private

Definition at line 138 of file CaloExtractorByAssociator.h.

Referenced by deposits().

◆ hcalTopologyToken_

edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> muonisolation::CaloExtractorByAssociator::hcalTopologyToken_
private

Definition at line 135 of file CaloExtractorByAssociator.h.

Referenced by CaloExtractorByAssociator(), and deposits().

◆ theAssociator

TrackDetectorAssociator* muonisolation::CaloExtractorByAssociator::theAssociator
private

◆ theAssociatorParameters

TrackAssociatorParameters* muonisolation::CaloExtractorByAssociator::theAssociatorParameters
private

associator, its' parameters and the propagator

Definition at line 119 of file CaloExtractorByAssociator.h.

Referenced by CaloExtractorByAssociator(), deposits(), and ~CaloExtractorByAssociator().

◆ theCenterConeOnCalIntersection

bool muonisolation::CaloExtractorByAssociator::theCenterConeOnCalIntersection
private

centers the cone on the veto direction – makes more sense for very displaced tracks like in cosmics

Definition at line 98 of file CaloExtractorByAssociator.h.

Referenced by deposits().

◆ theDepositInstanceLabels

std::vector<std::string> muonisolation::CaloExtractorByAssociator::theDepositInstanceLabels
private

multiple deposits: labels – expect 3 labels beginning with "e", "h", "ho"

Definition at line 79 of file CaloExtractorByAssociator.h.

Referenced by deposits().

◆ theDepositLabel

std::string muonisolation::CaloExtractorByAssociator::theDepositLabel
private

Label of deposit – suggest to set to "" (all info is in collection name anyways)

Definition at line 76 of file CaloExtractorByAssociator.h.

◆ theDR_Max

double muonisolation::CaloExtractorByAssociator::theDR_Max
private

max cone size in which towers are considered

Definition at line 100 of file CaloExtractorByAssociator.h.

Referenced by deposits().

◆ theDR_Veto_E

double muonisolation::CaloExtractorByAssociator::theDR_Veto_E
private

cone sizes inside which the Et (towers) are not counted

Definition at line 93 of file CaloExtractorByAssociator.h.

Referenced by deposits().

◆ theDR_Veto_H

double muonisolation::CaloExtractorByAssociator::theDR_Veto_H
private

Definition at line 94 of file CaloExtractorByAssociator.h.

Referenced by deposits().

◆ theDR_Veto_HO

double muonisolation::CaloExtractorByAssociator::theDR_Veto_HO
private

Definition at line 95 of file CaloExtractorByAssociator.h.

Referenced by deposits().

◆ theMaxSeverityHB

int muonisolation::CaloExtractorByAssociator::theMaxSeverityHB
private

Definition at line 89 of file CaloExtractorByAssociator.h.

Referenced by deposits().

◆ theMaxSeverityHE

int muonisolation::CaloExtractorByAssociator::theMaxSeverityHE
private

Definition at line 90 of file CaloExtractorByAssociator.h.

Referenced by deposits().

◆ theNoise_EB

double muonisolation::CaloExtractorByAssociator::theNoise_EB
private

the noise "sigmas" for a hit or tower to be considered consider if Energy > 3.*sigma

Definition at line 104 of file CaloExtractorByAssociator.h.

Referenced by noiseRecHit().

◆ theNoise_EE

double muonisolation::CaloExtractorByAssociator::theNoise_EE
private

Definition at line 105 of file CaloExtractorByAssociator.h.

Referenced by noiseRecHit().

◆ theNoise_HB

double muonisolation::CaloExtractorByAssociator::theNoise_HB
private

Definition at line 106 of file CaloExtractorByAssociator.h.

Referenced by noiseHcal(), and noiseRecHit().

◆ theNoise_HE

double muonisolation::CaloExtractorByAssociator::theNoise_HE
private

Definition at line 107 of file CaloExtractorByAssociator.h.

Referenced by noiseHcal(), and noiseRecHit().

◆ theNoise_HO

double muonisolation::CaloExtractorByAssociator::theNoise_HO
private

Definition at line 108 of file CaloExtractorByAssociator.h.

Referenced by noiseHOcal(), and noiseRecHit().

◆ theNoiseTow_EB

double muonisolation::CaloExtractorByAssociator::theNoiseTow_EB
private

Definition at line 109 of file CaloExtractorByAssociator.h.

Referenced by noiseEcal().

◆ theNoiseTow_EE

double muonisolation::CaloExtractorByAssociator::theNoiseTow_EE
private

Definition at line 110 of file CaloExtractorByAssociator.h.

Referenced by noiseEcal().

◆ thePrintTimeReport

bool muonisolation::CaloExtractorByAssociator::thePrintTimeReport
private

flag to turn on/off printing of a time report

Definition at line 143 of file CaloExtractorByAssociator.h.

◆ thePropagatorName

std::string muonisolation::CaloExtractorByAssociator::thePropagatorName
private

propagator name to feed into the track associator

Definition at line 82 of file CaloExtractorByAssociator.h.

Referenced by deposits().

◆ theService

MuonServiceProxy* muonisolation::CaloExtractorByAssociator::theService
private

the event setup proxy, it takes care the services update

Definition at line 116 of file CaloExtractorByAssociator.h.

Referenced by CaloExtractorByAssociator(), deposits(), and ~CaloExtractorByAssociator().

◆ theThreshold_E

double muonisolation::CaloExtractorByAssociator::theThreshold_E
private

Cone cuts and thresholds min values of Et to be included in deposits

Definition at line 86 of file CaloExtractorByAssociator.h.

Referenced by deposits().

◆ theThreshold_H

double muonisolation::CaloExtractorByAssociator::theThreshold_H
private

Definition at line 87 of file CaloExtractorByAssociator.h.

Referenced by deposits().

◆ theThreshold_HO

double muonisolation::CaloExtractorByAssociator::theThreshold_HO
private

Definition at line 88 of file CaloExtractorByAssociator.h.

Referenced by deposits().

◆ theUseEcalRecHitsFlag

bool muonisolation::CaloExtractorByAssociator::theUseEcalRecHitsFlag
private

use towers or rec hits

Definition at line 71 of file CaloExtractorByAssociator.h.

Referenced by deposits().

◆ theUseHcalRecHitsFlag

bool muonisolation::CaloExtractorByAssociator::theUseHcalRecHitsFlag
private

Definition at line 72 of file CaloExtractorByAssociator.h.

Referenced by deposits().

◆ theUseHORecHitsFlag

bool muonisolation::CaloExtractorByAssociator::theUseHORecHitsFlag
private

Definition at line 73 of file CaloExtractorByAssociator.h.

Referenced by deposits().

◆ theVetoCollection

std::vector<DetId> muonisolation::CaloExtractorByAssociator::theVetoCollection
private

Vector of calo Ids to veto – not used.

Definition at line 113 of file CaloExtractorByAssociator.h.