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]) != std::string::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);
789 unsigned int nTracks(0), nselTracks(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);
890 std::vector<DetId> eIds;
891 std::vector<double> eHit;
898 trkDetItr->pointHCAL,
899 trkDetItr->pointECAL,
901 trkDetItr->directionECAL,
905 for (
unsigned int k = 0;
k < eIds.size(); ++
k) {
911 edm::LogVerbatim(
"HcalIsoTrack") <<
"eMIP before and after: " << eMipDR <<
":" << eEcal;
913 isoTk.
eMipDR_.emplace_back(eEcal);
916 std::vector<DetId> eIds2;
917 std::vector<double> eHit2;
924 trkDetItr->pointHCAL,
925 trkDetItr->pointECAL,
927 trkDetItr->directionECAL,
931 for (
unsigned int k = 0;
k < eIds2.size(); ++
k) {
937 edm::LogVerbatim(
"HcalIsoTrack") <<
"eMIP before and after: " << eMipDR2 <<
":" << eEcal2;
939 isoTk.
eMipDR_.emplace_back(eEcal2);
942 std::vector<DetId> eIds3;
943 std::vector<double> eHit3;
950 trkDetItr->pointHCAL,
951 trkDetItr->pointECAL,
953 trkDetItr->directionECAL,
957 for (
unsigned int k = 0;
k < eIds3.size(); ++
k) {
963 edm::LogVerbatim(
"HcalIsoTrack") <<
"eMIP before and after: " << eMipDR3 <<
":" << eEcal3;
965 isoTk.
eMipDR_.emplace_back(eEcal3);
968 std::vector<DetId> eIds4;
969 std::vector<double> eHit4;
976 trkDetItr->pointHCAL,
977 trkDetItr->pointECAL,
979 trkDetItr->directionECAL,
983 for (
unsigned int k = 0;
k < eIds4.size(); ++
k) {
989 edm::LogVerbatim(
"HcalIsoTrack") <<
"eMIP before and after: " << eMipDR4 <<
":" << eEcal4;
991 isoTk.
eMipDR_.emplace_back(eEcal4);
994 std::vector<DetId> eIds5;
995 std::vector<double> eHit5;
1000 barrelRecHitsHandle,
1001 endcapRecHitsHandle,
1002 trkDetItr->pointHCAL,
1003 trkDetItr->pointECAL,
1005 trkDetItr->directionECAL,
1009 for (
unsigned int k = 0;
k < eIds5.size(); ++
k) {
1015 edm::LogVerbatim(
"HcalIsoTrack") <<
"eMIP before and after: " << eMipDR5 <<
":" << eEcal5;
1017 isoTk.
eMipDR_.emplace_back(eEcal5);
1021 const DetId cellE(trkDetItr->detIdECAL);
1023 barrelRecHitsHandle,
1024 endcapRecHitsHandle,
1036 barrelRecHitsHandle,
1037 endcapRecHitsHandle,
1048 if (e11x11P.second && e15x15P.second) {
1049 isoTk.
eAnnular_ = (e15x15P.first - e11x11P.first);
1051 isoTk.
eAnnular_ = -(e15x15P.first - e11x11P.first);
1054 const DetId cellH(trkDetItr->detIdHCAL);
1056 theHBHETopology, cellH,
hbhe, 2, 2,
false,
true, -100.0, -100.0, -100.0, -100.0, -100.0, 100.0);
1058 theHBHETopology, cellH,
hbhe, 3, 3,
false,
true, -100.0, -100.0, -100.0, -100.0, -100.0, 100.0);
1063 <<
" Annular E (Ecal) " << e11x11P.first <<
":" << e15x15P.first <<
":" 1064 << isoTk.
eAnnular_ <<
" (Hcal) " << h5x5 <<
":" << h7x7 <<
":" 1073 int nRecHits(-999), nRecHits1(-999), nRecHits3(-999);
1074 std::vector<DetId> ids, ids1, ids3;
1075 std::vector<double> edet0, edet1, edet3;
1078 trkDetItr->pointHCAL,
1079 trkDetItr->pointECAL,
1081 trkDetItr->directionHCAL,
1087 for (
unsigned k = 0;
k < ids.size(); ++
k)
1091 std::pair<double, double> ehcal0 =
1099 trkDetItr->pointHCAL,
1100 trkDetItr->pointECAL,
1102 trkDetItr->directionHCAL,
1108 for (
unsigned k = 0;
k < ids1.size(); ++
k)
1112 std::pair<double, double> ehcal1 =
1120 trkDetItr->pointHCAL,
1121 trkDetItr->pointECAL,
1123 trkDetItr->directionHCAL,
1129 for (
unsigned k = 0;
k < ids3.size(); ++
k)
1133 std::pair<double, double> ehcal3 =
1146 <<
"This track : " <<
nTracks <<
" (pt|eta|phi|p) : " << isoTk.
pt_ <<
"|" << pTrack->
eta() <<
"|" 1147 << isoTk.
phi_ <<
"|" << isoTk.
p_ <<
" Generator Level p " << isoTk.
gentrackP_;
1152 for (
unsigned int ll = 0; ll < isoTk.
detIds_.size(); ll++) {
1157 for (
unsigned int ll = 0; ll < isoTk.
detIds1_.size(); ll++) {
1162 for (
unsigned int ll = 0; ll < isoTk.
detIds3_.size(); ll++) {
1171 <<
"Run " << eventId.
run() <<
" Event " << eventId.
event() <<
" Track " <<
nTracks <<
" p " << isoTk.
p_;
1172 hocalib.emplace_back(isoTk);
1185 if (isoTk.
p_ > 40.0 && isoTk.
p_ <= 60.0 && isoTk.
selectTk_) {
1190 for (
unsigned int k = 0;
k < isoTk.
trgbits_.size();
k++) {
1206 <<
" Charge Isolation " << isoTk.
hmaxNearP_ <<
":" << eIsolation;
1210 std::array<int, 3>
i3{{nSave,
nLoose, nTight}};
1222 double mindR(999.9);
1227 pmom =
p.momentum().R();
1235 std::vector<double> sumPFNallSMDQH2;
1240 for (
const auto& pf_it : (*
tower)) {
1245 hadder += pf_it.hadEt();
1247 sumPFNallSMDQH2.emplace_back(hadder);
1252 std::sort(sumPFNallSMDQH2.begin(), sumPFNallSMDQH2.end());
1253 if (sumPFNallSMDQH2.size() % 2)
1254 evt_smdq = sumPFNallSMDQH2[(sumPFNallSMDQH2.size() - 1) / 2];
1256 evt_smdq = (sumPFNallSMDQH2[sumPFNallSMDQH2.size() / 2] + sumPFNallSMDQH2[(sumPFNallSMDQH2.size() - 2) / 2]) / 2.;
1270 eThr =
static_cast<double>((*eThresholds_)[
id]);
1287 for (
unsigned int k = 0;
k <
oldID_.size(); ++
k) {
1296 const std::vector<DetId>& ids,
1297 std::vector<double>& edet,
1299 std::vector<unsigned int>& detIds,
1300 std::vector<double>& hitEnergies) {
1303 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1310 for (
const auto& en : edet)
1314 edm::LogWarning(
"HcalIsoTrack") <<
"Check inconsistent energies: " << eHcal <<
":" << ehcal <<
" from " 1315 << ids.size() <<
" cells";
1319 std::map<HcalDetId, double> hitMap;
1320 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1322 auto itr = hitMap.find(
id);
1323 if (itr == hitMap.end()) {
1324 hitMap[
id] = edet[
k];
1326 (itr->second) += edet[
k];
1329 detIds.reserve(hitMap.size());
1330 hitEnergies.reserve(hitMap.size());
1331 for (
const auto&
hit : hitMap) {
1332 detIds.emplace_back(
hit.first.rawId());
1333 hitEnergies.emplace_back(
hit.second);
1336 detIds.reserve(ids.size());
1337 hitEnergies.reserve(ids.size());
1338 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1339 detIds.emplace_back(ids[
k].rawId());
1340 hitEnergies.emplace_back(edet[
k]);
1345 edm::LogVerbatim(
"HcalIsoTrack") <<
"StoreEnergy1::Input to storeEnergy with " << ids.size() <<
" cells";
1346 for (
unsigned int k = 0;
k < ids.size(); ++
k)
1348 edm::LogVerbatim(
"HcalIsoTrack") <<
"StoreEnergy1::Output of storeEnergy with " << detIds.size()
1349 <<
" cells and Etot " << eHcal;
1350 for (
unsigned int k = 0;
k < detIds.size(); ++
k)
1358 const std::vector<DetId>& ids,
1359 std::vector<double>& hitEnergy1,
1360 std::vector<double>& hitEnergy2) {
1361 double ehcal1(0), ehcal2(0);
1362 std::vector<double> edet1, edet2;
1363 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1364 double e1(0), e2(0);
1365 for (
auto itr =
hbhe->begin(); itr !=
hbhe->end(); ++itr) {
1366 if (itr->id() == ids[
k]) {
1376 edet1.emplace_back(
e1);
1377 edet2.emplace_back(e2);
1380 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1388 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1396 std::map<HcalDetId, std::pair<double, double>> hitMap;
1397 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1399 auto itr = hitMap.find(
id);
1400 if (itr == hitMap.end()) {
1401 hitMap[
id] = std::make_pair(edet1[
k], edet2[
k]);
1403 (itr->second).
first += edet1[
k];
1404 (itr->second).
second += edet2[
k];
1407 hitEnergy1.reserve(hitMap.size());
1408 hitEnergy2.reserve(hitMap.size());
1409 for (
const auto&
hit : hitMap) {
1410 hitEnergy1.emplace_back(
hit.second.first);
1411 hitEnergy2.emplace_back(
hit.second.second);
1414 hitEnergy1.reserve(ids.size());
1415 hitEnergy2.reserve(ids.size());
1416 for (
unsigned int k = 0;
k < ids.size(); ++
k) {
1417 hitEnergy1.emplace_back(edet1[
k]);
1418 hitEnergy2.emplace_back(edet2[
k]);
1423 edm::LogVerbatim(
"HcalIsoTrack") <<
"StoreEnergy2::Input to storeEnergy with " << ids.size() <<
" cells";
1424 edm::LogVerbatim(
"HcalIsoTrack") <<
"StoreEnergy2::Output of storeEnergy with " << hitEnergy1.size()
1425 <<
" cells and Etot " << ehcal1 <<
":" << ehcal2;
1426 for (
unsigned int k = 0;
k < hitEnergy1.size(); ++
k)
1427 edm::LogVerbatim(
"HcalIsoTrack") <<
"Hit [" <<
k <<
"] " << hitEnergy1[
k] <<
" : " << hitEnergy2[
k];
1430 return std::make_pair(ehcal1, ehcal2);
1435 for (reco::MuonCollection::const_iterator recMuon = muonh->begin(); recMuon != muonh->end(); ++recMuon) {
1436 if (recMuon->innerTrack().isNonnull()) {
1437 const reco::Track* pTrack = (recMuon->innerTrack()).
get();
1438 bool mediumMuon = (((recMuon->isPFMuon()) && (recMuon->isGlobalMuon() || recMuon->isTrackerMuon())) &&
1439 (recMuon->innerTrack()->validFraction() > 0.49));
1441 double chiGlobal = ((recMuon->globalTrack().isNonnull()) ? recMuon->globalTrack()->normalizedChi2() : 999);
1442 bool goodGlob = (recMuon->isGlobalMuon() && chiGlobal < 3 &&
1443 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_
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_
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
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_
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)
bool getData(T &iHolder) const
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