7 #include <boost/cstdint.hpp>
49 desc.
add<
edm::InputTag> (
"GmtInputTag",
edm::InputTag(
""))->setComment(
"InputTag for Global Muon Trigger (required parameter: default value is invalid)");
50 desc.
add<
edm::InputTag> (
"CaloInputTag",
edm::InputTag(
""))->setComment(
"InputTag for Calo Trigger (required parameter: default value is invalid)");
51 desc.
add<
edm::InputTag> (
"ExtInputTag",
edm::InputTag(
""))->setComment(
"InputTag for external conditions (not required, but recommend to specify explicitly in config)");
52 desc.
add<
bool>(
"AlgorithmTriggersUnprescaled",
false)->setComment(
"not required, but recommend to specify explicitly in config");
53 desc.
add<
bool>(
"AlgorithmTriggersUnmasked",
false)->setComment(
"not required, but recommend to specify explicitly in config");
56 desc.
add<
bool> (
"ProduceL1GtDaqRecord",
true);
57 desc.
add<
bool> (
"ProduceL1GtObjectMapRecord",
true);
58 desc.
add<
int> (
"EmulateBxInEvent",1);
59 desc.
add<
int> (
"L1DataBxInEvent",5);
60 desc.
add<
unsigned int> (
"AlternativeNrBxBoardDaq",0);
61 desc.
add<
int> (
"BstLengthBytes",-1);
62 desc.
add<
unsigned int> (
"PrescaleSet",1);
66 descriptions.
add(
"L1TGlobalProducer", desc);
70 m_muInputTag(parSet.getParameter<edm::
InputTag> (
"GmtInputTag")),
71 m_caloInputTag(parSet.getParameter<edm::
InputTag> (
"CaloInputTag")),
72 m_extInputTag(parSet.getParameter<edm::
InputTag> (
"ExtInputTag")),
73 m_produceL1GtDaqRecord(parSet.getParameter<bool> (
"ProduceL1GtDaqRecord")),
74 m_produceL1GtObjectMapRecord(parSet.getParameter<bool> (
"ProduceL1GtObjectMapRecord")),
75 m_emulateBxInEvent(parSet.getParameter<int> (
"EmulateBxInEvent")),
76 m_L1DataBxInEvent(parSet.getParameter<int> (
"L1DataBxInEvent")),
77 m_alternativeNrBxBoardDaq(parSet.getParameter<unsigned int> (
"AlternativeNrBxBoardDaq")),
78 m_psBstLengthBytes(parSet.getParameter<int> (
"BstLengthBytes")),
79 m_prescaleSet(parSet.getParameter<unsigned int> (
"PrescaleSet")),
80 m_algorithmTriggersUnprescaled(parSet.getParameter<bool> (
"AlgorithmTriggersUnprescaled")),
81 m_algorithmTriggersUnmasked(parSet.getParameter<bool> (
"AlgorithmTriggersUnmasked")),
82 m_verbosity(parSet.getUntrackedParameter<int>(
"Verbosity")),
101 <<
"\nInput tag for muon collection from GMT: " <<
m_muInputTag
102 <<
"\nInput tag for calorimeter collections from GCT: " <<
m_caloInputTag
115 <<
"\nAlternative for number of BX in GT DAQ record: 0x" << std::hex
132 <<
"\nWARNING: Number of bunch crossing to be emulated rounded to: "
144 <<
"\nWARNING: Number of bunch crossing for incoming L1 Data rounded to: "
153 <<
"\nWARNING: Number of bunch crossing for incoming L1 Data was changed to: "
164 produces<GlobalAlgBlkBxCollection>();
165 produces<GlobalExtBlkBxCollection>();
170 produces<L1GlobalTriggerObjectMapRecord>();
229 menuDir +
"/" + prescaleFileName);
233 unsigned int temp_numberPhysTriggers = 512;
236 std::ifstream inputPrescaleFile;
239 std::vector<std::vector<int> > vec;
240 std::vector<std::vector<int> > prescale_vec;
242 std::vector<unsigned int> temp_triggerMask;
243 std::vector<unsigned int> temp_triggerVetoMask;
245 if( inputPrescaleFile ){
253 while( getline(inputPrescaleFile,line) ){
255 if( !line.compare(0, prefix1.size(), prefix1) )
continue;
258 istringstream
split(line);
263 while( split >> value ){
266 vec.push_back(std::vector<int>());
269 vec[
col].push_back(value);
282 int NumPrescaleSets = 0;
285 int maskVetoColumn = -1;
286 for(
int iCol=0; iCol<int(vec.size()); iCol++ ){
287 if( vec[iCol].
size() > 0 ){
288 int firstRow = vec[iCol][0];
290 if( firstRow > 0 ) NumPrescaleSets++;
291 else if( firstRow==-2 ) maskColumn = iCol;
292 else if( firstRow==-3 ) maskVetoColumn = iCol;
297 for(
unsigned int iBit = 0; iBit < temp_numberPhysTriggers; ++iBit ){
298 unsigned int inputDefaultMask = 1;
299 unsigned int inputDefaultVetoMask = 0;
300 temp_triggerMask.push_back(inputDefaultMask);
301 temp_triggerVetoMask.push_back(inputDefaultVetoMask);
305 if( maskColumn>=0 || maskVetoColumn>=0 ){
306 for(
int iBit=1; iBit<int(vec[0].
size()); iBit++ ){
307 unsigned int algoBit = vec[0][iBit];
309 if( algoBit < temp_numberPhysTriggers ){
311 unsigned int triggerMask = vec[maskColumn][iBit];
312 temp_triggerMask[algoBit] = triggerMask;
314 if( maskVetoColumn>=0 ){
315 unsigned int triggerVetoMask = vec[maskVetoColumn][iBit];
316 temp_triggerVetoMask[algoBit] = triggerVetoMask;
323 if( NumPrescaleSets > 0 ){
325 for(
int iSet=0; iSet<NumPrescaleSets; iSet++ ){
326 prescale_vec.push_back(std::vector<int>());
327 for(
unsigned int iBit = 0; iBit < temp_numberPhysTriggers; ++iBit ){
328 int inputDefaultPrescale = 1;
329 prescale_vec[iSet].push_back(inputDefaultPrescale);
334 for(
int iBit=1; iBit<int(vec[0].
size()); iBit++ ){
335 unsigned int algoBit = vec[0][iBit];
337 if( algoBit < temp_numberPhysTriggers ){
338 for(
int iSet=0; iSet<int(vec.size()); iSet++ ){
340 if( vec[iSet].
size() > 0 ){
341 useSet = vec[iSet][0];
345 if( useSet<0 )
continue;
347 int prescale = vec[iSet][iBit];
348 prescale_vec[useSet][algoBit] = prescale;
353 <<
"\nPrescale file has algo bit: " << algoBit
355 <<
"\nSomething is wrong. Ignoring."
365 <<
"\nFilling the prescale vectors with prescale 1"
366 <<
"\nSetting prescale set to 1"
372 prescale_vec.push_back(std::vector<int>());
373 for(
unsigned int iBit = 0; iBit < temp_numberPhysTriggers; ++iBit ){
374 int inputDefaultPrescale = 1;
375 prescale_vec[
col].push_back(inputDefaultPrescale);
380 inputPrescaleFile.close();
443 unsigned long long l1GtStableParCacheID =
656 bool receiveMu =
true;
657 bool receiveEG =
true;
658 bool receiveTau =
true;
659 bool receiveJet =
true;
660 bool receiveEtSums =
true;
661 bool receiveExt =
true;
702 std::auto_ptr<GlobalAlgBlkBxCollection> uGtAlgRecord(
new GlobalAlgBlkBxCollection(0,minEmulBxInEvent,maxEmulBxInEvent));
703 std::auto_ptr<GlobalExtBlkBxCollection> uGtExtRecord(
new GlobalExtBlkBxCollection(0,minEmulBxInEvent,maxEmulBxInEvent));
706 std::auto_ptr<L1GlobalTriggerObjectMapRecord> gtObjectMapRecord(
716 boost::uint16_t bxCrossHw = 0;
717 if ((bxCross & 0xFFF) == bxCross) {
718 bxCrossHw =
static_cast<boost::uint16_t
> (bxCross);
725 <<
"\nBunch cross number [hex] = " << std::hex << bxCross
726 <<
"\n larger than 12 bits. Set to 0! \n" <<
std::dec
730 LogDebug(
"l1t|Global") <<
"HW BxCross " << bxCrossHw << std::endl;
822 if( pfAlgoSetIndex > (*m_prescaleFactorsAlgoTrig).size()-1 ){
824 <<
"\nAttempting to access prescale algo set: " <<
m_prescaleSet
825 <<
"\nNumber of prescale algo sets available: " << (*m_prescaleFactorsAlgoTrig).size()
826 <<
"Setting former to latter."
829 pfAlgoSetIndex = (*m_prescaleFactorsAlgoTrig).size()-1;
832 const std::vector<int>& prescaleFactorsAlgoTrig = (*m_prescaleFactorsAlgoTrig).at(pfAlgoSetIndex);
837 LogDebug(
"l1t|Global") <<
"Size of prescale vector" << prescaleFactorsAlgoTrig.size() << std::endl;
859 for (
int iBxInEvent = minEmulBxInEvent; iBxInEvent <= maxEmulBxInEvent;
864 <<
"\nGtProducer : running GTL for bx = " << iBxInEvent <<
"\n"
881 <<
"\nGtProducer : running FDL for bx = " << iBxInEvent <<
"\n"
890 prescaleFactorsAlgoTrig,
892 triggerMaskVetoAlgoTrig,
921 std::ostringstream myCoutStream;
923 for(
int bx=minEmulBxInEvent; bx<maxEmulBxInEvent; bx++) {
926 (uGtAlgRecord->at(bx,0)).
print(myCoutStream);
927 (uGtExtRecord->at(bx,0)).
print(myCoutStream);
932 <<
"\n The following L1 GT DAQ readout record was produced:\n"
933 << myCoutStream.str() <<
"\n"
936 myCoutStream.str(
"");
937 myCoutStream.clear();
964 iEvent.
put( uGtAlgRecord );
965 iEvent.
put( uGtExtRecord );
970 iEvent.
put( gtObjectMapRecord );
T getParameter(std::string const &) const
BXVector< GlobalExtBlk > GlobalExtBlkBxCollection
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::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
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
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)
edm::InputTag m_caloInputTag
input tag for calorimeter collections from GCT
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