99 return std::make_unique<alCaHcalIsotrkProducer::Counters>();
112 std::vector<math::XYZTLorentzVector>& vecL1,
113 std::vector<math::XYZTLorentzVector>& vecL3,
115 std::vector<spr::propagatedTrackDirection>& trkCaloDirections,
116 std::vector<spr::propagatedTrackID>& trkCaloDets,
129 std::vector<HcalIsoTrkCalibVariables>& hocalib,
138 const std::vector<DetId>& ids,
139 std::vector<double>& edet,
141 std::vector<unsigned int>& detIds,
142 std::vector<double>& hitEnergies);
145 const std::vector<DetId>& ids,
146 std::vector<double>& hitEnergy1,
147 std::vector<double>& hitEnergy2);
220 theTrackQuality_(iConfig.getParameter<
std::
string>(
"trackQuality")),
221 processName_(iConfig.getParameter<
std::
string>(
"processName")),
222 l1Filter_(iConfig.getParameter<
std::
string>(
"l1Filter")),
223 l2Filter_(iConfig.getParameter<
std::
string>(
"l2Filter")),
224 l3Filter_(iConfig.getParameter<
std::
string>(
"l3Filter")),
225 a_coneR_(iConfig.getParameter<double>(
"coneRadius")),
226 a_mipR_(iConfig.getParameter<double>(
"coneRadiusMIP")),
227 a_mipR2_(iConfig.getParameter<double>(
"coneRadiusMIP2")),
228 a_mipR3_(iConfig.getParameter<double>(
"coneRadiusMIP3")),
229 a_mipR4_(iConfig.getParameter<double>(
"coneRadiusMIP4")),
230 a_mipR5_(iConfig.getParameter<double>(
"coneRadiusMIP5")),
231 pTrackMin_(iConfig.getParameter<double>(
"minimumTrackP")),
232 eEcalMax_(iConfig.getParameter<double>(
"maximumEcalEnergy")),
233 maxRestrictionP_(iConfig.getParameter<double>(
"maxTrackP")),
234 slopeRestrictionP_(iConfig.getParameter<double>(
"slopeTrackP")),
235 hcalScale_(iConfig.getUntrackedParameter<double>(
"hHcalScale", 1.0)),
236 eIsolate1_(iConfig.getParameter<double>(
"isolationEnergyTight")),
237 eIsolate2_(iConfig.getParameter<double>(
"isolationEnergyLoose")),
238 pTrackLow_(iConfig.getParameter<double>(
"momentumLow")),
239 pTrackHigh_(iConfig.getParameter<double>(
"momentumHigh")),
240 ignoreTrigger_(iConfig.getUntrackedParameter<
bool>(
"ignoreTriggers",
false)),
241 useL1Trigger_(iConfig.getUntrackedParameter<
bool>(
"useL1Trigger",
false)),
242 unCorrect_(iConfig.getUntrackedParameter<
bool>(
"unCorrect",
false)),
243 collapseDepth_(iConfig.getUntrackedParameter<
bool>(
"collapseDepth",
false)),
244 hitEthrEB_(iConfig.getParameter<double>(
"EBHitEnergyThreshold")),
245 hitEthrEE0_(iConfig.getParameter<double>(
"EEHitEnergyThreshold0")),
246 hitEthrEE1_(iConfig.getParameter<double>(
"EEHitEnergyThreshold1")),
247 hitEthrEE2_(iConfig.getParameter<double>(
"EEHitEnergyThreshold2")),
248 hitEthrEE3_(iConfig.getParameter<double>(
"EEHitEnergyThreshold3")),
249 hitEthrEELo_(iConfig.getParameter<double>(
"EEHitEnergyThresholdLow")),
250 hitEthrEEHi_(iConfig.getParameter<double>(
"EEHitEnergyThresholdHigh")),
251 triggerEvent_(iConfig.getParameter<
edm::
InputTag>(
"labelTriggerEvent")),
252 theTriggerResultsLabel_(iConfig.getParameter<
edm::
InputTag>(
"labelTriggerResult")),
253 labelGenTrack_(iConfig.getParameter<
std::
string>(
"labelTrack")),
254 labelRecVtx_(iConfig.getParameter<
std::
string>(
"labelVertex")),
255 labelEB_(iConfig.getParameter<
std::
string>(
"labelEBRecHit")),
256 labelEE_(iConfig.getParameter<
std::
string>(
"labelEERecHit")),
257 labelHBHE_(iConfig.getParameter<
std::
string>(
"labelHBHERecHit")),
258 labelTower_(iConfig.getParameter<
std::
string>(
"labelCaloTower")),
259 l1TrigName_(iConfig.getUntrackedParameter<
std::
string>(
"l1TrigName",
"L1_SingleJet60")),
260 oldID_(iConfig.getUntrackedParameter<
std::
vector<
int>>(
"oldID")),
261 newDepth_(iConfig.getUntrackedParameter<
std::
vector<
int>>(
"newDepth")),
262 hep17_(iConfig.getUntrackedParameter<
bool>(
"hep17")),
263 labelIsoTkVar_(iConfig.getParameter<
std::
string>(
"isoTrackLabel")),
264 labelIsoTkEvtVar_(iConfig.getParameter<
std::
string>(
"isoTrackEventLabel")),
265 debEvents_(iConfig.getParameter<
std::
vector<
int>>(
"debugEvents")),
266 usePFThresh_(iConfig.getParameter<
bool>(
"usePFThreshold")) {
268 const double isolationRadius(28.9), innerR(10.0), outerR(30.0);
298 for (
unsigned int k = 0;
k <
oldID_.size(); ++
k) {
307 tok_bs_ = consumes<reco::BeamSpot>(labelBS);
312 tok_alg_ = consumes<BXVector<GlobalAlgBlk>>(algTag);
313 tok_Muon_ = consumes<reco::MuonCollection>(labelMuon);
324 tok_ddrec_ = esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord, edm::Transition::BeginRun>();
325 tok_bFieldH_ = esConsumes<MagneticField, IdealMagneticFieldRecord>();
327 tok_sevlv_ = esConsumes<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd>();
328 tok_geom_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
330 tok_htopo_ = esConsumes<HcalTopology, HcalRecNumberingRecord>();
331 tok_resp_ = esConsumes<HcalRespCorrs, HcalRespCorrsRcd>();
335 <<
"Parameters read from config file \n" 353 <<
debEvents_.size() <<
" events to be debugged";
358 for (
unsigned int k = 0;
k <
oldID_.size(); ++
k)
362 for (
int i = 0;
i < 10;
i++)
364 for (
int i = 0;
i < 8; ++
i)
375 edm::LogVerbatim(
"HcalIsoTrack") <<
" Expected to produce the collections:\n" 376 <<
"HcalIsoTrkCalibVariablesCollection with label " <<
labelIsoTkVar_ 383 std::vector<std::string>
trig;
384 desc.add<std::vector<std::string>>(
"triggers",
trig);
390 desc.add<
double>(
"minTrackPt", 1.0);
391 desc.add<
double>(
"maxDxyPV", 0.02);
392 desc.add<
double>(
"maxDzPV", 0.02);
393 desc.add<
double>(
"maxChi2", 5.0);
394 desc.add<
double>(
"maxDpOverP", 0.1);
395 desc.add<
int>(
"minOuterHit", 4);
396 desc.add<
int>(
"minLayerCrossed", 8);
397 desc.add<
int>(
"maxInMiss", 0);
398 desc.add<
int>(
"maxOutMiss", 0);
400 desc.add<
double>(
"minimumTrackP", 10.0);
401 desc.add<
double>(
"coneRadius", 34.98);
403 desc.add<
double>(
"coneRadiusMIP", 14.0);
404 desc.add<
double>(
"coneRadiusMIP2", 18.0);
405 desc.add<
double>(
"coneRadiusMIP3", 20.0);
406 desc.add<
double>(
"coneRadiusMIP4", 22.0);
407 desc.add<
double>(
"coneRadiusMIP5", 24.0);
408 desc.add<
double>(
"maximumEcalEnergy", 2.0);
410 desc.add<
double>(
"maxTrackP", 8.0);
411 desc.add<
double>(
"slopeTrackP", 0.05090504066);
412 desc.add<
double>(
"isolationEnergyTight", 2.0);
413 desc.add<
double>(
"isolationEnergyLoose", 10.0);
415 desc.add<
double>(
"EBHitEnergyThreshold", 0.08);
416 desc.add<
double>(
"EEHitEnergyThreshold0", 0.30);
417 desc.add<
double>(
"EEHitEnergyThreshold1", 0.00);
418 desc.add<
double>(
"EEHitEnergyThreshold2", 0.00);
419 desc.add<
double>(
"EEHitEnergyThreshold3", 0.00);
420 desc.add<
double>(
"EEHitEnergyThresholdLow", 0.30);
421 desc.add<
double>(
"EEHitEnergyThresholdHigh", 0.30);
423 desc.add<
double>(
"momentumLow", 40.0);
424 desc.add<
double>(
"momentumHigh", 60.0);
425 desc.add<
int>(
"prescaleLow", 1);
426 desc.add<
int>(
"prescaleHigh", 1);
444 desc.addUntracked<
bool>(
"ignoreTriggers",
false);
445 desc.addUntracked<
bool>(
"useL1Trigger",
false);
446 desc.addUntracked<
double>(
"hcalScale", 1.0);
447 desc.addUntracked<
bool>(
"unCorrect",
false);
448 desc.addUntracked<
bool>(
"collapseDepth",
false);
450 std::vector<int>
dummy;
451 desc.addUntracked<std::vector<int>>(
"oldID",
dummy);
452 desc.addUntracked<std::vector<int>>(
"newDepth",
dummy);
453 desc.addUntracked<
bool>(
"hep17",
false);
455 desc.add<std::vector<int>>(
"debugEvents",
events);
456 desc.add<
bool>(
"usePFThreshold",
true);
457 descriptions.
add(
"alcaHcalIsotrkProducer",
desc);
468 <<
" Luminosity " <<
iEvent.luminosityBlock() <<
" Bunch " 469 <<
iEvent.bunchCrossing();
490 if (!trkCollection.isValid()) {
503 if (recVtxs.isValid() && !(recVtxs->empty())) {
505 for (
unsigned int k = 0;
k < recVtxs->size(); ++
k) {
506 if (!((*recVtxs)[
k].isFake()) && ((*recVtxs)[
k].ndof() > 4)) {
513 if (goodPV == 0 && beamSpotH.isValid()) {
514 leadPV = beamSpotH->position();
518 edm::LogVerbatim(
"HcalIsoTrack") <<
"Primary Vertex " << leadPV <<
" out of " << goodPV <<
" vertex";
519 if (beamSpotH.isValid())
526 if (!barrelRecHitsHandle.isValid()) {
531 if (!endcapRecHitsHandle.isValid()) {
536 if (!
hbhe.isValid()) {
548 std::vector<spr::propagatedTrackDirection> trkCaloDirections;
550 std::vector<spr::propagatedTrackID> trkCaloDets;
552 std::vector<math::XYZTLorentzVector> vecL1, vecL3;
553 isoTrkEvent.
tracks_ = trkCollection->size();
554 isoTrkEvent.
tracksProp_ = trkCaloDirections.size();
561 for (
const auto& decision : finalDecisions) {
562 if (decision.first.find(
l1TrigName_) != std::string::npos) {
563 isoTrkEvent.
l1Bit_ = decision.second;
570 <<
" from a list of " << finalDecisions.size() <<
" decisions";
579 for (
unsigned int iHLT = 0; iHLT <
triggerResults->size(); iHLT++) {
589 <<
"This trigger " <<
names[iHLT] <<
" Flag " <<
hlt <<
":" << isoTrkEvent.
hltbits_[
i];
603 auto outputHcalIsoTrackColl = std::make_unique<HcalIsoTrkCalibVariablesCollection>();
604 std::array<int, 3> ntksave{{0, 0, 0}};
626 *outputHcalIsoTrackColl,
635 if (!triggerEventHandle.isValid()) {
643 std::vector<std::string>
modules;
646 for (
unsigned int iHLT = 0; iHLT <
triggerResults->size(); iHLT++) {
651 std::vector<math::XYZTLorentzVector> vecL2;
655 for (
unsigned int ifilter = 0; ifilter <
triggerEvent.sizeFilters(); ++ifilter) {
656 std::vector<int>
Keys;
659 for (
unsigned int imodule = 0; imodule < moduleLabels.size(); imodule++) {
660 if (
label.find(moduleLabels[imodule]) !=
label.npos) {
665 for (
unsigned int ifiltrKey = 0; ifiltrKey <
triggerEvent.filterKeys(ifilter).size(); ++ifiltrKey) {
679 <<
"key " << ifiltrKey <<
" : pt " << TO.
pt() <<
" eta " << TO.
eta() <<
" phi " << TO.
phi()
680 <<
" mass " << TO.
mass() <<
" Id " << TO.
id();
686 <<
"sizes " << vecL1.size() <<
":" << vecL2.size() <<
":" << vecL3.size();
713 *outputHcalIsoTrackColl,
729 for (
auto itr = outputHcalIsoTrackColl->begin(); itr != outputHcalIsoTrackColl->end(); ++itr) {
735 auto outputEventcol = std::make_unique<HcalIsoTrkEventVariablesCollection>();
736 outputEventcol->emplace_back(isoTrkEvent);
742 globalCache()->nAll_ +=
nAll_;
743 globalCache()->nGood_ +=
nGood_;
744 globalCache()->nRange_ +=
nRange_;
749 <<
count->nRange_ <<
" events in the momentum range";
768 std::vector<math::XYZTLorentzVector>& vecL1,
769 std::vector<math::XYZTLorentzVector>& vecL3,
771 std::vector<spr::propagatedTrackDirection>& trkCaloDirections,
772 std::vector<spr::propagatedTrackID>& trkCaloDets,
785 std::vector<HcalIsoTrkCalibVariables>& hocalib,
788 int nSave(0),
nLoose(0), nTight(0);
793 std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
794 for (trkDetItr = trkCaloDirections.begin(),
nTracks = 0; trkDetItr != trkCaloDirections.end();
796 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
803 isoTk.
nTrk_ = trkCaloDirections.size();
804 isoTk.
rhoh_ = rhohEV;
807 if (!vecL1.empty()) {
808 isoTk.
l1pt_ = vecL1[0].pt();
809 isoTk.
l1eta_ = vecL1[0].eta();
810 isoTk.
l1phi_ = vecL1[0].phi();
812 if (!vecL3.empty()) {
813 isoTk.
l3pt_ = vecL3[0].pt();
814 isoTk.
l3eta_ = vecL3[0].eta();
815 isoTk.
l3phi_ = vecL3[0].phi();
818 isoTk.
p_ = pTrack->
p();
819 isoTk.
pt_ = pTrack->
pt();
824 << pTrack->
eta() <<
"|" << isoTk.
phi_ <<
"|" << isoTk.
p_;
828 for (
unsigned int k = 0;
k < vecL3.size(); ++
k) {
829 double dr =
dR(vecL3[
k], v4);
834 isoTk.
mindR1_ = (!vecL1.empty()) ?
dR(vecL1[0], v4) : 999;
841 if (trkDetItr->okHCAL) {
845 if (isoTk.
p_ > 40.0 && isoTk.
p_ <= 60.0)
852 oneCutParameters.
maxDzPV = 100;
855 bool qltyFlag =
spr::goodTrack(pTrack, leadPV, oneCutParameters,
false);
858 oneCutParameters.
maxDzPV = 100;
871 edm::LogVerbatim(
"HcalIsoTrack") <<
"qltyFlag|okECAL|okHCAL : " << qltyFlag <<
"|" << trkDetItr->okECAL <<
"|" 872 << trkDetItr->okHCAL <<
" eIsolation " << eIsolation;
875 if (trkDetItr->okECAL)
877 if (trkDetItr->okHCAL)
880 isoTk.
qltyFlag_ = (qltyFlag && trkDetItr->okECAL && trkDetItr->okHCAL);
889 std::vector<DetId> eIds;
890 std::vector<double> eHit;
897 trkDetItr->pointHCAL,
898 trkDetItr->pointECAL,
900 trkDetItr->directionECAL,
904 for (
unsigned int k = 0;
k < eIds.size(); ++
k) {
910 edm::LogVerbatim(
"HcalIsoTrack") <<
"eMIP before and after: " << eMipDR <<
":" << eEcal;
912 isoTk.
eMipDR_.emplace_back(eEcal);
915 std::vector<DetId> eIds2;
916 std::vector<double> eHit2;
923 trkDetItr->pointHCAL,
924 trkDetItr->pointECAL,
926 trkDetItr->directionECAL,
930 for (
unsigned int k = 0;
k < eIds2.size(); ++
k) {
936 edm::LogVerbatim(
"HcalIsoTrack") <<
"eMIP before and after: " << eMipDR2 <<
":" << eEcal2;
938 isoTk.
eMipDR_.emplace_back(eEcal2);
941 std::vector<DetId> eIds3;
942 std::vector<double> eHit3;
949 trkDetItr->pointHCAL,
950 trkDetItr->pointECAL,
952 trkDetItr->directionECAL,
956 for (
unsigned int k = 0;
k < eIds3.size(); ++
k) {
962 edm::LogVerbatim(
"HcalIsoTrack") <<
"eMIP before and after: " << eMipDR3 <<
":" << eEcal3;
964 isoTk.
eMipDR_.emplace_back(eEcal3);
967 std::vector<DetId> eIds4;
968 std::vector<double> eHit4;
975 trkDetItr->pointHCAL,
976 trkDetItr->pointECAL,
978 trkDetItr->directionECAL,
982 for (
unsigned int k = 0;
k < eIds4.size(); ++
k) {
988 edm::LogVerbatim(
"HcalIsoTrack") <<
"eMIP before and after: " << eMipDR4 <<
":" << eEcal4;
990 isoTk.
eMipDR_.emplace_back(eEcal4);
993 std::vector<DetId> eIds5;
994 std::vector<double> eHit5;
1000 endcapRecHitsHandle,
1001 trkDetItr->pointHCAL,
1002 trkDetItr->pointECAL,
1004 trkDetItr->directionECAL,
1008 for (
unsigned int k = 0;
k < eIds5.size(); ++
k) {
1014 edm::LogVerbatim(
"HcalIsoTrack") <<
"eMIP before and after: " << eMipDR5 <<
":" << eEcal5;
1016 isoTk.
eMipDR_.emplace_back(eEcal5);
1020 const DetId cellE(trkDetItr->detIdECAL);
1022 barrelRecHitsHandle,
1023 endcapRecHitsHandle,
1035 barrelRecHitsHandle,
1036 endcapRecHitsHandle,
1047 if (e11x11P.second && e15x15P.second) {
1048 isoTk.
eAnnular_ = (e15x15P.first - e11x11P.first);
1050 isoTk.
eAnnular_ = -(e15x15P.first - e11x11P.first);
1053 const DetId cellH(trkDetItr->detIdHCAL);
1055 theHBHETopology, cellH,
hbhe, 2, 2,
false,
true, -100.0, -100.0, -100.0, -100.0, -100.0, 100.0);
1057 theHBHETopology, cellH,
hbhe, 3, 3,
false,
true, -100.0, -100.0, -100.0, -100.0, -100.0, 100.0);
1062 <<
" Annular E (Ecal) " << e11x11P.first <<
":" << e15x15P.first <<
":" 1063 << isoTk.
eAnnular_ <<
" (Hcal) " << h5x5 <<
":" << h7x7 <<
":" 1072 int nRecHits(-999), nRecHits1(-999), nRecHits3(-999);
1073 std::vector<DetId> ids, ids1, ids3;
1074 std::vector<double> edet0, edet1, edet3;
1077 trkDetItr->pointHCAL,
1078 trkDetItr->pointECAL,
1080 trkDetItr->directionHCAL,
1086 for (
unsigned k = 0;
k < ids.size(); ++
k)
1090 std::pair<double, double> ehcal0 =
1098 trkDetItr->pointHCAL,
1099 trkDetItr->pointECAL,
1101 trkDetItr->directionHCAL,
1107 for (
unsigned k = 0;
k < ids1.size(); ++
k)
1111 std::pair<double, double> ehcal1 =
1119 trkDetItr->pointHCAL,
1120 trkDetItr->pointECAL,
1122 trkDetItr->directionHCAL,
1128 for (
unsigned k = 0;
k < ids3.size(); ++
k)
1132 std::pair<double, double> ehcal3 =
1145 <<
"This track : " <<
nTracks <<
" (pt|eta|phi|p) : " << isoTk.
pt_ <<
"|" << pTrack->
eta() <<
"|" 1146 << isoTk.
phi_ <<
"|" << isoTk.
p_ <<
" Generator Level p " << isoTk.
gentrackP_;
1151 for (
unsigned int ll = 0; ll < isoTk.
detIds_.size(); ll++) {
1156 for (
unsigned int ll = 0; ll < isoTk.
detIds1_.size(); ll++) {
1161 for (
unsigned int ll = 0; ll < isoTk.
detIds3_.size(); ll++) {
1170 <<
"Run " << eventId.
run() <<
" Event " << eventId.
event() <<
" Track " <<
nTracks <<
" p " << isoTk.
p_;
1171 hocalib.emplace_back(isoTk);
1184 if (isoTk.
p_ > 40.0 && isoTk.
p_ <= 60.0 && isoTk.
selectTk_) {
1189 for (
unsigned int k = 0;
k < isoTk.
trgbits_.size();
k++) {
1205 <<
" Charge Isolation " << isoTk.
hmaxNearP_ <<
":" << eIsolation;
1209 std::array<int, 3>
i3{{nSave,
nLoose, nTight}};
1221 double mindR(999.9);
1226 pmom =
p.momentum().R();
1234 std::vector<double> sumPFNallSMDQH2;
1239 for (
const auto& pf_it : (*
tower)) {
1244 hadder += pf_it.hadEt();
1246 sumPFNallSMDQH2.emplace_back(hadder);
1251 std::sort(sumPFNallSMDQH2.begin(), sumPFNallSMDQH2.end());
1252 if (sumPFNallSMDQH2.size() % 2)
1253 evt_smdq = sumPFNallSMDQH2[(sumPFNallSMDQH2.size() - 1) / 2];
1255 evt_smdq = (sumPFNallSMDQH2[sumPFNallSMDQH2.size() / 2] + sumPFNallSMDQH2[(sumPFNallSMDQH2.size() - 2) / 2]) / 2.;
1269 eThr =
static_cast<double>((*eThresholds_)[
id]);
1286 for (
unsigned int k = 0;
k <
oldID_.size(); ++
k) {
1295 const std::vector<DetId>& ids,
1296 std::vector<double>& edet,
1298 std::vector<unsigned int>& detIds,
1299 std::vector<double>& hitEnergies) {
1302 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1309 for (
const auto& en : edet)
1313 edm::LogWarning(
"HcalIsoTrack") <<
"Check inconsistent energies: " << eHcal <<
":" << ehcal <<
" from " 1314 << ids.size() <<
" cells";
1318 std::map<HcalDetId, double> hitMap;
1319 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1321 auto itr = hitMap.find(
id);
1322 if (itr == hitMap.end()) {
1323 hitMap[
id] = edet[
k];
1325 (itr->second) += edet[
k];
1328 detIds.reserve(hitMap.size());
1329 hitEnergies.reserve(hitMap.size());
1330 for (
const auto&
hit : hitMap) {
1331 detIds.emplace_back(
hit.first.rawId());
1332 hitEnergies.emplace_back(
hit.second);
1335 detIds.reserve(ids.size());
1336 hitEnergies.reserve(ids.size());
1337 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1338 detIds.emplace_back(ids[
k].
rawId());
1339 hitEnergies.emplace_back(edet[
k]);
1344 edm::LogVerbatim(
"HcalIsoTrack") <<
"StoreEnergy1::Input to storeEnergy with " << ids.size() <<
" cells";
1345 for (
unsigned int k = 0;
k < ids.size(); ++
k)
1347 edm::LogVerbatim(
"HcalIsoTrack") <<
"StoreEnergy1::Output of storeEnergy with " << detIds.size()
1348 <<
" cells and Etot " << eHcal;
1349 for (
unsigned int k = 0;
k < detIds.size(); ++
k)
1357 const std::vector<DetId>& ids,
1358 std::vector<double>& hitEnergy1,
1359 std::vector<double>& hitEnergy2) {
1360 double ehcal1(0), ehcal2(0);
1361 std::vector<double> edet1, edet2;
1362 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1363 double e1(0), e2(0);
1364 for (
auto itr =
hbhe->begin(); itr !=
hbhe->end(); ++itr) {
1365 if (itr->id() == ids[
k]) {
1375 edet1.emplace_back(
e1);
1376 edet2.emplace_back(e2);
1379 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1387 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1395 std::map<HcalDetId, std::pair<double, double>> hitMap;
1396 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1398 auto itr = hitMap.find(
id);
1399 if (itr == hitMap.end()) {
1400 hitMap[
id] = std::make_pair(edet1[
k], edet2[
k]);
1402 (itr->second).
first += edet1[
k];
1403 (itr->second).
second += edet2[
k];
1406 hitEnergy1.reserve(hitMap.size());
1407 hitEnergy2.reserve(hitMap.size());
1408 for (
const auto&
hit : hitMap) {
1409 hitEnergy1.emplace_back(
hit.second.first);
1410 hitEnergy2.emplace_back(
hit.second.second);
1413 hitEnergy1.reserve(ids.size());
1414 hitEnergy2.reserve(ids.size());
1415 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1416 hitEnergy1.emplace_back(edet1[
k]);
1417 hitEnergy2.emplace_back(edet2[
k]);
1422 edm::LogVerbatim(
"HcalIsoTrack") <<
"StoreEnergy2::Input to storeEnergy with " << ids.size() <<
" cells";
1423 edm::LogVerbatim(
"HcalIsoTrack") <<
"StoreEnergy2::Output of storeEnergy with " << hitEnergy1.size()
1424 <<
" cells and Etot " << ehcal1 <<
":" << ehcal2;
1425 for (
unsigned int k = 0;
k < hitEnergy1.size(); ++
k)
1426 edm::LogVerbatim(
"HcalIsoTrack") <<
"Hit [" <<
k <<
"] " << hitEnergy1[
k] <<
" : " << hitEnergy2[
k];
1429 return std::make_pair(ehcal1, ehcal2);
1434 for (reco::MuonCollection::const_iterator recMuon = muonh->begin(); recMuon != muonh->end(); ++recMuon) {
1435 if (recMuon->innerTrack().isNonnull()) {
1436 const reco::Track* pTrack = (recMuon->innerTrack()).
get();
1437 bool mediumMuon = (((recMuon->isPFMuon()) && (recMuon->isGlobalMuon() || recMuon->isTrackerMuon())) &&
1438 (recMuon->innerTrack()->validFraction() > 0.49));
1440 double chiGlobal = ((recMuon->globalTrack().isNonnull()) ? recMuon->globalTrack()->normalizedChi2() : 999);
1441 bool goodGlob = (recMuon->isGlobalMuon() && chiGlobal < 3 &&
1442 recMuon->combinedQuality().chi2LocalPosition < 12 && recMuon->combinedQuality().trkKink < 20);
constexpr double deltaPhi(double phi1, double phi2)
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
AlCaHcalIsotrkProducer(edm::ParameterSet const &, const alCaHcalIsotrkProducer::Counters *)
edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, const std::string &theTrackQuality, bool debug=false)
std::vector< double > hitEnergies1Raw_
T getParameter(std::string const &) const
const std::string labelGenTrack_
std::vector< double > hitEnergies3_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
The single EDProduct to be saved for each event (AOD case)
std::vector< unsigned int > detIds3_
HcalDetId mergedDepthDetId(const HcalDetId &id) const
constexpr int zside() const
get the z-side of the cell (1/-1)
std::vector< double > hitEnergies_
const double hitEthrEELo_
~AlCaHcalIsotrkProducer() override=default
TrackQuality
track quality
constexpr int ietaAbs() const
get the absolute value of the cell ieta
void beginRun(edm::Run const &, edm::EventSetup const &) override
double px() const
x coordinate of momentum vector
std::vector< int > trackType_
double p() const
momentum vector magnitude
std::vector< unsigned int > detIds1_
std::vector< int > oldDet_
const double slopeRestrictionP_
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
edm::EDGetTokenT< trigger::TriggerEvent > tok_trigEvt_
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
double py() const
y coordinate of momentum vector
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const std::string labelIsoTkEvtVar_
std::vector< bool > trgbits_
const double hitEthrEEHi_
double chargeIsolationCone(unsigned int trkIndex, std::vector< spr::propagatedTrackDirection > &trkDirs, double dR, int &nNearTRKs, bool debug=false)
std::vector< int > ietaAll_
const std::string l1TrigName_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
edm::EDGetTokenT< reco::GenParticleCollection > tok_parts_
void endStream() override
std::vector< int > oldEta_
std::vector< unsigned int > detIds_
void storeEnergy(const HcalRespCorrs *respCorrs, const std::vector< DetId > &ids, std::vector< double > &edet, double &eHcal, std::vector< unsigned int > &detIds, std::vector< double > &hitEnergies)
const std::string names[nVars_]
bool notaMuon(const reco::Track *pTrack0, const edm::Handle< reco::MuonCollection > &muonh)
const bool ignoreTrigger_
const std::string labelEB_
const Item * getValues(DetId fId, bool throwOnFail=true) const
const std::string labelRecVtx_
std::vector< double > hitEnergiesRaw_
Single trigger physics object (e.g., an isolated muon)
U second(std::pair< T, U > const &p)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
edm::EDGetTokenT< BXVector< GlobalAlgBlk > > tok_alg_
double pt() const
track transverse momentum
constexpr HcalSubdetector subdet() const
get the subdetector
std::vector< int > oldDepth_
double dR(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
const HcalDDDRecConstants * hdc_
const std::string labelIsoTkVar_
spr::trackSelectionParameters selectionParameter_
TupleMultiplicity< TrackerTraits > const HitToTuple< TrackerTraits > const cms::cuda::AtomicPairCounter GPUCACellT< TrackerTraits > const *__restrict__ uint32_t const *__restrict__ CellNeighborsVector< TrackerTraits > const CellTracksVector< TrackerTraits > const OuterHitOfCell< TrackerTraits > const int32_t uint32_t Counters * counters
edm::EDGetTokenT< CaloTowerCollection > tok_cala_
double chargeIsolationEcal(unsigned int trkIndex, std::vector< spr::propagatedTrackID > &vdetIds, const CaloGeometry *geo, const CaloTopology *caloTopology, int ieta, int iphi, bool debug=false)
const std::string labelEE_
std::vector< double > phibins_
std::vector< double > hitEnergies1Aux_
const std::vector< int > debEvents_
double rhoh(const edm::Handle< CaloTowerCollection > &)
const edm::InputTag triggerEvent_
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
const bool collapseDepth_
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
l1t::L1TGlobalUtil * l1GtUtils_
std::vector< double > vec1
std::vector< bool > hltbits_
constexpr int ieta() const
get the cell ieta
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
Abs< T >::type abs(const T &t)
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
double phi() const
azimuthal angle of momentum vector
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)
std::vector< double > hitEnergies1_
#define DEFINE_FWK_MODULE(type)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
const double maxRestrictionP_
double trackP(const reco::Track *, const edm::Handle< reco::GenParticleCollection > &)
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
static std::string const triggerResults
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > tok_htopo_
const std::vector< int > newDepth_
HLTConfigProvider hltConfig_
std::vector< double > hitEnergies3Raw_
const edm::InputTag theTriggerResultsLabel_
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > tok_sevlv_
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
edm::EDGetTokenT< reco::BeamSpot > tok_bs_
const std::string labelTower_
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
static void globalEndJob(const alCaHcalIsotrkProducer::Counters *counters)
edm::EDGetTokenT< reco::MuonCollection > tok_Muon_
double eta() const
pseudorapidity of momentum vector
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tok_bFieldH_
static TrackQuality qualityByName(const std::string &name)
std::vector< double > hitEnergies3Aux_
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
std::atomic< unsigned int > nAll_
XYZPointD XYZPoint
point in space with cartesian internal representation
std::vector< size_type > Keys
const std::string processName_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
double pz() const
z coordinate of momentum vector
const EcalPFRecHitThresholds * eThresholds_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const std::string l1Filter_
std::vector< double > eMipDR_
edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_ddrec_
std::atomic< unsigned int > nGood_
edm::EDGetTokenT< GenEventInfoProduct > tok_ew_
edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > tok_ecalChStatus_
edm::EDGetTokenT< edm::TriggerResults > tok_trigRes_
DetId newId(const DetId &)
static std::unique_ptr< alCaHcalIsotrkProducer::Counters > initializeGlobalCache(edm::ParameterSet const &)
reco::TrackBase::TrackQuality minQuality
std::vector< int > ietaGood_
const std::vector< std::pair< std::string, bool > > & decisionsFinal()
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_resp_
const std::string l3Filter_
const std::vector< int > oldID_
const std::string l2Filter_
edm::ESGetToken< CaloTopology, CaloTopologyRecord > tok_caloTopology_
Log< level::Warning, false > LogWarning
const std::string theTrackQuality_
std::vector< double > hitEnergiesAux_
const std::string labelHBHE_
double eThreshold(const DetId &id, const CaloGeometry *geo) const
std::array< int, 3 > getProducts(int goodPV, double eventWeight, std::vector< math::XYZTLorentzVector > &vecL1, std::vector< math::XYZTLorentzVector > &vecL3, math::XYZPoint &leadPV, std::vector< spr::propagatedTrackDirection > &trkCaloDirections, std::vector< spr::propagatedTrackID > &trkCaloDets, const CaloGeometry *geo, const CaloTopology *topo, const HcalTopology *theHBHETopology, const EcalChannelStatus *theEcalChStatus, const EcalSeverityLevelAlgo *theEcalSevlv, edm::Handle< EcalRecHitCollection > &barrelRecHitsHandle, edm::Handle< EcalRecHitCollection > &endcapRecHitsHandle, edm::Handle< HBHERecHitCollection > &hbhe, edm::Handle< CaloTowerCollection > &towerHandle, const edm::Handle< reco::GenParticleCollection > &genParticles, const HcalRespCorrs *respCorrs, const edm::Handle< reco::MuonCollection > &muonh, std::vector< HcalIsoTrkCalibVariables > &hocalib, HcalIsoTrkEventVariables &hocalibEvent, const edm::EventID &eventId)
constexpr int iphi() const
get the cell iphi
const std::vector< std::string > trigNames_
void retrieveL1(const edm::Event &iEvent, const edm::EventSetup &evSetup)
initialize the class (mainly reserve)
EventNumber_t event() const
std::vector< double > etabins_
std::atomic< unsigned int > nRange_
void produce(edm::Event &, edm::EventSetup const &) override
edm::ESGetToken< EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd > tok_ecalPFRecHitThresholds_
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)
double eHCALmatrix(const HcalTopology *topology, const DetId &det, edm::Handle< T > &hits, int ieta, int iphi, bool includeHO=false, bool algoNew=true, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100, double tMin=-500, double tMax=500, int useRaw=0, bool debug=false)
void endRun(edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< reco::VertexCollection > tok_recVtx_
constexpr int depth() const
get the tower depth