176 : takeGenTracks_(iConfig.getUntrackedParameter<bool>(
"takeGenTracks")),
177 genhbheLabel_(iConfig.getParameter<edm::
InputTag>(
"genHBHE")),
178 associationConeSize_(iConfig.getParameter<double>(
"associationConeSize")),
179 allowMissingInputs_(iConfig.getUntrackedParameter<bool>(
"allowMissingInputs",
true)),
180 AxB_(iConfig.getParameter<std::
string>(
"AxB")),
181 calibrationConeSize_(iConfig.getParameter<double>(
"calibrationConeSize")),
182 MinNTrackHitsBarrel(iConfig.getParameter<int>(
"MinNTrackHitsBarrel")),
183 MinNTECHitsEndcap(iConfig.getParameter<int>(
"MinNTECHitsEndcap")),
184 energyECALmip(iConfig.getParameter<double>(
"energyECALmip")),
185 energyMinIso(iConfig.getParameter<double>(
"energyMinIso")),
186 energyMaxIso(iConfig.getParameter<double>(
"energyMaxIso")),
187 maxPNear(iConfig.getParameter<double>(
"maxPNear")),
192 iConfig.getParameter<edm::
InputTag>(
"HcalIsolTrackInput"))),
244 edm::LogVerbatim(
"ValidIsoTrkCalib") <<
"Hello World. TrackCollectionSize: " << isoPixelTracks->size();
246 if (isoPixelTracks->empty())
249 for (reco::TrackCollection::const_iterator trit = isoProdTracks->begin(); trit != isoProdTracks->end(); trit++) {
250 reco::IsolatedPixelTrackCandidateCollection::const_iterator isoMatched = isoPixelTracks->begin();
252 bool matched =
false;
255 for (reco::IsolatedPixelTrackCandidateCollection::const_iterator it = isoPixelTracks->begin();
256 it != isoPixelTracks->end();
260 if (
abs((trit->pt() - it->pt()) / it->pt()) < 0.005 &&
abs(trit->eta() - it->eta()) < 0.01) {
270 if (isoMatched->maxPtPxl() >
maxPNear)
273 ptNear = isoMatched->maxPtPxl();
280 if (fabs(trit->eta()) > 1.47 && trit->hitPattern().numberOfValidStripTECHits() <
MinNTECHitsEndcap)
284 edm::LogVerbatim(
"ValidIsoTrkCalib") <<
"Point 0.2.1 after numofvalidhits HB: "
285 << trit->hitPattern().numberOfValidHits();
286 edm::LogVerbatim(
"ValidIsoTrkCalib") <<
"Point 0.2.2 after numofvalidstrips HE: "
287 << trit->hitPattern().numberOfValidStripTECHits();
289 numVH = trit->hitPattern().numberOfValidHits();
290 numVS = trit->hitPattern().numberOfValidStripTECHits();
292 trackE =
sqrt(trit->px() * trit->px() + trit->py() * trit->py() + trit->pz() * trit->pz() + 0.14 * 0.14);
300 edm::LogVerbatim(
"ValidIsoTrkCalib") <<
"Point 0.3. Matched :: pt: " << trit->pt() <<
" wholeEnergy: " <<
trackE
346 ietatrue = tempId.
ieta();
347 iphitrue = tempId.
iphi();
354 std::vector<DetId> usedHits;
358 edm::LogVerbatim(
"ValidIsoTrkCalib") <<
"Point 1. Entrance to HBHECollection";
369 bool hitIsUsed =
false;
370 for (uint32_t
i = 0;
i < usedHits.size();
i++) {
371 if (usedHits[
i] == hhit->id())
376 usedHits.push_back(hhit->id());
387 int iphihitm = (hhit->id()).iphi();
388 int ietahitm = (hhit->id()).ieta();
389 int depthhit = (hhit->id()).
depth();
390 float enehit = hhit->energy() * recal;
397 if (dphi > 4. * atan(1.))
398 dphi = 8. * atan(1.) - dphi;
400 float dr =
sqrt(dphi * dphi + deta * deta);
408 int iphihitm2 = (hhit2->id()).iphi();
409 int ietahitm2 = (hhit2->id()).ieta();
410 int depthhit2 = (hhit2->id()).
depth();
411 float enehit2 = hhit2->energy() * recal;
413 if (iphihitm == iphihitm2 && ietahitm == ietahitm2 && depthhit != depthhit2)
414 enehit = enehit + enehit2;
418 edm::LogVerbatim(
"ValidIsoTrkCalib") <<
"IN CONE ieta: " << ietahitm <<
" iphi: " << iphihitm
419 <<
" depthhit: " << depthhit <<
" dr: " << dr <<
" energy: " << enehit;
425 MaxHit.
ietahitm = (hhit->id()).ieta();
426 MaxHit.
iphihitm = (hhit->id()).iphi();
427 MaxHit.
dr = distAtHcal;
440 <<
" dr: " << MaxHit.
dr;
441 edm::LogVerbatim(
"ValidIsoTrkCalib") <<
"Track ieta: " << ietatrue <<
" iphi: " << iphitrue;
446 Bool_t passCuts = kFALSE;
470 bool hitIsUsed =
false;
471 for (uint32_t
i = 0;
i < usedHits.size();
i++) {
472 if (usedHits[
i] == hhit->id())
477 usedHits.push_back(hhit->id());
480 if (MaxHit.
ietahitm * (hhit->id()).ieta() > 0) {
481 DIETA = MaxHit.
ietahitm - (hhit->id()).ieta();
483 if (MaxHit.
ietahitm * (hhit->id()).ieta() < 0) {
484 DIETA = MaxHit.
ietahitm - (hhit->id()).ieta();
485 DIETA = DIETA > 0 ? DIETA - 1 : DIETA + 1;
488 int DIPHI =
abs(MaxHit.
iphihitm - (hhit->id()).iphi());
489 DIPHI = DIPHI > 36 ? 72 - DIPHI : DIPHI;
491 int numbercell = 100;
499 if (
abs(DIETA) <= numbercell &&
500 (
abs(DIPHI) <= numbercell || (
abs(MaxHit.
ietahitm) >= 20 &&
abs(DIPHI) <= numbercell + 1))) {
503 if (passCuts && hhit->energy() > 0) {
512 if (hhit->id().ieta() == MaxHit.
ietahitm && hhit->id().iphi() == MaxHit.
iphihitm)
515 if (hhit->id().ieta() == MaxHit.
ietahitm && hhit->id().iphi() == MaxHit.
iphihitm)
516 iTime = hhit->time();
523 abs((hhit->id()).ieta()) <= 20 &&
abs(DIPHI) > 2)))) {
537 if (
abs(MaxHit.
ietahitm) == 21 &&
abs((hhit->id()).ieta()) <= 20 &&
abs(DIPHI) > 3)
546 if ((hhit->id().depth() == 1) && (
abs(hhit->id().ieta()) > 17) && (
abs(hhit->id().ieta()) < 29)) {
549 }
else if ((hhit->id().depth() == 2) && (
abs(hhit->id().ieta()) > 17) && (
abs(hhit->id().ieta()) < 29)) {
558 if (
abs(MaxHit.
ietahitm) == 21 &&
abs((hhit->id()).ieta()) <= 20 &&
abs(DIPHI) > 2)
567 if ((hhit->id().depth() == 1) && (
abs(hhit->id().ieta()) > 17) && (
abs(hhit->id().ieta()) < 29)) {
570 }
else if ((hhit->id().depth() == 2) && (
abs(hhit->id().ieta()) > 17) && (
abs(hhit->id().ieta()) < 29)) {
584 if ((hhit->id().depth() == 1) && (
abs(hhit->id().ieta()) > 17) && (
abs(hhit->id().ieta()) < 29)) {
587 }
else if ((hhit->id().depth() == 2) && (
abs(hhit->id().ieta()) > 17) && (
abs(hhit->id().ieta()) < 29)) {
602 if (MaxHit.
ietahitm * ietatrue > 0) {
605 if (MaxHit.
ietahitm * ietatrue < 0) {
609 diphi_M_P = diphi_M_P > 36 ? 72 - diphi_M_P : diphi_M_P;
633 iDr =
sqrt(diphi_M_P * diphi_M_P + dieta_M_P * dieta_M_P);
645 edm::LogVerbatim(
"ValidIsoTrkCalib") <<
" generalTracks Size: " << generalTracks->size();
647 int n = generalTracks->size();
651 gen = generalTracks->size();
652 iso = isoProdTracks->size();
653 pix = isoPixelTracks->size();
667 Int_t gencount = 0, isocount = 0, pixcount = 0;
668 for (reco::TrackCollection::const_iterator gentr = generalTracks->begin(); gentr != generalTracks->end(); gentr++) {
669 genPt[gencount] = gentr->pt();
670 genPhi[gencount] = gentr->phi();
671 genEta[gencount] = gentr->eta();
675 for (reco::TrackCollection::const_iterator isotr = isoProdTracks->begin(); isotr != isoProdTracks->end(); isotr++) {
676 isoPt[isocount] = isotr->pt();
677 isoPhi[isocount] = isotr->phi();
678 isoEta[isocount] = isotr->eta();
682 for (reco::IsolatedPixelTrackCandidateCollection::const_iterator pixtr = isoPixelTracks->begin();
683 pixtr != isoPixelTracks->end();
685 pixPt[pixcount] = pixtr->pt();
686 pixPhi[pixcount] = pixtr->phi();
687 pixEta[pixcount] = pixtr->eta();
699 nTracks = fs->
make<TH1F>(
"nTracks",
"general;number of general tracks", 11, -0.5, 10.5);
701 tTree = fs->
make<TTree>(
"tTree",
"Tree for gen info");
703 fTree = fs->
make<TTree>(
"fTree",
"Tree for IsoTrack Calibration");
705 fTree->Branch(
"eventNumber", &
eventNumber,
"eventNumber/I");
706 fTree->Branch(
"runNumber", &
runNumber,
"runNumber/I");
708 fTree->Branch(
"eClustBefore", &
eClustBefore,
"eClustBefore/F");
709 fTree->Branch(
"eClustAfter", &
eClustAfter,
"eClustAfter/F");
710 fTree->Branch(
"eTrack", &
eTrack,
"eTrack/F");
711 fTree->Branch(
"etaTrack", &
etaTrack,
"etaTrack/F");
712 fTree->Branch(
"phiTrack", &
phiTrack,
"phiTrack/F");
714 fTree->Branch(
"numHits", &
numHits,
"numHits/I");
715 fTree->Branch(
"eECAL", &
eECAL,
"eECAL/F");
716 fTree->Branch(
"PtNearBy", &
PtNearBy,
"PtNearBy/F");
717 fTree->Branch(
"numValidTrkHits", &
numValidTrkHits,
"numValidTrkHits/F");
720 fTree->Branch(
"eBeforeDepth1", &
eBeforeDepth1,
"eBeforeDepth1/F");
721 fTree->Branch(
"eBeforeDepth2", &
eBeforeDepth2,
"eBeforeDepth2/F");
722 fTree->Branch(
"eAfterDepth1", &
eAfterDepth1,
"eAfterDepth1/F");
723 fTree->Branch(
"eAfterDepth2", &
eAfterDepth2,
"eAfterDepth2/F");
725 fTree->Branch(
"e3x3Before", &
e3x3Before,
"e3x3Before/F");
726 fTree->Branch(
"e3x3After", &
e3x3After,
"e3x3After/F");
727 fTree->Branch(
"e5x5Before", &
e5x5Before,
"e5x5Before/F");
728 fTree->Branch(
"e5x5After", &
e5x5After,
"e5x5After/F");
730 fTree->Branch(
"eCentHitAfter", &
eCentHitAfter,
"eCentHitAfter/F");
731 fTree->Branch(
"eCentHitBefore", &
eCentHitBefore,
"eCentHitBefore/F");
732 fTree->Branch(
"iEta", &
iEta,
"iEta/I");
733 fTree->Branch(
"iPhi", &
iPhi,
"iPhi/I");
735 fTree->Branch(
"iEtaTr", &
iEtaTr,
"iEtaTr/I");
736 fTree->Branch(
"iPhiTr", &
iPhiTr,
"iPhiTr/I");
737 fTree->Branch(
"dietatr", &
dietatr,
"dietatr/I");
738 fTree->Branch(
"diphitr", &
diphitr,
"diphitr/I");
739 fTree->Branch(
"iDr", &
iDr,
"iDr/F");
740 fTree->Branch(
"delR", &
delR,
"delR/F");
742 fTree->Branch(
"iTime", &
iTime,
"iTime/F");
743 fTree->Branch(
"HTime",
HTime,
"HTime[numHits]/F");
745 fTree->Branch(
"xTrkEcal", &
xTrkEcal,
"xTrkEcal/F");
746 fTree->Branch(
"yTrkEcal", &
yTrkEcal,
"yTrkEcal/F");
747 fTree->Branch(
"zTrkEcal", &
zTrkEcal,
"zTrkEcal/F");
748 fTree->Branch(
"xTrkHcal", &
xTrkHcal,
"xTrkHcal/F");
749 fTree->Branch(
"yTrkHcal", &
yTrkHcal,
"yTrkHcal/F");
750 fTree->Branch(
"zTrkHcal", &
zTrkHcal,
"zTrkHcal/F");
753 tTree->Branch(
"gen", &
gen,
"gen/I");
754 tTree->Branch(
"iso", &
iso,
"iso/I");
755 tTree->Branch(
"pix", &
pix,
"pix/I");
756 tTree->Branch(
"genPt",
genPt,
"genPt[gen]/F");
760 tTree->Branch(
"isoPt",
isoPt,
"isoPt[iso]/F");
764 tTree->Branch(
"pixPt",
pixPt,
"pixPt[pix]/F");
static const std::string kSharedResource
Log< level::Info, true > LogVerbatim
const edm::EDGetTokenT< HORecHitCollection > tok_ho_
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
EventNumber_t event() const
const bool takeGenTracks_
void analyze(const edm::Event &, const edm::EventSetup &) override
DetId getClosestCell(const GlobalPoint &r) const override
const edm::EDGetTokenT< reco::TrackCollection > tok_track1_
#define DEFINE_FWK_MODULE(type)
void useDefaultPropagator()
use the default propagator
Geom::Phi< T > phi() const
std::vector< Track > TrackCollection
collection of Tracks
std::vector< T >::const_iterator const_iterator
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
const double calibrationConeSize_
TrackAssociatorParameters parameters_
T * make(const Args &...args) const
make new ROOT object
const Item * getValues(DetId fId, bool throwOnFail=true) const
const edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_recalibCorrs_
const bool allowMissingInputs_
math::XYZPoint trkGlobPosAtHcal
bool getData(T &iHolder) const
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
const double energyMinIso
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
std::vector< IsolatedPixelTrackCandidate > IsolatedPixelTrackCandidateCollection
collectin of IsolatedPixelTrackCandidate objects
const double energyECALmip
const HcalRespCorrs * respRecalib
const int MinNTrackHitsBarrel
ValidIsoTrkCalib(const edm::ParameterSet &)
const double energyMaxIso
std::string outputFileName_
std::vector< edm::InputTag > genecalLabel_
const_iterator end() const
const edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
const edm::EDGetTokenT< reco::IsolatedPixelTrackCandidateCollection > tok_track_
T const * product() const
const edm::InputTag genhbheLabel_
T getParameter(std::string const &) const
static FreeTrajectoryState getFreeTrajectoryState(const MagneticField *, const reco::Track &)
get FreeTrajectoryState from different track representations
const int MinNTECHitsEndcap
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)
const edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
Log< level::Warning, false > LogWarning
const double associationConeSize_
const_iterator begin() const
tok_geom_(esConsumes< CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun >())