157 std::vector<HcalDDDRecConstants::HcalActiveLength>
actHB,
actHE;
186 else if (maxDepth_ < 1) maxDepth_ = 4;
202 <<
" Vtx " << labelVtx_ <<
" EB " 203 << labelEBRecHit_ <<
" EE " 204 << labelEERecHit_ <<
" HBHE " 211 <<
"\n EB " << labelEBRecHit_
212 <<
"\n EE " << labelEERecHit_
213 <<
"\n HBHE " << labelHBHERecHit_
217 if (fileInCorr_ !=
"") {
218 std::ifstream infile(fileInCorr_.c_str());
219 if (infile.is_open()) {
223 infile >>
id >> cfac;
224 if (!infile.good())
break;
232 <<
" GetCharge " << getCharge_ <<
" UnCorrect " 233 << unCorrect_ <<
" IgnoreHECorr " 234 << ignoreHECorr_ <<
" CollapseDepth " 235 << collapseDepth_ <<
":" << mergedDepth_
236 <<
" IsItPlan1 " << isItPlan1_
237 <<
" IsItPreRecHit " << isItPreRecHit_
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";
345 reco::VertexCollection::const_iterator firstGoodVertex = vtx->end();
346 for (reco::VertexCollection::const_iterator it = vtx->begin();
347 it != vtx->end(); it++) {
349 if (firstGoodVertex == vtx->end()) firstGoodVertex = it;
353 if (firstGoodVertex != vtx->end()) {
354 pvx = firstGoodVertex->position();
374 for (reco::MuonCollection::const_iterator RecMuon = _Muon->begin(); RecMuon!= _Muon->end(); ++RecMuon) {
383 pMuon_.push_back(RecMuon->p());
386 << RecMuon->p() << std::endl;
388 muon_trkKink.push_back(RecMuon->combinedQuality().trkKink);
392 if (RecMuon->track().isNonnull()) {
393 trackerLayer_.push_back(RecMuon->track()->hitPattern().trackerLayersWithMeasurement());
397 if (RecMuon->innerTrack().isNonnull()) {
399 numPixelLayers_.push_back(RecMuon->innerTrack()->hitPattern().pixelLayersWithMeasurement());
400 chiTracker_.push_back(RecMuon->innerTrack()->normalizedChi2());
401 dxyTracker_.push_back(fabs(RecMuon->innerTrack()->dxy(pvx)));
402 dzTracker_.push_back(fabs(RecMuon->innerTrack()->dz(pvx)));
406 tight_PixelHits_.push_back(RecMuon->innerTrack()->hitPattern().numberOfValidPixelHits());
421 if (RecMuon->outerTrack().isNonnull()) {
426 outerTrackChi_.push_back(RecMuon->outerTrack()->normalizedChi2());
439 if (RecMuon->globalTrack().isNonnull()) {
441 chiGlobal_.push_back(RecMuon->globalTrack()->normalizedChi2());
442 globalMuonHits_.push_back(RecMuon->globalTrack()->hitPattern().numberOfValidMuonHits());
443 matchedStat_.push_back(RecMuon->numberOfMatchedStations());
461 isolationR04_.push_back(((RecMuon->pfIsolationR04().sumChargedHadronPt +
std::max(0.,RecMuon->pfIsolationR04().sumNeutralHadronEt + RecMuon->pfIsolationR04().sumPhotonEt - (0.5 *RecMuon->pfIsolationR04().sumPUPt))) / RecMuon->pt()) );
463 isolationR03_.push_back(((RecMuon->pfIsolationR03().sumChargedHadronPt +
std::max(0.,RecMuon->pfIsolationR03().sumNeutralHadronEt + RecMuon->pfIsolationR03().sumPhotonEt - (0.5 * RecMuon->pfIsolationR03().sumPUPt))) / RecMuon->pt()));
467 hoEnergy_.push_back(RecMuon->calEnergy().hoS9);
469 double eEcal(0), eHcal(0), activeLengthTot(0), activeLengthHotTot(0);
476 unsigned int isHot(0);
477 bool tmpmatch(
false);
479 eHcalDepth[
i] = eHcalDepthHot[
i] = 0;
480 eHcalDepthC[
i] = eHcalDepthHotC[
i] = 0;
481 cHcalDepthHot[
i] = cHcalDepthHotBG[
i]= 0;
482 activeL[
i] = activeHotL[
i] = 0;
483 matchDepth[
i] = matchDepthHot[
i] =
true;
485 if (RecMuon->innerTrack().isNonnull()) {
486 const reco::Track* pTrack = (RecMuon->innerTrack()).
get();
488 if ((RecMuon->p()>10.0) && (trackID.
okHCAL)) accept =
true;
500 bool okE = trackID.
okECAL;
503 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);
509 <<
":" << trackID.
okECAL <<
" E " <<eEcal;
515 if ((hcidt.ieta() == check.
ieta()) && (hcidt.iphi() == check.
iphi()))
519 << info.first <<
":" << check
520 <<
" Match " << tmpmatch;
524 int ieta = hcidt.ieta();
525 int iphi = hcidt.iphi();
526 bool hborhe = (
std::abs(ieta) == 16);
528 eHcal =
spr::eHCALmatrix(
theHBHETopology_, closestCell, hbhe,0,0,
false,
true, -100.0, -100.0, -100.0, -100.0, -500.,500.,
useRaw_);
529 std::vector<std::pair<double,int> > ehdepth;
530 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));
532 for (
unsigned int i=0;
i<ehdepth.size(); ++
i) {
536 double ene = ehdepth[
i].first;
541 <<
" with E = " << ene;
543 <<
" with " << ehdepth.size()
545 for (
const auto& ehd : ehdepth)
549 tmpC =
goodCell(hcid0, pTrack, geo, bField);
553 if (corr != 0) ene /=
corr;
560 int depth = ehdepth[
i].second - 1;
563 depth =
id.
depth() - 1;
565 eHcalDepth[
depth] += ene;
566 eHcalDepthC[
depth]+= enec;
567 activeL[
depth] += actL;
568 activeLengthTot += actL;
569 matchDepth[
depth] = (matchDepth[
depth] && tmpC);
573 << enec <<
" L " << actL
574 <<
" Match " << tmpC;
581 std::cout << hcidt <<
" Match " << tmpmatch <<
" Depths " 583 for (
unsigned int k=0;
k<ehdepth.size(); ++
k)
590 isHot =
matchId(closestCell,hotCell);
596 std::vector<std::pair<double,int> > ehdepth;
597 spr::energyHCALCell(hotCell, hbhe, ehdepth,
maxDepth_, -100.0, -100.0, -100.0, -100.0, -500.0, 500.0,
useRaw_,
depth16HE(ieta,iphi),
false);
599 for (
unsigned int i=0;
i<ehdepth.size(); ++
i) {
603 double ene = ehdepth[
i].first;
608 <<
" with E = " << ene;
610 <<
" with " << ehdepth.size()
612 for (
const auto& ehd : ehdepth)
616 tmpC =
goodCell(hcid0, pTrack, geo, bField);
617 double chg(ene), enec(ene);
624 <<
" Corr " << corr <<
" E " 625 << ene <<
":" << enec;
636 int depth = ehdepth[
i].second - 1;
639 depth =
id.
depth() - 1;
641 eHcalDepthHot[
depth] += ene;
642 eHcalDepthHotC[
depth] += enec;
644 activeHotL[
depth] += actL;
645 activeLengthHotTot += actL;
646 matchDepthHot[
depth] = (matchDepthHot[
depth] && tmpC);
650 <<
" E " << ene <<
":" << enec
651 <<
" C " <<
chg <<
" L " 652 << actL <<
" Match " << tmpC;
659 std::vector<std::pair<double,int> > ehdeptho;
660 spr::energyHCALCell(oppCell, hbhe, ehdeptho,
maxDepth_, -100.0, -100.0, -100.0, -100.0, -500.0, 500.0,
useRaw_,
depth16HE(-ieta,iphi),
false);
661 for (
unsigned int i=0;
i<ehdeptho.size(); ++
i) {
664 double ene = ehdeptho[
i].first;
668 <<
" with E = " << ene;
670 << ehdeptho.size() <<
" depths:";
671 for (
const auto& ehd : ehdeptho)
678 if (corr != 0) {ene /=
corr; chg /=
corr;}
682 <<
" Corr " << corr <<
" E " 684 << ehdeptho[
i].first;
689 if (gain != 0) chg /=
gain;
695 int depth = ehdeptho[
i].second - 1;
698 depth =
id.
depth() - 1;
704 <<
" E " << ene <<
" C " 714 << trackID.
okHCAL <<
" Match " << tmpmatch
715 <<
" Hot " << isHot <<
" Energy " 716 << eHcal << std::endl;
745 if (accept)
tree_->Fill();
816 sprintf (name,
"hcal_edepth%d", (
k+1));
818 sprintf (name,
"hcal_activeL%d", (k+1));
820 sprintf (name,
"hcal_edepthHot%d", (k+1));
822 sprintf (name,
"hcal_activeHotL%d", (k+1));
824 sprintf (name,
"hcal_cdepthHot%d", (k+1));
826 sprintf (name,
"hcal_cdepthHotBG%d", (k+1));
828 sprintf (name,
"hcal_edepthCorrect%d", (k+1));
830 sprintf (name,
"hcal_edepthHotCorrect%d", (k+1));
832 sprintf (name,
"hcal_depthMatch%d", (k+1));
834 sprintf (name,
"hcal_depthMatchHot%d", (k+1));
856 unsigned int k1(0), k2(0);
858 for (
const auto& act :
actHB) {
860 <<
" depth " << act.depth <<
" zside " 861 << act.zside <<
" type " << act.stype
862 <<
" phi " << act.iphis.size() <<
":" 863 << act.iphis[0] <<
" L " << act.thick;
871 for (
const auto& act :
actHE) {
873 <<
" depth " << act.depth <<
" zside " 874 << act.zside <<
" type " << act.stype
875 <<
" phi " << act.iphis.size() <<
":" 876 << act.iphis[0] <<
" L " << act.thick;
891 <<
"HLT" <<
" successfully extracted" 895 for (
unsigned int t=0;
t<ntriggers;++
t) {
897 for (
unsigned int ik=0; ik<6; ++ik) {
907 edm::LogError(
"HBHEMuon") <<
"Error! HLT config extraction with process " 908 <<
"name HLT failed";
928 << iRun.
run() <<
"\n";
929 for (
auto const&
id: ids) {
950 std::vector<std::string> trig = {
"HLT_IsoMu17",
"HLT_IsoMu20",
951 "HLT_IsoMu24",
"HLT_IsoMu27",
952 "HLT_Mu45",
"HLT_Mu50"};
953 desc.
add<std::vector<std::string>>(
"Triggers",trig);
954 desc.
add<
bool>(
"UseRaw",
false);
955 desc.
add<
bool>(
"UnCorrect",
false);
956 desc.
add<
bool>(
"GetCharge",
false);
957 desc.
add<
bool>(
"CollapseDepth",
false);
958 desc.
add<
bool>(
"IsItPlan1",
false);
967 descriptions.
add(
"hcalHBHEMuon",desc);
1053 int match = ((kd1 == kd2) ? 1 : 0);
1059 int ieta =
id.ietaAbs();
1060 int zside=
id.zside();
1061 int iphi =
id.iphi();
1062 std::vector<int> dpths;
1064 std::vector<HcalDetId>
ids;
1066 for (
auto idh : ids)
1067 dpths.emplace_back(idh.depth());
1069 dpths.emplace_back(
id.
depth());
1073 for (
unsigned int i=0;
i<
actHB.size(); ++
i) {
1074 if ((ieta ==
actHB[
i].ieta) && (zside ==
actHB[
i].zside) &&
1075 (
std::find(dpths.begin(),dpths.end(),
actHB[
i].depth) != dpths.end())&&
1082 for (
unsigned int i=0;
i<
actHE.size(); ++
i) {
1083 if ((ieta ==
actHE[
i].ieta) && (zside ==
actHE[
i].zside) &&
1084 (
std::find(dpths.begin(),dpths.end(),
actHE[
i].depth) != dpths.end())&&
1095 if (vtx.
isFake())
return false;
1096 if (vtx.
ndof() < 4)
return false;
1097 if (vtx.
position().Rho() > 2.)
return false;
1098 if (fabs(vtx.
position().Z()) > 24.)
return false;
1106 if (itr !=
corrValue_.end()) cfac = itr->second;
1116 for (
int capid=0; capid<4; ++capid)
1125 int zside = (ieta > 0) ? 1 : -1;
1131 <<
" depth " <<
depth;
1141 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_
T getParameter(std::string const &) const
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 &)
T getUntrackedParameter(std::string const &, T const &) const
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< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, std::string &theTrackQuality, bool debug=false)
std::vector< std::string > 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
edm::InputTag HLTriggerResults_
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_
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, bool useRaw=false, bool debug=false)
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
std::vector< double > isolationR03_
std::vector< int > outerTrackHits_
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_]
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_
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_
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
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_
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
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, bool useRaw=false, int depthHE=3, bool debug=false)
Abs< T >::type abs(const T &t)
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
std::vector< double > hcalEnergy_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< double > outerTrackEta_
double activeLength(const DetId &)
std::vector< bool > globalTrack_
virtual void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
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_
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_]
edm::InputTag labelHBHERecHit_
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 &)
edm::InputTag labelEERecHit_
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_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< bool > outerTrack_
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
edm::EDGetTokenT< HBHERecHitCollection > tok_HBHE_
edm::Service< TFileService > fs
T const * product() const
std::vector< double > dxyTracker_
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
std::vector< double > ecal3x3Energy_
edm::InputTag labelEBRecHit_
void setTopo(const HcalTopology *topo)
std::vector< double > tight_TransImpara_
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)
std::vector< float > muon_chi2LocalPosition