158 std::vector<HcalDDDRecConstants::HcalActiveLength>
actHB,
actHE;
173 verbosity_(iConfig.getUntrackedParameter<
int>(
"verbosity",0)),
198 if (modnam.empty()) {
219 if (infile.is_open()) {
223 infile >>
id >> cfac;
224 if (!infile.good())
break;
232 <<
" GetCharge " <<
getCharge_ <<
" UnCorrect " 273 std::vector<int>
index;
274 for (
int i=0;
i<Ntriggers;
i++) {
276 int triggerSize =
int( _Triggers->
size());
280 <<
"\ntriggerSize " << triggerSize
283 if (index[i] < triggerSize) {
288 <<
" triggerSize " << index[
i]
290 <<
" hltresult" << std::endl;
295 <<
"\" does not exist\n";
347 reco::VertexCollection::const_iterator firstGoodVertex = vtx->end();
348 for (reco::VertexCollection::const_iterator it = vtx->begin();
349 it != vtx->end(); it++) {
351 if (firstGoodVertex == vtx->end()) firstGoodVertex = it;
355 if (firstGoodVertex != vtx->end()) pvx = firstGoodVertex->position();
360 for (reco::MuonCollection::const_iterator RecMuon = _Muon->begin(); RecMuon!= _Muon->end(); ++RecMuon) {
369 pMuon_.push_back(RecMuon->p());
372 << RecMuon->p() << std::endl;
376 muon_trkKink.push_back(RecMuon->combinedQuality().trkKink);
380 if (RecMuon->track().isNonnull()) {
381 trackerLayer_.push_back(RecMuon->track()->hitPattern().trackerLayersWithMeasurement());
385 if (RecMuon->innerTrack().isNonnull()) {
387 numPixelLayers_.push_back(RecMuon->innerTrack()->hitPattern().pixelLayersWithMeasurement());
388 chiTracker_.push_back(RecMuon->innerTrack()->normalizedChi2());
389 dxyTracker_.push_back(fabs(RecMuon->innerTrack()->dxy(pvx)));
390 dzTracker_.push_back(fabs(RecMuon->innerTrack()->dz(pvx)));
394 tight_PixelHits_.push_back(RecMuon->innerTrack()->hitPattern().numberOfValidPixelHits());
409 if (RecMuon->outerTrack().isNonnull()) {
414 outerTrackChi_.push_back(RecMuon->outerTrack()->normalizedChi2());
427 if (RecMuon->globalTrack().isNonnull()) {
429 chiGlobal_.push_back(RecMuon->globalTrack()->normalizedChi2());
430 globalMuonHits_.push_back(RecMuon->globalTrack()->hitPattern().numberOfValidMuonHits());
431 matchedStat_.push_back(RecMuon->numberOfMatchedStations());
449 isolationR04_.push_back(((RecMuon->pfIsolationR04().sumChargedHadronPt +
std::max(0.,RecMuon->pfIsolationR04().sumNeutralHadronEt + RecMuon->pfIsolationR04().sumPhotonEt - (0.5 *RecMuon->pfIsolationR04().sumPUPt))) / RecMuon->pt()) );
451 isolationR03_.push_back(((RecMuon->pfIsolationR03().sumChargedHadronPt +
std::max(0.,RecMuon->pfIsolationR03().sumNeutralHadronEt + RecMuon->pfIsolationR03().sumPhotonEt - (0.5 * RecMuon->pfIsolationR03().sumPUPt))) / RecMuon->pt()));
455 hoEnergy_.push_back(RecMuon->calEnergy().hoS9);
457 double eEcal(0), eHcal(0), activeLengthTot(0), activeLengthHotTot(0);
464 unsigned int isHot(0);
465 bool tmpmatch(
false);
466 int ieta(-1000), iphi(-1000);
468 eHcalDepth[
i] = eHcalDepthHot[
i] = 0;
469 eHcalDepthC[
i] = eHcalDepthHotC[
i] = 0;
470 cHcalDepthHot[
i] = cHcalDepthHotBG[
i]= 0;
471 activeL[
i] = activeHotL[
i] = 0;
472 matchDepth[
i] = matchDepthHot[
i] =
true;
474 if (RecMuon->innerTrack().isNonnull()) {
475 const reco::Track* pTrack = (RecMuon->innerTrack()).
get();
477 if ((RecMuon->p()>10.0) && (trackID.
okHCAL)) accept =
true;
489 bool okE = trackID.
okECAL;
492 std::pair<double,bool> e3x3 =
spr::eECALmatrix(isoCell,barrelRecHitsHandle,endcapRecHitsHandle,*theEcalChStatus,geo,caloTopology,sevlv.
product(),1,1,-100.0,-100.0,-500.0,500.0,
false);
498 <<
":" << trackID.
okECAL <<
" E " <<eEcal;
504 if ((hcidt.ieta() == check.
ieta()) && (hcidt.iphi() == check.
iphi()))
508 << info.first <<
":" << check
509 <<
" Match " << tmpmatch;
515 bool hborhe = (
std::abs(ieta) == 16);
517 eHcal =
spr::eHCALmatrix(
theHBHETopology_, closestCell, hbhe,0,0,
false,
true, -100.0, -100.0, -100.0, -100.0, -500.,500.,
useRaw_);
518 std::vector<std::pair<double,int> > ehdepth;
519 spr::energyHCALCell((
HcalDetId)closestCell, hbhe, ehdepth,
maxDepth_, -100.0, -100.0, -100.0, -100.0, -500.0, 500.0,
useRaw_,
depth16HE(ieta,iphi), (((
verbosity_/1000)%10)>0));
521 for (
unsigned int i=0;
i<ehdepth.size(); ++
i) {
525 double ene = ehdepth[
i].first;
530 <<
" with E = " << ene;
532 <<
" with " << ehdepth.size()
534 for (
const auto& ehd : ehdepth)
538 tmpC =
goodCell(hcid0, pTrack, geo, bField);
542 if (corr != 0) ene /=
corr;
549 int depth = ehdepth[
i].second - 1;
552 depth =
id.
depth() - 1;
554 eHcalDepth[
depth] += ene;
555 eHcalDepthC[
depth]+= enec;
556 activeL[
depth] += actL;
557 activeLengthTot += actL;
558 matchDepth[
depth] = (matchDepth[
depth] && tmpC);
562 << enec <<
" L " << actL
563 <<
" Match " << tmpC;
571 <<
" Depths " << ehdepth.size();
572 for (
unsigned int k=0;
k<ehdepth.size(); ++
k)
574 << ehdepth[
k].second <<
"] " 580 isHot =
matchId(closestCell,hotCell);
586 std::vector<std::pair<double,int> > ehdepth;
587 spr::energyHCALCell(hotCell, hbhe, ehdepth,
maxDepth_, -100.0, -100.0, -100.0, -100.0, -500.0, 500.0,
useRaw_,
depth16HE(ieta,iphi),
false);
589 for (
unsigned int i=0;
i<ehdepth.size(); ++
i) {
593 double ene = ehdepth[
i].first;
598 <<
" with E = " << ene;
600 <<
" with " << ehdepth.size()
602 for (
const auto& ehd : ehdepth)
606 tmpC =
goodCell(hcid0, pTrack, geo, bField);
607 double chg(ene), enec(ene);
610 if (corr != 0) ene /=
corr;
614 <<
" Corr " << corr <<
" E " 615 << ene <<
":" << enec;
626 int depth = ehdepth[
i].second - 1;
629 depth =
id.
depth() - 1;
631 eHcalDepthHot[
depth] += ene;
632 eHcalDepthHotC[
depth] += enec;
634 activeHotL[
depth] += actL;
635 activeLengthHotTot += actL;
636 matchDepthHot[
depth] = (matchDepthHot[
depth] && tmpC);
640 <<
" E " << ene <<
":" << enec
641 <<
" C " <<
chg <<
" L " 642 << actL <<
" Match " << tmpC;
649 std::vector<std::pair<double,int> > ehdeptho;
650 spr::energyHCALCell(oppCell, hbhe, ehdeptho,
maxDepth_, -100.0, -100.0, -100.0, -100.0, -500.0, 500.0,
useRaw_,
depth16HE(-ieta,iphi),
false);
651 for (
unsigned int i=0;
i<ehdeptho.size(); ++
i) {
654 double ene = ehdeptho[
i].first;
658 <<
" with E = " << ene;
660 << ehdeptho.size() <<
" depths:";
661 for (
const auto& ehd : ehdeptho)
668 if (corr != 0) ene /=
corr;
672 <<
" Corr " << corr <<
" E " 674 << ehdeptho[
i].first;
679 if (gain != 0) chg /=
gain;
685 int depth = ehdeptho[
i].second - 1;
688 depth =
id.
depth() - 1;
694 <<
" E " << ene <<
" C " 704 << trackID.
okHCAL <<
" Match " << tmpmatch
705 <<
" Hot " << isHot <<
" Energy " 706 << eHcal << std::endl;
820 sprintf (name,
"hcal_edepth%d", (
k+1));
822 sprintf (name,
"hcal_activeL%d", (k+1));
824 sprintf (name,
"hcal_edepthHot%d", (k+1));
826 sprintf (name,
"hcal_activeHotL%d", (k+1));
828 sprintf (name,
"hcal_cdepthHot%d", (k+1));
830 sprintf (name,
"hcal_cdepthHotBG%d", (k+1));
832 sprintf (name,
"hcal_edepthCorrect%d", (k+1));
834 sprintf (name,
"hcal_edepthHotCorrect%d", (k+1));
836 sprintf (name,
"hcal_depthMatch%d", (k+1));
838 sprintf (name,
"hcal_depthMatchHot%d", (k+1));
860 unsigned int k1(0), k2(0);
862 for (
const auto& act :
actHB) {
864 <<
" depth " << act.depth <<
" zside " 865 << act.zside <<
" type " << act.stype
866 <<
" phi " << act.iphis.size() <<
":" 867 << act.iphis[0] <<
" L " << act.thick;
875 for (
const auto& act :
actHE) {
877 <<
" depth " << act.depth <<
" zside " 878 << act.zside <<
" type " << act.stype
879 <<
" phi " << act.iphis.size() <<
":" 880 << act.iphis[0] <<
" L " << act.thick;
895 <<
"HLT" <<
" successfully extracted" 899 for (
unsigned int t=0;
t<ntriggers;++
t) {
901 for (
unsigned int ik=0; ik<6; ++ik) {
911 edm::LogError(
"HBHEMuon") <<
"Error! HLT config extraction with process " 912 <<
"name HLT failed";
932 << iRun.
run() <<
"\n";
933 for (
auto const&
id: ids) {
952 std::vector<std::string> trig = {
"HLT_IsoMu17",
"HLT_IsoMu20",
953 "HLT_IsoMu24",
"HLT_IsoMu27",
954 "HLT_Mu45",
"HLT_Mu50"};
955 desc.
add<std::vector<std::string>>(
"triggers",trig);
957 desc.
add<
int>(
"useRaw",0);
958 desc.
add<
bool>(
"unCorrect",
false);
959 desc.
add<
bool>(
"getCharge",
false);
960 desc.
add<
bool>(
"collapseDepth",
false);
961 desc.
add<
bool>(
"isItPlan1",
false);
969 descriptions.
add(
"hcalHBHEMuon",desc);
1059 int match = ((kd1 == kd2) ? 1 : 0);
1065 int ieta =
id.ietaAbs();
1066 int zside=
id.zside();
1067 int iphi =
id.iphi();
1068 std::vector<int> dpths;
1070 std::vector<HcalDetId>
ids;
1072 for (
auto idh : ids)
1073 dpths.emplace_back(idh.depth());
1075 dpths.emplace_back(
id.
depth());
1079 for (
unsigned int i=0;
i<
actHB.size(); ++
i) {
1080 if ((ieta ==
actHB[
i].ieta) && (zside ==
actHB[
i].zside) &&
1081 (
std::find(dpths.begin(),dpths.end(),
actHB[
i].depth) != dpths.end())&&
1088 for (
unsigned int i=0;
i<
actHE.size(); ++
i) {
1089 if ((ieta ==
actHE[
i].ieta) && (zside ==
actHE[
i].zside) &&
1090 (
std::find(dpths.begin(),dpths.end(),
actHE[
i].depth) != dpths.end())&&
1101 if (vtx.
isFake())
return false;
1102 if (vtx.
ndof() < 4)
return false;
1103 if (vtx.
position().Rho() > 2.)
return false;
1104 if (fabs(vtx.
position().Z()) > 24.)
return false;
1112 if (itr !=
corrValue_.end()) cfac = itr->second;
1122 for (
int capid=0; capid<4; ++capid)
1131 int zside = (ieta > 0) ? 1 : -1;
1137 <<
" depth " <<
depth;
1147 std::pair<double,double> rz =
hdc_->
getRZ(hcid);
unsigned int size() const
number of trigger paths in trigger table
static const std::string kSharedResource
std::vector< double > tight_validFraction_
std::vector< int > hltresults_
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
EventNumber_t event() const
std::vector< double > innerTrackphi_
HcalHBHEMuonAnalyzer(const edm::ParameterSet &)
const std::string labelMuon_
T getUntrackedParameter(std::string const &, T const &) 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 HcalTopology * theHBHETopology_
const HcalDDDRecConstants * dddConstants() const
unsigned int eventNumber_
std::vector< std::string > all_triggers_
std::vector< double > dzTracker_
static const int depthMax_
HcalSubdetector subdet() const
get the subdetector
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void analyze(edm::Event const &, edm::EventSetup const &) override
const std::string & triggerName(unsigned int triggerIndex) const
std::vector< double > outerTrackChi_
bool isMediumMuon(const reco::Muon &, bool run2016_hip_mitigation=false)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
HcalDetId mergedDepthDetId(const HcalDetId &id) const
std::vector< double > hcalDepthChargeHotBG_[depthMax_]
std::vector< double > tight_LongPara_
#define DEFINE_FWK_MODULE(type)
std::pair< math::XYZPoint, bool > propagateHCAL(const reco::Track *, const MagneticField *, bool debug=false)
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
std::vector< unsigned int > ecalDetId_
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< double > pMuon_
bool accept() const
Has at least one path accepted the event?
std::vector< double > globalTrckPhi_
constexpr uint32_t rawId() const
get the raw id
std::vector< bool > muon_is_tight_
int bunchCrossing() const
double respCorr(const DetId &id)
T * make(const Args &...args) const
make new ROOT object
const Item * getValues(DetId fId, bool throwOnFail=true) const
std::vector< HcalDDDRecConstants::HcalActiveLength > actHE
bool validHcal(const HcalDetId &id) const
const edm::InputTag hlTriggerResults_
std::vector< double > isolationR03_
std::vector< int > outerTrackHits_
const bool writeRespCorr_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
LuminosityBlockNumber_t luminosityBlock() const
const Point & position() const
position
double gainFactor(const edm::ESHandle< HcalDbService > &, const HcalDetId &id)
std::vector< bool > muon_global_
edm::EDGetTokenT< edm::TriggerResults > tok_trigRes_
std::vector< float > muon_trkKink
std::vector< double > hcalDepthEnergy_[depthMax_]
const edm::InputTag labelEERecHit_
std::vector< double > outerTrackPt_
std::map< DetId, double > corrValue_
U second(std::pair< T, U > const &p)
const edm::InputTag labelEBRecHit_
edm::EDGetTokenT< reco::VertexCollection > tok_Vtx_
void beginRun(edm::Run const &, edm::EventSetup const &) override
std::vector< double > globalTrckPt_
int depth() const
get the tower depth
std::vector< int > tight_PixelHits_
std::vector< bool > muon_tracker_
std::vector< double > ecalEnergy_
unsigned int triggerIndex(std::string const &name) const
std::vector< int > numPixelLayers_
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)
std::vector< double > hcalActiveLengthHot_
std::vector< double > innerTracketa_
const bool isItPreRecHit_
std::vector< double > globalTrckEta_
std::vector< double > isolationR04_
unsigned int size() const
Get number of paths stored.
std::vector< double > hcalDepthActiveLengthHot_[depthMax_]
std::vector< double > hcalDepthEnergyHotCorr_[depthMax_]
int getMinDepth(const int &itype, const int &ieta, const int &iphi, const int &zside) const
double getRZ(const int &subdet, const int &ieta, const int &depth) const
std::vector< double > ptGlob_
std::vector< unsigned int > ehcalDetId_
int ieta() const
get the cell ieta
Abs< T >::type abs(const T &t)
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
std::vector< double > hcalEnergy_
std::vector< int > hcal_iphi_
const std::string labelVtx_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< double > outerTrackEta_
double activeLength(const DetId &)
std::vector< bool > globalTrack_
std::vector< double > hcal1x1Energy_
edm::EDGetTokenT< reco::MuonCollection > tok_Muon_
bool goodCell(const HcalDetId &hcid, const reco::Track *pTrack, const CaloGeometry *geo, const MagneticField *bField)
std::vector< int > outerTrackRHits_
std::vector< bool > hcalHot_
const edm::InputTag labelHBHERecHit_
std::vector< bool > muon_is_good_
int iphi() const
get the cell iphi
std::vector< double > chiGlobal_
std::vector< HcalDDDRecConstants::HcalActiveLength > actHB
std::vector< float > muon_segComp
int depth16HE(int ieta, int iphi)
std::vector< unsigned int > hcalDetId_
std::vector< double > hcalDepthEnergyHot_[depthMax_]
std::vector< int > matchedStat_
std::vector< bool > matchedId_
void endRun(edm::Run const &, edm::EventSetup const &) override
XYZPointD XYZPoint
point in space with cartesian internal representation
std::vector< double > hcalDepthEnergyCorr_[depthMax_]
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< int > hcal_ieta_
std::vector< double > hcalDepthActiveLength_[depthMax_]
std::vector< double > hoEnergy_
int matchId(const HcalDetId &, const HcalDetId &)
HcalRespCorrs * respCorrs_
const HcalDDDRecConstants * hdc_
std::vector< double > phiGlob_
HLTConfigProvider hltConfig_
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
std::vector< bool > muon_is_medium_
std::vector< int > globalMuonHits_
std::vector< double > hcalActiveLength_
std::vector< double > chiTracker_
std::vector< double > hcalDepthChargeHot_[depthMax_]
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
std::vector< bool > hcalDepthMatchHot_[depthMax_]
std::vector< HcalActiveLength > getThickActive(const int &type) const
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
std::vector< int > trackerLayer_
const bool collapseDepth_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< bool > outerTrack_
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
edm::EDGetTokenT< HBHERecHitCollection > tok_HBHE_
const std::string fileInCorr_
edm::Service< TFileService > fs
T const * product() const
std::vector< double > dxyTracker_
void energyHCALCell(HcalDetId detId, edm::Handle< T > &hits, std::vector< std::pair< double, int > > &energyCell, int maxDepth=1, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100, double tMin=-500, double tMax=500, int useRaw=0, int depthHE=3, bool debug=false)
constexpr double respcorrgain(int fCapId) const
get response corrected gain for capid=0..3
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
std::vector< double > ecal3x3Energy_
void setTopo(const HcalTopology *topo)
std::vector< double > tight_TransImpara_
const std::vector< std::string > triggers_
std::vector< double > energyMuon_
std::vector< double > etaGlob_
bool isGoodVertex(const reco::Vertex &vtx)
std::vector< double > outerTrackPhi_
std::vector< double > innerTrackpt_
std::vector< bool > innerTrack_
std::vector< bool > hcalDepthMatch_[depthMax_]
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)
std::vector< float > muon_chi2LocalPosition