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();
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;
396 float dphi = fabs(
info.trkGlobPosAtHcal.phi() -
pos.phi());
397 if (dphi > 4. * atan(1.))
398 dphi = 8. * atan(1.) - dphi;
399 float deta = fabs(
info.trkGlobPosAtHcal.eta() -
pos.eta());
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;
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());
485 DIETA = DIETA > 0 ? DIETA - 1 : DIETA + 1;
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)))) {
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)) {
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);
652 iso = isoProdTracks->size();
653 pix = isoPixelTracks->size();
667 Int_t gencount = 0, isocount = 0, pixcount = 0;
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");
739 fTree->Branch(
"iDr", &
iDr,
"iDr/F");
743 fTree->Branch(
"HTime",
HTime,
"HTime[numHits]/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_
T getParameter(std::string const &) 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
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_
const edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_recalibCorrs_
const bool allowMissingInputs_
const Item * getValues(DetId fId, bool throwOnFail=true) const
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
const double energyMinIso
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
constexpr int ieta() const
get the cell ieta
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > bFieldToken
Abs< T >::type abs(const T &t)
TrackDetectorAssociator trackAssociator_
std::vector< IsolatedPixelTrackCandidate > IsolatedPixelTrackCandidateCollection
collectin of IsolatedPixelTrackCandidate objects
bool getData(T &iHolder) const
const_iterator begin() const
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_
const edm::InputTag genhbheLabel_
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 &)
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 CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
constexpr int iphi() const
get the cell iphi