47 _card(card), _config(conf) {
53 std::cout <<
"DTTracoChip constructor called for TRACO number " << n << std::endl;
147 _geom(traco._geom), _id(traco._id), _card(traco._card), _luts(traco._luts) {
151 std::vector<DTTracoCand>::const_iterator
p;
160 std::vector<DTTracoTrig*>::const_iterator
p1;
206 std::vector<DTTracoCand>::const_iterator
p;
215 std::vector<DTTracoTrig*>::const_iterator
p1;
232 std::vector<DTTracoTrig*>::iterator
p1;
260 std::cout <<
"DTTracoChip::run: wrong TRACO number " <<
_id.
traco() << std::endl;
267 std::cout <<
"\n STEP: " << is << std::endl;
268 std::cout <<
" ================" << std::endl;
280 std::cout <<
" candidates " << std::endl;
288 if(
config()->LVALIDIFH()){
306 for(
int itk=0; itk < 2; itk++){
319 std::cout<<
"Best candidates for track " << itk+1 <<
" are:"<<std::endl;
331 if(inner==0&&outer==0)
379 std::cout<<
"Checking overlap I-II track..." <<std::endl;
387 std::cout <<
"II track at step " << std::hex << is-1 <<std::dec <<
"marked rej."<< std::endl;
388 std::cout <<
"I track overlap flag at step " << std::hex << is << std::dec <<
" setted" << std::endl;
396 std::cout <<
"overlap flag step = " << isd+DTConfigTraco::NSTEPF <<
402 for(
int cc=1;cc<=
nTrig(is);cc++){
425 if(prevTraco->
edgeBTI(step,1,2))
427 if(prevTraco->
edgeBTI(step,2,2))
432 if(nextTraco->
edgeBTI(step,1,1))
434 if(nextTraco->
edgeBTI(step,2,1))
440 for(
int i=0;
i<6;
i++){
449 std::cout <<
"Flags set for bx=" << step << std::endl;
467 if(tclist.size()<1)
return 0;
472 stable_sort( tclist.begin(),tclist.end() );
474 !(tclist.size()==2 && tclist[0].K()==tclist[1].K()) ) {
475 reverse( tclist.begin(),tclist.end() );
477 std::cout <<
"Reversing order of sorted candidate list..." << std::endl;
490 std::cout <<
"DTTracoChip::findBest - Looking for track number " << itk+1 << std::endl ;
491 std::cout <<
"Sorted std::vector of usable track candidates is:" << std::endl;
493 for(std::vector<DTTracoCand>::iterator
p=tclist.begin();
p<tclist.end();
p++){
495 std::cout <<
" DTTracoChip Candidate # " << i++;
499 std::cout <<
"--------------------------------------------------" << std::endl;
506 std::vector<DTTracoCand>::iterator
p;
507 for ( p = tclist.begin(); p < tclist.end(); ++
p ) {
512 std::cout <<
"Candidate # " << i <<
" supp. because next to H in adiacent Tracos" << std::endl;
516 if( (*p).BtiTrig()->code()==8 )
return &(*p);
517 if( bestltrig==0 ) bestltrig=&(*p);
530 std::vector<DTTracoCand>::iterator
p;
531 for(p=tclist.begin();p<tclist.end();p++){
532 if( (*p).BtiTrig()->code()<8 &&
533 abs( (*p).BtiTrig()->btiNumber() -
539 std::cout <<
"Suppressed because adiacent to H trig" <<std::endl;
553 candidate->
position()==1 )
return 1;
570 std::cout <<
"DTTracoChip::setPV called for candidates : " << std::endl;
571 if(inner)inner->
print();
572 if(outer)outer->
print();
573 std::cout <<
"--------------------------------------------------" << std::endl;
580 int first = (itk==0) ? 1 : 0;
586 if(inner!=0&&outer!=0) {
611 }
else if(inner==0&&outer!=0) {
613 }
else if(inner!=0&&outer==0) {
625 int K=candidate->
K();
631 tct->
setPV(first, cod, K, ioflag);
634 std::cout <<
"Selected candidate stored for preview is: ";
644 int is = tctrig->
step();
648 std::cout <<
"DTTracoChip::storeCorr called with candidates: " << std::endl;
649 if(inner)inner->
print();
650 if(outer)outer->
print();
651 std::cout <<
"--------------------------------------------------" << std::endl;
674 int xq1 = inner->
X();
675 int xq2 = outer->
X();
677 kcor = (xq1-xq2)+512;
678 int kq1 = int(shift/2.) * (inner->
BtiTrig()->
K()-
BTIC()) + 512;
679 int kq2 = int(shift/2.) * (outer->
BtiTrig()->
K()-
BTIC()) + 512;
682 int kd1 =
abs(kcor/16-kq1/16);
683 int kd2 =
abs(kcor/16-kq2/16);
691 std::cout <<
"*************************************************************";
704 std::cout <<
"*************************************************************";
715 tctrig->
setK(kcor - 512);
741 else if( tctrig->
qdec()==4 &&
757 std::cout <<
"*************************************************************";
759 std::cout <<
" Correlation was successfull: ";
765 std::cout <<
"*************************************************************";
774 std::cout <<
"*************************************************************";
776 std::cout <<
" No correlation possible ";
778 std::cout <<
"*************************************************************";
792 int is = tctrig->
step();
796 std::cout <<
"DTTracoChip::storeUncorr called with candidates: " << std::endl;
797 if(inner)inner->
print();
798 if(outer)outer->
print();
799 std::cout <<
"--------------------------------------------------" << std::endl;
807 if(inner!=0&&outer!=0) {
837 }
else if(inner==0&&outer!=0) {
839 }
else if(inner!=0&&outer==0) {
857 std::cout <<
"Low accepted because LVALIDIFH on...." << std::endl;
870 std::cout <<
"Single low trigger discarded by preview and "
871 <<
"priority selector for ltmsk!" <<std::endl;
880 if(candidate==outer &&
config()->TcReuse(0) && inner)
890 std::cout <<
"Low trigger suppressed because H in next 4 bx "<<
891 " and LTS flag on...." << std::endl;
910 if(candidate==outer &&
config()->TcReuse(0) && inner)
920 int kucor = (int)( 0.5*shift * (candidate->
BtiTrig()->
K()-
BTIC()) );
922 tctrig->
setX( candidate->
X() );
957 std::cout <<
"L rejected because outside angular window!" << std::endl;
965 std::cout <<
"*************************************************************";
973 std::cout <<
"*************************************************************";
986 std::cout <<
"DTTracoChip::add_btiT: wrong position: " <<
pos;
987 std::cout <<
"trigger not added!" << std::endl;
991 std::cout <<
"DTTracoChip::add_btiT: step out of range: " <<
step;
992 std::cout <<
"trigger not added!" << std::endl;
996 if(!
config()->usedBti(pos)) {
998 std::cout <<
"DTTracoChip::add_btiT: position: " <<
pos;
999 std::cout <<
"has disconnected bti" << std::endl;
1011 std::cout <<
"In TRACO num. " <<
number() <<
" BTI trig. in pos " << pos <<
" outside K acceptance (";
1020 if(pos<=DTConfigTraco::NBTITC){
1029 if(btitrig->
code()==8){
1030 for(
int is=step-4;is<
step;is++){
1031 if(is>0&&is<=DTConfigTraco::NSTEPL)
_bxlts.
set(is);
1044 std::cout <<
" to TRACO " <<
_id.
traco() <<
" at position " << pos << std::endl;
1054 std::cout <<
"DTTracoChip::addTrig: step out of range: " <<
step;
1055 std::cout <<
" trigger not added!" << std::endl;
1063 std::cout <<
"DTTracoChip::addTrig: adding trigger:"<< std::endl;
1073 std::cout <<
"DTTracoChip::nTrig: step out of range: " <<
step;
1074 std::cout <<
" 0 returned!" << std::endl;
1083 std::cout <<
"DTTracoChip::trigger: step out of range: " <<
step;
1084 std::cout <<
" empty pointer returned!" << std::endl;
1088 std::cout <<
"DTTracoChip::trigger: requested trigger doesn't exist: " <<
n;
1089 std::cout <<
" empty pointer returned!" << std::endl;
1092 std::vector<DTTracoTrig*>::const_iterator
p =
1100 std::cout <<
"DTTracoChip::triggerData: step out of range: " <<
step;
1101 std::cout <<
" dummy trigger returned!" << std::endl;
1105 std::cout <<
"DTTracoChip::trigger: requested trigger doesn't exist: " <<
n;
1106 std::cout <<
" dummy trigger returned!" << std::endl;
1109 std::vector<DTTracoTrig*>::const_iterator
p =
1111 return (*p)->data();
1154 std::cout <<
"DTTracoChip::useSecondTrack: step out of range: " <<
step;
1155 std::cout <<
" 0 returned!" << std::endl;
1164 std::cout <<
"DTTracoChip::edgeBTI: step out of range: " <<
step;
1165 std::cout <<
" 0 returned!" << std::endl;
1172 std::vector<DTTracoCand>::const_iterator
p;
1178 if(lr==1 && (*p).position()==1 && (*p).BtiTrig()->code()==8 )
1252 if(qual==3 || qual==1)
1254 if(qual==2 || qual==0)
1256 if(qual==6 || qual==5 || qual==4)
1261 idpsir = ipsi - iphir/8;
1306 idpsir = ipsi-dpsir;
1316 std::cout <<
"DTTracoChip::calculateAngles :" << std::endl;
1318 std::cout << std::dec <<
"K = " << tct->
K() <<
" X = " << tct->
X();
1319 std::cout <<
" ipsi = " << ipsi <<
" iphir = " << iphir;
1320 std::cout <<
" idpsir = " << idpsir << std::endl;
1322 std::cout <<
"Angles are calculated from LUT parameters from DB!" << std::endl;
1338 int bendAngINT = bendAng.
read(0,9);
1341 if(
config()->BendingAngleCut()!= -1 &&
1342 bendAngINT > 2*(
config()->BendingAngleCut())) {
1343 int absBendAng = tctrig->
DeltaPsiR() & 0x1FF;
1345 std::cout <<
"Attention: abs(bendAng)=" << absBendAng <<
" > "
1370 float Xin_max = Xin_min + K0;
1372 float Xout_max = 3 * DTConfig::NBTITC * K0;
1373 _PSIMAX[
i] = int( 2.*h/distsl * (Xin_max - Xout_min) + K0 + 1.01 );
1374 _PSIMIN[
i] = int( 2.*h/distsl * (Xin_min - Xout_max) + K0 );
1380 float Xin_max = 2. * DTConfig::NBTITC * K0 + shiftSL;
1381 float Xout_min = i * K0;
1382 float Xout_max = Xout_min + K0;
1383 _PSIMAX[DTConfig::NBTITC+
i] = int( 2.*h/distsl * (Xin_max - Xout_min) + K0 + 1.01 );
1384 _PSIMIN[DTConfig::NBTITC+
i] = int( 2.*h/distsl * (Xin_min - Xout_max) + K0 );
1392 std::cout <<
"Acceptance of mt ports for offset (cell unit) "
void setPosIn(int pos)
Set position of segments, inner.
int _PSIMAX[4 *DTConfig::NBTITC]
DTTSTheta * TSTh() const
Return TSTheta.
GlobalPoint CMSPosition() const
Position in CMS frame.
DTChamberId ChamberId() const
Return chamber identifier.
std::vector< DTTracoTrig * > _tracotrig[DTConfigTraco::NSTEPL-DTConfigTraco::NSTEPF+1]
GlobalPoint CMSPosition(const DTTrigData *trig) const
CMS position in chamber of a trigger-data object.
DTTrigGeom * geom() const
Associated geometry.
DTTracoTrigData data() const
Return the data part.
DTConfigTraco * config() const
Configuration set.
void run()
Run TRACO algorithm.
DTTrigGeom * geom() const
Return trigger geometry.
int nHTrig(int step)
Return number of DTBtiChip fired with a HTRIG (used by DTTracoChip)
float phiCh() const
Rotation angle of chamber (deg)
int insideAngWindow(DTTracoTrig *) const
Check if a trigger is inside the angular acceptance window.
float cellPitch() const
Width of a cell (cm) i.e. distance between ywo wires.
int AdjBtiLTSuppressed(DTTracoCand *candidate)
Do suppression of LTRIG on adjacent TRACO.
int eq() const
Return triggering equation.
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 BTIC() const
BTIC parameter.
void resetVar()
Reset all variables but preview.
Geom::Phi< T > phi() const
int KRAD() const
KRAD traco parameter.
int prefHtrig(int i) const
Preference to HTRIG on first/second tracks: F(S)HTPRF.
int KRad() const
K par of the radial angle of corr center referred to plane sl.
int K() const
Return K-KRAD.
int LVALIDIFH() const
Flag for Low validation parameter.
bool lutFromDBFlag()
Return lut computation option (DB/geometry)
int singleLenab(int i) const
Single LTRIG accept enabling on first/second tracks LTF.
void add_btiT(int step, int pos, const DTBtiTrigData *btitrig)
Add a BTI trigger to the TRACO.
DTTracoChip * getTRACO(int n) const
Returns the required DTTracoChip. Return 0 if it doesn't exist.
DTConfigLUTs * config_luts() const
Return LUTS config for this chamber (=minicrate)
void setCodeIn(int code)
Set trigger code, inner segment.
void setPosOut(int pos)
Set position of segments, outer.
~DTTracoChip()
Destructor.
int traco() const
Returns the traco.
int BTIC() const
BTIC traco parameter: must be equal to Btis ST parameter.
DTTracoCand * bestCand(int itk, std::vector< DTTracoCand > &tclist)
Get the best inner/outer candidate.
int step() const
Return step.
int step() const
Return Bunch crossing.
float distSL() const
Distance between the phi view superlayers (cms)
void setCodeOut(int code)
Set trigger code, outer segment.
float cellH() const
Height of a cell (cm)
int BendingAngleCut() const
Bending angle cut for all stations and triggers : KPRGCOM.
void raiseOverlap(int step)
raise overlap flag
int number() const
Return TRACO number.
unsigned read(const int p, const int n) 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.
const DTBtiTrigData * BtiTrig() const
Return associated BTI trigger.
std::vector< DTTracoCand > _innerCand[DTConfigTraco::NSTEPL-DTConfigTraco::NSTEPF+1]
static const int NSTEPL
Constants: first and last step to start trigger finding.
DTTracoTrig * trigger(int step, unsigned n) const
Return the requested trigger.
int btiNumber() const
Return parent BTI number.
void addDTBtiTrig(const DTBtiTrigData *btitrig)
Add a BTI trigger to the list.
void setAngles(int psi, int psir, int dpsir)
Set trigger angles.
int TcBxLts() const
Suppr. of LTRIG in 4 BX before HTRIG: LTS.
DTTracoChip(DTTracoCard *card, int n, DTConfigTraco *config)
Constructor.
int edgeBTI(int step, int io, int lr) const
flags for HTRIG in edge BTI
BitArray< 32 > _flag[DTConfigTraco::NSTEPL-DTConfigTraco::NSTEPF+1]
DTTracoChip & operator=(const DTTracoChip &traco)
Assignment operator.
static const int RESOLPSIR
Costant: resulution for psiR (phi)
int TcKToll(int i) const
K tollerance for correlation in TRACO: F(S)PRGCOMP.
int prefInner(int i) const
Preference to inner on first/second tracks: F(S)SLMSK.
float phiSLOffset()
Superlayer offset in chamber front-end frame, in cm.
DTChamberId statId() const
Identifier of the associated chamber.
int qdec() const
Return the trigger code in new format.
int element(const int pos) const
int btiSL() const
Return parent BTI superlayer.
BitArray< DTConfigTraco::NSTEPL+2 > _bxlts
bool useAcceptParamFlag()
Return acceptance flag.
void DoAdjBtiLts(DTTracoCand *candidate, std::vector< DTTracoCand > &tclist)
Do suppression of LTRIG on BTI close to selected HTRIG.
BitArray< N > twoComplement() const
int K() const
Return trigger K parameter.
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.
DTTracoTrigData triggerData(int step, unsigned n) const
Return the data part of the requested trigger.
int qdec() const
Return the trigger code in new format.
void print() const
Print.
void print() const
Print.
void setUsed()
set candidate used (unusable)
int X() const
Return trigger X parameter.
void setEqIn(int eq)
Set bti trigger equation of segments, inner.
int singleLflag(int i) const
Single LTRIG enabling on first/second tracks: F(S)LTMSK.
int _PSIMIN[4 *DTConfig::NBTITC]
static unsigned int const shift
int useSecondTrack(int step) const
a flag for a usable second track
void setUnused()
set candidate unused (usable)
void setPV(int first, int code, int K, int io)
Set trigger preview parameters.
float psiRad(int sl=0) const
Radial angle of correlator center in mrad referred to plane sl.
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
int TcReuse(int i) const
Recycling of TRACO cand. in inner/outer SL : REUSEI/REUSEO.
int wheel() const
Return the wheel number.
static const int RESOLPSI
Costants: esolution for psi and DeltaPsiR (phi_B)
int X() const
Return local X coordinate.
int debug() const
Debug flag.
int position() const
Return position inside TRACO.
int sortKascend(int i) const
Ascend. order for K sorting first/second tracks: F(S)HISM.
tuple size
Write out results.
void setPV(int step, int ntrk, int code, int K)
Set the preview values for a TRACO trigger.
LocalVector localDirection(const DTTrigData *) const
NEWGEO Local direction in chamber of a trigger-data object.
int code() const
Return trigger code.
int K() const
Return trigger K parameter.
int DeltaPsiR() const
Return DeltaPsiR.
void print() const
Print candidate.
int nTrig(int step) const
Return the number of trigger candidates.
int nTrig(int step)
Return number of DTBtiChip fired (used by DTTracoChip)
int code() const
Return trigger code.