|
|
Go to the documentation of this file.
167 std::vector<HcalDDDRecConstants::HcalActiveLength>
actHB,
actHE;
173 : hlTriggerResults_(iConfig.getParameter<
edm::
InputTag>(
"hlTriggerResults")),
174 labelEBRecHit_(iConfig.getParameter<
edm::
InputTag>(
"labelEBRecHit")),
175 labelEERecHit_(iConfig.getParameter<
edm::
InputTag>(
"labelEERecHit")),
176 labelHBHERecHit_(iConfig.getParameter<
edm::
InputTag>(
"labelHBHERecHit")),
177 labelVtx_(iConfig.getParameter<
std::
string>(
"labelVertex")),
178 labelMuon_(iConfig.getParameter<
std::
string>(
"labelMuon")),
179 fileInCorr_(iConfig.getUntrackedParameter<
std::
string>(
"fileInCorr",
"")),
181 verbosity_(iConfig.getUntrackedParameter<
int>(
"verbosity", 0)),
182 useRaw_(iConfig.getParameter<
int>(
"useRaw")),
183 unCorrect_(iConfig.getParameter<
bool>(
"unCorrect")),
184 collapseDepth_(iConfig.getParameter<
bool>(
"collapseDepth")),
185 isItPlan1_(iConfig.getParameter<
bool>(
"isItPlan1")),
186 ignoreHECorr_(iConfig.getUntrackedParameter<
bool>(
"ignoreHECorr",
false)),
187 isItPreRecHit_(iConfig.getUntrackedParameter<
bool>(
"isItPreRecHit",
false)),
188 getCharge_(iConfig.getParameter<
bool>(
"getCharge")),
189 writeRespCorr_(iConfig.getUntrackedParameter<
bool>(
"writeRespCorr",
false)),
191 theHBHETopology_(nullptr),
192 respCorrs_(nullptr) {
209 if (modnam.empty()) {
224 tok_ddrec_ = esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord, edm::Transition::BeginRun>();
225 tok_htopo_ = esConsumes<HcalTopology, HcalRecNumberingRecord, edm::Transition::BeginRun>();
226 tok_respcorr_ = esConsumes<HcalRespCorrs, HcalRespCorrsRcd, edm::Transition::BeginRun>();
227 tok_geom_ = esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>();
228 tok_magField_ = esConsumes<MagneticField, IdealMagneticFieldRecord>();
229 tok_chan_ = esConsumes<EcalChannelStatus, EcalChannelStatusRcd>();
230 tok_sevlv_ = esConsumes<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd>();
231 tok_topo_ = esConsumes<CaloTopology, CaloTopologyRecord>();
284 std::vector<int>
index;
285 for (
int i = 0;
i < Ntriggers;
i++) {
287 int triggerSize =
int(_Triggers->
size());
290 edm::LogVerbatim(
"HBHEMuon") <<
"outside loop " <<
index[
i] <<
"\ntriggerSize " << triggerSize << std::endl;
292 if (
index[
i] < triggerSize) {
297 <<
" trigger_index " <<
hltresults_.at(
i) <<
" hltresult" << std::endl;
302 <<
"\" does not exist\n";
332 if (!
vtx.isValid()) {
338 reco::VertexCollection::const_iterator firstGoodVertex =
vtx->end();
339 for (reco::VertexCollection::const_iterator it =
vtx->begin(); it !=
vtx->end(); it++) {
341 if (firstGoodVertex ==
vtx->end())
342 firstGoodVertex = it;
346 if (firstGoodVertex !=
vtx->end())
347 pvx = firstGoodVertex->position();
351 for (reco::MuonCollection::const_iterator RecMuon = _Muon->begin(); RecMuon != _Muon->end(); ++RecMuon) {
359 pMuon_.push_back(RecMuon->p());
361 edm::LogVerbatim(
"HBHEMuon") <<
"Energy:" << RecMuon->energy() <<
" P:" << RecMuon->p() << std::endl;
365 muon_trkKink.push_back(RecMuon->combinedQuality().trkKink);
369 if (RecMuon->track().isNonnull()) {
370 trackerLayer_.push_back(RecMuon->track()->hitPattern().trackerLayersWithMeasurement());
374 if (RecMuon->innerTrack().isNonnull()) {
376 numPixelLayers_.push_back(RecMuon->innerTrack()->hitPattern().pixelLayersWithMeasurement());
377 chiTracker_.push_back(RecMuon->innerTrack()->normalizedChi2());
378 dxyTracker_.push_back(fabs(RecMuon->innerTrack()->dxy(pvx)));
379 dzTracker_.push_back(fabs(RecMuon->innerTrack()->dz(pvx)));
383 tight_PixelHits_.push_back(RecMuon->innerTrack()->hitPattern().numberOfValidPixelHits());
398 if (RecMuon->outerTrack().isNonnull()) {
403 outerTrackChi_.push_back(RecMuon->outerTrack()->normalizedChi2());
416 if (RecMuon->globalTrack().isNonnull()) {
418 chiGlobal_.push_back(RecMuon->globalTrack()->normalizedChi2());
419 globalMuonHits_.push_back(RecMuon->globalTrack()->hitPattern().numberOfValidMuonHits());
420 matchedStat_.push_back(RecMuon->numberOfMatchedStations());
439 ((RecMuon->pfIsolationR04().sumChargedHadronPt +
441 RecMuon->pfIsolationR04().sumNeutralHadronEt + RecMuon->pfIsolationR04().sumPhotonEt -
442 (0.5 * RecMuon->pfIsolationR04().sumPUPt))) /
446 ((RecMuon->pfIsolationR03().sumChargedHadronPt +
448 RecMuon->pfIsolationR03().sumNeutralHadronEt + RecMuon->pfIsolationR03().sumPhotonEt -
449 (0.5 * RecMuon->pfIsolationR03().sumPUPt))) /
454 hoEnergy_.push_back(RecMuon->calEnergy().hoS9);
456 double eEcal(0), eHcal(0), activeLengthTot(0), activeLengthHotTot(0);
463 unsigned int isHot(0);
464 bool tmpmatch(
false);
467 eHcalDepth[
i] = eHcalDepthHot[
i] = 0;
468 eHcalDepthC[
i] = eHcalDepthHotC[
i] = 0;
469 cHcalDepthHot[
i] = cHcalDepthHotBG[
i] = 0;
470 activeL[
i] = activeHotL[
i] = 0;
471 matchDepth[
i] = matchDepthHot[
i] =
true;
473 if (RecMuon->innerTrack().isNonnull()) {
476 if ((RecMuon->p() > 10.0) && (trackID.
okHCAL))
489 bool okE = trackID.
okECAL;
510 edm::LogVerbatim(
"HBHEMuon") <<
"Propagate Track to ECAL: " << okE <<
":" << trackID.
okECAL <<
" E " << eEcal;
516 if ((hcidt.ieta() ==
check.ieta()) && (hcidt.iphi() ==
check.iphi()))
542 std::vector<std::pair<double, int>> ehdepth;
558 for (
unsigned int i = 0;
i < ehdepth.size(); ++
i) {
563 double ene = ehdepth[
i].first;
567 edm::LogWarning(
"HBHEMuon") <<
"(1) Invalid ID " << hcid0 <<
" with E = " << ene;
569 for (
const auto& ehd : ehdepth)
583 int depth = ehdepth[
i].second - 1;
586 depth =
id.depth() - 1;
588 eHcalDepth[
depth] += ene;
589 eHcalDepthC[
depth] += enec;
590 activeL[
depth] += actL;
591 activeLengthTot += actL;
592 matchDepth[
depth] = (matchDepth[
depth] && tmpC);
596 << hcid0 <<
" E " << ene <<
":" << enec <<
" L " << actL <<
" Match " << tmpC;
603 edm::LogVerbatim(
"HBHEMuon") << hcidt <<
" Match " << tmpmatch <<
" Depths " << ehdepth.size();
604 for (
unsigned int k = 0;
k < ehdepth.size(); ++
k)
605 edm::LogVerbatim(
"HBHEMuon") <<
" [" <<
k <<
":" << ehdepth[
k].second <<
"] " << matchDepth[
k];
610 isHot =
matchId(closestCell, hotCell);
616 std::vector<std::pair<double, int>> ehdepth;
632 for (
unsigned int i = 0;
i < ehdepth.size(); ++
i) {
637 double ene = ehdepth[
i].first;
641 edm::LogWarning(
"HBHEMuon") <<
"(2) Invalid ID " << hcid0 <<
" with E = " << ene;
643 for (
const auto& ehd : ehdepth)
647 double chg(ene), enec(ene);
655 << hcid0 <<
":" <<
id <<
" Corr " <<
corr <<
" E " << ene <<
":" << enec;
666 int depth = ehdepth[
i].second - 1;
669 depth =
id.depth() - 1;
671 eHcalDepthHot[
depth] += ene;
672 eHcalDepthHotC[
depth] += enec;
674 activeHotL[
depth] += actL;
675 activeLengthHotTot += actL;
676 matchDepthHot[
depth] = (matchDepthHot[
depth] && tmpC);
680 <<
chg <<
" L " << actL <<
" Match " << tmpC;
687 std::vector<std::pair<double, int>> ehdeptho;
701 for (
unsigned int i = 0;
i < ehdeptho.size(); ++
i) {
705 double ene = ehdeptho[
i].first;
708 edm::LogWarning(
"HBHEMuon") <<
"(3) Invalid ID " << hcid0 <<
" with E = " << ene;
709 edm::LogWarning(
"HBHEMuon") << oppCell <<
" with " << ehdeptho.size() <<
" depths:";
710 for (
const auto& ehd : ehdeptho)
721 << hcid0 <<
":" <<
id <<
" Corr " <<
corr <<
" E " << ene <<
":" << ehdeptho[
i].first;
732 int depth = ehdeptho[
i].second - 1;
735 depth =
id.depth() - 1;
749 <<
" Hot " << isHot <<
" Energy " << eHcal << std::endl;
861 sprintf(
name,
"hcal_edepth%d", (
k + 1));
863 sprintf(
name,
"hcal_activeL%d", (
k + 1));
865 sprintf(
name,
"hcal_edepthHot%d", (
k + 1));
867 sprintf(
name,
"hcal_activeHotL%d", (
k + 1));
869 sprintf(
name,
"hcal_cdepthHot%d", (
k + 1));
871 sprintf(
name,
"hcal_cdepthHotBG%d", (
k + 1));
873 sprintf(
name,
"hcal_edepthCorrect%d", (
k + 1));
875 sprintf(
name,
"hcal_edepthHotCorrect%d", (
k + 1));
877 sprintf(
name,
"hcal_depthMatch%d", (
k + 1));
879 sprintf(
name,
"hcal_depthMatchHot%d", (
k + 1));
898 unsigned int k1(0), k2(0);
900 for (
const auto& act :
actHB) {
901 edm::LogVerbatim(
"HBHEMuon") <<
"[" << k1 <<
"] ieta " << act.ieta <<
" depth " << act.depth <<
" zside "
902 << act.zside <<
" type " << act.stype <<
" phi " << act.iphis.size() <<
":"
903 << act.iphis[0] <<
" L " << act.thick;
910 for (
const auto& act :
actHE) {
911 edm::LogVerbatim(
"HBHEMuon") <<
"[" << k2 <<
"] ieta " << act.ieta <<
" depth " << act.depth <<
" zside "
912 << act.zside <<
" type " << act.stype <<
" phi " << act.iphis.size() <<
":"
913 << act.iphis[0] <<
" L " << act.thick;
928 <<
" successfully extracted" << std::endl;
931 for (
unsigned int t = 0;
t < ntriggers; ++
t) {
933 for (
unsigned int ik = 0; ik < 6; ++ik) {
934 if (hltname.find(
triggers_[ik]) != std::string::npos) {
942 edm::LogError(
"HBHEMuon") <<
"Error! HLT config extraction with process "
943 <<
"name HLT failed";
956 edm::LogVerbatim(
"HBHEMuon") <<
"\nTable of Correction Factors for Run " << iRun.
run() <<
"\n";
957 for (
auto const&
id : ids) {
975 std::vector<std::string>
trig = {
"HLT_IsoMu17",
"HLT_IsoMu20",
"HLT_IsoMu24",
"HLT_IsoMu27",
"HLT_Mu45",
"HLT_Mu50"};
976 desc.add<std::vector<std::string>>(
"triggers",
trig);
977 desc.addUntracked<
int>(
"verbosity", 0);
978 desc.add<
int>(
"useRaw", 0);
979 desc.add<
bool>(
"unCorrect",
false);
980 desc.add<
bool>(
"getCharge",
false);
981 desc.add<
bool>(
"collapseDepth",
false);
982 desc.add<
bool>(
"isItPlan1",
false);
983 desc.addUntracked<
bool>(
"ignoreHECorr",
false);
984 desc.addUntracked<
bool>(
"isItPreRecHit",
false);
987 desc.addUntracked<
int>(
"maxDepth", 4);
989 desc.addUntracked<
bool>(
"writeRespCorr",
false);
990 descriptions.
add(
"hcalHBHEMuon",
desc);
1079 int match = ((kd1 == kd2) ? 1 : 0);
1085 int ieta =
id.ietaAbs();
1086 int zside =
id.zside();
1087 int iphi =
id.iphi();
1088 std::vector<int> dpths;
1090 std::vector<HcalDetId> ids;
1092 for (
auto idh : ids)
1093 dpths.emplace_back(idh.depth());
1095 dpths.emplace_back(
id.
depth());
1099 for (
unsigned int i = 0;
i <
actHB.size(); ++
i) {
1101 (
std::find(dpths.begin(), dpths.end(),
actHB[
i].depth) != dpths.end()) &&
1107 for (
unsigned int i = 0;
i <
actHE.size(); ++
i) {
1109 (
std::find(dpths.begin(), dpths.end(),
actHE[
i].depth) != dpths.end()) &&
1123 if (
vtx.position().Rho() > 2.)
1125 if (fabs(
vtx.position().Z()) > 24.)
1145 for (
int capid = 0; capid < 4; ++capid)
1160 <<
" depth " <<
depth;
1169 std::pair<double, double> rz =
hdc_->
getRZ(hcid);
std::vector< double > innerTracketa_
std::vector< bool > muon_global_
std::vector< double > outerTrackPt_
std::vector< double > dxyTracker_
HcalDetId mergedDepthDetId(const HcalDetId &id) const
std::vector< double > pMuon_
std::vector< double > hcalDepthActiveLengthHot_[depthMax_]
std::vector< double > hcalDepthEnergyHot_[depthMax_]
bool isGoodVertex(const reco::Vertex &vtx)
std::vector< int > matchedStat_
std::vector< int > tight_PixelHits_
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > tok_htopo_
std::vector< double > hcalDepthChargeHot_[depthMax_]
bool validHcal(const HcalDetId &id) const
std::vector< double > tight_validFraction_
std::vector< bool > muon_is_good_
void setTopo(const HcalTopology *topo)
const bool collapseDepth_
std::vector< double > isolationR03_
HcalHBHEMuonAnalyzer(const edm::ParameterSet &)
constexpr int iphi() const
get the cell iphi
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > tok_sevlv_
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
std::vector< HcalActiveLength > getThickActive(const int &type) const
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tok_magField_
std::vector< double > hcalDepthEnergy_[depthMax_]
edm::EDGetTokenT< edm::TriggerResults > tok_trigRes_
double respCorr(const DetId &id)
std::vector< double > outerTrackPhi_
std::vector< float > muon_trkKink
const edm::InputTag labelHBHERecHit_
std::vector< double > energyMuon_
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
std::vector< double > hcalDepthChargeHotBG_[depthMax_]
U second(std::pair< T, U > const &p)
std::vector< HcalDDDRecConstants::HcalActiveLength > actHB
edm::EDGetTokenT< HBHERecHitCollection > tok_HBHE_
T getUntrackedParameter(std::string const &, T const &) const
std::vector< double > innerTrackphi_
const bool isItPreRecHit_
std::vector< std::string > all_triggers_
const bool writeRespCorr_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
unsigned int eventNumber_
std::vector< double > hcalActiveLength_
Log< level::Warning, false > LogWarning
const Item * getValues(DetId fId, bool throwOnFail=true) const
std::vector< double > hcalDepthEnergyHotCorr_[depthMax_]
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)
std::vector< HcalDDDRecConstants::HcalActiveLength > actHE
int matchId(const HcalDetId &, const HcalDetId &)
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_ddrec_
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< bool > muon_tracker_
edm::EDGetTokenT< reco::MuonCollection > tok_Muon_
#define DEFINE_FWK_MODULE(type)
std::vector< int > numPixelLayers_
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)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< double > isolationR04_
edm::Service< TFileService > fs
std::vector< bool > muon_is_tight_
unsigned int size() const
Get number of paths stored.
std::vector< unsigned int > ecalDetId_
std::vector< int > trackerLayer_
std::vector< unsigned int > ehcalDetId_
std::vector< double > phiGlob_
const edm::InputTag labelEBRecHit_
std::vector< double > dzTracker_
const edm::InputTag hlTriggerResults_
HcalRespCorrs * respCorrs_
int getMinDepth(const int &itype, const int &ieta, const int &iphi, const int &zside) const
constexpr double respcorrgain(int fCapId) const
get response corrected gain for capid=0..3
unsigned int size() const
number of trigger paths in trigger table
std::vector< int > globalMuonHits_
std::vector< double > hcalDepthEnergyCorr_[depthMax_]
constexpr int ieta() const
get the cell ieta
XYZPointD XYZPoint
point in space with cartesian internal representation
std::vector< double > hcal1x1Energy_
std::vector< int > outerTrackRHits_
std::vector< int > hltresults_
std::vector< bool > hcalHot_
std::vector< double > globalTrckPt_
const edm::InputTag labelEERecHit_
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
const HcalDDDRecConstants * dddConstants() const
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
constexpr HcalSubdetector subdet() const
get the subdetector
const CaloGeometry * geo_
std::vector< double > chiTracker_
const std::string labelVtx_
edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > tok_chan_
std::vector< bool > innerTrack_
std::vector< int > outerTrackHits_
std::vector< bool > globalTrack_
static const int depthMax_
std::vector< double > outerTrackEta_
edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_respcorr_
Log< level::Error, false > LogError
std::vector< double > globalTrckEta_
std::vector< std::pair< float, float > >::iterator itr
bool isMediumMuon(const reco::Muon &, bool run2016_hip_mitigation=false)
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
bool getData(T &iHolder) const
std::vector< double > hcalDepthActiveLength_[depthMax_]
std::vector< double > hcalEnergy_
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, const std::string &theTrackQuality, bool debug=false)
std::vector< float > muon_segComp
std::vector< unsigned int > hcalDetId_
std::map< DetId, double > corrValue_
std::vector< double > ecal3x3Energy_
std::vector< double > globalTrckPhi_
constexpr uint32_t rawId() const
get the raw id
double getRZ(const int &subdet, const int &ieta, const int &depth) const
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
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)
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
void endRun(edm::Run const &, edm::EventSetup const &) override
Log< level::Info, true > LogVerbatim
std::vector< double > hcalActiveLengthHot_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static const std::string kSharedResource
std::vector< bool > hcalDepthMatch_[depthMax_]
edm::ESGetToken< CaloTopology, CaloTopologyRecord > tok_topo_
edm::ESGetToken< HcalDbService, HcalDbRecord > tok_dbservice_
std::vector< int > hcal_ieta_
edm::EDGetTokenT< reco::VertexCollection > tok_Vtx_
void beginRun(edm::Run const &, edm::EventSetup const &) override
std::vector< double > hoEnergy_
std::pair< math::XYZPoint, bool > propagateHCAL(const reco::Track *, const MagneticField *, bool debug=false)
const HcalDDDRecConstants * hdc_
int depth16HE(int ieta, int iphi)
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)
bool accept() const
Has at least one path accepted the event?
const std::string & triggerName(unsigned int triggerIndex) const
std::vector< bool > matchedId_
std::vector< int > hcal_iphi_
const HcalTopology * theHBHETopology_
HLTConfigProvider hltConfig_
std::vector< double > ecalEnergy_
std::vector< bool > muon_is_medium_
std::vector< double > chiGlobal_
Abs< T >::type abs(const T &t)
void analyze(edm::Event const &, edm::EventSetup const &) override
std::vector< bool > hcalDepthMatchHot_[depthMax_]
std::vector< double > innerTrackpt_
std::vector< double > etaGlob_
std::vector< float > muon_chi2LocalPosition
const std::vector< std::string > triggers_
unsigned int triggerIndex(std::string const &name) const
std::vector< bool > outerTrack_
double gainFactor(const HcalDbService *dbserv, const HcalDetId &id)
double activeLength(const DetId &)
std::vector< double > ptGlob_
bool goodCell(const HcalDetId &hcid, const reco::Track *pTrack, const CaloGeometry *geo, const MagneticField *bField)
std::vector< double > outerTrackChi_
const std::string labelMuon_
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const
const std::string fileInCorr_
T * make(const Args &... args) const
make new ROOT object
std::vector< double > tight_LongPara_
std::vector< double > tight_TransImpara_