|
|
Go to the documentation of this file.
156 std::vector<HcalDDDRecConstants::HcalActiveLength>
actHB,
actHE;
162 : hlTriggerResults_(iConfig.getParameter<
edm::
InputTag>(
"hlTriggerResults")),
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 fileInCorr_(iConfig.getUntrackedParameter<
std::
string>(
"fileInCorr",
"")),
169 triggers_(iConfig.getParameter<
std::vector<
std::
string>>(
"triggers")),
170 verbosity_(iConfig.getUntrackedParameter<
int>(
"verbosity", 0)),
171 useRaw_(iConfig.getParameter<
int>(
"useRaw")),
172 unCorrect_(iConfig.getParameter<
bool>(
"unCorrect")),
173 collapseDepth_(iConfig.getParameter<
bool>(
"collapseDepth")),
174 isItPlan1_(iConfig.getParameter<
bool>(
"isItPlan1")),
175 ignoreHECorr_(iConfig.getUntrackedParameter<
bool>(
"ignoreHECorr",
false)),
176 isItPreRecHit_(iConfig.getUntrackedParameter<
bool>(
"isItPreRecHit",
false)),
177 getCharge_(iConfig.getParameter<
bool>(
"getCharge")),
178 writeRespCorr_(iConfig.getUntrackedParameter<
bool>(
"writeRespCorr",
false)),
180 theHBHETopology_(nullptr),
181 respCorrs_(nullptr) {
198 if (modnam.empty()) {
263 std::vector<int>
index;
264 for (
int i = 0;
i < Ntriggers;
i++) {
266 int triggerSize =
int(_Triggers->
size());
269 edm::LogVerbatim(
"HBHEMuon") <<
"outside loop " <<
index[
i] <<
"\ntriggerSize " << triggerSize << std::endl;
271 if (
index[
i] < triggerSize) {
276 <<
" trigger_index " <<
hltresults_.at(
i) <<
" hltresult" << std::endl;
281 <<
"\" does not exist\n";
327 if (!
vtx.isValid()) {
333 reco::VertexCollection::const_iterator firstGoodVertex =
vtx->end();
334 for (reco::VertexCollection::const_iterator it =
vtx->begin(); it !=
vtx->end(); it++) {
336 if (firstGoodVertex ==
vtx->end())
337 firstGoodVertex = it;
341 if (firstGoodVertex !=
vtx->end())
342 pvx = firstGoodVertex->position();
346 for (reco::MuonCollection::const_iterator RecMuon = _Muon->begin(); RecMuon != _Muon->end(); ++RecMuon) {
354 pMuon_.push_back(RecMuon->p());
356 edm::LogVerbatim(
"HBHEMuon") <<
"Energy:" << RecMuon->energy() <<
" P:" << RecMuon->p() << std::endl;
360 muon_trkKink.push_back(RecMuon->combinedQuality().trkKink);
364 if (RecMuon->track().isNonnull()) {
365 trackerLayer_.push_back(RecMuon->track()->hitPattern().trackerLayersWithMeasurement());
369 if (RecMuon->innerTrack().isNonnull()) {
371 numPixelLayers_.push_back(RecMuon->innerTrack()->hitPattern().pixelLayersWithMeasurement());
372 chiTracker_.push_back(RecMuon->innerTrack()->normalizedChi2());
373 dxyTracker_.push_back(fabs(RecMuon->innerTrack()->dxy(pvx)));
374 dzTracker_.push_back(fabs(RecMuon->innerTrack()->dz(pvx)));
378 tight_PixelHits_.push_back(RecMuon->innerTrack()->hitPattern().numberOfValidPixelHits());
393 if (RecMuon->outerTrack().isNonnull()) {
398 outerTrackChi_.push_back(RecMuon->outerTrack()->normalizedChi2());
411 if (RecMuon->globalTrack().isNonnull()) {
413 chiGlobal_.push_back(RecMuon->globalTrack()->normalizedChi2());
414 globalMuonHits_.push_back(RecMuon->globalTrack()->hitPattern().numberOfValidMuonHits());
415 matchedStat_.push_back(RecMuon->numberOfMatchedStations());
434 ((RecMuon->pfIsolationR04().sumChargedHadronPt +
436 RecMuon->pfIsolationR04().sumNeutralHadronEt + RecMuon->pfIsolationR04().sumPhotonEt -
437 (0.5 * RecMuon->pfIsolationR04().sumPUPt))) /
441 ((RecMuon->pfIsolationR03().sumChargedHadronPt +
443 RecMuon->pfIsolationR03().sumNeutralHadronEt + RecMuon->pfIsolationR03().sumPhotonEt -
444 (0.5 * RecMuon->pfIsolationR03().sumPUPt))) /
449 hoEnergy_.push_back(RecMuon->calEnergy().hoS9);
451 double eEcal(0), eHcal(0), activeLengthTot(0), activeLengthHotTot(0);
458 unsigned int isHot(0);
459 bool tmpmatch(
false);
462 eHcalDepth[
i] = eHcalDepthHot[
i] = 0;
463 eHcalDepthC[
i] = eHcalDepthHotC[
i] = 0;
464 cHcalDepthHot[
i] = cHcalDepthHotBG[
i] = 0;
465 activeL[
i] = activeHotL[
i] = 0;
466 matchDepth[
i] = matchDepthHot[
i] =
true;
468 if (RecMuon->innerTrack().isNonnull()) {
471 if ((RecMuon->p() > 10.0) && (trackID.
okHCAL))
484 bool okE = trackID.
okECAL;
505 edm::LogVerbatim(
"HBHEMuon") <<
"Propagate Track to ECAL: " << okE <<
":" << trackID.
okECAL <<
" E " << eEcal;
511 if ((hcidt.ieta() ==
check.ieta()) && (hcidt.iphi() ==
check.iphi()))
537 std::vector<std::pair<double, int>> ehdepth;
553 for (
unsigned int i = 0;
i < ehdepth.size(); ++
i) {
558 double ene = ehdepth[
i].first;
562 edm::LogWarning(
"HBHEMuon") <<
"(1) Invalid ID " << hcid0 <<
" with E = " << ene;
564 for (
const auto& ehd : ehdepth)
578 int depth = ehdepth[
i].second - 1;
581 depth =
id.depth() - 1;
583 eHcalDepth[
depth] += ene;
584 eHcalDepthC[
depth] += enec;
585 activeL[
depth] += actL;
586 activeLengthTot += actL;
587 matchDepth[
depth] = (matchDepth[
depth] && tmpC);
591 << hcid0 <<
" E " << ene <<
":" << enec <<
" L " << actL <<
" Match " << tmpC;
598 edm::LogVerbatim(
"HBHEMuon") << hcidt <<
" Match " << tmpmatch <<
" Depths " << ehdepth.size();
599 for (
unsigned int k = 0;
k < ehdepth.size(); ++
k)
600 edm::LogVerbatim(
"HBHEMuon") <<
" [" <<
k <<
":" << ehdepth[
k].second <<
"] " << matchDepth[
k];
605 isHot =
matchId(closestCell, hotCell);
611 std::vector<std::pair<double, int>> ehdepth;
627 for (
unsigned int i = 0;
i < ehdepth.size(); ++
i) {
632 double ene = ehdepth[
i].first;
636 edm::LogWarning(
"HBHEMuon") <<
"(2) Invalid ID " << hcid0 <<
" with E = " << ene;
638 for (
const auto& ehd : ehdepth)
642 double chg(ene), enec(ene);
650 << hcid0 <<
":" <<
id <<
" Corr " <<
corr <<
" E " << ene <<
":" << enec;
661 int depth = ehdepth[
i].second - 1;
664 depth =
id.depth() - 1;
666 eHcalDepthHot[
depth] += ene;
667 eHcalDepthHotC[
depth] += enec;
669 activeHotL[
depth] += actL;
670 activeLengthHotTot += actL;
671 matchDepthHot[
depth] = (matchDepthHot[
depth] && tmpC);
675 <<
chg <<
" L " << actL <<
" Match " << tmpC;
682 std::vector<std::pair<double, int>> ehdeptho;
696 for (
unsigned int i = 0;
i < ehdeptho.size(); ++
i) {
700 double ene = ehdeptho[
i].first;
703 edm::LogWarning(
"HBHEMuon") <<
"(3) Invalid ID " << hcid0 <<
" with E = " << ene;
704 edm::LogWarning(
"HBHEMuon") << oppCell <<
" with " << ehdeptho.size() <<
" depths:";
705 for (
const auto& ehd : ehdeptho)
716 << hcid0 <<
":" <<
id <<
" Corr " <<
corr <<
" E " << ene <<
":" << ehdeptho[
i].first;
727 int depth = ehdeptho[
i].second - 1;
730 depth =
id.depth() - 1;
744 <<
" Hot " << isHot <<
" Energy " << eHcal << std::endl;
856 sprintf(
name,
"hcal_edepth%d", (
k + 1));
858 sprintf(
name,
"hcal_activeL%d", (
k + 1));
860 sprintf(
name,
"hcal_edepthHot%d", (
k + 1));
862 sprintf(
name,
"hcal_activeHotL%d", (
k + 1));
864 sprintf(
name,
"hcal_cdepthHot%d", (
k + 1));
866 sprintf(
name,
"hcal_cdepthHotBG%d", (
k + 1));
868 sprintf(
name,
"hcal_edepthCorrect%d", (
k + 1));
870 sprintf(
name,
"hcal_edepthHotCorrect%d", (
k + 1));
872 sprintf(
name,
"hcal_depthMatch%d", (
k + 1));
874 sprintf(
name,
"hcal_depthMatchHot%d", (
k + 1));
895 unsigned int k1(0), k2(0);
897 for (
const auto& act :
actHB) {
898 edm::LogVerbatim(
"HBHEMuon") <<
"[" << k1 <<
"] ieta " << act.ieta <<
" depth " << act.depth <<
" zside "
899 << act.zside <<
" type " << act.stype <<
" phi " << act.iphis.size() <<
":"
900 << act.iphis[0] <<
" L " << act.thick;
907 for (
const auto& act :
actHE) {
908 edm::LogVerbatim(
"HBHEMuon") <<
"[" << k2 <<
"] ieta " << act.ieta <<
" depth " << act.depth <<
" zside "
909 << act.zside <<
" type " << act.stype <<
" phi " << act.iphis.size() <<
":"
910 << act.iphis[0] <<
" L " << act.thick;
925 <<
" successfully extracted" << std::endl;
928 for (
unsigned int t = 0;
t < ntriggers; ++
t) {
930 for (
unsigned int ik = 0; ik < 6; ++ik) {
931 if (hltname.find(
triggers_[ik]) != std::string::npos) {
939 edm::LogError(
"HBHEMuon") <<
"Error! HLT config extraction with process "
940 <<
"name HLT failed";
959 edm::LogVerbatim(
"HBHEMuon") <<
"\nTable of Correction Factors for Run " << iRun.
run() <<
"\n";
960 for (
auto const&
id : ids) {
978 std::vector<std::string>
trig = {
"HLT_IsoMu17",
"HLT_IsoMu20",
"HLT_IsoMu24",
"HLT_IsoMu27",
"HLT_Mu45",
"HLT_Mu50"};
979 desc.
add<std::vector<std::string>>(
"triggers",
trig);
981 desc.
add<
int>(
"useRaw", 0);
982 desc.
add<
bool>(
"unCorrect",
false);
983 desc.
add<
bool>(
"getCharge",
false);
984 desc.
add<
bool>(
"collapseDepth",
false);
985 desc.
add<
bool>(
"isItPlan1",
false);
993 descriptions.
add(
"hcalHBHEMuon", desc);
1082 int match = ((kd1 == kd2) ? 1 : 0);
1088 int ieta =
id.ietaAbs();
1089 int zside =
id.zside();
1090 int iphi =
id.iphi();
1091 std::vector<int> dpths;
1093 std::vector<HcalDetId> ids;
1095 for (
auto idh : ids)
1096 dpths.emplace_back(idh.depth());
1098 dpths.emplace_back(
id.
depth());
1102 for (
unsigned int i = 0;
i <
actHB.size(); ++
i) {
1104 (
std::find(dpths.begin(), dpths.end(),
actHB[
i].depth) != dpths.end()) &&
1110 for (
unsigned int i = 0;
i <
actHE.size(); ++
i) {
1112 (
std::find(dpths.begin(), dpths.end(),
actHE[
i].depth) != dpths.end()) &&
1126 if (
vtx.position().Rho() > 2.)
1128 if (fabs(
vtx.position().Z()) > 24.)
1148 for (
int capid = 0; capid < 4; ++capid)
1163 <<
" depth " <<
depth;
1172 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_
T const * product() const
std::vector< double > hcalDepthActiveLengthHot_[depthMax_]
std::vector< double > hcalDepthEnergyHot_[depthMax_]
bool isGoodVertex(const reco::Vertex &vtx)
std::vector< int > matchedStat_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< int > tight_PixelHits_
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)
double gainFactor(const edm::ESHandle< HcalDbService > &, const HcalDetId &id)
const bool collapseDepth_
std::vector< double > isolationR03_
HcalHBHEMuonAnalyzer(const edm::ParameterSet &)
constexpr int iphi() const
get the cell iphi
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_
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_
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)
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
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)
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_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
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
std::vector< double > chiTracker_
const std::string labelVtx_
std::vector< bool > innerTrack_
std::vector< int > outerTrackHits_
std::vector< bool > globalTrack_
static const int depthMax_
std::vector< double > outerTrackEta_
std::vector< double > globalTrckEta_
std::vector< std::pair< float, float > >::iterator itr
bool isMediumMuon(const reco::Muon &, bool run2016_hip_mitigation=false)
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
std::vector< double > hcalActiveLengthHot_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static const std::string kSharedResource
std::vector< bool > hcalDepthMatch_[depthMax_]
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 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_