281 edm::LogVerbatim(
"HcalIsoTrack") <<
"Hello World. TrackCollectionSize: " << isoPixelTracks->size();
283 if (isoPixelTracks->empty())
286 for (reco::TrackCollection::const_iterator trit = isoProdTracks->begin(); trit != isoProdTracks->end(); trit++) {
287 reco::IsolatedPixelTrackCandidateCollection::const_iterator isoMatched = isoPixelTracks->begin();
289 bool matched =
false;
292 for (reco::IsolatedPixelTrackCandidateCollection::const_iterator it = isoPixelTracks->begin();
293 it != isoPixelTracks->end();
297 if (
abs((trit->pt() - it->pt()) / it->pt()) < 0.005 &&
abs(trit->eta() - it->eta()) < 0.01) {
307 if (isoMatched->maxPtPxl() >
maxPNear)
310 ptNear = isoMatched->maxPtPxl();
317 if (fabs(trit->eta()) > 1.47 && trit->hitPattern().numberOfValidStripTECHits() <
MinNTECHitsEndcap)
322 << trit->hitPattern().numberOfValidHits();
323 edm::LogVerbatim(
"HcalIsoTrack") <<
"Point 0.2.2 after numofvalidstrips HE: "
324 << trit->hitPattern().numberOfValidStripTECHits();
326 numVH = trit->hitPattern().numberOfValidHits();
327 numVS = trit->hitPattern().numberOfValidStripTECHits();
329 trackE =
sqrt(trit->px() * trit->px() + trit->py() * trit->py() + trit->pz() * trit->pz() + 0.14 * 0.14);
337 edm::LogVerbatim(
"HcalIsoTrack") <<
"Point 0.3. Matched :: pt: " << trit->pt() <<
" wholeEnergy: " <<
trackE
383 ietatrue = tempId.
ieta();
384 iphitrue = tempId.
iphi();
391 std::vector<DetId> usedHits;
406 bool hitIsUsed =
false;
407 for (uint32_t
i = 0;
i < usedHits.size();
i++) {
408 if (usedHits[
i] == hhit->id())
413 usedHits.push_back(hhit->id());
424 int iphihitm = (hhit->id()).iphi();
425 int ietahitm = (hhit->id()).ieta();
426 int depthhit = (hhit->id()).
depth();
427 float enehit = hhit->energy() * recal;
434 if (dphi > 4. * atan(1.))
435 dphi = 8. * atan(1.) - dphi;
437 float dr =
sqrt(dphi * dphi + deta * deta);
445 int iphihitm2 = (hhit2->id()).iphi();
446 int ietahitm2 = (hhit2->id()).ieta();
447 int depthhit2 = (hhit2->id()).
depth();
448 float enehit2 = hhit2->energy() * recal;
450 if (iphihitm == iphihitm2 && ietahitm == ietahitm2 && depthhit != depthhit2)
451 enehit = enehit + enehit2;
455 edm::LogVerbatim(
"HcalIsoTrack") <<
"IN CONE ieta: " << ietahitm <<
" iphi: " << iphihitm
456 <<
" depthhit: " << depthhit <<
" dr: " << dr <<
" energy: " << enehit;
462 MaxHit.
ietahitm = (hhit->id()).ieta();
463 MaxHit.
iphihitm = (hhit->id()).iphi();
464 MaxHit.
dr = distAtHcal;
477 <<
" dr: " << MaxHit.
dr;
478 edm::LogVerbatim(
"HcalIsoTrack") <<
"Track ieta: " << ietatrue <<
" iphi: " << iphitrue;
483 Bool_t passCuts = kFALSE;
507 bool hitIsUsed =
false;
508 for (uint32_t
i = 0;
i < usedHits.size();
i++) {
509 if (usedHits[
i] == hhit->id())
514 usedHits.push_back(hhit->id());
517 if (MaxHit.
ietahitm * (hhit->id()).ieta() > 0) {
518 DIETA = MaxHit.
ietahitm - (hhit->id()).ieta();
520 if (MaxHit.
ietahitm * (hhit->id()).ieta() < 0) {
521 DIETA = MaxHit.
ietahitm - (hhit->id()).ieta();
522 DIETA = DIETA > 0 ? DIETA - 1 : DIETA + 1;
525 int DIPHI =
abs(MaxHit.
iphihitm - (hhit->id()).iphi());
526 DIPHI = DIPHI > 36 ? 72 - DIPHI : DIPHI;
528 int numbercell = 100;
536 if (
abs(DIETA) <= numbercell &&
537 (
abs(DIPHI) <= numbercell || (
abs(MaxHit.
ietahitm) >= 20 &&
abs(DIPHI) <= numbercell + 1))) {
540 if (passCuts && hhit->energy() > 0) {
549 if (hhit->id().ieta() == MaxHit.
ietahitm && hhit->id().iphi() == MaxHit.
iphihitm)
552 if (hhit->id().ieta() == MaxHit.
ietahitm && hhit->id().iphi() == MaxHit.
iphihitm)
553 iTime = hhit->time();
560 abs((hhit->id()).ieta()) <= 20 &&
abs(DIPHI) > 2)))) {
574 if (
abs(MaxHit.
ietahitm) == 21 &&
abs((hhit->id()).ieta()) <= 20 &&
abs(DIPHI) > 3)
583 if ((hhit->id().depth() == 1) && (
abs(hhit->id().ieta()) > 17) && (
abs(hhit->id().ieta()) < 29)) {
586 }
else if ((hhit->id().depth() == 2) && (
abs(hhit->id().ieta()) > 17) && (
abs(hhit->id().ieta()) < 29)) {
595 if (
abs(MaxHit.
ietahitm) == 21 &&
abs((hhit->id()).ieta()) <= 20 &&
abs(DIPHI) > 2)
604 if ((hhit->id().depth() == 1) && (
abs(hhit->id().ieta()) > 17) && (
abs(hhit->id().ieta()) < 29)) {
607 }
else if ((hhit->id().depth() == 2) && (
abs(hhit->id().ieta()) > 17) && (
abs(hhit->id().ieta()) < 29)) {
621 if ((hhit->id().depth() == 1) && (
abs(hhit->id().ieta()) > 17) && (
abs(hhit->id().ieta()) < 29)) {
624 }
else if ((hhit->id().depth() == 2) && (
abs(hhit->id().ieta()) > 17) && (
abs(hhit->id().ieta()) < 29)) {
639 if (MaxHit.
ietahitm * ietatrue > 0) {
642 if (MaxHit.
ietahitm * ietatrue < 0) {
646 diphi_M_P = diphi_M_P > 36 ? 72 - diphi_M_P : diphi_M_P;
670 iDr =
sqrt(diphi_M_P * diphi_M_P + dieta_M_P * dieta_M_P);
682 edm::LogVerbatim(
"HcalIsoTrack") <<
" generalTracks Size: " << generalTracks->size();
684 int n = generalTracks->size();
688 gen = generalTracks->size();
689 iso = isoProdTracks->size();
690 pix = isoPixelTracks->size();
704 Int_t gencount = 0, isocount = 0, pixcount = 0;
705 for (reco::TrackCollection::const_iterator gentr = generalTracks->begin(); gentr != generalTracks->end(); gentr++) {
706 genPt[gencount] = gentr->pt();
707 genPhi[gencount] = gentr->phi();
708 genEta[gencount] = gentr->eta();
712 for (reco::TrackCollection::const_iterator isotr = isoProdTracks->begin(); isotr != isoProdTracks->end(); isotr++) {
713 isoPt[isocount] = isotr->pt();
714 isoPhi[isocount] = isotr->phi();
715 isoEta[isocount] = isotr->eta();
719 for (reco::IsolatedPixelTrackCandidateCollection::const_iterator pixtr = isoPixelTracks->begin();
720 pixtr != isoPixelTracks->end();
722 pixPt[pixcount] = pixtr->pt();
723 pixPhi[pixcount] = pixtr->phi();
724 pixEta[pixcount] = pixtr->eta();
743 nTracks =
fs->
make<TH1F>(
"nTracks",
"general;number of general tracks", 11, -0.5, 10.5);
745 tTree =
fs->
make<TTree>(
"tTree",
"Tree for gen info");
747 fTree =
fs->
make<TTree>(
"fTree",
"Tree for IsoTrack Calibration");
749 fTree->Branch(
"eventNumber", &
eventNumber,
"eventNumber/I");
750 fTree->Branch(
"runNumber", &
runNumber,
"runNumber/I");
752 fTree->Branch(
"eClustBefore", &
eClustBefore,
"eClustBefore/F");
753 fTree->Branch(
"eClustAfter", &
eClustAfter,
"eClustAfter/F");
754 fTree->Branch(
"eTrack", &
eTrack,
"eTrack/F");
755 fTree->Branch(
"etaTrack", &
etaTrack,
"etaTrack/F");
756 fTree->Branch(
"phiTrack", &
phiTrack,
"phiTrack/F");
758 fTree->Branch(
"numHits", &
numHits,
"numHits/I");
759 fTree->Branch(
"eECAL", &
eECAL,
"eECAL/F");
760 fTree->Branch(
"PtNearBy", &
PtNearBy,
"PtNearBy/F");
761 fTree->Branch(
"numValidTrkHits", &
numValidTrkHits,
"numValidTrkHits/F");
764 fTree->Branch(
"eBeforeDepth1", &
eBeforeDepth1,
"eBeforeDepth1/F");
765 fTree->Branch(
"eBeforeDepth2", &
eBeforeDepth2,
"eBeforeDepth2/F");
766 fTree->Branch(
"eAfterDepth1", &
eAfterDepth1,
"eAfterDepth1/F");
767 fTree->Branch(
"eAfterDepth2", &
eAfterDepth2,
"eAfterDepth2/F");
769 fTree->Branch(
"e3x3Before", &
e3x3Before,
"e3x3Before/F");
770 fTree->Branch(
"e3x3After", &
e3x3After,
"e3x3After/F");
771 fTree->Branch(
"e5x5Before", &
e5x5Before,
"e5x5Before/F");
772 fTree->Branch(
"e5x5After", &
e5x5After,
"e5x5After/F");
774 fTree->Branch(
"eCentHitAfter", &
eCentHitAfter,
"eCentHitAfter/F");
775 fTree->Branch(
"eCentHitBefore", &
eCentHitBefore,
"eCentHitBefore/F");
776 fTree->Branch(
"iEta", &
iEta,
"iEta/I");
777 fTree->Branch(
"iPhi", &
iPhi,
"iPhi/I");
779 fTree->Branch(
"iEtaTr", &
iEtaTr,
"iEtaTr/I");
780 fTree->Branch(
"iPhiTr", &
iPhiTr,
"iPhiTr/I");
781 fTree->Branch(
"dietatr", &
dietatr,
"dietatr/I");
782 fTree->Branch(
"diphitr", &
diphitr,
"diphitr/I");
783 fTree->Branch(
"iDr", &
iDr,
"iDr/F");
784 fTree->Branch(
"delR", &
delR,
"delR/F");
786 fTree->Branch(
"iTime", &
iTime,
"iTime/F");
787 fTree->Branch(
"HTime",
HTime,
"HTime[numHits]/F");
789 fTree->Branch(
"xTrkEcal", &
xTrkEcal,
"xTrkEcal/F");
790 fTree->Branch(
"yTrkEcal", &
yTrkEcal,
"yTrkEcal/F");
791 fTree->Branch(
"zTrkEcal", &
zTrkEcal,
"zTrkEcal/F");
792 fTree->Branch(
"xTrkHcal", &
xTrkHcal,
"xTrkHcal/F");
793 fTree->Branch(
"yTrkHcal", &
yTrkHcal,
"yTrkHcal/F");
794 fTree->Branch(
"zTrkHcal", &
zTrkHcal,
"zTrkHcal/F");
797 tTree->Branch(
"gen", &
gen,
"gen/I");
798 tTree->Branch(
"iso", &
iso,
"iso/I");
799 tTree->Branch(
"pix", &
pix,
"pix/I");
800 tTree->Branch(
"genPt",
genPt,
"genPt[gen]/F");
804 tTree->Branch(
"isoPt",
isoPt,
"isoPt[iso]/F");
808 tTree->Branch(
"pixPt",
pixPt,
"pixPt[pix]/F");
static const std::string kSharedResource
edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
Log< level::Info, true > LogVerbatim
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void analyze(const edm::Event &, const edm::EventSetup &) override
DetId getClosestCell(const GlobalPoint &r) const override
#define DEFINE_FWK_MODULE(type)
void useDefaultPropagator()
use the default propagator
Geom::Phi< T > phi() const
std::vector< T >::const_iterator const_iterator
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
TrackAssociatorParameters parameters_
T * make(const Args &...args) const
make new ROOT object
const Item * getValues(DetId fId, bool throwOnFail=true) const
math::XYZPoint trkGlobPosAtHcal
edm::EDGetTokenT< reco::IsolatedPixelTrackCandidateCollection > tok_track_
bool getData(T &iHolder) const
double calibrationConeSize_
constexpr int iphi() const
get the cell iphi
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > bFieldToken
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Abs< T >::type abs(const T &t)
TrackDetectorAssociator trackAssociator_
constexpr int ieta() const
get the cell ieta
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_recalibCorrs_
const HcalRespCorrs * respRecalib
edm::InputTag genhbheLabel_
ValidIsoTrkCalib(const edm::ParameterSet &)
std::vector< edm::InputTag > genecalLabel_
const_iterator end() const
T const * product() const
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
edm::Service< TFileService > fs
T getParameter(std::string const &) const
static FreeTrajectoryState getFreeTrajectoryState(const MagneticField *, const reco::Track &)
get FreeTrajectoryState from different track representations
edm::EDGetTokenT< HORecHitCollection > tok_ho_
edm::InputTag genhoLabel_
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
math::XYZPoint trkGlobPosAtEcal
Track position at different parts of the calorimeter.
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
double getDistInPlaneSimple(const GlobalPoint caloPoint, const GlobalPoint rechitPoint)
double associationConeSize_
Log< level::Warning, false > LogWarning
edm::EDGetTokenT< reco::TrackCollection > tok_track1_
const_iterator begin() const