Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:20:12

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