Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 
0002 // StableParametersTrivialProducer
0003 
0004 #include <memory>
0005 #include <vector>
0006 
0007 #include "FWCore/Framework/interface/ESProducer.h"
0008 #include "FWCore/Framework/interface/ModuleFactory.h"
0009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0010 #include "FWCore/MessageLogger/interface/MessageDrop.h"
0011 
0012 #include "CondFormats/L1TObjects/interface/L1TGlobalParameters.h"
0013 #include "CondFormats/DataRecord/interface/L1TGlobalParametersRcd.h"
0014 
0015 #include "L1Trigger/L1TGlobal/interface/GlobalParamsHelper.h"
0016 
0017 // class declaration
0018 class StableParametersTrivialProducer : public edm::ESProducer {
0019 public:
0020   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0021 
0022   /// constructor
0023   StableParametersTrivialProducer(const edm::ParameterSet&);
0024 
0025   /// destructor
0026   ~StableParametersTrivialProducer() override;
0027 
0028   /// public methods
0029 
0030   /// L1 GT parameters
0031   std::unique_ptr<L1TGlobalParameters> produceGtStableParameters(const L1TGlobalParametersRcd&);
0032 
0033 private:
0034   l1t::GlobalParamsHelper data_;
0035 };
0036 
0037 using namespace std;
0038 using namespace edm;
0039 using namespace l1t;
0040 
0041 void StableParametersTrivialProducer::fillDescriptions(ConfigurationDescriptions& descriptions) {
0042   ParameterSetDescription desc;
0043 
0044   // TotalBxInEvent = cms.int32(5),
0045   desc.add<int>("TotalBxInEvent", 5)->setComment("stage2");
0046 
0047   //NumberPhysTriggers = cms.uint32(512)
0048   desc.add<unsigned int>("NumberPhysTriggers", 512)->setComment("Number of physics trigger algorithms");
0049 
0050   //NumberL1Muon = cms.uint32(12)
0051   desc.add<unsigned int>("NumberL1Muon", 12)->setComment("Number of L2 Muons");
0052 
0053   //NumberL1EGamma = cms.uint32(12),
0054   desc.add<unsigned int>("NumberL1EGamma", 12)->setComment("Number of L1 e/gamma objects");
0055 
0056   //NumberL1Jet = cms.uint32(12),
0057   desc.add<unsigned int>("NumberL1Jet", 12)->setComment("Number of L1 jets");
0058 
0059   //NumberL1Tau = cms.uint32(8),
0060   desc.add<unsigned int>("NumberL1Tau", 8)->setComment("Number of L1 taus");
0061 
0062   //NumberChips = cms.uint32(1),
0063   desc.add<unsigned int>("NumberChips", 5)->setComment("Number of chips in Menu");
0064 
0065   //PinsOnChip = cms.uint32(512),
0066   desc.add<unsigned int>("PinsOnChip", 512)->setComment("Number of pins on the GTL condition chips");
0067 
0068   //OrderOfChip = cms.vint32(1),
0069   vector<int> tmp = {1};
0070   desc.add<vector<int> >("OrderOfChip", tmp)->setComment("Chip order");
0071 
0072   //
0073   // Deprecated Parameters:  These can be removed once the HLT inteface is updated, or HLT takes these conditions from Offline DB.
0074   //
0075 
0076   desc.add<unsigned int>("NumberL1IsoEG", 0)->setComment("Deprecated...");
0077   desc.add<unsigned int>("NumberL1JetCounts", 0)->setComment("Deprecated...");
0078   desc.add<int>("UnitLength", 0)->setComment("Deprecated...");
0079   desc.add<unsigned int>("NumberL1ForJet", 0)->setComment("Deprecated...");
0080   desc.add<unsigned int>("IfCaloEtaNumberBits", 0)->setComment("Deprecated...");
0081   desc.add<unsigned int>("IfMuEtaNumberBits", 0)->setComment("Deprecated...");
0082   desc.add<unsigned int>("NumberL1TauJet", 0)->setComment("Deprecated...");
0083   desc.add<unsigned int>("NumberL1Mu", 0)->setComment("Deprecated...");
0084   desc.add<unsigned int>("NumberConditionChips", 0)->setComment("Deprecated...");
0085   desc.add<int>("NumberPsbBoards", 0)->setComment("Deprecated...");
0086   desc.add<unsigned int>("NumberL1CenJet", 0)->setComment("Deprecated...");
0087   desc.add<unsigned int>("PinsOnConditionChip", 0)->setComment("Deprecated...");
0088   desc.add<unsigned int>("NumberL1NoIsoEG", 0)->setComment("Deprecated...");
0089   desc.add<unsigned int>("NumberTechnicalTriggers", 0)->setComment("Deprecated...");
0090   desc.add<unsigned int>("NumberPhysTriggersExtended", 0)->setComment("Deprecated...");
0091   desc.add<int>("WordLength", 0)->setComment("Deprecated...");
0092   vector<int> tmp2 = {1};
0093   desc.add<vector<int> >("OrderConditionChip", tmp2)->setComment("Deprecated...");
0094 
0095   descriptions.add("StableParametersTrivialProducer", desc);
0096 }
0097 
0098 StableParametersTrivialProducer::StableParametersTrivialProducer(const edm::ParameterSet& parSet)
0099     : data_(new L1TGlobalParameters()) {
0100   // tell the framework what data is being produced
0101   setWhatProduced(this, &StableParametersTrivialProducer::produceGtStableParameters);
0102 
0103   // set the number of bx in event
0104   data_.setTotalBxInEvent(parSet.getParameter<int>("TotalBxInEvent"));
0105 
0106   // set the number of physics trigger algorithms
0107   data_.setNumberPhysTriggers(parSet.getParameter<unsigned int>("NumberPhysTriggers"));
0108 
0109   // set the number of L1 muons received by GT
0110   data_.setNumberL1Mu(parSet.getParameter<unsigned int>("NumberL1Muon"));
0111 
0112   //  set the number of L1 e/gamma objects received by GT
0113   data_.setNumberL1EG(parSet.getParameter<unsigned int>("NumberL1EGamma"));
0114 
0115   // set the number of L1 central jets received by GT
0116   data_.setNumberL1Jet(parSet.getParameter<unsigned int>("NumberL1Jet"));
0117 
0118   // set the number of L1 tau jets received by GT
0119   data_.setNumberL1Tau(parSet.getParameter<unsigned int>("NumberL1Tau"));
0120 
0121   // hardware stuff
0122 
0123   // set the number of condition chips in GTL
0124   data_.setNumberChips(parSet.getParameter<unsigned int>("NumberChips"));
0125 
0126   // set the number of pins on the GTL condition chips
0127   data_.setPinsOnChip(parSet.getParameter<unsigned int>("PinsOnChip"));
0128 
0129   // set the correspondence "condition chip - GTL algorithm word"
0130   // in the hardware
0131   data_.setOrderOfChip(parSet.getParameter<std::vector<int> >("OrderOfChip"));
0132 }
0133 
0134 // destructor
0135 StableParametersTrivialProducer::~StableParametersTrivialProducer() {
0136   // empty
0137 }
0138 
0139 // member functions
0140 
0141 // method called to produce the data
0142 std::unique_ptr<L1TGlobalParameters> StableParametersTrivialProducer::produceGtStableParameters(
0143     const L1TGlobalParametersRcd& iRecord) {
0144   // Return copy so that we don't give away our owned pointer to framework
0145   return std::make_unique<L1TGlobalParameters>(*data_.getWriteInstance());
0146 }
0147 
0148 DEFINE_FWK_EVENTSETUP_MODULE(StableParametersTrivialProducer);