12 #include <boost/cstdint.hpp>
45 desc.
add<
edm::InputTag> (
"MuonInputTag",
edm::InputTag(
""))->setComment(
"InputTag for Global Muon Trigger (required parameter: default value is invalid)");
46 desc.
add<
edm::InputTag> (
"EGammaInputTag",
edm::InputTag(
""))->setComment(
"InputTag for Calo Trigger EGamma (required parameter: default value is invalid)");
47 desc.
add<
edm::InputTag> (
"TauInputTag",
edm::InputTag(
""))->setComment(
"InputTag for Calo Trigger Tau (required parameter: default value is invalid)");
48 desc.
add<
edm::InputTag> (
"JetInputTag",
edm::InputTag(
""))->setComment(
"InputTag for Calo Trigger Jet (required parameter: default value is invalid)");
49 desc.
add<
edm::InputTag> (
"EtSumInputTag",
edm::InputTag(
""))->setComment(
"InputTag for Calo Trigger EtSum (required parameter: default value is invalid)");
50 desc.
add<
edm::InputTag> (
"ExtInputTag",
edm::InputTag(
""))->setComment(
"InputTag for external conditions (not required, but recommend to specify explicitly in config)");
51 desc.
add<
bool> (
"AlgorithmTriggersUnprescaled",
false)->setComment(
"not required, but recommend to specify explicitly in config");
52 desc.
add<
bool> (
"AlgorithmTriggersUnmasked",
false)->setComment(
"not required, but recommend to specify explicitly in config");
55 desc.
add<
bool> (
"ProduceL1GtDaqRecord",
true);
56 desc.
add<
bool> (
"ProduceL1GtObjectMapRecord",
true);
57 desc.
add<
int> (
"EmulateBxInEvent",1);
58 desc.
add<
int> (
"L1DataBxInEvent",5);
59 desc.
add<
unsigned int> (
"AlternativeNrBxBoardDaq",0);
60 desc.
add<
int> (
"BstLengthBytes",-1);
61 desc.
add<
unsigned int> (
"PrescaleSet",1);
65 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")),
80 m_produceL1GtDaqRecord(parSet.getParameter<bool> (
"ProduceL1GtDaqRecord")),
81 m_produceL1GtObjectMapRecord(parSet.getParameter<bool> (
"ProduceL1GtObjectMapRecord")),
83 m_emulateBxInEvent(parSet.getParameter<int> (
"EmulateBxInEvent")),
84 m_L1DataBxInEvent(parSet.getParameter<int> (
"L1DataBxInEvent")),
86 m_alternativeNrBxBoardDaq(parSet.getParameter<unsigned int> (
"AlternativeNrBxBoardDaq")),
87 m_psBstLengthBytes(parSet.getParameter<int> (
"BstLengthBytes")),
89 m_prescaleSet(parSet.getParameter<unsigned int> (
"PrescaleSet")),
91 m_algorithmTriggersUnprescaled(parSet.getParameter<bool> (
"AlgorithmTriggersUnprescaled")),
92 m_algorithmTriggersUnmasked(parSet.getParameter<bool> (
"AlgorithmTriggersUnmasked")),
94 m_verbosity(parSet.getUntrackedParameter<int>(
"Verbosity")),
109 <<
"\nInput tag for muon collection from uGMT: " <<
m_muInputTag
110 <<
"\nInput tag for calorimeter jet collections from Cal: " <<
m_jetInputTag
121 <<
"\nAlternative for number of BX in GT DAQ record: 0x" << std::hex
136 <<
"\nWARNING: Number of bunch crossing to be emulated rounded to: "
148 <<
"\nWARNING: Number of bunch crossing for incoming L1 Data rounded to: "
157 <<
"\nWARNING: Number of bunch crossing for incoming L1 Data was changed to: "
168 produces<GlobalAlgBlkBxCollection>();
174 produces<GlobalObjectMapRecord>();
232 menuDir +
"/" + prescaleFileName);
236 unsigned int temp_numberPhysTriggers = 512;
239 std::ifstream inputPrescaleFile;
242 std::vector<std::vector<int> > vec;
243 std::vector<std::vector<int> > prescale_vec;
245 std::vector<unsigned int> temp_triggerMask;
246 std::vector<unsigned int> temp_triggerVetoMask;
248 if( inputPrescaleFile ){
256 while( getline(inputPrescaleFile,line) ){
258 if( !line.compare(0, prefix1.size(), prefix1) )
continue;
261 istringstream
split(line);
266 while( split >> value ){
269 vec.push_back(std::vector<int>());
272 vec[
col].push_back(value);
285 int NumPrescaleSets = 0;
288 int maskVetoColumn = -1;
289 for(
int iCol=0; iCol<int(vec.size()); iCol++ ){
290 if( vec[iCol].
size() > 0 ){
291 int firstRow = vec[iCol][0];
293 if( firstRow > 0 ) NumPrescaleSets++;
294 else if( firstRow==-2 ) maskColumn = iCol;
295 else if( firstRow==-3 ) maskVetoColumn = iCol;
300 for(
unsigned int iBit = 0; iBit < temp_numberPhysTriggers; ++iBit ){
301 unsigned int inputDefaultMask = 1;
302 unsigned int inputDefaultVetoMask = 0;
303 temp_triggerMask.push_back(inputDefaultMask);
304 temp_triggerVetoMask.push_back(inputDefaultVetoMask);
308 if( maskColumn>=0 || maskVetoColumn>=0 ){
309 for(
int iBit=1; iBit<int(vec[0].
size()); iBit++ ){
310 unsigned int algoBit = vec[0][iBit];
312 if( algoBit < temp_numberPhysTriggers ){
314 unsigned int triggerMask = vec[maskColumn][iBit];
315 temp_triggerMask[algoBit] = triggerMask;
317 if( maskVetoColumn>=0 ){
318 unsigned int triggerVetoMask = vec[maskVetoColumn][iBit];
319 temp_triggerVetoMask[algoBit] = triggerVetoMask;
326 if( NumPrescaleSets > 0 ){
328 for(
int iSet=0; iSet<NumPrescaleSets; iSet++ ){
329 prescale_vec.push_back(std::vector<int>());
330 for(
unsigned int iBit = 0; iBit < temp_numberPhysTriggers; ++iBit ){
331 int inputDefaultPrescale = 1;
332 prescale_vec[iSet].push_back(inputDefaultPrescale);
337 for(
int iBit=1; iBit<int(vec[0].
size()); iBit++ ){
338 unsigned int algoBit = vec[0][iBit];
340 if( algoBit < temp_numberPhysTriggers ){
341 for(
int iSet=0; iSet<int(vec.size()); iSet++ ){
343 if( vec[iSet].
size() > 0 ){
344 useSet = vec[iSet][0];
348 if( useSet<0 )
continue;
350 int prescale = vec[iSet][iBit];
351 prescale_vec[useSet][algoBit] = prescale;
356 <<
"\nPrescale file has algo bit: " << algoBit
358 <<
"\nSomething is wrong. Ignoring."
368 <<
"\nFilling the prescale vectors with prescale 1"
369 <<
"\nSetting prescale set to 1"
375 prescale_vec.push_back(std::vector<int>());
376 for(
unsigned int iBit = 0; iBit < temp_numberPhysTriggers; ++iBit ){
377 int inputDefaultPrescale = 1;
378 prescale_vec[
col].push_back(inputDefaultPrescale);
383 inputPrescaleFile.close();
414 unsigned long long l1GtParCacheID =
619 bool receiveMu =
true;
620 bool receiveEG =
true;
621 bool receiveTau =
true;
622 bool receiveJet =
true;
623 bool receiveEtSums =
true;
624 bool receiveExt =
true;
656 std::auto_ptr<GlobalAlgBlkBxCollection> uGtAlgRecord(
new GlobalAlgBlkBxCollection(0,minEmulBxInEvent,maxEmulBxInEvent));
659 std::auto_ptr<GlobalObjectMapRecord> gtObjectMapRecord(
669 boost::uint16_t bxCrossHw = 0;
670 if ((bxCross & 0xFFF) == bxCross) {
671 bxCrossHw =
static_cast<boost::uint16_t
> (bxCross);
678 <<
"\nBunch cross number [hex] = " << std::hex << bxCross
679 <<
"\n larger than 12 bits. Set to 0! \n" <<
std::dec
683 LogDebug(
"L1TGlobalProducer") <<
"HW BxCross " << bxCrossHw << std::endl;
693 if( pfAlgoSetIndex > (*m_prescaleFactorsAlgoTrig).size()-1 ){
695 <<
"\nAttempting to access prescale algo set: " <<
m_prescaleSet
696 <<
"\nNumber of prescale algo sets available: " << (*m_prescaleFactorsAlgoTrig).size()
697 <<
"Setting former to latter."
700 pfAlgoSetIndex = (*m_prescaleFactorsAlgoTrig).size()-1;
703 const std::vector<int>& prescaleFactorsAlgoTrig = (*m_prescaleFactorsAlgoTrig).at(pfAlgoSetIndex);
708 LogDebug(
"L1TGlobalProducer") <<
"Size of prescale vector" << prescaleFactorsAlgoTrig.size() << std::endl;
730 for (
int iBxInEvent = minEmulBxInEvent; iBxInEvent <= maxEmulBxInEvent;
735 <<
"\nL1TGlobalProducer : running GTL for bx = " << iBxInEvent <<
"\n"
752 <<
"\nL1TGlobalProducer : running FDL for bx = " << iBxInEvent <<
"\n"
761 prescaleFactorsAlgoTrig,
763 triggerMaskVetoAlgoTrig,
787 std::ostringstream myCoutStream;
789 for(
int bx=minEmulBxInEvent; bx<maxEmulBxInEvent; bx++) {
792 (uGtAlgRecord->at(bx,0)).
print(myCoutStream);
797 <<
"\n The following L1 GT DAQ readout record was produced:\n"
798 << myCoutStream.str() <<
"\n"
801 myCoutStream.str(
"");
802 myCoutStream.clear();
804 const std::vector<GlobalObjectMap> objMapVec =
805 gtObjectMapRecord->gtObjectMap();
807 for (std::vector<GlobalObjectMap>::const_iterator
808 it = objMapVec.begin(); it != objMapVec.end(); ++it) {
810 (*it).print(myCoutStream);
816 <<
"Test gtObjectMapRecord in L1TGlobalProducer \n\n" << myCoutStream.str() <<
"\n\n"
819 myCoutStream.str(
"");
820 myCoutStream.clear();
828 iEvent.
put( uGtAlgRecord );
833 iEvent.
put( gtObjectMapRecord );
T getParameter(std::string const &) const
void receiveMuonObjectData(edm::Event &, const edm::EDGetTokenT< BXVector< l1t::Muon > > &, const bool receiveMu, const int nrL1Mu)
edm::InputTag m_jetInputTag
unsigned int m_numberDaqPartitions
unsigned long long m_l1GtParCacheID
unsigned int numberL1Jet() const
get / set the number of L1 jets received by GT
unsigned long long m_l1GtTmVetoAlgoCacheID
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)
const std::vector< unsigned int > * m_triggerMaskAlgoTrig
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
int m_verbosity
verbosity level
unsigned int numberL1EG() const
get / set the number of L1 e/gamma objects received by GT
std::string m_prescalesFile
CSV file for prescales.
edm::InputTag m_egInputTag
input tag for calorimeter collections from GCT
edm::EDGetTokenT< BXVector< l1t::Tau > > m_tauInputToken
#define DEFINE_FWK_MODULE(type)
void fillAlgRecord(int iBxInEvent, std::auto_ptr< GlobalAlgBlkBxCollection > &uGtAlgRecord, int prescaleSet, int menuUUID, int firmwareUUID)
Fill the Daq Records.
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 numberPhysTriggers() const
get / set the number of physics trigger algorithms
int bunchCrossing() const
unsigned int m_numberPhysTriggers
const L1TGlobalParameters * m_l1GtStablePar
cached stuff
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
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
void setVerbosity(const int verbosity)
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
const std::vector< int > & orderOfChip() const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
bool m_algorithmTriggersUnprescaled
std::vector< std::vector< int > > m_initialPrescaleFactorsAlgoTrig
boost::uint16_t m_activeBoardsGtDaq
active boards in L1 GT DAQ record
void receiveExternalData(edm::Event &, const edm::EDGetTokenT< BXVector< GlobalExtBlk > > &, const bool receiveExt)
bool m_produceL1GtDaqRecord
logical flag to produce the L1 GT DAQ readout record
bool m_algorithmTriggersUnmasked
edm::EDGetTokenT< BXVector< l1t::Muon > > m_muInputToken
unsigned int numberL1Tau() const
get / set the number of L1 tau received by GT
ParameterDescriptionBase * add(U const &iLabel, T const &value)
virtual void produce(edm::Event &, const edm::EventSetup &)
unsigned int m_prescaleSet
prescale set used
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::EDGetTokenT< BXVector< l1t::EtSum > > m_sumInputToken
int m_L1DataBxInEvent
Bx expected in Data coming to GT.
l1t::GlobalBoard * m_uGtBrd
L1TGlobalProducer(const edm::ParameterSet &)
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 long long m_l1GtBMCacheID
int m_ifCaloEtaNumberBits
T const * product() const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< unsigned int > m_initialTriggerMaskVetoAlgoTrig
unsigned int m_bstLengthBytes
length of BST record (in bytes) from event setup
int totalBxInEvent() const
get / set the number of bx in hardware
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrig
unsigned long long m_l1GtPfAlgoCacheID
unsigned int numberL1Mu() const
get / set the number of L1 muons received by GT
unsigned int pinsOnChip() const
get / set the number of pins on the GTL condition chips
tuple size
Write out results.
const std::vector< unsigned int > * m_triggerMaskVetoAlgoTrig
void runGTL(edm::Event &iEvent, const edm::EventSetup &evSetup, const TriggerMenu *m_l1GtMenu, const bool produceL1GtObjectMapRecord, const int iBxInEvent, std::auto_ptr< GlobalObjectMapRecord > >ObjectMapRecord, const unsigned int numberPhysTriggers, const int nrL1Mu, const int nrL1EG, const int nrL1Tau, const int nrL1Jet)
run the uGT GTL (Conditions and Algorithms)
edm::EDGetTokenT< BXVector< l1t::Jet > > m_jetInputToken
unsigned int numberChips() const
get / set the number of condition chips in GTL
edm::EDGetTokenT< BXVector< l1t::EGamma > > m_egInputToken