143 std::vector<HcalDDDRecConstants::HcalActiveLength>
actHB,
actHE;
177 else if (maxDepth_ < 1) maxDepth_ = 4;
193 <<
" Vtx " << labelVtx_ <<
" EB " 194 << labelEBRecHit_ <<
" EE " 195 << labelEERecHit_ <<
" HBHE " 202 <<
"\n EB " << labelEBRecHit_
203 <<
"\n EE " << labelEERecHit_
204 <<
"\n HBHE " << labelHBHERecHit_
208 if (fileInCorr_ !=
"") {
209 std::ifstream infile(fileInCorr_.c_str());
210 if (infile.is_open()) {
214 infile >>
id >> cfac;
215 if (!infile.good())
break;
223 <<
" GetCharge " << getCharge_ <<
" UnCorrect " 224 << unCorrect_ <<
" IgnoreHECorr " 225 << ignoreHECorr_ <<
" CollapseDepth " 226 << collapseDepth_ <<
":" << mergedDepth_
227 <<
" IsItPlan1 " << isItPlan1_
228 <<
" IsItPreRecHit " << isItPreRecHit_
264 std::vector<int>
index;
265 for (
int i=0;
i<Ntriggers;
i++) {
267 int triggerSize =
int( _Triggers->
size());
271 <<
"\ntriggerSize " << triggerSize
274 if (index[i] < triggerSize) {
279 <<
" triggerSize " << index[
i]
281 <<
" hltresult" << std::endl;
286 <<
"\" does not exist\n";
335 reco::VertexCollection::const_iterator firstGoodVertex = vtx->end();
336 for (reco::VertexCollection::const_iterator it = vtx->begin();
337 it != firstGoodVertex; it++) {
339 firstGoodVertex = it;
343 if (firstGoodVertex != vtx->end()) {
344 pvx = firstGoodVertex->position();
364 for (reco::MuonCollection::const_iterator RecMuon = _Muon->begin(); RecMuon!= _Muon->end(); ++RecMuon) {
366 if ((RecMuon->p()>10.0) && (RecMuon->track().isNonnull())) accept =
true;
375 pMuon_.push_back(RecMuon->p());
378 << RecMuon->p() << std::endl;
380 muon_trkKink.push_back(RecMuon->combinedQuality().trkKink);
384 if (RecMuon->track().isNonnull()) {
385 trackerLayer_.push_back(RecMuon->track()->hitPattern().trackerLayersWithMeasurement());
389 if (RecMuon->innerTrack().isNonnull()) {
391 numPixelLayers_.push_back(RecMuon->innerTrack()->hitPattern().pixelLayersWithMeasurement());
392 chiTracker_.push_back(RecMuon->innerTrack()->normalizedChi2());
393 dxyTracker_.push_back(fabs(RecMuon->innerTrack()->dxy(pvx)));
394 dzTracker_.push_back(fabs(RecMuon->innerTrack()->dz(pvx)));
398 tight_PixelHits_.push_back(RecMuon->innerTrack()->hitPattern().numberOfValidPixelHits());
413 if (RecMuon->outerTrack().isNonnull()) {
418 outerTrackChi_.push_back(RecMuon->outerTrack()->normalizedChi2());
431 if (RecMuon->globalTrack().isNonnull()) {
433 chiGlobal_.push_back(RecMuon->globalTrack()->normalizedChi2());
434 globalMuonHits_.push_back(RecMuon->globalTrack()->hitPattern().numberOfValidMuonHits());
435 matchedStat_.push_back(RecMuon->numberOfMatchedStations());
453 isolationR04_.push_back(((RecMuon->pfIsolationR04().sumChargedHadronPt +
std::max(0.,RecMuon->pfIsolationR04().sumNeutralHadronEt + RecMuon->pfIsolationR04().sumPhotonEt - (0.5 *RecMuon->pfIsolationR04().sumPUPt))) / RecMuon->pt()) );
455 isolationR03_.push_back(((RecMuon->pfIsolationR03().sumChargedHadronPt +
std::max(0.,RecMuon->pfIsolationR03().sumNeutralHadronEt + RecMuon->pfIsolationR03().sumPhotonEt - (0.5 * RecMuon->pfIsolationR03().sumPUPt))) / RecMuon->pt()));
459 hoEnergy_.push_back(RecMuon->calEnergy().hoS9);
461 double eEcal(0), eHcal(0), activeLengthTot(0), activeLengthHotTot(0);
467 unsigned int isHot(0);
468 bool tmpmatch(
false);
470 eHcalDepth[
i] = eHcalDepthHot[
i] = 0;
471 eHcalDepthC[
i] = eHcalDepthHotC[
i] = 0;
472 cHcalDepthHot[
i] = cHcalDepthHotBG[
i]= 0;
473 activeL[
i] = activeHotL[
i] = 0;
475 if (RecMuon->innerTrack().isNonnull()) {
476 const reco::Track* pTrack = (RecMuon->innerTrack()).
get();
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 " 499 << eEcal << std::endl;
505 if ((hcidt.ieta() == check.
ieta()) && (hcidt.iphi() == check.
iphi()))
509 int ieta = hcidt.ieta();
510 int iphi = hcidt.iphi();
511 bool hborhe = (
std::abs(ieta) == 16);
513 eHcal =
spr::eHCALmatrix(
theHBHETopology_, closestCell, hbhe,0,0,
false,
true, -100.0, -100.0, -100.0, -100.0, -500.,500.,
useRaw_);
514 std::vector<std::pair<double,int> > ehdepth;
515 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));
517 for (
unsigned int i=0;
i<ehdepth.size(); ++
i) {
521 double ene = ehdepth[
i].first;
525 <<
" with E = " << ene;
527 <<
" with " << ehdepth.size()
529 for (
const auto& ehd : ehdepth)
536 if (corr != 0) ene /=
corr;
543 int depth = ehdepth[
i].second - 1;
546 depth =
id.
depth() - 1;
548 eHcalDepth[
depth] += ene;
549 eHcalDepthC[
depth]+= enec;
550 activeL[
depth] += actL;
551 activeLengthTot += actL;
555 << enec <<
" L " << actL;
563 isHot =
matchId(closestCell,hotCell);
569 std::vector<std::pair<double,int> > ehdepth;
570 spr::energyHCALCell(hotCell, hbhe, ehdepth,
maxDepth_, -100.0, -100.0, -100.0, -100.0, -500.0, 500.0,
useRaw_,
depth16HE(ieta,iphi),
false);
572 for (
unsigned int i=0;
i<ehdepth.size(); ++
i) {
576 double ene = ehdepth[
i].first;
580 <<
" with E = " << ene;
582 <<
" with " << ehdepth.size()
584 for (
const auto& ehd : ehdepth)
588 double chg(ene), enec(ene);
595 <<
" Corr " << corr <<
" E " 596 << ene <<
":" << enec;
607 int depth = ehdepth[
i].second - 1;
610 depth =
id.
depth() - 1;
612 eHcalDepthHot[
depth] += ene;
613 eHcalDepthHotC[
depth] += enec;
615 activeHotL[
depth] += actL;
616 activeLengthHotTot += actL;
620 <<
" E " << ene <<
":" << enec
621 <<
" C " <<
chg <<
" L " 629 std::vector<std::pair<double,int> > ehdeptho;
630 spr::energyHCALCell(oppCell, hbhe, ehdeptho,
maxDepth_, -100.0, -100.0, -100.0, -100.0, -500.0, 500.0,
useRaw_,
depth16HE(-ieta,iphi),
false);
631 for (
unsigned int i=0;
i<ehdeptho.size(); ++
i) {
634 double ene = ehdeptho[
i].first;
638 <<
" with E = " << ene;
640 << ehdeptho.size() <<
" depths:";
641 for (
const auto& ehd : ehdeptho)
648 if (corr != 0) {ene /=
corr; chg /=
corr;}
652 <<
" Corr " << corr <<
" E " 654 << ehdeptho[
i].first;
659 if (gain != 0) chg /=
gain;
665 int depth = ehdeptho[
i].second - 1;
668 depth =
id.
depth() - 1;
674 <<
" E " << ene <<
" C " 684 << trackID.
okHCAL <<
" Match " << tmpmatch
685 <<
" Hot " << isHot <<
" Energy " 686 << eHcal << std::endl;
713 if (accept)
tree_->Fill();
741 sprintf (name,
"hcal_edepth%d", (
k+1));
743 sprintf (name,
"hcal_activeL%d", (k+1));
745 sprintf (name,
"hcal_edepthHot%d", (k+1));
747 sprintf (name,
"hcal_activeHotL%d", (k+1));
749 sprintf (name,
"hcal_edepthCorrect%d", (k+1));
751 sprintf (name,
"hcal_edepthHotCorrect%d", (k+1));
753 sprintf (name,
"hcal_cdepthHot%d", (k+1));
755 sprintf (name,
"hcal_cdepthHotBG%d", (k+1));
821 unsigned int k1(0), k2(0);
823 for (
const auto& act :
actHB) {
825 <<
" depth " << act.depth <<
" zside " 826 << act.zside <<
" type " << act.stype
827 <<
" phi " << act.iphis.size() <<
":" 828 << act.iphis[0] <<
" L " << act.thick;
836 for (
const auto& act :
actHE) {
838 <<
" depth " << act.depth <<
" zside " 839 << act.zside <<
" type " << act.stype
840 <<
" phi " << act.iphis.size() <<
":" 841 << act.iphis[0] <<
" L " << act.thick;
856 <<
"HLT" <<
" successfully extracted" 860 for (
unsigned int t=0;
t<ntriggers;++
t) {
862 for (
unsigned int ik=0; ik<6; ++ik) {
872 edm::LogError(
"HBHEMuon") <<
"Error! HLT config extraction with process name " 873 <<
"HLT" <<
" failed";
893 << iRun.
run() <<
"\n";
894 for (
auto const&
id: ids) {
915 std::vector<std::string> trig = {
"HLT_IsoMu17",
"HLT_IsoMu20",
916 "HLT_IsoMu24",
"HLT_IsoMu27",
917 "HLT_Mu45",
"HLT_Mu50"};
918 desc.
add<std::vector<std::string>>(
"Triggers",trig);
919 desc.
add<
bool>(
"UseRaw",
false);
920 desc.
add<
bool>(
"UnCorrect",
false);
921 desc.
add<
bool>(
"GetCharge",
false);
922 desc.
add<
bool>(
"CollapseDepth",
false);
923 desc.
add<
bool>(
"IsItPlan1",
false);
932 descriptions.
add(
"hcalHBHEMuon",desc);
1010 int match = ((kd1 == kd2) ? 1 : 0);
1016 int ieta =
id.ietaAbs();
1017 int zside=
id.zside();
1018 int iphi =
id.iphi();
1019 std::vector<int> dpths;
1021 std::vector<HcalDetId>
ids;
1023 for (
auto idh : ids)
1024 dpths.emplace_back(idh.depth());
1026 dpths.emplace_back(
id.
depth());
1030 for (
unsigned int i=0;
i<
actHB.size(); ++
i) {
1031 if ((ieta ==
actHB[
i].ieta) && (zside ==
actHB[
i].zside) &&
1032 (
std::find(dpths.begin(),dpths.end(),
actHB[
i].depth) != dpths.end())&&
1039 for (
unsigned int i=0;
i<
actHE.size(); ++
i) {
1040 if ((ieta ==
actHE[
i].ieta) && (zside ==
actHE[
i].zside) &&
1041 (
std::find(dpths.begin(),dpths.end(),
actHE[
i].depth) != dpths.end())&&
1052 if (vtx.
isFake())
return false;
1053 if (vtx.
ndof() < 4)
return false;
1054 if (vtx.
position().Rho() > 2.)
return false;
1055 if (fabs(vtx.
position().Z()) > 24.)
return false;
1063 if (itr !=
corrValue_.end()) cfac = itr->second;
1073 for (
int capid=0; capid<4; ++capid)
1082 int zside = (ieta > 0) ? 1 : -1;
1088 <<
" depth " <<
depth;
unsigned int size() const
number of trigger paths in trigger table
static const std::string kSharedResource
std::vector< double > tight_validFraction_
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< double > hcalHot_
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 > muon_chi2LocalPosition
std::vector< double > outerTrackChi_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< double > matchedStat_
HcalDetId mergedDepthDetId(const HcalDetId &id) const
std::vector< double > hcalDepthChargeHotBG_[depthMax_]
std::vector< double > tight_LongPara_
#define DEFINE_FWK_MODULE(type)
std::vector< double > muon_trkKink
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_
std::vector< double > outerTrackHits_
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_
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< 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< bool > muon_tracker_
std::vector< double > ecalEnergy_
unsigned int triggerIndex(std::string const &name) const
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
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)
std::vector< double > tight_PixelHits_
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
std::vector< double > hcalEnergy_
std::vector< double > trackerLayer_
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 > outerTrackRHits_
std::vector< double > hcal1x1Energy_
edm::EDGetTokenT< reco::MuonCollection > tok_Muon_
std::vector< bool > muon_is_good_
int iphi() const
get the cell iphi
std::vector< double > chiGlobal_
std::vector< HcalDDDRecConstants::HcalActiveLength > actHB
int depth16HE(int ieta, int iphi)
std::vector< unsigned int > hcalDetId_
std::vector< double > hcalDepthEnergyHot_[depthMax_]
edm::InputTag labelHBHERecHit_
void endRun(edm::Run const &, edm::EventSetup const &) override
std::vector< int > hltresults
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
std::vector< std::string > all_triggers
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< double > globalMuonHits_
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< double > hcalActiveLength_
std::vector< double > chiTracker_
std::vector< double > hcalDepthChargeHot_[depthMax_]
std::vector< double > matchedId_
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
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.
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< bool > outerTrack_
std::vector< double > muon_segComp
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
std::vector< double > numPixelLayers_
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_
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)