15 TRIGdistance(99999.,99999.);
20 unsigned long int debug) :
92 int station = digit->decoding().lvl1_station();
93 int cabling = digit->decoding().cabling_code();
103 if(layer)
m_pivot1.set(digit,channel);
106 else if (IO ==
LowPt)
108 if(layer)
m_lowPt1.set(digit,channel);
125 for(
int i=0;i<pattern.size();++i)
129 int cluster_size = 0;
130 do { ++cluster_size; }
while( pattern.test(i+cluster_size) );
133 int decl_upper = cluster_size;
135 switch (cluster_size%2)
138 for( ;decl_lower+1 < decl_upper && decl_lower<=3; ++decl_lower)
140 pattern.unset(i - 1 + decl_lower);
141 pattern.unset(i - 1 + decl_upper);
146 for( ;decl_lower+1 < decl_upper && decl_lower<=3; ++decl_lower)
148 pattern.unset(i - 1 + decl_lower);
149 pattern.unset(i - 1 + decl_upper);
153 i += (cluster_size - 1);
171 result |= layer0 & layer1;
172 for(
int i=0;i<left;++i)
result |= layer0 & (tmp1<<1);
173 for(
int i=0;i<right;++i)
result |= layer0 & (tmp2>>1);
175 for (
int i=0;i<
result.size();++i)
194 if(std::fabs(NEW.first) < std::fabs(OLD.first)) OLD = NEW;
237 for(
int i=0;i<pivot.
size();++i)
239 if(
const RPCdigit* pivot_digit = pivot[i])
241 for(
int j=0;j<confirm.size();++j)
243 if(
const RPCdigit* confirm_digit = confirm[j])
262 if( pivot->
station_radius(pivrad) && confirm->station_radius(conrad) )
268 float Zprime = pivot->
z()*(conrad/pivrad);
269 value.first = confirm->z() - Zprime;
277 if( pivot->
phi(pivphi) &&
278 confirm->phi(conphi) &&
282 float Sprime = std::tan(pivphi-staphi)*conrad;
283 value.first = std::tan(conphi-staphi)*conrad - Sprime;
304 if(!signatures.empty())
306 if(signatures.top().trigger().searchForHigh())
308 return signatures.top();
346 while(!signatures.empty())
359 signatures = std::move(tmp);
370 if ( !pivot.
any() || !confirm.any() )
return;
372 for(
int i=0;i<pivot.
size();++i)
374 if(
const RPCdigit* pivot_digit = pivot[i])
379 for(
int j=0;j<confirm.size();++j)
381 if(
const RPCdigit* confirm_digit = confirm[j])
400 else if(trigType ==
High)
406 trigger_result += signature;
412 signatures.push(trigger_result);
424 if ( !confirm.any() )
return;
428 const int Kpatt = trigger_result.
Kpatt();
433 for(
int j=0;j<confirm.size();++j)
435 if(
const RPCdigit* confirm_digit = confirm[j])
453 else if(trigType ==
High)
459 trigger_result += signature;
475 if ( !pivot.
any() || !lowPt.any() )
return trigger_result;
477 for(
int i=0;i<pivot.
size();++i)
479 if(
const RPCdigit* pivot_digit = pivot[i])
482 for(
int j=0;j<lowPt.size();++j)
484 if(
const RPCdigit* confirm_digit = lowPt[j])
490 trigger_result += signature;
497 for(
int k=0;k<highPt.size();++k)
499 if(
const RPCdigit* confirm_digit = highPt[k])
504 trigger_result += signature;
515 return trigger_result;
526 if ( !pivot.
any() || !lowPt.any() )
return trigger_result;
528 for(
int i=0;i<pivot.
size();++i)
530 if(
const RPCdigit* pivot_digit = pivot[i])
533 for(
int j=0;j<lowPt.size();++j)
535 if(
const RPCdigit* confirm_digit = lowPt[j])
541 trigger_result += signature;
548 for(
int k=0;k<
highPt0.size();++k)
555 trigger_result += signature;
565 for(
int k=0;k<
highPt1.size();++k)
572 trigger_result += signature;
583 return trigger_result;
595 int upper_threshold = (
type ==
Low)? 2 : 4;
596 int lower_threshold = (
type ==
Low)? 0 : 3;
598 for(
int i=upper_threshold; i >= lower_threshold;--i)
616 if(fabsf(dist.first)<10.0)
622 if(fabsf(dist.first)<10.0)
639 const bool* program = 0;
649 program = prog->registers();
661 program = prog->registers();
667 for(
int th=2;th>=0;--th)
669 int pos = th*pivch*conch + pivot*conch + confirm;
691 unsigned int upper = 95;
692 unsigned int lower = 45;
694 for(
int i=0;i<80;++i) stream << (
char)
upper;
697 stream <<
name() <<
" giving input to: logic sector = " <<
m_sector
717 for(
int i=0;i<80;++i) stream << (
char) lower;
730 int subsystem = (
m_sector<32)? 0 : 1;
734 int lohi = (
type ==
Low) ? 0 : 1;
742 auto matrix = std::make_unique<Matrix>(
run,event,
debug,subsystem,proj,
sector,PADadd,lohi,
743 address,localAdd, NOBXS, BCZERO);
756 matrix->setKReadOut(0);
759 matrix->setLocalDirection(0,7);
760 matrix->setLocalDirection(1,7);
763 matrix->setPulseWidth(4);
786 const uint32_t* bytes = program->
bytes();
788 for(
int th=0;th<3;++th)
789 for (
int ch=0; ch<pivot_ch; ++ch)
790 for (
int by=0;by<2;++by)
794 matrix->setRoad(th,ch,by,0xffffffff);
796 int pos = th*pivot_ch*2 + ch*2 + by;
797 matrix->setRoad(th,ch,by,bytes[pos]);
804 const uint32_t* bytes = program->
bytes();
806 for(
int th=0;th<3;++th)
807 for (
int ch=0; ch<pivot_ch; ++ch)
808 for (
int by=0;by<2;++by)
810 int pos = th*pivot_ch*2 + ch*2 + by;
811 matrix->setRoad(th,ch,by,bytes[pos]);
827 for(
int th=0;th<3;++th)
828 for (
int ch=0; ch<pivot_ch; ++ch)
829 for (
int by=0;by<2;++by)
831 matrix->setRoad(th,ch,by,0xffffffff);
836 matrix->setMajority(0,maj_th0);
837 matrix->setMajority(1,maj_th1);
838 matrix->setMajority(2,maj_th2);
843 matrix->setMatOverlap(0, ovl1);
844 matrix->setMatOverlap(1, ovl2);
871 const uint32_t* bytes = program->
bytes();
873 for(
int th=0;th<3;++th)
874 for (
int ch=0; ch<pivot_ch; ++ch)
875 for (
int by=0;by<2;++by)
879 matrix->setRoad(th,ch,by,0xffffffff);
881 int pos = th*pivot_ch*2 + ch*2 + by;
882 matrix->setRoad(th,ch,by,bytes[pos]);
888 const uint32_t* bytes = program->
bytes();
889 for(
int th=0;th<3;++th)
890 for (
int ch=0; ch<pivot_ch; ++ch)
891 for (
int by=0;by<2;++by)
893 int pos = th*pivot_ch*2 + ch*2 + by;
894 matrix->setRoad(th,ch,by,bytes[pos]);
910 for(
int th=0;th<3;++th)
911 for (
int ch=0; ch<pivot_ch; ++ch)
912 for (
int by=0;by<2;++by)
914 matrix->setRoad(th,ch,by,0xffffffff);
918 matrix->setMajority(0,maj_th0);
919 matrix->setMajority(1,maj_th1);
920 matrix->setMajority(2,maj_th2);
923 matrix->setMatOverlap(0, ovl1);
924 matrix->setMatOverlap(1, ovl2);
948 for (
int i=0;i<pattern.size();++i)
950 if(pattern.test(i)) mat->putData(side,layer,i,pattern[i]->time());
char data[hepevt_bytes_allocation_ATLAS]
const std::string & name() const
static constexpr int confirm_channels
const CMAidentity & id() const
const CMAprogram * lowPt_program() const
static constexpr int pivot_channels
const CMAprogram * highPt_program() const
bool operator==(const CMApatterns &) const
void Print(std::ostream &, bool) const
std::unique_ptr< Matrix > m_low_pt_matrix
const TRIGdistance lowest_distance(const bitPATTERN &, const bitPATTERN &) const
const bitPATTERN & pivot1(void) const
unsigned long int debug(void) const
CMAtrigger find_trigger(const bitPATTERN &, const bitPATTERN &, const bitPATTERN &) const
std::unique_ptr< Matrix > m_high_pt_matrix
static const TRIGdistance no_distance
bitPATTERN decluster(const bitPATTERN &) const
Matrix * give_high_pt_matrix(uint NOBXS, uint BCZERO)
void coincidence_distance(TRIGdistance &, TRIGdistance &) const
void search_for_lowPt(Lvl1RPCalgo, TrigSigns &) const
bool operator<(const CMApatterns &) const
bool operator!=(const CMApatterns &) const
const bitPATTERN & lowPt0(void) const
std::priority_queue< CMAtrigger > TrigSigns
CMApatterns operator=(const CMApatterns &)
bitPATTERN majority(bitPATTERN &, bitPATTERN &) const
CMAtrigger trigger_threshold(int, int, TrigType) const
const bitPATTERN & pivot0(void) const
const CMAparameters * m_cma_parameters
CMApatterns & operator<<(const RPCdigit *)
const bitPATTERN & highPt0(void) const
const CMAparameters & cma_parameters(void) const
const TRIGdistance distance(const RPCdigit *, const RPCdigit *) const
void load_digit(const RPCdigit *)
void search_signatures(Lvl1RPCalgo, TrigType, TrigSigns &, const bitPATTERN &, const bitPATTERN &) const
const CMAtrigger give_trigger(Lvl1RPCalgo) const
CMAtrigger trigger_window(TRIGdistance, TrigType) const
void search_for_highPt(Lvl1RPCalgo, TrigSigns &) const
CMApatterns(int, const CMAparameters *, unsigned long int)
void create_hardware(TrigType, uint NOBXS, uint BCZERO)
void update_distance(const TRIGdistance &, TRIGdistance &) const
Matrix * give_low_pt_matrix(uint NOBXS, uint BCZERO)
unsigned long int m_debug
void load_data(int, int, const bitPATTERN &, Matrix *)
const bitPATTERN & highPt1(void) const
std::pair< float, float > TRIGdistance
const bitPATTERN & lowPt1(void) const
uint32_t overlap2(void) const
uint8_t trig_thr2_maj_reg() const
const uint32_t * bytes(void) const
uint8_t trig_thr0_maj_reg() const
uint8_t trig_thr1_maj_reg() const
uint32_t overlap1(void) const
void set_pivot(const RPCdigit *)
void set_highPt(const RPCdigit *)
void set_Kpatt(int Kpatt)
void set_width(const float width)
void set_lowPt(const RPCdigit *)
const RPCdigit * pivot_hit(void) const
const TRIGGERidentity & trigger(void) const
ViewType view(void) const
const RPCdecoder & decoding(void) const
bool station_phi(float &) const
bool station_eta(float &) const
bool station_radius(float &) const
RPCtrigDataObject(int, const std::string &)
bool searchForHigh(void) const
bool highest(TrigType) const
TrigType type(void) const
const PATTERNidentity & id(void) const
void Print(std::ostream &, bool detail) const
std::vector< std::string > patterns
int windows(float distance, float eta_pivot, int thr, int sector)