84 namespace alcaHcalIsoTracks {
97 return std::make_unique<alcaHcalIsoTracks::Counters>();
110 std::vector<math::XYZTLorentzVector>& vecL1,
111 std::vector<math::XYZTLorentzVector>& vecL3,
113 std::vector<spr::propagatedTrackDirection>& trkCaloDirections,
114 std::vector<spr::propagatedTrackID>& trkCaloDets,
127 std::vector<HcalIsoTrkCalibVariables>& hocalib,
135 const std::vector<DetId>& ids,
136 std::vector<double>& edet,
138 std::vector<unsigned int>& detIds,
139 std::vector<double>& hitEnergies);
142 const std::vector<DetId>& ids,
143 std::vector<double>& hitEnergy1,
144 std::vector<double>& hitEnergy2);
212 trigNames_(iConfig.getParameter<std::
vector<std::
string>>(
"triggers")),
213 theTrackQuality_(iConfig.getParameter<std::
string>(
"trackQuality")),
214 processName_(iConfig.getParameter<std::
string>(
"processName")),
215 l1Filter_(iConfig.getParameter<std::
string>(
"l1Filter")),
216 l2Filter_(iConfig.getParameter<std::
string>(
"l2Filter")),
217 l3Filter_(iConfig.getParameter<std::
string>(
"l3Filter")),
218 a_coneR_(iConfig.getParameter<double>(
"coneRadius")),
219 a_mipR_(iConfig.getParameter<double>(
"coneRadiusMIP")),
220 a_mipR2_(iConfig.getParameter<double>(
"coneRadiusMIP2")),
221 a_mipR3_(iConfig.getParameter<double>(
"coneRadiusMIP3")),
222 a_mipR4_(iConfig.getParameter<double>(
"coneRadiusMIP4")),
223 a_mipR5_(iConfig.getParameter<double>(
"coneRadiusMIP5")),
224 pTrackMin_(iConfig.getParameter<double>(
"minimumTrackP")),
225 eEcalMax_(iConfig.getParameter<double>(
"maximumEcalEnergy")),
226 maxRestrictionP_(iConfig.getParameter<double>(
"maxTrackP")),
227 slopeRestrictionP_(iConfig.getParameter<double>(
"slopeTrackP")),
228 hcalScale_(iConfig.getUntrackedParameter<double>(
"hHcalScale", 1.0)),
229 eIsolate1_(iConfig.getParameter<double>(
"isolationEnergyTight")),
230 eIsolate2_(iConfig.getParameter<double>(
"isolationEnergyLoose")),
231 pTrackLow_(iConfig.getParameter<double>(
"momentumLow")),
232 pTrackHigh_(iConfig.getParameter<double>(
"momentumHigh")),
233 ignoreTrigger_(iConfig.getUntrackedParameter<bool>(
"ignoreTriggers",
false)),
234 useL1Trigger_(iConfig.getUntrackedParameter<bool>(
"useL1Trigger",
false)),
235 unCorrect_(iConfig.getUntrackedParameter<bool>(
"unCorrect",
false)),
236 collapseDepth_(iConfig.getUntrackedParameter<bool>(
"collapseDepth",
false)),
237 hitEthrEB_(iConfig.getParameter<double>(
"EBHitEnergyThreshold")),
238 hitEthrEE0_(iConfig.getParameter<double>(
"EEHitEnergyThreshold0")),
239 hitEthrEE1_(iConfig.getParameter<double>(
"EEHitEnergyThreshold1")),
240 hitEthrEE2_(iConfig.getParameter<double>(
"EEHitEnergyThreshold2")),
241 hitEthrEE3_(iConfig.getParameter<double>(
"EEHitEnergyThreshold3")),
242 hitEthrEELo_(iConfig.getParameter<double>(
"EEHitEnergyThresholdLow")),
243 hitEthrEEHi_(iConfig.getParameter<double>(
"EEHitEnergyThresholdHigh")),
244 triggerEvent_(iConfig.getParameter<edm::
InputTag>(
"labelTriggerEvent")),
245 theTriggerResultsLabel_(iConfig.getParameter<edm::
InputTag>(
"labelTriggerResult")),
246 labelGenTrack_(iConfig.getParameter<std::
string>(
"labelTrack")),
247 labelRecVtx_(iConfig.getParameter<std::
string>(
"labelVertex")),
248 labelEB_(iConfig.getParameter<std::
string>(
"labelEBRecHit")),
249 labelEE_(iConfig.getParameter<std::
string>(
"labelEERecHit")),
250 labelHBHE_(iConfig.getParameter<std::
string>(
"labelHBHERecHit")),
251 labelTower_(iConfig.getParameter<std::
string>(
"labelCaloTower")),
252 l1TrigName_(iConfig.getUntrackedParameter<std::
string>(
"l1TrigName",
"L1_SingleJet60")),
253 oldID_(iConfig.getUntrackedParameter<std::
vector<int>>(
"oldID")),
254 newDepth_(iConfig.getUntrackedParameter<std::
vector<int>>(
"newDepth")),
255 hep17_(iConfig.getUntrackedParameter<bool>(
"hep17")),
256 labelIsoTkVar_(iConfig.getParameter<std::
string>(
"isoTrackLabel")),
257 labelIsoTkEvtVar_(iConfig.getParameter<std::
string>(
"isoTrackEventLabel")),
258 debEvents_(iConfig.getParameter<std::
vector<int>>(
"debugEvents")) {
260 const double isolationRadius(28.9), innerR(10.0), outerR(30.0);
290 for (
unsigned int k = 0;
k <
oldID_.size(); ++
k) {
299 tok_bs_ = consumes<reco::BeamSpot>(labelBS);
304 tok_alg_ = consumes<BXVector<GlobalAlgBlk>>(algTag);
305 tok_Muon_ = consumes<reco::MuonCollection>(labelMuon);
316 tok_ddrec_ = esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord, edm::Transition::BeginRun>();
317 tok_bFieldH_ = esConsumes<MagneticField, IdealMagneticFieldRecord>();
319 tok_sevlv_ = esConsumes<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd>();
320 tok_geom_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
322 tok_htopo_ = esConsumes<HcalTopology, HcalRecNumberingRecord>();
323 tok_resp_ = esConsumes<HcalRespCorrs, HcalRespCorrsRcd>();
335 <<
":" <<
a_coneR2_ <<
"\t a_charIsoR " << a_charIsoR_ <<
"\t a_mipR " <<
a_mipR_
349 <<
debEvents_.size() <<
" events to be debugged";
354 for (
unsigned int k = 0;
k <
oldID_.size(); ++
k)
358 for (
int i = 0;
i < 10;
i++)
360 for (
int i = 0;
i < 8; ++
i)
371 edm::LogVerbatim(
"HcalIsoTrack") <<
" Expected to produce the collections:\n"
372 <<
"HcalIsoTrkCalibVariablesCollection with label " <<
labelIsoTkVar_
379 std::vector<std::string> trig;
380 desc.
add<std::vector<std::string>>(
"triggers", trig);
386 desc.
add<
double>(
"minTrackPt", 1.0);
387 desc.
add<
double>(
"maxDxyPV", 0.02);
388 desc.
add<
double>(
"maxDzPV", 0.02);
389 desc.
add<
double>(
"maxChi2", 5.0);
390 desc.
add<
double>(
"maxDpOverP", 0.1);
391 desc.
add<
int>(
"minOuterHit", 4);
392 desc.
add<
int>(
"minLayerCrossed", 8);
393 desc.
add<
int>(
"maxInMiss", 0);
394 desc.
add<
int>(
"maxOutMiss", 0);
396 desc.
add<
double>(
"minimumTrackP", 10.0);
397 desc.
add<
double>(
"coneRadius", 34.98);
399 desc.
add<
double>(
"coneRadiusMIP", 14.0);
400 desc.
add<
double>(
"coneRadiusMIP2", 18.0);
401 desc.
add<
double>(
"coneRadiusMIP3", 20.0);
402 desc.
add<
double>(
"coneRadiusMIP4", 22.0);
403 desc.
add<
double>(
"coneRadiusMIP5", 24.0);
404 desc.
add<
double>(
"maximumEcalEnergy", 2.0);
406 desc.
add<
double>(
"maxTrackP", 8.0);
407 desc.
add<
double>(
"slopeTrackP", 0.05090504066);
408 desc.
add<
double>(
"isolationEnergyTight", 2.0);
409 desc.
add<
double>(
"isolationEnergyLoose", 10.0);
411 desc.
add<
double>(
"EBHitEnergyThreshold", 0.08);
412 desc.
add<
double>(
"EEHitEnergyThreshold0", 0.30);
413 desc.
add<
double>(
"EEHitEnergyThreshold1", 0.00);
414 desc.
add<
double>(
"EEHitEnergyThreshold2", 0.00);
415 desc.
add<
double>(
"EEHitEnergyThreshold3", 0.00);
416 desc.
add<
double>(
"EEHitEnergyThresholdLow", 0.30);
417 desc.
add<
double>(
"EEHitEnergyThresholdHigh", 0.30);
419 desc.
add<
double>(
"momentumLow", 40.0);
420 desc.
add<
double>(
"momentumHigh", 60.0);
421 desc.
add<
int>(
"prescaleLow", 1);
422 desc.
add<
int>(
"prescaleHigh", 1);
446 std::vector<int> dummy;
451 desc.
add<std::vector<int>>(
"debugEvents",
events);
452 descriptions.
add(
"alcaHcalIsotrkProducer", desc);
481 if (!trkCollection.isValid()) {
494 if (recVtxs.isValid() && !(recVtxs->empty())) {
496 for (
unsigned int k = 0;
k < recVtxs->size(); ++
k) {
497 if (!((*recVtxs)[
k].isFake()) && ((*recVtxs)[
k].ndof() > 4)) {
504 if (goodPV == 0 && beamSpotH.isValid()) {
505 leadPV = beamSpotH->position();
509 edm::LogVerbatim(
"HcalIsoTrack") <<
"Primary Vertex " << leadPV <<
" out of " << goodPV <<
" vertex";
510 if (beamSpotH.isValid())
517 if (!barrelRecHitsHandle.isValid()) {
522 if (!endcapRecHitsHandle.isValid()) {
527 if (!hbhe.isValid()) {
536 double eventWeight = (genEventInfo.isValid()) ? genEventInfo->weight() : 1.0;
539 std::vector<spr::propagatedTrackDirection> trkCaloDirections;
541 std::vector<spr::propagatedTrackID> trkCaloDets;
543 std::vector<math::XYZTLorentzVector> vecL1, vecL3;
544 isoTrkEvent.
tracks_ = trkCollection->size();
545 isoTrkEvent.
tracksProp_ = trkCaloDirections.size();
552 for (
const auto& decision : finalDecisions) {
553 if (decision.first.find(
l1TrigName_) != std::string::npos) {
554 isoTrkEvent.
l1Bit_ = decision.second;
561 <<
" from a list of " << finalDecisions.size() <<
" decisions";
570 for (
unsigned int iHLT = 0; iHLT <
triggerResults->size(); iHLT++) {
580 <<
"This trigger " << names[iHLT] <<
" Flag " << hlt <<
":" << isoTrkEvent.
hltbits_[
i];
594 auto outputHcalIsoTrackColl = std::make_unique<HcalIsoTrkCalibVariablesCollection>();
595 std::array<int, 3> ntksave{{0, 0, 0}};
617 *outputHcalIsoTrackColl,
625 if (!triggerEventHandle.isValid()) {
628 triggerEvent = *(triggerEventHandle.product());
633 std::vector<std::string>
modules;
636 for (
unsigned int iHLT = 0; iHLT <
triggerResults->size(); iHLT++) {
641 std::vector<math::XYZTLorentzVector> vecL2;
645 for (
unsigned int ifilter = 0; ifilter < triggerEvent.
sizeFilters(); ++ifilter) {
646 std::vector<int>
Keys;
649 for (
unsigned int imodule = 0; imodule < moduleLabels.size(); imodule++) {
650 if (label.find(moduleLabels[imodule]) != std::string::npos) {
655 for (
unsigned int ifiltrKey = 0; ifiltrKey < triggerEvent.
filterKeys(ifilter).size(); ++ifiltrKey) {
656 Keys.push_back(triggerEvent.
filterKeys(ifilter)[ifiltrKey]);
659 if (label.find(
l2Filter_) != std::string::npos) {
661 }
else if (label.find(
l3Filter_) != std::string::npos) {
669 <<
"key " << ifiltrKey <<
" : pt " << TO.
pt() <<
" eta " << TO.
eta() <<
" phi " << TO.
phi()
670 <<
" mass " << TO.
mass() <<
" Id " << TO.
id();
676 <<
"sizes " << vecL1.size() <<
":" << vecL2.size() <<
":" << vecL3.size();
703 *outputHcalIsoTrackColl,
718 for (
auto itr = outputHcalIsoTrackColl->begin(); itr != outputHcalIsoTrackColl->end(); ++itr) {
724 auto outputEventcol = std::make_unique<HcalIsoTrkEventVariablesCollection>();
725 outputEventcol->emplace_back(isoTrkEvent);
731 globalCache()->nAll_ +=
nAll_;
732 globalCache()->nGood_ +=
nGood_;
733 globalCache()->nRange_ +=
nRange_;
738 << count->
nRange_ <<
" events in the momentum range";
757 std::vector<math::XYZTLorentzVector>& vecL1,
758 std::vector<math::XYZTLorentzVector>& vecL3,
760 std::vector<spr::propagatedTrackDirection>& trkCaloDirections,
761 std::vector<spr::propagatedTrackID>& trkCaloDets,
774 std::vector<HcalIsoTrkCalibVariables>& hocalib,
776 int nSave(0), nLoose(0), nTight(0);
777 unsigned int nTracks(0), nselTracks(0);
778 double rhohEV = (tower.
isValid()) ?
rhoh(tower) : 0;
781 std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
782 for (trkDetItr = trkCaloDirections.begin(),
nTracks = 0; trkDetItr != trkCaloDirections.end();
784 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
791 isoTk.
nTrk_ = trkCaloDirections.size();
792 isoTk.
rhoh_ = rhohEV;
793 for (
const auto& trig : hocalibEvent.
hltbits_)
795 if (!vecL1.empty()) {
796 isoTk.
l1pt_ = vecL1[0].pt();
797 isoTk.
l1eta_ = vecL1[0].eta();
798 isoTk.
l1phi_ = vecL1[0].phi();
800 if (!vecL3.empty()) {
801 isoTk.
l3pt_ = vecL3[0].pt();
802 isoTk.
l3eta_ = vecL3[0].eta();
803 isoTk.
l3phi_ = vecL3[0].phi();
806 isoTk.
p_ = pTrack->
p();
807 isoTk.
pt_ = pTrack->
pt();
812 << pTrack->
eta() <<
"|" << isoTk.
phi_ <<
"|" << isoTk.
p_;
816 for (
unsigned int k = 0;
k < vecL3.size(); ++
k) {
817 double dr =
dR(vecL3[
k], v4);
822 isoTk.
mindR1_ = (!vecL1.empty()) ?
dR(vecL1[0], v4) : 999;
829 if (trkDetItr->okHCAL) {
833 if (isoTk.
p_ > 40.0 && isoTk.
p_ <= 60.0)
840 oneCutParameters.
maxDzPV = 100;
843 bool qltyFlag =
spr::goodTrack(pTrack, leadPV, oneCutParameters,
false);
846 oneCutParameters.
maxDzPV = 100;
859 edm::LogVerbatim(
"HcalIsoTrack") <<
"qltyFlag|okECAL|okHCAL : " << qltyFlag <<
"|" << trkDetItr->okECAL <<
"|"
860 << trkDetItr->okHCAL <<
" eIsolation " << eIsolation;
863 if (trkDetItr->okECAL)
865 if (trkDetItr->okHCAL)
868 isoTk.
qltyFlag_ = (qltyFlag && trkDetItr->okECAL && trkDetItr->okHCAL);
878 std::vector<DetId> eIds;
879 std::vector<double> eHit;
886 trkDetItr->pointHCAL,
887 trkDetItr->pointECAL,
889 trkDetItr->directionECAL,
893 for (
unsigned int k = 0;
k < eIds.size(); ++
k) {
899 edm::LogVerbatim(
"HcalIsoTrack") <<
"eMIP before and after: " << eMipDR <<
":" << eEcal;
901 isoTk.
eMipDR_.emplace_back(eEcal);
904 std::vector<DetId> eIds2;
905 std::vector<double> eHit2;
912 trkDetItr->pointHCAL,
913 trkDetItr->pointECAL,
915 trkDetItr->directionECAL,
919 for (
unsigned int k = 0;
k < eIds2.size(); ++
k) {
925 edm::LogVerbatim(
"HcalIsoTrack") <<
"eMIP before and after: " << eMipDR2 <<
":" << eEcal2;
927 isoTk.
eMipDR_.emplace_back(eEcal2);
930 std::vector<DetId> eIds3;
931 std::vector<double> eHit3;
938 trkDetItr->pointHCAL,
939 trkDetItr->pointECAL,
941 trkDetItr->directionECAL,
945 for (
unsigned int k = 0;
k < eIds3.size(); ++
k) {
951 edm::LogVerbatim(
"HcalIsoTrack") <<
"eMIP before and after: " << eMipDR3 <<
":" << eEcal3;
953 isoTk.
eMipDR_.emplace_back(eEcal3);
956 std::vector<DetId> eIds4;
957 std::vector<double> eHit4;
964 trkDetItr->pointHCAL,
965 trkDetItr->pointECAL,
967 trkDetItr->directionECAL,
971 for (
unsigned int k = 0;
k < eIds4.size(); ++
k) {
977 edm::LogVerbatim(
"HcalIsoTrack") <<
"eMIP before and after: " << eMipDR4 <<
":" << eEcal4;
979 isoTk.
eMipDR_.emplace_back(eEcal4);
982 std::vector<DetId> eIds5;
983 std::vector<double> eHit5;
990 trkDetItr->pointHCAL,
991 trkDetItr->pointECAL,
993 trkDetItr->directionECAL,
997 for (
unsigned int k = 0;
k < eIds5.size(); ++
k) {
1003 edm::LogVerbatim(
"HcalIsoTrack") <<
"eMIP before and after: " << eMipDR5 <<
":" << eEcal5;
1005 isoTk.
eMipDR_.emplace_back(eEcal5);
1009 const DetId cellE(trkDetItr->detIdECAL);
1011 barrelRecHitsHandle,
1012 endcapRecHitsHandle,
1024 barrelRecHitsHandle,
1025 endcapRecHitsHandle,
1036 if (e11x11P.second && e15x15P.second) {
1037 isoTk.
eAnnular_ = (e15x15P.first - e11x11P.first);
1039 isoTk.
eAnnular_ = -(e15x15P.first - e11x11P.first);
1042 const DetId cellH(trkDetItr->detIdHCAL);
1044 theHBHETopology, cellH, hbhe, 2, 2,
false,
true, -100.0, -100.0, -100.0, -100.0, -100.0, 100.0);
1046 theHBHETopology, cellH, hbhe, 3, 3,
false,
true, -100.0, -100.0, -100.0, -100.0, -100.0, 100.0);
1051 <<
" Annular E (Ecal) " << e11x11P.first <<
":" << e15x15P.first <<
":"
1052 << isoTk.
eAnnular_ <<
" (Hcal) " << h5x5 <<
":" << h7x7 <<
":"
1061 int nRecHits(-999), nRecHits1(-999), nRecHits3(-999);
1062 std::vector<DetId> ids, ids1, ids3;
1063 std::vector<double> edet0, edet1, edet3;
1066 trkDetItr->pointHCAL,
1067 trkDetItr->pointECAL,
1069 trkDetItr->directionHCAL,
1075 for (
unsigned k = 0;
k < ids.size(); ++
k)
1079 std::pair<double, double> ehcal0 =
1087 trkDetItr->pointHCAL,
1088 trkDetItr->pointECAL,
1090 trkDetItr->directionHCAL,
1096 for (
unsigned k = 0;
k < ids1.size(); ++
k)
1100 std::pair<double, double> ehcal1 =
1108 trkDetItr->pointHCAL,
1109 trkDetItr->pointECAL,
1111 trkDetItr->directionHCAL,
1117 for (
unsigned k = 0;
k < ids3.size(); ++
k)
1121 std::pair<double, double> ehcal3 =
1132 std::string ctype = accept ?
" ***** ACCEPT *****" :
"";
1134 <<
"This track : " <<
nTracks <<
" (pt|eta|phi|p) : " << isoTk.
pt_ <<
"|" << pTrack->
eta() <<
"|"
1135 << isoTk.
phi_ <<
"|" << isoTk.
p_ <<
" Generator Level p " << isoTk.
gentrackP_;
1140 for (
unsigned int ll = 0; ll < isoTk.
detIds_.size(); ll++) {
1145 for (
unsigned int ll = 0; ll < isoTk.
detIds1_.size(); ll++) {
1150 for (
unsigned int ll = 0; ll < isoTk.
detIds3_.size(); ll++) {
1158 hocalib.emplace_back(isoTk);
1171 if (isoTk.
p_ > 40.0 && isoTk.
p_ <= 60.0 && isoTk.
selectTk_) {
1176 for (
unsigned int k = 0;
k < isoTk.
trgbits_.size();
k++) {
1187 <<
" Accept " << accept <<
" Momentum " << isoTk.
p_ <<
":" <<
pTrackMin_;
1190 <<
" Accept " << accept <<
" Momentum " << isoTk.
p_ <<
":" <<
pTrackMin_
1192 <<
" Charge Isolation " << isoTk.
hmaxNearP_ <<
":" << eIsolation;
1196 std::array<int, 3> i3{{nSave, nLoose, nTight}};
1201 return reco::deltaR(vec1.eta(), vec1.phi(), vec2.eta(), vec2.phi());
1208 double mindR(999.9);
1209 for (
const auto&
p : (*genParticles)) {
1213 pmom =
p.momentum().R();
1221 std::vector<double> sumPFNallSMDQH2;
1226 for (
const auto& pf_it : (*tower)) {
1231 hadder += pf_it.hadEt();
1233 sumPFNallSMDQH2.emplace_back(hadder);
1238 std::sort(sumPFNallSMDQH2.begin(), sumPFNallSMDQH2.end());
1239 if (sumPFNallSMDQH2.size() % 2)
1240 evt_smdq = sumPFNallSMDQH2[(sumPFNallSMDQH2.size() - 1) / 2];
1242 evt_smdq = (sumPFNallSMDQH2[sumPFNallSMDQH2.size() / 2] + sumPFNallSMDQH2[(sumPFNallSMDQH2.size() - 2) / 2]) / 2.;
1269 for (
unsigned int k = 0;
k <
oldID_.size(); ++
k) {
1278 const std::vector<DetId>& ids,
1279 std::vector<double>& edet,
1281 std::vector<unsigned int>& detIds,
1282 std::vector<double>& hitEnergies) {
1285 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1292 for (
const auto& en : edet)
1296 edm::LogWarning(
"HcalIsoTrack") <<
"Check inconsistent energies: " << eHcal <<
":" << ehcal <<
" from "
1297 << ids.size() <<
" cells";
1301 std::map<HcalDetId, double> hitMap;
1302 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1304 auto itr = hitMap.find(
id);
1305 if (itr == hitMap.end()) {
1306 hitMap[
id] = edet[
k];
1308 (itr->second) += edet[k];
1311 detIds.reserve(hitMap.size());
1312 hitEnergies.reserve(hitMap.size());
1313 for (
const auto&
hit : hitMap) {
1314 detIds.emplace_back(
hit.first.rawId());
1315 hitEnergies.emplace_back(
hit.second);
1318 detIds.reserve(ids.size());
1319 hitEnergies.reserve(ids.size());
1320 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1321 detIds.emplace_back(ids[
k].rawId());
1322 hitEnergies.emplace_back(edet[
k]);
1327 edm::LogVerbatim(
"HcalIsoTrack") <<
"StoreEnergy1::Input to storeEnergy with " << ids.size() <<
" cells";
1328 for (
unsigned int k = 0;
k < ids.size(); ++
k)
1330 edm::LogVerbatim(
"HcalIsoTrack") <<
"StoreEnergy1::Output of storeEnergy with " << detIds.size()
1331 <<
" cells and Etot " << eHcal;
1332 for (
unsigned int k = 0; k < detIds.size(); ++
k)
1340 const std::vector<DetId>& ids,
1341 std::vector<double>& hitEnergy1,
1342 std::vector<double>& hitEnergy2) {
1343 double ehcal1(0), ehcal2(0);
1344 std::vector<double> edet1, edet2;
1345 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1346 double e1(0), e2(0);
1347 for (
auto itr = hbhe->begin(); itr != hbhe->end(); ++itr) {
1348 if (itr->id() == ids[
k]) {
1358 edet1.emplace_back(e1);
1359 edet2.emplace_back(e2);
1362 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1370 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1378 std::map<HcalDetId, std::pair<double, double>> hitMap;
1379 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1381 auto itr = hitMap.find(
id);
1382 if (itr == hitMap.end()) {
1383 hitMap[
id] = std::make_pair(edet1[k], edet2[k]);
1385 (itr->second).
first += edet1[k];
1386 (itr->second).
second += edet2[k];
1389 hitEnergy1.reserve(hitMap.size());
1390 hitEnergy2.reserve(hitMap.size());
1391 for (
const auto&
hit : hitMap) {
1392 hitEnergy1.emplace_back(
hit.second.first);
1393 hitEnergy2.emplace_back(
hit.second.second);
1396 hitEnergy1.reserve(ids.size());
1397 hitEnergy2.reserve(ids.size());
1398 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1399 hitEnergy1.emplace_back(edet1[
k]);
1400 hitEnergy2.emplace_back(edet2[k]);
1405 edm::LogVerbatim(
"HcalIsoTrack") <<
"StoreEnergy2::Input to storeEnergy with " << ids.size() <<
" cells";
1406 edm::LogVerbatim(
"HcalIsoTrack") <<
"StoreEnergy2::Output of storeEnergy with " << hitEnergy1.size()
1407 <<
" cells and Etot " << ehcal1 <<
":" << ehcal2;
1408 for (
unsigned int k = 0;
k < hitEnergy1.size(); ++
k)
1409 edm::LogVerbatim(
"HcalIsoTrack") <<
"Hit [" <<
k <<
"] " << hitEnergy1[
k] <<
" : " << hitEnergy2[
k];
1412 return std::make_pair(ehcal1, ehcal2);
1417 for (reco::MuonCollection::const_iterator recMuon = muonh->begin(); recMuon != muonh->end(); ++recMuon) {
1418 if (recMuon->innerTrack().isNonnull()) {
1419 const reco::Track* pTrack = (recMuon->innerTrack()).
get();
1420 bool mediumMuon = (((recMuon->isPFMuon()) && (recMuon->isGlobalMuon() || recMuon->isTrackerMuon())) &&
1421 (recMuon->innerTrack()->validFraction() > 0.49));
1423 double chiGlobal = ((recMuon->globalTrack().isNonnull()) ? recMuon->globalTrack()->normalizedChi2() : 999);
1424 bool goodGlob = (recMuon->isGlobalMuon() && chiGlobal < 3 &&
1425 recMuon->combinedQuality().chi2LocalPosition < 12 && recMuon->combinedQuality().trkKink < 20);
constexpr double deltaPhi(double phi1, double phi2)
double p() const
momentum vector magnitude
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
EventNumber_t event() const
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_
const std::string labelGenTrack_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
constexpr int ietaAbs() const
get the absolute value of the cell ieta
std::vector< double > hitEnergies3_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
The single EDProduct to be saved for each event (AOD case)
trigger::size_type sizeFilters() const
uint16_t *__restrict__ id
std::vector< unsigned int > detIds3_
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
HcalDetId mergedDepthDetId(const HcalDetId &id) const
#define DEFINE_FWK_MODULE(type)
void beginRun(edm::Run const &, edm::EventSetup const &) override
std::vector< int > trackType_
std::vector< unsigned int > detIds1_
std::vector< int > oldDet_
const Keys & filterKeys(trigger::size_type index) const
const double slopeRestrictionP_
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
edm::EDGetTokenT< trigger::TriggerEvent > tok_trigEvt_
int bunchCrossing() const
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
edm::LuminosityBlockNumber_t luminosityBlock() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
double phi() const
azimuthal angle of momentum vector
const std::string labelIsoTkEvtVar_
std::vector< bool > trgbits_
const Item * getValues(DetId fId, bool throwOnFail=true) const
const double hitEthrEEHi_
Exp< T >::type exp(const T &t)
double chargeIsolationCone(unsigned int trkIndex, std::vector< spr::propagatedTrackDirection > &trkDirs, double dR, int &nNearTRKs, bool debug=false)
double px() const
x coordinate of momentum vector
std::vector< int > ietaAll_
static std::unique_ptr< alcaHcalIsoTracks::Counters > initializeGlobalCache(edm::ParameterSet const &)
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_
Strings const & triggerNames() const
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 std::string labelRecVtx_
std::vector< double > hitEnergiesRaw_
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
Single trigger physics object (e.g., an isolated muon)
bool getData(T &iHolder) const
U second(std::pair< T, U > const &p)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
edm::EDGetTokenT< BXVector< GlobalAlgBlk > > tok_alg_
constexpr HcalSubdetector subdet() const
get the subdetector
std::vector< int > oldDepth_
double dR(math::XYZTLorentzVector &, math::XYZTLorentzVector &)
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
const HcalDDDRecConstants * hdc_
const std::string labelIsoTkVar_
spr::trackSelectionParameters selectionParameter_
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)
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t uint32_t CAHitNtupletGeneratorKernelsGPU::Counters * counters
double eta() const
pseudorapidity of momentum vector
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_
const bool collapseDepth_
constexpr int iphi() const
get the cell iphi
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
const TriggerObjectCollection & getObjects() const
l1t::L1TGlobalUtil * l1GtUtils_
std::vector< double > vec1
std::vector< bool > hltbits_
double pt() const
track transverse momentum
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Abs< T >::type abs(const T &t)
static void globalEndJob(const alcaHcalIsoTracks::Counters *counters)
constexpr int ieta() const
get the cell ieta
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
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_
const double maxRestrictionP_
double trackP(const reco::Track *, const edm::Handle< reco::GenParticleCollection > &)
static std::string const triggerResults
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > tok_htopo_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::atomic< unsigned int > nRange_
const std::vector< int > newDepth_
HLTConfigProvider hltConfig_
std::vector< double > hitEnergies3Raw_
const edm::InputTag theTriggerResultsLabel_
double pz() const
z coordinate of momentum vector
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::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
const std::string labelTower_
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
edm::EDGetTokenT< reco::MuonCollection > tok_Muon_
const edm::InputTag filterTag(trigger::size_type index) const
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tok_bFieldH_
static TrackQuality qualityByName(const std::string &name)
double eThreshold(const DetId &id, const CaloGeometry *geo) const
std::vector< double > hitEnergies3Aux_
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
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
T getParameter(std::string const &) const
AlCaHcalIsotrkProducer(edm::ParameterSet const &, const alcaHcalIsoTracks::Counters *)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const std::string l1Filter_
std::atomic< unsigned int > nAll_
std::vector< double > eMipDR_
edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_ddrec_
edm::EDGetTokenT< GenEventInfoProduct > tok_ew_
edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > tok_ecalChStatus_
edm::EDGetTokenT< edm::TriggerResults > tok_trigRes_
DetId newId(const DetId &)
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_
constexpr int depth() const
get the tower depth
Log< level::Warning, false > LogWarning
const std::string theTrackQuality_
std::vector< double > hitEnergiesAux_
const std::string labelHBHE_
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 std::vector< std::string > trigNames_
void retrieveL1(const edm::Event &iEvent, const edm::EventSetup &evSetup)
initialize the class (mainly reserve)
double py() const
y coordinate of momentum vector
std::atomic< unsigned int > nGood_
std::vector< double > etabins_
void produce(edm::Event &, edm::EventSetup const &) override
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_