7 #include <boost/cstdint.hpp>
49 desc.
add<
edm::InputTag> (
"MuonInputTag",
edm::InputTag(
""))->setComment(
"InputTag for Global Muon Trigger (required parameter: default value is invalid)");
50 desc.
add<
edm::InputTag> (
"EGammaInputTag",
edm::InputTag(
""))->setComment(
"InputTag for Calo Trigger EGamma (required parameter: default value is invalid)");
51 desc.
add<
edm::InputTag> (
"TauInputTag",
edm::InputTag(
""))->setComment(
"InputTag for Calo Trigger Tau (required parameter: default value is invalid)");
52 desc.
add<
edm::InputTag> (
"JetInputTag",
edm::InputTag(
""))->setComment(
"InputTag for Calo Trigger Jet (required parameter: default value is invalid)");
53 desc.
add<
edm::InputTag> (
"EtSumInputTag",
edm::InputTag(
""))->setComment(
"InputTag for Calo Trigger EtSum (required parameter: default value is invalid)");
54 desc.
add<
edm::InputTag> (
"ExtInputTag",
edm::InputTag(
""))->setComment(
"InputTag for external conditions (not required, but recommend to specify explicitly in config)");
55 desc.
add<
bool>(
"AlgorithmTriggersUnprescaled",
false)->setComment(
"not required, but recommend to specify explicitly in config");
56 desc.
add<
bool>(
"AlgorithmTriggersUnmasked",
false)->setComment(
"not required, but recommend to specify explicitly in config");
59 desc.
add<
bool> (
"ProduceL1GtDaqRecord",
true);
60 desc.
add<
bool> (
"ProduceL1GtObjectMapRecord",
true);
61 desc.
add<
int> (
"EmulateBxInEvent",1);
62 desc.
add<
int> (
"L1DataBxInEvent",5);
63 desc.
add<
unsigned int> (
"AlternativeNrBxBoardDaq",0);
64 desc.
add<
int> (
"BstLengthBytes",-1);
65 desc.
add<
unsigned int> (
"PrescaleSet",1);
69 descriptions.
add(
"L1TGlobalProducer", desc);
73 m_muInputTag(parSet.getParameter<edm::
InputTag> (
"MuonInputTag")),
74 m_egInputTag(parSet.getParameter<edm::
InputTag> (
"EGammaInputTag")),
75 m_tauInputTag(parSet.getParameter<edm::
InputTag> (
"TauInputTag")),
76 m_jetInputTag(parSet.getParameter<edm::
InputTag> (
"JetInputTag")),
77 m_sumInputTag(parSet.getParameter<edm::
InputTag> (
"EtSumInputTag")),
78 m_extInputTag(parSet.getParameter<edm::
InputTag> (
"ExtInputTag")),
79 m_produceL1GtDaqRecord(parSet.getParameter<bool> (
"ProduceL1GtDaqRecord")),
80 m_produceL1GtObjectMapRecord(parSet.getParameter<bool> (
"ProduceL1GtObjectMapRecord")),
81 m_emulateBxInEvent(parSet.getParameter<int> (
"EmulateBxInEvent")),
82 m_L1DataBxInEvent(parSet.getParameter<int> (
"L1DataBxInEvent")),
83 m_alternativeNrBxBoardDaq(parSet.getParameter<unsigned int> (
"AlternativeNrBxBoardDaq")),
84 m_psBstLengthBytes(parSet.getParameter<int> (
"BstLengthBytes")),
85 m_prescaleSet(parSet.getParameter<unsigned int> (
"PrescaleSet")),
86 m_algorithmTriggersUnprescaled(parSet.getParameter<bool> (
"AlgorithmTriggersUnprescaled")),
87 m_algorithmTriggersUnmasked(parSet.getParameter<bool> (
"AlgorithmTriggersUnmasked")),
88 m_verbosity(parSet.getUntrackedParameter<int>(
"Verbosity")),
103 LogDebug(
"l1t|Global") << std::endl;
106 <<
"\nInput tag for muon collection from GMT: " <<
m_muInputTag
123 <<
"\nAlternative for number of BX in GT DAQ record: 0x" << std::hex
140 <<
"\nWARNING: Number of bunch crossing to be emulated rounded to: "
152 <<
"\nWARNING: Number of bunch crossing for incoming L1 Data rounded to: "
161 <<
"\nWARNING: Number of bunch crossing for incoming L1 Data was changed to: "
172 produces<GlobalAlgBlkBxCollection>();
173 produces<GlobalExtBlkBxCollection>();
178 produces<L1GlobalTriggerObjectMapRecord>();
237 menuDir +
"/" + prescaleFileName);
241 unsigned int temp_numberPhysTriggers = 512;
244 std::ifstream inputPrescaleFile;
247 std::vector<std::vector<int> > vec;
248 std::vector<std::vector<int> > prescale_vec;
250 std::vector<unsigned int> temp_triggerMask;
251 std::vector<unsigned int> temp_triggerVetoMask;
253 if( inputPrescaleFile ){
261 while( getline(inputPrescaleFile,line) ){
263 if( !line.compare(0, prefix1.size(), prefix1) )
continue;
266 istringstream
split(line);
271 while( split >> value ){
274 vec.push_back(std::vector<int>());
277 vec[
col].push_back(value);
290 int NumPrescaleSets = 0;
293 int maskVetoColumn = -1;
294 for(
int iCol=0; iCol<int(vec.size()); iCol++ ){
295 if( vec[iCol].
size() > 0 ){
296 int firstRow = vec[iCol][0];
298 if( firstRow > 0 ) NumPrescaleSets++;
299 else if( firstRow==-2 ) maskColumn = iCol;
300 else if( firstRow==-3 ) maskVetoColumn = iCol;
305 for(
unsigned int iBit = 0; iBit < temp_numberPhysTriggers; ++iBit ){
306 unsigned int inputDefaultMask = 1;
307 unsigned int inputDefaultVetoMask = 0;
308 temp_triggerMask.push_back(inputDefaultMask);
309 temp_triggerVetoMask.push_back(inputDefaultVetoMask);
313 if( maskColumn>=0 || maskVetoColumn>=0 ){
314 for(
int iBit=1; iBit<int(vec[0].
size()); iBit++ ){
315 unsigned int algoBit = vec[0][iBit];
317 if( algoBit < temp_numberPhysTriggers ){
319 unsigned int triggerMask = vec[maskColumn][iBit];
320 temp_triggerMask[algoBit] = triggerMask;
322 if( maskVetoColumn>=0 ){
323 unsigned int triggerVetoMask = vec[maskVetoColumn][iBit];
324 temp_triggerVetoMask[algoBit] = triggerVetoMask;
331 if( NumPrescaleSets > 0 ){
333 for(
int iSet=0; iSet<NumPrescaleSets; iSet++ ){
334 prescale_vec.push_back(std::vector<int>());
335 for(
unsigned int iBit = 0; iBit < temp_numberPhysTriggers; ++iBit ){
336 int inputDefaultPrescale = 1;
337 prescale_vec[iSet].push_back(inputDefaultPrescale);
342 for(
int iBit=1; iBit<int(vec[0].
size()); iBit++ ){
343 unsigned int algoBit = vec[0][iBit];
345 if( algoBit < temp_numberPhysTriggers ){
346 for(
int iSet=0; iSet<int(vec.size()); iSet++ ){
348 if( vec[iSet].
size() > 0 ){
349 useSet = vec[iSet][0];
353 if( useSet<0 )
continue;
355 int prescale = vec[iSet][iBit];
356 prescale_vec[useSet][algoBit] = prescale;
361 <<
"\nPrescale file has algo bit: " << algoBit
363 <<
"\nSomething is wrong. Ignoring."
373 <<
"\nFilling the prescale vectors with prescale 1"
374 <<
"\nSetting prescale set to 1"
380 prescale_vec.push_back(std::vector<int>());
381 for(
unsigned int iBit = 0; iBit < temp_numberPhysTriggers; ++iBit ){
382 int inputDefaultPrescale = 1;
383 prescale_vec[
col].push_back(inputDefaultPrescale);
388 inputPrescaleFile.close();
454 unsigned long long l1GtStableParCacheID =
667 bool receiveMu =
true;
668 bool receiveEG =
true;
669 bool receiveTau =
true;
670 bool receiveJet =
true;
671 bool receiveEtSums =
true;
672 bool receiveExt =
true;
713 std::auto_ptr<GlobalAlgBlkBxCollection> uGtAlgRecord(
new GlobalAlgBlkBxCollection(0,minEmulBxInEvent,maxEmulBxInEvent));
714 std::auto_ptr<GlobalExtBlkBxCollection> uGtExtRecord(
new GlobalExtBlkBxCollection(0,minEmulBxInEvent,maxEmulBxInEvent));
717 std::auto_ptr<L1GlobalTriggerObjectMapRecord> gtObjectMapRecord(
727 boost::uint16_t bxCrossHw = 0;
728 if ((bxCross & 0xFFF) == bxCross) {
729 bxCrossHw =
static_cast<boost::uint16_t
> (bxCross);
736 <<
"\nBunch cross number [hex] = " << std::hex << bxCross
737 <<
"\n larger than 12 bits. Set to 0! \n" <<
std::dec
741 LogDebug(
"l1t|Global") <<
"HW BxCross " << bxCrossHw << std::endl;
833 if( pfAlgoSetIndex > (*m_prescaleFactorsAlgoTrig).size()-1 ){
835 <<
"\nAttempting to access prescale algo set: " <<
m_prescaleSet
836 <<
"\nNumber of prescale algo sets available: " << (*m_prescaleFactorsAlgoTrig).size()
837 <<
"Setting former to latter."
840 pfAlgoSetIndex = (*m_prescaleFactorsAlgoTrig).size()-1;
843 const std::vector<int>& prescaleFactorsAlgoTrig = (*m_prescaleFactorsAlgoTrig).at(pfAlgoSetIndex);
848 LogDebug(
"l1t|Global") <<
"Size of prescale vector" << prescaleFactorsAlgoTrig.size() << std::endl;
870 for (
int iBxInEvent = minEmulBxInEvent; iBxInEvent <= maxEmulBxInEvent;
875 <<
"\nGtProducer : running GTL for bx = " << iBxInEvent <<
"\n"
892 <<
"\nGtProducer : running FDL for bx = " << iBxInEvent <<
"\n"
901 prescaleFactorsAlgoTrig,
903 triggerMaskVetoAlgoTrig,
932 std::ostringstream myCoutStream;
934 for(
int bx=minEmulBxInEvent; bx<maxEmulBxInEvent; bx++) {
937 (uGtAlgRecord->at(bx,0)).
print(myCoutStream);
938 (uGtExtRecord->at(bx,0)).
print(myCoutStream);
943 <<
"\n The following L1 GT DAQ readout record was produced:\n"
944 << myCoutStream.str() <<
"\n"
947 myCoutStream.str(
"");
948 myCoutStream.clear();
975 iEvent.
put( uGtAlgRecord );
976 iEvent.
put( uGtExtRecord );
981 iEvent.
put( gtObjectMapRecord );
T getParameter(std::string const &) const
BXVector< GlobalExtBlk > GlobalExtBlkBxCollection
edm::InputTag m_jetInputTag
unsigned int gtPinsOnConditionChip() const
get / set the number of pins on the GTL condition chips
unsigned int m_numberDaqPartitions
number of DAQ partitions
unsigned long long m_l1GtParCacheID
void setVerbosity(const int verbosity)
unsigned int gtIfCaloEtaNumberBits() const
get / set the number of bits for eta of calorimeter objects
unsigned long long m_l1GtTmVetoAlgoCacheID
const std::vector< unsigned int > * m_triggerMaskAlgoTrig
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
int m_verbosity
verbosity level
unsigned int gtNumberL1NoIsoEG() const
get / set the number of L1 e/gamma objects received by GT
const boost::uint16_t gtDaqActiveBoards() const
get / set the active boards for L1 GT DAQ record
std::string m_prescalesFile
CSV file for prescales.
const GlobalStableParameters * m_l1GtStablePar
cached stuff
const int gtTotalBxInEvent() const
get / set the total Bx's in the event
edm::InputTag m_egInputTag
input tag for calorimeter collections from GCT
edm::EDGetTokenT< BXVector< l1t::Tau > > m_tauInputToken
#define DEFINE_FWK_MODULE(type)
int m_psBstLengthBytes
length of BST record (in bytes) from parameter set
void receiveExternalData(edm::Event &, const edm::EDGetTokenT< BXVector< GlobalExtBlk > > &, const bool receiveExt)
bool m_produceL1GtObjectMapRecord
logical flag to produce the L1 GT object map record
int m_totalBxInEvent
total number of Bx's in the event coming from EventSetup
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.
unsigned int gtNumberL1Mu() const
get / set the number of L1 muons received by GT
const unsigned int gtBstLengthBytes() const
get / set length of BST message (in bytes) for L1 GT EVM record
int bunchCrossing() const
unsigned int m_numberPhysTriggers
number of physics triggers
edm::EDGetTokenT< BXVector< GlobalExtBlk > > m_extInputToken
BXVector< GlobalAlgBlk > GlobalAlgBlkBxCollection
unsigned long long m_l1GtTmAlgoCacheID
const TriggerMenu * m_l1GtMenu
std::vector< unsigned int > m_initialTriggerMaskAlgoTrig
unsigned int m_alternativeNrBxBoardDaq
edm::InputTag m_sumInputTag
unsigned int gtNumberL1CenJet() const
get / set the number of L1 central jets received by GT
edm::InputTag m_muInputTag
input tag for muon collection from GMT
edm::InputTag m_extInputTag
input tag for external conditions
unsigned long long m_l1GtMenuCacheID
edm::InputTag m_tauInputTag
bool m_writePsbL1GtDaqRecord
logical flag to write the PSB content in the L1 GT DAQ record
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
bool m_algorithmTriggersUnprescaled
std::vector< std::vector< int > > m_initialPrescaleFactorsAlgoTrig
void receiveCaloObjectData(edm::Event &, const edm::EDGetTokenT< BXVector< l1t::EGamma >> &, const edm::EDGetTokenT< BXVector< l1t::Tau >> &, const edm::EDGetTokenT< BXVector< l1t::Jet >> &, const edm::EDGetTokenT< BXVector< l1t::EtSum >> &, const bool receiveEG, const int nrL1EG, const bool receiveTau, const int nrL1Tau, const bool receiveJet, const int nrL1Jet, const bool receiveEtSums)
receive data from Global Muon Trigger
unsigned int gtNumberL1TauJet() const
get / set the number of L1 tau jets received by GT
boost::uint16_t m_activeBoardsGtDaq
active boards in L1 GT DAQ record
bool m_produceL1GtDaqRecord
logical flag to produce the L1 GT DAQ readout record
unsigned int gtIfMuEtaNumberBits() const
get / set the number of bits for eta of muon objects
bool m_algorithmTriggersUnmasked
unsigned long long m_l1GtStableParCacheID
edm::EDGetTokenT< BXVector< l1t::Muon > > m_muInputToken
ParameterDescriptionBase * add(U const &iLabel, T const &value)
virtual void produce(edm::Event &, const edm::EventSetup &)
unsigned int gtNumberPhysTriggers() const
get / set the number of physics trigger algorithms
unsigned int m_prescaleSet
prescale set used
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void receiveMuonObjectData(edm::Event &, const edm::EDGetTokenT< BXVector< l1t::Muon > > &, const bool receiveMu, const int nrL1Mu)
edm::EDGetTokenT< BXVector< l1t::EtSum > > m_sumInputToken
int m_L1DataBxInEvent
Bx expected in Data coming to GT.
L1TGlobalProducer(const edm::ParameterSet &)
unsigned int gtNumberConditionChips() const
hardware stuff
unsigned long long m_l1GtBMCacheID
int m_ifCaloEtaNumberBits
T const * product() const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
unsigned int gtNumberL1JetCounts() const
get / set the number of L1 jet counts received by GT
void init(const int numberPhysTriggers, const int nrL1Mu, const int nrL1EG, const int nrL1Tau, const int nrL1Jet, int bxFirst, int bxLast)
initialize the class (mainly reserve)
std::vector< unsigned int > m_initialTriggerMaskVetoAlgoTrig
void runFDL(edm::Event &iEvent, const int iBxInEvent, const int totalBxInEvent, const unsigned int numberPhysTriggers, const std::vector< int > &prescaleFactorsAlgoTrig, const std::vector< unsigned int > &triggerMaskAlgoTrig, const std::vector< unsigned int > &triggerMaskVetoAlgoTrig, const bool algorithmTriggersUnprescaled, const bool algorithmTriggersUnmasked)
run the uGT FDL (Apply Prescales and Veto)
unsigned int m_bstLengthBytes
length of BST record (in bytes) from event setup
void fillExtRecord(int iBxInEvent, std::auto_ptr< GlobalExtBlkBxCollection > &uGtExtRecord, cms_uint64_t orbNr, int bxNr)
const L1GtParameters * m_l1GtPar
parameters
const std::vector< int > & gtOrderConditionChip() const
void fillAlgRecord(int iBxInEvent, std::auto_ptr< GlobalAlgBlkBxCollection > &uGtAlgRecord, cms_uint64_t orbNr, int bxNr)
Fill the Daq Records.
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrig
unsigned long long m_l1GtPfAlgoCacheID
unsigned long long cms_uint64_t
void runGTL(edm::Event &iEvent, const edm::EventSetup &evSetup, const TriggerMenu *m_l1GtMenu, const bool produceL1GtObjectMapRecord, const int iBxInEvent, std::auto_ptr< L1GlobalTriggerObjectMapRecord > >ObjectMapRecord, const unsigned int numberPhysTriggers, const int nrL1Mu, const int nrL1EG, const int nrL1Tau, const int nrL1Jet, const int nrL1JetCounts)
run the uGT GTL (Conditions and Algorithms)
tuple size
Write out results.
const std::vector< unsigned int > * m_triggerMaskVetoAlgoTrig
edm::EDGetTokenT< BXVector< l1t::Jet > > m_jetInputToken
edm::EDGetTokenT< BXVector< l1t::EGamma > > m_egInputToken