CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
AlCaHcalHBHEMuonProducer Class Reference
Inheritance diagram for AlCaHcalHBHEMuonProducer:
edm::stream::EDProducer< edm::GlobalCache< alcaHcalHBHEMuonProducer::Counters > >

Public Member Functions

 AlCaHcalHBHEMuonProducer (const edm::ParameterSet &, const alcaHcalHBHEMuonProducer::Counters *)
 
void endStream () override
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~AlCaHcalHBHEMuonProducer () override=default
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< alcaHcalHBHEMuonProducer::Counters > >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
static void globalEndJob (const alcaHcalHBHEMuonProducer::Counters *counters)
 
static std::unique_ptr< alcaHcalHBHEMuonProducer::CountersinitializeGlobalCache (edm::ParameterSet const &)
 

Private Member Functions

double activeLength (const DetId &, const HcalDDDRecConstants *hdc)
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
int depth16HE (int ieta, int iphi, const HcalTopology *theHBHETopology)
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
double gainFactor (const HcalDbService *dbserv, const HcalDetId &id)
 
bool goodCell (const HcalDetId &hcid, const reco::Track *pTrack, const CaloGeometry *geo, const MagneticField *bField, const HcalDDDRecConstants *hdc)
 
bool isGoodVertex (const reco::Vertex &vtx)
 
int matchId (const HcalDetId &, const HcalDetId &)
 
double respCorr (const DetId &id, const HcalRespCorrs *respCorrs)
 

Private Attributes

std::vector< HcalDDDRecConstants::HcalActiveLengthactHB
 
std::vector< HcalDDDRecConstants::HcalActiveLengthactHE
 
std::vector< std::string > all_triggers_
 
const bool collapseDepth_
 
std::map< DetId, double > corrValue_
 
const std::string fileInCorr_
 
HLTConfigProvider hltConfig_
 
std::vector< int > hltresults_
 
const bool isItPlan1_
 
const bool isItPreRecHit_
 
const edm::InputTag labelEBRecHit_
 
const edm::InputTag labelEERecHit_
 
const std::string labelHBHEMuon_
 
const edm::InputTag labelHBHERecHit_
 
const std::string labelMuon_
 
const std::string labelVtx_
 
const int maxDepth_
 
const bool mergedDepth_
 
int nAll_
 
int nGood_
 
int nRun_
 
const std::string processName_
 
const edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcdtok_chan_
 
const edm::ESGetToken< HcalDbService, HcalDbRecordtok_dbservice_
 
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecordtok_ddrec0_
 
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecordtok_ddrec1_
 
const edm::EDGetTokenT< EcalRecHitCollectiontok_EB_
 
const edm::ESGetToken< EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcdtok_ecalPFRecHitThresholds_
 
const edm::EDGetTokenT< EcalRecHitCollectiontok_EE_
 
const edm::ESGetToken< CaloGeometry, CaloGeometryRecordtok_geom0_
 
const edm::ESGetToken< CaloGeometry, CaloGeometryRecordtok_geom1_
 
const edm::EDGetTokenT< HBHERecHitCollectiontok_HBHE_
 
const edm::ESGetToken< HcalTopology, HcalRecNumberingRecordtok_htopo0_
 
const edm::ESGetToken< HcalTopology, HcalRecNumberingRecordtok_htopo1_
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordtok_magField_
 
const edm::EDGetTokenT< reco::MuonCollectiontok_Muon_
 
const edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcdtok_respcorr0_
 
const edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcdtok_respcorr1_
 
const edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcdtok_sevlv_
 
const edm::ESGetToken< CaloTopology, CaloTopologyRecordtok_topo_
 
const edm::EDGetTokenT< edm::TriggerResultstok_trigRes_
 
const edm::EDGetTokenT< reco::VertexCollectiontok_Vtx_
 
const edm::InputTag triggerResults_
 
const std::vector< std::string > trigNames_
 
bool useMyCorr_
 
const bool usePFThresh_
 
const int verbosity_
 
const bool writeRespCorr_
 

Static Private Attributes

static const int depthMax_ = 7
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< alcaHcalHBHEMuonProducer::Counters > >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 81 of file AlCaHcalHBHEMuonProducer.cc.

Constructor & Destructor Documentation

◆ AlCaHcalHBHEMuonProducer()

AlCaHcalHBHEMuonProducer::AlCaHcalHBHEMuonProducer ( const edm::ParameterSet iConfig,
const alcaHcalHBHEMuonProducer::Counters  
)
explicit

Definition at line 162 of file AlCaHcalHBHEMuonProducer.cc.

References collapseDepth_, corrValue_, fileInCorr_, l1ctLayer2EG_cff::id, timingPdfMaker::infile, isItPlan1_, isItPreRecHit_, labelEBRecHit_, labelEERecHit_, labelHBHEMuon_, labelHBHERecHit_, labelMuon_, labelVtx_, mergedDepth_, triggerResults_, and useMyCorr_.

164  : trigNames_(iConfig.getParameter<std::vector<std::string>>("triggers")),
165  processName_(iConfig.getParameter<std::string>("processName")),
166  triggerResults_(iConfig.getParameter<edm::InputTag>("triggerResults")),
167  labelEBRecHit_(iConfig.getParameter<edm::InputTag>("labelEBRecHit")),
168  labelEERecHit_(iConfig.getParameter<edm::InputTag>("labelEERecHit")),
169  labelHBHERecHit_(iConfig.getParameter<edm::InputTag>("labelHBHERecHit")),
170  labelVtx_(iConfig.getParameter<std::string>("labelVertex")),
171  labelMuon_(iConfig.getParameter<std::string>("labelMuon")),
172  labelHBHEMuon_(iConfig.getParameter<std::string>("labelHBHEMuon")),
173  collapseDepth_(iConfig.getParameter<bool>("collapseDepth")),
174  isItPlan1_(iConfig.getParameter<bool>("isItPlan1")),
175  verbosity_(iConfig.getUntrackedParameter<int>("verbosity", 0)),
176  isItPreRecHit_(iConfig.getUntrackedParameter<bool>("isItPreRecHit", false)),
177  writeRespCorr_(iConfig.getUntrackedParameter<bool>("writeRespCorr", false)),
178  fileInCorr_(iConfig.getUntrackedParameter<std::string>("fileInCorr", "")),
179  maxDepth_(iConfig.getUntrackedParameter<int>("maxDepth", 7)),
181  usePFThresh_(iConfig.getParameter<bool>("usePFThreshold")),
182  nRun_(0),
183  nAll_(0),
184  nGood_(0),
185  tok_trigRes_(consumes<edm::TriggerResults>(triggerResults_)),
186  tok_Vtx_(consumes<reco::VertexCollection>(labelVtx_)),
187  tok_EB_(consumes<EcalRecHitCollection>(labelEBRecHit_)),
188  tok_EE_(consumes<EcalRecHitCollection>(labelEERecHit_)),
189  tok_HBHE_(consumes<HBHERecHitCollection>(labelHBHERecHit_)),
190  tok_Muon_(consumes<reco::MuonCollection>(labelMuon_)),
191  tok_ddrec0_(esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord, edm::Transition::BeginRun>()),
192  tok_ddrec1_(esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord>()),
193  tok_respcorr0_(esConsumes<HcalRespCorrs, HcalRespCorrsRcd, edm::Transition::BeginRun>()),
194  tok_respcorr1_(esConsumes<HcalRespCorrs, HcalRespCorrsRcd>()),
195  tok_geom0_(esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>()),
196  tok_geom1_(esConsumes<CaloGeometry, CaloGeometryRecord>()),
197  tok_htopo0_(esConsumes<HcalTopology, HcalRecNumberingRecord, edm::Transition::BeginRun>()),
198  tok_htopo1_(esConsumes<HcalTopology, HcalRecNumberingRecord>()),
199  tok_magField_(esConsumes<MagneticField, IdealMagneticFieldRecord>()),
200  tok_chan_(esConsumes<EcalChannelStatus, EcalChannelStatusRcd>()),
201  tok_sevlv_(esConsumes<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd>()),
202  tok_topo_(esConsumes<CaloTopology, CaloTopologyRecord>()),
203  tok_dbservice_(esConsumes<HcalDbService, HcalDbRecord>()),
204  tok_ecalPFRecHitThresholds_(esConsumes<EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd>()) {
205  //now do what ever initialization is needed
206  edm::LogVerbatim("HBHEMuon") << "Labels used: Trig " << triggerResults_ << " Vtx " << labelVtx_ << " EB "
207  << labelEBRecHit_ << " EE " << labelEERecHit_ << " HBHE " << labelHBHERecHit_ << " MU "
208  << labelMuon_;
209 
210  if (!fileInCorr_.empty()) {
211  std::ifstream infile(fileInCorr_.c_str());
212  if (infile.is_open()) {
213  while (true) {
214  unsigned int id;
215  double cfac;
216  infile >> id >> cfac;
217  if (!infile.good())
218  break;
219  corrValue_[DetId(id)] = cfac;
220  }
221  infile.close();
222  }
223  }
224  useMyCorr_ = (!corrValue_.empty());
225  edm::LogVerbatim("HBHEMuon") << "Flags used: ollapseDepth " << collapseDepth_ << ":" << mergedDepth_ << " IsItPlan1 "
226  << isItPlan1_ << " IsItPreRecHit " << isItPreRecHit_ << " UseMyCorr " << useMyCorr_;
227 
228  //create the objects for HcalHBHEMuonVariables which has information of isolated muons
229  produces<HcalHBHEMuonVariablesCollection>(labelHBHEMuon_);
230  edm::LogVerbatim("HcalIsoTrack") << " Expected to produce the collections:\n"
231  << "HcalHBHEMuonVariablesCollection with label " << labelHBHEMuon_;
232 }
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tok_magField_
const edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_respcorr0_
const edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > tok_htopo0_
const edm::ESGetToken< HcalDbService, HcalDbRecord > tok_dbservice_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom1_
const edm::EDGetTokenT< reco::MuonCollection > tok_Muon_
T getUntrackedParameter(std::string const &, T const &) const
const edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > tok_sevlv_
const std::vector< std::string > trigNames_
const edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > tok_chan_
const edm::ESGetToken< EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd > tok_ecalPFRecHitThresholds_
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_ddrec1_
const edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > tok_htopo1_
Definition: DetId.h:17
std::map< DetId, double > corrValue_
const edm::ESGetToken< CaloTopology, CaloTopologyRecord > tok_topo_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom0_
const edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_respcorr1_
const edm::EDGetTokenT< edm::TriggerResults > tok_trigRes_
const edm::EDGetTokenT< reco::VertexCollection > tok_Vtx_
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_ddrec0_
const edm::EDGetTokenT< HBHERecHitCollection > tok_HBHE_
const edm::EDGetTokenT< EcalRecHitCollection > tok_EE_

◆ ~AlCaHcalHBHEMuonProducer()

AlCaHcalHBHEMuonProducer::~AlCaHcalHBHEMuonProducer ( )
overridedefault

Member Function Documentation

◆ activeLength()

double AlCaHcalHBHEMuonProducer::activeLength ( const DetId id0,
const HcalDDDRecConstants hdc 
)
private

Definition at line 1070 of file AlCaHcalHBHEMuonProducer.cc.

References actHB, actHE, hcalRecHitTable_cff::depth, spr::find(), HcalBarrel, mps_fire::i, l1ctLayer2EG_cff::id, hcalRecHitTable_cff::ieta, hcalRecHitTable_cff::iphi, mergedDepth_, HcalDDDRecConstants::unmergeDepthDetId(), and ecaldqm::zside().

Referenced by beginRun(), and produce().

1070  {
1071  HcalDetId id(id0);
1072  int ieta = id.ietaAbs();
1073  int zside = id.zside();
1074  int iphi = id.iphi();
1075  std::vector<int> dpths;
1076  if (mergedDepth_) {
1077  std::vector<HcalDetId> ids;
1078  hdc->unmergeDepthDetId(id, ids);
1079  for (auto idh : ids)
1080  dpths.emplace_back(idh.depth());
1081  } else {
1082  dpths.emplace_back(id.depth());
1083  }
1084  double lx(0);
1085  if (id.subdet() == HcalBarrel) {
1086  for (unsigned int i = 0; i < actHB.size(); ++i) {
1087  if ((ieta == actHB[i].ieta) && (zside == actHB[i].zside) &&
1088  (std::find(dpths.begin(), dpths.end(), actHB[i].depth) != dpths.end()) &&
1089  (std::find(actHB[i].iphis.begin(), actHB[i].iphis.end(), iphi) != actHB[i].iphis.end())) {
1090  lx += actHB[i].thick;
1091  }
1092  }
1093  } else {
1094  for (unsigned int i = 0; i < actHE.size(); ++i) {
1095  if ((ieta == actHE[i].ieta) && (zside == actHE[i].zside) &&
1096  (std::find(dpths.begin(), dpths.end(), actHE[i].depth) != dpths.end()) &&
1097  (std::find(actHE[i].iphis.begin(), actHE[i].iphis.end(), iphi) != actHE[i].iphis.end())) {
1098  lx += actHE[i].thick;
1099  }
1100  }
1101  }
1102  return lx;
1103 }
int zside(DetId const &)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::vector< HcalDDDRecConstants::HcalActiveLength > actHE
std::vector< HcalDDDRecConstants::HcalActiveLength > actHB
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const

◆ beginRun()

void AlCaHcalHBHEMuonProducer::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprivate

Definition at line 1001 of file AlCaHcalHBHEMuonProducer.cc.

References actHB, actHE, activeLength(), RemoveAddSevLevel::flag, edm::EventSetup::getData(), CaloGeometry::getSubdetectorGeometry(), HcalDDDRecConstants::getThickActive(), HcalGeometry::getValidDetIds(), reco::JetExtendedAssociation::getValue(), HcalCondObjectContainer< Item >::getValues(), DetId::Hcal, HcalBarrel, HcalEndcap, hltConfig_, HLTConfigProvider::init(), mergedDepth_, HcalDDDRecConstants::mergedDepthDetId(), nRun_, processName_, DetId::rawId(), edm::RunBase::run(), HcalCondObjectContainerBase::setTopo(), tok_ddrec0_, tok_geom0_, tok_htopo0_, tok_respcorr0_, and writeRespCorr_.

1001  {
1002  const HcalDDDRecConstants* hdc = &iSetup.getData(tok_ddrec0_);
1003  actHB.clear();
1004  actHE.clear();
1005  actHB = hdc->getThickActive(0);
1006  actHE = hdc->getThickActive(1);
1007 #ifdef EDM_ML_DEBUG
1008  unsigned int k1(0), k2(0);
1009  edm::LogVerbatim("HBHEMuon") << actHB.size() << " Active Length for HB";
1010  for (const auto& act : actHB) {
1011  edm::LogVerbatim("HBHEMuon") << "[" << k1 << "] ieta " << act.ieta << " depth " << act.depth << " zside "
1012  << act.zside << " type " << act.stype << " phi " << act.iphis.size() << ":"
1013  << act.iphis[0] << " L " << act.thick;
1014  HcalDetId hcid1(HcalBarrel, (act.ieta) * (act.zside), act.iphis[0], act.depth);
1015  HcalDetId hcid2 = mergedDepth_ ? hdc->mergedDepthDetId(hcid1) : hcid1;
1016  edm::LogVerbatim("HBHEMuon") << hcid1 << " | " << hcid2 << " L " << activeLength(DetId(hcid2), hdc);
1017  ++k1;
1018  }
1019  edm::LogVerbatim("HBHEMuon") << actHE.size() << " Active Length for HE";
1020  for (const auto& act : actHE) {
1021  edm::LogVerbatim("HBHEMuon") << "[" << k2 << "] ieta " << act.ieta << " depth " << act.depth << " zside "
1022  << act.zside << " type " << act.stype << " phi " << act.iphis.size() << ":"
1023  << act.iphis[0] << " L " << act.thick;
1024  HcalDetId hcid1(HcalEndcap, (act.ieta) * (act.zside), act.iphis[0], act.depth);
1025  HcalDetId hcid2 = mergedDepth_ ? hdc->mergedDepthDetId(hcid1) : hcid1;
1026  edm::LogVerbatim("HBHEMuon") << hcid1 << " | " << hcid2 << " L " << activeLength(DetId(hcid2), hdc);
1027  ++k2;
1028  }
1029 #endif
1030 
1031  bool changed = true;
1032  bool flag = hltConfig_.init(iRun, iSetup, processName_, changed);
1033  edm::LogVerbatim("HBHEMuon") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init " << flag << std::endl;
1034 
1035  const HcalRespCorrs* resp = &iSetup.getData(tok_respcorr0_);
1036  const HcalTopology* theHBHETopology = &iSetup.getData(tok_htopo0_);
1037  const CaloGeometry* geo = &iSetup.getData(tok_geom0_);
1038  HcalRespCorrs respCorrsObj(*resp);
1039  HcalRespCorrs* respCorrs = &respCorrsObj;
1040  respCorrs->setTopo(theHBHETopology);
1041 
1042  // Write correction factors for all HB/HE events
1043  if (writeRespCorr_) {
1044  const HcalGeometry* gHcal = static_cast<const HcalGeometry*>(geo->getSubdetectorGeometry(DetId::Hcal, HcalBarrel));
1045  const std::vector<DetId>& ids = gHcal->getValidDetIds(DetId::Hcal, 0);
1046  edm::LogVerbatim("HBHEMuon") << "\nTable of Correction Factors for Run " << iRun.run() << "\n";
1047  for (auto const& id : ids) {
1048  if ((id.det() == DetId::Hcal) && ((id.subdetId() == HcalBarrel) || (id.subdetId() == HcalEndcap))) {
1049  edm::LogVerbatim("HBHEMuon") << HcalDetId(id) << " " << id.rawId() << " "
1050  << (respCorrs->getValues(id))->getValue();
1051  }
1052  }
1053  }
1054 }
Log< level::Info, true > LogVerbatim
const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const override
Get a list of valid detector ids (for the given subdetector)
Definition: HcalGeometry.cc:76
const edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_respcorr0_
HcalDetId mergedDepthDetId(const HcalDetId &id) const
const edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > tok_htopo0_
std::vector< HcalDDDRecConstants::HcalActiveLength > actHE
const Item * getValues(DetId fId, bool throwOnFail=true) const
double activeLength(const DetId &, const HcalDDDRecConstants *hdc)
Definition: DetId.h:17
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom0_
std::vector< HcalActiveLength > getThickActive(const int &type) const
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
std::vector< HcalDDDRecConstants::HcalActiveLength > actHB
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
void setTopo(const HcalTopology *topo)
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_ddrec0_

◆ depth16HE()

int AlCaHcalHBHEMuonProducer::depth16HE ( int  ieta,
int  iphi,
const HcalTopology theHBHETopology 
)
private

Definition at line 1137 of file AlCaHcalHBHEMuonProducer.cc.

References HcalTopology::dddConstants(), hcalRecHitTable_cff::depth, HcalDDDRecConstants::getMinDepth(), hcalRecHitTable_cff::ieta, hcalRecHitTable_cff::iphi, isItPlan1_, isItPreRecHit_, and ecaldqm::zside().

Referenced by produce().

1137  {
1138  // Transition between HB/HE is special
1139  // For Run 1 or for Plan1 standard reconstruction it is 3
1140  // For runs beyond 2018 or in Plan1 for HEP17 it is 4
1141  int zside = (ieta > 0) ? 1 : -1;
1142  int depth = theHBHETopology->dddConstants()->getMinDepth(1, 16, iphi, zside);
1143  if (isItPlan1_ && (!isItPreRecHit_))
1144  depth = 3;
1145 #ifdef EDM_ML_DEBUG
1146  edm::LogVerbatim("HBHEMuon") << "Plan1 " << isItPlan1_ << " PreRecHit " << isItPreRecHit_ << " phi " << iphi
1147  << " depth " << depth;
1148 #endif
1149  return depth;
1150 }
int getMinDepth(const int &itype, const int &ieta, const int &iphi, const int &zside) const
Log< level::Info, true > LogVerbatim
int zside(DetId const &)
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:161

◆ endRun()

void AlCaHcalHBHEMuonProducer::endRun ( edm::Run const &  iRun,
edm::EventSetup const &   
)
overrideprivate

Definition at line 1056 of file AlCaHcalHBHEMuonProducer.cc.

References nRun_, and edm::RunBase::run().

1056  {
1057  edm::LogVerbatim("HBHEMuon") << "endRun[" << nRun_ << "] " << iRun.run() << "\n";
1058  ++nRun_;
1059 }
Log< level::Info, true > LogVerbatim

◆ endStream()

void AlCaHcalHBHEMuonProducer::endStream ( )
override

Definition at line 991 of file AlCaHcalHBHEMuonProducer.cc.

References nAll_, and nGood_.

991  {
992  globalCache()->nAll_ += nAll_;
993  globalCache()->nGood_ += nGood_;
994 }

◆ fillDescriptions()

void AlCaHcalHBHEMuonProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 967 of file AlCaHcalHBHEMuonProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

967  {
969  std::vector<std::string> triggers = {"HLT_IsoMu", "HLT_Mu"};
970  desc.add<std::vector<std::string>>("triggers", triggers);
971  desc.add<std::string>("processName", "HLT");
972  desc.add<edm::InputTag>("triggerResults", edm::InputTag("TriggerResults", "", "HLT"));
973  desc.add<edm::InputTag>("labelEBRecHit", edm::InputTag("ecalRecHit", "EcalRecHitsEB"));
974  desc.add<edm::InputTag>("labelEERecHit", edm::InputTag("ecalRecHit", "EcalRecHitsEE"));
975  desc.add<edm::InputTag>("labelHBHERecHit", edm::InputTag("hbhereco"));
976  desc.add<std::string>("labelVertex", "offlinePrimaryVertices");
977  desc.add<std::string>("labelMuon", "muons");
978  desc.add<std::string>("labelHBHEMuon", "hbheMuon");
979  desc.add<bool>("collapseDepth", false);
980  desc.add<bool>("isItPlan1", false);
981  desc.addUntracked<int>("verbosity", 0);
982  desc.addUntracked<bool>("isItPreRecHit", false);
983  desc.addUntracked<bool>("writeRespCorr", false);
984  desc.addUntracked<std::string>("fileInCorr", "");
985  desc.addUntracked<int>("maxDepth", 7);
986  desc.add<bool>("usePFThreshold", true);
987  descriptions.add("alcaHcalHBHEMuonProducer", desc);
988 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ gainFactor()

double AlCaHcalHBHEMuonProducer::gainFactor ( const HcalDbService dbserv,
const HcalDetId id 
)
private

Definition at line 1129 of file AlCaHcalHBHEMuonProducer.cc.

References submitPVValidationJobs::conditions, PedestalClient_cfi::gain, and HcalCalibrations::respcorrgain().

Referenced by produce().

1129  {
1130  double gain(0.0);
1131  const HcalCalibrations& calibs = conditions->getHcalCalibrations(id);
1132  for (int capid = 0; capid < 4; ++capid)
1133  gain += (0.25 * calibs.respcorrgain(capid));
1134  return gain;
1135 }
constexpr double respcorrgain(int fCapId) const
get response corrected gain for capid=0..3

◆ globalEndJob()

void AlCaHcalHBHEMuonProducer::globalEndJob ( const alcaHcalHBHEMuonProducer::Counters counters)
static

Definition at line 996 of file AlCaHcalHBHEMuonProducer.cc.

References submitPVResolutionJobs::count.

996  {
997  edm::LogVerbatim("HBHEMuon") << "Selects " << count->nGood_ << " out of " << count->nAll_ << " total # of events\n";
998 }
Log< level::Info, true > LogVerbatim

◆ goodCell()

bool AlCaHcalHBHEMuonProducer::goodCell ( const HcalDetId hcid,
const reco::Track pTrack,
const CaloGeometry geo,
const MagneticField bField,
const HcalDDDRecConstants hdc 
)
private

Definition at line 1152 of file AlCaHcalHBHEMuonProducer.cc.

References Calorimetry_cff::bField, HcalDDDRecConstants::getRZ(), HcalEndcap, match(), spr::propagateHCAL(), HcalDetId::subdet(), and verbosity_.

Referenced by produce().

1156  {
1157  std::pair<double, double> rz = hdc->getRZ(hcid);
1158  bool typeRZ = (hcid.subdet() == HcalEndcap) ? false : true;
1159  bool match = spr::propagateHCAL(pTrack, geo, bField, typeRZ, rz, (((verbosity_ / 10000) % 10) > 0));
1160  return match;
1161 }
double getRZ(const int &subdet, const int &ieta, const int &depth) const
std::pair< math::XYZPoint, bool > propagateHCAL(const reco::Track *, const MagneticField *, bool debug=false)
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10

◆ initializeGlobalCache()

static std::unique_ptr<alcaHcalHBHEMuonProducer::Counters> AlCaHcalHBHEMuonProducer::initializeGlobalCache ( edm::ParameterSet const &  )
inlinestatic

Definition at line 86 of file AlCaHcalHBHEMuonProducer.cc.

86  {
87  return std::make_unique<alcaHcalHBHEMuonProducer::Counters>();
88  }

◆ isGoodVertex()

bool AlCaHcalHBHEMuonProducer::isGoodVertex ( const reco::Vertex vtx)
private

Definition at line 1105 of file AlCaHcalHBHEMuonProducer.cc.

References L1BJetProducer_cff::vtx.

Referenced by produce().

1105  {
1106  if (vtx.isFake())
1107  return false;
1108  if (vtx.ndof() < 4)
1109  return false;
1110  if (vtx.position().Rho() > 2.)
1111  return false;
1112  if (fabs(vtx.position().Z()) > 24.)
1113  return false;
1114  return true;
1115 }

◆ matchId()

int AlCaHcalHBHEMuonProducer::matchId ( const HcalDetId id1,
const HcalDetId id2 
)
private

Definition at line 1063 of file AlCaHcalHBHEMuonProducer.cc.

References globals_cff::id1, globals_cff::id2, and match().

Referenced by produce().

1063  {
1064  HcalDetId kd1(id1.subdet(), id1.ieta(), id1.iphi(), 1);
1065  HcalDetId kd2(id1.subdet(), id2.ieta(), id2.iphi(), 1);
1066  int match = ((kd1 == kd2) ? 1 : 0);
1067  return match;
1068 }
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10

◆ produce()

void AlCaHcalHBHEMuonProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 239 of file AlCaHcalHBHEMuonProducer.cc.

References funct::abs(), activeLength(), Calorimetry_cff::bField, HcalHBHEMuonVariables::bxNumber_, RPCNoise_example::check, chg, HcalHBHEMuonVariables::chiGlobal_, HcalHBHEMuonVariables::chiTracker_, collapseDepth_, submitPVValidationJobs::conditions, alignCSCRings::corr, hcalRecHitTable_cff::depth, depth16HE(), depthMax_, spr::propagatedTrackID::detIdECAL, spr::propagatedTrackID::detIdEHCAL, spr::propagatedTrackID::detIdHCAL, HcalHBHEMuonVariables::dxyTracker_, HcalHBHEMuonVariables::dzTracker_, HcalHBHEMuonVariables::ecal3x3Energy_, HcalHBHEMuonVariables::ecalDetId_, HcalHBHEMuonVariables::ecalEnergy_, spr::eECALmatrix(), HcalHBHEMuonVariables::ehcalDetId_, spr::eHCALmatrix(), spr::energyHCALCell(), HcalHBHEMuonVariables::energyMuon_, HcalHBHEMuonVariables::etaGlob_, HcalHBHEMuonVariables::eventNumber_, spr::find(), PedestalClient_cfi::gain, gainFactor(), edm::EventSetup::getData(), HcalHBHEMuonVariables::globalMuonHits_, HcalHBHEMuonVariables::globalTrack_, HcalHBHEMuonVariables::globalTrackEta_, HcalHBHEMuonVariables::globalTrackPhi_, HcalHBHEMuonVariables::globalTrackPt_, goodCell(), HcalHBHEMuonVariables::goodVertex_, photonIsolationHIProducer_cfi::hbhe, HcalHBHEMuonVariables::hcal1x1Energy_, HcalHBHEMuonVariables::hcal1x1EnergyAux_, HcalHBHEMuonVariables::hcal1x1EnergyRaw_, HcalHBHEMuonVariables::hcalActiveLength_, HcalHBHEMuonVariables::hcalActiveLengthHot_, HcalBarrel, HcalHBHEMuonVariables::hcalDepthActiveLength_, HcalHBHEMuonVariables::hcalDepthActiveLengthHot_, HcalHBHEMuonVariables::hcalDepthChargeHot_, HcalHBHEMuonVariables::hcalDepthChargeHotAux_, HcalHBHEMuonVariables::hcalDepthChargeHotBG_, HcalHBHEMuonVariables::hcalDepthChargeHotBGAux_, HcalHBHEMuonVariables::hcalDepthChargeHotBGRaw_, HcalHBHEMuonVariables::hcalDepthChargeHotRaw_, HcalHBHEMuonVariables::hcalDepthEnergy_, HcalHBHEMuonVariables::hcalDepthEnergyAux_, HcalHBHEMuonVariables::hcalDepthEnergyCorr_, HcalHBHEMuonVariables::hcalDepthEnergyCorrAux_, HcalHBHEMuonVariables::hcalDepthEnergyCorrRaw_, HcalHBHEMuonVariables::hcalDepthEnergyHot_, HcalHBHEMuonVariables::hcalDepthEnergyHotAux_, HcalHBHEMuonVariables::hcalDepthEnergyHotCorr_, HcalHBHEMuonVariables::hcalDepthEnergyHotCorrAux_, HcalHBHEMuonVariables::hcalDepthEnergyHotCorrRaw_, HcalHBHEMuonVariables::hcalDepthEnergyHotRaw_, HcalHBHEMuonVariables::hcalDepthEnergyRaw_, HcalHBHEMuonVariables::hcalDepthMatch_, HcalHBHEMuonVariables::hcalDepthMatchHot_, HcalHBHEMuonVariables::hcalDetId_, HcalEndcap, HcalHBHEMuonVariables::hcalEnergy_, HcalHBHEMuonVariables::hcalHot_, HcalHBHEMuonVariables::hcalIeta_, HcalHBHEMuonVariables::hcalIphi_, ValidationMatrix::hlt, HcalHBHEMuonVariables::hoEnergy_, mps_fire::i, hcalRecHitTable_cff::ieta, HcalDetId::ieta(), iEvent, info(), HcalHBHEMuonVariables::innerTrack_, HcalHBHEMuonVariables::innerTrackEta_, HcalHBHEMuonVariables::innerTrackPhi_, HcalHBHEMuonVariables::innerTrackPt_, hcalRecHitTable_cff::iphi, HcalDetId::iphi(), isGoodVertex(), isItPlan1_, isItPreRecHit_, muon::isMediumMuon(), HcalHBHEMuonVariables::isolationR03_, HcalHBHEMuonVariables::isolationR04_, muon::isTightMuon(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, dqmdumpme::k, labelHBHEMuon_, HcalHBHEMuonVariables::lumiNumber_, HcalHBHEMuonVariables::matchedId_, HcalHBHEMuonVariables::matchedStat_, matchId(), SiStripPI::max, maxDepth_, HcalDDDRecConstants::mergedDepthDetId(), LogMessageMonitor_cff::modules, eostools::move(), HcalHBHEMuonVariables::muonChi2LocalPosition_, HcalHBHEMuonVariables::muonGlobal_, HcalHBHEMuonVariables::muonGood_, HcalHBHEMuonVariables::muonMedium_, DiMuonV_cfg::muons, HcalHBHEMuonVariables::muonSegComp_, HcalHBHEMuonVariables::muonTight_, HcalHBHEMuonVariables::muonTracker_, HcalHBHEMuonVariables::muonTrkKink_, nAll_, nGood_, HcalHBHEMuonVariables::numPixelLayers_, convertSQLiteXML::ok, spr::propagatedTrackID::okECAL, spr::propagatedTrackID::okHCAL, HcalHBHEMuonVariables::outerTrack_, HcalHBHEMuonVariables::outerTrackChi_, HcalHBHEMuonVariables::outerTrackEta_, HcalHBHEMuonVariables::outerTrackHits_, HcalHBHEMuonVariables::outerTrackPhi_, HcalHBHEMuonVariables::outerTrackPt_, HcalHBHEMuonVariables::outerTrackRHits_, HcalHBHEMuonVariables::phiGlob_, HcalHBHEMuonVariables::pMuon_, spr::propagateCALO(), spr::propagateHCALBack(), DiDispStaMuonMonitor_cfi::pt, HcalHBHEMuonVariables::ptGlob_, DetId::rawId(), respCorr(), convertSQLiteXML::runNumber, HcalHBHEMuonVariables::runNumber_, edm::second(), muon::segmentCompatibility(), HcalCondObjectContainerBase::setTopo(), HcalDetId::subdet(), HcalHBHEMuonVariables::tightLongPara_, HcalHBHEMuonVariables::tightPixelHits_, HcalHBHEMuonVariables::tightTransImpara_, HcalHBHEMuonVariables::tightValidFraction_, tok_chan_, tok_dbservice_, tok_ddrec1_, tok_EB_, tok_ecalPFRecHitThresholds_, tok_EE_, tok_geom1_, tok_HBHE_, tok_htopo1_, tok_magField_, tok_Muon_, tok_respcorr1_, tok_sevlv_, tok_topo_, tok_trigRes_, tok_Vtx_, HcalHBHEMuonVariables::trackerLayer_, L1TEGammaOffline_cfi::triggerNames, triggerResults, trigNames_, usePFThresh_, HcalTopology::validHcal(), verbosity_, and L1BJetProducer_cff::vtx.

239  {
240  ++nAll_;
241  auto outputHcalHBHEMuonColl = std::make_unique<HcalHBHEMuonVariablesCollection>();
242 
243  unsigned int runNumber = iEvent.id().run();
244  unsigned int eventNumber = iEvent.id().event();
245  unsigned int lumiNumber = iEvent.id().luminosityBlock();
246  unsigned int bxNumber = iEvent.bunchCrossing();
247 #ifdef EDM_ML_DEBUG
248  edm::LogVerbatim("HBHEMuon") << "Run " << runNumber << " Event " << eventNumber << " Lumi " << lumiNumber << " BX "
249  << bxNumber << std::endl;
250 #endif
251 
252  //Step1: Find if the event passes one of the chosen triggers
253  bool ok(false);
255  if (trigNames_.empty()) {
256  ok = true;
257  } else {
258  auto const& triggerResults = iEvent.getHandle(tok_trigRes_);
259  if (triggerResults.isValid()) {
260  std::vector<std::string> modules;
261  const edm::TriggerNames& triggerNames = iEvent.triggerNames(*triggerResults);
262  const std::vector<std::string>& triggerNames_ = triggerNames.triggerNames();
263  for (unsigned int iHLT = 0; iHLT < triggerResults->size(); iHLT++) {
264  int hlt = triggerResults->accept(iHLT);
265  for (unsigned int i = 0; i < trigNames_.size(); ++i) {
266  if (triggerNames_[iHLT].find(trigNames_[i]) != std::string::npos) {
267  if (hlt > 0) {
268  ok = true;
269  }
270 #ifdef EDM_ML_DEBUG
271  edm::LogVerbatim("HBHEMuon") << "AlCaHcalHBHEMuonFilter::Trigger " << triggerNames_[iHLT] << " Flag " << hlt
272  << ":" << ok << std::endl;
273 #endif
274  }
275  }
276  }
277  }
278  }
279 
280  // get handles to calogeometry and calotopology
281  const HcalDDDRecConstants* hdc = &iSetup.getData(tok_ddrec1_);
282  const HcalRespCorrs* resp = &iSetup.getData(tok_respcorr1_);
283  const CaloGeometry* geo = &iSetup.getData(tok_geom1_);
284  const HcalTopology* theHBHETopology = &iSetup.getData(tok_htopo1_);
285  const MagneticField* bField = &iSetup.getData(tok_magField_);
286  const EcalChannelStatus* theEcalChStatus = &iSetup.getData(tok_chan_);
287  const EcalSeverityLevelAlgo* sevlv = &iSetup.getData(tok_sevlv_);
288  const CaloTopology* caloTopology = &iSetup.getData(tok_topo_);
290  HcalRespCorrs respCorrsObj(*resp);
291  HcalRespCorrs* respCorrs = &respCorrsObj;
292  respCorrs->setTopo(theHBHETopology);
293  const EcalPFRecHitThresholds* eThresholds = &iSetup.getData(tok_ecalPFRecHitThresholds_);
294  ;
295 
296  // Relevant blocks from iEvent
297  auto const& vtx = iEvent.getHandle(tok_Vtx_);
298  auto barrelRecHitsHandle = iEvent.getHandle(tok_EB_);
299  auto endcapRecHitsHandle = iEvent.getHandle(tok_EE_);
300  auto hbhe = iEvent.getHandle(tok_HBHE_);
301  auto const& muons = iEvent.getHandle(tok_Muon_);
302 
303  // require a good vertex
304  math::XYZPoint pvx;
305  unsigned int goodVertex = 0;
306  reco::VertexCollection::const_iterator firstGoodVertex;
307  if (!vtx.isValid()) {
308 #ifdef EDM_ML_DEBUG
309  edm::LogVerbatim("HBHEMuon") << "No Good Vertex found == Reject";
310 #endif
311  } else {
312  firstGoodVertex = vtx->end();
313  for (reco::VertexCollection::const_iterator it = vtx->begin(); it != vtx->end(); it++) {
314  if (isGoodVertex(*it)) {
315  if (firstGoodVertex == vtx->end())
316  firstGoodVertex = it;
317  ++goodVertex;
318  }
319  }
320  if (firstGoodVertex != vtx->end())
321  pvx = firstGoodVertex->position();
322  }
323 
324  if (ok && (goodVertex > 0) && muons.isValid() && barrelRecHitsHandle.isValid() && endcapRecHitsHandle.isValid() &&
325  hbhe.isValid()) {
326  for (reco::MuonCollection::const_iterator recMuon = muons->begin(); recMuon != muons->end(); ++recMuon) {
327  HcalHBHEMuonVariables hbheMuon;
328  hbheMuon.runNumber_ = runNumber;
329  hbheMuon.eventNumber_ = eventNumber;
330  hbheMuon.lumiNumber_ = lumiNumber;
331  hbheMuon.bxNumber_ = bxNumber;
332  hbheMuon.goodVertex_ = goodVertex;
333  hbheMuon.muonGood_ = (recMuon->isPFMuon());
334  hbheMuon.muonGlobal_ = (recMuon->isGlobalMuon());
335  hbheMuon.muonTracker_ = (recMuon->isTrackerMuon());
336  hbheMuon.ptGlob_ = ((recMuon)->pt());
337  hbheMuon.etaGlob_ = (recMuon->eta());
338  hbheMuon.phiGlob_ = (recMuon->phi());
339  hbheMuon.energyMuon_ = (recMuon->energy());
340  hbheMuon.pMuon_ = (recMuon->p());
341 #ifdef EDM_ML_DEBUG
342  edm::LogVerbatim("HBHEMuon") << "Energy:" << recMuon->energy() << " P:" << recMuon->p();
343 #endif
344  hbheMuon.muonTight_ = (muon::isTightMuon(*recMuon, *firstGoodVertex));
345  hbheMuon.muonMedium_ = (muon::isMediumMuon(*recMuon));
346  hbheMuon.muonTrkKink_ = (recMuon->combinedQuality().trkKink);
347  hbheMuon.muonChi2LocalPosition_ = (recMuon->combinedQuality().chi2LocalPosition);
348  hbheMuon.muonSegComp_ = (muon::segmentCompatibility(*recMuon));
349  // acessing tracker hits info
350  if (recMuon->track().isNonnull()) {
351  hbheMuon.trackerLayer_ = (recMuon->track()->hitPattern().trackerLayersWithMeasurement());
352  } else {
353  hbheMuon.trackerLayer_ = -1;
354  }
355  if (recMuon->innerTrack().isNonnull()) {
356  hbheMuon.innerTrack_ = true;
357  hbheMuon.numPixelLayers_ = (recMuon->innerTrack()->hitPattern().pixelLayersWithMeasurement());
358  hbheMuon.chiTracker_ = (recMuon->innerTrack()->normalizedChi2());
359  hbheMuon.dxyTracker_ = (fabs(recMuon->innerTrack()->dxy(pvx)));
360  hbheMuon.dzTracker_ = (fabs(recMuon->innerTrack()->dz(pvx)));
361  hbheMuon.innerTrackPt_ = (recMuon->innerTrack()->pt());
362  hbheMuon.innerTrackEta_ = (recMuon->innerTrack()->eta());
363  hbheMuon.innerTrackPhi_ = (recMuon->innerTrack()->phi());
364  hbheMuon.tightPixelHits_ = (recMuon->innerTrack()->hitPattern().numberOfValidPixelHits());
365  hbheMuon.tightValidFraction_ = (recMuon->innerTrack()->validFraction());
366  }
367  // outer track info
368  if (recMuon->outerTrack().isNonnull()) {
369  hbheMuon.outerTrack_ = true;
370  hbheMuon.outerTrackPt_ = (recMuon->outerTrack()->pt());
371  hbheMuon.outerTrackEta_ = (recMuon->outerTrack()->eta());
372  hbheMuon.outerTrackPhi_ = (recMuon->outerTrack()->phi());
373  hbheMuon.outerTrackChi_ = (recMuon->outerTrack()->normalizedChi2());
374  hbheMuon.outerTrackHits_ = (recMuon->outerTrack()->numberOfValidHits());
375  hbheMuon.outerTrackRHits_ = (recMuon->outerTrack()->recHitsSize());
376  }
377  // Tight Muon cuts
378  if (recMuon->globalTrack().isNonnull()) {
379  hbheMuon.globalTrack_ = true;
380  hbheMuon.chiGlobal_ = (recMuon->globalTrack()->normalizedChi2());
381  hbheMuon.globalMuonHits_ = (recMuon->globalTrack()->hitPattern().numberOfValidMuonHits());
382  hbheMuon.matchedStat_ = (recMuon->numberOfMatchedStations());
383  hbheMuon.globalTrackPt_ = (recMuon->globalTrack()->pt());
384  hbheMuon.globalTrackEta_ = (recMuon->globalTrack()->eta());
385  hbheMuon.globalTrackPhi_ = (recMuon->globalTrack()->phi());
386  hbheMuon.tightTransImpara_ = (fabs(recMuon->muonBestTrack()->dxy(pvx)));
387  hbheMuon.tightLongPara_ = (fabs(recMuon->muonBestTrack()->dz(pvx)));
388  }
389 
390  hbheMuon.isolationR04_ =
391  ((recMuon->pfIsolationR04().sumChargedHadronPt +
392  std::max(0.,
393  recMuon->pfIsolationR04().sumNeutralHadronEt + recMuon->pfIsolationR04().sumPhotonEt -
394  (0.5 * recMuon->pfIsolationR04().sumPUPt))) /
395  recMuon->pt());
396 
397  hbheMuon.isolationR03_ =
398  ((recMuon->pfIsolationR03().sumChargedHadronPt +
399  std::max(0.,
400  recMuon->pfIsolationR03().sumNeutralHadronEt + recMuon->pfIsolationR03().sumPhotonEt -
401  (0.5 * recMuon->pfIsolationR03().sumPUPt))) /
402  recMuon->pt());
403 
404  hbheMuon.ecalEnergy_ = (recMuon->calEnergy().emS9);
405  hbheMuon.hcalEnergy_ = (recMuon->calEnergy().hadS9);
406  hbheMuon.hoEnergy_ = (recMuon->calEnergy().hoS9);
407 
408  if (recMuon->innerTrack().isNonnull()) {
409  const reco::Track* pTrack = (recMuon->innerTrack()).get();
410  spr::propagatedTrackID trackID = spr::propagateCALO(pTrack, geo, bField, (((verbosity_ / 100) % 10 > 0)));
411 
412  double activeLengthTot(0), activeLengthHotTot(0);
413  double eHcalDepth[depthMax_], eHcalDepthHot[depthMax_];
414  double eHcalDepthC[depthMax_], eHcalDepthHotC[depthMax_];
415  double cHcalDepthHot[depthMax_], cHcalDepthHotBG[depthMax_];
416  double eHcalDepthRaw[depthMax_], eHcalDepthHotRaw[depthMax_];
417  double eHcalDepthCRaw[depthMax_], eHcalDepthHotCRaw[depthMax_];
418  double cHcalDepthHotRaw[depthMax_], cHcalDepthHotBGRaw[depthMax_];
419  double eHcalDepthAux[depthMax_], eHcalDepthHotAux[depthMax_];
420  double eHcalDepthCAux[depthMax_], eHcalDepthHotCAux[depthMax_];
421  double cHcalDepthHotAux[depthMax_], cHcalDepthHotBGAux[depthMax_];
422  double activeL[depthMax_], activeHotL[depthMax_];
423  bool matchDepth[depthMax_], matchDepthHot[depthMax_];
424  HcalDetId eHcalDetId[depthMax_];
425  unsigned int isHot(0);
426  int ieta(-1000), iphi(-1000);
427  for (int i = 0; i < depthMax_; ++i) {
428  eHcalDepth[i] = eHcalDepthHot[i] = 0;
429  eHcalDepthC[i] = eHcalDepthHotC[i] = 0;
430  cHcalDepthHot[i] = cHcalDepthHotBG[i] = 0;
431  eHcalDepthRaw[i] = eHcalDepthHotRaw[i] = 0;
432  eHcalDepthCRaw[i] = eHcalDepthHotCRaw[i] = 0;
433  cHcalDepthHotRaw[i] = cHcalDepthHotBGRaw[i] = 0;
434  eHcalDepthAux[i] = eHcalDepthHotAux[i] = 0;
435  eHcalDepthCAux[i] = eHcalDepthHotCAux[i] = 0;
436  cHcalDepthHotAux[i] = cHcalDepthHotBGAux[i] = 0;
437  activeL[i] = activeHotL[i] = 0;
438  matchDepth[i] = matchDepthHot[i] = true;
439  }
440 #ifdef EDM_ML_DEBUG
441  double eHcal(0);
442 #endif
443 
444  hbheMuon.ecalDetId_ = ((trackID.detIdECAL)());
445  hbheMuon.hcalDetId_ = ((trackID.detIdHCAL)());
446  hbheMuon.ehcalDetId_ = ((trackID.detIdEHCAL)());
447 
448  HcalDetId check(false);
449  std::pair<bool, HcalDetId> info = spr::propagateHCALBack(pTrack, geo, bField, (((verbosity_ / 100) % 10 > 0)));
450  if (info.first) {
451  check = info.second;
452  }
453 
454  bool okE = trackID.okECAL;
455  if (okE) {
456  const DetId isoCell(trackID.detIdECAL);
457  std::pair<double, bool> e3x3 = (usePFThresh_ ? spr::eECALmatrix(isoCell,
458  barrelRecHitsHandle,
459  endcapRecHitsHandle,
460  *theEcalChStatus,
461  geo,
462  caloTopology,
463  sevlv,
464  eThresholds,
465  1,
466  1,
467  false)
468  : spr::eECALmatrix(isoCell,
469  barrelRecHitsHandle,
470  endcapRecHitsHandle,
471  *theEcalChStatus,
472  geo,
473  caloTopology,
474  sevlv,
475  1,
476  1,
477  -100.0,
478  -100.0,
479  -500.0,
480  500.0,
481  false));
482  hbheMuon.ecal3x3Energy_ = e3x3.first;
483  okE = e3x3.second;
484  }
485 #ifdef EDM_ML_DEBUG
486  edm::LogVerbatim("HBHEMuon") << "Propagate Track to ECAL: " << okE << ":" << trackID.okECAL << " E "
487  << hbheMuon.ecal3x3Energy_;
488 #endif
489 
490  if (trackID.okHCAL) {
491  DetId closestCell(trackID.detIdHCAL);
492  HcalDetId hcidt(closestCell.rawId());
493  if ((hcidt.ieta() == check.ieta()) && (hcidt.iphi() == check.iphi()))
494  hbheMuon.matchedId_ = true;
495 #ifdef EDM_ML_DEBUG
496  edm::LogVerbatim("HBHEMuon") << "Front " << hcidt << " Back " << info.first << ":" << check << " Match "
497  << hbheMuon.matchedId_;
498 #endif
499  HcalSubdetector subdet = hcidt.subdet();
500  ieta = hcidt.ieta();
501  iphi = hcidt.iphi();
502  bool hborhe = (std::abs(ieta) == 16);
503 
504  hbheMuon.hcal1x1Energy_ = spr::eHCALmatrix(
505  theHBHETopology, closestCell, hbhe, 0, 0, false, true, -100.0, -100.0, -100.0, -100.0, -500., 500., 0);
507  theHBHETopology, closestCell, hbhe, 0, 0, false, true, -100.0, -100.0, -100.0, -100.0, -500., 500., 1);
509  theHBHETopology, closestCell, hbhe, 0, 0, false, true, -100.0, -100.0, -100.0, -100.0, -500., 500., 2);
510  std::vector<std::pair<double, int>> ehdepth, ehdepthAux, ehdepthRaw;
511  spr::energyHCALCell((HcalDetId)closestCell,
512  hbhe,
513  ehdepth,
514  maxDepth_,
515  -100.0,
516  -100.0,
517  -100.0,
518  -100.0,
519  -500.0,
520  500.0,
521  0,
522  depth16HE(ieta, iphi, theHBHETopology),
523  (((verbosity_ / 1000) % 10) > 0));
524  for (int i = 0; i < depthMax_; ++i)
525  eHcalDetId[i] = HcalDetId();
526  spr::energyHCALCell((HcalDetId)closestCell,
527  hbhe,
528  ehdepthAux,
529  maxDepth_,
530  -100.0,
531  -100.0,
532  -100.0,
533  -100.0,
534  -500.0,
535  500.0,
536  1,
537  depth16HE(ieta, iphi, theHBHETopology),
538  (((verbosity_ / 1000) % 10) > 0));
539  spr::energyHCALCell((HcalDetId)closestCell,
540  hbhe,
541  ehdepthRaw,
542  maxDepth_,
543  -100.0,
544  -100.0,
545  -100.0,
546  -100.0,
547  -500.0,
548  500.0,
549  2,
550  depth16HE(ieta, iphi, theHBHETopology),
551  (((verbosity_ / 1000) % 10) > 0));
552  for (unsigned int i = 0; i < ehdepth.size(); ++i) {
553  HcalSubdetector subdet0 =
554  (hborhe) ? ((ehdepth[i].second >= depth16HE(ieta, iphi, theHBHETopology)) ? HcalEndcap : HcalBarrel)
555  : subdet;
556  HcalDetId hcid0(subdet0, ieta, iphi, ehdepth[i].second);
557  double actL = activeLength(DetId(hcid0), hdc);
558  double ene = ehdepth[i].first;
559  double eneAux = ehdepthAux[i].first;
560  double eneRaw = ehdepthRaw[i].first;
561  bool tmpC(false);
562  if (ene > 0.0) {
563  if (!(theHBHETopology->validHcal(hcid0))) {
564  edm::LogWarning("HBHEMuon") << "(1) Invalid ID " << hcid0 << " with E = " << ene;
565  edm::LogWarning("HBHEMuon") << HcalDetId(closestCell) << " with " << ehdepth.size() << " depths:";
566  for (const auto& ehd : ehdepth)
567  edm::LogWarning("HBHEMuon") << " " << ehd.second << ":" << ehd.first;
568  } else {
569  tmpC = goodCell(hcid0, pTrack, geo, bField, hdc);
570  double enec(ene);
571  double corr = respCorr(DetId(hcid0), respCorrs);
572  if (corr != 0)
573  ene /= corr;
574 #ifdef EDM_ML_DEBUG
575  HcalDetId id = (isItPlan1_ && isItPreRecHit_) ? hdc->mergedDepthDetId(hcid0) : hcid0;
576  edm::LogVerbatim("HBHEMuon") << hcid0 << ":" << id << " Corr " << corr;
577 #endif
578  int depth = ehdepth[i].second - 1;
579  if (collapseDepth_) {
580  HcalDetId id = hdc->mergedDepthDetId(hcid0);
581  depth = id.depth() - 1;
582  }
583  eHcalDepth[depth] += ene;
584  eHcalDepthC[depth] += enec;
585  activeL[depth] += actL;
586  activeLengthTot += actL;
587  matchDepth[depth] = (matchDepth[depth] && tmpC);
588 #ifdef EDM_ML_DEBUG
589  if ((verbosity_ % 10) > 0)
590  edm::LogVerbatim("HBHEMuon")
591  << hcid0 << " E " << ene << ":" << enec << " L " << actL << " Match " << tmpC;
592 #endif
593  }
594  }
595  if (eneAux > 0.0) {
596  if (theHBHETopology->validHcal(hcid0)) {
597  double enecAux(eneAux);
598  double corr = respCorr(DetId(hcid0), respCorrs);
599  if (corr != 0)
600  eneAux /= corr;
601  int depth = ehdepthAux[i].second - 1;
602  if (collapseDepth_) {
603  HcalDetId id = hdc->mergedDepthDetId(hcid0);
604  depth = id.depth() - 1;
605  }
606  eHcalDepthAux[depth] += eneAux;
607  eHcalDepthCAux[depth] += enecAux;
608 #ifdef EDM_ML_DEBUG
609  if ((verbosity_ % 10) > 0)
610  edm::LogVerbatim("HBHEMuon")
611  << hcid0 << " E " << eneAux << ":" << enecAux << " L " << actL << " Match " << tmpC;
612 #endif
613  }
614  }
615  if (eneRaw > 0.0) {
616  if (theHBHETopology->validHcal(hcid0)) {
617  double enecRaw(eneRaw);
618  double corr = respCorr(DetId(hcid0), respCorrs);
619  if (corr != 0)
620  eneRaw /= corr;
621  int depth = ehdepthRaw[i].second - 1;
622  if (collapseDepth_) {
623  HcalDetId id = hdc->mergedDepthDetId(hcid0);
624  depth = id.depth() - 1;
625  }
626  eHcalDepthRaw[depth] += eneRaw;
627  eHcalDepthCRaw[depth] += enecRaw;
628 #ifdef EDM_ML_DEBUG
629  if ((verbosity_ % 10) > 0)
630  edm::LogVerbatim("HBHEMuon")
631  << hcid0 << " E " << eneRaw << ":" << enecRaw << " L " << actL << " Match " << tmpC;
632 #endif
633  }
634  }
635  }
636 #ifdef EDM_ML_DEBUG
637  if ((verbosity_ % 10) > 0) {
638  edm::LogVerbatim("HBHEMuon") << hcidt << " Match " << hbheMuon.matchedId_ << " Depths " << ehdepth.size();
639  for (unsigned int k = 0; k < ehdepth.size(); ++k)
640  edm::LogVerbatim("HBHEMuon") << " [" << k << ":" << ehdepth[k].second << "] " << matchDepth[k];
641  }
642 #endif
643  HcalDetId hotCell;
644  spr::eHCALmatrix(geo, theHBHETopology, closestCell, hbhe, 1, 1, hotCell, false, 0, false);
645  isHot = matchId(closestCell, hotCell);
646  if (hotCell != HcalDetId()) {
647  subdet = HcalDetId(hotCell).subdet();
648  ieta = HcalDetId(hotCell).ieta();
649  iphi = HcalDetId(hotCell).iphi();
650  hborhe = (std::abs(ieta) == 16);
651  std::vector<std::pair<double, int>> ehdepth, ehdepthAux, ehdepthRaw;
652  spr::energyHCALCell(hotCell,
653  hbhe,
654  ehdepth,
655  maxDepth_,
656  -100.0,
657  -100.0,
658  -100.0,
659  -100.0,
660  -500.0,
661  500.0,
662  0,
663  depth16HE(ieta, iphi, theHBHETopology),
664  false);
665  spr::energyHCALCell(hotCell,
666  hbhe,
667  ehdepthAux,
668  maxDepth_,
669  -100.0,
670  -100.0,
671  -100.0,
672  -100.0,
673  -500.0,
674  500.0,
675  1,
676  depth16HE(ieta, iphi, theHBHETopology),
677  false);
678  spr::energyHCALCell(hotCell,
679  hbhe,
680  ehdepthRaw,
681  maxDepth_,
682  -100.0,
683  -100.0,
684  -100.0,
685  -100.0,
686  -500.0,
687  500.0,
688  2,
689  depth16HE(ieta, iphi, theHBHETopology),
690  false);
691  for (int i = 0; i < depthMax_; ++i)
692  eHcalDetId[i] = HcalDetId();
693  for (unsigned int i = 0; i < ehdepth.size(); ++i) {
694  HcalSubdetector subdet0 =
695  (hborhe) ? ((ehdepth[i].second >= depth16HE(ieta, iphi, theHBHETopology)) ? HcalEndcap : HcalBarrel)
696  : subdet;
697  HcalDetId hcid0(subdet0, ieta, iphi, ehdepth[i].second);
698  double actL = activeLength(DetId(hcid0), hdc);
699  double ene = ehdepth[i].first;
700  bool tmpC(false);
701  if (ene > 0.0) {
702  if (!(theHBHETopology->validHcal(hcid0))) {
703  edm::LogWarning("HBHEMuon") << "(2) Invalid ID " << hcid0 << " with E = " << ene;
704  edm::LogWarning("HBHEMuon") << HcalDetId(hotCell) << " with " << ehdepth.size() << " depths:";
705  for (const auto& ehd : ehdepth)
706  edm::LogWarning("HBHEMuon") << " " << ehd.second << ":" << ehd.first;
707  } else {
708  tmpC = goodCell(hcid0, pTrack, geo, bField, hdc);
709  double chg(ene), enec(ene);
710  double corr = respCorr(DetId(hcid0), respCorrs);
711  if (corr != 0)
712  ene /= corr;
713 #ifdef EDM_ML_DEBUG
714  HcalDetId id = (isItPlan1_ && isItPreRecHit_) ? hdc->mergedDepthDetId(hcid0) : hcid0;
715  edm::LogVerbatim("HBHEMuon") << hcid0 << ":" << id << " Corr " << corr << " E " << ene << ":" << enec;
716 #endif
717  double gain = gainFactor(conditions, hcid0);
718  if (gain != 0)
719  chg /= gain;
720 #ifdef EDM_ML_DEBUG
721  edm::LogVerbatim("HBHEMuon") << hcid0 << " Gain " << gain << " C " << chg;
722 #endif
723  int depth = ehdepth[i].second - 1;
724  if (collapseDepth_) {
725  HcalDetId id = hdc->mergedDepthDetId(hcid0);
726  depth = id.depth() - 1;
727  }
728  eHcalDepthHot[depth] += ene;
729  eHcalDepthHotC[depth] += enec;
730  cHcalDepthHot[depth] += chg;
731  activeHotL[depth] += actL;
732  activeLengthHotTot += actL;
733  matchDepthHot[depth] = (matchDepthHot[depth] && tmpC);
734 #ifdef EDM_ML_DEBUG
735  eHcal += ene;
736  if ((verbosity_ % 10) > 0)
737  edm::LogVerbatim("HBHEMuon") << hcid0 << " depth " << depth << " E " << ene << ":" << enec << " C "
738  << chg << " L " << actL << " Match " << tmpC;
739 #endif
740  }
741  }
742  double eneAux = ehdepthAux[i].first;
743  if (eneAux > 0.0) {
744  if (theHBHETopology->validHcal(hcid0)) {
745  double chgAux(eneAux), enecAux(eneAux);
746  double corr = respCorr(DetId(hcid0), respCorrs);
747  if (corr != 0)
748  eneAux /= corr;
749  double gain = gainFactor(conditions, hcid0);
750  if (gain != 0)
751  chgAux /= gain;
752  int depth = ehdepthAux[i].second - 1;
753  if (collapseDepth_) {
754  HcalDetId id = hdc->mergedDepthDetId(hcid0);
755  depth = id.depth() - 1;
756  }
757  eHcalDepthHotAux[depth] += eneAux;
758  eHcalDepthHotCAux[depth] += enecAux;
759  cHcalDepthHotAux[depth] += chgAux;
760 #ifdef EDM_ML_DEBUG
761  if ((verbosity_ % 10) > 0)
762  edm::LogVerbatim("HBHEMuon") << hcid0 << " depth " << depth << " E " << eneAux << ":" << enecAux
763  << " C " << chgAux << " L " << actL << " Match " << tmpC;
764 #endif
765  }
766  }
767  double eneRaw = ehdepthRaw[i].first;
768  if (eneRaw > 0.0) {
769  if (theHBHETopology->validHcal(hcid0)) {
770  double chgRaw(eneRaw), enecRaw(eneRaw);
771  double corr = respCorr(DetId(hcid0), respCorrs);
772  if (corr != 0)
773  eneRaw /= corr;
774  double gain = gainFactor(conditions, hcid0);
775  if (gain != 0)
776  chgRaw /= gain;
777  int depth = ehdepthRaw[i].second - 1;
778  if (collapseDepth_) {
779  HcalDetId id = hdc->mergedDepthDetId(hcid0);
780  depth = id.depth() - 1;
781  }
782  eHcalDepthHotRaw[depth] += eneRaw;
783  eHcalDepthHotCRaw[depth] += enecRaw;
784  cHcalDepthHotRaw[depth] += chgRaw;
785 #ifdef EDM_ML_DEBUG
786  if ((verbosity_ % 10) > 0)
787  edm::LogVerbatim("HBHEMuon") << hcid0 << " depth " << depth << " E " << eneRaw << ":" << enecRaw
788  << " C " << chgRaw << " L " << actL << " Match " << tmpC;
789 #endif
790  }
791  }
792  }
793 
794  HcalDetId oppCell(subdet, -ieta, iphi, HcalDetId(hotCell).depth());
795  std::vector<std::pair<double, int>> ehdeptho, ehdepthoAux, ehdepthoRaw;
796  spr::energyHCALCell(oppCell,
797  hbhe,
798  ehdeptho,
799  maxDepth_,
800  -100.0,
801  -100.0,
802  -100.0,
803  -100.0,
804  -500.0,
805  500.0,
806  0,
807  depth16HE(-ieta, iphi, theHBHETopology),
808  false);
809  spr::energyHCALCell(oppCell,
810  hbhe,
811  ehdepthoAux,
812  maxDepth_,
813  -100.0,
814  -100.0,
815  -100.0,
816  -100.0,
817  -500.0,
818  500.0,
819  1,
820  depth16HE(-ieta, iphi, theHBHETopology),
821  false);
822  spr::energyHCALCell(oppCell,
823  hbhe,
824  ehdepthoRaw,
825  maxDepth_,
826  -100.0,
827  -100.0,
828  -100.0,
829  -100.0,
830  -500.0,
831  500.0,
832  2,
833  depth16HE(-ieta, iphi, theHBHETopology),
834  false);
835  for (unsigned int i = 0; i < ehdeptho.size(); ++i) {
836  HcalSubdetector subdet0 =
837  (hborhe) ? ((ehdeptho[i].second >= depth16HE(-ieta, iphi, theHBHETopology)) ? HcalEndcap : HcalBarrel)
838  : subdet;
839  HcalDetId hcid0(subdet0, -ieta, iphi, ehdeptho[i].second);
840  double ene = ehdeptho[i].first;
841  if (ene > 0.0) {
842  if (!(theHBHETopology->validHcal(hcid0))) {
843  edm::LogWarning("HBHEMuon") << "(3) Invalid ID " << hcid0 << " with E = " << ene;
844  edm::LogWarning("HBHEMuon") << oppCell << " with " << ehdeptho.size() << " depths:";
845  for (const auto& ehd : ehdeptho)
846  edm::LogWarning("HBHEMuon") << " " << ehd.second << ":" << ehd.first;
847  } else {
848  double chg(ene);
849  double corr = respCorr(DetId(hcid0), respCorrs);
850  if (corr != 0)
851  ene /= corr;
852 #ifdef EDM_ML_DEBUG
853  HcalDetId id = (isItPlan1_ && isItPreRecHit_) ? hdc->mergedDepthDetId(hcid0) : hcid0;
854  edm::LogVerbatim("HBHEMuon")
855  << hcid0 << ":" << id << " Corr " << corr << " E " << ene << ":" << ehdeptho[i].first;
856 #endif
857  double gain = gainFactor(conditions, hcid0);
858  if (gain != 0)
859  chg /= gain;
860 #ifdef EDM_ML_DEBUG
861  edm::LogVerbatim("HBHEMuon") << hcid0 << " Gain " << gain << " C " << chg;
862 #endif
863  int depth = ehdeptho[i].second - 1;
864  if (collapseDepth_) {
865  HcalDetId id = hdc->mergedDepthDetId(hcid0);
866  depth = id.depth() - 1;
867  }
868  cHcalDepthHotBG[depth] += chg;
869 #ifdef EDM_ML_DEBUG
870  if ((verbosity_ % 10) > 0)
871  edm::LogVerbatim("HBHEMuon") << hcid0 << " Depth " << depth << " E " << ene << " C " << chg;
872 #endif
873  }
874  }
875  double eneAux = ehdepthoAux[i].first;
876  if (eneAux > 0.0) {
877  if (theHBHETopology->validHcal(hcid0)) {
878  double chgAux(eneAux);
879  double corr = respCorr(DetId(hcid0), respCorrs);
880  if (corr != 0)
881  eneAux /= corr;
882  double gain = gainFactor(conditions, hcid0);
883  if (gain != 0)
884  chgAux /= gain;
885  int depth = ehdepthoAux[i].second - 1;
886  if (collapseDepth_) {
887  HcalDetId id = hdc->mergedDepthDetId(hcid0);
888  depth = id.depth() - 1;
889  }
890  cHcalDepthHotBGAux[depth] += chgAux;
891 #ifdef EDM_ML_DEBUG
892  if ((verbosity_ % 10) > 0)
893  edm::LogVerbatim("HBHEMuon") << hcid0 << " Depth " << depth << " E " << eneAux << " C " << chgAux;
894 #endif
895  }
896  }
897  double eneRaw = ehdepthoRaw[i].first;
898  if (eneRaw > 0.0) {
899  if (theHBHETopology->validHcal(hcid0)) {
900  double chgRaw(eneRaw);
901  double corr = respCorr(DetId(hcid0), respCorrs);
902  if (corr != 0)
903  eneRaw /= corr;
904  double gain = gainFactor(conditions, hcid0);
905  if (gain != 0)
906  chgRaw /= gain;
907  int depth = ehdepthoRaw[i].second - 1;
908  if (collapseDepth_) {
909  HcalDetId id = hdc->mergedDepthDetId(hcid0);
910  depth = id.depth() - 1;
911  }
912  cHcalDepthHotBGRaw[depth] += chgRaw;
913 #ifdef EDM_ML_DEBUG
914  if ((verbosity_ % 10) > 0)
915  edm::LogVerbatim("HBHEMuon") << hcid0 << " Depth " << depth << " E " << eneRaw << " C " << chgRaw;
916 #endif
917  }
918  }
919  }
920  }
921  }
922 #ifdef EDM_ML_DEBUG
923  edm::LogVerbatim("HBHEMuon") << "Propagate Track to HCAL: " << trackID.okHCAL << " Match "
924  << hbheMuon.matchedId_ << " Hot " << isHot << " Energy " << eHcal;
925 #endif
926  hbheMuon.hcalIeta_ = ieta;
927  hbheMuon.hcalIphi_ = iphi;
928  for (int i = 0; i < depthMax_; ++i) {
929  hbheMuon.hcalDepthEnergy_.push_back(eHcalDepth[i]);
930  hbheMuon.hcalDepthActiveLength_.push_back(activeL[i]);
931  hbheMuon.hcalDepthEnergyHot_.push_back(eHcalDepthHot[i]);
932  hbheMuon.hcalDepthActiveLengthHot_.push_back(activeHotL[i]);
933  hbheMuon.hcalDepthEnergyCorr_.push_back(eHcalDepthC[i]);
934  hbheMuon.hcalDepthEnergyHotCorr_.push_back(eHcalDepthHotC[i]);
935  hbheMuon.hcalDepthChargeHot_.push_back(cHcalDepthHot[i]);
936  hbheMuon.hcalDepthChargeHotBG_.push_back(cHcalDepthHotBG[i]);
937  hbheMuon.hcalDepthMatch_.push_back(matchDepth[i]);
938  hbheMuon.hcalDepthMatchHot_.push_back(matchDepthHot[i]);
939  hbheMuon.hcalDepthEnergyAux_.push_back(eHcalDepthAux[i]);
940  hbheMuon.hcalDepthEnergyHotAux_.push_back(eHcalDepthHotAux[i]);
941  hbheMuon.hcalDepthEnergyCorrAux_.push_back(eHcalDepthCAux[i]);
942  hbheMuon.hcalDepthEnergyHotCorrAux_.push_back(eHcalDepthHotCAux[i]);
943  hbheMuon.hcalDepthChargeHotAux_.push_back(cHcalDepthHotAux[i]);
944  hbheMuon.hcalDepthChargeHotBGAux_.push_back(cHcalDepthHotBGAux[i]);
945  hbheMuon.hcalDepthEnergyRaw_.push_back(eHcalDepthRaw[i]);
946  hbheMuon.hcalDepthEnergyHotRaw_.push_back(eHcalDepthHotRaw[i]);
947  hbheMuon.hcalDepthEnergyCorrRaw_.push_back(eHcalDepthCRaw[i]);
948  hbheMuon.hcalDepthEnergyHotCorrRaw_.push_back(eHcalDepthHotCRaw[i]);
949  hbheMuon.hcalDepthChargeHotRaw_.push_back(cHcalDepthHotRaw[i]);
950  hbheMuon.hcalDepthChargeHotBGRaw_.push_back(cHcalDepthHotBGRaw[i]);
951  }
952  hbheMuon.hcalActiveLength_ = activeLengthTot;
953  hbheMuon.hcalHot_ = isHot;
954  hbheMuon.hcalActiveLengthHot_ = activeLengthHotTot;
955 
956  if ((recMuon->p() > 10.0) && (trackID.okHCAL))
957  outputHcalHBHEMuonColl->emplace_back(hbheMuon);
958  }
959  }
960  }
961  if (!outputHcalHBHEMuonColl->empty())
962  ++nGood_;
963  iEvent.put(std::move(outputHcalHBHEMuonColl), labelHBHEMuon_);
964 }
Log< level::Info, true > LogVerbatim
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, const std::string &theTrackQuality, bool debug=false)
int depth16HE(int ieta, int iphi, const HcalTopology *theHBHETopology)
static const TGPicture * info(bool iBackgroundIsBlack)
const edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tok_magField_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
bool goodCell(const HcalDetId &hcid, const reco::Track *pTrack, const CaloGeometry *geo, const MagneticField *bField, const HcalDDDRecConstants *hdc)
HcalDetId mergedDepthDetId(const HcalDetId &id) const
bool isMediumMuon(const reco::Muon &, bool run2016_hip_mitigation=false)
const float chg[109]
Definition: CoreSimTrack.cc:5
const edm::ESGetToken< HcalDbService, HcalDbRecord > tok_dbservice_
std::vector< float > hcalDepthEnergyCorrRaw_
std::vector< float > hcalDepthEnergyRaw_
std::vector< float > hcalDepthEnergy_
std::vector< float > hcalDepthEnergyHotRaw_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom1_
std::vector< float > hcalDepthChargeHotRaw_
std::vector< bool > hcalDepthMatchHot_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
Definition: DiMuonV_cfg.py:214
std::vector< float > hcalDepthChargeHotBGRaw_
std::vector< float > hcalDepthEnergyHotAux_
std::vector< float > hcalDepthEnergyHotCorr_
const edm::EDGetTokenT< reco::MuonCollection > tok_Muon_
const edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > tok_sevlv_
U second(std::pair< T, U > const &p)
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
bool isGoodVertex(const reco::Vertex &vtx)
int iEvent
Definition: GenABIO.cc:224
double activeLength(const DetId &, const HcalDDDRecConstants *hdc)
dictionary corr
const std::vector< std::string > trigNames_
spr::propagatedTrackDirection propagateHCALBack(unsigned int thisTrk, edm::Handle< edm::SimTrackContainer > &SimTk, edm::Handle< edm::SimVertexContainer > &SimVtx, const CaloGeometry *geo, const MagneticField *bField, bool debug=false)
double respCorr(const DetId &id, const HcalRespCorrs *respCorrs)
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
const edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > tok_chan_
const edm::ESGetToken< EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd > tok_ecalPFRecHitThresholds_
std::vector< float > hcalDepthChargeHotAux_
std::vector< float > hcalDepthEnergyHot_
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_ddrec1_
HcalSubdetector
Definition: HcalAssistant.h:31
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
std::vector< float > hcalDepthEnergyCorr_
std::vector< float > hcalDepthActiveLength_
static std::string const triggerResults
Definition: EdmProvDump.cc:47
const edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > tok_htopo1_
std::vector< float > hcalDepthEnergyAux_
std::vector< float > hcalDepthEnergyHotCorrRaw_
Definition: DetId.h:17
std::vector< float > hcalDepthChargeHotBG_
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
const edm::ESGetToken< CaloTopology, CaloTopologyRecord > tok_topo_
bool validHcal(const HcalDetId &id) const
const edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_respcorr1_
std::vector< float > hcalDepthChargeHot_
const edm::EDGetTokenT< edm::TriggerResults > tok_trigRes_
std::vector< float > hcalDepthEnergyCorrAux_
std::vector< bool > hcalDepthMatch_
double gainFactor(const HcalDbService *dbserv, const HcalDetId &id)
const edm::EDGetTokenT< reco::VertexCollection > tok_Vtx_
int matchId(const HcalDetId &, const HcalDetId &)
std::vector< float > hcalDepthEnergyHotCorrAux_
Log< level::Warning, false > LogWarning
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
std::vector< float > hcalDepthActiveLengthHot_
void energyHCALCell(HcalDetId detId, edm::Handle< T > &hits, std::vector< std::pair< double, int > > &energyCell, int maxDepth=1, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100, double tMin=-500, double tMax=500, int useRaw=0, int depthHE=3, bool debug=false)
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
def move(src, dest)
Definition: eostools.py:511
void setTopo(const HcalTopology *topo)
const edm::EDGetTokenT< HBHERecHitCollection > tok_HBHE_
std::vector< float > hcalDepthChargeHotBGAux_
double eECALmatrix(const DetId &detId, edm::Handle< T > &hitsEB, edm::Handle< T > &hitsEE, const CaloGeometry *geo, const CaloTopology *caloTopology, int ieta, int iphi, double ebThr=-100, double eeThr=-100, double tMin=-500, double tMax=500, bool debug=false)
double eHCALmatrix(const HcalTopology *topology, const DetId &det, edm::Handle< T > &hits, int ieta, int iphi, bool includeHO=false, bool algoNew=true, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100, double tMin=-500, double tMax=500, int useRaw=0, bool debug=false)
const edm::EDGetTokenT< EcalRecHitCollection > tok_EE_

◆ respCorr()

double AlCaHcalHBHEMuonProducer::respCorr ( const DetId id,
const HcalRespCorrs respCorrs 
)
private

Definition at line 1117 of file AlCaHcalHBHEMuonProducer.cc.

References corrValue_, reco::JetExtendedAssociation::getValue(), HcalCondObjectContainer< Item >::getValues(), and useMyCorr_.

Referenced by produce().

1117  {
1118  double cfac(1.0);
1119  if (useMyCorr_) {
1120  auto itr = corrValue_.find(id);
1121  if (itr != corrValue_.end())
1122  cfac = itr->second;
1123  } else if (respCorrs != nullptr) {
1124  cfac = (respCorrs->getValues(id))->getValue();
1125  }
1126  return cfac;
1127 }
const Item * getValues(DetId fId, bool throwOnFail=true) const
std::map< DetId, double > corrValue_
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found

Member Data Documentation

◆ actHB

std::vector<HcalDDDRecConstants::HcalActiveLength> AlCaHcalHBHEMuonProducer::actHB
private

Definition at line 157 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by activeLength(), and beginRun().

◆ actHE

std::vector<HcalDDDRecConstants::HcalActiveLength> AlCaHcalHBHEMuonProducer::actHE
private

Definition at line 157 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by activeLength(), and beginRun().

◆ all_triggers_

std::vector<std::string> AlCaHcalHBHEMuonProducer::all_triggers_
private

Definition at line 154 of file AlCaHcalHBHEMuonProducer.cc.

◆ collapseDepth_

const bool AlCaHcalHBHEMuonProducer::collapseDepth_
private

Definition at line 120 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer(), and produce().

◆ corrValue_

std::map<DetId, double> AlCaHcalHBHEMuonProducer::corrValue_
private

Definition at line 158 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer(), and respCorr().

◆ depthMax_

const int AlCaHcalHBHEMuonProducer::depthMax_ = 7
staticprivate

Definition at line 153 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ fileInCorr_

const std::string AlCaHcalHBHEMuonProducer::fileInCorr_
private

Definition at line 123 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer().

◆ hltConfig_

HLTConfigProvider AlCaHcalHBHEMuonProducer::hltConfig_
private

Definition at line 114 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun().

◆ hltresults_

std::vector<int> AlCaHcalHBHEMuonProducer::hltresults_
private

Definition at line 155 of file AlCaHcalHBHEMuonProducer.cc.

◆ isItPlan1_

const bool AlCaHcalHBHEMuonProducer::isItPlan1_
private

Definition at line 120 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer(), depth16HE(), and produce().

◆ isItPreRecHit_

const bool AlCaHcalHBHEMuonProducer::isItPreRecHit_
private

Definition at line 122 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer(), depth16HE(), and produce().

◆ labelEBRecHit_

const edm::InputTag AlCaHcalHBHEMuonProducer::labelEBRecHit_
private

Definition at line 118 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer().

◆ labelEERecHit_

const edm::InputTag AlCaHcalHBHEMuonProducer::labelEERecHit_
private

Definition at line 118 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer().

◆ labelHBHEMuon_

const std::string AlCaHcalHBHEMuonProducer::labelHBHEMuon_
private

Definition at line 119 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer(), and produce().

◆ labelHBHERecHit_

const edm::InputTag AlCaHcalHBHEMuonProducer::labelHBHERecHit_
private

Definition at line 118 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer().

◆ labelMuon_

const std::string AlCaHcalHBHEMuonProducer::labelMuon_
private

Definition at line 119 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer().

◆ labelVtx_

const std::string AlCaHcalHBHEMuonProducer::labelVtx_
private

Definition at line 119 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer().

◆ maxDepth_

const int AlCaHcalHBHEMuonProducer::maxDepth_
private

Definition at line 124 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ mergedDepth_

const bool AlCaHcalHBHEMuonProducer::mergedDepth_
private

Definition at line 125 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by activeLength(), AlCaHcalHBHEMuonProducer(), and beginRun().

◆ nAll_

int AlCaHcalHBHEMuonProducer::nAll_
private

Definition at line 128 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by endStream(), and produce().

◆ nGood_

int AlCaHcalHBHEMuonProducer::nGood_
private

Definition at line 128 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by endStream(), and produce().

◆ nRun_

int AlCaHcalHBHEMuonProducer::nRun_
private

Definition at line 128 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun(), and endRun().

◆ processName_

const std::string AlCaHcalHBHEMuonProducer::processName_
private

Definition at line 116 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun().

◆ tok_chan_

const edm::ESGetToken<EcalChannelStatus, EcalChannelStatusRcd> AlCaHcalHBHEMuonProducer::tok_chan_
private

Definition at line 146 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_dbservice_

const edm::ESGetToken<HcalDbService, HcalDbRecord> AlCaHcalHBHEMuonProducer::tok_dbservice_
private

Definition at line 149 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_ddrec0_

const edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> AlCaHcalHBHEMuonProducer::tok_ddrec0_
private

Definition at line 137 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun().

◆ tok_ddrec1_

const edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> AlCaHcalHBHEMuonProducer::tok_ddrec1_
private

Definition at line 138 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_EB_

const edm::EDGetTokenT<EcalRecHitCollection> AlCaHcalHBHEMuonProducer::tok_EB_
private

Definition at line 132 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_ecalPFRecHitThresholds_

const edm::ESGetToken<EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd> AlCaHcalHBHEMuonProducer::tok_ecalPFRecHitThresholds_
private

Definition at line 150 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_EE_

const edm::EDGetTokenT<EcalRecHitCollection> AlCaHcalHBHEMuonProducer::tok_EE_
private

Definition at line 133 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_geom0_

const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> AlCaHcalHBHEMuonProducer::tok_geom0_
private

Definition at line 141 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun().

◆ tok_geom1_

const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> AlCaHcalHBHEMuonProducer::tok_geom1_
private

Definition at line 142 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_HBHE_

const edm::EDGetTokenT<HBHERecHitCollection> AlCaHcalHBHEMuonProducer::tok_HBHE_
private

Definition at line 134 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_htopo0_

const edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> AlCaHcalHBHEMuonProducer::tok_htopo0_
private

Definition at line 143 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun().

◆ tok_htopo1_

const edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> AlCaHcalHBHEMuonProducer::tok_htopo1_
private

Definition at line 144 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_magField_

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> AlCaHcalHBHEMuonProducer::tok_magField_
private

Definition at line 145 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_Muon_

const edm::EDGetTokenT<reco::MuonCollection> AlCaHcalHBHEMuonProducer::tok_Muon_
private

Definition at line 135 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_respcorr0_

const edm::ESGetToken<HcalRespCorrs, HcalRespCorrsRcd> AlCaHcalHBHEMuonProducer::tok_respcorr0_
private

Definition at line 139 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun().

◆ tok_respcorr1_

const edm::ESGetToken<HcalRespCorrs, HcalRespCorrsRcd> AlCaHcalHBHEMuonProducer::tok_respcorr1_
private

Definition at line 140 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_sevlv_

const edm::ESGetToken<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd> AlCaHcalHBHEMuonProducer::tok_sevlv_
private

Definition at line 147 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_topo_

const edm::ESGetToken<CaloTopology, CaloTopologyRecord> AlCaHcalHBHEMuonProducer::tok_topo_
private

Definition at line 148 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_trigRes_

const edm::EDGetTokenT<edm::TriggerResults> AlCaHcalHBHEMuonProducer::tok_trigRes_
private

Definition at line 130 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_Vtx_

const edm::EDGetTokenT<reco::VertexCollection> AlCaHcalHBHEMuonProducer::tok_Vtx_
private

Definition at line 131 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ triggerResults_

const edm::InputTag AlCaHcalHBHEMuonProducer::triggerResults_
private

Definition at line 117 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer().

◆ trigNames_

const std::vector<std::string> AlCaHcalHBHEMuonProducer::trigNames_
private

Definition at line 115 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ useMyCorr_

bool AlCaHcalHBHEMuonProducer::useMyCorr_
private

Definition at line 127 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer(), and respCorr().

◆ usePFThresh_

const bool AlCaHcalHBHEMuonProducer::usePFThresh_
private

Definition at line 125 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ verbosity_

const int AlCaHcalHBHEMuonProducer::verbosity_
private

Definition at line 121 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by goodCell(), and produce().

◆ writeRespCorr_

const bool AlCaHcalHBHEMuonProducer::writeRespCorr_
private

Definition at line 122 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun().