Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:22:31

0001 // -*- C++ -*-
0002 //
0003 // Package:    L1ExtraParticleMapProd
0004 // Class:      L1ExtraParticleMapProd
0005 //
0006 /**\class L1ExtraParticleMapProd \file L1ExtraParticleMapProd.cc
0007  * L1Trigger/L1ExtraParticleMapProd/src/L1ExtraParticleMapProd.cc \author Werner
0008  * Sun
0009  */
0010 //
0011 // Original Author:  Werner Sun
0012 //         Created:  Mon Oct 16 23:19:38 EDT 2006
0013 //
0014 //
0015 
0016 // system include files
0017 #include <memory>
0018 
0019 // user include files
0020 #include "L1Trigger/L1ExtraFromDigis/interface/L1ExtraParticleMapProd.h"
0021 
0022 //#include "FWCore/Framework/interface/MakerMacros.h"
0023 
0024 #include "DataFormats/Common/interface/Handle.h"
0025 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0026 
0027 #include "CLHEP/Random/RandFlat.h"
0028 
0029 static const int kDefault = -1;
0030 
0031 //
0032 // constants, enums and typedefs
0033 //
0034 
0035 //
0036 // static data member definitions
0037 //
0038 
0039 //
0040 // constructors and destructor
0041 //
0042 L1ExtraParticleMapProd::L1ExtraParticleMapProd(const edm::ParameterSet &iConfig)
0043     : muonSource_(iConfig.getParameter<edm::InputTag>("muonSource")),
0044       isoEmSource_(iConfig.getParameter<edm::InputTag>("isolatedEmSource")),
0045       nonIsoEmSource_(iConfig.getParameter<edm::InputTag>("nonIsolatedEmSource")),
0046       cenJetSource_(iConfig.getParameter<edm::InputTag>("centralJetSource")),
0047       forJetSource_(iConfig.getParameter<edm::InputTag>("forwardJetSource")),
0048       tauJetSource_(iConfig.getParameter<edm::InputTag>("tauJetSource")),
0049       etMissSource_(iConfig.getParameter<edm::InputTag>("etMissSource")),
0050       htMissSource_(iConfig.getParameter<edm::InputTag>("htMissSource")) {
0051   using namespace l1extra;
0052 
0053   // register your products
0054   produces<L1ParticleMapCollection>();
0055   produces<L1GlobalTriggerReadoutRecord>();
0056 
0057   // now do what ever other initialization is needed
0058   for (int i = 0; i < L1ParticleMap::kNumOfL1TriggerTypes; ++i) {
0059     singleThresholds_[i] = 0.;
0060     doubleThresholds_[i].first = 0.;
0061     doubleThresholds_[i].second = 0.;
0062     prescaleCounters_[i] = 1;
0063     prescales_[i] = 1;
0064   }
0065 
0066   // Single object triggers, 5 thresholds each
0067 
0068   singleThresholds_[L1ParticleMap::kSingleMu3] = iConfig.getParameter<double>("L1_SingleMu3_thresh");
0069   prescales_[L1ParticleMap::kSingleMu3] = iConfig.getParameter<int>("L1_SingleMu3_prescale");
0070   singleThresholds_[L1ParticleMap::kSingleMu5] = iConfig.getParameter<double>("L1_SingleMu5_thresh");
0071   prescales_[L1ParticleMap::kSingleMu5] = iConfig.getParameter<int>("L1_SingleMu5_prescale");
0072   singleThresholds_[L1ParticleMap::kSingleMu7] = iConfig.getParameter<double>("L1_SingleMu7_thresh");
0073   prescales_[L1ParticleMap::kSingleMu7] = iConfig.getParameter<int>("L1_SingleMu7_prescale");
0074   singleThresholds_[L1ParticleMap::kSingleMu10] = iConfig.getParameter<double>("L1_SingleMu10_thresh");
0075   prescales_[L1ParticleMap::kSingleMu10] = iConfig.getParameter<int>("L1_SingleMu10_prescale");
0076   singleThresholds_[L1ParticleMap::kSingleMu14] = iConfig.getParameter<double>("L1_SingleMu14_thresh");
0077   prescales_[L1ParticleMap::kSingleMu14] = iConfig.getParameter<int>("L1_SingleMu14_prescale");
0078   singleThresholds_[L1ParticleMap::kSingleMu20] = iConfig.getParameter<double>("L1_SingleMu20_thresh");
0079   prescales_[L1ParticleMap::kSingleMu20] = iConfig.getParameter<int>("L1_SingleMu20_prescale");
0080   singleThresholds_[L1ParticleMap::kSingleMu25] = iConfig.getParameter<double>("L1_SingleMu25_thresh");
0081   prescales_[L1ParticleMap::kSingleMu25] = iConfig.getParameter<int>("L1_SingleMu25_prescale");
0082 
0083   singleThresholds_[L1ParticleMap::kSingleIsoEG5] = iConfig.getParameter<double>("L1_SingleIsoEG5_thresh");
0084   prescales_[L1ParticleMap::kSingleIsoEG5] = iConfig.getParameter<int>("L1_SingleIsoEG5_prescale");
0085   singleThresholds_[L1ParticleMap::kSingleIsoEG8] = iConfig.getParameter<double>("L1_SingleIsoEG8_thresh");
0086   prescales_[L1ParticleMap::kSingleIsoEG8] = iConfig.getParameter<int>("L1_SingleIsoEG8_prescale");
0087   singleThresholds_[L1ParticleMap::kSingleIsoEG10] = iConfig.getParameter<double>("L1_SingleIsoEG10_thresh");
0088   prescales_[L1ParticleMap::kSingleIsoEG10] = iConfig.getParameter<int>("L1_SingleIsoEG10_prescale");
0089   singleThresholds_[L1ParticleMap::kSingleIsoEG12] = iConfig.getParameter<double>("L1_SingleIsoEG12_thresh");
0090   prescales_[L1ParticleMap::kSingleIsoEG12] = iConfig.getParameter<int>("L1_SingleIsoEG12_prescale");
0091   singleThresholds_[L1ParticleMap::kSingleIsoEG15] = iConfig.getParameter<double>("L1_SingleIsoEG15_thresh");
0092   prescales_[L1ParticleMap::kSingleIsoEG15] = iConfig.getParameter<int>("L1_SingleIsoEG15_prescale");
0093   singleThresholds_[L1ParticleMap::kSingleIsoEG20] = iConfig.getParameter<double>("L1_SingleIsoEG20_thresh");
0094   prescales_[L1ParticleMap::kSingleIsoEG20] = iConfig.getParameter<int>("L1_SingleIsoEG20_prescale");
0095   singleThresholds_[L1ParticleMap::kSingleIsoEG25] = iConfig.getParameter<double>("L1_SingleIsoEG25_thresh");
0096   prescales_[L1ParticleMap::kSingleIsoEG25] = iConfig.getParameter<int>("L1_SingleIsoEG25_prescale");
0097 
0098   singleThresholds_[L1ParticleMap::kSingleEG5] = iConfig.getParameter<double>("L1_SingleEG5_thresh");
0099   prescales_[L1ParticleMap::kSingleEG5] = iConfig.getParameter<int>("L1_SingleEG5_prescale");
0100   singleThresholds_[L1ParticleMap::kSingleEG8] = iConfig.getParameter<double>("L1_SingleEG8_thresh");
0101   prescales_[L1ParticleMap::kSingleEG8] = iConfig.getParameter<int>("L1_SingleEG8_prescale");
0102   singleThresholds_[L1ParticleMap::kSingleEG10] = iConfig.getParameter<double>("L1_SingleEG10_thresh");
0103   prescales_[L1ParticleMap::kSingleEG10] = iConfig.getParameter<int>("L1_SingleEG10_prescale");
0104   singleThresholds_[L1ParticleMap::kSingleEG12] = iConfig.getParameter<double>("L1_SingleEG12_thresh");
0105   prescales_[L1ParticleMap::kSingleEG12] = iConfig.getParameter<int>("L1_SingleEG12_prescale");
0106   singleThresholds_[L1ParticleMap::kSingleEG15] = iConfig.getParameter<double>("L1_SingleEG15_thresh");
0107   prescales_[L1ParticleMap::kSingleEG15] = iConfig.getParameter<int>("L1_SingleEG15_prescale");
0108   singleThresholds_[L1ParticleMap::kSingleEG20] = iConfig.getParameter<double>("L1_SingleEG20_thresh");
0109   prescales_[L1ParticleMap::kSingleEG20] = iConfig.getParameter<int>("L1_SingleEG20_prescale");
0110   singleThresholds_[L1ParticleMap::kSingleEG25] = iConfig.getParameter<double>("L1_SingleEG25_thresh");
0111   prescales_[L1ParticleMap::kSingleEG25] = iConfig.getParameter<int>("L1_SingleEG25_prescale");
0112 
0113   singleThresholds_[L1ParticleMap::kSingleJet15] = iConfig.getParameter<double>("L1_SingleJet15_thresh");
0114   prescales_[L1ParticleMap::kSingleJet15] = iConfig.getParameter<int>("L1_SingleJet15_prescale");
0115   singleThresholds_[L1ParticleMap::kSingleJet20] = iConfig.getParameter<double>("L1_SingleJet20_thresh");
0116   prescales_[L1ParticleMap::kSingleJet20] = iConfig.getParameter<int>("L1_SingleJet20_prescale");
0117   singleThresholds_[L1ParticleMap::kSingleJet30] = iConfig.getParameter<double>("L1_SingleJet30_thresh");
0118   prescales_[L1ParticleMap::kSingleJet30] = iConfig.getParameter<int>("L1_SingleJet30_prescale");
0119   singleThresholds_[L1ParticleMap::kSingleJet50] = iConfig.getParameter<double>("L1_SingleJet50_thresh");
0120   prescales_[L1ParticleMap::kSingleJet50] = iConfig.getParameter<int>("L1_SingleJet50_prescale");
0121   singleThresholds_[L1ParticleMap::kSingleJet70] = iConfig.getParameter<double>("L1_SingleJet70_thresh");
0122   prescales_[L1ParticleMap::kSingleJet70] = iConfig.getParameter<int>("L1_SingleJet70_prescale");
0123   singleThresholds_[L1ParticleMap::kSingleJet100] = iConfig.getParameter<double>("L1_SingleJet100_thresh");
0124   prescales_[L1ParticleMap::kSingleJet100] = iConfig.getParameter<int>("L1_SingleJet100_prescale");
0125   singleThresholds_[L1ParticleMap::kSingleJet150] = iConfig.getParameter<double>("L1_SingleJet150_thresh");
0126   prescales_[L1ParticleMap::kSingleJet150] = iConfig.getParameter<int>("L1_SingleJet150_prescale");
0127   singleThresholds_[L1ParticleMap::kSingleJet200] = iConfig.getParameter<double>("L1_SingleJet200_thresh");
0128   prescales_[L1ParticleMap::kSingleJet200] = iConfig.getParameter<int>("L1_SingleJet200_prescale");
0129 
0130   singleThresholds_[L1ParticleMap::kSingleTauJet10] = iConfig.getParameter<double>("L1_SingleTauJet10_thresh");
0131   prescales_[L1ParticleMap::kSingleTauJet10] = iConfig.getParameter<int>("L1_SingleTauJet10_prescale");
0132   singleThresholds_[L1ParticleMap::kSingleTauJet20] = iConfig.getParameter<double>("L1_SingleTauJet20_thresh");
0133   prescales_[L1ParticleMap::kSingleTauJet20] = iConfig.getParameter<int>("L1_SingleTauJet20_prescale");
0134   singleThresholds_[L1ParticleMap::kSingleTauJet30] = iConfig.getParameter<double>("L1_SingleTauJet30_thresh");
0135   prescales_[L1ParticleMap::kSingleTauJet30] = iConfig.getParameter<int>("L1_SingleTauJet30_prescale");
0136   singleThresholds_[L1ParticleMap::kSingleTauJet35] = iConfig.getParameter<double>("L1_SingleTauJet35_thresh");
0137   prescales_[L1ParticleMap::kSingleTauJet35] = iConfig.getParameter<int>("L1_SingleTauJet35_prescale");
0138   singleThresholds_[L1ParticleMap::kSingleTauJet40] = iConfig.getParameter<double>("L1_SingleTauJet40_thresh");
0139   prescales_[L1ParticleMap::kSingleTauJet40] = iConfig.getParameter<int>("L1_SingleTauJet40_prescale");
0140   singleThresholds_[L1ParticleMap::kSingleTauJet60] = iConfig.getParameter<double>("L1_SingleTauJet60_thresh");
0141   prescales_[L1ParticleMap::kSingleTauJet60] = iConfig.getParameter<int>("L1_SingleTauJet60_prescale");
0142   singleThresholds_[L1ParticleMap::kSingleTauJet80] = iConfig.getParameter<double>("L1_SingleTauJet80_thresh");
0143   prescales_[L1ParticleMap::kSingleTauJet80] = iConfig.getParameter<int>("L1_SingleTauJet80_prescale");
0144   singleThresholds_[L1ParticleMap::kSingleTauJet100] = iConfig.getParameter<double>("L1_SingleTauJet100_thresh");
0145   prescales_[L1ParticleMap::kSingleTauJet100] = iConfig.getParameter<int>("L1_SingleTauJet100_prescale");
0146 
0147   singleThresholds_[L1ParticleMap::kHTT100] = iConfig.getParameter<double>("L1_HTT100_thresh");
0148   prescales_[L1ParticleMap::kHTT100] = iConfig.getParameter<int>("L1_HTT100_prescale");
0149   singleThresholds_[L1ParticleMap::kHTT200] = iConfig.getParameter<double>("L1_HTT200_thresh");
0150   prescales_[L1ParticleMap::kHTT200] = iConfig.getParameter<int>("L1_HTT200_prescale");
0151   singleThresholds_[L1ParticleMap::kHTT250] = iConfig.getParameter<double>("L1_HTT250_thresh");
0152   prescales_[L1ParticleMap::kHTT250] = iConfig.getParameter<int>("L1_HTT250_prescale");
0153   singleThresholds_[L1ParticleMap::kHTT300] = iConfig.getParameter<double>("L1_HTT300_thresh");
0154   prescales_[L1ParticleMap::kHTT300] = iConfig.getParameter<int>("L1_HTT300_prescale");
0155   singleThresholds_[L1ParticleMap::kHTT400] = iConfig.getParameter<double>("L1_HTT400_thresh");
0156   prescales_[L1ParticleMap::kHTT400] = iConfig.getParameter<int>("L1_HTT400_prescale");
0157   singleThresholds_[L1ParticleMap::kHTT500] = iConfig.getParameter<double>("L1_HTT500_thresh");
0158   prescales_[L1ParticleMap::kHTT500] = iConfig.getParameter<int>("L1_HTT500_prescale");
0159 
0160   singleThresholds_[L1ParticleMap::kETM10] = iConfig.getParameter<double>("L1_ETM10_thresh");
0161   prescales_[L1ParticleMap::kETM10] = iConfig.getParameter<int>("L1_ETM10_prescale");
0162   singleThresholds_[L1ParticleMap::kETM15] = iConfig.getParameter<double>("L1_ETM15_thresh");
0163   prescales_[L1ParticleMap::kETM15] = iConfig.getParameter<int>("L1_ETM15_prescale");
0164   singleThresholds_[L1ParticleMap::kETM20] = iConfig.getParameter<double>("L1_ETM20_thresh");
0165   prescales_[L1ParticleMap::kETM20] = iConfig.getParameter<int>("L1_ETM20_prescale");
0166   singleThresholds_[L1ParticleMap::kETM30] = iConfig.getParameter<double>("L1_ETM30_thresh");
0167   prescales_[L1ParticleMap::kETM30] = iConfig.getParameter<int>("L1_ETM30_prescale");
0168   singleThresholds_[L1ParticleMap::kETM40] = iConfig.getParameter<double>("L1_ETM40_thresh");
0169   prescales_[L1ParticleMap::kETM40] = iConfig.getParameter<int>("L1_ETM40_prescale");
0170   singleThresholds_[L1ParticleMap::kETM50] = iConfig.getParameter<double>("L1_ETM50_thresh");
0171   prescales_[L1ParticleMap::kETM50] = iConfig.getParameter<int>("L1_ETM50_prescale");
0172   singleThresholds_[L1ParticleMap::kETM60] = iConfig.getParameter<double>("L1_ETM60_thresh");
0173   prescales_[L1ParticleMap::kETM60] = iConfig.getParameter<int>("L1_ETM60_prescale");
0174 
0175   singleThresholds_[L1ParticleMap::kETT60] = iConfig.getParameter<double>("L1_ETT60_thresh");
0176   prescales_[L1ParticleMap::kETT60] = iConfig.getParameter<int>("L1_ETT60_prescale");
0177 
0178   // AA triggers
0179 
0180   singleThresholds_[L1ParticleMap::kDoubleMu3] = iConfig.getParameter<double>("L1_DoubleMu3_thresh");
0181   prescales_[L1ParticleMap::kDoubleMu3] = iConfig.getParameter<int>("L1_DoubleMu3_prescale");
0182 
0183   singleThresholds_[L1ParticleMap::kDoubleIsoEG8] = iConfig.getParameter<double>("L1_DoubleIsoEG8_thresh");
0184   prescales_[L1ParticleMap::kDoubleIsoEG8] = iConfig.getParameter<int>("L1_DoubleIsoEG8_prescale");
0185   singleThresholds_[L1ParticleMap::kDoubleIsoEG10] = iConfig.getParameter<double>("L1_DoubleIsoEG10_thresh");
0186   prescales_[L1ParticleMap::kDoubleIsoEG10] = iConfig.getParameter<int>("L1_DoubleIsoEG10_prescale");
0187 
0188   singleThresholds_[L1ParticleMap::kDoubleEG5] = iConfig.getParameter<double>("L1_DoubleEG5_thresh");
0189   prescales_[L1ParticleMap::kDoubleEG5] = iConfig.getParameter<int>("L1_DoubleEG5_prescale");
0190   singleThresholds_[L1ParticleMap::kDoubleEG10] = iConfig.getParameter<double>("L1_DoubleEG10_thresh");
0191   prescales_[L1ParticleMap::kDoubleEG10] = iConfig.getParameter<int>("L1_DoubleEG10_prescale");
0192   singleThresholds_[L1ParticleMap::kDoubleEG15] = iConfig.getParameter<double>("L1_DoubleEG15_thresh");
0193   prescales_[L1ParticleMap::kDoubleEG15] = iConfig.getParameter<int>("L1_DoubleEG15_prescale");
0194 
0195   singleThresholds_[L1ParticleMap::kDoubleJet70] = iConfig.getParameter<double>("L1_DoubleJet70_thresh");
0196   prescales_[L1ParticleMap::kDoubleJet70] = iConfig.getParameter<int>("L1_DoubleJet70_prescale");
0197   singleThresholds_[L1ParticleMap::kDoubleJet100] = iConfig.getParameter<double>("L1_DoubleJet100_thresh");
0198   prescales_[L1ParticleMap::kDoubleJet100] = iConfig.getParameter<int>("L1_DoubleJet100_prescale");
0199 
0200   singleThresholds_[L1ParticleMap::kDoubleTauJet20] = iConfig.getParameter<double>("L1_DoubleTauJet20_thresh");
0201   prescales_[L1ParticleMap::kDoubleTauJet20] = iConfig.getParameter<int>("L1_DoubleTauJet20_prescale");
0202   singleThresholds_[L1ParticleMap::kDoubleTauJet30] = iConfig.getParameter<double>("L1_DoubleTauJet30_thresh");
0203   prescales_[L1ParticleMap::kDoubleTauJet30] = iConfig.getParameter<int>("L1_DoubleTauJet30_prescale");
0204   singleThresholds_[L1ParticleMap::kDoubleTauJet35] = iConfig.getParameter<double>("L1_DoubleTauJet35_thresh");
0205   prescales_[L1ParticleMap::kDoubleTauJet35] = iConfig.getParameter<int>("L1_DoubleTauJet35_prescale");
0206   singleThresholds_[L1ParticleMap::kDoubleTauJet40] = iConfig.getParameter<double>("L1_DoubleTauJet40_thresh");
0207   prescales_[L1ParticleMap::kDoubleTauJet40] = iConfig.getParameter<int>("L1_DoubleTauJet40_prescale");
0208 
0209   // AB triggers
0210 
0211   doubleThresholds_[L1ParticleMap::kMu3_IsoEG5].first = iConfig.getParameter<double>("L1_Mu3_IsoEG5_thresh1");
0212   doubleThresholds_[L1ParticleMap::kMu3_IsoEG5].second = iConfig.getParameter<double>("L1_Mu3_IsoEG5_thresh2");
0213   prescales_[L1ParticleMap::kMu3_IsoEG5] = iConfig.getParameter<int>("L1_Mu3_IsoEG5_prescale");
0214   doubleThresholds_[L1ParticleMap::kMu5_IsoEG10].first = iConfig.getParameter<double>("L1_Mu5_IsoEG10_thresh1");
0215   doubleThresholds_[L1ParticleMap::kMu5_IsoEG10].second = iConfig.getParameter<double>("L1_Mu5_IsoEG10_thresh2");
0216   prescales_[L1ParticleMap::kMu5_IsoEG10] = iConfig.getParameter<int>("L1_Mu5_IsoEG10_prescale");
0217 
0218   doubleThresholds_[L1ParticleMap::kMu3_EG12].first = iConfig.getParameter<double>("L1_Mu3_EG12_thresh1");
0219   doubleThresholds_[L1ParticleMap::kMu3_EG12].second = iConfig.getParameter<double>("L1_Mu3_EG12_thresh2");
0220   prescales_[L1ParticleMap::kMu3_EG12] = iConfig.getParameter<int>("L1_Mu3_EG12_prescale");
0221 
0222   doubleThresholds_[L1ParticleMap::kMu3_Jet15].first = iConfig.getParameter<double>("L1_Mu3_Jet15_thresh1");
0223   doubleThresholds_[L1ParticleMap::kMu3_Jet15].second = iConfig.getParameter<double>("L1_Mu3_Jet15_thresh2");
0224   prescales_[L1ParticleMap::kMu3_Jet15] = iConfig.getParameter<int>("L1_Mu3_Jet15_prescale");
0225   doubleThresholds_[L1ParticleMap::kMu5_Jet15].first = iConfig.getParameter<double>("L1_Mu5_Jet15_thresh1");
0226   doubleThresholds_[L1ParticleMap::kMu5_Jet15].second = iConfig.getParameter<double>("L1_Mu5_Jet15_thresh2");
0227   prescales_[L1ParticleMap::kMu5_Jet15] = iConfig.getParameter<int>("L1_Mu5_Jet15_prescale");
0228   doubleThresholds_[L1ParticleMap::kMu3_Jet70].first = iConfig.getParameter<double>("L1_Mu3_Jet70_thresh1");
0229   doubleThresholds_[L1ParticleMap::kMu3_Jet70].second = iConfig.getParameter<double>("L1_Mu3_Jet70_thresh2");
0230   prescales_[L1ParticleMap::kMu3_Jet70] = iConfig.getParameter<int>("L1_Mu3_Jet70_prescale");
0231   doubleThresholds_[L1ParticleMap::kMu5_Jet20].first = iConfig.getParameter<double>("L1_Mu5_Jet20_thresh1");
0232   doubleThresholds_[L1ParticleMap::kMu5_Jet20].second = iConfig.getParameter<double>("L1_Mu5_Jet20_thresh2");
0233   prescales_[L1ParticleMap::kMu5_Jet20] = iConfig.getParameter<int>("L1_Mu5_Jet20_prescale");
0234 
0235   doubleThresholds_[L1ParticleMap::kMu5_TauJet20].first = iConfig.getParameter<double>("L1_Mu5_TauJet20_thresh1");
0236   doubleThresholds_[L1ParticleMap::kMu5_TauJet20].second = iConfig.getParameter<double>("L1_Mu5_TauJet20_thresh2");
0237   prescales_[L1ParticleMap::kMu5_TauJet20] = iConfig.getParameter<int>("L1_Mu5_TauJet20_prescale");
0238   doubleThresholds_[L1ParticleMap::kMu5_TauJet30].first = iConfig.getParameter<double>("L1_Mu5_TauJet30_thresh1");
0239   doubleThresholds_[L1ParticleMap::kMu5_TauJet30].second = iConfig.getParameter<double>("L1_Mu5_TauJet30_thresh2");
0240   prescales_[L1ParticleMap::kMu5_TauJet30] = iConfig.getParameter<int>("L1_Mu5_TauJet30_prescale");
0241 
0242   doubleThresholds_[L1ParticleMap::kIsoEG10_EG10].first = iConfig.getParameter<double>("L1_IsoEG10_EG10_thresh1");
0243   doubleThresholds_[L1ParticleMap::kIsoEG10_EG10].second = iConfig.getParameter<double>("L1_IsoEG10_EG10_thresh2");
0244   prescales_[L1ParticleMap::kIsoEG10_EG10] = iConfig.getParameter<int>("L1_IsoEG10_EG10_prescale");
0245 
0246   doubleThresholds_[L1ParticleMap::kIsoEG10_Jet15].first = iConfig.getParameter<double>("L1_IsoEG10_Jet15_thresh1");
0247   doubleThresholds_[L1ParticleMap::kIsoEG10_Jet15].second = iConfig.getParameter<double>("L1_IsoEG10_Jet15_thresh2");
0248   prescales_[L1ParticleMap::kIsoEG10_Jet15] = iConfig.getParameter<int>("L1_IsoEG10_Jet15_prescale");
0249   doubleThresholds_[L1ParticleMap::kIsoEG10_Jet30].first = iConfig.getParameter<double>("L1_IsoEG10_Jet30_thresh1");
0250   doubleThresholds_[L1ParticleMap::kIsoEG10_Jet30].second = iConfig.getParameter<double>("L1_IsoEG10_Jet30_thresh2");
0251   prescales_[L1ParticleMap::kIsoEG10_Jet30] = iConfig.getParameter<int>("L1_IsoEG10_Jet30_prescale");
0252   doubleThresholds_[L1ParticleMap::kIsoEG10_Jet20].first = iConfig.getParameter<double>("L1_IsoEG10_Jet20_thresh1");
0253   doubleThresholds_[L1ParticleMap::kIsoEG10_Jet20].second = iConfig.getParameter<double>("L1_IsoEG10_Jet20_thresh2");
0254   prescales_[L1ParticleMap::kIsoEG10_Jet20] = iConfig.getParameter<int>("L1_IsoEG10_Jet20_prescale");
0255   doubleThresholds_[L1ParticleMap::kIsoEG10_Jet70].first = iConfig.getParameter<double>("L1_IsoEG10_Jet70_thresh1");
0256   doubleThresholds_[L1ParticleMap::kIsoEG10_Jet70].second = iConfig.getParameter<double>("L1_IsoEG10_Jet70_thresh2");
0257   prescales_[L1ParticleMap::kIsoEG10_Jet70] = iConfig.getParameter<int>("L1_IsoEG10_Jet70_prescale");
0258 
0259   doubleThresholds_[L1ParticleMap::kIsoEG10_TauJet20].first =
0260       iConfig.getParameter<double>("L1_IsoEG10_TauJet20_thresh1");
0261   doubleThresholds_[L1ParticleMap::kIsoEG10_TauJet20].second =
0262       iConfig.getParameter<double>("L1_IsoEG10_TauJet20_thresh2");
0263   prescales_[L1ParticleMap::kIsoEG10_TauJet20] = iConfig.getParameter<int>("L1_IsoEG10_TauJet20_prescale");
0264   doubleThresholds_[L1ParticleMap::kIsoEG10_TauJet30].first =
0265       iConfig.getParameter<double>("L1_IsoEG10_TauJet30_thresh1");
0266   doubleThresholds_[L1ParticleMap::kIsoEG10_TauJet30].second =
0267       iConfig.getParameter<double>("L1_IsoEG10_TauJet30_thresh2");
0268   prescales_[L1ParticleMap::kIsoEG10_TauJet30] = iConfig.getParameter<int>("L1_IsoEG10_TauJet30_prescale");
0269 
0270   doubleThresholds_[L1ParticleMap::kEG10_Jet15].first = iConfig.getParameter<double>("L1_EG10_Jet15_thresh1");
0271   doubleThresholds_[L1ParticleMap::kEG10_Jet15].second = iConfig.getParameter<double>("L1_EG10_Jet15_thresh2");
0272   prescales_[L1ParticleMap::kEG10_Jet15] = iConfig.getParameter<int>("L1_EG10_Jet15_prescale");
0273   doubleThresholds_[L1ParticleMap::kEG12_Jet20].first = iConfig.getParameter<double>("L1_EG12_Jet20_thresh1");
0274   doubleThresholds_[L1ParticleMap::kEG12_Jet20].second = iConfig.getParameter<double>("L1_EG12_Jet20_thresh2");
0275   prescales_[L1ParticleMap::kEG12_Jet20] = iConfig.getParameter<int>("L1_EG12_Jet20_prescale");
0276   doubleThresholds_[L1ParticleMap::kEG12_Jet70].first = iConfig.getParameter<double>("L1_EG12_Jet70_thresh1");
0277   doubleThresholds_[L1ParticleMap::kEG12_Jet70].second = iConfig.getParameter<double>("L1_EG12_Jet70_thresh2");
0278   prescales_[L1ParticleMap::kEG12_Jet70] = iConfig.getParameter<int>("L1_EG12_Jet70_prescale");
0279 
0280   doubleThresholds_[L1ParticleMap::kEG12_TauJet40].first = iConfig.getParameter<double>("L1_EG12_TauJet40_thresh1");
0281   doubleThresholds_[L1ParticleMap::kEG12_TauJet40].second = iConfig.getParameter<double>("L1_EG12_TauJet40_thresh2");
0282   prescales_[L1ParticleMap::kEG12_TauJet40] = iConfig.getParameter<int>("L1_EG12_TauJet40_prescale");
0283 
0284   doubleThresholds_[L1ParticleMap::kJet70_TauJet40].first = iConfig.getParameter<double>("L1_Jet70_TauJet40_thresh1");
0285   doubleThresholds_[L1ParticleMap::kJet70_TauJet40].second = iConfig.getParameter<double>("L1_Jet70_TauJet40_thresh2");
0286   prescales_[L1ParticleMap::kJet70_TauJet40] = iConfig.getParameter<int>("L1_Jet70_TauJet40_prescale");
0287 
0288   doubleThresholds_[L1ParticleMap::kMu3_HTT200].first = iConfig.getParameter<double>("L1_Mu3_HTT200_thresh1");
0289   doubleThresholds_[L1ParticleMap::kMu3_HTT200].second = iConfig.getParameter<double>("L1_Mu3_HTT200_thresh2");
0290   prescales_[L1ParticleMap::kMu3_HTT200] = iConfig.getParameter<int>("L1_Mu3_HTT200_prescale");
0291   doubleThresholds_[L1ParticleMap::kIsoEG10_HTT200].first = iConfig.getParameter<double>("L1_IsoEG10_HTT200_thresh1");
0292   doubleThresholds_[L1ParticleMap::kIsoEG10_HTT200].second = iConfig.getParameter<double>("L1_IsoEG10_HTT200_thresh2");
0293   prescales_[L1ParticleMap::kIsoEG10_HTT200] = iConfig.getParameter<int>("L1_IsoEG10_HTT200_prescale");
0294   doubleThresholds_[L1ParticleMap::kEG12_HTT200].first = iConfig.getParameter<double>("L1_EG12_HTT200_thresh1");
0295   doubleThresholds_[L1ParticleMap::kEG12_HTT200].second = iConfig.getParameter<double>("L1_EG12_HTT200_thresh2");
0296   prescales_[L1ParticleMap::kEG12_HTT200] = iConfig.getParameter<int>("L1_EG12_HTT200_prescale");
0297   doubleThresholds_[L1ParticleMap::kJet70_HTT200].first = iConfig.getParameter<double>("L1_Jet70_HTT200_thresh1");
0298   doubleThresholds_[L1ParticleMap::kJet70_HTT200].second = iConfig.getParameter<double>("L1_Jet70_HTT200_thresh2");
0299   prescales_[L1ParticleMap::kJet70_HTT200] = iConfig.getParameter<int>("L1_Jet70_HTT200_prescale");
0300   doubleThresholds_[L1ParticleMap::kTauJet40_HTT200].first = iConfig.getParameter<double>("L1_TauJet40_HTT200_thresh1");
0301   doubleThresholds_[L1ParticleMap::kTauJet40_HTT200].second =
0302       iConfig.getParameter<double>("L1_TauJet40_HTT200_thresh2");
0303   prescales_[L1ParticleMap::kTauJet40_HTT200] = iConfig.getParameter<int>("L1_TauJet40_HTT200_prescale");
0304 
0305   doubleThresholds_[L1ParticleMap::kMu3_ETM30].first = iConfig.getParameter<double>("L1_Mu3_ETM30_thresh1");
0306   doubleThresholds_[L1ParticleMap::kMu3_ETM30].second = iConfig.getParameter<double>("L1_Mu3_ETM30_thresh2");
0307   prescales_[L1ParticleMap::kMu3_ETM30] = iConfig.getParameter<int>("L1_Mu3_ETM30_prescale");
0308   doubleThresholds_[L1ParticleMap::kIsoEG10_ETM30].first = iConfig.getParameter<double>("L1_IsoEG10_ETM30_thresh1");
0309   doubleThresholds_[L1ParticleMap::kIsoEG10_ETM30].second = iConfig.getParameter<double>("L1_IsoEG10_ETM30_thresh2");
0310   prescales_[L1ParticleMap::kIsoEG10_ETM30] = iConfig.getParameter<int>("L1_IsoEG10_ETM30_prescale");
0311   doubleThresholds_[L1ParticleMap::kEG12_ETM30].first = iConfig.getParameter<double>("L1_EG12_ETM30_thresh1");
0312   doubleThresholds_[L1ParticleMap::kEG12_ETM30].second = iConfig.getParameter<double>("L1_EG12_ETM30_thresh2");
0313   prescales_[L1ParticleMap::kEG12_ETM30] = iConfig.getParameter<int>("L1_EG12_ETM30_prescale");
0314   doubleThresholds_[L1ParticleMap::kJet70_ETM40].first = iConfig.getParameter<double>("L1_Jet70_ETM40_thresh1");
0315   doubleThresholds_[L1ParticleMap::kJet70_ETM40].second = iConfig.getParameter<double>("L1_Jet70_ETM40_thresh2");
0316   prescales_[L1ParticleMap::kJet70_ETM40] = iConfig.getParameter<int>("L1_Jet70_ETM40_prescale");
0317 
0318   doubleThresholds_[L1ParticleMap::kTauJet20_ETM20].first = iConfig.getParameter<double>("L1_TauJet20_ETM20_thresh1");
0319   doubleThresholds_[L1ParticleMap::kTauJet20_ETM20].second = iConfig.getParameter<double>("L1_TauJet20_ETM20_thresh2");
0320   prescales_[L1ParticleMap::kTauJet20_ETM20] = iConfig.getParameter<int>("L1_TauJet20_ETM20_prescale");
0321   doubleThresholds_[L1ParticleMap::kTauJet30_ETM30].first = iConfig.getParameter<double>("L1_TauJet30_ETM30_thresh1");
0322   doubleThresholds_[L1ParticleMap::kTauJet30_ETM30].second = iConfig.getParameter<double>("L1_TauJet30_ETM30_thresh2");
0323   prescales_[L1ParticleMap::kTauJet30_ETM30] = iConfig.getParameter<int>("L1_TauJet30_ETM30_prescale");
0324   doubleThresholds_[L1ParticleMap::kTauJet30_ETM40].first = iConfig.getParameter<double>("L1_TauJet30_ETM40_thresh1");
0325   doubleThresholds_[L1ParticleMap::kTauJet30_ETM40].second = iConfig.getParameter<double>("L1_TauJet30_ETM40_thresh2");
0326   prescales_[L1ParticleMap::kTauJet30_ETM40] = iConfig.getParameter<int>("L1_TauJet30_ETM40_prescale");
0327 
0328   doubleThresholds_[L1ParticleMap::kHTT100_ETM30].first = iConfig.getParameter<double>("L1_HTT100_ETM30_thresh1");
0329   doubleThresholds_[L1ParticleMap::kHTT100_ETM30].second = iConfig.getParameter<double>("L1_HTT100_ETM30_thresh2");
0330   prescales_[L1ParticleMap::kHTT100_ETM30] = iConfig.getParameter<int>("L1_HTT100_ETM30_prescale");
0331 
0332   // AAA triggers
0333 
0334   singleThresholds_[L1ParticleMap::kTripleMu3] = iConfig.getParameter<double>("L1_TripleMu3_thresh");
0335   prescales_[L1ParticleMap::kTripleMu3] = iConfig.getParameter<int>("L1_TripleMu3_prescale");
0336   singleThresholds_[L1ParticleMap::kTripleIsoEG5] = iConfig.getParameter<double>("L1_TripleIsoEG5_thresh");
0337   prescales_[L1ParticleMap::kTripleIsoEG5] = iConfig.getParameter<int>("L1_TripleIsoEG5_prescale");
0338   singleThresholds_[L1ParticleMap::kTripleEG10] = iConfig.getParameter<double>("L1_TripleEG10_thresh");
0339   prescales_[L1ParticleMap::kTripleEG10] = iConfig.getParameter<int>("L1_TripleEG10_prescale");
0340   singleThresholds_[L1ParticleMap::kTripleJet50] = iConfig.getParameter<double>("L1_TripleJet50_thresh");
0341   prescales_[L1ParticleMap::kTripleJet50] = iConfig.getParameter<int>("L1_TripleJet50_prescale");
0342   singleThresholds_[L1ParticleMap::kTripleTauJet40] = iConfig.getParameter<double>("L1_TripleTauJet40_thresh");
0343   prescales_[L1ParticleMap::kTripleTauJet40] = iConfig.getParameter<int>("L1_TripleTauJet40_prescale");
0344 
0345   // AAB triggers
0346 
0347   doubleThresholds_[L1ParticleMap::kDoubleMu3_IsoEG5].first =
0348       iConfig.getParameter<double>("L1_DoubleMu3_IsoEG5_thresh1");
0349   doubleThresholds_[L1ParticleMap::kDoubleMu3_IsoEG5].second =
0350       iConfig.getParameter<double>("L1_DoubleMu3_IsoEG5_thresh2");
0351   prescales_[L1ParticleMap::kDoubleMu3_IsoEG5] = iConfig.getParameter<int>("L1_DoubleMu3_IsoEG5_prescale");
0352   doubleThresholds_[L1ParticleMap::kDoubleMu3_EG10].first = iConfig.getParameter<double>("L1_DoubleMu3_EG10_thresh1");
0353   doubleThresholds_[L1ParticleMap::kDoubleMu3_EG10].second = iConfig.getParameter<double>("L1_DoubleMu3_EG10_thresh2");
0354   prescales_[L1ParticleMap::kDoubleMu3_EG10] = iConfig.getParameter<int>("L1_DoubleMu3_EG10_prescale");
0355   doubleThresholds_[L1ParticleMap::kDoubleIsoEG5_Mu3].first =
0356       iConfig.getParameter<double>("L1_DoubleIsoEG5_Mu3_thresh1");
0357   doubleThresholds_[L1ParticleMap::kDoubleIsoEG5_Mu3].second =
0358       iConfig.getParameter<double>("L1_DoubleIsoEG5_Mu3_thresh2");
0359   prescales_[L1ParticleMap::kDoubleIsoEG5_Mu3] = iConfig.getParameter<int>("L1_DoubleIsoEG5_Mu3_prescale");
0360   doubleThresholds_[L1ParticleMap::kDoubleEG10_Mu3].first = iConfig.getParameter<double>("L1_DoubleEG10_Mu3_thresh1");
0361   doubleThresholds_[L1ParticleMap::kDoubleEG10_Mu3].second = iConfig.getParameter<double>("L1_DoubleEG10_Mu3_thresh2");
0362   prescales_[L1ParticleMap::kDoubleEG10_Mu3] = iConfig.getParameter<int>("L1_DoubleEG10_Mu3_prescale");
0363 
0364   doubleThresholds_[L1ParticleMap::kDoubleMu3_HTT200].first =
0365       iConfig.getParameter<double>("L1_DoubleMu3_HTT200_thresh1");
0366   doubleThresholds_[L1ParticleMap::kDoubleMu3_HTT200].second =
0367       iConfig.getParameter<double>("L1_DoubleMu3_HTT200_thresh2");
0368   prescales_[L1ParticleMap::kDoubleMu3_HTT200] = iConfig.getParameter<int>("L1_DoubleMu3_HTT200_prescale");
0369   doubleThresholds_[L1ParticleMap::kDoubleIsoEG5_HTT200].first =
0370       iConfig.getParameter<double>("L1_DoubleIsoEG5_HTT200_thresh1");
0371   doubleThresholds_[L1ParticleMap::kDoubleIsoEG5_HTT200].second =
0372       iConfig.getParameter<double>("L1_DoubleIsoEG5_HTT200_thresh2");
0373   prescales_[L1ParticleMap::kDoubleIsoEG5_HTT200] = iConfig.getParameter<int>("L1_DoubleIsoEG5_HTT200_prescale");
0374   doubleThresholds_[L1ParticleMap::kDoubleEG10_HTT200].first =
0375       iConfig.getParameter<double>("L1_DoubleEG10_HTT200_thresh1");
0376   doubleThresholds_[L1ParticleMap::kDoubleEG10_HTT200].second =
0377       iConfig.getParameter<double>("L1_DoubleEG10_HTT200_thresh2");
0378   prescales_[L1ParticleMap::kDoubleEG10_HTT200] = iConfig.getParameter<int>("L1_DoubleEG10_HTT200_prescale");
0379   doubleThresholds_[L1ParticleMap::kDoubleJet50_HTT200].first =
0380       iConfig.getParameter<double>("L1_DoubleJet50_HTT200_thresh1");
0381   doubleThresholds_[L1ParticleMap::kDoubleJet50_HTT200].second =
0382       iConfig.getParameter<double>("L1_DoubleJet50_HTT200_thresh2");
0383   prescales_[L1ParticleMap::kDoubleJet50_HTT200] = iConfig.getParameter<int>("L1_DoubleJet50_HTT200_prescale");
0384   doubleThresholds_[L1ParticleMap::kDoubleTauJet40_HTT200].first =
0385       iConfig.getParameter<double>("L1_DoubleTauJet40_HTT200_thresh1");
0386   doubleThresholds_[L1ParticleMap::kDoubleTauJet40_HTT200].second =
0387       iConfig.getParameter<double>("L1_DoubleTauJet40_HTT200_thresh2");
0388   prescales_[L1ParticleMap::kDoubleTauJet40_HTT200] = iConfig.getParameter<int>("L1_DoubleTauJet40_HTT200_prescale");
0389 
0390   doubleThresholds_[L1ParticleMap::kDoubleMu3_ETM20].first = iConfig.getParameter<double>("L1_DoubleMu3_ETM20_thresh1");
0391   doubleThresholds_[L1ParticleMap::kDoubleMu3_ETM20].second =
0392       iConfig.getParameter<double>("L1_DoubleMu3_ETM20_thresh2");
0393   prescales_[L1ParticleMap::kDoubleMu3_ETM20] = iConfig.getParameter<int>("L1_DoubleMu3_ETM20_prescale");
0394   doubleThresholds_[L1ParticleMap::kDoubleIsoEG5_ETM20].first =
0395       iConfig.getParameter<double>("L1_DoubleIsoEG5_ETM20_thresh1");
0396   doubleThresholds_[L1ParticleMap::kDoubleIsoEG5_ETM20].second =
0397       iConfig.getParameter<double>("L1_DoubleIsoEG5_ETM20_thresh2");
0398   prescales_[L1ParticleMap::kDoubleIsoEG5_ETM20] = iConfig.getParameter<int>("L1_DoubleIsoEG5_ETM20_prescale");
0399   doubleThresholds_[L1ParticleMap::kDoubleEG10_ETM20].first =
0400       iConfig.getParameter<double>("L1_DoubleEG10_ETM20_thresh1");
0401   doubleThresholds_[L1ParticleMap::kDoubleEG10_ETM20].second =
0402       iConfig.getParameter<double>("L1_DoubleEG10_ETM20_thresh2");
0403   prescales_[L1ParticleMap::kDoubleEG10_ETM20] = iConfig.getParameter<int>("L1_DoubleEG10_ETM20_prescale");
0404   doubleThresholds_[L1ParticleMap::kDoubleJet50_ETM20].first =
0405       iConfig.getParameter<double>("L1_DoubleJet50_ETM20_thresh1");
0406   doubleThresholds_[L1ParticleMap::kDoubleJet50_ETM20].second =
0407       iConfig.getParameter<double>("L1_DoubleJet50_ETM20_thresh2");
0408   prescales_[L1ParticleMap::kDoubleJet50_ETM20] = iConfig.getParameter<int>("L1_DoubleJet50_ETM20_prescale");
0409   doubleThresholds_[L1ParticleMap::kDoubleTauJet40_ETM20].first =
0410       iConfig.getParameter<double>("L1_DoubleTauJet40_ETM20_thresh1");
0411   doubleThresholds_[L1ParticleMap::kDoubleTauJet40_ETM20].second =
0412       iConfig.getParameter<double>("L1_DoubleTauJet40_ETM20_thresh2");
0413   prescales_[L1ParticleMap::kDoubleTauJet40_ETM20] = iConfig.getParameter<int>("L1_DoubleTauJet40_ETM20_prescale");
0414 
0415   singleThresholds_[L1ParticleMap::kQuadJet30] = iConfig.getParameter<double>("L1_QuadJet30_thresh");
0416   prescales_[L1ParticleMap::kQuadJet30] = iConfig.getParameter<int>("L1_QuadJet30_prescale");
0417 
0418   // Diffractive triggers
0419   doubleThresholds_[L1ParticleMap::kExclusiveDoubleIsoEG4].first =
0420       iConfig.getParameter<double>("L1_ExclusiveDoubleIsoEG4_thresh1");
0421   doubleThresholds_[L1ParticleMap::kExclusiveDoubleIsoEG4].second =
0422       iConfig.getParameter<double>("L1_ExclusiveDoubleIsoEG4_thresh2");  // for jet rejection
0423   prescales_[L1ParticleMap::kExclusiveDoubleIsoEG4] = iConfig.getParameter<int>("L1_ExclusiveDoubleIsoEG4_prescale");
0424   singleThresholds_[L1ParticleMap::kExclusiveDoubleJet60] =
0425       iConfig.getParameter<double>("L1_ExclusiveDoubleJet60_thresh");
0426   prescales_[L1ParticleMap::kExclusiveDoubleJet60] = iConfig.getParameter<int>("L1_ExclusiveDoubleJet60_prescale");
0427   singleThresholds_[L1ParticleMap::kExclusiveJet25_Gap_Jet25] =
0428       iConfig.getParameter<double>("L1_ExclusiveJet25_Gap_Jet25_thresh");
0429   prescales_[L1ParticleMap::kExclusiveJet25_Gap_Jet25] =
0430       iConfig.getParameter<int>("L1_ExclusiveJet25_Gap_Jet25_prescale");
0431   doubleThresholds_[L1ParticleMap::kIsoEG10_Jet20_ForJet10].first =
0432       iConfig.getParameter<double>("L1_IsoEG10_Jet20_ForJet10_thresh1");
0433   doubleThresholds_[L1ParticleMap::kIsoEG10_Jet20_ForJet10].second =
0434       iConfig.getParameter<double>("L1_IsoEG10_Jet20_ForJet10_thresh2");
0435   singleThresholds_[L1ParticleMap::kIsoEG10_Jet20_ForJet10] =
0436       iConfig.getParameter<double>("L1_IsoEG10_Jet20_ForJet10_thresh3");
0437   prescales_[L1ParticleMap::kIsoEG10_Jet20_ForJet10] = iConfig.getParameter<int>("L1_IsoEG10_Jet20_ForJet10_prescale");
0438 
0439   prescales_[L1ParticleMap::kMinBias_HTT10] = iConfig.getParameter<int>("L1_MinBias_HTT10_prescale");
0440   prescales_[L1ParticleMap::kZeroBias] = iConfig.getParameter<int>("L1_ZeroBias_prescale");
0441 
0442   //    // Print trigger table in Twiki table format.
0443   //    std::cout << "|  *Trigger Index*  |  *Trigger Name*  |  *E<sub>T</sub>
0444   //    Threshold (!GeV)*  |  *Prescale*  |"
0445   //         << std::endl ;
0446 
0447   //    for( int i = 0 ; i < L1ParticleMap::kNumOfL1TriggerTypes ; ++i )
0448   //    {
0449   //       std::cout
0450   //     << "|  "
0451   //     << i
0452   //     << "  |  " ;
0453   //       if( prescales_[ i ] == 999999999 ) std::cout << "<strike>" ;
0454   //       std::cout
0455   //     << L1ParticleMap::triggerName( ( L1ParticleMap::L1TriggerType ) i ) ;
0456   //       if( prescales_[ i ] == 999999999 ) std::cout << "</strike>" ;
0457   //       std::cout << "  |  " ;
0458 
0459   //       if( singleThresholds_[ i ] > 0 )
0460   //       {
0461   //     if( doubleThresholds_[ i ].first > 0 )
0462   //     {
0463   //        std::cout << doubleThresholds_[ i ].first << ", "
0464   //              << doubleThresholds_[ i ].second << ", " ;
0465   //     }
0466 
0467   //     std::cout << singleThresholds_[ i ] ;
0468   //       }
0469   //       else if( doubleThresholds_[ i ].first > 0 )
0470   //       {
0471   //     std::cout << doubleThresholds_[ i ].first << ", "
0472   //           << doubleThresholds_[ i ].second ;
0473   //       }
0474   //       else
0475   //       {
0476   //     std::cout << "---" ;
0477   //       }
0478 
0479   //       std::cout << "  |  " ;
0480   //       if( prescales_[ i ] != 999999999 ) std::cout << prescales_[ i ] ;
0481   //       std::cout << "  |"
0482   //        << std::endl ;
0483   //    }
0484 }
0485 
0486 L1ExtraParticleMapProd::~L1ExtraParticleMapProd() {
0487   // do anything here that needs to be done at desctruction time
0488   // (e.g. close files, deallocate resources etc.)
0489 }
0490 
0491 //
0492 // member functions
0493 //
0494 
0495 // ------------ method called to produce the data  ------------
0496 void L1ExtraParticleMapProd::produce(edm::Event &iEvent, const edm::EventSetup &iSetup) {
0497   using namespace edm;
0498   using namespace std;
0499   using namespace reco;
0500   using namespace l1extra;
0501 
0502   // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0503   // ~~~~~~~~ Get L1Extra particles ~~~~~~~~
0504   // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0505 
0506   Handle<L1EmParticleCollection> isoEmHandle;
0507   iEvent.getByLabel(isoEmSource_, isoEmHandle);
0508 
0509   Handle<L1EmParticleCollection> nonIsoEmHandle;
0510   iEvent.getByLabel(nonIsoEmSource_, nonIsoEmHandle);
0511 
0512   Handle<L1JetParticleCollection> cenJetHandle;
0513   iEvent.getByLabel(cenJetSource_, cenJetHandle);
0514 
0515   Handle<L1JetParticleCollection> forJetHandle;
0516   iEvent.getByLabel(forJetSource_, forJetHandle);
0517 
0518   Handle<L1JetParticleCollection> tauJetHandle;
0519   iEvent.getByLabel(tauJetSource_, tauJetHandle);
0520 
0521   Handle<L1MuonParticleCollection> muHandle;
0522   iEvent.getByLabel(muonSource_, muHandle);
0523 
0524   Handle<L1EtMissParticle> metHandle;
0525   iEvent.getByLabel(etMissSource_, metHandle);
0526 
0527   Handle<L1EtMissParticle> mhtHandle;
0528   iEvent.getByLabel(htMissSource_, mhtHandle);
0529 
0530   double met = metHandle->etMiss();
0531   double ht = mhtHandle->etTotal();
0532   double ett = metHandle->etTotal();
0533 
0534   // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0535   // ~~~ Evaluate trigger conditions and make a L1ParticleMapCollection. ~~~
0536   // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0537 
0538   // First, form the input vector<Ref>s that will be needed.
0539   L1EmParticleVectorRef inputIsoEmRefs;
0540   addToVectorRefs(isoEmHandle, inputIsoEmRefs);
0541 
0542   L1EmParticleVectorRef inputRelaxedEmRefs;
0543   addToVectorRefs(isoEmHandle, inputRelaxedEmRefs);
0544   addToVectorRefs(nonIsoEmHandle, inputRelaxedEmRefs);
0545 
0546   L1JetParticleVectorRef inputTauRefs;
0547   addToVectorRefs(tauJetHandle, inputTauRefs);
0548 
0549   L1JetParticleVectorRef inputJetRefs;
0550   addToVectorRefs(forJetHandle, inputJetRefs);
0551   addToVectorRefs(cenJetHandle, inputJetRefs);
0552   addToVectorRefs(tauJetHandle, inputJetRefs);
0553 
0554   L1JetParticleVectorRef inputForJetRefs;
0555   addToVectorRefs(forJetHandle, inputForJetRefs);
0556 
0557   L1JetParticleVectorRef inputCenJetTauJetRefs;
0558   addToVectorRefs(cenJetHandle, inputCenJetTauJetRefs);
0559   addToVectorRefs(tauJetHandle, inputCenJetTauJetRefs);
0560 
0561   L1MuonParticleVectorRef inputMuonRefsSingle;
0562   L1MuonParticleVectorRef inputMuonRefsDouble;
0563   L1MuonParticleCollection::const_iterator muItr = muHandle->begin();
0564   L1MuonParticleCollection::const_iterator muEnd = muHandle->end();
0565 
0566   for (size_t i = 0; muItr != muEnd; ++muItr, ++i) {
0567     if (!muItr->gmtMuonCand().empty()) {
0568       unsigned int qual = muItr->gmtMuonCand().quality();
0569 
0570       if (qual == 4 || qual == 5 || qual == 6 || qual == 7) {
0571         inputMuonRefsSingle.push_back(edm::Ref<L1MuonParticleCollection>(muHandle, i));
0572       }
0573 
0574       if (qual == 3 || qual == 5 || qual == 6 || qual == 7) {
0575         inputMuonRefsDouble.push_back(edm::Ref<L1MuonParticleCollection>(muHandle, i));
0576       }
0577     }
0578   }
0579 
0580   unique_ptr<L1ParticleMapCollection> mapColl(new L1ParticleMapCollection);
0581   bool globalDecision = false;
0582   std::vector<bool> decisionWord;
0583 
0584   for (int itrig = 0; itrig < L1ParticleMap::kNumOfL1TriggerTypes; ++itrig) {
0585     bool decision = false;
0586     std::vector<L1ParticleMap::L1ObjectType> objectTypes;
0587     L1EmParticleVectorRef outputEmRefsTmp;
0588     L1JetParticleVectorRef outputJetRefsTmp;
0589     L1MuonParticleVectorRef outputMuonRefsTmp;
0590     L1EtMissParticleRefProd metRefTmp;
0591     L1ParticleMap::L1IndexComboVector combosTmp;  // unfilled for single objs
0592 
0593     if (itrig == L1ParticleMap::kSingleMu3 || itrig == L1ParticleMap::kSingleMu5 ||
0594         itrig == L1ParticleMap::kSingleMu7 || itrig == L1ParticleMap::kSingleMu10 ||
0595         itrig == L1ParticleMap::kSingleMu14 || itrig == L1ParticleMap::kSingleMu20 ||
0596         itrig == L1ParticleMap::kSingleMu25) {
0597       objectTypes.push_back(L1ParticleMap::kMuon);
0598 
0599       evaluateSingleObjectTrigger(inputMuonRefsSingle, singleThresholds_[itrig], decision, outputMuonRefsTmp);
0600     } else if (itrig == L1ParticleMap::kSingleIsoEG5 || itrig == L1ParticleMap::kSingleIsoEG8 ||
0601                itrig == L1ParticleMap::kSingleIsoEG10 || itrig == L1ParticleMap::kSingleIsoEG12 ||
0602                itrig == L1ParticleMap::kSingleIsoEG15 || itrig == L1ParticleMap::kSingleIsoEG20 ||
0603                itrig == L1ParticleMap::kSingleIsoEG25) {
0604       objectTypes.push_back(L1ParticleMap::kEM);
0605 
0606       evaluateSingleObjectTrigger(inputIsoEmRefs, singleThresholds_[itrig], decision, outputEmRefsTmp);
0607     } else if (itrig == L1ParticleMap::kSingleEG5 || itrig == L1ParticleMap::kSingleEG8 ||
0608                itrig == L1ParticleMap::kSingleEG10 || itrig == L1ParticleMap::kSingleEG12 ||
0609                itrig == L1ParticleMap::kSingleEG15 || itrig == L1ParticleMap::kSingleEG20 ||
0610                itrig == L1ParticleMap::kSingleEG25) {
0611       objectTypes.push_back(L1ParticleMap::kEM);
0612 
0613       evaluateSingleObjectTrigger(inputRelaxedEmRefs, singleThresholds_[itrig], decision, outputEmRefsTmp);
0614     } else if (itrig == L1ParticleMap::kSingleJet15 || itrig == L1ParticleMap::kSingleJet20 ||
0615                itrig == L1ParticleMap::kSingleJet30 || itrig == L1ParticleMap::kSingleJet50 ||
0616                itrig == L1ParticleMap::kSingleJet70 || itrig == L1ParticleMap::kSingleJet100 ||
0617                itrig == L1ParticleMap::kSingleJet150 || itrig == L1ParticleMap::kSingleJet200) {
0618       objectTypes.push_back(L1ParticleMap::kJet);
0619 
0620       evaluateSingleObjectTrigger(inputJetRefs, singleThresholds_[itrig], decision, outputJetRefsTmp);
0621     } else if (itrig == L1ParticleMap::kSingleTauJet10 || itrig == L1ParticleMap::kSingleTauJet20 ||
0622                itrig == L1ParticleMap::kSingleTauJet30 || itrig == L1ParticleMap::kSingleTauJet35 ||
0623                itrig == L1ParticleMap::kSingleTauJet40 || itrig == L1ParticleMap::kSingleTauJet60 ||
0624                itrig == L1ParticleMap::kSingleTauJet80 || itrig == L1ParticleMap::kSingleTauJet100) {
0625       objectTypes.push_back(L1ParticleMap::kJet);
0626 
0627       evaluateSingleObjectTrigger(inputTauRefs, singleThresholds_[itrig], decision, outputJetRefsTmp);
0628     } else if (itrig == L1ParticleMap::kHTT100 || itrig == L1ParticleMap::kHTT200 || itrig == L1ParticleMap::kHTT250 ||
0629                itrig == L1ParticleMap::kHTT300 || itrig == L1ParticleMap::kHTT400 || itrig == L1ParticleMap::kHTT500) {
0630       objectTypes.push_back(L1ParticleMap::kEtHad);
0631 
0632       if (ht >= singleThresholds_[itrig]) {
0633         decision = true;
0634         metRefTmp = L1EtMissParticleRefProd(mhtHandle);
0635       }
0636     } else if (itrig == L1ParticleMap::kETM10 || itrig == L1ParticleMap::kETM15 || itrig == L1ParticleMap::kETM20 ||
0637                itrig == L1ParticleMap::kETM30 || itrig == L1ParticleMap::kETM40 || itrig == L1ParticleMap::kETM50 ||
0638                itrig == L1ParticleMap::kETM60) {
0639       objectTypes.push_back(L1ParticleMap::kEtMiss);
0640 
0641       if (met >= singleThresholds_[itrig]) {
0642         decision = true;
0643         metRefTmp = L1EtMissParticleRefProd(metHandle);
0644       }
0645     } else if (itrig == L1ParticleMap::kETT60) {
0646       objectTypes.push_back(L1ParticleMap::kEtTotal);
0647 
0648       if (ett >= singleThresholds_[itrig]) {
0649         decision = true;
0650         metRefTmp = L1EtMissParticleRefProd(metHandle);
0651       }
0652     } else if (itrig == L1ParticleMap::kDoubleMu3) {
0653       objectTypes.push_back(L1ParticleMap::kMuon);
0654       objectTypes.push_back(L1ParticleMap::kMuon);
0655 
0656       evaluateDoubleSameObjectTrigger(
0657           inputMuonRefsDouble, singleThresholds_[itrig], decision, outputMuonRefsTmp, combosTmp);
0658     } else if (itrig == L1ParticleMap::kDoubleIsoEG8 || itrig == L1ParticleMap::kDoubleIsoEG10) {
0659       objectTypes.push_back(L1ParticleMap::kEM);
0660       objectTypes.push_back(L1ParticleMap::kEM);
0661 
0662       evaluateDoubleSameObjectTrigger(inputIsoEmRefs, singleThresholds_[itrig], decision, outputEmRefsTmp, combosTmp);
0663     } else if (itrig == L1ParticleMap::kDoubleEG5 || itrig == L1ParticleMap::kDoubleEG10 ||
0664                itrig == L1ParticleMap::kDoubleEG15) {
0665       objectTypes.push_back(L1ParticleMap::kEM);
0666       objectTypes.push_back(L1ParticleMap::kEM);
0667 
0668       evaluateDoubleSameObjectTrigger(
0669           inputRelaxedEmRefs, singleThresholds_[itrig], decision, outputEmRefsTmp, combosTmp);
0670     } else if (itrig == L1ParticleMap::kDoubleJet70 || itrig == L1ParticleMap::kDoubleJet100) {
0671       objectTypes.push_back(L1ParticleMap::kJet);
0672       objectTypes.push_back(L1ParticleMap::kJet);
0673 
0674       evaluateDoubleSameObjectTrigger(inputJetRefs, singleThresholds_[itrig], decision, outputJetRefsTmp, combosTmp);
0675     } else if (itrig == L1ParticleMap::kDoubleTauJet20 || itrig == L1ParticleMap::kDoubleTauJet30 ||
0676                itrig == L1ParticleMap::kDoubleTauJet35 || itrig == L1ParticleMap::kDoubleTauJet40) {
0677       objectTypes.push_back(L1ParticleMap::kJet);
0678       objectTypes.push_back(L1ParticleMap::kJet);
0679 
0680       evaluateDoubleSameObjectTrigger(inputTauRefs, singleThresholds_[itrig], decision, outputJetRefsTmp, combosTmp);
0681     } else if (itrig == L1ParticleMap::kMu3_IsoEG5 || itrig == L1ParticleMap::kMu5_IsoEG10) {
0682       objectTypes.push_back(L1ParticleMap::kMuon);
0683       objectTypes.push_back(L1ParticleMap::kEM);
0684 
0685       evaluateDoubleDifferentObjectTrigger(inputMuonRefsSingle,
0686                                            inputIsoEmRefs,
0687                                            doubleThresholds_[itrig].first,
0688                                            doubleThresholds_[itrig].second,
0689                                            decision,
0690                                            outputMuonRefsTmp,
0691                                            outputEmRefsTmp,
0692                                            combosTmp);
0693     } else if (itrig == L1ParticleMap::kMu3_EG12) {
0694       objectTypes.push_back(L1ParticleMap::kMuon);
0695       objectTypes.push_back(L1ParticleMap::kEM);
0696 
0697       evaluateDoubleDifferentObjectTrigger(inputMuonRefsSingle,
0698                                            inputRelaxedEmRefs,
0699                                            doubleThresholds_[itrig].first,
0700                                            doubleThresholds_[itrig].second,
0701                                            decision,
0702                                            outputMuonRefsTmp,
0703                                            outputEmRefsTmp,
0704                                            combosTmp);
0705     } else if (itrig == L1ParticleMap::kMu3_Jet15 || itrig == L1ParticleMap::kMu5_Jet15 ||
0706                itrig == L1ParticleMap::kMu3_Jet70 || itrig == L1ParticleMap::kMu5_Jet20) {
0707       objectTypes.push_back(L1ParticleMap::kMuon);
0708       objectTypes.push_back(L1ParticleMap::kJet);
0709 
0710       evaluateDoubleDifferentObjectTrigger(inputMuonRefsSingle,
0711                                            inputJetRefs,
0712                                            doubleThresholds_[itrig].first,
0713                                            doubleThresholds_[itrig].second,
0714                                            decision,
0715                                            outputMuonRefsTmp,
0716                                            outputJetRefsTmp,
0717                                            combosTmp);
0718     } else if (itrig == L1ParticleMap::kMu5_TauJet20 || itrig == L1ParticleMap::kMu5_TauJet30) {
0719       objectTypes.push_back(L1ParticleMap::kMuon);
0720       objectTypes.push_back(L1ParticleMap::kJet);
0721 
0722       evaluateDoubleDifferentObjectTrigger(inputMuonRefsSingle,
0723                                            inputTauRefs,
0724                                            doubleThresholds_[itrig].first,
0725                                            doubleThresholds_[itrig].second,
0726                                            decision,
0727                                            outputMuonRefsTmp,
0728                                            outputJetRefsTmp,
0729                                            combosTmp);
0730     } else if (itrig == L1ParticleMap::kIsoEG10_EG10) {
0731       objectTypes.push_back(L1ParticleMap::kEM);
0732       objectTypes.push_back(L1ParticleMap::kEM);
0733 
0734       evaluateDoubleDifferentObjectSameTypeTrigger(inputIsoEmRefs,
0735                                                    inputRelaxedEmRefs,
0736                                                    doubleThresholds_[itrig].first,
0737                                                    doubleThresholds_[itrig].second,
0738                                                    decision,
0739                                                    outputEmRefsTmp,
0740                                                    combosTmp);
0741     } else if (itrig == L1ParticleMap::kIsoEG10_Jet15 || itrig == L1ParticleMap::kIsoEG10_Jet30 ||
0742                itrig == L1ParticleMap::kIsoEG10_Jet20 || itrig == L1ParticleMap::kIsoEG10_Jet70) {
0743       objectTypes.push_back(L1ParticleMap::kEM);
0744       objectTypes.push_back(L1ParticleMap::kJet);
0745 
0746       evaluateDoubleDifferentCaloObjectTrigger(inputIsoEmRefs,
0747                                                inputJetRefs,
0748                                                doubleThresholds_[itrig].first,
0749                                                doubleThresholds_[itrig].second,
0750                                                decision,
0751                                                outputEmRefsTmp,
0752                                                outputJetRefsTmp,
0753                                                combosTmp);
0754     } else if (itrig == L1ParticleMap::kIsoEG10_TauJet20 || itrig == L1ParticleMap::kIsoEG10_TauJet30) {
0755       objectTypes.push_back(L1ParticleMap::kEM);
0756       objectTypes.push_back(L1ParticleMap::kJet);
0757 
0758       evaluateDoubleDifferentCaloObjectTrigger(inputIsoEmRefs,
0759                                                inputTauRefs,
0760                                                doubleThresholds_[itrig].first,
0761                                                doubleThresholds_[itrig].second,
0762                                                decision,
0763                                                outputEmRefsTmp,
0764                                                outputJetRefsTmp,
0765                                                combosTmp);
0766     } else if (itrig == L1ParticleMap::kEG10_Jet15 || itrig == L1ParticleMap::kEG12_Jet20 ||
0767                itrig == L1ParticleMap::kEG12_Jet70) {
0768       objectTypes.push_back(L1ParticleMap::kEM);
0769       objectTypes.push_back(L1ParticleMap::kJet);
0770 
0771       evaluateDoubleDifferentCaloObjectTrigger(inputRelaxedEmRefs,
0772                                                inputJetRefs,
0773                                                doubleThresholds_[itrig].first,
0774                                                doubleThresholds_[itrig].second,
0775                                                decision,
0776                                                outputEmRefsTmp,
0777                                                outputJetRefsTmp,
0778                                                combosTmp);
0779     } else if (itrig == L1ParticleMap::kEG12_TauJet40) {
0780       objectTypes.push_back(L1ParticleMap::kEM);
0781       objectTypes.push_back(L1ParticleMap::kJet);
0782 
0783       evaluateDoubleDifferentCaloObjectTrigger(inputRelaxedEmRefs,
0784                                                inputTauRefs,
0785                                                doubleThresholds_[itrig].first,
0786                                                doubleThresholds_[itrig].second,
0787                                                decision,
0788                                                outputEmRefsTmp,
0789                                                outputJetRefsTmp,
0790                                                combosTmp);
0791     } else if (itrig == L1ParticleMap::kJet70_TauJet40) {
0792       objectTypes.push_back(L1ParticleMap::kJet);
0793       objectTypes.push_back(L1ParticleMap::kJet);
0794 
0795       evaluateDoubleDifferentObjectSameTypeTrigger(inputJetRefs,
0796                                                    inputTauRefs,
0797                                                    doubleThresholds_[itrig].first,
0798                                                    doubleThresholds_[itrig].second,
0799                                                    decision,
0800                                                    outputJetRefsTmp,
0801                                                    combosTmp);
0802     } else if (itrig == L1ParticleMap::kMu3_HTT200) {
0803       objectTypes.push_back(L1ParticleMap::kMuon);
0804       objectTypes.push_back(L1ParticleMap::kEtHad);
0805 
0806       if (ht >= doubleThresholds_[itrig].second) {
0807         evaluateSingleObjectTrigger(inputMuonRefsSingle, doubleThresholds_[itrig].first, decision, outputMuonRefsTmp);
0808 
0809         if (decision) {
0810           metRefTmp = L1EtMissParticleRefProd(mhtHandle);
0811         }
0812       }
0813     } else if (itrig == L1ParticleMap::kIsoEG10_HTT200) {
0814       objectTypes.push_back(L1ParticleMap::kEM);
0815       objectTypes.push_back(L1ParticleMap::kEtHad);
0816 
0817       if (ht >= doubleThresholds_[itrig].second) {
0818         evaluateSingleObjectTrigger(inputIsoEmRefs, doubleThresholds_[itrig].first, decision, outputEmRefsTmp);
0819 
0820         if (decision) {
0821           metRefTmp = L1EtMissParticleRefProd(mhtHandle);
0822         }
0823       }
0824     } else if (itrig == L1ParticleMap::kEG12_HTT200) {
0825       objectTypes.push_back(L1ParticleMap::kEM);
0826       objectTypes.push_back(L1ParticleMap::kEtHad);
0827 
0828       if (ht >= doubleThresholds_[itrig].second) {
0829         evaluateSingleObjectTrigger(inputRelaxedEmRefs, doubleThresholds_[itrig].first, decision, outputEmRefsTmp);
0830 
0831         if (decision) {
0832           metRefTmp = L1EtMissParticleRefProd(mhtHandle);
0833         }
0834       }
0835     } else if (itrig == L1ParticleMap::kJet70_HTT200) {
0836       objectTypes.push_back(L1ParticleMap::kJet);
0837       objectTypes.push_back(L1ParticleMap::kEtHad);
0838 
0839       if (ht >= doubleThresholds_[itrig].second) {
0840         evaluateSingleObjectTrigger(inputJetRefs, doubleThresholds_[itrig].first, decision, outputJetRefsTmp);
0841 
0842         if (decision) {
0843           metRefTmp = L1EtMissParticleRefProd(mhtHandle);
0844         }
0845       }
0846     } else if (itrig == L1ParticleMap::kTauJet40_HTT200) {
0847       objectTypes.push_back(L1ParticleMap::kJet);
0848       objectTypes.push_back(L1ParticleMap::kEtHad);
0849 
0850       if (ht >= doubleThresholds_[itrig].second) {
0851         evaluateSingleObjectTrigger(inputTauRefs, doubleThresholds_[itrig].first, decision, outputJetRefsTmp);
0852 
0853         if (decision) {
0854           metRefTmp = L1EtMissParticleRefProd(mhtHandle);
0855         }
0856       }
0857     } else if (itrig == L1ParticleMap::kMu3_ETM30) {
0858       objectTypes.push_back(L1ParticleMap::kMuon);
0859       objectTypes.push_back(L1ParticleMap::kEtMiss);
0860 
0861       if (met >= doubleThresholds_[itrig].second) {
0862         evaluateSingleObjectTrigger(inputMuonRefsSingle, doubleThresholds_[itrig].first, decision, outputMuonRefsTmp);
0863 
0864         if (decision) {
0865           metRefTmp = L1EtMissParticleRefProd(metHandle);
0866         }
0867       }
0868     } else if (itrig == L1ParticleMap::kIsoEG10_ETM30) {
0869       objectTypes.push_back(L1ParticleMap::kEM);
0870       objectTypes.push_back(L1ParticleMap::kEtMiss);
0871 
0872       if (met >= doubleThresholds_[itrig].second) {
0873         evaluateSingleObjectTrigger(inputIsoEmRefs, doubleThresholds_[itrig].first, decision, outputEmRefsTmp);
0874 
0875         if (decision) {
0876           metRefTmp = L1EtMissParticleRefProd(metHandle);
0877         }
0878       }
0879     } else if (itrig == L1ParticleMap::kEG12_ETM30) {
0880       objectTypes.push_back(L1ParticleMap::kEM);
0881       objectTypes.push_back(L1ParticleMap::kEtMiss);
0882 
0883       if (met >= doubleThresholds_[itrig].second) {
0884         evaluateSingleObjectTrigger(inputRelaxedEmRefs, doubleThresholds_[itrig].first, decision, outputEmRefsTmp);
0885 
0886         if (decision) {
0887           metRefTmp = L1EtMissParticleRefProd(metHandle);
0888         }
0889       }
0890     } else if (itrig == L1ParticleMap::kJet70_ETM40) {
0891       objectTypes.push_back(L1ParticleMap::kJet);
0892       objectTypes.push_back(L1ParticleMap::kEtMiss);
0893 
0894       if (met >= doubleThresholds_[itrig].second) {
0895         evaluateSingleObjectTrigger(inputJetRefs, doubleThresholds_[itrig].first, decision, outputJetRefsTmp);
0896 
0897         if (decision) {
0898           metRefTmp = L1EtMissParticleRefProd(metHandle);
0899         }
0900       }
0901     } else if (itrig == L1ParticleMap::kTauJet20_ETM20 || itrig == L1ParticleMap::kTauJet30_ETM30 ||
0902                itrig == L1ParticleMap::kTauJet30_ETM40) {
0903       objectTypes.push_back(L1ParticleMap::kJet);
0904       objectTypes.push_back(L1ParticleMap::kEtMiss);
0905 
0906       if (met >= doubleThresholds_[itrig].second) {
0907         evaluateSingleObjectTrigger(inputTauRefs, doubleThresholds_[itrig].first, decision, outputJetRefsTmp);
0908 
0909         if (decision) {
0910           metRefTmp = L1EtMissParticleRefProd(metHandle);
0911         }
0912       }
0913     } else if (itrig == L1ParticleMap::kHTT100_ETM30) {
0914       objectTypes.push_back(L1ParticleMap::kEtHad);
0915       objectTypes.push_back(L1ParticleMap::kEtMiss);
0916 
0917       if (ht >= doubleThresholds_[itrig].first && met >= doubleThresholds_[itrig].second) {
0918         decision = true;
0919         metRefTmp = L1EtMissParticleRefProd(metHandle);
0920       }
0921     } else if (itrig == L1ParticleMap::kTripleMu3) {
0922       objectTypes.push_back(L1ParticleMap::kMuon);
0923       objectTypes.push_back(L1ParticleMap::kMuon);
0924       objectTypes.push_back(L1ParticleMap::kMuon);
0925 
0926       evaluateTripleSameObjectTrigger(
0927           inputMuonRefsDouble, singleThresholds_[itrig], decision, outputMuonRefsTmp, combosTmp);
0928     } else if (itrig == L1ParticleMap::kTripleIsoEG5) {
0929       objectTypes.push_back(L1ParticleMap::kEM);
0930       objectTypes.push_back(L1ParticleMap::kEM);
0931       objectTypes.push_back(L1ParticleMap::kEM);
0932 
0933       evaluateTripleSameObjectTrigger(inputIsoEmRefs, singleThresholds_[itrig], decision, outputEmRefsTmp, combosTmp);
0934     } else if (itrig == L1ParticleMap::kTripleEG10) {
0935       objectTypes.push_back(L1ParticleMap::kEM);
0936       objectTypes.push_back(L1ParticleMap::kEM);
0937       objectTypes.push_back(L1ParticleMap::kEM);
0938 
0939       evaluateTripleSameObjectTrigger(
0940           inputRelaxedEmRefs, singleThresholds_[itrig], decision, outputEmRefsTmp, combosTmp);
0941     } else if (itrig == L1ParticleMap::kTripleJet50) {
0942       objectTypes.push_back(L1ParticleMap::kJet);
0943       objectTypes.push_back(L1ParticleMap::kJet);
0944       objectTypes.push_back(L1ParticleMap::kJet);
0945 
0946       evaluateTripleSameObjectTrigger(inputJetRefs, singleThresholds_[itrig], decision, outputJetRefsTmp, combosTmp);
0947     } else if (itrig == L1ParticleMap::kTripleTauJet40) {
0948       objectTypes.push_back(L1ParticleMap::kJet);
0949       objectTypes.push_back(L1ParticleMap::kJet);
0950       objectTypes.push_back(L1ParticleMap::kJet);
0951 
0952       evaluateTripleSameObjectTrigger(inputTauRefs, singleThresholds_[itrig], decision, outputJetRefsTmp, combosTmp);
0953     } else if (itrig == L1ParticleMap::kDoubleMu3_IsoEG5) {
0954       objectTypes.push_back(L1ParticleMap::kMuon);
0955       objectTypes.push_back(L1ParticleMap::kMuon);
0956       objectTypes.push_back(L1ParticleMap::kEM);
0957 
0958       evaluateDoublePlusSingleObjectTrigger(inputMuonRefsDouble,
0959                                             inputIsoEmRefs,
0960                                             doubleThresholds_[itrig].first,
0961                                             doubleThresholds_[itrig].second,
0962                                             decision,
0963                                             outputMuonRefsTmp,
0964                                             outputEmRefsTmp,
0965                                             combosTmp);
0966     } else if (itrig == L1ParticleMap::kDoubleMu3_EG10) {
0967       objectTypes.push_back(L1ParticleMap::kMuon);
0968       objectTypes.push_back(L1ParticleMap::kMuon);
0969       objectTypes.push_back(L1ParticleMap::kEM);
0970 
0971       evaluateDoublePlusSingleObjectTrigger(inputMuonRefsDouble,
0972                                             inputRelaxedEmRefs,
0973                                             doubleThresholds_[itrig].first,
0974                                             doubleThresholds_[itrig].second,
0975                                             decision,
0976                                             outputMuonRefsTmp,
0977                                             outputEmRefsTmp,
0978                                             combosTmp);
0979     } else if (itrig == L1ParticleMap::kDoubleIsoEG5_Mu3) {
0980       objectTypes.push_back(L1ParticleMap::kEM);
0981       objectTypes.push_back(L1ParticleMap::kEM);
0982       objectTypes.push_back(L1ParticleMap::kMuon);
0983 
0984       evaluateDoublePlusSingleObjectTrigger(inputIsoEmRefs,
0985                                             inputMuonRefsSingle,
0986                                             doubleThresholds_[itrig].first,
0987                                             doubleThresholds_[itrig].second,
0988                                             decision,
0989                                             outputEmRefsTmp,
0990                                             outputMuonRefsTmp,
0991                                             combosTmp);
0992     } else if (itrig == L1ParticleMap::kDoubleEG10_Mu3) {
0993       objectTypes.push_back(L1ParticleMap::kEM);
0994       objectTypes.push_back(L1ParticleMap::kEM);
0995       objectTypes.push_back(L1ParticleMap::kMuon);
0996 
0997       evaluateDoublePlusSingleObjectTrigger(inputRelaxedEmRefs,
0998                                             inputMuonRefsSingle,
0999                                             doubleThresholds_[itrig].first,
1000                                             doubleThresholds_[itrig].second,
1001                                             decision,
1002                                             outputEmRefsTmp,
1003                                             outputMuonRefsTmp,
1004                                             combosTmp);
1005     } else if (itrig == L1ParticleMap::kDoubleMu3_HTT200) {
1006       objectTypes.push_back(L1ParticleMap::kMuon);
1007       objectTypes.push_back(L1ParticleMap::kMuon);
1008       objectTypes.push_back(L1ParticleMap::kEtHad);
1009 
1010       if (ht >= doubleThresholds_[itrig].second) {
1011         evaluateDoubleSameObjectTrigger(
1012             inputMuonRefsDouble, doubleThresholds_[itrig].first, decision, outputMuonRefsTmp, combosTmp, true);
1013 
1014         if (decision) {
1015           metRefTmp = L1EtMissParticleRefProd(mhtHandle);
1016         }
1017       }
1018     } else if (itrig == L1ParticleMap::kDoubleIsoEG5_HTT200) {
1019       objectTypes.push_back(L1ParticleMap::kEM);
1020       objectTypes.push_back(L1ParticleMap::kEM);
1021       objectTypes.push_back(L1ParticleMap::kEtHad);
1022 
1023       if (ht >= doubleThresholds_[itrig].second) {
1024         evaluateDoubleSameObjectTrigger(
1025             inputIsoEmRefs, doubleThresholds_[itrig].first, decision, outputEmRefsTmp, combosTmp, true);
1026 
1027         if (decision) {
1028           metRefTmp = L1EtMissParticleRefProd(mhtHandle);
1029         }
1030       }
1031     } else if (itrig == L1ParticleMap::kDoubleEG10_HTT200) {
1032       objectTypes.push_back(L1ParticleMap::kEM);
1033       objectTypes.push_back(L1ParticleMap::kEM);
1034       objectTypes.push_back(L1ParticleMap::kEtHad);
1035 
1036       if (ht >= doubleThresholds_[itrig].second) {
1037         evaluateDoubleSameObjectTrigger(
1038             inputRelaxedEmRefs, doubleThresholds_[itrig].first, decision, outputEmRefsTmp, combosTmp, true);
1039 
1040         if (decision) {
1041           metRefTmp = L1EtMissParticleRefProd(mhtHandle);
1042         }
1043       }
1044     } else if (itrig == L1ParticleMap::kDoubleJet50_HTT200) {
1045       objectTypes.push_back(L1ParticleMap::kJet);
1046       objectTypes.push_back(L1ParticleMap::kJet);
1047       objectTypes.push_back(L1ParticleMap::kEtHad);
1048 
1049       if (ht >= doubleThresholds_[itrig].second) {
1050         evaluateDoubleSameObjectTrigger(
1051             inputJetRefs, doubleThresholds_[itrig].first, decision, outputJetRefsTmp, combosTmp, true);
1052 
1053         if (decision) {
1054           metRefTmp = L1EtMissParticleRefProd(mhtHandle);
1055         }
1056       }
1057     } else if (itrig == L1ParticleMap::kDoubleTauJet40_HTT200) {
1058       objectTypes.push_back(L1ParticleMap::kJet);
1059       objectTypes.push_back(L1ParticleMap::kJet);
1060       objectTypes.push_back(L1ParticleMap::kEtHad);
1061 
1062       if (ht >= doubleThresholds_[itrig].second) {
1063         evaluateDoubleSameObjectTrigger(
1064             inputTauRefs, doubleThresholds_[itrig].first, decision, outputJetRefsTmp, combosTmp, true);
1065 
1066         if (decision) {
1067           metRefTmp = L1EtMissParticleRefProd(mhtHandle);
1068         }
1069       }
1070     } else if (itrig == L1ParticleMap::kDoubleMu3_ETM20) {
1071       objectTypes.push_back(L1ParticleMap::kMuon);
1072       objectTypes.push_back(L1ParticleMap::kMuon);
1073       objectTypes.push_back(L1ParticleMap::kEtMiss);
1074 
1075       if (met >= doubleThresholds_[itrig].second) {
1076         evaluateDoubleSameObjectTrigger(
1077             inputMuonRefsDouble, doubleThresholds_[itrig].first, decision, outputMuonRefsTmp, combosTmp, true);
1078 
1079         if (decision) {
1080           metRefTmp = L1EtMissParticleRefProd(metHandle);
1081         }
1082       }
1083     } else if (itrig == L1ParticleMap::kDoubleIsoEG5_ETM20) {
1084       objectTypes.push_back(L1ParticleMap::kEM);
1085       objectTypes.push_back(L1ParticleMap::kEM);
1086       objectTypes.push_back(L1ParticleMap::kEtMiss);
1087 
1088       if (met >= doubleThresholds_[itrig].second) {
1089         evaluateDoubleSameObjectTrigger(
1090             inputIsoEmRefs, doubleThresholds_[itrig].first, decision, outputEmRefsTmp, combosTmp, true);
1091 
1092         if (decision) {
1093           metRefTmp = L1EtMissParticleRefProd(metHandle);
1094         }
1095       }
1096     } else if (itrig == L1ParticleMap::kDoubleEG10_ETM20) {
1097       objectTypes.push_back(L1ParticleMap::kEM);
1098       objectTypes.push_back(L1ParticleMap::kEM);
1099       objectTypes.push_back(L1ParticleMap::kEtMiss);
1100 
1101       if (met >= doubleThresholds_[itrig].second) {
1102         evaluateDoubleSameObjectTrigger(
1103             inputRelaxedEmRefs, doubleThresholds_[itrig].first, decision, outputEmRefsTmp, combosTmp, true);
1104 
1105         if (decision) {
1106           metRefTmp = L1EtMissParticleRefProd(metHandle);
1107         }
1108       }
1109     } else if (itrig == L1ParticleMap::kDoubleJet50_ETM20) {
1110       objectTypes.push_back(L1ParticleMap::kJet);
1111       objectTypes.push_back(L1ParticleMap::kJet);
1112       objectTypes.push_back(L1ParticleMap::kEtMiss);
1113 
1114       if (met >= doubleThresholds_[itrig].second) {
1115         evaluateDoubleSameObjectTrigger(
1116             inputJetRefs, doubleThresholds_[itrig].first, decision, outputJetRefsTmp, combosTmp, true);
1117 
1118         if (decision) {
1119           metRefTmp = L1EtMissParticleRefProd(metHandle);
1120         }
1121       }
1122     } else if (itrig == L1ParticleMap::kDoubleTauJet40_ETM20) {
1123       objectTypes.push_back(L1ParticleMap::kJet);
1124       objectTypes.push_back(L1ParticleMap::kJet);
1125       objectTypes.push_back(L1ParticleMap::kEtMiss);
1126 
1127       if (met >= doubleThresholds_[itrig].second) {
1128         evaluateDoubleSameObjectTrigger(
1129             inputTauRefs, doubleThresholds_[itrig].first, decision, outputJetRefsTmp, combosTmp, true);
1130 
1131         if (decision) {
1132           metRefTmp = L1EtMissParticleRefProd(metHandle);
1133         }
1134       }
1135     } else if (itrig == L1ParticleMap::kQuadJet30) {
1136       objectTypes.push_back(L1ParticleMap::kJet);
1137       objectTypes.push_back(L1ParticleMap::kJet);
1138       objectTypes.push_back(L1ParticleMap::kJet);
1139       objectTypes.push_back(L1ParticleMap::kJet);
1140 
1141       evaluateQuadSameObjectTrigger(inputJetRefs, singleThresholds_[itrig], decision, outputJetRefsTmp, combosTmp);
1142     } else if (itrig == L1ParticleMap::kExclusiveDoubleIsoEG4) {
1143       objectTypes.push_back(L1ParticleMap::kEM);
1144       objectTypes.push_back(L1ParticleMap::kEM);
1145 
1146       evaluateDoubleExclusiveIsoEG(inputIsoEmRefs,
1147                                    inputJetRefs,
1148                                    doubleThresholds_[itrig].first,
1149                                    doubleThresholds_[itrig].second,
1150                                    decision,
1151                                    outputEmRefsTmp,
1152                                    combosTmp);
1153 
1154     } else if (itrig == L1ParticleMap::kExclusiveDoubleJet60) {
1155       objectTypes.push_back(L1ParticleMap::kJet);
1156       objectTypes.push_back(L1ParticleMap::kJet);
1157 
1158       if (inputJetRefs.size() == 2) {
1159         evaluateDoubleSameObjectTrigger(inputJetRefs, singleThresholds_[itrig], decision, outputJetRefsTmp, combosTmp);
1160       }
1161     } else if (itrig == L1ParticleMap::kExclusiveJet25_Gap_Jet25) {
1162       objectTypes.push_back(L1ParticleMap::kJet);
1163       objectTypes.push_back(L1ParticleMap::kJet);
1164 
1165       if (inputJetRefs.size() == 2) {
1166         evaluateJetGapJetTrigger(inputForJetRefs, singleThresholds_[itrig], decision, outputJetRefsTmp, combosTmp);
1167       }
1168     } else if (itrig == L1ParticleMap::kIsoEG10_Jet20_ForJet10) {
1169       objectTypes.push_back(L1ParticleMap::kEM);
1170       objectTypes.push_back(L1ParticleMap::kJet);
1171 
1172       evaluateForwardRapidityGap(inputForJetRefs, singleThresholds_[itrig], decision);
1173 
1174       if (decision) {
1175         decision = false;
1176         evaluateDoubleDifferentCaloObjectTrigger(inputIsoEmRefs,
1177                                                  inputCenJetTauJetRefs,
1178                                                  doubleThresholds_[itrig].first,
1179                                                  doubleThresholds_[itrig].second,
1180                                                  decision,
1181                                                  outputEmRefsTmp,
1182                                                  outputJetRefsTmp,
1183                                                  combosTmp);
1184       }
1185     } else if (itrig == L1ParticleMap::kMinBias_HTT10) {
1186       objectTypes.push_back(L1ParticleMap::kEtHad);
1187 
1188       if (ht >= 10.) {
1189         decision = true;
1190         metRefTmp = L1EtMissParticleRefProd(mhtHandle);
1191       }
1192     } else if (itrig == L1ParticleMap::kZeroBias) {
1193       decision = true;
1194     }
1195 
1196     L1EmParticleVectorRef outputEmRefs;
1197     L1JetParticleVectorRef outputJetRefs;
1198     L1MuonParticleVectorRef outputMuonRefs;
1199     L1EtMissParticleRefProd metRef;
1200     L1ParticleMap::L1IndexComboVector combos;  // unfilled for single objs
1201 
1202     if (decision) {
1203       //     if( prescaleCounters_[ itrig ] % prescales_[ itrig ] )
1204 
1205       double rand = CLHEP::RandFlat::shoot() * (double)prescales_[itrig];
1206       if (rand > 1.) {
1207         decision = false;
1208       } else {
1209         outputEmRefs = outputEmRefsTmp;
1210         outputJetRefs = outputJetRefsTmp;
1211         outputMuonRefs = outputMuonRefsTmp;
1212         metRef = metRefTmp;
1213         combos = combosTmp;
1214       }
1215 
1216       ++prescaleCounters_[itrig];
1217     }
1218 
1219     // Construct a L1ParticleMap and add it to the collection.
1220     mapColl->push_back(L1ParticleMap((L1ParticleMap::L1TriggerType)itrig,
1221                                      decision,
1222                                      objectTypes,
1223                                      outputEmRefs,
1224                                      outputJetRefs,
1225                                      outputMuonRefs,
1226                                      metRef,
1227                                      combos));
1228 
1229     globalDecision = globalDecision || decision;
1230     decisionWord.push_back(decision);
1231   }
1232 
1233   // Put the L1ParticleMapCollection into the event.
1234   iEvent.put(std::move(mapColl));
1235 
1236   // Make a L1GlobalTriggerReadoutRecord and put it into the event.
1237   unique_ptr<L1GlobalTriggerReadoutRecord> gtRecord(new L1GlobalTriggerReadoutRecord());
1238   gtRecord->setDecision(globalDecision);
1239   gtRecord->setDecisionWord(decisionWord);
1240   iEvent.put(std::move(gtRecord));
1241 
1242   return;
1243 }
1244 
1245 template <class TCollection>
1246 void L1ExtraParticleMapProd::addToVectorRefs(const edm::Handle<TCollection> &handle,          // input
1247                                              std::vector<edm::Ref<TCollection>> &vectorRefs)  // output
1248 {
1249   for (size_t i = 0; i < handle->size(); ++i) {
1250     vectorRefs.push_back(edm::Ref<TCollection>(handle, i));
1251   }
1252 }
1253 
1254 template <class TCollection>
1255 void L1ExtraParticleMapProd::evaluateSingleObjectTrigger(const std::vector<edm::Ref<TCollection>> &inputRefs,  // input
1256                                                          const double &etThreshold,                            // input
1257                                                          bool &decision,                                       // output
1258                                                          std::vector<edm::Ref<TCollection>> &outputRefs)       // output
1259 {
1260   for (size_t i = 0; i < inputRefs.size(); ++i) {
1261     if (inputRefs[i].get()->et() >= etThreshold) {
1262       decision = true;
1263       outputRefs.push_back(inputRefs[i]);
1264     }
1265   }
1266 }
1267 
1268 template <class TCollection>
1269 void L1ExtraParticleMapProd::evaluateDoubleSameObjectTrigger(
1270     const std::vector<edm::Ref<TCollection>> &inputRefs,  // input
1271     const double &etThreshold,                            // input
1272     bool &decision,                                       // output
1273     std::vector<edm::Ref<TCollection>> &outputRefs,       // output
1274     l1extra::L1ParticleMap::L1IndexComboVector &combos,   // output
1275     bool combinedWithGlobalObject)                        // input
1276 {
1277   // Use i+1 < inputRefs.size() instead of i < inputRefs.size()-1
1278   // because i is unsigned, and if size() is 0, then RHS undefined.
1279   for (size_t i = 0; i + 1 < inputRefs.size(); ++i) {
1280     const edm::Ref<TCollection> &refi = inputRefs[i];
1281     if (refi.get()->et() >= etThreshold) {
1282       for (size_t j = i + 1; j < inputRefs.size(); ++j) {
1283         const edm::Ref<TCollection> &refj = inputRefs[j];
1284         if (refj.get()->et() >= etThreshold) {
1285           decision = true;
1286 
1287           // If the two objects are already in the list, find
1288           // their indices.
1289           int iInList = kDefault;
1290           int jInList = kDefault;
1291           for (size_t iout = 0; iout < outputRefs.size(); ++iout) {
1292             if (refi == outputRefs[iout]) {
1293               iInList = iout;
1294             }
1295 
1296             if (refj == outputRefs[iout]) {
1297               jInList = iout;
1298             }
1299           }
1300 
1301           // If either object is not in the list, add it, and
1302           // record its index.
1303           if (iInList == kDefault) {
1304             iInList = outputRefs.size();
1305             outputRefs.push_back(refi);
1306           }
1307 
1308           if (jInList == kDefault) {
1309             jInList = outputRefs.size();
1310             outputRefs.push_back(refj);
1311           }
1312 
1313           // Record this object combination.
1314           l1extra::L1ParticleMap::L1IndexCombo combo;
1315           combo.push_back(iInList);
1316           combo.push_back(jInList);
1317           if (combinedWithGlobalObject)
1318             combo.push_back(0);
1319           combos.push_back(combo);
1320         }
1321       }
1322     }
1323   }
1324 }
1325 
1326 template <class TCollection>
1327 void L1ExtraParticleMapProd::evaluateTripleSameObjectTrigger(
1328     const std::vector<edm::Ref<TCollection>> &inputRefs,  // input
1329     const double &etThreshold,                            // input
1330     bool &decision,                                       // output
1331     std::vector<edm::Ref<TCollection>> &outputRefs,       // output
1332     l1extra::L1ParticleMap::L1IndexComboVector &combos)   // output
1333 {
1334   // Use i+2 < inputRefs.size() instead of i < inputRefs.size()-2
1335   // because i is unsigned, and if size() is 0, then RHS undefined.
1336   for (size_t i = 0; i + 2 < inputRefs.size(); ++i) {
1337     const edm::Ref<TCollection> &refi = inputRefs[i];
1338     if (refi.get()->et() >= etThreshold) {
1339       for (size_t j = i + 1; j + 1 < inputRefs.size(); ++j) {
1340         const edm::Ref<TCollection> &refj = inputRefs[j];
1341         if (refj.get()->et() >= etThreshold) {
1342           for (size_t k = j + 1; k < inputRefs.size(); ++k) {
1343             const edm::Ref<TCollection> &refk = inputRefs[k];
1344             if (refk.get()->et() >= etThreshold) {
1345               decision = true;
1346 
1347               // If the three objects are already in the list, find
1348               // their indices.
1349               int iInList = kDefault;
1350               int jInList = kDefault;
1351               int kInList = kDefault;
1352               for (size_t iout = 0; iout < outputRefs.size(); ++iout) {
1353                 if (refi == outputRefs[iout]) {
1354                   iInList = iout;
1355                 }
1356 
1357                 if (refj == outputRefs[iout]) {
1358                   jInList = iout;
1359                 }
1360 
1361                 if (refk == outputRefs[iout]) {
1362                   kInList = iout;
1363                 }
1364               }
1365 
1366               // If any object is not in the list, add it, and
1367               // record its index.
1368               if (iInList == kDefault) {
1369                 iInList = outputRefs.size();
1370                 outputRefs.push_back(refi);
1371               }
1372 
1373               if (jInList == kDefault) {
1374                 jInList = outputRefs.size();
1375                 outputRefs.push_back(refj);
1376               }
1377 
1378               if (kInList == kDefault) {
1379                 kInList = outputRefs.size();
1380                 outputRefs.push_back(refk);
1381               }
1382 
1383               // Record this object combination.
1384               l1extra::L1ParticleMap::L1IndexCombo combo;
1385               combo.push_back(iInList);
1386               combo.push_back(jInList);
1387               combo.push_back(kInList);
1388               combos.push_back(combo);
1389             }
1390           }
1391         }
1392       }
1393     }
1394   }
1395 }
1396 
1397 template <class TCollection1, class TCollection2>
1398 void L1ExtraParticleMapProd::evaluateDoublePlusSingleObjectTrigger(
1399     const std::vector<edm::Ref<TCollection1>> &inputRefs1,  // input
1400     const std::vector<edm::Ref<TCollection2>> &inputRefs2,  // input
1401     const double &etThreshold1,                             // input
1402     const double &etThreshold2,                             // input
1403     bool &decision,                                         // output
1404     std::vector<edm::Ref<TCollection1>> &outputRefs1,       // output
1405     std::vector<edm::Ref<TCollection2>> &outputRefs2,       // output
1406     l1extra::L1ParticleMap::L1IndexComboVector &combos)     // output
1407 {
1408   // Use i+1 < inputRefs.size() instead of i < inputRefs.size()-1
1409   // because i is unsigned, and if size() is 0, then RHS undefined.
1410   for (size_t i = 0; i + 1 < inputRefs1.size(); ++i) {
1411     const edm::Ref<TCollection1> &refi = inputRefs1[i];
1412     if (refi.get()->et() >= etThreshold1) {
1413       for (size_t j = i + 1; j < inputRefs1.size(); ++j) {
1414         const edm::Ref<TCollection1> &refj = inputRefs1[j];
1415         if (refj.get()->et() >= etThreshold1) {
1416           for (size_t k = 0; k < inputRefs2.size(); ++k) {
1417             const edm::Ref<TCollection2> &refk = inputRefs2[k];
1418             if (refk.get()->et() >= etThreshold2) {
1419               decision = true;
1420 
1421               // If the three objects are already in the list, find
1422               // their indices.
1423               int iInList = kDefault;
1424               int jInList = kDefault;
1425 
1426               for (size_t iout = 0; iout < outputRefs1.size(); ++iout) {
1427                 if (refi == outputRefs1[iout]) {
1428                   iInList = iout;
1429                 }
1430 
1431                 if (refj == outputRefs1[iout]) {
1432                   jInList = iout;
1433                 }
1434               }
1435 
1436               int kInList = kDefault;
1437               for (size_t kout = 0; kout < outputRefs2.size(); ++kout) {
1438                 if (refk == outputRefs2[kout]) {
1439                   kInList = kout;
1440                 }
1441               }
1442 
1443               // If any object is not in the list, add it, and
1444               // record its index.
1445               if (iInList == kDefault) {
1446                 iInList = outputRefs1.size();
1447                 outputRefs1.push_back(refi);
1448               }
1449 
1450               if (jInList == kDefault) {
1451                 jInList = outputRefs1.size();
1452                 outputRefs1.push_back(refj);
1453               }
1454 
1455               if (kInList == kDefault) {
1456                 kInList = outputRefs2.size();
1457                 outputRefs2.push_back(refk);
1458               }
1459 
1460               // Record this object combination.
1461               l1extra::L1ParticleMap::L1IndexCombo combo;
1462               combo.push_back(iInList);
1463               combo.push_back(jInList);
1464               combo.push_back(kInList);
1465               combos.push_back(combo);
1466             }
1467           }
1468         }
1469       }
1470     }
1471   }
1472 }
1473 
1474 template <class TCollection>
1475 void L1ExtraParticleMapProd::evaluateQuadSameObjectTrigger(
1476     const std::vector<edm::Ref<TCollection>> &inputRefs,  // input
1477     const double &etThreshold,                            // input
1478     bool &decision,                                       // output
1479     std::vector<edm::Ref<TCollection>> &outputRefs,       // output
1480     l1extra::L1ParticleMap::L1IndexComboVector &combos)   // output
1481 {
1482   // Use i+3 < inputRefs.size() instead of i < inputRefs.size()-3
1483   // because i is unsigned, and if size() is 0, then RHS undefined.
1484   for (size_t i = 0; i + 3 < inputRefs.size(); ++i) {
1485     const edm::Ref<TCollection> &refi = inputRefs[i];
1486     if (refi.get()->et() >= etThreshold) {
1487       for (size_t j = i + 1; j + 2 < inputRefs.size(); ++j) {
1488         const edm::Ref<TCollection> &refj = inputRefs[j];
1489         if (refj.get()->et() >= etThreshold) {
1490           for (size_t k = j + 1; k + 1 < inputRefs.size(); ++k) {
1491             const edm::Ref<TCollection> &refk = inputRefs[k];
1492             if (refk.get()->et() >= etThreshold) {
1493               for (size_t p = k + 1; p < inputRefs.size(); ++p) {
1494                 const edm::Ref<TCollection> &refp = inputRefs[p];
1495                 if (refp.get()->et() >= etThreshold) {
1496                   decision = true;
1497 
1498                   // If the objects are already in the list, find
1499                   // their indices.
1500                   int iInList = kDefault;
1501                   int jInList = kDefault;
1502                   int kInList = kDefault;
1503                   int pInList = kDefault;
1504                   for (size_t iout = 0; iout < outputRefs.size(); ++iout) {
1505                     if (refi == outputRefs[iout]) {
1506                       iInList = iout;
1507                     }
1508 
1509                     if (refj == outputRefs[iout]) {
1510                       jInList = iout;
1511                     }
1512 
1513                     if (refk == outputRefs[iout]) {
1514                       kInList = iout;
1515                     }
1516 
1517                     if (refp == outputRefs[iout]) {
1518                       pInList = iout;
1519                     }
1520                   }
1521 
1522                   // If any object is not in the list, add it, and
1523                   // record its index.
1524                   if (iInList == kDefault) {
1525                     iInList = outputRefs.size();
1526                     outputRefs.push_back(refi);
1527                   }
1528 
1529                   if (jInList == kDefault) {
1530                     jInList = outputRefs.size();
1531                     outputRefs.push_back(refj);
1532                   }
1533 
1534                   if (kInList == kDefault) {
1535                     kInList = outputRefs.size();
1536                     outputRefs.push_back(refk);
1537                   }
1538 
1539                   if (pInList == kDefault) {
1540                     pInList = outputRefs.size();
1541                     outputRefs.push_back(refp);
1542                   }
1543 
1544                   // Record this object combination.
1545                   l1extra::L1ParticleMap::L1IndexCombo combo;
1546                   combo.push_back(iInList);
1547                   combo.push_back(jInList);
1548                   combo.push_back(kInList);
1549                   combo.push_back(pInList);
1550                   combos.push_back(combo);
1551                 }
1552               }
1553             }
1554           }
1555         }
1556       }
1557     }
1558   }
1559 }
1560 
1561 template <class TCollection1, class TCollection2>
1562 void L1ExtraParticleMapProd::evaluateDoubleDifferentObjectTrigger(
1563     const std::vector<edm::Ref<TCollection1>> &inputRefs1,  // input
1564     const std::vector<edm::Ref<TCollection2>> &inputRefs2,  // input
1565     const double &etThreshold1,                             // input
1566     const double &etThreshold2,                             // input
1567     bool &decision,                                         // output
1568     std::vector<edm::Ref<TCollection1>> &outputRefs1,       // output
1569     std::vector<edm::Ref<TCollection2>> &outputRefs2,       // output
1570     l1extra::L1ParticleMap::L1IndexComboVector &combos)     // output
1571 {
1572   for (size_t i = 0; i < inputRefs1.size(); ++i) {
1573     const edm::Ref<TCollection1> &refi = inputRefs1[i];
1574     if (refi.get()->et() >= etThreshold1) {
1575       for (size_t j = 0; j < inputRefs2.size(); ++j) {
1576         const edm::Ref<TCollection2> &refj = inputRefs2[j];
1577 
1578         if (refj.get()->et() >= etThreshold2) {
1579           decision = true;
1580 
1581           // If the two objects are already in their respective lists,
1582           // find their indices.
1583           int iInList = kDefault;
1584           for (size_t iout = 0; iout < outputRefs1.size(); ++iout) {
1585             if (refi == outputRefs1[iout]) {
1586               iInList = iout;
1587             }
1588           }
1589 
1590           int jInList = kDefault;
1591           for (size_t jout = 0; jout < outputRefs2.size(); ++jout) {
1592             if (refj == outputRefs2[jout]) {
1593               jInList = jout;
1594             }
1595           }
1596 
1597           // If either object is not in the list, add it, and
1598           // record its index.
1599           if (iInList == kDefault) {
1600             iInList = outputRefs1.size();
1601             outputRefs1.push_back(refi);
1602           }
1603 
1604           if (jInList == kDefault) {
1605             jInList = outputRefs2.size();
1606             outputRefs2.push_back(refj);
1607           }
1608 
1609           // Record this object combination.
1610           l1extra::L1ParticleMap::L1IndexCombo combo;
1611           combo.push_back(iInList);
1612           combo.push_back(jInList);
1613           combos.push_back(combo);
1614         }
1615       }
1616     }
1617   }
1618 }
1619 
1620 template <class TCollection>
1621 void L1ExtraParticleMapProd::evaluateDoubleDifferentObjectSameTypeTrigger(
1622     const std::vector<edm::Ref<TCollection>> &inputRefs1,  // input
1623     const std::vector<edm::Ref<TCollection>> &inputRefs2,  // input
1624     const double &etThreshold1,                            // input
1625     const double &etThreshold2,                            // input
1626     bool &decision,                                        // output
1627     std::vector<edm::Ref<TCollection>> &outputRefs,        // output
1628     l1extra::L1ParticleMap::L1IndexComboVector &combos)    // output
1629 {
1630   for (size_t i = 0; i < inputRefs1.size(); ++i) {
1631     const edm::Ref<TCollection> &refi = inputRefs1[i];
1632     if (refi.get()->et() >= etThreshold1) {
1633       for (size_t j = 0; j < inputRefs2.size(); ++j) {
1634         const edm::Ref<TCollection> &refj = inputRefs2[j];
1635 
1636         if (refj.get()->et() >= etThreshold2 && refi != refj) {
1637           decision = true;
1638 
1639           // If the two objects are already in their respective lists,
1640           // find their indices.
1641           int iInList = kDefault;
1642           for (size_t iout = 0; iout < outputRefs.size(); ++iout) {
1643             if (refi == outputRefs[iout]) {
1644               iInList = iout;
1645             }
1646           }
1647 
1648           int jInList = kDefault;
1649           for (size_t jout = 0; jout < outputRefs.size(); ++jout) {
1650             if (refj == outputRefs[jout]) {
1651               jInList = jout;
1652             }
1653           }
1654 
1655           // If either object is not in the list, add it, and
1656           // record its index.
1657           if (iInList == kDefault) {
1658             iInList = outputRefs.size();
1659             outputRefs.push_back(refi);
1660           }
1661 
1662           if (jInList == kDefault) {
1663             jInList = outputRefs.size();
1664             outputRefs.push_back(refj);
1665           }
1666 
1667           // Record this object combination.
1668           l1extra::L1ParticleMap::L1IndexCombo combo;
1669           combo.push_back(iInList);
1670           combo.push_back(jInList);
1671           combos.push_back(combo);
1672         }
1673       }
1674     }
1675   }
1676 }
1677 
1678 void L1ExtraParticleMapProd::evaluateDoubleDifferentCaloObjectTrigger(
1679     const l1extra::L1EmParticleVectorRef &inputRefs1,    // input
1680     const l1extra::L1JetParticleVectorRef &inputRefs2,   // input
1681     const double &etThreshold1,                          // input
1682     const double &etThreshold2,                          // input
1683     bool &decision,                                      // output
1684     l1extra::L1EmParticleVectorRef &outputRefs1,         // output
1685     l1extra::L1JetParticleVectorRef &outputRefs2,        // output
1686     l1extra::L1ParticleMap::L1IndexComboVector &combos)  // output
1687 {
1688   for (size_t i = 0; i < inputRefs1.size(); ++i) {
1689     const l1extra::L1EmParticleRef &refi = inputRefs1[i];
1690     if (refi.get()->et() >= etThreshold1) {
1691       for (size_t j = 0; j < inputRefs2.size(); ++j) {
1692         const l1extra::L1JetParticleRef &refj = inputRefs2[j];
1693 
1694         // Check for identical region only if both HW objects are non-null.
1695         if (refj.get()->et() >= etThreshold2 &&
1696             (refi.get()->gctEmCand() == nullptr || refj.get()->gctJetCand() == nullptr ||
1697              refi.get()->gctEmCand()->regionId() != refj.get()->gctJetCand()->regionId())) {
1698           decision = true;
1699 
1700           // If the two objects are already in their respective lists,
1701           // find their indices.
1702           int iInList = kDefault;
1703           for (size_t iout = 0; iout < outputRefs1.size(); ++iout) {
1704             if (refi == outputRefs1[iout]) {
1705               iInList = iout;
1706             }
1707           }
1708 
1709           int jInList = kDefault;
1710           for (size_t jout = 0; jout < outputRefs2.size(); ++jout) {
1711             if (refj == outputRefs2[jout]) {
1712               jInList = jout;
1713             }
1714           }
1715 
1716           // If either object is not in the list, add it, and
1717           // record its index.
1718           if (iInList == kDefault) {
1719             iInList = outputRefs1.size();
1720             outputRefs1.push_back(refi);
1721           }
1722 
1723           if (jInList == kDefault) {
1724             jInList = outputRefs2.size();
1725             outputRefs2.push_back(refj);
1726           }
1727 
1728           // Record this object combination.
1729           l1extra::L1ParticleMap::L1IndexCombo combo;
1730           combo.push_back(iInList);
1731           combo.push_back(jInList);
1732           combos.push_back(combo);
1733         }
1734       }
1735     }
1736   }
1737 }
1738 
1739 // ok if both objects are above the threshold and are in opposite hemispheres
1740 void L1ExtraParticleMapProd::evaluateJetGapJetTrigger(const l1extra::L1JetParticleVectorRef &inputRefs,    // input
1741                                                       const double &etThreshold,                           // input
1742                                                       bool &decision,                                      // output
1743                                                       l1extra::L1JetParticleVectorRef &outputRefs,         // output
1744                                                       l1extra::L1ParticleMap::L1IndexComboVector &combos)  // output
1745 {
1746   // Use i+1 < inputRefs.size() instead of i < inputRefs.size()-1
1747   // because i is unsigned, and if size() is 0, then RHS undefined.
1748   for (size_t i = 0; i + 1 < inputRefs.size(); ++i) {
1749     const l1extra::L1JetParticleRef &refi = inputRefs[i];
1750     if (refi.get()->et() >= etThreshold) {
1751       for (size_t j = i + 1; j < inputRefs.size(); ++j) {
1752         const l1extra::L1JetParticleRef &refj = inputRefs[j];
1753         if ((refj.get()->et() >= etThreshold) && (((refi.get()->eta() < 0.) && (refj.get()->eta() > 0.)) ||
1754                                                   ((refi.get()->eta() > 0.) && (refj.get()->eta() < 0.)))) {
1755           decision = true;
1756 
1757           // If the two objects are already in the list, find
1758           // their indices.
1759           int iInList = kDefault;
1760           int jInList = kDefault;
1761           for (size_t iout = 0; iout < outputRefs.size(); ++iout) {
1762             if (refi == outputRefs[iout]) {
1763               iInList = iout;
1764             }
1765 
1766             if (refj == outputRefs[iout]) {
1767               jInList = iout;
1768             }
1769           }
1770 
1771           // If either object is not in the list, add it, and
1772           // record its index.
1773           if (iInList == kDefault) {
1774             iInList = outputRefs.size();
1775             outputRefs.push_back(refi);
1776           }
1777 
1778           if (jInList == kDefault) {
1779             jInList = outputRefs.size();
1780             outputRefs.push_back(refj);
1781           }
1782 
1783           // Record this object combination.
1784           l1extra::L1ParticleMap::L1IndexCombo combo;
1785           combo.push_back(iInList);
1786           combo.push_back(jInList);
1787           combos.push_back(combo);
1788         }
1789       }
1790     }
1791   }
1792 }
1793 
1794 // veto if both forward regions see some jet with e_T > threshold
1795 void L1ExtraParticleMapProd::evaluateForwardRapidityGap(const l1extra::L1JetParticleVectorRef &inputRefs,  // input
1796                                                         const double &etThreshold,                         // input
1797                                                         bool &decision                                     // output
1798 ) {
1799   decision = true;
1800 
1801   // search for forward pair
1802   for (size_t k = 0; k + 1 < inputRefs.size(); ++k) {
1803     const l1extra::L1JetParticleRef &refk = inputRefs[k];
1804     double etak = refk.get()->eta();
1805     if ((refk.get()->type() == l1extra::L1JetParticle::kForward) && (refk.get()->et() >= etThreshold)) {
1806       for (size_t l = k + 1; l < inputRefs.size(); ++l) {
1807         const l1extra::L1JetParticleRef &refl = inputRefs[l];
1808         double etal = refl.get()->eta();
1809         if ((refl.get()->type() == l1extra::L1JetParticle::kForward) && (refl.get()->et() >= etThreshold) &&
1810             ((etak > 0 && etal < 0) || (etak < 0 && etal > 0))) {
1811           decision = false;
1812           return;  // no need for going further -- for a faster algorithm
1813         }
1814       }
1815     }
1816   }
1817 }
1818 
1819 void L1ExtraParticleMapProd::evaluateDoubleExclusiveIsoEG(const l1extra::L1EmParticleVectorRef &inputRefs1,    // input
1820                                                           const l1extra::L1JetParticleVectorRef &inputRefs2,   // input
1821                                                           const double &etThreshold1,                          // input
1822                                                           const double &etThreshold2,                          // input
1823                                                           bool &decision,                                      // output
1824                                                           l1extra::L1EmParticleVectorRef &outputRefs1,         // output
1825                                                           l1extra::L1ParticleMap::L1IndexComboVector &combos)  // output
1826 {
1827   if (inputRefs1.size() == 2) {  // 2 iso EG
1828     decision = true;
1829     if (!inputRefs2.empty()) {  // should veto if there are jets, with pt>thresh
1830       for (size_t j = 0; j < inputRefs2.size(); ++j) {
1831         if (inputRefs2[j].get()->gctJetCand()->regionId() == inputRefs1[0].get()->gctEmCand()->regionId())
1832           continue;
1833         if (inputRefs2[j].get()->gctJetCand()->regionId() == inputRefs1[1].get()->gctEmCand()->regionId())
1834           continue;
1835         if (inputRefs2[j].get()->et() > etThreshold2) {
1836           decision = false;
1837           break;
1838         }
1839         // break : for a faster algorithm
1840       }
1841     }
1842     if (decision) {  // threshold evaluation for the Exclusive double isoEG
1843       decision = false;
1844       evaluateDoubleSameObjectTrigger(inputRefs1, etThreshold1, decision, outputRefs1, combos);
1845     }
1846   }
1847 }
1848 
1849 // define this as a plug-in
1850 // DEFINE_FWK_MODULE(L1ExtraParticleMapProd);