52 std::cout <<
"DTTracoChip constructor called for TRACO number " <<
n << std::endl;
99 float SL_shift = xBTI1_3 - xBTI1_1;
148 : _geom(traco._geom), _id(traco._id), _card(traco._card), _luts(traco._luts) {
152 std::vector<DTTracoCand>::const_iterator
p;
161 std::vector<DTTracoTrig *>::const_iterator
p1;
196 if (
this != &traco) {
203 std::vector<DTTracoCand>::const_iterator
p;
212 std::vector<DTTracoTrig *>::const_iterator
p1;
226 std::vector<DTTracoTrig *>::iterator
p1;
250 std::cout <<
"DTTracoChip::run: wrong TRACO number " <<
_id.
traco() << std::endl;
257 std::cout <<
"\n STEP: " << is << std::endl;
258 std::cout <<
" ================" << std::endl;
269 std::cout <<
" candidates " << std::endl;
295 for (
int itk = 0; itk < 2; itk++) {
307 std::cout <<
"Best candidates for track " << itk + 1 <<
" are:" << std::endl;
370 std::cout <<
"Checking overlap I-II track..." << std::endl;
373 if (
nTrig(is - 1) > 0) {
378 std::cout <<
"II track at step " << std::hex << is - 1 <<
std::dec <<
"marked rej." << std::endl;
379 std::cout <<
"I track overlap flag at step " << std::hex << is <<
std::dec <<
" setted" << std::endl;
393 for (
int cc = 1; cc <=
nTrig(is); cc++) {
410 if (prevTraco !=
nullptr) {
417 if (nextTraco !=
nullptr) {
425 for (
int i = 0;
i < 6;
i++) {
455 stable_sort(tclist.begin(), tclist.end());
456 if (
config()->
sortKascend(itk) && !(tclist.size() == 2 && tclist[0].K() == tclist[1].K())) {
457 reverse(tclist.begin(), tclist.end());
459 std::cout <<
"Reversing order of sorted candidate list..." << std::endl;
472 std::cout <<
"DTTracoChip::findBest - Looking for track number " << itk + 1 << std::endl;
473 std::cout <<
"Sorted std::vector of usable track candidates is:" << std::endl;
475 for (std::vector<DTTracoCand>::iterator
p = tclist.begin();
p < tclist.end();
p++) {
477 std::cout <<
" DTTracoChip Candidate # " <<
i++;
481 std::cout <<
"--------------------------------------------------" << std::endl;
488 std::vector<DTTracoCand>::iterator
p;
489 for (
p = tclist.begin();
p < tclist.end(); ++
p) {
494 std::cout <<
"Candidate # " <<
i <<
" supp. because next to H in adiacent Tracos" << std::endl;
499 if ((*p).BtiTrig()->code() == 8)
501 if (bestltrig ==
nullptr)
514 std::vector<DTTracoCand>::iterator
p;
515 for (
p = tclist.begin();
p < tclist.end();
p++) {
516 if ((*p).BtiTrig()->code() < 8 &&
abs((*p).BtiTrig()->btiNumber() - candidate->
BtiTrig()->
btiNumber()) < 2) {
521 std::cout <<
"Suppressed because adiacent to H trig" << std::endl;
551 std::cout <<
"DTTracoChip::setPV called for candidates : " << std::endl;
556 std::cout <<
"--------------------------------------------------" << std::endl;
563 int first = (itk == 0) ? 1 : 0;
573 if (
inner->BtiTrig()->code() == 8 &&
outer->BtiTrig()->code() < 8) {
575 }
else if (
inner->BtiTrig()->code() < 8 &&
outer->BtiTrig()->code() == 8) {
594 }
else if (
inner ==
nullptr &&
outer !=
nullptr) {
596 }
else if (
inner !=
nullptr &&
outer ==
nullptr) {
609 int K = candidate->
K();
618 std::cout <<
"Selected candidate stored for preview is: ";
626 int is = tctrig->
step();
630 std::cout <<
"DTTracoChip::storeCorr called with candidates: " << std::endl;
635 std::cout <<
"--------------------------------------------------" << std::endl;
659 int xq1 =
inner->X();
660 int xq2 =
outer->X();
661 xcor = (xq2 + xq1) / 2;
662 kcor = (xq1 - xq2) + 512;
667 int kd1 =
abs(kcor / 16 - kq1 / 16);
668 int kd2 =
abs(kcor / 16 - kq2 / 16);
674 std::cout <<
"*************************************************************";
687 std::cout <<
"*************************************************************";
698 tctrig->
setK(kcor - 512);
724 else if (tctrig->
qdec() == 4 &&
739 std::cout <<
"*************************************************************";
741 std::cout <<
" Correlation was successfull: ";
747 std::cout <<
"*************************************************************";
755 std::cout <<
"*************************************************************";
757 std::cout <<
" No correlation possible ";
759 std::cout <<
"*************************************************************";
770 int is = tctrig->
step();
774 std::cout <<
"DTTracoChip::storeUncorr called with candidates: " << std::endl;
779 std::cout <<
"--------------------------------------------------" << std::endl;
791 if (
inner->BtiTrig()->code() == 8 &&
outer->BtiTrig()->code() < 8) {
794 }
else if (
inner->BtiTrig()->code() < 8 &&
outer->BtiTrig()->code() == 8) {
817 }
else if (
inner ==
nullptr &&
outer !=
nullptr) {
819 }
else if (
inner !=
nullptr &&
outer ==
nullptr) {
838 std::cout <<
"Low accepted because LVALIDIFH on...." << std::endl;
851 std::cout <<
"Single low trigger discarded by preview and " 852 <<
"priority selector for ltmsk!" << std::endl;
866 if (
config()->TcBxLts()) {
871 std::cout <<
"Low trigger suppressed because H in next 4 bx " 872 <<
" and LTS flag on...." << std::endl;
903 tctrig->
setX(candidate->
X());
938 std::cout <<
"L rejected because outside angular window!" << std::endl;
946 std::cout <<
"*************************************************************";
954 std::cout <<
"*************************************************************";
964 std::cout <<
"DTTracoChip::add_btiT: wrong position: " <<
pos;
965 std::cout <<
"trigger not added!" << std::endl;
969 std::cout <<
"DTTracoChip::add_btiT: step out of range: " <<
step;
970 std::cout <<
"trigger not added!" << std::endl;
976 std::cout <<
"DTTracoChip::add_btiT: position: " <<
pos;
977 std::cout <<
"has disconnected bti" << std::endl;
989 std::cout <<
"In TRACO num. " <<
number() <<
" BTI trig. in pos " <<
pos <<
" outside K acceptance (";
1005 if (btitrig->
code() == 8) {
1006 for (
int is =
step - 4; is <
step; is++) {
1028 std::cout <<
"DTTracoChip::addTrig: step out of range: " <<
step;
1029 std::cout <<
" trigger not added!" << std::endl;
1037 std::cout <<
"DTTracoChip::addTrig: adding trigger:" << std::endl;
1045 std::cout <<
"DTTracoChip::nTrig: step out of range: " <<
step;
1046 std::cout <<
" 0 returned!" << std::endl;
1054 std::cout <<
"DTTracoChip::trigger: step out of range: " <<
step;
1055 std::cout <<
" empty pointer returned!" << std::endl;
1059 std::cout <<
"DTTracoChip::trigger: requested trigger doesn't exist: " <<
n;
1060 std::cout <<
" empty pointer returned!" << std::endl;
1069 std::cout <<
"DTTracoChip::triggerData: step out of range: " <<
step;
1070 std::cout <<
" dummy trigger returned!" << std::endl;
1074 std::cout <<
"DTTracoChip::trigger: requested trigger doesn't exist: " <<
n;
1075 std::cout <<
" dummy trigger returned!" << std::endl;
1079 return (*p)->data();
1118 std::cout <<
"DTTracoChip::useSecondTrack: step out of range: " <<
step;
1119 std::cout <<
" 0 returned!" << std::endl;
1127 std::cout <<
"DTTracoChip::edgeBTI: step out of range: " <<
step;
1128 std::cout <<
" 0 returned!" << std::endl;
1135 std::vector<DTTracoCand>::const_iterator
p;
1141 if (lr == 1 && (*p).position() == 1 && (*p).BtiTrig()->code() == 8)
1213 if (qual == 3 || qual == 1)
1215 if (qual == 2 || qual == 0)
1217 if (qual == 6 || qual == 5 || qual == 4)
1222 idpsir = ipsi - iphir / 8;
1264 idpsir = ipsi - dpsir;
1274 std::cout <<
"DTTracoChip::calculateAngles :" << std::endl;
1277 std::cout <<
" ipsi = " << ipsi <<
" iphir = " << iphir;
1278 std::cout <<
" idpsir = " << idpsir << std::endl;
1280 std::cout <<
"Angles are calculated from LUT parameters from DB!" << std::endl;
1294 int bendAngINT = bendAng.
read(0, 9);
1297 if (
config()->BendingAngleCut() != -1 && bendAngINT > 2 * (
config()->BendingAngleCut())) {
1298 int absBendAng = tctrig->
DeltaPsiR() & 0x1FF;
1301 <<
"!! reject trigger" << std::endl;
1322 float Xin_max = Xin_min + K0;
1325 _PSIMAX[
i] =
int(2. *
h / distsl * (Xin_max - Xout_min) + K0 + 1.01);
1326 _PSIMIN[
i] =
int(2. *
h / distsl * (Xin_min - Xout_max) + K0);
1333 float Xout_min =
i * K0;
1334 float Xout_max = Xout_min + K0;
void setPosIn(int pos)
Set position of segments, inner.
LocalVector localDirection(const DTTrigData *) const override
NEWGEO Local direction in chamber of a trigger-data object.
LocalPoint localPosition(const DTBtiId) const
Local position in chamber of a BTI.
int btiNumber() const
Return parent BTI number.
int _PSIMAX[4 *DTConfig::NBTITC]
int station() const
Return the station number.
constexpr int32_t ceil(float num)
const DTBtiTrigData * BtiTrig() const
Return associated BTI trigger.
int btiSL() const
Return parent BTI superlayer.
int KRad() const
K par of the radial angle of corr center referred to plane sl.
int singleLflag(int i) const
Single LTRIG enabling on first/second tracks: F(S)LTMSK.
DTTracoChip * getTRACO(int n) const
Returns the required DTTracoChip. Return 0 if it doesn't exist.
void run()
Run TRACO algorithm.
int sortKascend(int i) const
Ascend. order for K sorting first/second tracks: F(S)HISM.
int nHTrig(int step)
Return number of DTBtiChip fired with a HTRIG (used by DTTracoChip)
int AdjBtiLTSuppressed(DTTracoCand *candidate)
Do suppression of LTRIG on adjacent TRACO.
int BTIC() const
BTIC traco parameter: must be equal to Btis ST parameter.
float cellPitch() const
Width of a cell (cm) i.e. distance between ywo wires.
int K() const
Return trigger K parameter.
void setX(int x)
Set trigger X parameter.
void setK(int k)
Set trigger K parameter.
void calculateAngles(DTTracoTrig *)
Calculate trigger angles.
void setFlag(int step, int ext=0)
Set flags for multiple trigger detection between cons. TRACO's.
void addTrig(int step, DTTracoTrig *)
Add a TRACO trigger.
void setTracoAcceptances()
Compute traco chip acceptances.
int DeltaPsiR() const
Return DeltaPsiR.
int BTIC() const
BTIC parameter.
DTTracoTrigData data() const
Return the data part.
float phiCh() const
Rotation angle of chamber (deg)
void resetVar()
Reset all variables but preview.
int prefInner(int i) const
Preference to inner on first/second tracks: F(S)SLMSK.
Geom::Phi< T > phi() const
DTTrigGeom * geom() const
Return trigger geometry.
int qdec() const
Return the trigger code in new format.
bool lutFromDBFlag()
Return lut computation option (DB/geometry)
int K() const
Return K-KRAD.
int BendingAngleCut() const
Bending angle cut for all stations and triggers : KPRGCOM.
void add_btiT(int step, int pos, const DTBtiTrigData *btitrig)
Add a BTI trigger to the TRACO.
void setCodeIn(int code)
Set trigger code, inner segment.
int step() const
Return step.
int K() const
Return trigger K parameter.
int position() const
Return position inside TRACO.
int singleLenab(int i) const
Single LTRIG accept enabling on first/second tracks LTF.
void setPosOut(int pos)
Set position of segments, outer.
float psiRad(int sl=0) const
Radial angle of correlator center in mrad referred to plane sl.
void print() const
Print candidate.
int nTrig(int step) const
Return the number of trigger candidates.
~DTTracoChip()
Destructor.
DTTracoCand * bestCand(int itk, std::vector< DTTracoCand > &tclist)
Get the best inner/outer candidate.
int insideAngWindow(DTTracoTrig *) const
Check if a trigger is inside the angular acceptance window.
int code() const
Return trigger code.
DTChamberId ChamberId() const override
Return chamber identifier.
GlobalPoint CMSPosition() const
Position in CMS frame.
int useSecondTrack(int step) const
a flag for a usable second track
float distSL() const
Distance between the phi view superlayers (cms)
DTTrigGeom * geom() const
Associated geometry.
int X() const
Return trigger X parameter.
void setCodeOut(int code)
Set trigger code, outer segment.
int edgeBTI(int step, int io, int lr) const
flags for HTRIG in edge BTI
int step() const
Return Bunch crossing.
Abs< T >::type abs(const T &t)
void raiseOverlap(int step)
raise overlap flag
int traco() const
Returns the traco.
DTChamberId statId() const
Identifier of the associated chamber.
BitArray< N > twoComplement() const
std::vector< DTTracoCand > _outerCand[DTConfigTraco::NSTEPL - DTConfigTraco::NSTEPF+1]
int storeUncorr(DTTracoTrig *tctrig, DTTracoCand *inner, DTTracoCand *outer, int tkn)
Store uncorrelated trigger.
void setEqOut(int eq)
Set bti trigger equation of segments, outer.
static const int NSTEPL
Constants: first and last step to start trigger finding.
std::vector< DTTracoTrig * > _tracotrig[DTConfigTraco::NSTEPL - DTConfigTraco::NSTEPF+1]
DTTracoTrigData triggerData(int step, unsigned n) const
Return the data part of the requested trigger.
void addDTBtiTrig(const DTBtiTrigData *btitrig)
Add a BTI trigger to the list.
void setAngles(int psi, int psir, int dpsir)
Set trigger angles.
DTTracoChip(DTTracoCard *card, int n, DTConfigTraco *config)
Constructor.
int TcKToll(int i) const
K tollerance for correlation in TRACO: F(S)PRGCOMP.
int prefHtrig(int i) const
Preference to HTRIG on first/second tracks: F(S)HTPRF.
std::vector< DTTracoCand > _innerCand[DTConfigTraco::NSTEPL - DTConfigTraco::NSTEPF+1]
DTTracoChip & operator=(const DTTracoChip &traco)
Assignment operator.
float cellH() const
Height of a cell (cm)
void print() const override
Print.
static const int RESOLPSIR
Costant: resulution for psiR (phi)
int debug() const
Debug flag.
int qdec() const
Return the trigger code in new format.
float phiSLOffset()
Superlayer offset in chamber front-end frame, in cm.
GlobalPoint CMSPosition(const DTTrigData *trig) const
CMS position in chamber of a trigger-data object.
int TcReuse(int i) const
Recycling of TRACO cand. in inner/outer SL : REUSEI/REUSEO.
bool useAcceptParamFlag()
Return acceptance flag.
void DoAdjBtiLts(DTTracoCand *candidate, std::vector< DTTracoCand > &tclist)
Do suppression of LTRIG on BTI close to selected HTRIG.
DTTracoTrig * trigger(int step, unsigned n) const
Return the requested trigger.
void assign(const int p, const int n, const int val)
int storeCorr(DTTracoTrig *tctrig, DTTracoCand *inner, DTTracoCand *outer, int tkn)
Check correlation and store correlated trigger.
void setPVCorr(int ic)
Set trigger preview correlation bit.
int wheel() const
Return the wheel number.
const DTConfigLUTs * config_luts() const
Return LUTS config for this chamber (=minicrate)
DTConfigTraco * config() const
Configuration set.
void setEqIn(int eq)
Set bti trigger equation of segments, inner.
BitArray< 32 > _flag[DTConfigTraco::NSTEPL - DTConfigTraco::NSTEPF+1]
int _PSIMIN[4 *DTConfig::NBTITC]
void print() const override
Print.
static unsigned int const shift
int X() const
Return local X coordinate.
int KRAD() const
KRAD traco parameter.
int code() const
Return trigger code.
int get_x(int addr) const
DTTSTheta * TSTh() const
Return TSTheta.
BitArray< DTConfigTraco::NSTEPL+2 > _bxlts
int TcBxLts() const
Suppr. of LTRIG in 4 BX before HTRIG: LTS.
void setPV(int first, int code, int K, int io)
Set trigger preview parameters.
int LVALIDIFH() const
Flag for Low validation parameter.
unsigned read(const int p, const int n) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
static const int RESOLPSI
Costants: esolution for psi and DeltaPsiR (phi_B)
int number() const
Return TRACO number.
int eq() const
Return triggering equation.
void setPV(int step, int ntrk, int code, int K)
Set the preview values for a TRACO trigger.
int element(const int pos) const
int get_k(int addr) const
int nTrig(int step)
Return number of DTBtiChip fired (used by DTTracoChip)