|
|
Go to the documentation of this file.
162 std::vector<HcalDDDRecConstants::HcalActiveLength>
actHB,
actHE;
168 : labelEBRecHit_(iConfig.getParameter<
edm::
InputTag>(
"labelEBRecHit")),
169 labelEERecHit_(iConfig.getParameter<
edm::
InputTag>(
"labelEERecHit")),
170 labelHBHERecHit_(iConfig.getParameter<
edm::
InputTag>(
"labelHBHERecHit")),
171 labelVtx_(iConfig.getParameter<
std::
string>(
"labelVertex")),
172 labelMuon_(iConfig.getParameter<
std::
string>(
"labelMuon")),
173 labelGenTrack_(iConfig.getParameter<
std::
string>(
"labelTrack")),
174 etaMin_(iConfig.getParameter<double>(
"etaMin")),
175 emaxNearPThr_(iConfig.getParameter<double>(
"emaxNearPThreshold")),
176 analyzeMuon_(iConfig.getParameter<
bool>(
"analyzeMuon")),
177 unCorrect_(iConfig.getParameter<
bool>(
"unCorrect")),
178 collapseDepth_(iConfig.getParameter<
bool>(
"collapseDepth")),
179 isItPlan1_(iConfig.getParameter<
bool>(
"isItPlan1")),
180 getCharge_(iConfig.getParameter<
bool>(
"getCharge")),
181 useRaw_(iConfig.getParameter<
int>(
"useRaw")),
182 verbosity_(iConfig.getParameter<
int>(
"verbosity")),
183 theTrackQuality_(iConfig.getUntrackedParameter<
std::
string>(
"trackQuality")),
184 fileInCorr_(iConfig.getUntrackedParameter<
std::
string>(
"fileInCorr",
"")),
185 ignoreHECorr_(iConfig.getUntrackedParameter<
bool>(
"ignoreHECorr",
false)),
186 isItPreRecHit_(iConfig.getUntrackedParameter<
bool>(
"isItPreRecHit",
false)),
187 writeRespCorr_(iConfig.getUntrackedParameter<
bool>(
"writeRespCorr",
false)),
189 theHBHETopology_(nullptr),
256 desc.
add<
double>(
"etaMin", 2.0);
257 desc.
add<
double>(
"emaxNearPThreshold", 10.0);
258 desc.
add<
bool>(
"analyzeMuon",
true);
259 desc.
add<
bool>(
"unCorrect",
false);
260 desc.
add<
bool>(
"collapseDepth",
false);
261 desc.
add<
bool>(
"isItPlan1",
false);
262 desc.
add<
bool>(
"getCharge",
false);
263 desc.
add<
int>(
"useRaw", 0);
264 desc.
add<
int>(
"verbosity", 0);
276 descriptions.
add(
"hcalHBHEMuonHighEta", desc);
282 tree_ = fs->
make<TTree>(
"HBHEMuonHighEta",
"HBHEMuonHighEta");
311 sprintf(
name,
"hcal_edepth%d", (
k + 1));
313 sprintf(
name,
"hcal_activeL%d", (
k + 1));
315 sprintf(
name,
"hcal_edepthHot%d", (
k + 1));
317 sprintf(
name,
"hcal_activeHotL%d", (
k + 1));
319 sprintf(
name,
"hcal_cdepthHot%d", (
k + 1));
321 sprintf(
name,
"hcal_cdepthHotBG%d", (
k + 1));
323 sprintf(
name,
"hcal_edepthCorrect%d", (
k + 1));
325 sprintf(
name,
"hcal_edepthHotCorrect%d", (
k + 1));
327 sprintf(
name,
"hcal_depthMatch%d", (
k + 1));
329 sprintf(
name,
"hcal_depthMatchHot%d", (
k + 1));
371 if (!
vtx.isValid()) {
378 reco::VertexCollection::const_iterator firstGoodVertex =
vtx->end();
379 for (reco::VertexCollection::const_iterator it =
vtx->begin(); it !=
vtx->end(); it++) {
381 if (firstGoodVertex ==
vtx->end())
382 firstGoodVertex = it;
386 if (firstGoodVertex !=
vtx->end())
387 pvx = firstGoodVertex->position();
419 <<
" Energy|Length|EnergyHot|LengthHot|Charge|ChargeBG|EnergyCorr|EnergyHotCorr|Match|MatchHot:"
442 unsigned int k1(0), k2(0);
444 for (
const auto& act :
actHB) {
445 edm::LogVerbatim(
"HBHEMuon") <<
"[" << k1 <<
"] ieta " << act.ieta <<
" depth " << act.depth <<
" zside "
446 << act.zside <<
" type " << act.stype <<
" phi " << act.iphis.size() <<
":"
447 << act.iphis[0] <<
" L " << act.thick;
454 for (
const auto& act :
actHE) {
455 edm::LogVerbatim(
"HBHEMuon") <<
"[" << k2 <<
"] ieta " << act.ieta <<
" depth " << act.depth <<
" zside "
456 << act.zside <<
" type " << act.stype <<
" phi " << act.iphis.size() <<
":"
457 << act.iphis[0] <<
" L " << act.thick;
482 edm::LogVerbatim(
"HBHEMuon") <<
"\nTable of Correction Factors for Run " << iRun.
run() <<
"\n";
483 for (
auto const&
id : ids) {
499 std::vector<spr::propagatedTrackID> trkCaloDets;
500 for (reco::MuonCollection::const_iterator RecMuon = _Muon->begin(); RecMuon != _Muon->end(); ++RecMuon) {
501 if (RecMuon->innerTrack().isNonnull()) {
504 if (
analyzeTracks(pTrack, leadPV, nTrack, trkCaloDets,
false)) {
507 etaGlob_.emplace_back(RecMuon->eta());
508 phiGlob_.emplace_back(RecMuon->phi());
510 pMuon_.emplace_back(RecMuon->p());
511 bool mediumMuon = (((RecMuon->isPFMuon()) && (RecMuon->isGlobalMuon() || RecMuon->isTrackerMuon())) &&
512 (RecMuon->innerTrack()->validFraction() > 0.49));
515 ((RecMuon->globalTrack().isNonnull()) ? RecMuon->globalTrack()->normalizedChi2() : 999);
517 (RecMuon->isGlobalMuon() && chiGlobal < 3 && RecMuon->combinedQuality().chi2LocalPosition < 12 &&
518 RecMuon->combinedQuality().trkKink < 20);
523 ((RecMuon->pfIsolationR03().sumChargedHadronPt +
525 RecMuon->pfIsolationR03().sumNeutralHadronEt + RecMuon->pfIsolationR03().sumPhotonEt -
526 (0.5 * RecMuon->pfIsolationR03().sumPUPt))) /
529 ((RecMuon->pfIsolationR04().sumChargedHadronPt +
531 RecMuon->pfIsolationR04().sumNeutralHadronEt + RecMuon->pfIsolationR04().sumPhotonEt -
532 (0.5 * RecMuon->pfIsolationR04().sumPUPt))) /
537 ecalEnergy_.emplace_back(RecMuon->calEnergy().emS9);
538 hcalEnergy_.emplace_back(RecMuon->calEnergy().hadS9);
539 hoEnergy_.emplace_back(RecMuon->calEnergy().hoS9);
563 if (!trkCollection.
isValid()) {
566 std::vector<spr::propagatedTrackID> trkCaloDets;
569 std::vector<spr::propagatedTrackID>::const_iterator trkDetItr;
570 for (trkDetItr = trkCaloDets.begin(), nTrack = 0; trkDetItr != trkCaloDets.end(); trkDetItr++, nTrack++) {
571 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
583 std::vector<spr::propagatedTrackID>& trkCaloDets,
597 double eEcal(0), eHcal(0), activeLengthTot(0), activeLengthHotTot(0);
604 unsigned int isHot(0);
605 bool tmpmatch(
false);
608 eHcalDepth[
i] = eHcalDepthHot[
i] = 0;
609 eHcalDepthC[
i] = eHcalDepthHotC[
i] = 0;
610 cHcalDepthHot[
i] = cHcalDepthHotBG[
i] = 0;
611 activeL[
i] = activeHotL[
i] = 0;
612 matchDepth[
i] = matchDepthHot[
i] =
true;
638 edm::LogVerbatim(
"HBHEMuon") <<
"Propagate Track to ECAL: " << e3x3.second <<
":" << trackID.
okECAL <<
" E "
644 if ((hcidt.ieta() ==
check.ieta()) && (hcidt.iphi() ==
check.iphi()))
671 std::vector<std::pair<double, int>> ehdepth;
687 for (
unsigned int i = 0;
i < ehdepth.size(); ++
i) {
692 double ene = ehdepth[
i].first;
696 edm::LogWarning(
"HBHEMuon") <<
"(1) Invalid ID " << hcid0 <<
" with E = " << ene;
698 for (
const auto& ehd : ehdepth)
714 int depth = ehdepth[
i].second - 1;
717 depth =
id.depth() - 1;
719 eHcalDepth[
depth] += ene;
720 eHcalDepthC[
depth] += enec;
721 activeL[
depth] += actL;
722 activeLengthTot += actL;
723 matchDepth[
depth] = (matchDepth[
depth] && tmpC);
727 << hcid0 <<
" E " << ene <<
":" << enec <<
" L " << actL <<
" Match " << tmpC;
734 edm::LogVerbatim(
"HBHEMuon") << hcidt <<
" Match " << tmpmatch <<
" Depths " << ehdepth.size();
735 for (
unsigned int k = 0;
k < ehdepth.size(); ++
k)
736 edm::LogVerbatim(
"HBHEMuon") <<
" [" <<
k <<
":" << ehdepth[
k].second <<
"] " << matchDepth[
k];
741 isHot =
matchId(closestCell, hotCell);
747 std::vector<std::pair<double, int>> ehdepth;
763 for (
unsigned int i = 0;
i < ehdepth.size(); ++
i) {
768 double ene = ehdepth[
i].first;
772 edm::LogWarning(
"HBHEMuon") <<
"(2) Invalid ID " << hcid0 <<
" with E = " << ene;
774 for (
const auto& ehd : ehdepth)
778 double chg(ene), enec(ene);
787 << hcid0 <<
":" <<
id <<
" Corr " <<
corr <<
" E " << ene <<
":" << enec;
800 int depth = ehdepth[
i].second - 1;
803 depth =
id.depth() - 1;
805 eHcalDepthHot[
depth] += ene;
806 eHcalDepthHotC[
depth] += enec;
808 activeHotL[
depth] += actL;
809 activeLengthHotTot += actL;
810 matchDepthHot[
depth] = (matchDepthHot[
depth] && tmpC);
814 <<
chg <<
" L " << actL <<
" Match " << tmpC;
822 <<
" Hot " << isHot <<
" Energy " << eHcal;
929 int match = ((kd1 == kd2) ? 1 : 0);
935 int ieta =
id.ietaAbs();
936 int zside =
id.zside();
937 int iphi =
id.iphi();
938 std::vector<int> dpths;
940 std::vector<HcalDetId> ids;
943 dpths.emplace_back(idh.depth());
945 dpths.emplace_back(
id.
depth());
949 for (
unsigned int i = 0;
i <
actHB.size(); ++
i) {
951 (
std::find(dpths.begin(), dpths.end(),
actHB[
i].depth) != dpths.end()) &&
957 for (
unsigned int i = 0;
i <
actHE.size(); ++
i) {
959 (
std::find(dpths.begin(), dpths.end(),
actHE[
i].depth) != dpths.end()) &&
973 if (
vtx.position().Rho() > 2.)
975 if (fabs(
vtx.position().Z()) > 24.)
995 for (
int capid = 0; capid < 4; ++capid)
1011 <<
" depth " <<
depth;
1020 std::pair<double, double> rz =
hdc_->
getRZ(hcid);
bool analyzeMuon(edm::Event const &, math::XYZPoint &)
std::vector< double > hcalDepthChargeHot_[depthMax_]
HcalDetId mergedDepthDetId(const HcalDetId &id) const
std::vector< double > hcalEnergy_
T const * product() const
const edm::InputTag labelHBHERecHit_
bool analyzeHadron(edm::Event const &, math::XYZPoint &)
std::vector< int > hcal_ieta_
double activeLength(const DetId &)
std::vector< double > hcalDepthChargeHotBG_[depthMax_]
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< bool > hcalHot_
bool validHcal(const HcalDetId &id) const
edm::ESHandle< HcalDbService > conditions_
std::vector< bool > hcalDepthMatch_[depthMax_]
void setTopo(const HcalTopology *topo)
int stripTOBLayersWithMeasurement() const
int trackerLayersWithoutMeasurement(HitCategory category) const
std::vector< double > phiGlob_
edm::ESHandle< CaloGeometry > pG_
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
std::vector< double > hcalDepthEnergyHot_[depthMax_]
double respCorr(const DetId &)
std::vector< int > trackLayerCrossed_
edm::Handle< HBHERecHitCollection > hbhe_
bool analyzeTracks(const reco::Track *, math::XYZPoint &, int, std::vector< spr::propagatedTrackID > &, bool)
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
double gainFactor(const edm::ESHandle< HcalDbService > &, const HcalDetId &)
TrackQuality
track quality
U second(std::pair< T, U > const &p)
bool goodCell(const HcalDetId &, const reco::Track *, const CaloGeometry *, const MagneticField *)
std::vector< int > trackMissedOuterHits_
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
std::vector< double > ecal3x3Energy_
T getUntrackedParameter(std::string const &, T const &) const
bool isGoodVertex(const reco::Vertex &)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< int > hcal_iphi_
void fillTrackParameters(const reco::Track *, math::XYZPoint)
const Item * getValues(DetId fId, bool throwOnFail=true) const
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< int > trackOuterHit_
const edm::InputTag labelEBRecHit_
edm::EDGetTokenT< reco::VertexCollection > tok_Vtx_
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
std::vector< unsigned int > hcalDetId_
edm::EDGetTokenT< HBHERecHitCollection > tok_HBHE_
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)
#define DEFINE_FWK_MODULE(type)
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)
static const int depthMax_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
int trackerLayersWithMeasurement() const
std::vector< double > hcal1x1Energy_
std::vector< int > trackMissedInnerHits_
std::vector< double > hcalActiveLengthHot_
std::vector< double > hcalActiveLength_
std::vector< bool > mediumMuon_
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
const bool isItPreRecHit_
const bool writeRespCorr_
std::map< DetId, double > corrValue_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
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
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
std::vector< bool > hcalDepthMatchHot_[depthMax_]
const std::string labelMuon_
std::vector< double > hcalDepthEnergy_[depthMax_]
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
edm::EDGetTokenT< reco::MuonCollection > tok_Muon_
constexpr int ieta() const
get the cell ieta
const HcalDDDRecConstants * hdc_
XYZPointD XYZPoint
point in space with cartesian internal representation
const std::string fileInCorr_
std::vector< double > etaGlob_
std::vector< bool > matchedId_
HcalHBHEMuonHighEtaAnalyzer(const edm::ParameterSet &)
const HcalDDDRecConstants * dddConstants() const
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
double eta() const
pseudorapidity of momentum vector
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 > hoEnergy_
const std::string labelVtx_
HcalRespCorrs * respCorrs_
std::vector< std::pair< float, float > >::iterator itr
reco::TrackBase::TrackQuality minQuality
const bool collapseDepth_
edm::Handle< EcalRecHitCollection > barrelRecHitsHandle_
edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
std::vector< double > hcalDepthActiveLength_[depthMax_]
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, const std::string &theTrackQuality, bool debug=false)
static TrackQuality qualityByName(const std::string &name)
std::vector< double > ecalEnergy_
edm::ESHandle< CaloTopology > theCaloTopology_
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
void endRun(edm::Run const &, edm::EventSetup const &) override
unsigned int eventNumber_
constexpr uint32_t rawId() const
get the raw id
double getRZ(const int &subdet, const int &ieta, const int &depth) 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)
const HcalTopology * theHBHETopology_
static const std::string kSharedResource
edm::Handle< EcalRecHitCollection > endcapRecHitsHandle_
void beginRun(edm::Run const &, edm::EventSetup const &) override
std::vector< unsigned int > ehcalDetId_
std::pair< math::XYZPoint, bool > propagateHCAL(const reco::Track *, const MagneticField *, bool debug=false)
int matchId(const HcalDetId &, const HcalDetId &)
std::vector< unsigned int > ecalDetId_
const edm::InputTag labelEERecHit_
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< double > emaxNearP_
Abs< T >::type abs(const T &t)
double chargeIsolationEcal(unsigned int trkIndex, std::vector< spr::propagatedTrackID > &vdetIds, const CaloGeometry *geo, const CaloTopology *caloTopology, int ieta, int iphi, bool debug=false)
std::vector< double > trackDz_
void analyze(edm::Event const &, edm::EventSetup const &) override
const std::string labelGenTrack_
int stripTECLayersWithMeasurement() const
spr::trackSelectionParameters selectionParameter_
std::vector< double > pMuon_
edm::ESHandle< EcalSeverityLevelAlgo > sevlv_
const std::string theTrackQuality_
std::vector< double > energyMuon_
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const
std::vector< double > isolationR04_
std::vector< double > ptGlob_
std::vector< double > hcalDepthActiveLengthHot_[depthMax_]
edm::ESHandle< EcalChannelStatus > ecalChStatus_
std::vector< double > hcalDepthEnergyCorr_[depthMax_]
T * make(const Args &... args) const
make new ROOT object
std::vector< HcalDDDRecConstants::HcalActiveLength > actHB
edm::ESHandle< MagneticField > bFieldH_
std::vector< HcalDDDRecConstants::HcalActiveLength > actHE
const double emaxNearPThr_
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
std::vector< double > isolationR03_
std::vector< double > hcalDepthEnergyHotCorr_[depthMax_]