41 unsigned short int tss_buffer[7][31],
43 unsigned short int tsm_buffer[9]) {
53 bool tsscgs2, tsscgs1, tsscce1, tsshte1, tssnoe1, carrytss;
54 bool tsscce2, tsshte2, tssnoe2, tssccec, tsshtec, tssnoec;
55 unsigned short tssgs1, tssgs2, tssmsk1, tssmsk2;
57 tsscgs2 = tsscgs1 = tsscce1 = tsshte1 = tssnoe1 = carrytss =
false;
58 tsscce2 = tsshte2 = tssnoe2 = tssccec = tsshtec = tssnoec =
false;
59 tssgs1 = tssgs2 = tssmsk1 = tssmsk2 = 0;
61 memset(tstren,
true, 24 *
sizeof(
bool));
64 for (
int itss = 0; itss < ntss; itss++) {
65 unsigned short int memory_tss[27];
67 for (
int ts = 0; ts < 27; ts++) {
68 memory_tss[ts] = tss_buffer[itss][ts + 4];
72 tstren[itss * 4] = !(memory_tss[1] & 0x08);
73 tstren[itss * 4 + 1] = !(memory_tss[1] & 0x80);
74 tstren[itss * 4 + 2] = !(memory_tss[2] & 0x08);
75 tstren[itss * 4 + 3] = !(memory_tss[2] & 0x80);
78 tsscgs2 = !(memory_tss[0] & 0x08);
79 tssgs2 = memory_tss[0] & 0x04 ? 0 : 1;
80 tsscgs1 = !(memory_tss[0] & 0x02);
81 tssgs1 = memory_tss[0] & 0x01 ? 0 : 1;
82 tsscce1 = !(memory_tss[4] & 0x04);
83 tsshte1 = !(memory_tss[4] & 0x02);
84 tssnoe1 = !(memory_tss[4] & 0x01);
85 tsscce2 = !(memory_tss[3] & 0x40);
86 tsshte2 = !(memory_tss[3] & 0x20);
87 tssnoe2 = !(memory_tss[3] & 0x10);
88 tssccec = !(memory_tss[3] & 0x04);
89 tsshtec = !(memory_tss[3] & 0x02);
90 tssnoec = !(memory_tss[3] & 0x01);
91 carrytss = !(memory_tss[4] & 0x40);
92 tssmsk1 = memory_tss[4] & 0x10 ? 132 : 312;
93 tssmsk2 = memory_tss[4] & 0x20 ? 132 : 312;
100 unsigned short int memory_tsms[2], memory_tsmdu[2], memory_tsmdd[2];
102 for (
int ts = 0; ts < 2; ts++) {
103 memory_tsms[ts] = tsm_buffer[ts + 3];
104 memory_tsmdu[ts] = tsm_buffer[ts + 5];
105 memory_tsmdd[ts] = tsm_buffer[ts + 7];
111 unsigned short tsmgs1 = memory_tsms[1] & 0x02 ? 0 : 1;
113 unsigned short tsmgs2 = 1;
123 bool carrytsms = !(memory_tsms[1] & 0x01);
124 unsigned short tsmmsk1 = memory_tsms[1] & 0x08 ? 321 : 312;
125 unsigned short tsmmsk2 = tsmmsk1;
127 tsmword[0] = !((memory_tsmdu[0] & 0x80) && (memory_tsmdd[0] & 0x80));
128 tsmword[1] = !(memory_tsms[0] & 0x01);
129 tsmword[2] = !(memory_tsms[0] & 0x02);
130 tsmword[3] = !(memory_tsms[0] & 0x04);
131 tsmword[4] = !(memory_tsms[0] & 0x08);
132 tsmword[5] = !(memory_tsms[0] & 0x10);
133 tsmword[6] = !(memory_tsms[0] & 0x20);
134 tsmword[7] = !(memory_tsms[0] & 0x40);
135 bool carrytsmd = !((memory_tsmdu[0] & 0x10) && (memory_tsmdd[0] & 0x10));
137 unsigned short tsmhsp = carrytss && carrytsms && carrytsmd;
143 for (
int i = 0;
i < 24;
i++)
145 std::cout <<
" tsscgs1=" << tsscgs1 <<
" tssgs1=" << tssgs1 <<
" tsscgs2=" << tsscgs2 <<
" tssgs2=" << tssgs2
146 <<
" tsscce1=" << tsscce1 <<
" tsshte1=" << tsshte1 <<
" tssnoe1=" << tssnoe1 <<
" tsscce2=" << tsscce2
147 <<
" tsshte2=" << tsshte2 <<
" tssnoe2=" << tssnoe2 <<
" tssccec=" << tssccec <<
" tsshtec=" << tsshtec
148 <<
" tssnoec=" << tssnoec <<
" carrytss=" << carrytss <<
" tssmsk1=" << tssmsk1 <<
" tssmsk2=" << tssmsk2
152 <<
"tsmcgs1=" << tsmcgs1 <<
" tsmgs1=" << tsmgs1 <<
" tsmcgs2=" << tsmcgs2 <<
" tsmgs2=" << tsmgs2
153 <<
" tsmcce1=" << tsmcce1 <<
" tsmhte1=" << tsmhte1 <<
" tsmnoe1=" << tsmnoe1 <<
" tsmcce2=" << tsmcce2
154 <<
" tsmhte2=" << tsmhte2 <<
" tsmnoe2=" << tsmnoe2 <<
" tsmccec=" << tsmccec <<
" tsmhtec=" << tsmhtec
155 <<
" tsmnoec=" << tsmnoec <<
" tsmhsp=" << tsmhsp <<
" carrytsms=" << carrytsms
156 <<
" carrytsmd=" << carrytsmd <<
" tsmword=";
157 for (
int i = 0;
i < 8;
i++)
159 std::cout <<
" tsmmsk1=" << tsmmsk1 <<
" tsmmsk2=" << tsmmsk2 << std::endl;
195 for (
int i = 0;
i < 24;
i++)
197 for (
int i = 0; i < 8; i++)
222 edm::LogVerbatim(
"DTTPG") <<
"DTConfigTSPhi::setDefaults : TSSMSK1 not in correct form: " << mymsk << std::endl;
230 edm::LogVerbatim(
"DTTPG") <<
"DTConfigTSPhi::setDefaults : TSSMSK2 not in correct form: " << mymsk << std::endl;
262 if (mygs >= 0 && mygs < 3)
265 edm::LogVerbatim(
"DTTPG") <<
"DTConfigTSPhi::setDefaults : TSSGS1 value is not correct: " << mygs << std::endl;
270 if (mygs >= 0 && mygs < 5)
273 edm::LogVerbatim(
"DTTPG") <<
"DTConfigTSPhi::setDefaults : TSSGS2 value is not correct: " << mygs << std::endl;
287 edm::LogVerbatim(
"DTTPG") <<
"DTConfigTSPhi::setDefaults : TSMMSK1 not in correct form: " << mymsk << std::endl;
295 edm::LogVerbatim(
"DTTPG") <<
"DTConfigTSPhi::setDefaults : TSMMSK2 not in correct form: " << mymsk << std::endl;
327 if (mygs >= 0 && mygs < 3)
330 edm::LogVerbatim(
"DTTPG") <<
"DTConfigTSPhi::setDefaults : TSMGS1 value is not correct: " << mygs << std::endl;
335 if (mygs >= 0 && mygs < 5)
338 edm::LogVerbatim(
"DTTPG") <<
"DTConfigTSPhi::setDefaults : TSMGS2 value is not correct: " << mygs << std::endl;
349 if (myhsp >= 0 && myhsp < 3)
352 edm::LogVerbatim(
"DTTPG") <<
"DTConfigTSPhi::setDefaults : TSMHSP value is not correct: " << myhsp << std::endl;
359 edm::LogVerbatim(
"DTTPG") <<
"DTConfigTSPhi::setDefaults : TSMWORD value is not correct: " << word << std::endl;
361 for (
int i = 0;
i < 7;
i++) {
362 short int bit = word % 2;
370 for (
int i = 0;
i < 24;
i++) {
371 std::stringstream os;
396 if (stat == 1 || stat == 2 || (stat == 4 && (sect == 9 || sect == 11 || sect == 10))) {
403 std::cout <<
"******************************************************************************" << std::endl;
404 std::cout <<
"* DTTrigger configuration : TSPhi chips *" << std::endl;
405 std::cout <<
"******************************************************************************" << std::endl
408 std::cout <<
" TSS Parameters:" << std::endl;
417 std::cout <<
" TSM Parameters:" << std::endl;
428 for (
int i = 1;
i < 25;
i++)
436 std::cout <<
"******************************************************************************" << std::endl;
442 int nValidTSS =
static_cast<int>(isMaskValid && isGsValid ?
m_ntss : 0);
451 int nValidTSM =
static_cast<int>(isMaskValid && isGsValid && isCarryValid ?
m_ntsm : 0);
459 bool hasthree =
false;
460 for (
int i = 0;
i < 3;
i++) {
461 int mynum = msk % 10;
475 if (hasone ==
true && hastwo ==
true && hasthree ==
true)
void setTssGhost2Corr(bool tsscgs2)
Correlated ghost 2 suppression option in TSS.
Log< level::Info, true > LogVerbatim
T getUntrackedParameter(std::string const &, T const &) const
bool TsmInOutEna(int i) const
Enable Inner SL checking in TSM for sort1/2.
bool TssInOutEnaCarry() const
Enable Inner SL checking in TSS for carry.
void setTsmCorrEna(bool tsmcce, int i)
Enable Correlation checking in TSM for sort1/2.
bool TsmHtrigEna(int i) const
Enable Htrig checking in TSM for sort1/2.
bool TsmGhost2Corr() const
Correlated ghost 2 suppression option in TSM.
void setTsmInOutEnaCarry(bool tsmnoe)
Enable Inner SL checking in TSM for carry.
void setTssHtrigEna(bool tsshte, int i)
Enable Htrig checking in TSS for sort1/2.
unsigned short int m_tssgs1
unsigned short int m_tsmgs2
int TsmMasking(int i) const
Order of quality bits in TSM for sort1/2.
void setTssGhost1Corr(bool tsscgs1)
Correlated ghost 1 suppression option in TSS.
void setTssMasking(unsigned short int tssmsk, int i)
Order of quality bits in TSS for sort1/2.
unsigned short int m_tsmhsp
void setTssGhost1Flag(unsigned short tssgs1)
Ghost 1 suppression option in TSS.
int TssMasking(int i) const
Order of quality bits in TSS for sort1/2.
unsigned short int m_tsmmsk[2]
void setTsmCorrEnaCarry(bool tsmcce)
Enable Correlation checking in TSM for carry.
void setUsedTraco(int i, int val)
Enabled TRACOs in TS.
int nValidTSM() const
Number of correctly configured TSS.
void setTsmInOutEna(bool tsmnoe, int i)
Enable Inner SL checking in TSM for sort1/2.
DTConfigTSPhi()
Constructor.
void setTssGhost2Flag(unsigned short tssgs2)
Ghost 2 suppression option in TSS.
~DTConfigTSPhi() override
Destructor.
void setTsmGhost1Corr(bool tsmcgs1)
Correlated ghost 1 suppression option in TSM.
bool debug() const
Return the debug flag.
bool TssCorrEnaCarry() const
Enable Correlation checking in TSS for carry.
void setDefaults(const edm::ParameterSet &ps)
Load pset values into class variables.
void setTsmCarryFlag(unsigned short tsmhsp)
Handling of second track (carry) in case of pile-up, in TSM.
bool TsmHtrigEnaCarry() const
Enable Htrig checking in TSM for carry.
int TsmGetCarryFlag() const
Handling of second track (carry) in case of pile-up, in TSM.
unsigned short int m_tsmgs1
void setTssHtrigEnaCarry(bool tsshte)
Enable Htrig checking in TSS for carry.
int TSSinTSMD(int stat, int sect) const
Return the max nb. of TSSs in input to a single TSMD (called ONLY in back-up mode) ...
void setTsmGhost2Corr(bool tsmcgs2)
Correlated ghost 2 suppression option in TSM.
int TsmGhost1Flag() const
Ghost 1 suppression option in TSM.
bool TssHtrigEnaCarry() const
Enable Htrig checking in TSS for carry.
bool TssGhost1Corr() const
Correlated ghost 1 suppression option in TSS.
void print() const
Print the setup.
void setTssCorrEna(bool tsscce, int i)
Enable Correlation checking in TSS for sort1/2.
int TssGhost2Flag() const
Ghost 2 suppression option in TSS.
void setTsmGhost2Flag(unsigned short tsmgs2)
Ghost 2 suppression option in TSM.
void setTsmGhost1Flag(unsigned short tsmgs1)
Ghost 1 suppression option in TSM.
T getParameter(std::string const &) const
int TssGhost1Flag() const
Ghost 1 suppression option in TSS.
int TsmGhost2Flag() const
Ghost 2 suppression option in TSM.
bool TsmCorrEnaCarry() const
Enable Correlation checking in TSM for carry.
void setTsmHtrigEna(bool tsmhte, int i)
Enable Htrig checking in TSM for sort1/2.
bool TsmCorrEna(int i) const
Enable Correlation checking in TSM for sort1/2.
void setTsmStatus(int i, int val)
TSM status.
bool TssInOutEna(int i) const
Enable Inner SL checking in TSS for sort1/2.
bool TsmInOutEnaCarry() const
Enable Inner SL checking in TSM for carry.
int nValidTSS() const
Number of correctly configured TSS.
BitArray< 8 > TsmStatus() const
TSM status.
bool TssGhost2Corr() const
Correlated ghost 2 suppression option in TSS.
void setTssCorrEnaCarry(bool tsscce)
Enable Correlation checking in TSS for.
std::ostream & print(std::ostream &o=std::cout) const
void setTsmMasking(unsigned short int tsmmsk, int i)
Order of quality bits in TSM for sort1/2.
bool TsmGhost1Corr() const
Correlated ghost 1 suppression option in TSM.
void setTsmHtrigEnaCarry(bool tsmhte)
Enable Htrig checking in TSM for carry.
bool TssCorrEna(int i) const
Enable Correlation checking in TSS for sort1/2.
unsigned short int m_tssmsk[2]
void setTssInOutEnaCarry(bool tssnoe)
Enable Inner SL checking in TSS for carry.
void setTssInOutEna(bool tssnoe, int i)
Enable Inner SL checking in TSS for sort1/2.
bool usedTraco(int i) const
Enabled TRACOs in TS.
bool checkMask(unsigned short) const
Check mask correctness.
bool TssHtrigEna(int i) const
Enable Htrig checking in TSS for sort1/2.
unsigned short int m_tssgs2