CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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::Counters
initializeGlobalCache (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::HcalActiveLength
actHB
 
std::vector
< HcalDDDRecConstants::HcalActiveLength
actHE
 
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,
EcalChannelStatusRcd
tok_chan_
 
const edm::ESGetToken
< HcalDbService, HcalDbRecord
tok_dbservice_
 
const edm::ESGetToken
< HcalDDDRecConstants,
HcalRecNumberingRecord
tok_ddrec0_
 
const edm::ESGetToken
< HcalDDDRecConstants,
HcalRecNumberingRecord
tok_ddrec1_
 
const edm::EDGetTokenT
< EcalRecHitCollection
tok_EB_
 
const edm::EDGetTokenT
< EcalRecHitCollection
tok_EE_
 
const edm::ESGetToken
< CaloGeometry,
CaloGeometryRecord
tok_geom0_
 
const edm::ESGetToken
< CaloGeometry,
CaloGeometryRecord
tok_geom1_
 
const edm::EDGetTokenT
< HBHERecHitCollection
tok_HBHE_
 
const edm::ESGetToken
< HcalTopology,
HcalRecNumberingRecord
tok_htopo0_
 
const edm::ESGetToken
< HcalTopology,
HcalRecNumberingRecord
tok_htopo1_
 
const edm::ESGetToken
< MagneticField,
IdealMagneticFieldRecord
tok_magField_
 
const edm::EDGetTokenT
< reco::MuonCollection
tok_Muon_
 
const edm::ESGetToken
< HcalRespCorrs,
HcalRespCorrsRcd
tok_respcorr0_
 
const edm::ESGetToken
< HcalRespCorrs,
HcalRespCorrsRcd
tok_respcorr1_
 
const edm::ESGetToken
< EcalSeverityLevelAlgo,
EcalSeverityLevelAlgoRcd
tok_sevlv_
 
const edm::ESGetToken
< CaloTopology,
CaloTopologyRecord
tok_topo_
 
const edm::EDGetTokenT
< edm::TriggerResults
tok_trigRes_
 
const edm::EDGetTokenT
< reco::VertexCollection
tok_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 ( const edm::ParameterSet iConfig,
const alcaHcalHBHEMuon::Counters  
)
explicit

Definition at line 159 of file AlCaHcalHBHEMuonProducer.cc.

References collapseDepth_, corrValue_, fileInCorr_, gpuClustering::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 getUntrackedParameter(std::string const &, T const &) const
const edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tok_magField_
uint16_t *__restrict__ id
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_
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_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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 ( )
overridedefault

Member Function Documentation

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

Definition at line 1048 of file AlCaHcalHBHEMuonProducer.cc.

References actHB, actHE, HLT_FULL_cff::depth, spr::find(), HcalBarrel, mps_fire::i, gpuClustering::id, mergedDepth_, HcalDDDRecConstants::unmergeDepthDetId(), and ecaldqm::zside().

Referenced by beginRun(), and produce().

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

Definition at line 980 of file AlCaHcalHBHEMuonProducer.cc.

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

980  {
981  const HcalDDDRecConstants* hdc = &iSetup.getData(tok_ddrec0_);
982  actHB.clear();
983  actHE.clear();
984  actHB = hdc->getThickActive(0);
985  actHE = hdc->getThickActive(1);
986 #ifdef EDM_ML_DEBUG
987  unsigned int k1(0), k2(0);
988  edm::LogVerbatim("HBHEMuon") << actHB.size() << " Active Length for HB";
989  for (const auto& act : actHB) {
990  edm::LogVerbatim("HBHEMuon") << "[" << k1 << "] ieta " << act.ieta << " depth " << act.depth << " zside "
991  << act.zside << " type " << act.stype << " phi " << act.iphis.size() << ":"
992  << act.iphis[0] << " L " << act.thick;
993  HcalDetId hcid1(HcalBarrel, (act.ieta) * (act.zside), act.iphis[0], act.depth);
994  HcalDetId hcid2 = mergedDepth_ ? hdc->mergedDepthDetId(hcid1) : hcid1;
995  edm::LogVerbatim("HBHEMuon") << hcid1 << " | " << hcid2 << " L " << activeLength(DetId(hcid2), hdc);
996  ++k1;
997  }
998  edm::LogVerbatim("HBHEMuon") << actHE.size() << " Active Length for HE";
999  for (const auto& act : actHE) {
1000  edm::LogVerbatim("HBHEMuon") << "[" << k2 << "] ieta " << act.ieta << " depth " << act.depth << " zside "
1001  << act.zside << " type " << act.stype << " phi " << act.iphis.size() << ":"
1002  << act.iphis[0] << " L " << act.thick;
1003  HcalDetId hcid1(HcalEndcap, (act.ieta) * (act.zside), act.iphis[0], act.depth);
1004  HcalDetId hcid2 = mergedDepth_ ? hdc->mergedDepthDetId(hcid1) : hcid1;
1005  edm::LogVerbatim("HBHEMuon") << hcid1 << " | " << hcid2 << " L " << activeLength(DetId(hcid2), hdc);
1006  ++k2;
1007  }
1008 #endif
1009 
1010  bool changed = true;
1011  bool flag = hltConfig_.init(iRun, iSetup, processName_, changed);
1012  edm::LogVerbatim("HBHEMuon") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init " << flag << std::endl;
1013 
1014  const HcalRespCorrs* resp = &iSetup.getData(tok_respcorr0_);
1015  const HcalTopology* theHBHETopology = &iSetup.getData(tok_htopo0_);
1016  const CaloGeometry* geo = &iSetup.getData(tok_geom0_);
1017  HcalRespCorrs* respCorrs = new HcalRespCorrs(*resp);
1018  respCorrs->setTopo(theHBHETopology);
1019 
1020  // Write correction factors for all HB/HE events
1021  if (writeRespCorr_) {
1022  const HcalGeometry* gHcal = static_cast<const HcalGeometry*>(geo->getSubdetectorGeometry(DetId::Hcal, HcalBarrel));
1023  const std::vector<DetId>& ids = gHcal->getValidDetIds(DetId::Hcal, 0);
1024  edm::LogVerbatim("HBHEMuon") << "\nTable of Correction Factors for Run " << iRun.run() << "\n";
1025  for (auto const& id : ids) {
1026  if ((id.det() == DetId::Hcal) && ((id.subdetId() == HcalBarrel) || (id.subdetId() == HcalEndcap))) {
1027  edm::LogVerbatim("HBHEMuon") << HcalDetId(id) << " " << id.rawId() << " "
1028  << (respCorrs->getValues(id))->getValue();
1029  }
1030  }
1031  }
1032 }
Log< level::Info, true > LogVerbatim
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
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_
const edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > tok_htopo0_
HcalDetId mergedDepthDetId(const HcalDetId &id) const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const Item * getValues(DetId fId, bool throwOnFail=true) const
std::vector< HcalDDDRecConstants::HcalActiveLength > actHE
double activeLength(const DetId &, const HcalDDDRecConstants *hdc)
Definition: DetId.h:17
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_
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
std::vector< HcalActiveLength > getThickActive(const int &type) const
std::vector< HcalDDDRecConstants::HcalActiveLength > actHB
void setTopo(const HcalTopology *topo)
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_ddrec0_
int AlCaHcalHBHEMuonProducer::depth16HE ( int  ieta,
int  iphi,
const HcalTopology theHBHETopology 
)
private

Definition at line 1115 of file AlCaHcalHBHEMuonProducer.cc.

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

Referenced by produce().

1115  {
1116  // Transition between HB/HE is special
1117  // For Run 1 or for Plan1 standard reconstruction it is 3
1118  // For runs beyond 2018 or in Plan1 for HEP17 it is 4
1119  int zside = (ieta > 0) ? 1 : -1;
1120  int depth = theHBHETopology->dddConstants()->getMinDepth(1, 16, iphi, zside);
1121  if (isItPlan1_ && (!isItPreRecHit_))
1122  depth = 3;
1123 #ifdef EDM_ML_DEBUG
1124  edm::LogVerbatim("HBHEMuon") << "Plan1 " << isItPlan1_ << " PreRecHit " << isItPreRecHit_ << " phi " << iphi
1125  << " depth " << depth;
1126 #endif
1127  return depth;
1128 }
Log< level::Info, true > LogVerbatim
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:164
int zside(DetId const &)
int getMinDepth(const int &itype, const int &ieta, const int &iphi, const int &zside) const
void AlCaHcalHBHEMuonProducer::endRun ( edm::Run const &  iRun,
edm::EventSetup const &   
)
overrideprivate

Definition at line 1034 of file AlCaHcalHBHEMuonProducer.cc.

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

1034  {
1035  edm::LogVerbatim("HBHEMuon") << "endRun[" << nRun_ << "] " << iRun.run() << "\n";
1036  ++nRun_;
1037 }
Log< level::Info, true > LogVerbatim
void AlCaHcalHBHEMuonProducer::endStream ( )
override

Definition at line 970 of file AlCaHcalHBHEMuonProducer.cc.

References nAll_, and nGood_.

970  {
971  globalCache()->nAll_ += nAll_;
972  globalCache()->nGood_ += nGood_;
973 }
void AlCaHcalHBHEMuonProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 947 of file AlCaHcalHBHEMuonProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), submitPVResolutionJobs::desc, HLT_FULL_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 1107 of file AlCaHcalHBHEMuonProducer.cc.

References HcalDbService::getHcalCalibrations(), and HcalCalibrations::respcorrgain().

Referenced by produce().

1107  {
1108  double gain(0.0);
1109  const HcalCalibrations& calibs = conditions->getHcalCalibrations(id);
1110  for (int capid = 0; capid < 4; ++capid)
1111  gain += (0.25 * calibs.respcorrgain(capid));
1112  return gain;
1113 }
constexpr double respcorrgain(int fCapId) const
get response corrected gain for capid=0..3
void AlCaHcalHBHEMuonProducer::globalEndJob ( const alcaHcalHBHEMuon::Counters counters)
static

Definition at line 975 of file AlCaHcalHBHEMuonProducer.cc.

References alcaHcalHBHEMuon::Counters::nAll_, and alcaHcalHBHEMuon::Counters::nGood_.

975  {
976  edm::LogVerbatim("HBHEMuon") << "Selects " << count->nGood_ << " out of " << count->nAll_ << " total # of events\n";
977 }
Log< level::Info, true > LogVerbatim
bool AlCaHcalHBHEMuonProducer::goodCell ( const HcalDetId hcid,
const reco::Track pTrack,
const CaloGeometry geo,
const MagneticField bField,
const HcalDDDRecConstants hdc 
)
private

Definition at line 1130 of file AlCaHcalHBHEMuonProducer.cc.

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

Referenced by produce().

1134  {
1135  std::pair<double, double> rz = hdc->getRZ(hcid);
1136  bool typeRZ = (hcid.subdet() == HcalEndcap) ? false : true;
1137  bool match = spr::propagateHCAL(pTrack, geo, bField, typeRZ, rz, (((verbosity_ / 10000) % 10) > 0));
1138  return match;
1139 }
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
double getRZ(const int &subdet, const int &ieta, const int &depth) const
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
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  }
bool AlCaHcalHBHEMuonProducer::isGoodVertex ( const reco::Vertex vtx)
private

Definition at line 1083 of file AlCaHcalHBHEMuonProducer.cc.

References reco::Vertex::isFake(), reco::Vertex::ndof(), and reco::Vertex::position().

Referenced by produce().

1083  {
1084  if (vtx.isFake())
1085  return false;
1086  if (vtx.ndof() < 4)
1087  return false;
1088  if (vtx.position().Rho() > 2.)
1089  return false;
1090  if (fabs(vtx.position().Z()) > 24.)
1091  return false;
1092  return true;
1093 }
const Point & position() const
position
Definition: Vertex.h:127
double ndof() const
Definition: Vertex.h:123
bool isFake() const
Definition: Vertex.h:76
int AlCaHcalHBHEMuonProducer::matchId ( const HcalDetId id1,
const HcalDetId id2 
)
private

Definition at line 1041 of file AlCaHcalHBHEMuonProducer.cc.

References HcalDetId::ieta(), HcalDetId::iphi(), match(), and HcalDetId::subdet().

Referenced by produce().

1041  {
1042  HcalDetId kd1(id1.subdet(), id1.ieta(), id1.iphi(), 1);
1043  HcalDetId kd2(id1.subdet(), id2.ieta(), id2.iphi(), 1);
1044  int match = ((kd1 == kd2) ? 1 : 0);
1045  return match;
1046 }
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
void AlCaHcalHBHEMuonProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 233 of file AlCaHcalHBHEMuonProducer.cc.

References funct::abs(), activeLength(), ecalTB2006H4_GenSimDigiReco_cfg::bField, edm::EventBase::bunchCrossing(), HcalHBHEMuonVariables::bxNumber_, trackerTree::check(), chg, HcalHBHEMuonVariables::chiGlobal_, HcalHBHEMuonVariables::chiTracker_, collapseDepth_, submitPVValidationJobs::conditions, alignCSCRings::corr, HcalDetId::depth(), HLT_FULL_cff::depth, depth16HE(), depthMax_, spr::propagatedTrackID::detIdECAL, spr::propagatedTrackID::detIdEHCAL, spr::propagatedTrackID::detIdHCAL, HcalHBHEMuonVariables::dxyTracker_, HcalHBHEMuonVariables::dzTracker_, HcalHBHEMuonVariables::ecal3x3Energy_, HcalHBHEMuonVariables::ecalDetId_, HcalHBHEMuonVariables::ecalEnergy_, spr::eECALmatrix(), HcalHBHEMuonVariables::ehcalDetId_, spr::eHCALmatrix(), spr::energyHCALCell(), HcalHBHEMuonVariables::energyMuon_, HcalHBHEMuonVariables::etaGlob_, edm::EventID::event(), HcalHBHEMuonVariables::eventNumber_, spr::find(), gainFactor(), edm::EventSetup::getData(), edm::Event::getHandle(), HcalHBHEMuonVariables::globalMuonHits_, HcalHBHEMuonVariables::globalTrack_, HcalHBHEMuonVariables::globalTrackEta_, HcalHBHEMuonVariables::globalTrackPhi_, HcalHBHEMuonVariables::globalTrackPt_, goodCell(), HcalHBHEMuonVariables::goodVertex_, 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, edm::EventBase::id(), HcalDetId::ieta(), info(), HcalHBHEMuonVariables::innerTrack_, HcalHBHEMuonVariables::innerTrackEta_, HcalHBHEMuonVariables::innerTrackPhi_, HcalHBHEMuonVariables::innerTrackPt_, HcalDetId::iphi(), isGoodVertex(), isItPlan1_, isItPreRecHit_, muon::isMediumMuon(), HcalHBHEMuonVariables::isolationR03_, HcalHBHEMuonVariables::isolationR04_, muon::isTightMuon(), isotrackApplyRegressor::k, labelHBHEMuon_, edm::EventID::luminosityBlock(), HcalHBHEMuonVariables::lumiNumber_, HcalHBHEMuonVariables::matchedId_, HcalHBHEMuonVariables::matchedStat_, matchId(), SiStripPI::max, maxDepth_, HcalDDDRecConstants::mergedDepthDetId(), TrackingSourceConfig_Tier0_Cosmic_cff::modules, eostools::move(), HcalHBHEMuonVariables::muonChi2LocalPosition_, HcalHBHEMuonVariables::muonGlobal_, HcalHBHEMuonVariables::muonGood_, HcalHBHEMuonVariables::muonMedium_, patZpeak::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_, edm::Event::put(), DetId::rawId(), respCorr(), edm::EventID::run(), 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_, edm::TriggerNames::triggerNames(), L1TMuonDQMOffline_cfi::triggerNames, edm::Event::triggerNames(), triggerResults, trigNames_, HcalTopology::validHcal(), and verbosity_.

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

Definition at line 1095 of file AlCaHcalHBHEMuonProducer.cc.

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

Referenced by produce().

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

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

Definition at line 154 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by activeLength(), and beginRun().

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

Definition at line 154 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by activeLength(), and beginRun().

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

Definition at line 151 of file AlCaHcalHBHEMuonProducer.cc.

const bool AlCaHcalHBHEMuonProducer::collapseDepth_
private

Definition at line 118 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer(), and produce().

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

Definition at line 155 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer(), and respCorr().

const int AlCaHcalHBHEMuonProducer::depthMax_ = 7
staticprivate

Definition at line 150 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

const std::string AlCaHcalHBHEMuonProducer::fileInCorr_
private

Definition at line 121 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer().

HLTConfigProvider AlCaHcalHBHEMuonProducer::hltConfig_
private

Definition at line 112 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun().

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

Definition at line 152 of file AlCaHcalHBHEMuonProducer.cc.

const bool AlCaHcalHBHEMuonProducer::isItPlan1_
private

Definition at line 118 of file AlCaHcalHBHEMuonProducer.cc.

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

const bool AlCaHcalHBHEMuonProducer::isItPreRecHit_
private

Definition at line 120 of file AlCaHcalHBHEMuonProducer.cc.

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

const edm::InputTag AlCaHcalHBHEMuonProducer::labelEBRecHit_
private

Definition at line 116 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer().

const edm::InputTag AlCaHcalHBHEMuonProducer::labelEERecHit_
private

Definition at line 116 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer().

const std::string AlCaHcalHBHEMuonProducer::labelHBHEMuon_
private

Definition at line 117 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer(), and produce().

const edm::InputTag AlCaHcalHBHEMuonProducer::labelHBHERecHit_
private

Definition at line 116 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer().

const std::string AlCaHcalHBHEMuonProducer::labelMuon_
private

Definition at line 117 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer().

const std::string AlCaHcalHBHEMuonProducer::labelVtx_
private

Definition at line 117 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer().

const int AlCaHcalHBHEMuonProducer::maxDepth_
private

Definition at line 122 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

const bool AlCaHcalHBHEMuonProducer::mergedDepth_
private

Definition at line 123 of file AlCaHcalHBHEMuonProducer.cc.

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

int AlCaHcalHBHEMuonProducer::nAll_
private

Definition at line 126 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by endStream(), and produce().

int AlCaHcalHBHEMuonProducer::nGood_
private

Definition at line 126 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by endStream(), and produce().

int AlCaHcalHBHEMuonProducer::nRun_
private

Definition at line 126 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun(), and endRun().

const std::string AlCaHcalHBHEMuonProducer::processName_
private

Definition at line 114 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun().

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

Definition at line 144 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

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

Definition at line 147 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

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

Definition at line 135 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun().

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

Definition at line 136 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

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

Definition at line 130 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

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

Definition at line 131 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

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

Definition at line 139 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun().

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

Definition at line 140 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

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

Definition at line 132 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

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

Definition at line 141 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun().

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

Definition at line 142 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

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

Definition at line 143 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

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

Definition at line 133 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

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

Definition at line 137 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun().

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

Definition at line 138 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

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

Definition at line 145 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

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

Definition at line 146 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

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

Definition at line 128 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

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

Definition at line 129 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

const edm::InputTag AlCaHcalHBHEMuonProducer::triggerResults_
private

Definition at line 115 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer().

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

Definition at line 113 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by produce().

bool AlCaHcalHBHEMuonProducer::useMyCorr_
private

Definition at line 125 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by AlCaHcalHBHEMuonProducer(), and respCorr().

const int AlCaHcalHBHEMuonProducer::verbosity_
private

Definition at line 119 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by goodCell(), and produce().

const bool AlCaHcalHBHEMuonProducer::writeRespCorr_
private

Definition at line 120 of file AlCaHcalHBHEMuonProducer.cc.

Referenced by beginRun().