174 : takeGenTracks_(iConfig.getUntrackedParameter<
bool>(
"takeGenTracks")),
175 genhbheLabel_(iConfig.getParameter<
edm::
InputTag>(
"genHBHE")),
176 associationConeSize_(iConfig.getParameter<double>(
"associationConeSize")),
177 allowMissingInputs_(iConfig.getUntrackedParameter<
bool>(
"allowMissingInputs",
true)),
178 AxB_(iConfig.getParameter<
std::
string>(
"AxB")),
179 calibrationConeSize_(iConfig.getParameter<double>(
"calibrationConeSize")),
180 MinNTrackHitsBarrel(iConfig.getParameter<
int>(
"MinNTrackHitsBarrel")),
181 MinNTECHitsEndcap(iConfig.getParameter<
int>(
"MinNTECHitsEndcap")),
182 energyECALmip(iConfig.getParameter<double>(
"energyECALmip")),
183 energyMinIso(iConfig.getParameter<double>(
"energyMinIso")),
184 energyMaxIso(iConfig.getParameter<double>(
"energyMaxIso")),
185 maxPNear(iConfig.getParameter<double>(
"maxPNear")),
190 iConfig.getParameter<
edm::
InputTag>(
"HcalIsolTrackInput"))),
232 edm::LogVerbatim(
"ValidIsoTrkCalib") <<
"Hello World. TrackCollectionSize: " << isoPixelTracks->size();
234 if (isoPixelTracks->empty())
237 for (reco::TrackCollection::const_iterator trit = isoProdTracks->begin(); trit != isoProdTracks->end(); trit++) {
238 reco::IsolatedPixelTrackCandidateCollection::const_iterator isoMatched = isoPixelTracks->begin();
241 for (reco::IsolatedPixelTrackCandidateCollection::const_iterator it = isoPixelTracks->begin();
242 it != isoPixelTracks->end();
244 if (
abs((trit->pt() - it->pt()) / it->pt()) < 0.005 &&
abs(trit->eta() - it->eta()) < 0.01) {
254 if (isoMatched->maxPtPxl() >
maxPNear)
257 ptNear = isoMatched->maxPtPxl();
264 if (fabs(trit->eta()) > 1.47 && trit->hitPattern().numberOfValidStripTECHits() <
MinNTECHitsEndcap)
268 edm::LogVerbatim(
"ValidIsoTrkCalib") <<
"Point 0.2.1 after numofvalidhits HB: " 269 << trit->hitPattern().numberOfValidHits();
270 edm::LogVerbatim(
"ValidIsoTrkCalib") <<
"Point 0.2.2 after numofvalidstrips HE: " 271 << trit->hitPattern().numberOfValidStripTECHits();
273 numVH = trit->hitPattern().numberOfValidHits();
274 numVS = trit->hitPattern().numberOfValidStripTECHits();
276 trackE =
sqrt(trit->px() * trit->px() + trit->py() * trit->py() + trit->pz() * trit->pz() + 0.14 * 0.14);
284 edm::LogVerbatim(
"ValidIsoTrkCalib") <<
"Point 0.3. Matched :: pt: " << trit->pt() <<
" wholeEnergy: " <<
trackE 317 ietatrue = tempId.
ieta();
318 iphitrue = tempId.
iphi();
325 std::vector<DetId> usedHits;
328 edm::LogVerbatim(
"ValidIsoTrkCalib") <<
"Point 1. Entrance to HBHECollection";
335 bool hitIsUsed =
false;
336 for (uint32_t
i = 0;
i < usedHits.size();
i++) {
337 if (usedHits[
i] == hhit->id())
342 usedHits.push_back(hhit->id());
351 int iphihitm = (hhit->id()).
iphi();
352 int ietahitm = (hhit->id()).
ieta();
353 int depthhit = (hhit->id()).
depth();
354 float enehit = hhit->energy() * recal;
360 float dphi = fabs(
info.trkGlobPosAtHcal.phi() -
pos.phi());
361 if (dphi > 4. * atan(1.))
362 dphi = 8. * atan(1.) - dphi;
363 float deta = fabs(
info.trkGlobPosAtHcal.eta() -
pos.eta());
364 float dr =
sqrt(dphi * dphi + deta * deta);
371 int iphihitm2 = (hhit2->id()).
iphi();
372 int ietahitm2 = (hhit2->id()).
ieta();
373 int depthhit2 = (hhit2->id()).
depth();
374 float enehit2 = hhit2->energy() * recal;
376 if (iphihitm == iphihitm2 && ietahitm == ietahitm2 && depthhit != depthhit2)
377 enehit = enehit + enehit2;
381 edm::LogVerbatim(
"ValidIsoTrkCalib") <<
"IN CONE ieta: " << ietahitm <<
" iphi: " << iphihitm
382 <<
" depthhit: " << depthhit <<
" dr: " <<
dr <<
" energy: " << enehit;
390 MaxHit.
dr = distAtHcal;
400 <<
" dr: " << MaxHit.
dr;
401 edm::LogVerbatim(
"ValidIsoTrkCalib") <<
"Track ieta: " << ietatrue <<
" iphi: " << iphitrue;
406 Bool_t passCuts = kFALSE;
430 bool hitIsUsed =
false;
431 for (uint32_t
i = 0;
i < usedHits.size();
i++) {
432 if (usedHits[
i] == hhit->id())
437 usedHits.push_back(hhit->id());
445 DIETA = DIETA > 0 ? DIETA - 1 : DIETA + 1;
449 DIPHI = DIPHI > 36 ? 72 - DIPHI : DIPHI;
451 int numbercell = 100;
453 if (
abs(DIETA) <= numbercell &&
454 (
abs(DIPHI) <= numbercell || (
abs(MaxHit.
ietahitm) >= 20 &&
abs(DIPHI) <= numbercell + 1))) {
457 if (passCuts && hhit->energy() > 0) {
464 if (hhit->id().ieta() == MaxHit.
ietahitm && hhit->id().iphi() == MaxHit.
iphihitm)
467 if (hhit->id().ieta() == MaxHit.
ietahitm && hhit->id().iphi() == MaxHit.
iphihitm)
468 iTime = hhit->time();
475 abs((hhit->id()).
ieta()) <= 20 &&
abs(DIPHI) > 2)))) {
498 if ((hhit->id().depth() == 1) && (
abs(hhit->id().ieta()) > 17) && (
abs(hhit->id().ieta()) < 29)) {
501 }
else if ((hhit->id().depth() == 2) && (
abs(hhit->id().ieta()) > 17) && (
abs(hhit->id().ieta()) < 29)) {
519 if ((hhit->id().depth() == 1) && (
abs(hhit->id().ieta()) > 17) && (
abs(hhit->id().ieta()) < 29)) {
522 }
else if ((hhit->id().depth() == 2) && (
abs(hhit->id().ieta()) > 17) && (
abs(hhit->id().ieta()) < 29)) {
536 if ((hhit->id().depth() == 1) && (
abs(hhit->id().ieta()) > 17) && (
abs(hhit->id().ieta()) < 29)) {
539 }
else if ((hhit->id().depth() == 2) && (
abs(hhit->id().ieta()) > 17) && (
abs(hhit->id().ieta()) < 29)) {
554 if (MaxHit.
ietahitm * ietatrue > 0) {
557 if (MaxHit.
ietahitm * ietatrue < 0) {
561 diphi_M_P = diphi_M_P > 36 ? 72 - diphi_M_P : diphi_M_P;
585 iDr =
sqrt(diphi_M_P * diphi_M_P + dieta_M_P * dieta_M_P);
604 iso = isoProdTracks->size();
605 pix = isoPixelTracks->size();
619 Int_t gencount = 0, isocount = 0, pixcount = 0;
621 genPt[gencount] = gentr->pt();
622 genPhi[gencount] = gentr->phi();
623 genEta[gencount] = gentr->eta();
627 for (reco::TrackCollection::const_iterator isotr = isoProdTracks->begin(); isotr != isoProdTracks->end(); isotr++) {
628 isoPt[isocount] = isotr->pt();
629 isoPhi[isocount] = isotr->phi();
630 isoEta[isocount] = isotr->eta();
634 for (reco::IsolatedPixelTrackCandidateCollection::const_iterator pixtr = isoPixelTracks->begin();
635 pixtr != isoPixelTracks->end();
637 pixPt[pixcount] = pixtr->pt();
638 pixPhi[pixcount] = pixtr->phi();
639 pixEta[pixcount] = pixtr->eta();
651 nTracks =
fs->make<TH1F>(
"nTracks",
"general;number of general tracks", 11, -0.5, 10.5);
653 tTree =
fs->make<TTree>(
"tTree",
"Tree for gen info");
655 fTree =
fs->make<TTree>(
"fTree",
"Tree for IsoTrack Calibration");
691 fTree->Branch(
"iDr", &
iDr,
"iDr/F");
695 fTree->Branch(
"HTime",
HTime,
"HTime[numHits]/F");
705 tTree->Branch(
"gen", &
gen,
"gen/I");
706 tTree->Branch(
"iso", &
iso,
"iso/I");
707 tTree->Branch(
"pix", &
pix,
"pix/I");
708 tTree->Branch(
"genPt",
genPt,
"genPt[gen]/F");
712 tTree->Branch(
"isoPt",
isoPt,
"isoPt[iso]/F");
716 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
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
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_
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
#define DEFINE_FWK_MODULE(type)
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