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::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< 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 79 of file AlCaHcalHBHEMuonProducer.cc.

Constructor & Destructor Documentation

◆ AlCaHcalHBHEMuonProducer()

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

Definition at line 159 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_.

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

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

Referenced by beginRun(), and produce().

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

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

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

Referenced by produce().

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

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

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

◆ endStream()

void AlCaHcalHBHEMuonProducer::endStream ( )
override

Definition at line 972 of file AlCaHcalHBHEMuonProducer.cc.

References nAll_, and nGood_.

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

◆ fillDescriptions()

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

Definition at line 949 of file AlCaHcalHBHEMuonProducer.cc.

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

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

◆ gainFactor()

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

Definition at line 1110 of file AlCaHcalHBHEMuonProducer.cc.

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

Referenced by produce().

1110  {
1111  double gain(0.0);
1112  const HcalCalibrations& calibs = conditions->getHcalCalibrations(id);
1113  for (int capid = 0; capid < 4; ++capid)
1114  gain += (0.25 * calibs.respcorrgain(capid));
1115  return gain;
1116 }
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 977 of file AlCaHcalHBHEMuonProducer.cc.

References submitPVResolutionJobs::count.

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

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

Referenced by produce().

1137  {
1138  std::pair<double, double> rz = hdc->getRZ(hcid);
1139  bool typeRZ = (hcid.subdet() == HcalEndcap) ? false : true;
1140  bool match = spr::propagateHCAL(pTrack, geo, bField, typeRZ, rz, (((verbosity_ / 10000) % 10) > 0));
1141  return match;
1142 }
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 84 of file AlCaHcalHBHEMuonProducer.cc.

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

◆ isGoodVertex()

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

Definition at line 1086 of file AlCaHcalHBHEMuonProducer.cc.

References extraflags_cff::vtx.

Referenced by produce().

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

◆ matchId()

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

Definition at line 1044 of file AlCaHcalHBHEMuonProducer.cc.

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

Referenced by produce().

1044  {
1045  HcalDetId kd1(id1.subdet(), id1.ieta(), id1.iphi(), 1);
1046  HcalDetId kd2(id1.subdet(), id2.ieta(), id2.iphi(), 1);
1047  int match = ((kd1 == kd2) ? 1 : 0);
1048  return match;
1049 }
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 234 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.

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

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

Referenced by produce().

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