169 std::vector<HcalDDDRecConstants::HcalActiveLength>
actHB,
actHE;
175 : labelEBRecHit_(iConfig.getParameter<
edm::
InputTag>(
"labelEBRecHit")),
176 labelEERecHit_(iConfig.getParameter<
edm::
InputTag>(
"labelEERecHit")),
177 labelHBHERecHit_(iConfig.getParameter<
edm::
InputTag>(
"labelHBHERecHit")),
178 labelVtx_(iConfig.getParameter<
std::
string>(
"labelVertex")),
179 labelMuon_(iConfig.getParameter<
std::
string>(
"labelMuon")),
180 labelGenTrack_(iConfig.getParameter<
std::
string>(
"labelTrack")),
181 etaMin_(iConfig.getParameter<double>(
"etaMin")),
182 emaxNearPThr_(iConfig.getParameter<double>(
"emaxNearPThreshold")),
183 analyzeMuon_(iConfig.getParameter<
bool>(
"analyzeMuon")),
184 unCorrect_(iConfig.getParameter<
bool>(
"unCorrect")),
185 collapseDepth_(iConfig.getParameter<
bool>(
"collapseDepth")),
186 isItPlan1_(iConfig.getParameter<
bool>(
"isItPlan1")),
187 getCharge_(iConfig.getParameter<
bool>(
"getCharge")),
188 useRaw_(iConfig.getParameter<
int>(
"useRaw")),
189 verbosity_(iConfig.getParameter<
int>(
"verbosity")),
190 theTrackQuality_(iConfig.getUntrackedParameter<
std::
string>(
"trackQuality")),
191 fileInCorr_(iConfig.getUntrackedParameter<
std::
string>(
"fileInCorr",
"")),
192 ignoreHECorr_(iConfig.getUntrackedParameter<
bool>(
"ignoreHECorr",
false)),
193 isItPreRecHit_(iConfig.getUntrackedParameter<
bool>(
"isItPreRecHit",
false)),
194 writeRespCorr_(iConfig.getUntrackedParameter<
bool>(
"writeRespCorr",
false)),
195 maxDepth_(iConfig.getUntrackedParameter<
int>(
"maxDepth", 7)),
212 theHBHETopology_(nullptr),
268 desc.add<
double>(
"etaMin", 2.0);
269 desc.add<
double>(
"emaxNearPThreshold", 10.0);
270 desc.add<
bool>(
"analyzeMuon",
true);
271 desc.add<
bool>(
"unCorrect",
true);
272 desc.add<
bool>(
"collapseDepth",
false);
273 desc.add<
bool>(
"isItPlan1",
false);
274 desc.add<
bool>(
"getCharge",
true);
275 desc.add<
int>(
"useRaw", 0);
276 desc.add<
int>(
"verbosity", 0);
279 desc.addUntracked<
double>(
"minTrackPt", 1.0);
280 desc.addUntracked<
double>(
"maxDxyPV", 0.02);
281 desc.addUntracked<
double>(
"maxDzPV", 100.0);
282 desc.addUntracked<
double>(
"maxChi2", 5.0);
283 desc.addUntracked<
double>(
"maxDpOverP", 0.1);
284 desc.addUntracked<
bool>(
"ignoreHECorr",
false);
285 desc.addUntracked<
bool>(
"isItPreRecHit",
false);
286 desc.addUntracked<
bool>(
"writeRespCorr",
false);
287 desc.addUntracked<
int>(
"maxDepth", 7);
288 descriptions.
add(
"hcalHBHEMuonHighEta",
desc);
294 tree_ =
fs->make<TTree>(
"HBHEMuonHighEta",
"HBHEMuonHighEta");
323 sprintf(
name,
"hcal_edepth%d", (
k + 1));
325 sprintf(
name,
"hcal_activeL%d", (
k + 1));
327 sprintf(
name,
"hcal_edepthHot%d", (
k + 1));
329 sprintf(
name,
"hcal_activeHotL%d", (
k + 1));
331 sprintf(
name,
"hcal_cdepthHot%d", (
k + 1));
333 sprintf(
name,
"hcal_cdepthHotBG%d", (
k + 1));
335 sprintf(
name,
"hcal_edepthCorrect%d", (
k + 1));
337 sprintf(
name,
"hcal_edepthHotCorrect%d", (
k + 1));
339 sprintf(
name,
"hcal_depthMatch%d", (
k + 1));
341 sprintf(
name,
"hcal_depthMatchHot%d", (
k + 1));
380 if (!
vtx.isValid()) {
387 reco::VertexCollection::const_iterator firstGoodVertex =
vtx->end();
388 for (reco::VertexCollection::const_iterator
it =
vtx->begin();
it !=
vtx->end();
it++) {
390 if (firstGoodVertex ==
vtx->end())
391 firstGoodVertex =
it;
395 if (firstGoodVertex !=
vtx->end())
396 pvx = firstGoodVertex->position();
428 <<
" Energy|Length|EnergyHot|LengthHot|Charge|ChargeBG|EnergyCorr|EnergyHotCorr|Match|MatchHot:" 449 unsigned int k1(0), k2(0);
451 for (
const auto& act :
actHB) {
452 edm::LogVerbatim(
"HBHEMuon") <<
"[" << k1 <<
"] ieta " << act.ieta <<
" depth " << act.depth <<
" zside " 453 << act.zside <<
" type " << act.stype <<
" phi " << act.iphis.size() <<
":" 454 << act.iphis[0] <<
" L " << act.thick;
461 for (
const auto& act :
actHE) {
462 edm::LogVerbatim(
"HBHEMuon") <<
"[" << k2 <<
"] ieta " << act.ieta <<
" depth " << act.depth <<
" zside " 463 << act.zside <<
" type " << act.stype <<
" phi " << act.iphis.size() <<
":" 464 << act.iphis[0] <<
" L " << act.thick;
483 edm::LogVerbatim(
"HBHEMuon") <<
"\nTable of Correction Factors for Run " << iRun.
run() <<
"\n";
484 for (
auto const&
id : ids) {
499 std::vector<spr::propagatedTrackID> trkCaloDets;
500 for (
const auto& RecMuon : (*(_Muon.
product()))) {
501 if (RecMuon.innerTrack().isNonnull()) {
502 const reco::Track* pTrack = (RecMuon.innerTrack()).
get();
506 ptGlob_.emplace_back(RecMuon.pt());
507 etaGlob_.emplace_back(RecMuon.eta());
508 phiGlob_.emplace_back(RecMuon.phi());
510 pMuon_.emplace_back(RecMuon.p());
511 bool mediumMuon = (((RecMuon.isPFMuon()) && (RecMuon.isGlobalMuon() || RecMuon.isTrackerMuon())) &&
512 (RecMuon.innerTrack()->validFraction() > 0.49));
514 double chiGlobal = ((RecMuon.globalTrack().isNonnull()) ? RecMuon.globalTrack()->normalizedChi2() : 999);
516 (RecMuon.isGlobalMuon() && chiGlobal < 3 && RecMuon.combinedQuality().chi2LocalPosition < 12 &&
517 RecMuon.combinedQuality().trkKink < 20);
522 ((RecMuon.pfIsolationR03().sumChargedHadronPt +
524 RecMuon.pfIsolationR03().sumNeutralHadronEt + RecMuon.pfIsolationR03().sumPhotonEt -
525 (0.5 * RecMuon.pfIsolationR03().sumPUPt))) /
528 ((RecMuon.pfIsolationR04().sumChargedHadronPt +
530 RecMuon.pfIsolationR04().sumNeutralHadronEt + RecMuon.pfIsolationR04().sumPhotonEt -
531 (0.5 * RecMuon.pfIsolationR04().sumPUPt))) /
536 ecalEnergy_.emplace_back(RecMuon.calEnergy().emS9);
537 hcalEnergy_.emplace_back(RecMuon.calEnergy().hadS9);
538 hoEnergy_.emplace_back(RecMuon.calEnergy().hoS9);
561 if (!trkCollection.
isValid()) {
562 std::vector<spr::propagatedTrackID> trkCaloDets;
565 std::vector<spr::propagatedTrackID>::const_iterator trkDetItr;
566 for (trkDetItr = trkCaloDets.begin(),
nTrack = 0; trkDetItr != trkCaloDets.end(); trkDetItr++,
nTrack++) {
567 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
579 std::vector<spr::propagatedTrackID>& trkCaloDets,
589 double eEcal(0), eHcal(0), activeLengthTot(0), activeLengthHotTot(0);
596 unsigned int isHot(0);
597 bool tmpmatch(
false);
600 eHcalDepth[
i] = eHcalDepthHot[
i] = 0;
601 eHcalDepthC[
i] = eHcalDepthHotC[
i] = 0;
602 cHcalDepthHot[
i] = cHcalDepthHotBG[
i] = 0;
603 activeL[
i] = activeHotL[
i] = 0;
604 matchDepth[
i] = matchDepthHot[
i] =
true;
630 edm::LogVerbatim(
"HBHEMuon") <<
"Propagate Track to ECAL: " << e3x3.second <<
":" << trackID.
okECAL <<
" E " 636 if ((hcidt.ieta() ==
check.ieta()) && (hcidt.iphi() ==
check.iphi()))
663 std::vector<std::pair<double, int>> ehdepth;
679 for (
unsigned int i = 0;
i < ehdepth.size(); ++
i) {
684 double ene = ehdepth[
i].first;
688 edm::LogWarning(
"HBHEMuon") <<
"(1) Invalid ID " << hcid0 <<
" with E = " << ene;
690 for (
const auto& ehd : ehdepth)
706 int depth = ehdepth[
i].second - 1;
709 depth =
id.depth() - 1;
711 eHcalDepth[
depth] += ene;
712 eHcalDepthC[
depth] += enec;
713 activeL[
depth] += actL;
714 activeLengthTot += actL;
715 matchDepth[
depth] = (matchDepth[
depth] && tmpC);
719 << hcid0 <<
" E " << ene <<
":" << enec <<
" L " << actL <<
" Match " << tmpC;
726 edm::LogVerbatim(
"HBHEMuon") << hcidt <<
" Match " << tmpmatch <<
" Depths " << ehdepth.size();
727 for (
unsigned int k = 0;
k < ehdepth.size(); ++
k)
728 edm::LogVerbatim(
"HBHEMuon") <<
" [" <<
k <<
":" << ehdepth[
k].second <<
"] " << matchDepth[
k];
733 isHot =
matchId(closestCell, hotCell);
739 std::vector<std::pair<double, int>> ehdepth;
755 for (
unsigned int i = 0;
i < ehdepth.size(); ++
i) {
760 double ene = ehdepth[
i].first;
764 edm::LogWarning(
"HBHEMuon") <<
"(2) Invalid ID " << hcid0 <<
" with E = " << ene;
766 for (
const auto& ehd : ehdepth)
770 double chg(ene), enec(ene);
779 << hcid0 <<
":" <<
id <<
" Corr " <<
corr <<
" E " << ene <<
":" << enec;
792 int depth = ehdepth[
i].second - 1;
795 depth =
id.depth() - 1;
797 eHcalDepthHot[
depth] += ene;
798 eHcalDepthHotC[
depth] += enec;
800 activeHotL[
depth] += actL;
801 activeLengthHotTot += actL;
802 matchDepthHot[
depth] = (matchDepthHot[
depth] && tmpC);
806 <<
chg <<
" L " << actL <<
" Match " << tmpC;
814 <<
" Hot " << isHot <<
" Energy " << eHcal;
921 int match = ((kd1 == kd2) ? 1 : 0);
927 int ieta =
id.ietaAbs();
928 int zside =
id.zside();
929 int iphi =
id.iphi();
930 std::vector<int> dpths;
932 std::vector<HcalDetId> ids;
935 dpths.emplace_back(idh.depth());
937 dpths.emplace_back(
id.
depth());
941 for (
unsigned int i = 0;
i <
actHB.size(); ++
i) {
943 (
std::find(dpths.begin(), dpths.end(),
actHB[
i].depth) != dpths.end()) &&
949 for (
unsigned int i = 0;
i <
actHE.size(); ++
i) {
951 (
std::find(dpths.begin(), dpths.end(),
actHE[
i].depth) != dpths.end()) &&
965 if (
vtx.position().Rho() > 2.)
967 if (fabs(
vtx.position().Z()) > 24.)
987 for (
int capid = 0; capid < 4; ++capid)
1003 <<
" depth " <<
depth;
1012 std::pair<double, double> rz =
hdc_->
getRZ(hcid);
std::vector< int > trackOuterHit_
int getMinDepth(const int &itype, const int &ieta, const int &iphi, const int &zside) const
int matchId(const HcalDetId &, const HcalDetId &)
static const std::string kSharedResource
double respCorr(const DetId &)
const std::string labelMuon_
Log< level::Info, true > LogVerbatim
std::vector< double > energyMuon_
double getRZ(const int &subdet, const int &ieta, const int &depth) const
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, const std::string &theTrackQuality, bool debug=false)
const edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
unsigned int eventNumber_
const double emaxNearPThr_
std::vector< int > trackMissedInnerHits_
const EcalChannelStatus * theEcalChStatus_
std::vector< double > hcalActiveLengthHot_
spr::trackSelectionParameters selectionParameter_
edm::Handle< HBHERecHitCollection > hbhe_
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)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
std::vector< double > hoEnergy_
HcalDetId mergedDepthDetId(const HcalDetId &id) const
const edm::EDGetTokenT< HBHERecHitCollection > tok_HBHE_
std::vector< double > isolationR04_
std::vector< double > hcalDepthActiveLengthHot_[depthMax_]
std::vector< double > hcalDepthEnergyCorr_[depthMax_]
std::vector< int > hcal_iphi_
std::vector< HcalDDDRecConstants::HcalActiveLength > actHE
TrackQuality
track quality
const CaloGeometry * geo_
std::pair< math::XYZPoint, bool > propagateHCAL(const reco::Track *, const MagneticField *, bool debug=false)
std::vector< double > hcalDepthEnergy_[depthMax_]
std::vector< double > phiGlob_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int trackerLayersWithMeasurement() const
const bool collapseDepth_
std::vector< double > trackDz_
T const * product() const
const edm::ESGetToken< CaloTopology, CaloTopologyRecord > tok_topo_
std::vector< Track > TrackCollection
collection of Tracks
const EcalSeverityLevelAlgo * sevlv_
const CaloTopology * caloTopology_
std::vector< double > pMuon_
const MagneticField * bField_
std::vector< bool > hcalDepthMatchHot_[depthMax_]
const edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > tok_htopo_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tok_magField_
bool analyzeMuon(edm::Event const &, math::XYZPoint &)
std::vector< unsigned int > hcalDetId_
bool goodCell(const HcalDetId &, const reco::Track *, const CaloGeometry *, const MagneticField *)
const std::string fileInCorr_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< double > isolationR03_
std::vector< Vertex > VertexCollection
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
std::vector< double > hcalDepthChargeHotBG_[depthMax_]
HcalRespCorrs * respCorrs_
std::vector< bool > hcalHot_
int stripTECLayersWithMeasurement() const
std::vector< Muon > MuonCollection
collection of Muon objects
bool isGoodVertex(const reco::Vertex &)
const bool isItPreRecHit_
const Item * getValues(DetId fId, bool throwOnFail=true) const
T getUntrackedParameter(std::string const &, T const &) const
U second(std::pair< T, U > const &p)
std::vector< double > hcalEnergy_
double gainFactor(const HcalDbService *, const HcalDetId &)
constexpr HcalSubdetector subdet() const
get the subdetector
const std::string labelGenTrack_
std::vector< bool > mediumMuon_
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
double chargeIsolationEcal(unsigned int trkIndex, std::vector< spr::propagatedTrackID > &vdetIds, const CaloGeometry *geo, const CaloTopology *caloTopology, int ieta, int iphi, bool debug=false)
std::vector< bool > matchedId_
const edm::EDGetTokenT< reco::MuonCollection > tok_Muon_
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)
const edm::EDGetTokenT< reco::VertexCollection > tok_Vtx_
const std::string theTrackQuality_
const edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > tok_chan_
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
std::vector< double > ecalEnergy_
const edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_respcorr_
constexpr int ieta() const
get the cell ieta
const edm::InputTag labelEERecHit_
std::vector< double > hcalDepthEnergyHot_[depthMax_]
HcalHBHEMuonHighEtaAnalyzer(const edm::ParameterSet &)
Abs< T >::type abs(const T &t)
int stripTOBLayersWithMeasurement() const
std::vector< double > hcal1x1Energy_
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
#define DEFINE_FWK_MODULE(type)
const bool writeRespCorr_
std::vector< int > hcal_ieta_
std::map< DetId, double > corrValue_
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_ddrec_
const edm::InputTag labelEBRecHit_
const HcalTopology * theHBHETopology_
const HcalDDDRecConstants * hdc_
constexpr double respcorrgain(int fCapId) const
get response corrected gain for capid=0..3
void fillTrackParameters(const reco::Track *, math::XYZPoint)
std::vector< double > hcalDepthActiveLength_[depthMax_]
double eta() const
pseudorapidity of momentum vector
std::vector< double > ptGlob_
void beginRun(edm::Run const &, edm::EventSetup const &) override
int trackerLayersWithoutMeasurement(HitCategory category) const
static TrackQuality qualityByName(const std::string &name)
const edm::InputTag labelHBHERecHit_
bool analyzeTracks(const reco::Track *, math::XYZPoint &, int, std::vector< spr::propagatedTrackID > &, bool)
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
std::vector< double > hcalDepthEnergyHotCorr_[depthMax_]
constexpr uint32_t rawId() const
get the raw id
const edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
XYZPointD XYZPoint
point in space with cartesian internal representation
std::vector< double > hcalActiveLength_
void analyze(edm::Event const &, edm::EventSetup const &) override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static const int depthMax_
const HcalDbService * conditions_
double activeLength(const DetId &)
const edm::ESGetToken< HcalDbService, HcalDbRecord > tok_dbservice_
std::vector< unsigned int > ehcalDetId_
bool validHcal(const HcalDetId &id) const
std::vector< HcalDDDRecConstants::HcalActiveLength > actHB
void endRun(edm::Run const &, edm::EventSetup const &) override
edm::Handle< EcalRecHitCollection > barrelRecHitsHandle_
reco::TrackBase::TrackQuality minQuality
std::vector< double > etaGlob_
std::vector< HcalActiveLength > getThickActive(const int &type) const
const HcalDDDRecConstants * dddConstants() const
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
std::vector< double > ecal3x3Energy_
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const
std::vector< double > hcalDepthChargeHot_[depthMax_]
Log< level::Warning, false > LogWarning
const edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
const std::string labelVtx_
std::vector< bool > hcalDepthMatch_[depthMax_]
std::vector< unsigned int > ecalDetId_
std::vector< int > trackMissedOuterHits_
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
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)
std::vector< double > emaxNearP_
edm::Handle< EcalRecHitCollection > endcapRecHitsHandle_
constexpr int iphi() const
get the cell iphi
void setTopo(const HcalTopology *topo)
const edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > tok_sevlv_
bool analyzeHadron(edm::Event const &, math::XYZPoint &)
std::vector< int > trackLayerCrossed_
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)