16 #include "TDirectory.h"
19 #include <Math/GenVector/VectorUtil.h>
162 : doMC_(iConfig.getUntrackedParameter<bool>(
"DoMC",
false)),
163 myverbose_(iConfig.getUntrackedParameter<int>(
"Verbosity", 5)),
164 theTrackQuality_(iConfig.getUntrackedParameter<std::
string>(
"TrackQuality",
"highPurity")),
165 a_mipR_(iConfig.getUntrackedParameter<double>(
"ConeRadiusMIP", 14.0)),
166 a_coneR_(iConfig.getUntrackedParameter<double>(
"ConeRadius", 34.98)),
167 tMinE_(iConfig.getUntrackedParameter<double>(
"TimeMinCutECAL", -500.)),
168 tMaxE_(iConfig.getUntrackedParameter<double>(
"TimeMaxCutECAL", 500.)),
169 trackerHitAssociatorConfig_(consumesCollector()) {
215 tok_geom_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
217 tok_magField_ = esConsumes<MagneticField, IdealMagneticFieldRecord>();
219 tok_sevlv_ = esConsumes<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd>();
240 descriptions.
add(
"isolatedTracksHcalScale", desc);
273 if (!recVtxs->empty() && !((*recVtxs)[0].isFake())) {
274 leadPV =
math::XYZPoint((*recVtxs)[0].
x(), (*recVtxs)[0].
y(), (*recVtxs)[0].
z());
275 }
else if (beamSpotH.
isValid()) {
276 leadPV = beamSpotH->position();
285 std::vector<spr::propagatedTrackDirection> trkCaloDirections;
287 std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
308 std::unique_ptr<TrackerHitAssociator> associate;
320 for (trkDetItr = trkCaloDirections.begin(), nTracks = 0; trkDetItr != trkCaloDirections.end();
321 trkDetItr++, nTracks++) {
322 const reco::Track *pTrack = &(*(trkDetItr->trkItr));
325 int nRH_eMipDR = 0, nRH_eDR = 0, nNearTRKs = 0, nRecHitsCone = -99;
326 double distFromHotCell = -99.0, distFromHotCell2 = -99.0;
327 int ietaHotCell = -99, iphiHotCell = -99;
328 int ietaHotCell2 = -99, iphiHotCell2 = -99;
329 GlobalPoint gposHotCell(0., 0., 0.), gposHotCell2(0., 0., 0.);
330 std::vector<DetId> coneRecHitDetIds, coneRecHitDetIds2;
331 std::pair<double, bool> e11x11_20SigP, e15x15_20SigP;
334 trkDetItr->pointHCAL,
335 trkDetItr->pointECAL,
337 trkDetItr->directionHCAL,
347 trkDetItr->pointHCAL,
348 trkDetItr->pointECAL,
350 trkDetItr->directionHCAL,
360 trkDetItr->pointHCAL,
361 trkDetItr->pointECAL,
363 trkDetItr->directionHCAL,
373 trkDetItr->pointHCAL,
374 trkDetItr->pointECAL,
376 trkDetItr->directionHCAL,
385 double conehmaxNearP =
391 trkDetItr->pointHCAL,
392 trkDetItr->pointECAL,
394 trkDetItr->directionECAL,
399 trkDetItr->pointHCAL,
400 trkDetItr->pointECAL,
402 trkDetItr->directionECAL,
407 trkDetItr->pointHCAL,
408 trkDetItr->pointECAL,
410 trkDetItr->directionECAL,
417 trkDetItr->pointHCAL,
418 trkDetItr->pointECAL,
420 trkDetItr->directionECAL,
427 trkDetItr->pointHCAL,
428 trkDetItr->pointECAL,
430 trkDetItr->directionECAL,
437 trkDetItr->pointHCAL,
438 trkDetItr->pointECAL,
440 trkDetItr->directionECAL,
496 edm::LogVerbatim(
"IsoTrack") <<
"Track p " << pTrack->
p() <<
" pt " << pTrack->
pt() <<
" eta "
498 <<
" ieta/iphi (" << closestCell.
ieta() <<
", " << closestCell.
iphi()
499 <<
") Energy in cone " << hCone <<
" Charge Isolation " << conehmaxNearP
500 <<
" eMIP (" << eMipDR <<
", " << eMipDR_1 <<
", " << eMipDR_2 <<
")"
501 <<
" Neutral isolation (ECAL) (" << eECALDR - eMipDR <<
", "
502 << eECALDR_1 - eMipDR_1 <<
", " << eECALDR_2 - eMipDR_2 <<
") (ECAL NxN) "
503 << e15x15_20SigP.first - e11x11_20SigP.first <<
" (HCAL) " << eHCALDR - hCone;
509 std::map<std::string, double> hsimInfo;
510 std::vector<int> multiplicity;
512 geo, pcalohh, trkDetItr->pointHCAL, trkDetItr->pointECAL,
a_coneR_, trkDetItr->directionHCAL, nSimHits);
513 hsimInfo = spr::eHCALSimInfoCone(iEvent,
520 trkDetItr->pointHCAL,
521 trkDetItr->pointECAL,
523 trkDetItr->directionHCAL,
545 edm::LogVerbatim(
"IsoTrack") <<
"Matched (E) " << hsimInfo[
"eMatched"] <<
" (N) " << multiplicity.at(0)
546 <<
" Rest (E) " << hsimInfo[
"eRest"] <<
" (N) " << multiplicity.at(1)
547 <<
" Gamma (E) " << hsimInfo[
"eGamma"] <<
" (N) " << multiplicity.at(2)
548 <<
" Neutral Had (E) " << hsimInfo[
"eNeutralHad"] <<
" (N) "
549 << multiplicity.at(3) <<
" Charged Had (E) " << hsimInfo[
"eChargedHad"]
550 <<
" (N) " << multiplicity.at(4) <<
" Total (E) " << hsimInfo[
"eTotal"]
551 <<
" (N) " << multiplicity.at(5) <<
" PDG " << hsimInfo[
"pdgMatched"]
552 <<
" Total E " << hsim <<
" NHit " << nSimHits;
567 tree_->SetAutoSave(10000);
573 t_trackP =
new std::vector<double>();
579 t_hCone =
new std::vector<double>();
581 t_eMipDR =
new std::vector<double>();
594 tree_->Branch(
"t_trackPt",
"std::vector<double>", &t_trackPt);
595 tree_->Branch(
"t_trackEta",
"std::vector<double>", &t_trackEta);
596 tree_->Branch(
"t_trackPhi",
"std::vector<double>", &t_trackPhi);
597 tree_->Branch(
"t_trackHcalEta",
"std::vector<double>", &t_trackHcalEta);
598 tree_->Branch(
"t_trackHcalPhi",
"std::vector<double>", &t_trackHcalPhi);
599 tree_->Branch(
"t_hCone",
"std::vector<double>", &t_hCone);
600 tree_->Branch(
"t_conehmaxNearP",
"std::vector<double>", &t_conehmaxNearP);
601 tree_->Branch(
"t_eMipDR",
"std::vector<double>", &t_eMipDR);
602 tree_->Branch(
"t_eECALDR",
"std::vector<double>", &t_eECALDR);
603 tree_->Branch(
"t_eHCALDR",
"std::vector<double>", &t_eHCALDR);
604 tree_->Branch(
"t_e11x11_20Sig",
"std::vector<double>", &t_e11x11_20Sig);
605 tree_->Branch(
"t_e15x15_20Sig",
"std::vector<double>", &t_e15x15_20Sig);
606 tree_->Branch(
"t_eMipDR_1",
"std::vector<double>", &t_eMipDR_1);
607 tree_->Branch(
"t_eECALDR_1",
"std::vector<double>", &t_eECALDR_1);
608 tree_->Branch(
"t_eMipDR_2",
"std::vector<double>", &t_eMipDR_2);
609 tree_->Branch(
"t_eECALDR_2",
"std::vector<double>", &t_eECALDR_2);
610 tree_->Branch(
"t_hConeHB",
"std::vector<double>", &t_hConeHB);
611 tree_->Branch(
"t_eHCALDRHB",
"std::vector<double>", &t_eHCALDRHB);
627 t_hsim =
new std::vector<double>();
631 tree_->Branch(
"t_hsimInfoRest",
"std::vector<double>", &t_hsimInfoRest);
632 tree_->Branch(
"t_hsimInfoPhoton",
"std::vector<double>", &t_hsimInfoPhoton);
633 tree_->Branch(
"t_hsimInfoNeutHad",
"std::vector<double>", &t_hsimInfoNeutHad);
634 tree_->Branch(
"t_hsimInfoCharHad",
"std::vector<double>", &t_hsimInfoCharHad);
635 tree_->Branch(
"t_hsimInfoPdgMatched",
"std::vector<double>", &t_hsimInfoPdgMatched);
636 tree_->Branch(
"t_hsimInfoTotal",
"std::vector<double>", &t_hsimInfoTotal);
637 tree_->Branch(
"t_hsimInfoNMatched",
"std::vector<int>", &t_hsimInfoNMatched);
638 tree_->Branch(
"t_hsimInfoNTotal",
"std::vector<int>", &t_hsimInfoNTotal);
639 tree_->Branch(
"t_hsimInfoNNeutHad",
"std::vector<int>", &t_hsimInfoNNeutHad);
640 tree_->Branch(
"t_hsimInfoNCharHad",
"std::vector<int>", &t_hsimInfoNCharHad);
641 tree_->Branch(
"t_hsimInfoNPhoton",
"std::vector<int>", &t_hsimInfoNPhoton);
642 tree_->Branch(
"t_hsimInfoNRest",
"std::vector<int>", &t_hsimInfoNRest);
643 tree_->Branch(
"t_hsim",
"std::vector<double>", &t_hsim);
644 tree_->Branch(
"t_nSimHits",
"std::vector<int>", &t_nSimHits);
static const std::string kSharedResource
double p() const
momentum vector magnitude
double eCone_hcal(const CaloGeometry *geo, edm::Handle< T > &hits, const GlobalPoint &hpoint1, const GlobalPoint &point1, double dR, const GlobalVector &trackMom, int &nRecHits, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100, double tMin=-500, double tMax=500, int detOnly=-1, int useRaw=0, bool debug=false)
Log< level::Info, true > LogVerbatim
std::vector< double > * t_hsimInfoMatched
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< double > * t_eHCALDR
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, const std::string &theTrackQuality, bool debug=false)
edm::ESGetToken< CaloTopology, CaloTopologyRecord > tok_caloTopology_
std::vector< int > * t_hsimInfoNRest
std::vector< double > * t_hCone
std::string theTrackQuality_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
IsolatedTracksHcalScale(const edm::ParameterSet &)
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
std::vector< int > * t_hsimInfoNTotal
std::vector< int > * t_hsimInfoNCharHad
edm::EDGetTokenT< edm::PCaloHitContainer > tok_caloEE_
TrackerHitAssociator::Config trackerHitAssociatorConfig_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< int > * t_hsimInfoNMatched
TrackQuality
track quality
#define DEFINE_FWK_MODULE(type)
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tok_magField_
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
std::vector< double > * t_hsim
int bunchCrossing() const
std::vector< double > * t_hsimInfoNeutHad
edm::LuminosityBlockNumber_t luminosityBlock() const
T * make(const Args &...args) const
make new ROOT object
std::vector< double > * t_eMipDR_2
std::vector< int > * t_hsimInfoNPhoton
double chargeIsolationCone(unsigned int trkIndex, std::vector< spr::propagatedTrackDirection > &trkDirs, double dR, int &nNearTRKs, bool debug=false)
const Vector & momentum() const
track momentum vector
bool getData(T &iHolder) const
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
std::vector< double > * t_e11x11_20Sig
constexpr int iphi() const
get the cell iphi
std::vector< int > * t_hsimInfoNNeutHad
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
edm::EDGetTokenT< edm::PCaloHitContainer > tok_caloEB_
spr::trackSelectionParameters selectionParameters_
double pt() const
track transverse momentum
edm::EDGetTokenT< reco::VertexCollection > tok_recVtx_
std::vector< double > * t_trackEta
std::vector< double > * t_eECALDR_2
constexpr int ieta() const
get the cell ieta
edm::EDGetTokenT< edm::SimTrackContainer > tok_simTk_
std::vector< double > * t_eECALDR
double eCone_ecal(const CaloGeometry *geo, edm::Handle< T > &barrelhits, edm::Handle< T > &endcaphits, const GlobalPoint &hpoint1, const GlobalPoint &point1, double dR, const GlobalVector &trackMom, int &nRecHits, double ebThr=-100, double eeThr=-100, double tMin=-500, double tMax=500, bool debug=false)
edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > tok_ecalChStatus_
std::vector< double > * t_eMipDR_1
std::vector< double > * t_trackPt
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > tok_sevlv_
static TrackQuality qualityByName(const std::string &name)
T const * product() const
std::vector< double > * t_trackHcalEta
std::vector< double > * t_trackP
std::vector< double > * t_eECALDR_1
XYZPointD XYZPoint
point in space with cartesian internal representation
std::vector< double > * t_trackHcalPhi
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void analyze(const edm::Event &, const edm::EventSetup &) override
std::vector< double > * t_hsimInfoPhoton
std::vector< double > * t_hsimInfoTotal
edm::EDGetTokenT< edm::PCaloHitContainer > tok_caloHH_
std::vector< double > * t_hsimInfoCharHad
reco::TrackBase::TrackQuality minQuality
~IsolatedTracksHcalScale() override
edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
std::vector< double > * t_trackPhi
std::vector< double > * t_eHCALDRHB
std::vector< double > * t_hsimInfoPdgMatched
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
edm::EDGetTokenT< reco::BeamSpot > tok_bs_
edm::EDGetTokenT< edm::SimVertexContainer > tok_simVtx_
std::vector< int > * t_nSimHits
std::vector< double > * t_hConeHB
std::vector< double > * t_hsimInfoRest
std::vector< double > * t_conehmaxNearP
std::vector< double > * t_e15x15_20Sig
std::vector< double > * t_eMipDR
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)