|
|
Go to the documentation of this file.
171 std::vector<HcalDDDRecConstants::HcalActiveLength>
actHB,
actHE;
177 : labelEBRecHit_(iConfig.getParameter<
edm::
InputTag>(
"labelEBRecHit")),
178 labelEERecHit_(iConfig.getParameter<
edm::
InputTag>(
"labelEERecHit")),
179 labelHBHERecHit_(iConfig.getParameter<
edm::
InputTag>(
"labelHBHERecHit")),
180 labelVtx_(iConfig.getParameter<
std::
string>(
"labelVertex")),
181 labelMuon_(iConfig.getParameter<
std::
string>(
"labelMuon")),
182 labelGenTrack_(iConfig.getParameter<
std::
string>(
"labelTrack")),
183 etaMin_(iConfig.getParameter<double>(
"etaMin")),
184 emaxNearPThr_(iConfig.getParameter<double>(
"emaxNearPThreshold")),
185 analyzeMuon_(iConfig.getParameter<
bool>(
"analyzeMuon")),
186 unCorrect_(iConfig.getParameter<
bool>(
"unCorrect")),
187 collapseDepth_(iConfig.getParameter<
bool>(
"collapseDepth")),
188 isItPlan1_(iConfig.getParameter<
bool>(
"isItPlan1")),
189 getCharge_(iConfig.getParameter<
bool>(
"getCharge")),
190 useRaw_(iConfig.getParameter<
int>(
"useRaw")),
191 verbosity_(iConfig.getParameter<
int>(
"verbosity")),
192 theTrackQuality_(iConfig.getUntrackedParameter<
std::
string>(
"trackQuality")),
193 fileInCorr_(iConfig.getUntrackedParameter<
std::
string>(
"fileInCorr",
"")),
194 ignoreHECorr_(iConfig.getUntrackedParameter<
bool>(
"ignoreHECorr",
false)),
195 isItPreRecHit_(iConfig.getUntrackedParameter<
bool>(
"isItPreRecHit",
false)),
196 writeRespCorr_(iConfig.getUntrackedParameter<
bool>(
"writeRespCorr",
false)),
198 theHBHETopology_(nullptr),
231 tok_ddrec_ = esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord, edm::Transition::BeginRun>();
232 tok_htopo_ = esConsumes<HcalTopology, HcalRecNumberingRecord, edm::Transition::BeginRun>();
233 tok_respcorr_ = esConsumes<HcalRespCorrs, HcalRespCorrsRcd, edm::Transition::BeginRun>();
234 tok_geom_ = esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>();
235 tok_magField_ = esConsumes<MagneticField, IdealMagneticFieldRecord>();
236 tok_chan_ = esConsumes<EcalChannelStatus, EcalChannelStatusRcd>();
237 tok_sevlv_ = esConsumes<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd>();
238 tok_topo_ = esConsumes<CaloTopology, CaloTopologyRecord>();
275 desc.add<
double>(
"etaMin", 2.0);
276 desc.add<
double>(
"emaxNearPThreshold", 10.0);
277 desc.add<
bool>(
"analyzeMuon",
true);
278 desc.add<
bool>(
"unCorrect",
false);
279 desc.add<
bool>(
"collapseDepth",
false);
280 desc.add<
bool>(
"isItPlan1",
false);
281 desc.add<
bool>(
"getCharge",
false);
282 desc.add<
int>(
"useRaw", 0);
283 desc.add<
int>(
"verbosity", 0);
286 desc.addUntracked<
double>(
"minTrackPt", 1.0);
287 desc.addUntracked<
double>(
"maxDxyPV", 0.02);
288 desc.addUntracked<
double>(
"maxDzPV", 100.0);
289 desc.addUntracked<
double>(
"maxChi2", 5.0);
290 desc.addUntracked<
double>(
"maxDpOverP", 0.1);
291 desc.addUntracked<
bool>(
"ignoreHECorr",
false);
292 desc.addUntracked<
bool>(
"isItPreRecHit",
false);
293 desc.addUntracked<
bool>(
"writeRespCorr",
false);
294 desc.addUntracked<
int>(
"maxDepth", 7);
295 descriptions.
add(
"hcalHBHEMuonHighEta",
desc);
301 tree_ = fs->
make<TTree>(
"HBHEMuonHighEta",
"HBHEMuonHighEta");
330 sprintf(
name,
"hcal_edepth%d", (
k + 1));
332 sprintf(
name,
"hcal_activeL%d", (
k + 1));
334 sprintf(
name,
"hcal_edepthHot%d", (
k + 1));
336 sprintf(
name,
"hcal_activeHotL%d", (
k + 1));
338 sprintf(
name,
"hcal_cdepthHot%d", (
k + 1));
340 sprintf(
name,
"hcal_cdepthHotBG%d", (
k + 1));
342 sprintf(
name,
"hcal_edepthCorrect%d", (
k + 1));
344 sprintf(
name,
"hcal_edepthHotCorrect%d", (
k + 1));
346 sprintf(
name,
"hcal_depthMatch%d", (
k + 1));
348 sprintf(
name,
"hcal_depthMatchHot%d", (
k + 1));
388 if (!
vtx.isValid()) {
395 reco::VertexCollection::const_iterator firstGoodVertex =
vtx->end();
396 for (reco::VertexCollection::const_iterator it =
vtx->begin(); it !=
vtx->end(); it++) {
398 if (firstGoodVertex ==
vtx->end())
399 firstGoodVertex = it;
403 if (firstGoodVertex !=
vtx->end())
404 pvx = firstGoodVertex->position();
436 <<
" Energy|Length|EnergyHot|LengthHot|Charge|ChargeBG|EnergyCorr|EnergyHotCorr|Match|MatchHot:"
457 unsigned int k1(0), k2(0);
459 for (
const auto& act :
actHB) {
460 edm::LogVerbatim(
"HBHEMuon") <<
"[" << k1 <<
"] ieta " << act.ieta <<
" depth " << act.depth <<
" zside "
461 << act.zside <<
" type " << act.stype <<
" phi " << act.iphis.size() <<
":"
462 << act.iphis[0] <<
" L " << act.thick;
469 for (
const auto& act :
actHE) {
470 edm::LogVerbatim(
"HBHEMuon") <<
"[" << k2 <<
"] ieta " << act.ieta <<
" depth " << act.depth <<
" zside "
471 << act.zside <<
" type " << act.stype <<
" phi " << act.iphis.size() <<
":"
472 << act.iphis[0] <<
" L " << act.thick;
491 edm::LogVerbatim(
"HBHEMuon") <<
"\nTable of Correction Factors for Run " << iRun.
run() <<
"\n";
492 for (
auto const&
id : ids) {
508 std::vector<spr::propagatedTrackID> trkCaloDets;
509 for (reco::MuonCollection::const_iterator RecMuon = _Muon->begin(); RecMuon != _Muon->end(); ++RecMuon) {
510 if (RecMuon->innerTrack().isNonnull()) {
513 if (
analyzeTracks(pTrack, leadPV, nTrack, trkCaloDets,
false)) {
516 etaGlob_.emplace_back(RecMuon->eta());
517 phiGlob_.emplace_back(RecMuon->phi());
519 pMuon_.emplace_back(RecMuon->p());
520 bool mediumMuon = (((RecMuon->isPFMuon()) && (RecMuon->isGlobalMuon() || RecMuon->isTrackerMuon())) &&
521 (RecMuon->innerTrack()->validFraction() > 0.49));
524 ((RecMuon->globalTrack().isNonnull()) ? RecMuon->globalTrack()->normalizedChi2() : 999);
526 (RecMuon->isGlobalMuon() && chiGlobal < 3 && RecMuon->combinedQuality().chi2LocalPosition < 12 &&
527 RecMuon->combinedQuality().trkKink < 20);
532 ((RecMuon->pfIsolationR03().sumChargedHadronPt +
534 RecMuon->pfIsolationR03().sumNeutralHadronEt + RecMuon->pfIsolationR03().sumPhotonEt -
535 (0.5 * RecMuon->pfIsolationR03().sumPUPt))) /
538 ((RecMuon->pfIsolationR04().sumChargedHadronPt +
540 RecMuon->pfIsolationR04().sumNeutralHadronEt + RecMuon->pfIsolationR04().sumPhotonEt -
541 (0.5 * RecMuon->pfIsolationR04().sumPUPt))) /
546 ecalEnergy_.emplace_back(RecMuon->calEnergy().emS9);
547 hcalEnergy_.emplace_back(RecMuon->calEnergy().hadS9);
548 hoEnergy_.emplace_back(RecMuon->calEnergy().hoS9);
572 if (!trkCollection.
isValid()) {
573 std::vector<spr::propagatedTrackID> trkCaloDets;
576 std::vector<spr::propagatedTrackID>::const_iterator trkDetItr;
577 for (trkDetItr = trkCaloDets.begin(), nTrack = 0; trkDetItr != trkCaloDets.end(); trkDetItr++, nTrack++) {
578 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
590 std::vector<spr::propagatedTrackID>& trkCaloDets,
600 double eEcal(0), eHcal(0), activeLengthTot(0), activeLengthHotTot(0);
607 unsigned int isHot(0);
608 bool tmpmatch(
false);
611 eHcalDepth[
i] = eHcalDepthHot[
i] = 0;
612 eHcalDepthC[
i] = eHcalDepthHotC[
i] = 0;
613 cHcalDepthHot[
i] = cHcalDepthHotBG[
i] = 0;
614 activeL[
i] = activeHotL[
i] = 0;
615 matchDepth[
i] = matchDepthHot[
i] =
true;
641 edm::LogVerbatim(
"HBHEMuon") <<
"Propagate Track to ECAL: " << e3x3.second <<
":" << trackID.
okECAL <<
" E "
647 if ((hcidt.ieta() ==
check.ieta()) && (hcidt.iphi() ==
check.iphi()))
674 std::vector<std::pair<double, int>> ehdepth;
690 for (
unsigned int i = 0;
i < ehdepth.size(); ++
i) {
695 double ene = ehdepth[
i].first;
699 edm::LogWarning(
"HBHEMuon") <<
"(1) Invalid ID " << hcid0 <<
" with E = " << ene;
701 for (
const auto& ehd : ehdepth)
717 int depth = ehdepth[
i].second - 1;
720 depth =
id.depth() - 1;
722 eHcalDepth[
depth] += ene;
723 eHcalDepthC[
depth] += enec;
724 activeL[
depth] += actL;
725 activeLengthTot += actL;
726 matchDepth[
depth] = (matchDepth[
depth] && tmpC);
730 << hcid0 <<
" E " << ene <<
":" << enec <<
" L " << actL <<
" Match " << tmpC;
737 edm::LogVerbatim(
"HBHEMuon") << hcidt <<
" Match " << tmpmatch <<
" Depths " << ehdepth.size();
738 for (
unsigned int k = 0;
k < ehdepth.size(); ++
k)
739 edm::LogVerbatim(
"HBHEMuon") <<
" [" <<
k <<
":" << ehdepth[
k].second <<
"] " << matchDepth[
k];
744 isHot =
matchId(closestCell, hotCell);
750 std::vector<std::pair<double, int>> ehdepth;
766 for (
unsigned int i = 0;
i < ehdepth.size(); ++
i) {
771 double ene = ehdepth[
i].first;
775 edm::LogWarning(
"HBHEMuon") <<
"(2) Invalid ID " << hcid0 <<
" with E = " << ene;
777 for (
const auto& ehd : ehdepth)
781 double chg(ene), enec(ene);
790 << hcid0 <<
":" <<
id <<
" Corr " <<
corr <<
" E " << ene <<
":" << enec;
803 int depth = ehdepth[
i].second - 1;
806 depth =
id.depth() - 1;
808 eHcalDepthHot[
depth] += ene;
809 eHcalDepthHotC[
depth] += enec;
811 activeHotL[
depth] += actL;
812 activeLengthHotTot += actL;
813 matchDepthHot[
depth] = (matchDepthHot[
depth] && tmpC);
817 <<
chg <<
" L " << actL <<
" Match " << tmpC;
825 <<
" Hot " << isHot <<
" Energy " << eHcal;
932 int match = ((kd1 == kd2) ? 1 : 0);
938 int ieta =
id.ietaAbs();
939 int zside =
id.zside();
940 int iphi =
id.iphi();
941 std::vector<int> dpths;
943 std::vector<HcalDetId> ids;
946 dpths.emplace_back(idh.depth());
948 dpths.emplace_back(
id.
depth());
952 for (
unsigned int i = 0;
i <
actHB.size(); ++
i) {
954 (
std::find(dpths.begin(), dpths.end(),
actHB[
i].depth) != dpths.end()) &&
960 for (
unsigned int i = 0;
i <
actHE.size(); ++
i) {
962 (
std::find(dpths.begin(), dpths.end(),
actHE[
i].depth) != dpths.end()) &&
976 if (
vtx.position().Rho() > 2.)
978 if (fabs(
vtx.position().Z()) > 24.)
998 for (
int capid = 0; capid < 4; ++capid)
1014 <<
" depth " <<
depth;
1023 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_
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_]
std::vector< bool > hcalHot_
bool validHcal(const HcalDetId &id) const
std::vector< bool > hcalDepthMatch_[depthMax_]
void setTopo(const HcalTopology *topo)
int stripTOBLayersWithMeasurement() const
int trackerLayersWithoutMeasurement(HitCategory category) const
std::vector< double > phiGlob_
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)
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tok_magField_
const EcalChannelStatus * theEcalChStatus_
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
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
edm::ESGetToken< HcalDbService, HcalDbRecord > tok_dbservice_
bool isGoodVertex(const reco::Vertex &)
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< int > hcal_iphi_
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > tok_htopo_
void fillTrackParameters(const reco::Track *, math::XYZPoint)
Log< level::Warning, false > LogWarning
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)
std::vector< int > trackOuterHit_
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > tok_sevlv_
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)
edm::ESGetToken< CaloTopology, CaloTopologyRecord > tok_topo_
#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_
const MagneticField * bField_
std::vector< int > trackMissedInnerHits_
std::vector< double > hcalActiveLengthHot_
edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > tok_chan_
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_]
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
edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_ddrec_
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_
const CaloGeometry * geo_
HcalRespCorrs * respCorrs_
reco::TrackBase::TrackQuality minQuality
const bool collapseDepth_
edm::Handle< EcalRecHitCollection > barrelRecHitsHandle_
T * make(const Args &...args) const
make new ROOT object
edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
bool getData(T &iHolder) const
std::vector< double > hcalDepthActiveLength_[depthMax_]
const EcalSeverityLevelAlgo * sevlv_
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_
const CaloTopology * caloTopology_
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_
Log< level::Info, true > LogVerbatim
const HcalDbService * conditions_
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)
double gainFactor(const HcalDbService *, const HcalDetId &)
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_
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_]
std::vector< double > hcalDepthEnergyCorr_[depthMax_]
std::vector< HcalDDDRecConstants::HcalActiveLength > actHB
std::vector< HcalDDDRecConstants::HcalActiveLength > actHE
const double emaxNearPThr_
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
std::vector< double > isolationR03_
std::vector< double > hcalDepthEnergyHotCorr_[depthMax_]
edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_respcorr_