ATLAS Offline Software
CMApatterns.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include <math.h>
8 
10 
12 
14  TRIGdistance(99999.,99999.);
15 
17 
19  unsigned long int debug) :
20  RPCtrigDataObject(0,"CMA patterns"),
21  m_debug(debug),
22  m_sector(sector),m_cma_parameters(cma),
23 m_pivot0("pivot0 ",PATTERNidentity(Pivot,0),CMAparameters::pivot_channels),
24 m_pivot1("pivot1 ",PATTERNidentity(Pivot,1),CMAparameters::pivot_channels),
25 m_lowPt0("lowPt0 ",PATTERNidentity(LowPt,0),CMAparameters::confirm_channels),
26 m_lowPt1("lowPt1 ",PATTERNidentity(LowPt,1),CMAparameters::confirm_channels),
27 m_highPt0("highPt0",PATTERNidentity(HighPt,0),CMAparameters::confirm_channels),
28 m_highPt1("highPt1",PATTERNidentity(HighPt,1),CMAparameters::confirm_channels)
29 {}
30 
33  m_debug(patterns.debug()),
34  m_sector(patterns.sector()),
35  m_cma_parameters(&patterns.cma_parameters()),
36  m_pivot0(patterns.pivot0()),
37  m_pivot1(patterns.pivot1()),
38  m_lowPt0(patterns.lowPt0()),
39  m_lowPt1(patterns.lowPt1()),
40  m_highPt0(patterns.highPt0()),
41  m_highPt1(patterns.highPt1())
42 {}
43 
46 {
47  static_cast<RPCtrigDataObject&>(*this) =
48  static_cast<const RPCtrigDataObject&>(patterns);
49  m_debug = patterns.debug();
50  m_sector = patterns.sector();
51  m_cma_parameters = &patterns.cma_parameters();
52  m_pivot0 = patterns.pivot0();
53  m_pivot1 = patterns.pivot1();
54  m_lowPt0 = patterns.lowPt0();
55  m_lowPt1 = patterns.lowPt1();
56  m_highPt0 = patterns.highPt0();
57  m_highPt1 = patterns.highPt1();
58  return *this;
59 }
60 
61 bool
63 {
64  if(m_sector == patterns.sector())
65  {
66  if (m_cma_parameters->id()==patterns.cma_parameters().id()) return true;
67  }
68  return false;
69 }
70 
71 bool
73 {
74  return !(*this == patterns);
75 }
76 
77 
78 bool
80 {
81  if(m_sector < patterns.sector())
82  {
83  if (m_cma_parameters->id() < patterns.cma_parameters().id()) return true;
84  }
85  return false;
86 }
87 
88 void
90 {
91  int station = digit->decoding().lvl1_station();
92  int cabling = digit->decoding().cabling_code();
93 
94  CMAinput IO = NoInput;
95  int channel = 0;
96  int layer = 0;
97 
99  {
100  if(IO == Pivot)
101  {
103  else m_pivot0.set(digit,channel);
104  }
105  else if (IO == LowPt)
106  {
108  else m_lowPt0.set(digit,channel);
109  }
110  else if (IO == HighPt)
111  {
113  else m_highPt0.set(digit,channel);
114  }
115  }
116 }
117 
120 {
121 
123 
124  for(int i=0;i<pattern.size();++i)
125  {
126  if(pattern.test(i))
127  {
128  int cluster_size = 0;
129  do { ++cluster_size; } while( pattern.test(i+cluster_size) );
130 
131  int decl_lower = 1;
132  int decl_upper = cluster_size;
133 
134  switch (cluster_size%2)
135  {
136  case 0:
137  for( ;decl_lower+1 < decl_upper && decl_lower<=3; ++decl_lower)
138  {
139  pattern.unset(i - 1 + decl_lower);
140  pattern.unset(i - 1 + decl_upper);
141  --decl_upper;
142  }
143  case 1:
144  for( ;decl_lower+1 < decl_upper && decl_lower<=3; ++decl_lower)
145  {
146  pattern.unset(i - 1 + decl_lower);
147  pattern.unset(i - 1 + decl_upper);
148  --decl_upper;
149  }
150  }
151  i += (cluster_size - 1);
152  }
153  }
154  return pattern;
155 }
156 
157 
160 {
161 
162  int left = 1;
163  int right = 1;
164 
165  bitPATTERN result(layer0.name(),layer0.id(),layer0.size());
166  bitPATTERN tmp1(layer1);
167  bitPATTERN tmp2(layer1);
168 
169  result |= layer0 & layer1;
170  for(int i=0;i<left;++i) result |= layer0 & (tmp1<<1);
171  for(int i=0;i<right;++i) result |= layer0 & (tmp2>>1);
172 
173  for (int i=0;i<result.size();++i)
174  {
175  if(result.test(i))
176  {
177  layer0.unset(i);
178  layer0.unset(i-1);
179  layer0.unset(i+1);
180  layer1.unset(i);
181  layer1.unset(i-1);
182  layer1.unset(i+1);
183  }
184  }
185 
186  return result;
187 }
188 
189 void
191 {
192  if(fabsf(NEW.first) < fabsf(OLD.first)) OLD = NEW;
193 }
194 
195 void
197 const
198 {
199 
200  lowTr = no_distance;
201  highTr = no_distance;
202 
209 
210  bitPATTERN pivot2 = majority(pivot0,pivot1);
211  bitPATTERN lowPt2 = majority(lowPt0,lowPt1);
212  bitPATTERN highPt2 = majority(highPt0,highPt1);
213 
214  update_distance( lowest_distance(pivot2,lowPt2) , lowTr );
215  update_distance( lowest_distance(pivot2,lowPt0) , lowTr );
216  update_distance( lowest_distance(pivot2,lowPt1) , lowTr );
217  update_distance( lowest_distance(pivot0,lowPt2) , lowTr );
218  update_distance( lowest_distance(pivot1,lowPt2) , lowTr );
219 
220  update_distance( lowest_distance(pivot2,highPt2) , highTr );
221  update_distance( lowest_distance(pivot2,highPt0) , highTr );
222  update_distance( lowest_distance(pivot2,highPt1) , highTr );
223  update_distance( lowest_distance(pivot0,highPt2) , highTr );
224  update_distance( lowest_distance(pivot1,highPt2) , highTr );
225 }
226 
229 const
230 {
231  if ( !pivot.any() || !confirm.any() ) return no_distance;
232 
234 
235  for(int i=0;i<pivot.size();++i)
236  {
237  if(const RPCdigit* pivot_digit = pivot[i])
238  {
239  for(int j=0;j<confirm.size();++j)
240  {
241  if(const RPCdigit* confirm_digit = confirm[j])
242  {
243  update_distance(distance(pivot_digit,confirm_digit),value);
244  }
245  }
246  }
247  }
248 
249  return value;
250 }
251 
253 CMApatterns::distance(const RPCdigit* pivot,const RPCdigit* confirm) const
254 {
255 
256 
258  float pivrad = 0;
259  float conrad = 0;
260  if( pivot->station_radius(pivrad) && confirm->station_radius(conrad) )
261  {
262  if(pivot->decoding().view() == Eta)
263  {
264  if(pivot->station_eta(value.second))
265  {
266  float Zprime = pivot->z()*(conrad/pivrad);
267  value.first = confirm->z() - Zprime;
268  }
269  }
270  else if (pivot->decoding().view() == Phi)
271  {
272  float pivphi = 0;
273  float conphi = 0;
274  float staphi = 0;
275  if( pivot->phi(pivphi) &&
276  confirm->phi(conphi) &&
277  pivot->station_phi(staphi) &&
278  pivot->station_eta(value.second) )
279  {
280  float Sprime = tan(pivphi-staphi)*conrad;
281  value.first = tan(conphi-staphi)*conrad - Sprime;
282  }
283  }
284  }
285  return value;
286 }
287 
288 const CMAtrigger
290 {
291 
292 
293 
294  if(type == HardwareEmulation)
295  {
296  return CMAtrigger(type,this);
297  }
298  else
299  {
302  if(!signatures.empty())
303  {
304  if(signatures.top().trigger().searchForHigh())
306  return signatures.top();
307  }
308  else return CMAtrigger(type,this);
309  }
310 }
311 
312 void
314 {
315 
316 
321 
322  bitPATTERN pivot2 = majority(pivot0,pivot1);
323  bitPATTERN lowPt2 = majority(lowPt0,lowPt1);
324 
325  search_signatures(type,Low,signatures,pivot2,lowPt2);
330 }
331 
332 void
334 {
335 
336 
339 
340  bitPATTERN highPt2 = majority(highPt0,highPt1);
341 
342  TrigSigns tmp;
343 
344  while(!signatures.empty())
345  {
346  CMAtrigger signature = signatures.top();
347  signatures.pop();
348  if(signature.trigger().searchForHigh())
349  {
350  search_signatures(type,High,signature,highPt2);
351  search_signatures(type,High,signature,highPt0);
352  search_signatures(type,High,signature,highPt1);
353  tmp.push(signature);
354  }
355  }
356 
357  signatures = tmp;
358 }
359 
360 
361 void
364  const bitPATTERN& pivot,
365  const bitPATTERN& confirm) const
366 {
367 
368  if ( !pivot.any() || !confirm.any() ) return;
369 
370  for(int i=0;i<pivot.size();++i)
371  {
372  if(const RPCdigit* pivot_digit = pivot[i])
373  {
374  // Start searching for trigger signature
375  CMAtrigger trigger_result(algoType,this);
376 
377  for(int j=0;j<confirm.size();++j)
378  {
379  if(const RPCdigit* confirm_digit = confirm[j])
380  {
381  TRIGdistance d = distance(pivot_digit,confirm_digit);
382  CMAtrigger signature(algoType,this);
383 
384  if(algoType == GeometricAlgo)
385  {
386  signature = trigger_window(d,trigType);
387  }
388  else if (algoType == LogicEmulation)
389  {
390  signature = trigger_threshold(i,j,trigType);
391  }
392 
393  if(trigType == Low)
394  {
395  signature.set_pivot(pivot_digit);
396  signature.set_lowPt(confirm_digit);
397  }
398  else if(trigType == High)
399  {
400  signature.set_highPt(confirm_digit);
401  }
402  signature.set_width(d.first);
403  signature.set_Kpatt(i);
404  trigger_result += signature;
405  }
406 
407  //if ( trigger_result.trigger().highest(trigType) ) break;
408  }
409  if(trigger_result.trigger().type()!=None)
410  signatures.push(trigger_result);
411  }
412  }
413 }
414 
415 
416 void
418  CMAtrigger& trigger_result,
419  const bitPATTERN& confirm) const
420 {
421 
422  if ( !confirm.any() ) return;
423 
424 
425  const RPCdigit* pivot_digit = trigger_result.pivot_hit();
426  const int Kpatt = trigger_result.Kpatt();
427 
428  // Start searching for trigger signature
429  CMAtrigger signature(algoType,this);
430 
431  for(int j=0;j<confirm.size();++j)
432  {
433  if(const RPCdigit* confirm_digit = confirm[j])
434  {
435  TRIGdistance d = distance(pivot_digit,confirm_digit);
436 
437  if(algoType == GeometricAlgo)
438  {
439  signature = trigger_window(d,trigType);
440  }
441  else if (algoType == LogicEmulation)
442  {
443  signature = trigger_threshold(Kpatt,j,trigType);
444  }
445 
446  if(trigType == Low)
447  {
448  signature.set_pivot(pivot_digit);
449  signature.set_lowPt(confirm_digit);
450  }
451  else if(trigType == High)
452  {
453  signature.set_highPt(confirm_digit);
454  }
455  signature.set_width(d.first);
456  signature.set_Kpatt(Kpatt);
457  trigger_result += signature;
458  }
459 
460  //if ( trigger_result.trigger().highest(trigType) ) break;
461  }
462 }
463 
464 
467  const bitPATTERN& highPt) const
468 {
469 
470 
471  CMAtrigger trigger_result(GeometricAlgo,this);
472 
473  if ( !pivot.any() || !lowPt.any() ) return trigger_result;
474 
475  for(int i=0;i<pivot.size();++i)
476  {
477  if(const RPCdigit* pivot_digit = pivot[i])
478  {
479  // Start searching for Low Pt trigger signature
480  for(int j=0;j<lowPt.size();++j)
481  {
482  if(const RPCdigit* confirm_digit = lowPt[j])
483  {
484  TRIGdistance d = distance(pivot_digit,confirm_digit);
485  CMAtrigger signature = trigger_window(d,Low);
486  signature.set_pivot(pivot_digit);
487  signature.set_lowPt(confirm_digit);
488  trigger_result += signature;
489  }
490 
491  // if Low Pt Third threshold has fired
492  if ( trigger_result.trigger().searchForHigh() )
493  {
494  // Start searching for High Pt trigger signature
495  for(int k=0;k<highPt.size();++k)
496  {
497  if(const RPCdigit* confirm_digit = highPt[k])
498  {
499  TRIGdistance d=distance(pivot_digit,confirm_digit);
500  CMAtrigger signature = trigger_window(d,High);
501  signature.set_highPt(confirm_digit);
502  trigger_result += signature;
503  }
504  if( trigger_result.trigger().highest(High) ) break;
505  }
506  }
507  if ( trigger_result.trigger().highest(High) ) break;
508  }
509  }
510  if ( trigger_result.trigger().highest(High) ) break;
511  }
512 
513  return trigger_result;
514 }
515 
516 
519  const bitPATTERN& highPt0,const bitPATTERN& highPt1) const
520 {
521 
522  CMAtrigger trigger_result(GeometricAlgo,this);
523 
524  if ( !pivot.any() || !lowPt.any() ) return trigger_result;
525 
526  for(int i=0;i<pivot.size();++i)
527  {
528  if(const RPCdigit* pivot_digit = pivot[i])
529  {
530  // Start searching for Low Pt trigger signature
531  for(int j=0;j<lowPt.size();++j)
532  {
533  if(const RPCdigit* confirm_digit = lowPt[j])
534  {
535  TRIGdistance d = distance(pivot_digit,confirm_digit);
536  CMAtrigger signature = trigger_window(d,Low);
537  signature.set_pivot(pivot_digit);
538  signature.set_lowPt(confirm_digit);
539  trigger_result += signature;
540  }
541 
542  // if Low Pt Third threshold has fired
543  if ( trigger_result.trigger().searchForHigh() )
544  {
545  // Start searching for High Pt trigger signature in plane 0
546  for(int k=0;k<highPt0.size();++k)
547  {
548  if(const RPCdigit* confirm_digit = highPt0[k])
549  {
550  TRIGdistance d=distance(pivot_digit,confirm_digit);
551  CMAtrigger signature = trigger_window(d,High);
552  signature.set_highPt(confirm_digit);
553  trigger_result += signature;
554  }
555  if( trigger_result.trigger().highest(High) ) break;
556  }
557  }
558 
559  // if Low Pt Third threshold has fired
560  if ( trigger_result.trigger().searchForHigh() )
561  {
562  // Start searching for High Pt trigger signature in plane 1
563  for(int k=0;k<highPt1.size();++k)
564  {
565  if(const RPCdigit* confirm_digit = highPt1[k])
566  {
567  TRIGdistance d=distance(pivot_digit,confirm_digit);
568  CMAtrigger signature = trigger_window(d,High);
569  signature.set_highPt(confirm_digit);
570  trigger_result += signature;
571  }
572  if( trigger_result.trigger().highest(High) ) break;
573  }
574  }
575  if ( trigger_result.trigger().highest(High) ) break;
576  }
577  }
578  if ( trigger_result.trigger().highest(High) ) break;
579  }
580 
581  return trigger_result;
582 }
583 
586 {
587 
588  if (type == None) return CMAtrigger(GeometricAlgo,this);
589 
590  if(m_cma_parameters->id().type() == Eta)
591  {
592  //implement the geometric coincidence for the eta projection
593  int upper_threshold = (type == Low)? 2 : 4;
594  int lower_threshold = (type == Low)? 0 : 3;
595 
596  for(int i=upper_threshold; i >= lower_threshold;--i)
597  {
598  if (windows(dist.first,dist.second,i,m_sector%32))
599  {
601  if ( (i%3) == 0 ) threshold = FirstTh;
602  else if ( (i%3) == 1 ) threshold = SecondTh;
603  else if ( (i%3) == 2 ) threshold = ThirdTh;
604  return CMAtrigger(GeometricAlgo,type,threshold,this);
605  }
606  }
607  }
608  else if (m_cma_parameters->id().type() == Phi)
609  {
610  //implement the geometric coincidence for the phi projection
611  if(type == Low)
612  {
613  // set the trigger window width equal to 10 centimeters
614  if(fabsf(dist.first)<10.0)
615  return CMAtrigger(GeometricAlgo,type,ThirdTh,this);
616  }
617  else if (type == High)
618  {
619  // set the trigger window width equal to 10 centimeters
620  if(fabsf(dist.first)<10.0)
621  return CMAtrigger(GeometricAlgo,type,SecondTh,this);
622  }
623  }
624 
625  return CMAtrigger(GeometricAlgo,this);
626 }
627 
630 {
631 
632  if (type == None) return CMAtrigger(LogicEmulation,this);
633 
634  const int pivch = CMAparameters::pivot_channels;
635  const int conch = CMAparameters::confirm_channels;
636 
637  const bool* program = 0;
638 
639  if(type == Low)
640  {
641  if(const CMAprogram* prog = cma_parameters().lowPt_program() )
642  {
643  // avoid to use the Phi program for the time being ///////////
644  if(cma_parameters().id().type() == Phi) //
645  return CMAtrigger(LogicEmulation,type,ThirdTh,this); //
647  program = prog->registers();
648  }
649  else return CMAtrigger(LogicEmulation,type,ThirdTh,this);
650  }
651  else
652  {
653  if(const CMAprogram* prog = cma_parameters().highPt_program() )
654  {
655  // avoid to use the Phi program for the time being ///////////
656  if(cma_parameters().id().type() == Phi) //
657  return CMAtrigger(LogicEmulation,type,ThirdTh,this); //
659  program = prog->registers();
660  }
661  else return CMAtrigger(LogicEmulation,type,ThirdTh,this);
662  }
663 
664 
665  for(int th=2;th>=0;--th)
666  {
667  int pos = th*pivch*conch + pivot*conch + confirm;
668  if(*(program+pos))
669  {
670  Threshold threshold = static_cast<Threshold>(th);
672  }
673  }
674  return CMAtrigger(LogicEmulation,this);
675 }
676 
679 {
680  load_digit(digit);
681  return *this;
682 }
683 
684 void CMApatterns::Print(std::ostream& stream,bool detail) const
685 {
686  //unsigned int upper = 19;
687  //unsigned int lower = 17;
688 
689  unsigned int upper = 95;
690  unsigned int lower = 45;
691 
692  for(int i=0;i<80;++i) stream << (char) upper;
693  stream << std::endl;
694 
695  stream << name() << " giving input to: logic sector = " << m_sector
696  << ", sector type = " << cma_parameters().sector_type() << std::endl;
697  stream << cma_parameters() << std::endl;
698 
699  //bitPATTERN layer0 = decluster(pivot0());
700  //bitPATTERN layer1 (pivot1());
701 
704 
705  //layer0.Print(stream,detail); // test for declustering
706  //stream << majority(layer0,layer1); // test for majority logic
707  //layer1.Print(stream,detail); // test for majority logic
708  //layer0.Print(stream,detail); // test for majority logic
709 
714 
715  for(int i=0;i<80;++i) stream << (char) lower;
716  stream << std::endl;
717 }
718 
719 void
721 {
722 
723  if(type == None) return;
724 
725  int run = 0;
726  int event = 0;
727  unsigned int long debug = m_debug;
728  int subsystem = (m_sector<32)? 0 : 1;
729  int proj = cma_parameters().id().type();
730  int sector = m_sector%32;
731  int PADadd = cma_parameters().id().PAD_index();
732  int lohi = (type == Low) ? 0 : 1;
733  int address[2] = { cma_parameters().id().eta_index(),
734  cma_parameters().id().phi_index() };
735  int localAdd = cma_parameters().id().Ixx_index();
736 
737 
738  // Instanciate the Matrix
739 
740  auto matrix = std::make_unique<Matrix>(run,event,debug,subsystem,proj,sector,PADadd,lohi,
741  address,localAdd, NOBXS, BCZERO);
742 
744  // ****************** START PROGRAMMING THE MATRIX ****************** //
746 
747 
748  // Loading pivot data into Matrix
749  // load_data(0,0,m_pivot0,matrix);
750  // load_data(0,1,m_pivot1,matrix);
751 
752 
753  // Specify the readout threshold to be transmitted into the readout
754  matrix->setKReadOut(0);
755 
756  // Specify the AND/OR logic for a matrix input (0=pivot, 1=coincidence)
757  matrix->setLocalDirection(0,7);
758  matrix->setLocalDirection(1,7);
759 
760  // Specify the width of the pulse signal in Matrix clock thick (320 Mhz)
761  matrix->setPulseWidth(4);
762 
763  if(type == Low)
764  {
765  // Loading pivot data into Matrix
766  load_data(0,0,m_pivot0,matrix.get());
767  load_data(0,1,m_pivot1,matrix.get());
768 
769  // Load the theshold registers into Matrix hardware simulation
770  const CMAprogram* program = cma_parameters().lowPt_program();
771  const int pivot_ch = CMAparameters::pivot_channels;
772 
773  CMAword ovl1 = 0x0;
774  CMAword ovl2 = 0x0;
775  CMAword maj_th0 = 0x2;
776  CMAword maj_th1 = 0x2;
777  CMAword maj_th2 = 0x2;
778 
779 
780  if(program)
781  {
782  if(cma_parameters().id().type() == Phi)
783  {
784  const uint32_t* bytes = program->bytes();
785 
786  for(int th=0;th<3;++th) // loop over thresholds
787  for (int ch=0; ch<pivot_ch; ++ch) // loop over channels
788  for (int by=0;by<2;++by) // loop over bytes
789  {
790  // G.Bruni, M.Corradi 1/3/2010 set phi roads for new cabling
791  if (cma_parameters().conf_type() != CMAparameters::Atlas){
792  matrix->setRoad(th,ch,by,0xffffffff); // old cabling, keep the phi roads all open
793  } else {
794  int pos = th*pivot_ch*2 + ch*2 + by;
795  matrix->setRoad(th,ch,by,bytes[pos]);
796  }
797  }
798  }
799  else
800  {
801 
802  const uint32_t* bytes = program->bytes();
803 
804  for(int th=0;th<3;++th) // loop over thresholds
805  for (int ch=0; ch<pivot_ch; ++ch) // loop over channels
806  for (int by=0;by<2;++by) // loop over bytes
807  {
808  int pos = th*pivot_ch*2 + ch*2 + by;
809  matrix->setRoad(th,ch,by,bytes[pos]);
810  }
811  }
812 
813  ovl1 = program->overlap1();
814  ovl2 = program->overlap2();
815  maj_th0 = program->trig_thr0_maj_reg();
816  maj_th1 = program->trig_thr1_maj_reg();
817  maj_th2 = program->trig_thr2_maj_reg();
818 
819 
820  }
821  else if (!program && cma_parameters().id().type() == Phi)
822  {
823  // open only the Phi matrix if no program is found
824 
825  for(int th=0;th<3;++th) // loop over thresholds
826  for (int ch=0; ch<pivot_ch; ++ch) // loop over channels
827  for (int by=0;by<2;++by) // loop over bytes
828  {
829  matrix->setRoad(th,ch,by,0xffffffff);
830  }
831  }
832 
833  // Load the Majority logic setup
834  matrix->setMajority(0,maj_th0);
835  matrix->setMajority(1,maj_th1);
836  matrix->setMajority(2,maj_th2);
837 
838  //matrix->setMask1(0,1);
839 
840  // Load the Overlap flag
841  matrix->setMatOverlap(0, ovl1);
842  matrix->setMatOverlap(1, ovl2);
843 
844  // Load Low Pt plane data into Matrix
845  load_data(1,0,m_lowPt0,matrix.get());
846  load_data(1,1,m_lowPt1,matrix.get());
847 
848  // Execute the matrix simulation
849  matrix->execute();
850  m_low_pt_matrix = std::move(matrix);
851  }
852  else
853  {
854  // Load the theshold registers into Matrix hardware simulation
855  const CMAprogram* program = cma_parameters().highPt_program();
856  const int pivot_ch = CMAparameters::pivot_channels;
857 
858  CMAword ovl1 = 0x0;
859  CMAword ovl2 = 0x0;
860  CMAword maj_th0 = 0x1;
861  CMAword maj_th1 = 0x1;
862  CMAword maj_th2 = 0x1;
863 
864  if(program)
865  {
866 
867  if(cma_parameters().id().type() == Phi)
868  {
869  const uint32_t* bytes = program->bytes();
870 
871  for(int th=0;th<3;++th) // loop over thresholds
872  for (int ch=0; ch<pivot_ch; ++ch) // loop over channels
873  for (int by=0;by<2;++by) // loop over bytes
874  {
875  // G.Bruni, M.Corradi 1/3/2010 set phi roads for new cabling
876  if (cma_parameters().conf_type()!= CMAparameters::Atlas){
877  matrix->setRoad(th,ch,by,0xffffffff); // old cabling, keep the phi roads all open
878  } else {
879  int pos = th*pivot_ch*2 + ch*2 + by;
880  matrix->setRoad(th,ch,by,bytes[pos]);
881  }
882  }
883  }
884  else
885  {
886  const uint32_t* bytes = program->bytes();
887  for(int th=0;th<3;++th) // loop over thresholds
888  for (int ch=0; ch<pivot_ch; ++ch) // loop over channels
889  for (int by=0;by<2;++by) // loop over bytes
890  {
891  int pos = th*pivot_ch*2 + ch*2 + by;
892  matrix->setRoad(th,ch,by,bytes[pos]);
893  }
894  }
895 
896  ovl1 = program->overlap1();
897  ovl2 = program->overlap2();
898  maj_th0 = program->trig_thr0_maj_reg();
899  maj_th1 = program->trig_thr1_maj_reg();
900  maj_th2 = program->trig_thr2_maj_reg();
901 
902  }
903  else if (!program && cma_parameters().id().type() == Phi)
904  {
905 
906  // open only the Phi matrix if no program is found
907 
908  for(int th=0;th<3;++th) // loop over thresholds
909  for (int ch=0; ch<pivot_ch; ++ch) // loop over channels
910  for (int by=0;by<2;++by) // loop over bytes
911  {
912  matrix->setRoad(th,ch,by,0xffffffff);
913  }
914  }
915  // Load the Majority logic setup
916  matrix->setMajority(0,maj_th0);
917  matrix->setMajority(1,maj_th1);
918  matrix->setMajority(2,maj_th2);
919 
920  // Load the Overlap flag
921  matrix->setMatOverlap(0, ovl1);
922  matrix->setMatOverlap(1, ovl2);
923 
924  // Load High Pt plane data into Matrix
925  load_data(1,0,m_highPt0,matrix.get());
926  load_data(1,1,m_highPt1,matrix.get());
927 
928  if(!m_low_pt_matrix) create_hardware(Low, NOBXS, BCZERO);
929 
930  // Put the Low Pt patterns into the High Pt Matrix input
931  matrix->putPatt(m_low_pt_matrix.get());
932 
933  // Execute the matrix simulation
934  matrix->execute();
935  m_high_pt_matrix = std::move(matrix);
936  }
937 }
938 
939 void
941  Matrix* mat)
942 {
943 
944  if(pattern.any())
945  {
946  for (int i=0;i<pattern.size();++i)
947  {
948  if(pattern.test(i)) mat->putData(side,layer,i,pattern[i]->time());
949  }
950  }
951 }
952 
953 Matrix*
955 {
956 
957  if(!m_low_pt_matrix) create_hardware(Low, NOBXS, BCZERO);
958  return m_low_pt_matrix.get();
959 }
960 
961 
962 Matrix*
964 {
965 
966  if(!m_high_pt_matrix) create_hardware(High, NOBXS, BCZERO);
967  return m_high_pt_matrix.get();
968 }
MuonParameters::lowPt
@ lowPt
Definition: MuonParamDefs.h:52
Matrix
Definition: Trigger/TrigT1/TrigT1RPChardware/TrigT1RPChardware/Matrix.h:15
TrigType
TrigType
Definition: TRIGGERidentity.h:17
RPCdigit::station_radius
bool station_radius(float &) const
Definition: RPCdigit.h:81
CMApatterns::find_trigger
CMAtrigger find_trigger(const bitPATTERN &, const bitPATTERN &, const bitPATTERN &) const
Definition: CMApatterns.cxx:466
DumpGeoConfig.prog
prog
Definition: DumpGeoConfig.py:167
ThirdTh
@ ThirdTh
Definition: TRIGGERidentity.h:18
mergePhysValFiles.pattern
pattern
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:26
CMApatterns::m_pivot0
bitPATTERN m_pivot0
Definition: CMApatterns.h:35
CMApatterns::operator<
bool operator<(const CMApatterns &) const
Definition: CMApatterns.cxx:79
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
CMApatterns::m_low_pt_matrix
std::unique_ptr< Matrix > m_low_pt_matrix
Definition: CMApatterns.h:42
get_generator_info.result
result
Definition: get_generator_info.py:21
DeMoUpdate.tmp2
string tmp2
Definition: DeMoUpdate.py:1168
CMAtrigger::set_Kpatt
void set_Kpatt(int Kpatt)
Definition: CMAtrigger.cxx:130
CMApatterns::majority
bitPATTERN majority(bitPATTERN &, bitPATTERN &) const
Definition: CMApatterns.cxx:159
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:28
CMApatterns::m_pivot1
bitPATTERN m_pivot1
Definition: CMApatterns.h:36
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
Pivot
@ Pivot
Definition: CMAparameters.h:18
patterns
std::vector< std::string > patterns
Definition: listroot.cxx:187
HighPt
@ HighPt
Definition: CMAparameters.h:18
bitPATTERN
Definition: bitPATTERN.h:13
hist_file_dump.d
d
Definition: hist_file_dump.py:137
CMAidentity::type
ViewType type() const
Definition: CMAidentity.cxx:117
CMAparameters::lowPt_program
const CMAprogram * lowPt_program() const
Definition: CMAparameters.cxx:18
bitPATTERN::unset
void unset(int)
Definition: bitPATTERN.cxx:61
mat
GeoMaterial * mat
Definition: LArDetectorConstructionTBEC.cxx:53
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
CMApatterns::m_sector
int m_sector
Definition: CMApatterns.h:32
LowPt
@ LowPt
Definition: CMAparameters.h:18
bitPATTERN::set
void set(const RPCdigit *, int)
Definition: bitPATTERN.cxx:54
bitPATTERN::Print
void Print(std::ostream &, bool detail) const
Definition: bitPATTERN.cxx:243
bitPATTERN::id
const PATTERNidentity & id(void) const
Definition: bitPATTERN.h:39
CMApatterns::load_data
void load_data(int, int, const bitPATTERN &, Matrix *)
Definition: CMApatterns.cxx:940
athena.value
value
Definition: athena.py:122
CMApatterns::no_distance
static const TRIGdistance no_distance
Definition: CMApatterns.h:24
detail
Definition: extract_histogram_tag.cxx:14
CMApatterns::m_lowPt0
bitPATTERN m_lowPt0
Definition: CMApatterns.h:37
CMApatterns::give_high_pt_matrix
Matrix * give_high_pt_matrix(uint NOBXS, uint BCZERO)
Definition: CMApatterns.cxx:963
upper
int upper(int c)
Definition: LArBadChannelParser.cxx:49
CMAparameters::id
const CMAidentity & id() const
Definition: CMAparameters.cxx:17
Phi
@ Phi
Definition: RPCdef.h:8
CMApatterns::highPt0
const bitPATTERN & highPt0(void) const
Definition: CMApatterns.h:93
RPCdigit::phi
bool phi(float &) const
Definition: RPCdigit.cxx:217
CMApatterns::TRIGdistance
std::pair< float, float > TRIGdistance
Definition: CMApatterns.h:23
checkRpcDigits.digit
digit
Definition: checkRpcDigits.py:186
CMApatterns::pivot0
const bitPATTERN & pivot0(void) const
Definition: CMApatterns.h:89
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
CMApatterns::m_high_pt_matrix
std::unique_ptr< Matrix > m_high_pt_matrix
Definition: CMApatterns.h:43
CMAtrigger::set_highPt
void set_highPt(const RPCdigit *)
Definition: CMAtrigger.cxx:154
CMApatterns::operator==
bool operator==(const CMApatterns &) const
Definition: CMApatterns.cxx:62
CMAparameters::confirm_channels
static constexpr int confirm_channels
Definition: CMAparameters.h:70
CMApatterns::operator<<
CMApatterns & operator<<(const RPCdigit *)
Definition: CMApatterns.cxx:678
CMApatterns::m_highPt1
bitPATTERN m_highPt1
Definition: CMApatterns.h:40
CMAtrigger::set_pivot
void set_pivot(const RPCdigit *)
Definition: CMAtrigger.cxx:142
SecondTh
@ SecondTh
Definition: TRIGGERidentity.h:18
PATTERNidentity
Definition: PATTERNidentity.h:13
TRT::Hit::side
@ side
Definition: HitInfo.h:83
MuonParameters::highPt
@ highPt
Definition: MuonParamDefs.h:51
CMAtrigger::pivot_hit
const RPCdigit * pivot_hit(void) const
Definition: CMAtrigger.h:59
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
CMApatterns::trigger_threshold
CMAtrigger trigger_threshold(int, int, TrigType) const
Definition: CMApatterns.cxx:629
CMApatterns::cma_parameters
const CMAparameters & cma_parameters(void) const
Definition: CMApatterns.h:87
CMAprogram::trig_thr0_maj_reg
uint8_t trig_thr0_maj_reg() const
Definition: CMAprogram.h:245
python.TriggerHandler.th
th
Definition: TriggerHandler.py:296
CMApatterns::operator=
CMApatterns operator=(const CMApatterns &)
Definition: CMApatterns.cxx:45
CMApatterns::coincidence_distance
void coincidence_distance(TRIGdistance &, TRIGdistance &) const
Definition: CMApatterns.cxx:196
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
RPCdigit::station_phi
bool station_phi(float &) const
Definition: RPCdigit.h:93
lumiFormat.i
int i
Definition: lumiFormat.py:92
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
CMAprogram::trig_thr1_maj_reg
uint8_t trig_thr1_maj_reg() const
Definition: CMAprogram.h:251
BaseObject::name
std::string name() const
Definition: BaseObject.h:23
CMApatterns::trigger_window
CMAtrigger trigger_window(TRIGdistance, TrigType) const
Definition: CMApatterns.cxx:585
CMApatterns::m_lowPt1
bitPATTERN m_lowPt1
Definition: CMApatterns.h:38
CMAparameters::highPt_program
const CMAprogram * highPt_program() const
Definition: CMAparameters.cxx:19
CMApatterns::create_hardware
void create_hardware(TrigType, uint NOBXS, uint BCZERO)
Definition: CMApatterns.cxx:720
run
Definition: run.py:1
fitman.by
by
Definition: fitman.py:411
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
GeometricAlgo
@ GeometricAlgo
Definition: CMAtrigger.h:20
CMApatterns::m_cma_parameters
const CMAparameters * m_cma_parameters
Definition: CMApatterns.h:33
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
CMApatterns::m_debug
unsigned long int m_debug
Definition: CMApatterns.h:30
CMApatterns::load_digit
void load_digit(const RPCdigit *)
Definition: CMApatterns.cxx:89
make_coralServer_rep.proj
proj
Definition: make_coralServer_rep.py:48
CMApatterns::highPt1
const bitPATTERN & highPt1(void) const
Definition: CMApatterns.h:94
CMAinput
CMAinput
Definition: CMAparameters.h:18
CMApatterns::update_distance
void update_distance(const TRIGdistance &, TRIGdistance &) const
Definition: CMApatterns.cxx:190
CMApatterns::debug
unsigned long int debug(void) const
Definition: CMApatterns.h:84
CMAprogram
Definition: CMAprogram.h:11
CMAparameters::give_connection
bool give_connection(int, int, CMAinput &, int &, int &) const
Definition: CMAparameters.cxx:578
CMAprogram::bytes
const uint32_t * bytes(void) const
Definition: CMAprogram.h:120
CMApatterns::m_highPt0
bitPATTERN m_highPt0
Definition: CMApatterns.h:39
CMAidentity::Ixx_index
int Ixx_index() const
Definition: CMAidentity.cxx:123
CMApatterns::Print
void Print(std::ostream &, bool) const
Definition: CMApatterns.cxx:684
CMApatterns::lowPt1
const bitPATTERN & lowPt1(void) const
Definition: CMApatterns.h:92
CMAtrigger
Definition: CMAtrigger.h:23
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
debug
const bool debug
Definition: MakeUncertaintyPlots.cxx:53
RPCtrigDataObject
Definition: RPCtrigDataObject.h:15
CMAidentity::eta_index
int eta_index() const
Definition: CMAidentity.cxx:120
bitPATTERN::any
bool any(void) const
Definition: bitPATTERN.cxx:78
TrackCorrType::None
@ None
threshold
Definition: chainparser.cxx:74
Low
@ Low
Definition: TRIGGERidentity.h:17
CMAprogram::overlap1
uint32_t overlap1(void) const
Definition: CMAprogram.h:123
CMAtrigger::Kpatt
int Kpatt(void) const
Definition: CMAtrigger.h:63
ChainNameParser::signatures
std::vector< std::string > signatures(const std::string &chain)
Definition: ChainNameParser.cxx:210
RPCdigit
Definition: RPCdigit.h:16
RTTAlgmain.address
address
Definition: RTTAlgmain.py:55
CMAword
uint32_t CMAword
Definition: Lvl1Def.h:17
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
Lvl1RPCalgo
Lvl1RPCalgo
Definition: CMAtrigger.h:20
CMAidentity::PAD_index
int PAD_index() const
Definition: CMAidentity.cxx:122
CMApatterns::lowPt0
const bitPATTERN & lowPt0(void) const
Definition: CMApatterns.h:91
CMApatterns::TrigSigns
std::priority_queue< CMAtrigger > TrigSigns
Definition: CMApatterns.h:27
CMAtrigger::set_width
void set_width(const float width)
Definition: CMAtrigger.cxx:136
HardwareEmulation
@ HardwareEmulation
Definition: CMAtrigger.h:20
python.testIfMatch.matrix
matrix
Definition: testIfMatch.py:66
TRIGGERidentity::highest
bool highest(TrigType) const
Definition: TRIGGERidentity.cxx:61
windows.h
CMAprogram::trig_thr2_maj_reg
uint8_t trig_thr2_maj_reg() const
Definition: CMAprogram.h:257
Threshold
Threshold
Definition: TRIGGERidentity.h:18
CMAtrigger::trigger
const TRIGGERidentity & trigger(void) const
Definition: CMAtrigger.h:57
CMAparameters
Definition: CMAparameters.h:21
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
RPCdecoder::view
ViewType view(void) const
Definition: RPCdecoder.cxx:150
NoInput
@ NoInput
Definition: CMAparameters.h:18
High
@ High
Definition: TRIGGERidentity.h:17
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TRIGGERidentity::searchForHigh
bool searchForHigh(void) const
Definition: TRIGGERidentity.cxx:71
CMApatterns::search_for_lowPt
void search_for_lowPt(Lvl1RPCalgo, TrigSigns &) const
Definition: CMApatterns.cxx:313
RPCdigit::decoding
const RPCdecoder & decoding(void) const
Definition: RPCdigit.h:48
CMAprogram.h
CMApatterns::search_signatures
void search_signatures(Lvl1RPCalgo, TrigType, TrigSigns &, const bitPATTERN &, const bitPATTERN &) const
Definition: CMApatterns.cxx:362
RPCdigit::z
float z(void) const
Definition: RPCdigit.h:55
CMApatterns::lowest_distance
const TRIGdistance lowest_distance(const bitPATTERN &, const bitPATTERN &) const
Definition: CMApatterns.cxx:228
CMApatterns.h
CMAidentity::phi_index
int phi_index() const
Definition: CMAidentity.cxx:121
CMApatterns::sector
int sector(void) const
Definition: CMApatterns.h:86
CMAparameters::pivot_channels
static constexpr int pivot_channels
Definition: CMAparameters.h:69
CMAprogram::overlap2
uint32_t overlap2(void) const
Definition: CMAprogram.h:124
CMApatterns::pivot1
const bitPATTERN & pivot1(void) const
Definition: CMApatterns.h:90
CMApatterns::decluster
bitPATTERN decluster(const bitPATTERN &) const
Definition: CMApatterns.cxx:119
TRIGGERidentity::type
TrigType type(void) const
Definition: TRIGGERidentity.h:44
CMApatterns
Definition: CMApatterns.h:21
CMApatterns::distance
const TRIGdistance distance(const RPCdigit *, const RPCdigit *) const
Definition: CMApatterns.cxx:253
CMAparameters::Atlas
@ Atlas
Definition: CMAparameters.h:23
CMAtrigger::set_lowPt
void set_lowPt(const RPCdigit *)
Definition: CMAtrigger.cxx:148
DeMoSetup.confirm
confirm
Definition: DeMoSetup.py:46
bitPATTERN::size
int size(void) const
Definition: bitPATTERN.h:41
CMApatterns::CMApatterns
CMApatterns(int, const CMAparameters *, unsigned long int)
Definition: CMApatterns.cxx:18
L1TopoSimulationConfig.subsystem
subsystem
Definition: L1TopoSimulationConfig.py:242
CMApatterns::operator!=
bool operator!=(const CMApatterns &) const
Definition: CMApatterns.cxx:72
CMApatterns::search_for_highPt
void search_for_highPt(Lvl1RPCalgo, TrigSigns &) const
Definition: CMApatterns.cxx:333
CablingObject::sector_type
int sector_type() const
Definition: CablingObject.cxx:14
FirstTh
@ FirstTh
Definition: TRIGGERidentity.h:18
CMApatterns::give_trigger
const CMAtrigger give_trigger(Lvl1RPCalgo) const
Definition: CMApatterns.cxx:289
CMApatterns::give_low_pt_matrix
Matrix * give_low_pt_matrix(uint NOBXS, uint BCZERO)
Definition: CMApatterns.cxx:954
Eta
@ Eta
Definition: RPCdef.h:8
fitman.k
k
Definition: fitman.py:528
LogicEmulation
@ LogicEmulation
Definition: CMAtrigger.h:20
RPCdigit::station_eta
bool station_eta(float &) const
Definition: RPCdigit.cxx:227
windows
int windows(float distance, float eta_pivot, int thr, int sector)
Definition: windows.cxx:14