Skip to content

Commit

Permalink
Merge pull request #13066 from cms-l1t-offline/pr-l1tglobal-emulator-80x
Browse files Browse the repository at this point in the history
Pr l1tglobal emulator 80x
  • Loading branch information
cmsbuild committed Jan 31, 2016
2 parents 3c25366 + 18dd3f2 commit 0475d82
Show file tree
Hide file tree
Showing 38 changed files with 14,892 additions and 498 deletions.
35 changes: 23 additions & 12 deletions DataFormats/L1TGlobal/interface/GlobalAlgBlk.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,31 @@ class GlobalAlgBlk
public:

/// set simple members
void setOrbitNr(int orbNr) { m_orbitNr = orbNr; }
void setbxNr(int bxNr) { m_bxNr = bxNr; }
void setbxInEventNr(int bxNr) { m_bxInEvent = bxNr; }
void setFinalOR(int fOR) { m_finalOR = fOR; }
void setOrbitNr(int orbNr) { m_orbitNr = orbNr; }
void setbxNr(int bxNr) { m_bxNr = bxNr; }
void setbxInEventNr(int bxNr) { m_bxInEvent = bxNr; }
void setFinalORVeto(bool fOR) { m_finalORVeto = fOR; }
void setFinalORPreVeto(bool fOR){ m_finalORPreVeto = fOR; }
void setFinalOR(bool fOR) { m_finalOR = fOR; }
void setPreScColumn(int psC) { m_preScColumn = psC; }

/// get simple members
inline const int getOrbitNr() const { return m_orbitNr; }
inline const int getbxNr() const { return m_bxNr; }
inline const int getbxInEventNr() const { return m_bxInEvent; }
inline const int getFinalOR() const { return m_finalOR; }
inline const int getOrbitNr() const { return m_orbitNr; }
inline const int getbxNr() const { return m_bxNr; }
inline const int getbxInEventNr() const { return m_bxInEvent; }
inline const bool getFinalOR() const { return m_finalOR; }
inline const bool getFinalORPreVeto() const { return m_finalORPreVeto; };
inline const bool getFinalORVeto() const { return m_finalORVeto; }
inline const int getPreScColumn() const { return m_preScColumn; }

/// Copy vectors words
void copyInitialToPrescaled() { m_algoDecisionPreScaled = m_algoDecisionInitial; }
void copyPrescaledToFinal() { m_algoDecisionFinal = m_algoDecisionPreScaled; }

/// Set decision bits
void setAlgoDecisionInitial(int bit, bool val);
void setAlgoDecisionPreScaled(int bit, bool val);
void setAlgoDecisionFinal(int bit, bool val);
void setAlgoDecisionInitial(unsigned int bit, bool val);
void setAlgoDecisionPreScaled(unsigned int bit, bool val);
void setAlgoDecisionFinal(unsigned int bit, bool val);

/// Get decision bits
bool getAlgoDecisionInitial(unsigned int bit) const;
Expand All @@ -95,7 +101,12 @@ class GlobalAlgBlk
int m_bxInEvent;

// finalOR
int m_finalOR;
bool m_finalOR;
bool m_finalORPreVeto;
bool m_finalORVeto;

//Prescale Column
int m_preScColumn;


std::vector<bool> m_algoDecisionInitial;
Expand Down
28 changes: 1 addition & 27 deletions DataFormats/L1TGlobal/interface/GlobalExtBlk.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,14 @@ class GlobalExtBlk
/// constructors
GlobalExtBlk(); // empty constructor, all members set to zero;

GlobalExtBlk(int orbitNr, int bxNr, int bxInEvent);

/// destructor
virtual ~GlobalExtBlk();


public:

/// set simple members
void setOrbitNr(int orbNr) { m_orbitNr = orbNr; }
void setbxNr(int bxNr) { m_bxNr = bxNr; }
void setbxInEventNr(int bxNr) { m_bxInEvent = bxNr; }
void setFinalOR(int fOR) { m_finalOR = fOR; }

/// get simple members
inline const int getOrbitNr() const { return m_orbitNr; }
inline const int getbxNr() const { return m_bxNr; }
inline const int getbxInEventNr() const { return m_bxInEvent; }
inline const int getFinalOR() const { return m_finalOR; }

/// Set decision bits
void setExternalDecision(int bit, bool val);
void setExternalDecision(unsigned int bit, bool val);

/// Get decision bits
bool getExternalDecision(unsigned int bit) const;
Expand All @@ -74,18 +60,6 @@ class GlobalExtBlk

private:

/// orbit number
int m_orbitNr;

/// bunch cross number of the actual bx
int m_bxNr;

/// bunch cross in the GT event record (E,F,0,1,2)
int m_bxInEvent;

// finalOR
int m_finalOR;


std::vector<bool> m_extDecision;

Expand Down
84 changes: 58 additions & 26 deletions DataFormats/L1TGlobal/src/GlobalAlgBlk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/MessageLogger/interface/MessageDrop.h"

const static unsigned int maxPhysicsTriggers = 512; //TO DO Move this to a standard parameter area.

// constructors

// empty constructor, all members set to zero;
Expand All @@ -33,16 +35,17 @@ GlobalAlgBlk::GlobalAlgBlk(int orbitNr, int bxNr, int bxInEvent):

//Clear out the header data
m_finalOR=0;
m_preScColumn=0;

// Reserve/Clear out the decision words
m_algoDecisionInitial.reserve(L1GlobalTriggerReadoutSetup::NumberPhysTriggers);
m_algoDecisionInitial.assign(L1GlobalTriggerReadoutSetup::NumberPhysTriggers,false);
m_algoDecisionInitial.reserve(maxPhysicsTriggers);
m_algoDecisionInitial.assign(maxPhysicsTriggers,false);

m_algoDecisionPreScaled.reserve(L1GlobalTriggerReadoutSetup::NumberPhysTriggers);
m_algoDecisionPreScaled.assign(L1GlobalTriggerReadoutSetup::NumberPhysTriggers,false);
m_algoDecisionPreScaled.reserve(maxPhysicsTriggers);
m_algoDecisionPreScaled.assign(maxPhysicsTriggers,false);

m_algoDecisionFinal.reserve(L1GlobalTriggerReadoutSetup::NumberPhysTriggers);
m_algoDecisionFinal.assign(L1GlobalTriggerReadoutSetup::NumberPhysTriggers,false);
m_algoDecisionFinal.reserve(maxPhysicsTriggers);
m_algoDecisionFinal.assign(maxPhysicsTriggers,false);

}

Expand All @@ -56,16 +59,19 @@ GlobalAlgBlk::GlobalAlgBlk( )
m_bxNr=0;
m_bxInEvent=0;
m_finalOR=0;
m_finalORPreVeto = 0;
m_finalORVeto = 0;
m_preScColumn=0;

// Reserve/Clear out the decision words
m_algoDecisionInitial.reserve(L1GlobalTriggerReadoutSetup::NumberPhysTriggers);
m_algoDecisionInitial.assign(L1GlobalTriggerReadoutSetup::NumberPhysTriggers,false);
m_algoDecisionInitial.reserve(maxPhysicsTriggers);
m_algoDecisionInitial.assign(maxPhysicsTriggers,false);

m_algoDecisionPreScaled.reserve(L1GlobalTriggerReadoutSetup::NumberPhysTriggers);
m_algoDecisionPreScaled.assign(L1GlobalTriggerReadoutSetup::NumberPhysTriggers,false);
m_algoDecisionPreScaled.reserve(maxPhysicsTriggers);
m_algoDecisionPreScaled.assign(maxPhysicsTriggers,false);

m_algoDecisionFinal.reserve(L1GlobalTriggerReadoutSetup::NumberPhysTriggers);
m_algoDecisionFinal.assign(L1GlobalTriggerReadoutSetup::NumberPhysTriggers,false);
m_algoDecisionFinal.reserve(maxPhysicsTriggers);
m_algoDecisionFinal.assign(maxPhysicsTriggers,false);

}

Expand All @@ -80,24 +86,40 @@ GlobalAlgBlk::~GlobalAlgBlk()


/// Set decision bits
void GlobalAlgBlk::setAlgoDecisionInitial(int bit, bool val)
void GlobalAlgBlk::setAlgoDecisionInitial(unsigned int bit, bool val)
{
// if(bit < m_algoDecisionInitial.size()) {
if(bit < m_algoDecisionInitial.size()) {

m_algoDecisionInitial.at(bit) = val;

// }
// Need some erorr checking here.

} else {
// Need some erorr checking here.
LogTrace("L1TGlobal") << "Attempting to set an algorithm bit " << bit << " beyond limit " << m_algoDecisionInitial.size();
}

}
void GlobalAlgBlk::setAlgoDecisionPreScaled(int bit, bool val)
void GlobalAlgBlk::setAlgoDecisionPreScaled(unsigned int bit, bool val)
{
m_algoDecisionPreScaled.at(bit) = val;

if(bit < m_algoDecisionPreScaled.size()) {

m_algoDecisionPreScaled.at(bit) = val;
} else {
// Need some erorr checking here.
LogTrace("L1TGlobal") << "Attempting to set an algorithm bit " << bit << " beyond limit " << m_algoDecisionPreScaled.size();
}

}
void GlobalAlgBlk::setAlgoDecisionFinal(int bit, bool val)
void GlobalAlgBlk::setAlgoDecisionFinal(unsigned int bit, bool val)
{
m_algoDecisionFinal.at(bit) = val;

if(bit < m_algoDecisionFinal.size()) {
m_algoDecisionFinal.at(bit) = val;
} else {
// Need some erorr checking here.
LogTrace("L1TGlobal") << "Attempting to set an algorithm bit " << bit << " beyond limit " << m_algoDecisionFinal.size();
}

}

/// Get decision bits
Expand Down Expand Up @@ -127,12 +149,15 @@ void GlobalAlgBlk::reset()
m_bxNr=0;
m_bxInEvent=0;
m_finalOR=0;
m_finalORPreVeto = 0;
m_finalORVeto = 0;
m_preScColumn=0;

// Clear out the decision words
// but leave the vector intact
m_algoDecisionInitial.assign(L1GlobalTriggerReadoutSetup::NumberPhysTriggers,false);
m_algoDecisionPreScaled.assign(L1GlobalTriggerReadoutSetup::NumberPhysTriggers,false);
m_algoDecisionFinal.assign(L1GlobalTriggerReadoutSetup::NumberPhysTriggers,false);
m_algoDecisionInitial.assign(maxPhysicsTriggers,false);
m_algoDecisionPreScaled.assign(maxPhysicsTriggers,false);
m_algoDecisionFinal.assign(maxPhysicsTriggers,false);


}
Expand All @@ -149,8 +174,12 @@ void GlobalAlgBlk::print(std::ostream& myCout) const
myCout << " Bx Number (hex): 0x" << std::hex << std::setw(4) << std::setfill('0') << m_bxNr << std::endl;

myCout << " Local Bx (hex): 0x" << std::hex << std::setw(1) << std::setfill('0') << m_bxInEvent << std::endl;

myCout << " Final OR (hex): Ox" << std::hex << std::setw(1) << std::setfill('0') << m_finalOR << std::endl;

myCout << " PreScale Column: " <<std::setw(2) << m_preScColumn << std::endl;

myCout << " Final OR Veto: " << std::hex << std::setw(1) << std::setfill('0') << m_finalORVeto << std::endl;

myCout << " Final OR: " << std::hex << std::setw(1) << std::setfill('0') << m_finalOR << std::endl;

// Loop through bits to create a hex word of algorithm bits.
int lengthWd = m_algoDecisionInitial.size();
Expand All @@ -161,6 +190,7 @@ void GlobalAlgBlk::print(std::ostream& myCout) const
if((i%4) == 0){
myCout << std::hex << std::setw(1) << digit;
digit = 0;
if(i%32 == 0 && i<lengthWd-1) myCout << " ";
}
} //end loop over algorithm bits
myCout << std::endl;
Expand All @@ -174,6 +204,7 @@ void GlobalAlgBlk::print(std::ostream& myCout) const
if((i%4) == 0){
myCout << std::hex << std::setw(1) << digit;
digit = 0;
if(i%32 == 0 && i<lengthWd-1) myCout << " ";
}
} //end loop over algorithm bits
myCout << std::endl;
Expand All @@ -188,6 +219,7 @@ void GlobalAlgBlk::print(std::ostream& myCout) const
if((i%4) == 0){
myCout << std::hex << std::setw(1) << digit;
digit = 0;
if(i%32 == 0 && i<lengthWd-1) myCout << " ";
}
} //end loop over algorithm bits
myCout << std::endl;
Expand Down
57 changes: 16 additions & 41 deletions DataFormats/L1TGlobal/src/GlobalExtBlk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,17 @@
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/MessageLogger/interface/MessageDrop.h"

const static unsigned int maxExternalConditions = 256; //TO DO Move this to a standard parameter area.
// constructors

// empty constructor, all members set to zero;
GlobalExtBlk::GlobalExtBlk(int orbitNr, int bxNr, int bxInEvent):
m_orbitNr(orbitNr), m_bxNr(bxNr), m_bxInEvent(bxInEvent)
{

//Clear out the header data
m_finalOR=0;

// Reserve/Clear out the decision words
m_extDecision.reserve(L1GlobalTriggerReadoutSetup::NumberPhysTriggers);
m_extDecision.assign(L1GlobalTriggerReadoutSetup::NumberPhysTriggers,false);

}


// empty constructor, all members set to zero;
GlobalExtBlk::GlobalExtBlk( )
{

//Clear out the header data
m_orbitNr=0;
m_bxNr=0;
m_bxInEvent=0;
m_finalOR=0;

// Reserve/Clear out the decision words
m_extDecision.reserve(L1GlobalTriggerReadoutSetup::NumberPhysTriggers);
m_extDecision.assign(L1GlobalTriggerReadoutSetup::NumberPhysTriggers,false);
m_extDecision.reserve(maxExternalConditions);
m_extDecision.assign(maxExternalConditions,false);

}

Expand All @@ -68,14 +49,16 @@ GlobalExtBlk::~GlobalExtBlk()


/// Set decision bits
void GlobalExtBlk::setExternalDecision(int bit, bool val)
void GlobalExtBlk::setExternalDecision(unsigned int bit, bool val)
{
// if(bit < m_algoDecision.size()) {
if(bit < m_extDecision.size()) {

m_extDecision.at(bit) = val;

// }
// Need some erorr checking here.
}else {
// Need some erorr checking here.
LogTrace("L1TGlobal") << "Attempting to set a external bit " << bit << " beyond limit " << m_extDecision.size();
}

}

Expand All @@ -92,15 +75,9 @@ bool GlobalExtBlk::getExternalDecision(unsigned int bit) const
void GlobalExtBlk::reset()
{

//Clear out the header data
m_orbitNr=0;
m_bxNr=0;
m_bxInEvent=0;
m_finalOR=0;

// Clear out the decision words
// but leave the vector intact
m_extDecision.assign(L1GlobalTriggerReadoutSetup::NumberPhysTriggers,false);
m_extDecision.assign(maxExternalConditions,false);


}
Expand All @@ -110,24 +87,22 @@ void GlobalExtBlk::print(std::ostream& myCout) const
{

myCout << " GlobalExtBlk " << std::endl;

myCout << " Orbit Number (hex): 0x" << std::hex << std::setw(8) << std::setfill('0') << m_orbitNr << std::endl;

myCout << " Bx Number (hex): 0x" << std::hex << std::setw(4) << std::setfill('0') << m_bxNr << std::endl;

myCout << " Local Bx (hex): 0x" << std::hex << std::setw(1) << std::setfill('0') << m_bxInEvent << std::endl;

// Loop through bits to create a hex word of algorithm bits.
int lengthWd = m_extDecision.size();
myCout << " External Condition 0x" << std::hex;
myCout << " External Conditions 0x" << std::hex;
int digit = 0;
bool firstNonZero = false;
for(int i=lengthWd-1; i>-1; i--) {
if(m_extDecision.at(i)) digit |= (1 << (i%4));
if((i%4) == 0){
if(digit > 0) firstNonZero = true;
if((i%4) == 0 && firstNonZero){
myCout << std::hex << std::setw(1) << digit;
digit = 0;
if(i%32 == 0 && i<lengthWd-1) myCout << " ";
}
} //end loop over algorithm bits
if(!firstNonZero) myCout << "0";
myCout << std::endl;

}
Expand Down
6 changes: 4 additions & 2 deletions DataFormats/L1TGlobal/src/classes_def.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<lcgdict>
<class name="GlobalAlgBlk" ClassVersion="10">
<class name="GlobalAlgBlk" ClassVersion="11">
<version ClassVersion="11" checksum="2460401123"/>
<version ClassVersion="10" checksum="2404151857"/>
</class>
<class name="GlobalAlgBlkBxCollection"/>
<class name="edm::Wrapper<GlobalAlgBlkBxCollection>"/>

<class name="GlobalExtBlk" ClassVersion="10">
<class name="GlobalExtBlk" ClassVersion="11">
<version ClassVersion="11" checksum="3765126275"/>
<version ClassVersion="10" checksum="3371214087"/>
</class>
<class name="GlobalExtBlkBxCollection"/>
Expand Down
Loading

0 comments on commit 0475d82

Please sign in to comment.