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>();
224 desc.addUntracked<
bool>(
"doMC",
false);
225 desc.addUntracked<
int>(
"Verbosity", 0);
227 desc.addUntracked<
double>(
"MinTrackPt", 10.0);
228 desc.addUntracked<
double>(
"MaxDxyPV", 0.02);
229 desc.addUntracked<
double>(
"MaxDzPV", 0.02);
230 desc.addUntracked<
double>(
"MaxChi2", 5.0);
231 desc.addUntracked<
double>(
"MaxDpOverP", 0.1);
232 desc.addUntracked<
int>(
"MinOuterHit", 4);
233 desc.addUntracked<
int>(
"MinLayerCrossed", 8);
234 desc.addUntracked<
int>(
"MaxInMiss", 0);
235 desc.addUntracked<
int>(
"MaxOutMiss", 0);
236 desc.addUntracked<
double>(
"ConeRadius", 34.98);
237 desc.addUntracked<
double>(
"ConeRadiusMIP", 14.0);
238 desc.addUntracked<
double>(
"TimeMinCutECAL", -500.0);
239 desc.addUntracked<
double>(
"TimeMaxCutECAL", 500.0);
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()) {
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();
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;
566 tree_ =
fs->make<TTree>(
"tree",
"tree");
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>();
599 tree_->Branch(
"t_hCone",
"std::vector<double>", &
t_hCone);
627 t_hsim =
new std::vector<double>();
643 tree_->Branch(
"t_hsim",
"std::vector<double>", &
t_hsim);
static const std::string kSharedResource
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
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_
std::vector< int > * t_hsimInfoNTotal
const Point & position() const
position
std::vector< int > * t_hsimInfoNCharHad
edm::EDGetTokenT< edm::PCaloHitContainer > tok_caloEE_
TrackerHitAssociator::Config trackerHitAssociatorConfig_
std::vector< int > * t_hsimInfoNMatched
TrackQuality
track quality
double p() const
momentum vector magnitude
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tok_magField_
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
std::vector< double > * t_hsim
std::vector< double > * t_hsimInfoNeutHad
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)
T getUntrackedParameter(std::string const &, T const &) const
double pt() const
track transverse momentum
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
std::vector< double > * t_e11x11_20Sig
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_
constexpr int ieta() const
get the cell ieta
spr::trackSelectionParameters selectionParameters_
edm::EDGetTokenT< reco::VertexCollection > tok_recVtx_
std::vector< double > * t_trackEta
std::vector< double > * t_eECALDR_2
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)
#define DEFINE_FWK_MODULE(type)
edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > tok_ecalChStatus_
bool getData(T &iHolder) const
std::vector< double > * t_eMipDR_1
std::vector< double > * t_trackPt
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > tok_sevlv_
static TrackQuality qualityByName(const std::string &name)
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
const Vector & momentum() const
track momentum vector
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
constexpr int iphi() const
get the cell iphi
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)