157 std::vector<HcalDDDRecConstants::HcalActiveLength>
actHB,
actHE;
173 verbosity_(iConfig.getUntrackedParameter<
int>(
"verbosity",0)),
199 if (modnam.empty()) {
220 if (infile.is_open()) {
224 infile >>
id >> cfac;
225 if (!infile.good())
break;
233 <<
" GetCharge " <<
getCharge_ <<
" UnCorrect " 274 std::vector<int>
index;
275 for (
int i=0;
i<Ntriggers;
i++) {
277 int triggerSize =
int( _Triggers->
size());
281 <<
"\ntriggerSize " << triggerSize
284 if (index[i] < triggerSize) {
289 <<
" triggerSize " << index[
i]
291 <<
" hltresult" << std::endl;
296 <<
"\" does not exist\n";
346 reco::VertexCollection::const_iterator firstGoodVertex = vtx->end();
347 for (reco::VertexCollection::const_iterator it = vtx->begin();
348 it != vtx->end(); it++) {
350 if (firstGoodVertex == vtx->end()) firstGoodVertex = it;
354 if (firstGoodVertex != vtx->end()) {
355 pvx = firstGoodVertex->position();
375 for (reco::MuonCollection::const_iterator RecMuon = _Muon->begin(); RecMuon!= _Muon->end(); ++RecMuon) {
384 pMuon_.push_back(RecMuon->p());
387 << RecMuon->p() << std::endl;
389 muon_trkKink.push_back(RecMuon->combinedQuality().trkKink);
393 if (RecMuon->track().isNonnull()) {
394 trackerLayer_.push_back(RecMuon->track()->hitPattern().trackerLayersWithMeasurement());
398 if (RecMuon->innerTrack().isNonnull()) {
400 numPixelLayers_.push_back(RecMuon->innerTrack()->hitPattern().pixelLayersWithMeasurement());
401 chiTracker_.push_back(RecMuon->innerTrack()->normalizedChi2());
402 dxyTracker_.push_back(fabs(RecMuon->innerTrack()->dxy(pvx)));
403 dzTracker_.push_back(fabs(RecMuon->innerTrack()->dz(pvx)));
407 tight_PixelHits_.push_back(RecMuon->innerTrack()->hitPattern().numberOfValidPixelHits());
422 if (RecMuon->outerTrack().isNonnull()) {
427 outerTrackChi_.push_back(RecMuon->outerTrack()->normalizedChi2());
440 if (RecMuon->globalTrack().isNonnull()) {
442 chiGlobal_.push_back(RecMuon->globalTrack()->normalizedChi2());
443 globalMuonHits_.push_back(RecMuon->globalTrack()->hitPattern().numberOfValidMuonHits());
444 matchedStat_.push_back(RecMuon->numberOfMatchedStations());
462 isolationR04_.push_back(((RecMuon->pfIsolationR04().sumChargedHadronPt +
std::max(0.,RecMuon->pfIsolationR04().sumNeutralHadronEt + RecMuon->pfIsolationR04().sumPhotonEt - (0.5 *RecMuon->pfIsolationR04().sumPUPt))) / RecMuon->pt()) );
464 isolationR03_.push_back(((RecMuon->pfIsolationR03().sumChargedHadronPt +
std::max(0.,RecMuon->pfIsolationR03().sumNeutralHadronEt + RecMuon->pfIsolationR03().sumPhotonEt - (0.5 * RecMuon->pfIsolationR03().sumPUPt))) / RecMuon->pt()));
468 hoEnergy_.push_back(RecMuon->calEnergy().hoS9);
470 double eEcal(0), eHcal(0), activeLengthTot(0), activeLengthHotTot(0);
477 unsigned int isHot(0);
478 bool tmpmatch(
false);
480 eHcalDepth[
i] = eHcalDepthHot[
i] = 0;
481 eHcalDepthC[
i] = eHcalDepthHotC[
i] = 0;
482 cHcalDepthHot[
i] = cHcalDepthHotBG[
i]= 0;
483 activeL[
i] = activeHotL[
i] = 0;
484 matchDepth[
i] = matchDepthHot[
i] =
true;
486 if (RecMuon->innerTrack().isNonnull()) {
487 const reco::Track* pTrack = (RecMuon->innerTrack()).
get();
489 if ((RecMuon->p()>10.0) && (trackID.
okHCAL)) accept =
true;
501 bool okE = trackID.
okECAL;
504 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);
510 <<
":" << trackID.
okECAL <<
" E " <<eEcal;
516 if ((hcidt.ieta() == check.
ieta()) && (hcidt.iphi() == check.
iphi()))
520 << info.first <<
":" << check
521 <<
" Match " << tmpmatch;
525 int ieta = hcidt.ieta();
526 int iphi = hcidt.iphi();
527 bool hborhe = (
std::abs(ieta) == 16);
529 eHcal =
spr::eHCALmatrix(
theHBHETopology_, closestCell, hbhe,0,0,
false,
true, -100.0, -100.0, -100.0, -100.0, -500.,500.,
useRaw_);
530 std::vector<std::pair<double,int> > ehdepth;
531 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));
533 for (
unsigned int i=0;
i<ehdepth.size(); ++
i) {
537 double ene = ehdepth[
i].first;
542 <<
" with E = " << ene;
544 <<
" with " << ehdepth.size()
546 for (
const auto& ehd : ehdepth)
550 tmpC =
goodCell(hcid0, pTrack, geo, bField);
554 if (corr != 0) ene /=
corr;
561 int depth = ehdepth[
i].second - 1;
564 depth =
id.
depth() - 1;
566 eHcalDepth[
depth] += ene;
567 eHcalDepthC[
depth]+= enec;
568 activeL[
depth] += actL;
569 activeLengthTot += actL;
570 matchDepth[
depth] = (matchDepth[
depth] && tmpC);
574 << enec <<
" L " << actL
575 <<
" Match " << tmpC;
582 std::cout << hcidt <<
" Match " << tmpmatch <<
" Depths " 584 for (
unsigned int k=0;
k<ehdepth.size(); ++
k)
591 isHot =
matchId(closestCell,hotCell);
597 std::vector<std::pair<double,int> > ehdepth;
598 spr::energyHCALCell(hotCell, hbhe, ehdepth,
maxDepth_, -100.0, -100.0, -100.0, -100.0, -500.0, 500.0,
useRaw_,
depth16HE(ieta,iphi),
false);
600 for (
unsigned int i=0;
i<ehdepth.size(); ++
i) {
604 double ene = ehdepth[
i].first;
609 <<
" with E = " << ene;
611 <<
" with " << ehdepth.size()
613 for (
const auto& ehd : ehdepth)
617 tmpC =
goodCell(hcid0, pTrack, geo, bField);
618 double chg(ene), enec(ene);
621 if (corr != 0) ene /=
corr;
625 <<
" Corr " << corr <<
" E " 626 << ene <<
":" << enec;
637 int depth = ehdepth[
i].second - 1;
640 depth =
id.
depth() - 1;
642 eHcalDepthHot[
depth] += ene;
643 eHcalDepthHotC[
depth] += enec;
645 activeHotL[
depth] += actL;
646 activeLengthHotTot += actL;
647 matchDepthHot[
depth] = (matchDepthHot[
depth] && tmpC);
651 <<
" E " << ene <<
":" << enec
652 <<
" C " <<
chg <<
" L " 653 << actL <<
" Match " << tmpC;
660 std::vector<std::pair<double,int> > ehdeptho;
661 spr::energyHCALCell(oppCell, hbhe, ehdeptho,
maxDepth_, -100.0, -100.0, -100.0, -100.0, -500.0, 500.0,
useRaw_,
depth16HE(-ieta,iphi),
false);
662 for (
unsigned int i=0;
i<ehdeptho.size(); ++
i) {
665 double ene = ehdeptho[
i].first;
669 <<
" with E = " << ene;
671 << ehdeptho.size() <<
" depths:";
672 for (
const auto& ehd : ehdeptho)
679 if (corr != 0) ene /=
corr;
683 <<
" Corr " << corr <<
" E " 685 << ehdeptho[
i].first;
690 if (gain != 0) chg /=
gain;
696 int depth = ehdeptho[
i].second - 1;
699 depth =
id.
depth() - 1;
705 <<
" E " << ene <<
" C " 715 << trackID.
okHCAL <<
" Match " << tmpmatch
716 <<
" Hot " << isHot <<
" Energy " 717 << eHcal << std::endl;
746 if (accept)
tree_->Fill();
817 sprintf (name,
"hcal_edepth%d", (
k+1));
819 sprintf (name,
"hcal_activeL%d", (k+1));
821 sprintf (name,
"hcal_edepthHot%d", (k+1));
823 sprintf (name,
"hcal_activeHotL%d", (k+1));
825 sprintf (name,
"hcal_cdepthHot%d", (k+1));
827 sprintf (name,
"hcal_cdepthHotBG%d", (k+1));
829 sprintf (name,
"hcal_edepthCorrect%d", (k+1));
831 sprintf (name,
"hcal_edepthHotCorrect%d", (k+1));
833 sprintf (name,
"hcal_depthMatch%d", (k+1));
835 sprintf (name,
"hcal_depthMatchHot%d", (k+1));
857 unsigned int k1(0), k2(0);
859 for (
const auto& act :
actHB) {
861 <<
" depth " << act.depth <<
" zside " 862 << act.zside <<
" type " << act.stype
863 <<
" phi " << act.iphis.size() <<
":" 864 << act.iphis[0] <<
" L " << act.thick;
872 for (
const auto& act :
actHE) {
874 <<
" depth " << act.depth <<
" zside " 875 << act.zside <<
" type " << act.stype
876 <<
" phi " << act.iphis.size() <<
":" 877 << act.iphis[0] <<
" L " << act.thick;
892 <<
"HLT" <<
" successfully extracted" 896 for (
unsigned int t=0;
t<ntriggers;++
t) {
898 for (
unsigned int ik=0; ik<6; ++ik) {
908 edm::LogError(
"HBHEMuon") <<
"Error! HLT config extraction with process " 909 <<
"name HLT failed";
929 << iRun.
run() <<
"\n";
930 for (
auto const&
id: ids) {
951 std::vector<std::string> trig = {
"HLT_IsoMu17",
"HLT_IsoMu20",
952 "HLT_IsoMu24",
"HLT_IsoMu27",
953 "HLT_Mu45",
"HLT_Mu50"};
954 desc.
add<std::vector<std::string>>(
"triggers",trig);
956 desc.
add<
int>(
"useRaw",0);
957 desc.
add<
bool>(
"unCorrect",
false);
958 desc.
add<
bool>(
"getCharge",
false);
959 desc.
add<
bool>(
"collapseDepth",
false);
960 desc.
add<
bool>(
"isItPlan1",
false);
968 descriptions.
add(
"hcalHBHEMuon",desc);
1054 int match = ((kd1 == kd2) ? 1 : 0);
1060 int ieta =
id.ietaAbs();
1061 int zside=
id.zside();
1062 int iphi =
id.iphi();
1063 std::vector<int> dpths;
1065 std::vector<HcalDetId>
ids;
1067 for (
auto idh : ids)
1068 dpths.emplace_back(idh.depth());
1070 dpths.emplace_back(
id.
depth());
1074 for (
unsigned int i=0;
i<
actHB.size(); ++
i) {
1075 if ((ieta ==
actHB[
i].ieta) && (zside ==
actHB[
i].zside) &&
1076 (
std::find(dpths.begin(),dpths.end(),
actHB[
i].depth) != dpths.end())&&
1083 for (
unsigned int i=0;
i<
actHE.size(); ++
i) {
1084 if ((ieta ==
actHE[
i].ieta) && (zside ==
actHE[
i].zside) &&
1085 (
std::find(dpths.begin(),dpths.end(),
actHE[
i].depth) != dpths.end())&&
1096 if (vtx.
isFake())
return false;
1097 if (vtx.
ndof() < 4)
return false;
1098 if (vtx.
position().Rho() > 2.)
return false;
1099 if (fabs(vtx.
position().Z()) > 24.)
return false;
1107 if (itr !=
corrValue_.end()) cfac = itr->second;
1117 for (
int capid=0; capid<4; ++capid)
1126 int zside = (ieta > 0) ? 1 : -1;
1132 <<
" depth " <<
depth;
1142 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_
double respcorrgain(int fCapId) const
get response corrected gain for capid=0..3
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 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_
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_
uint32_t rawId() const
get the raw id
U second(std::pair< T, U > const &p)
edm::EDGetTokenT< reco::BeamSpot > tok_bs_
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_
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< 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< 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
const Point & position() const
position
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_
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_
const std::string labelBS_
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)
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