Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-04-24 01:30:21

0001 // -*- C++ -*-
0002 //
0003 // Package:    HLTriggerOffline/Scouting
0004 // Class:      ScoutingEGammaCollectionMonitoring
0005 //
0006 /**\class ScoutingEGammaCollectionMonitoring
0007 
0008  ScoutingEGammaCollectionMonitoring.cc
0009  HLTriggerOffline/Scouting/plugins/ScoutingEGammaCollectionMonitoring.cc
0010 
0011  Description: ScoutingEGammaCollectionMonitoring is developed to enable us to
0012  monitor the comparison between pat::Object and Run3Scouting<Object>.
0013 
0014  Implementation:
0015      * Current runs on top of MINIAOD dataformat of the 
0016        ScoutingEGammaCollectionMonitoring dataset.
0017      * Implemented only for electrons as of now.
0018 */
0019 
0020 //
0021 // Original Authors:  Abanti Ranadhir Sahasransu, Ting-Hsiang Hsu
0022 //          Created:  Sun, 18 Aug 2024 13:02:11 GMT
0023 //
0024 //
0025 
0026 // system includes
0027 #include <cmath>
0028 #include <string>
0029 #include <vector>
0030 #include <algorithm>
0031 #include <numeric>
0032 
0033 // user includes
0034 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0035 #include "DQMServices/Core/interface/DQMGlobalEDAnalyzer.h"
0036 #include "DataFormats/Common/interface/TriggerResults.h"
0037 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
0038 #include "DataFormats/HLTReco/interface/TriggerEventWithRefs.h"
0039 #include "DataFormats/HLTReco/interface/TriggerObject.h"
0040 #include "DataFormats/HLTReco/interface/TriggerRefsCollections.h"
0041 #include "DataFormats/Math/interface/LorentzVector.h"
0042 #include "DataFormats/Math/interface/deltaPhi.h"
0043 #include "DataFormats/PatCandidates/interface/Electron.h"
0044 #include "DataFormats/PatCandidates/interface/PackedTriggerPrescales.h"
0045 #include "DataFormats/PatCandidates/interface/TriggerObjectStandAlone.h"
0046 #include "DataFormats/Scouting/interface/Run3ScoutingElectron.h"
0047 #include "FWCore/Common/interface/TriggerNames.h"
0048 #include "FWCore/Framework/interface/Event.h"
0049 #include "FWCore/Framework/interface/Frameworkfwd.h"
0050 #include "FWCore/Framework/interface/MakerMacros.h"
0051 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0052 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0053 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
0054 #include "L1Trigger/L1TGlobal/interface/L1TGlobalUtil.h"
0055 
0056 #include "ScoutingDQMUtils.h"
0057 
0058 //
0059 // class declaration
0060 //
0061 
0062 struct kThreeMomentumHistos {
0063   dqm::reco::MonitorElement* h1Pt;
0064   dqm::reco::MonitorElement* h1Eta;
0065   dqm::reco::MonitorElement* h1Phi;
0066 };
0067 
0068 struct kInvmHistos {
0069   dqm::reco::MonitorElement* h1N;
0070   kThreeMomentumHistos electrons;
0071   kThreeMomentumHistos electron1;
0072   kThreeMomentumHistos electron2;
0073   dqm::reco::MonitorElement* h1InvMass12;
0074   dqm::reco::MonitorElement* h1InvMassID;
0075   dqm::reco::MonitorElement* h1InvMassIDEBEB;
0076   dqm::reco::MonitorElement* h1InvMassIDEBEE;
0077   dqm::reco::MonitorElement* h1InvMassIDEEEE;
0078   std::vector<std::vector<dqm::reco::MonitorElement*>> hInvMassID_passDST;
0079   std::vector<std::vector<dqm::reco::MonitorElement*>> hInvMassIDEBEB_passDST;
0080   std::vector<std::vector<dqm::reco::MonitorElement*>> hInvMassIDEBEE_passDST;
0081   std::vector<std::vector<dqm::reco::MonitorElement*>> hInvMassIDEEEE_passDST;
0082 };
0083 
0084 struct kHistogramsScoutingEGammaCollectionMonitoring {
0085   kInvmHistos patElectron;
0086   kInvmHistos sctElectron;
0087 };
0088 
0089 class ScoutingEGammaCollectionMonitoring : public DQMEDAnalyzer {
0090 public:
0091   explicit ScoutingEGammaCollectionMonitoring(const edm::ParameterSet&);
0092   ~ScoutingEGammaCollectionMonitoring() override = default;
0093 
0094   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0095 
0096 private:
0097   void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
0098 
0099   void analyze(edm::Event const&, edm::EventSetup const&) override;
0100 
0101   // ------------ member data ------------
0102   const std::string outputInternalPath_;
0103 
0104   const std::vector<std::string> vtriggerSelection_;
0105 
0106   edm::EDGetToken algToken_;
0107   std::shared_ptr<l1t::L1TGlobalUtil> l1GtUtils_;
0108   std::vector<std::string> l1Seeds_;
0109 
0110   const edm::EDGetToken triggerResultsToken_;
0111   const edm::EDGetTokenT<edm::View<pat::Electron>> electronCollection_;
0112   const edm::EDGetTokenT<std::vector<Run3ScoutingElectron>> scoutingElectronCollection_;
0113   const edm::EDGetTokenT<edm::ValueMap<bool>> eleIdMapTightToken_;
0114 
0115   kHistogramsScoutingEGammaCollectionMonitoring histos;
0116 };
0117 
0118 ScoutingEGammaCollectionMonitoring::ScoutingEGammaCollectionMonitoring(const edm::ParameterSet& iConfig)
0119     : outputInternalPath_(iConfig.getParameter<std::string>("OutputInternalPath")),
0120       vtriggerSelection_{iConfig.getParameter<vector<string>>("triggerSelection")},
0121       algToken_{consumes<BXVector<GlobalAlgBlk>>(iConfig.getParameter<edm::InputTag>("AlgInputTag"))},
0122       triggerResultsToken_(consumes<edm::TriggerResults>(iConfig.getParameter<edm::InputTag>("TriggerResultTag"))),
0123       electronCollection_(
0124           consumes<edm::View<pat::Electron>>(iConfig.getParameter<edm::InputTag>("ElectronCollection"))),
0125       scoutingElectronCollection_(consumes<std::vector<Run3ScoutingElectron>>(
0126           iConfig.getParameter<edm::InputTag>("ScoutingElectronCollection"))),
0127       eleIdMapTightToken_(consumes<edm::ValueMap<bool>>(iConfig.getParameter<edm::InputTag>("eleIdMapTight"))) {
0128   l1GtUtils_ = std::make_shared<l1t::L1TGlobalUtil>(iConfig, consumesCollector(), l1t::UseEventSetupIn::RunAndEvent);
0129   l1Seeds_ = iConfig.getParameter<std::vector<std::string>>("L1Seeds");
0130 }
0131 
0132 // ------------ method called for each event  ------------
0133 
0134 void ScoutingEGammaCollectionMonitoring::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) {
0135   ////////////////////////////////////////
0136   // Get PAT / Scouting Electron Token  //
0137   ////////////////////////////////////////
0138 
0139   edm::Handle<edm::View<pat::Electron>> patEls;
0140   iEvent.getByToken(electronCollection_, patEls);
0141   if (patEls.failedToGet()) {
0142     edm::LogWarning("ScoutingEGammaCollectionMonitoring") << "pat::Electron collection not found.";
0143     return;
0144   }
0145 
0146   edm::Handle<std::vector<Run3ScoutingElectron>> sctEls;
0147   iEvent.getByToken(scoutingElectronCollection_, sctEls);
0148   if (sctEls.failedToGet()) {
0149     edm::LogWarning("ScoutingEGammaCollectionMonitoring") << "Run3ScoutingElectron collection not found.";
0150     return;
0151   }
0152 
0153   edm::Handle<edm::ValueMap<bool>> tight_ele_id_decisions;
0154   iEvent.getByToken(eleIdMapTightToken_, tight_ele_id_decisions);
0155 
0156   edm::LogInfo("ScoutingEGammaCollectionMonitoring") << "Process pat::Electrons: " << patEls->size();
0157   edm::LogInfo("ScoutingEGammaCollectionMonitoring") << "Process Run3ScoutingElectrons: " << sctEls->size();
0158 
0159   // Trigger
0160   edm::Handle<edm::TriggerResults> triggerResults;
0161   iEvent.getByToken(triggerResultsToken_, triggerResults);
0162 
0163   if (triggerResults.failedToGet()) {
0164     edm::LogWarning("ScoutingEGammaCollectionMonitoring") << "Trgger Results not found.";
0165     return;
0166   }
0167 
0168   int nTriggers = triggerResults->size();
0169   std::vector<bool> vtrigger_result(vtriggerSelection_.size(), false);
0170   const edm::TriggerNames& triggerNames = iEvent.triggerNames(*triggerResults);
0171   for (int i_Trig = 0; i_Trig < nTriggers; i_Trig++) {
0172     if (triggerResults.product()->accept(i_Trig)) {
0173       TString TrigPath = triggerNames.triggerName(i_Trig);
0174       for (unsigned int i_selectTrig = 0; i_selectTrig < vtriggerSelection_.size(); i_selectTrig++) {
0175         if (TrigPath.Index(vtriggerSelection_.at(i_selectTrig)) >= 0) {
0176           vtrigger_result[i_selectTrig] = true;
0177         }
0178       }
0179     }
0180   }
0181 
0182   // Loop to verify the sorting of pat::Electron collection - REMOVE IN ONLINE
0183   // DQM
0184   for (size_t i = 1; i < patEls->size(); ++i) {
0185     if (patEls->ptrAt(i - 1)->pt() < patEls->ptrAt(i)->pt()) {
0186       edm::LogWarning("ScoutingEGammaCollectionMonitoring")
0187           << "pat::Electron collection not sorted by PT in descending order"
0188           << " will result in random histo filling. \n"
0189           << "pat::Electron[" << i << "].pt() = " << patEls->ptrAt(i)->pt() << "\n"
0190           << "pat::Electron[" << i + 1 << "].pt() = " << patEls->ptrAt(i + 1)->pt();
0191     }
0192   }
0193 
0194   // Fill pat::Electron histograms
0195   histos.patElectron.h1N->Fill(patEls->size());
0196   std::vector<int> tight_patElectron_index;
0197   for (size_t i = 0; i < patEls->size(); ++i) {
0198     const auto el = patEls->ptrAt(i);
0199     histos.patElectron.electrons.h1Pt->Fill(el->pt());
0200     histos.patElectron.electrons.h1Eta->Fill(el->eta());
0201     histos.patElectron.electrons.h1Phi->Fill(el->phi());
0202     if (((*tight_ele_id_decisions)[el]))
0203       tight_patElectron_index.push_back(i);
0204   }
0205 
0206   // Expect pat electrons to be sorted by pt
0207   if (!patEls->empty()) {
0208     histos.patElectron.electron1.h1Pt->Fill(patEls->ptrAt(0)->pt());
0209     histos.patElectron.electron1.h1Eta->Fill(patEls->ptrAt(0)->eta());
0210     histos.patElectron.electron1.h1Phi->Fill(patEls->ptrAt(0)->phi());
0211   }
0212 
0213   if (patEls->size() >= 2) {
0214     histos.patElectron.electron2.h1Pt->Fill(patEls->ptrAt(1)->pt());
0215     histos.patElectron.electron2.h1Eta->Fill(patEls->ptrAt(1)->eta());
0216     histos.patElectron.electron2.h1Phi->Fill(patEls->ptrAt(1)->phi());
0217     if (!tight_patElectron_index.empty()) {
0218       histos.patElectron.h1InvMass12->Fill((patEls->ptrAt(0)->p4() + patEls->ptrAt(1)->p4()).mass());
0219     }
0220   }
0221 
0222   if (tight_patElectron_index.size() == 2) {
0223     histos.patElectron.h1InvMassID->Fill(
0224         (patEls->ptrAt(tight_patElectron_index[0])->p4() + patEls->ptrAt(tight_patElectron_index[1])->p4()).mass());
0225   }
0226 
0227   // Fill the Run3ScoutingElectron histograms. No sorting assumed.
0228   histos.sctElectron.h1N->Fill(sctEls->size());
0229   // unsigned int leadSctElIndx = 0, subleadSctElIndx = -1;
0230 
0231   // Sort scouting electrons by pt - They are unordered in the collection by
0232   // default Get an index list of the same size as scouting electrons
0233   std::vector<int> sortedSctIdx(sctEls->size());
0234   std::iota(sortedSctIdx.begin(), sortedSctIdx.end(), 0);
0235   // Sort the indices based on the pt of the scouting electrons
0236   std::sort(
0237       sortedSctIdx.begin(), sortedSctIdx.end(), [&](int i, int j) { return sctEls->at(i).pt() > sctEls->at(j).pt(); });
0238 
0239   std::vector<int> tight_sctElectron_index;
0240   for (int idx : sortedSctIdx) {
0241     histos.sctElectron.electrons.h1Pt->Fill(sctEls->at(idx).pt());
0242     histos.sctElectron.electrons.h1Eta->Fill(sctEls->at(idx).eta());
0243     histos.sctElectron.electrons.h1Phi->Fill(sctEls->at(idx).phi());
0244     if (scoutingDQMUtils::scoutingElectronID(sctEls->at(idx)))
0245       tight_sctElectron_index.push_back(idx);
0246   }
0247   sortedSctIdx.clear();
0248   if (!tight_sctElectron_index.empty() && sctEls->size() > 1) {
0249     math::PtEtaPhiMLorentzVector first_sct_el(
0250         sctEls->at(0).pt(), sctEls->at(0).eta(), sctEls->at(0).phi(), sctEls->at(0).m());
0251     math::PtEtaPhiMLorentzVector second_sct_el(
0252         sctEls->at(1).pt(), sctEls->at(1).eta(), sctEls->at(1).phi(), sctEls->at(1).m());
0253     // Use function to measure invariant mass with uniquely associated tracks
0254     histos.sctElectron.h1InvMass12->Fill((first_sct_el + second_sct_el).mass());
0255   }
0256 
0257   if (tight_sctElectron_index.size() == 2) {
0258     math::PtEtaPhiMLorentzVector sctEl0(sctEls->at(tight_sctElectron_index[0]).pt(),
0259                                         sctEls->at(tight_sctElectron_index[0]).eta(),
0260                                         sctEls->at(tight_sctElectron_index[0]).phi(),
0261                                         scoutingDQMUtils::ELECTRON_MASS);
0262     math::PtEtaPhiMLorentzVector sctEl1(sctEls->at(tight_sctElectron_index[1]).pt(),
0263                                         sctEls->at(tight_sctElectron_index[1]).eta(),
0264                                         sctEls->at(tight_sctElectron_index[1]).phi(),
0265                                         scoutingDQMUtils::ELECTRON_MASS);
0266     size_t gsfTrkIdx0 = 9999, gsfTrkIdx1 = 9999;
0267     bool foundGoodGsfTrkIdx0 =
0268         scoutingDQMUtils::scoutingElectronGsfTrackIdx(sctEls->at(tight_sctElectron_index[0]), gsfTrkIdx0);
0269     bool foundGoodGsfTrkIdx1 =
0270         scoutingDQMUtils::scoutingElectronGsfTrackIdx(sctEls->at(tight_sctElectron_index[1]), gsfTrkIdx1);
0271 
0272     if (!foundGoodGsfTrkIdx0 || !foundGoodGsfTrkIdx1)
0273       return;
0274 
0275     math::PtEtaPhiMLorentzVector sctElCombined0(
0276         scoutingDQMUtils::computePtFromEnergyMassEta(sctEl0.energy(),
0277                                                      scoutingDQMUtils::ELECTRON_MASS,
0278                                                      sctEls->at(tight_sctElectron_index[0]).trketa()[gsfTrkIdx0]),
0279         sctEls->at(tight_sctElectron_index[0]).trketa()[gsfTrkIdx0],
0280         sctEls->at(tight_sctElectron_index[0]).trkphi()[gsfTrkIdx0],
0281         scoutingDQMUtils::ELECTRON_MASS);
0282     math::PtEtaPhiMLorentzVector sctElCombined1(
0283         scoutingDQMUtils::computePtFromEnergyMassEta(sctEl1.energy(),
0284                                                      scoutingDQMUtils::ELECTRON_MASS,
0285                                                      sctEls->at(tight_sctElectron_index[1]).trketa()[gsfTrkIdx1]),
0286         sctEls->at(tight_sctElectron_index[1]).trketa()[gsfTrkIdx1],
0287         sctEls->at(tight_sctElectron_index[1]).trkphi()[gsfTrkIdx1],
0288         scoutingDQMUtils::ELECTRON_MASS);
0289 
0290     double invMass = (sctElCombined0 + sctElCombined1).mass();
0291     histos.sctElectron.h1InvMassID->Fill(invMass);
0292     if (fabs(sctEls->at(tight_sctElectron_index[0]).eta()) < scoutingDQMUtils::ELE_etaEB &&
0293         fabs(sctEls->at(tight_sctElectron_index[1]).eta()) < scoutingDQMUtils::ELE_etaEB) {
0294       histos.sctElectron.h1InvMassIDEBEB->Fill(invMass);
0295     } else if (fabs(sctEls->at(tight_sctElectron_index[0]).eta()) < scoutingDQMUtils::ELE_etaEB &&
0296                fabs(sctEls->at(tight_sctElectron_index[1]).eta()) > scoutingDQMUtils::ELE_etaEB) {
0297       histos.sctElectron.h1InvMassIDEBEE->Fill(invMass);
0298     } else {
0299       histos.sctElectron.h1InvMassIDEEEE->Fill(invMass);
0300     }
0301 
0302     l1GtUtils_->retrieveL1(iEvent, iSetup, algToken_);
0303     for (unsigned int i_selectTrig = 0; i_selectTrig < vtriggerSelection_.size(); i_selectTrig++) {
0304       if (vtrigger_result.at(i_selectTrig)) {
0305         histos.sctElectron.hInvMassID_passDST.at(i_selectTrig)[0]->Fill(invMass);
0306         if (fabs(sctEls->at(tight_sctElectron_index[0]).eta()) < scoutingDQMUtils::ELE_etaEB &&
0307             fabs(sctEls->at(tight_sctElectron_index[1]).eta()) < scoutingDQMUtils::ELE_etaEB) {
0308           histos.sctElectron.hInvMassIDEBEB_passDST.at(i_selectTrig)[0]->Fill(invMass);
0309         } else if (fabs(sctEls->at(tight_sctElectron_index[0]).eta()) < scoutingDQMUtils::ELE_etaEB &&
0310                    fabs(sctEls->at(tight_sctElectron_index[1]).eta()) > scoutingDQMUtils::ELE_etaEB) {
0311           histos.sctElectron.hInvMassIDEBEE_passDST.at(i_selectTrig)[0]->Fill(invMass);
0312         } else {
0313           histos.sctElectron.hInvMassIDEEEE_passDST.at(i_selectTrig)[0]->Fill(invMass);
0314         }
0315 
0316         for (unsigned int i_l1seed = 0; i_l1seed < l1Seeds_.size(); i_l1seed++) {
0317           const auto& l1seed(l1Seeds_.at(i_l1seed));
0318           bool l1htbit = false;
0319           double prescale = -1;
0320           l1GtUtils_->getFinalDecisionByName(l1seed, l1htbit);
0321           l1GtUtils_->getPrescaleByName(l1seed, prescale);
0322           if (l1htbit == 1) {
0323             histos.sctElectron.hInvMassID_passDST.at(i_selectTrig)[i_l1seed + 1]->Fill(invMass);
0324             if (fabs(sctEls->at(tight_sctElectron_index[0]).eta()) < scoutingDQMUtils::ELE_etaEB &&
0325                 fabs(sctEls->at(tight_sctElectron_index[1]).eta()) < scoutingDQMUtils::ELE_etaEB) {
0326               histos.sctElectron.hInvMassIDEBEB_passDST.at(i_selectTrig)[i_l1seed + 1]->Fill(invMass);
0327             } else if (fabs(sctEls->at(tight_sctElectron_index[0]).eta()) < scoutingDQMUtils::ELE_etaEB &&
0328                        fabs(sctEls->at(tight_sctElectron_index[1]).eta()) > scoutingDQMUtils::ELE_etaEB) {
0329               histos.sctElectron.hInvMassIDEBEE_passDST.at(i_selectTrig)[i_l1seed + 1]->Fill(invMass);
0330             } else {
0331               histos.sctElectron.hInvMassIDEEEE_passDST.at(i_selectTrig)[i_l1seed + 1]->Fill(invMass);
0332             }
0333           }
0334         }
0335       }
0336     }
0337   }
0338 }
0339 
0340 void ScoutingEGammaCollectionMonitoring::bookHistograms(DQMStore::IBooker& ibook,
0341                                                         edm::Run const& run,
0342                                                         edm::EventSetup const& iSetup) {
0343   ibook.setCurrentFolder(outputInternalPath_);
0344 
0345   // PAT Electron Total Summary
0346   histos.patElectron.h1N = ibook.book1D("all_patElectron_electrons_N", "all_patElectron_electrons_N", 20, 0., 20.);
0347   histos.patElectron.electrons.h1Pt =
0348       ibook.book1D("all_patElectron_electrons_Pt", "all_patElectron_electrons_Pt", 5000, 0., 500.);
0349   histos.patElectron.electrons.h1Eta =
0350       ibook.book1D("all_patElectron_electrons_Eta", "all_patElectron_electrons_Eta", 1000, -5., 5.);
0351   histos.patElectron.electrons.h1Phi =
0352       ibook.book1D("all_patElectron_electrons_Phi", "all_patElectron_electrons_Phi", 660, -3.3, 3.3);
0353 
0354   // Leading pT PAT Electron Summary
0355   histos.patElectron.electron1.h1Pt = ibook.book1D("patElectron_leading_Pt", "patElectron_leading_Pt", 5000, 0., 500.);
0356   histos.patElectron.electron1.h1Eta =
0357       ibook.book1D("patElectron_leading_Eta", "patElectron_leading_Eta", 1000, -5., 5.);
0358   histos.patElectron.electron1.h1Phi =
0359       ibook.book1D("patElectron_leading_Phi", "patElectron_leading_Phi", 660, -3.3, 3.3);
0360 
0361   // Subleading pT PAT Electron Summary
0362   histos.patElectron.electron2.h1Pt =
0363       ibook.book1D("patElectron_subleading_Pt", "patElectron_subleading_Pt", 5000, 0., 500.);
0364   histos.patElectron.electron2.h1Eta =
0365       ibook.book1D("patElectron_subleading_Eta", "patElectron_subleading_Eta", 1000, -5., 5.);
0366   histos.patElectron.electron2.h1Phi =
0367       ibook.book1D("patElectron_subleading_Phi", "patElectron_subleading_Phi", 660, -3.3, 3.3);
0368 
0369   // Inv Mass PAT Electron Summary
0370   histos.patElectron.h1InvMass12 = ibook.book1D("patElectron_E1E2_invMass", "patElectron_E1E2_invMass", 400, 0., 200.);
0371   histos.patElectron.h1InvMassID =
0372       ibook.book1D("patElectron_appliedID_invMass", "patElectron_appliedID_invMass", 400, 0., 200.);
0373   // Scouting electron summary
0374   histos.sctElectron.h1N = ibook.book1D("all_sctElectron_electrons_N", "all_sctElectron_electrons_N", 20, 0., 20.);
0375   histos.sctElectron.electrons.h1Pt =
0376       ibook.book1D("all_sctElectron_electrons_Pt", "all_sctElectron_electrons_Pt", 5000, 0., 500.);
0377   histos.sctElectron.electrons.h1Eta =
0378       ibook.book1D("all_sctElectron_electrons_Eta", "all_sctElectron_electrons_Eta", 1000, -5., 5.);
0379   histos.sctElectron.electrons.h1Phi =
0380       ibook.book1D("all_sctElectron_electrons_Phi", "all_sctElectron_electrons_Phi", 660, -3.3, 3.3);
0381 
0382   // Leading Scouting electron summary
0383   histos.sctElectron.electron1.h1Pt = ibook.book1D("sctElectron_leading_Pt", "sctElectron_leading_Pt", 5000, 0., 500.);
0384   histos.sctElectron.electron1.h1Eta =
0385       ibook.book1D("sctElectron_leading_Eta", "sctElectron_leading_Eta", 1000, -5., 5.);
0386   histos.sctElectron.electron1.h1Phi =
0387       ibook.book1D("sctElectron_leading_Phi", "sctElectron_leading_Phi", 660, -3.3, 3.3);
0388 
0389   // SubLeading Scouting electron summary
0390   histos.sctElectron.electron2.h1Pt =
0391       ibook.book1D("sctElectron_subleading_Pt", "sctElectron_subleading_Pt", 5000, 0., 500.);
0392   histos.sctElectron.electron2.h1Eta =
0393       ibook.book1D("sctElectron_subleading_Eta", "sctElectron_subleading_Eta", 1000, -5., 5.);
0394   histos.sctElectron.electron2.h1Phi =
0395       ibook.book1D("sctElectron_subleading_Phi", "sctElectron_subleading_Phi", 660, -3.3, 3.3);
0396 
0397   histos.sctElectron.h1InvMass12 = ibook.book1D("sctElectron_E1E2_invMass", "sctElectron_E1E2_invMass", 400, 0., 200.);
0398   histos.sctElectron.h1InvMassID =
0399       ibook.book1D("sctElectron_appliedID_invMass", "sctElectron_appliedID_invMass", 400, 0., 200.);
0400   histos.sctElectron.h1InvMassIDEBEB =
0401       ibook.book1D("sctElectron_EBEB_appliedID_invMass", "sctElectron_EBEB_appliedID_invMass", 400, 0., 200.);
0402   histos.sctElectron.h1InvMassIDEBEE =
0403       ibook.book1D("sctElectron_EBEE_appliedID_invMass", "sctElectron_EBEE_appliedID_invMass", 400, 0., 200.);
0404   histos.sctElectron.h1InvMassIDEEEE =
0405       ibook.book1D("sctElectron_EEEE_appliedID_invMass", "sctElectron_EEEE_appliedID_invMass", 400, 0., 200.);
0406 
0407   for (auto const& vt : vtriggerSelection_) {
0408     std::string cleaned_vt = vt;
0409     cleaned_vt.erase(std::remove(cleaned_vt.begin(), cleaned_vt.end(), '*'), cleaned_vt.end());
0410 
0411     std::vector<dqm::reco::MonitorElement*> h_passDST;
0412     std::vector<dqm::reco::MonitorElement*> h_EBEB_passDST;
0413     std::vector<dqm::reco::MonitorElement*> h_EBEE_passDST;
0414     std::vector<dqm::reco::MonitorElement*> h_EEEE_passDST;
0415 
0416     h_passDST.push_back(ibook.book1D(
0417         "sctElectron_appliedID_invMass_pass_" + cleaned_vt, ";Invariant mass (GeV); Electrons", 400, 0., 200));
0418     h_EBEB_passDST.push_back(ibook.book1D(
0419         "sctElectron_EBEB_appliedID_invMass_pass_" + cleaned_vt, ";Invariant mass (GeV); Electrons", 400, 0., 200));
0420     h_EBEE_passDST.push_back(ibook.book1D(
0421         "sctElectron_EBEE_appliedID_invMass_pass_" + cleaned_vt, ";Invariant mass (GeV); Electrons", 400, 0., 200));
0422     h_EEEE_passDST.push_back(ibook.book1D(
0423         "sctElectron_EEEE_appliedID_invMass_pass_" + cleaned_vt, ";Invariant mass (GeV); Electrons", 400, 0., 200));
0424 
0425     for (auto const& l1seed : l1Seeds_) {
0426       h_passDST.push_back(ibook.book1D("sctElectron_appliedID_invMass_pass_" + cleaned_vt + "_and_" + l1seed,
0427                                        ";Invariant mass (GeV); Electrons",
0428                                        400,
0429                                        0.,
0430                                        200));
0431       h_EBEB_passDST.push_back(ibook.book1D("sctElectron_EBEB_appliedID_invMass_pass_" + cleaned_vt + "_and_" + l1seed,
0432                                             ";Invariant mass (GeV); Electrons",
0433                                             400,
0434                                             0.,
0435                                             200));
0436       h_EBEE_passDST.push_back(ibook.book1D("sctElectron_EBEE_appliedID_invMass_pass_" + cleaned_vt + "_and_" + l1seed,
0437                                             ";Invariant mass (GeV); Electrons",
0438                                             400,
0439                                             0.,
0440                                             200));
0441       h_EEEE_passDST.push_back(ibook.book1D("sctElectron_EEEE_appliedID_invMass_pass_" + cleaned_vt + "_and_" + l1seed,
0442                                             ";Invariant mass (GeV); Electrons",
0443                                             400,
0444                                             0.,
0445                                             200));
0446     }
0447 
0448     histos.sctElectron.hInvMassID_passDST.push_back(h_passDST);
0449     histos.sctElectron.hInvMassIDEBEB_passDST.push_back(h_EBEB_passDST);
0450     histos.sctElectron.hInvMassIDEBEE_passDST.push_back(h_EBEE_passDST);
0451     histos.sctElectron.hInvMassIDEEEE_passDST.push_back(h_EEEE_passDST);
0452   }
0453 }
0454 
0455 // ------------ method fills 'descriptions' with the allowed parameters for the
0456 // module  ------------
0457 void ScoutingEGammaCollectionMonitoring::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0458   edm::ParameterSetDescription desc;
0459   desc.add<std::string>("OutputInternalPath", "MY_FOLDER");
0460   desc.add<vector<string>>("triggerSelection", {});
0461   desc.add<edm::InputTag>("AlgInputTag", edm::InputTag("gtStage2Digis"));
0462   desc.add<edm::InputTag>("l1tAlgBlkInputTag", edm::InputTag("gtStage2Digis"));
0463   desc.add<edm::InputTag>("l1tExtBlkInputTag", edm::InputTag("gtStage2Digis"));
0464   desc.add<bool>("ReadPrescalesFromFile", false);
0465   desc.add<std::vector<std::string>>("L1Seeds", {});
0466   desc.add<edm::InputTag>("TriggerResultTag", edm::InputTag("TriggerResults", "", "HLT"));
0467   desc.add<edm::InputTag>("ElectronCollection", edm::InputTag("slimmedElectrons"));
0468   desc.add<edm::InputTag>("ScoutingElectronCollection", edm::InputTag("hltScoutingEgammaPacker"));
0469   desc.add<edm::InputTag>("eleIdMapTight",
0470                           edm::InputTag("egmGsfElectronIDs:cutBasedElectronID-RunIIIWinter22-V1-tight"));
0471   descriptions.addWithDefaultLabel(desc);
0472 }
0473 
0474 // define this as a plug-in
0475 DEFINE_FWK_MODULE(ScoutingEGammaCollectionMonitoring);