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< alcaHcalHBHEMuon::Counters > >

Public Member Functions

 AlCaHcalHBHEMuonProducer (const edm::ParameterSet &, const alcaHcalHBHEMuon::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< alcaHcalHBHEMuon::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 alcaHcalHBHEMuon::Counters *counters)
 
static std::unique_ptr< alcaHcalHBHEMuon::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::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 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< alcaHcalHBHEMuon::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 79 of file AlCaHcalHBHEMuonProducer.cc.

Constructor & Destructor Documentation

◆ AlCaHcalHBHEMuonProducer()

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

Definition at line 159 of file AlCaHcalHBHEMuonProducer.cc.

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

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

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

Referenced by beginRun(), and produce().

1050  {
1051  HcalDetId id(id0);
1052  int ieta = id.ietaAbs();
1053  int zside = id.zside();
1054  int iphi = id.iphi();
1055  std::vector<int> dpths;
1056  if (mergedDepth_) {
1057  std::vector<HcalDetId> ids;
1058  hdc->unmergeDepthDetId(id, ids);
1059  for (auto idh : ids)
1060  dpths.emplace_back(idh.depth());
1061  } else {
1062  dpths.emplace_back(id.depth());
1063  }
1064  double lx(0);
1065  if (id.subdet() == HcalBarrel) {
1066  for (unsigned int i = 0; i < actHB.size(); ++i) {
1067  if ((ieta == actHB[i].ieta) && (zside == actHB[i].zside) &&
1068  (std::find(dpths.begin(), dpths.end(), actHB[i].depth) != dpths.end()) &&
1069  (std::find(actHB[i].iphis.begin(), actHB[i].iphis.end(), iphi) != actHB[i].iphis.end())) {
1070  lx += actHB[i].thick;
1071  }
1072  }
1073  } else {
1074  for (unsigned int i = 0; i < actHE.size(); ++i) {
1075  if ((ieta == actHE[i].ieta) && (zside == actHE[i].zside) &&
1076  (std::find(dpths.begin(), dpths.end(), actHE[i].depth) != dpths.end()) &&
1077  (std::find(actHE[i].iphis.begin(), actHE[i].iphis.end(), iphi) != actHE[i].iphis.end())) {
1078  lx += actHE[i].thick;
1079  }
1080  }
1081  }
1082  return lx;
1083 }
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 981 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_.

981  {
982  const HcalDDDRecConstants* hdc = &iSetup.getData(tok_ddrec0_);
983  actHB.clear();
984  actHE.clear();
985  actHB = hdc->getThickActive(0);
986  actHE = hdc->getThickActive(1);
987 #ifdef EDM_ML_DEBUG
988  unsigned int k1(0), k2(0);
989  edm::LogVerbatim("HBHEMuon") << actHB.size() << " Active Length for HB";
990  for (const auto& act : actHB) {
991  edm::LogVerbatim("HBHEMuon") << "[" << k1 << "] ieta " << act.ieta << " depth " << act.depth << " zside "
992  << act.zside << " type " << act.stype << " phi " << act.iphis.size() << ":"
993  << act.iphis[0] << " L " << act.thick;
994  HcalDetId hcid1(HcalBarrel, (act.ieta) * (act.zside), act.iphis[0], act.depth);
995  HcalDetId hcid2 = mergedDepth_ ? hdc->mergedDepthDetId(hcid1) : hcid1;
996  edm::LogVerbatim("HBHEMuon") << hcid1 << " | " << hcid2 << " L " << activeLength(DetId(hcid2), hdc);
997  ++k1;
998  }
999  edm::LogVerbatim("HBHEMuon") << actHE.size() << " Active Length for HE";
1000  for (const auto& act : actHE) {
1001  edm::LogVerbatim("HBHEMuon") << "[" << k2 << "] ieta " << act.ieta << " depth " << act.depth << " zside "
1002  << act.zside << " type " << act.stype << " phi " << act.iphis.size() << ":"
1003  << act.iphis[0] << " L " << act.thick;
1004  HcalDetId hcid1(HcalEndcap, (act.ieta) * (act.zside), act.iphis[0], act.depth);
1005  HcalDetId hcid2 = mergedDepth_ ? hdc->mergedDepthDetId(hcid1) : hcid1;
1006  edm::LogVerbatim("HBHEMuon") << hcid1 << " | " << hcid2 << " L " << activeLength(DetId(hcid2), hdc);
1007  ++k2;
1008  }
1009 #endif
1010 
1011  bool changed = true;
1012  bool flag = hltConfig_.init(iRun, iSetup, processName_, changed);
1013  edm::LogVerbatim("HBHEMuon") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init " << flag << std::endl;
1014 
1015  const HcalRespCorrs* resp = &iSetup.getData(tok_respcorr0_);
1016  const HcalTopology* theHBHETopology = &iSetup.getData(tok_htopo0_);
1017  const CaloGeometry* geo = &iSetup.getData(tok_geom0_);
1018  HcalRespCorrs respCorrsObj(*resp);
1019  HcalRespCorrs* respCorrs = &respCorrsObj;
1020  respCorrs->setTopo(theHBHETopology);
1021 
1022  // Write correction factors for all HB/HE events
1023  if (writeRespCorr_) {
1024  const HcalGeometry* gHcal = static_cast<const HcalGeometry*>(geo->getSubdetectorGeometry(DetId::Hcal, HcalBarrel));
1025  const std::vector<DetId>& ids = gHcal->getValidDetIds(DetId::Hcal, 0);
1026  edm::LogVerbatim("HBHEMuon") << "\nTable of Correction Factors for Run " << iRun.run() << "\n";
1027  for (auto const& id : ids) {
1028  if ((id.det() == DetId::Hcal) && ((id.subdetId() == HcalBarrel) || (id.subdetId() == HcalEndcap))) {
1029  edm::LogVerbatim("HBHEMuon") << HcalDetId(id) << " " << id.rawId() << " "
1030  << (respCorrs->getValues(id))->getValue();
1031  }
1032  }
1033  }
1034 }
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 1117 of file AlCaHcalHBHEMuonProducer.cc.

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

Referenced by produce().

1117  {
1118  // Transition between HB/HE is special
1119  // For Run 1 or for Plan1 standard reconstruction it is 3
1120  // For runs beyond 2018 or in Plan1 for HEP17 it is 4
1121  int zside = (ieta > 0) ? 1 : -1;
1122  int depth = theHBHETopology->dddConstants()->getMinDepth(1, 16, iphi, zside);
1123  if (isItPlan1_ && (!isItPreRecHit_))
1124  depth = 3;
1125 #ifdef EDM_ML_DEBUG
1126  edm::LogVerbatim("HBHEMuon") << "Plan1 " << isItPlan1_ << " PreRecHit " << isItPreRecHit_ << " phi " << iphi
1127  << " depth " << depth;
1128 #endif
1129  return depth;
1130 }
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:164

◆ endRun()

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

Definition at line 1036 of file AlCaHcalHBHEMuonProducer.cc.

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

1036  {
1037  edm::LogVerbatim("HBHEMuon") << "endRun[" << nRun_ << "] " << iRun.run() << "\n";
1038  ++nRun_;
1039 }
Log< level::Info, true > LogVerbatim

◆ endStream()

void AlCaHcalHBHEMuonProducer::endStream ( )
override

Definition at line 971 of file AlCaHcalHBHEMuonProducer.cc.

References nAll_, and nGood_.

971  {
972  globalCache()->nAll_ += nAll_;
973  globalCache()->nGood_ += nGood_;
974 }

◆ fillDescriptions()

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

Definition at line 948 of file AlCaHcalHBHEMuonProducer.cc.

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

948  {
950  std::vector<std::string> triggers = {"HLT_IsoMu", "HLT_Mu"};
951  desc.add<std::vector<std::string>>("triggers", triggers);
952  desc.add<std::string>("processName", "HLT");
953  desc.add<edm::InputTag>("triggerResults", edm::InputTag("TriggerResults", "", "HLT"));
954  desc.add<edm::InputTag>("labelEBRecHit", edm::InputTag("ecalRecHit", "EcalRecHitsEB"));
955  desc.add<edm::InputTag>("labelEERecHit", edm::InputTag("ecalRecHit", "EcalRecHitsEE"));
956  desc.add<edm::InputTag>("labelHBHERecHit", edm::InputTag("hbhereco"));
957  desc.add<std::string>("labelVertex", "offlinePrimaryVertices");
958  desc.add<std::string>("labelMuon", "muons");
959  desc.add<std::string>("labelHBHEMuon", "hbheMuon");
960  desc.add<bool>("collapseDepth", false);
961  desc.add<bool>("isItPlan1", false);
962  desc.addUntracked<int>("verbosity", 0);
963  desc.addUntracked<bool>("isItPreRecHit", false);
964  desc.addUntracked<bool>("writeRespCorr", false);
965  desc.addUntracked<std::string>("fileInCorr", "");
966  desc.addUntracked<int>("maxDepth", 4);
967  descriptions.add("alcaHcalHBHEMuonProducer", desc);
968 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ gainFactor()

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

Definition at line 1109 of file AlCaHcalHBHEMuonProducer.cc.

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

Referenced by produce().

1109  {
1110  double gain(0.0);
1111  const HcalCalibrations& calibs = conditions->getHcalCalibrations(id);
1112  for (int capid = 0; capid < 4; ++capid)
1113  gain += (0.25 * calibs.respcorrgain(capid));
1114  return gain;
1115 }
constexpr double respcorrgain(int fCapId) const
get response corrected gain for capid=0..3

◆ globalEndJob()

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

Definition at line 976 of file AlCaHcalHBHEMuonProducer.cc.

References submitPVResolutionJobs::count.

976  {
977  edm::LogVerbatim("HBHEMuon") << "Selects " << count->nGood_ << " out of " << count->nAll_ << " total # of events\n";
978 }
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 1132 of file AlCaHcalHBHEMuonProducer.cc.

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

Referenced by produce().

1136  {
1137  std::pair<double, double> rz = hdc->getRZ(hcid);
1138  bool typeRZ = (hcid.subdet() == HcalEndcap) ? false : true;
1139  bool match = spr::propagateHCAL(pTrack, geo, bField, typeRZ, rz, (((verbosity_ / 10000) % 10) > 0));
1140  return match;
1141 }
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<alcaHcalHBHEMuon::Counters> AlCaHcalHBHEMuonProducer::initializeGlobalCache ( edm::ParameterSet const &  )
inlinestatic

Definition at line 84 of file AlCaHcalHBHEMuonProducer.cc.

84  {
85  return std::make_unique<alcaHcalHBHEMuon::Counters>();
86  }

◆ isGoodVertex()

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

Definition at line 1085 of file AlCaHcalHBHEMuonProducer.cc.

References extraflags_cff::vtx.

Referenced by produce().

1085  {
1086  if (vtx.isFake())
1087  return false;
1088  if (vtx.ndof() < 4)
1089  return false;
1090  if (vtx.position().Rho() > 2.)
1091  return false;
1092  if (fabs(vtx.position().Z()) > 24.)
1093  return false;
1094  return true;
1095 }

◆ matchId()

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

Definition at line 1043 of file AlCaHcalHBHEMuonProducer.cc.

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

Referenced by produce().

1043  {
1044  HcalDetId kd1(id1.subdet(), id1.ieta(), id1.iphi(), 1);
1045  HcalDetId kd2(id1.subdet(), id2.ieta(), id2.iphi(), 1);
1046  int match = ((kd1 == kd2) ? 1 : 0);
1047  return match;
1048 }
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 233 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, LEDCalibrationChannels::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, LEDCalibrationChannels::ieta, HcalDetId::ieta(), iEvent, info(), HcalHBHEMuonVariables::innerTrack_, HcalHBHEMuonVariables::innerTrackEta_, HcalHBHEMuonVariables::innerTrackPhi_, HcalHBHEMuonVariables::innerTrackPt_, LEDCalibrationChannels::iphi, HcalDetId::iphi(), isGoodVertex(), isItPlan1_, isItPreRecHit_, muon::isMediumMuon(), HcalHBHEMuonVariables::isolationR03_, HcalHBHEMuonVariables::isolationR04_, muon::isTightMuon(), 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_, PDWG_BPHSkim_cff::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_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_, HcalTopology::validHcal(), verbosity_, and extraflags_cff::vtx.

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

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

Referenced by produce().

1097  {
1098  double cfac(1.0);
1099  if (useMyCorr_) {
1100  auto itr = corrValue_.find(id);
1101  if (itr != corrValue_.end())
1102  cfac = itr->second;
1103  } else if (respCorrs != nullptr) {
1104  cfac = (respCorrs->getValues(id))->getValue();
1105  }
1106  return cfac;
1107 }
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 154 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by activeLength(), and beginRun().

◆ actHE

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

Definition at line 154 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by activeLength(), and beginRun().

◆ all_triggers_

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

Definition at line 151 of file AlCaHcalHBHEMuonProducer.cc.

◆ collapseDepth_

const bool AlCaHcalHBHEMuonProducer::collapseDepth_
private

Definition at line 118 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer(), and produce().

◆ corrValue_

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

Definition at line 155 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer(), and respCorr().

◆ depthMax_

const int AlCaHcalHBHEMuonProducer::depthMax_ = 7
staticprivate

Definition at line 150 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ fileInCorr_

const std::string AlCaHcalHBHEMuonProducer::fileInCorr_
private

Definition at line 121 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer().

◆ hltConfig_

HLTConfigProvider AlCaHcalHBHEMuonProducer::hltConfig_
private

Definition at line 112 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun().

◆ hltresults_

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

Definition at line 152 of file AlCaHcalHBHEMuonProducer.cc.

◆ isItPlan1_

const bool AlCaHcalHBHEMuonProducer::isItPlan1_
private

Definition at line 118 of file AlCaHcalHBHEMuonProducer.cc.

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

◆ isItPreRecHit_

const bool AlCaHcalHBHEMuonProducer::isItPreRecHit_
private

Definition at line 120 of file AlCaHcalHBHEMuonProducer.cc.

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

◆ labelEBRecHit_

const edm::InputTag AlCaHcalHBHEMuonProducer::labelEBRecHit_
private

Definition at line 116 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer().

◆ labelEERecHit_

const edm::InputTag AlCaHcalHBHEMuonProducer::labelEERecHit_
private

Definition at line 116 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer().

◆ labelHBHEMuon_

const std::string AlCaHcalHBHEMuonProducer::labelHBHEMuon_
private

Definition at line 117 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer(), and produce().

◆ labelHBHERecHit_

const edm::InputTag AlCaHcalHBHEMuonProducer::labelHBHERecHit_
private

Definition at line 116 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer().

◆ labelMuon_

const std::string AlCaHcalHBHEMuonProducer::labelMuon_
private

Definition at line 117 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer().

◆ labelVtx_

const std::string AlCaHcalHBHEMuonProducer::labelVtx_
private

Definition at line 117 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer().

◆ maxDepth_

const int AlCaHcalHBHEMuonProducer::maxDepth_
private

Definition at line 122 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ mergedDepth_

const bool AlCaHcalHBHEMuonProducer::mergedDepth_
private

Definition at line 123 of file AlCaHcalHBHEMuonProducer.cc.

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

◆ nAll_

int AlCaHcalHBHEMuonProducer::nAll_
private

Definition at line 126 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by endStream(), and produce().

◆ nGood_

int AlCaHcalHBHEMuonProducer::nGood_
private

Definition at line 126 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by endStream(), and produce().

◆ nRun_

int AlCaHcalHBHEMuonProducer::nRun_
private

Definition at line 126 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun(), and endRun().

◆ processName_

const std::string AlCaHcalHBHEMuonProducer::processName_
private

Definition at line 114 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun().

◆ tok_chan_

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

Definition at line 144 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_dbservice_

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

Definition at line 147 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_ddrec0_

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

Definition at line 135 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun().

◆ tok_ddrec1_

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

Definition at line 136 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_EB_

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

Definition at line 130 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_EE_

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

Definition at line 131 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_geom0_

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

Definition at line 139 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun().

◆ tok_geom1_

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

Definition at line 140 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_HBHE_

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

Definition at line 132 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_htopo0_

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

Definition at line 141 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun().

◆ tok_htopo1_

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

Definition at line 142 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_magField_

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

Definition at line 143 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_Muon_

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

Definition at line 133 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_respcorr0_

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

Definition at line 137 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun().

◆ tok_respcorr1_

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

Definition at line 138 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_sevlv_

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

Definition at line 145 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_topo_

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

Definition at line 146 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_trigRes_

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

Definition at line 128 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ tok_Vtx_

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

Definition at line 129 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ triggerResults_

const edm::InputTag AlCaHcalHBHEMuonProducer::triggerResults_
private

Definition at line 115 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer().

◆ trigNames_

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

Definition at line 113 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

◆ useMyCorr_

bool AlCaHcalHBHEMuonProducer::useMyCorr_
private

Definition at line 125 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer(), and respCorr().

◆ verbosity_

const int AlCaHcalHBHEMuonProducer::verbosity_
private

Definition at line 119 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by goodCell(), and produce().

◆ writeRespCorr_

const bool AlCaHcalHBHEMuonProducer::writeRespCorr_
private

Definition at line 120 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun().