ATLAS Offline Software
Loading...
Searching...
No Matches
CMApatterns Class Reference

#include <CMApatterns.h>

Inheritance diagram for CMApatterns:
Collaboration diagram for CMApatterns:

Public Types

typedef std::pair< float, float > TRIGdistance
typedef std::list< CMAtriggerTRIGlist
typedef std::priority_queue< CMAtriggerTrigSigns

Public Member Functions

 CMApatterns (int, const CMAparameters *, unsigned long int)
 CMApatterns (const CMApatterns &)
CMApatterns operator= (const CMApatterns &)
bool operator== (const CMApatterns &) const
bool operator!= (const CMApatterns &) const
bool operator< (const CMApatterns &) const
void load_digit (const RPCdigit *)
CMApatternsoperator<< (const RPCdigit *)
unsigned long int debug (void) const
int sector (void) const
const CMAparameterscma_parameters (void) const
const bitPATTERNpivot0 (void) const
const bitPATTERNpivot1 (void) const
const bitPATTERNlowPt0 (void) const
const bitPATTERNlowPt1 (void) const
const bitPATTERNhighPt0 (void) const
const bitPATTERNhighPt1 (void) const
void coincidence_distance (TRIGdistance &, TRIGdistance &) const
const TRIGdistance lowest_distance (const bitPATTERN &, const bitPATTERN &) const
const TRIGdistance distance (const RPCdigit *, const RPCdigit *) const
const CMAtrigger give_trigger (Lvl1RPCalgo) const
Matrixgive_low_pt_matrix (uint NOBXS, uint BCZERO)
Matrixgive_high_pt_matrix (uint NOBXS, uint BCZERO)
void Print (std::ostream &, bool) const
void set_number (int)
int number (void) const
void PrintElement (std::ostream &, std::string, bool) const
ObjectType tag () const
const std::string & name () const

Static Public Attributes

static const TRIGdistance no_distance

Private Member Functions

bitPATTERN decluster (const bitPATTERN &) const
bitPATTERN majority (bitPATTERN &, bitPATTERN &) const
void update_distance (const TRIGdistance &, TRIGdistance &) const
CMAtrigger find_trigger (const bitPATTERN &, const bitPATTERN &, const bitPATTERN &) const
CMAtrigger find_trigger (const bitPATTERN &, const bitPATTERN &, const bitPATTERN &, const bitPATTERN &) const
CMAtrigger trigger_window (TRIGdistance, TrigType) const
CMAtrigger trigger_threshold (int, int, TrigType) const
void search_for_lowPt (Lvl1RPCalgo, TrigSigns &) const
void search_for_highPt (Lvl1RPCalgo, TrigSigns &) const
void search_signatures (Lvl1RPCalgo, TrigType, TrigSigns &, const bitPATTERN &, const bitPATTERN &) const
void search_signatures (Lvl1RPCalgo, TrigType, CMAtrigger &, const bitPATTERN &) const
void create_hardware (TrigType, uint NOBXS, uint BCZERO)
void load_data (int, int, const bitPATTERN &, Matrix *)

Private Attributes

unsigned long int m_debug
int m_sector
const CMAparametersm_cma_parameters
bitPATTERN m_pivot0
bitPATTERN m_pivot1
bitPATTERN m_lowPt0
bitPATTERN m_lowPt1
bitPATTERN m_highPt0
bitPATTERN m_highPt1
std::unique_ptr< Matrixm_low_pt_matrix
std::unique_ptr< Matrixm_high_pt_matrix
int m_number
ObjectType m_tag
std::string m_name

Detailed Description

Definition at line 20 of file CMApatterns.h.

Member Typedef Documentation

◆ TRIGdistance

typedef std::pair< float, float > CMApatterns::TRIGdistance

Definition at line 23 of file CMApatterns.h.

◆ TRIGlist

typedef std::list< CMAtrigger > CMApatterns::TRIGlist

Definition at line 26 of file CMApatterns.h.

◆ TrigSigns

typedef std::priority_queue< CMAtrigger > CMApatterns::TrigSigns

Definition at line 27 of file CMApatterns.h.

Constructor & Destructor Documentation

◆ CMApatterns() [1/2]

CMApatterns::CMApatterns ( int sector,
const CMAparameters * cma,
unsigned long int debug )

Definition at line 19 of file CMApatterns.cxx.

20 :
21 RPCtrigDataObject(0,"CMA patterns"),
24m_pivot0("pivot0 ",PATTERNidentity(Pivot,0),CMAparameters::pivot_channels),
25m_pivot1("pivot1 ",PATTERNidentity(Pivot,1),CMAparameters::pivot_channels),
26m_lowPt0("lowPt0 ",PATTERNidentity(LowPt,0),CMAparameters::confirm_channels),
27m_lowPt1("lowPt1 ",PATTERNidentity(LowPt,1),CMAparameters::confirm_channels),
28m_highPt0("highPt0",PATTERNidentity(HighPt,0),CMAparameters::confirm_channels),
29m_highPt1("highPt1",PATTERNidentity(HighPt,1),CMAparameters::confirm_channels)
30{}
@ LowPt
@ HighPt
@ Pivot
static constexpr int confirm_channels
static constexpr int pivot_channels
bitPATTERN m_highPt0
Definition CMApatterns.h:39
bitPATTERN m_pivot1
Definition CMApatterns.h:36
unsigned long int debug(void) const
Definition CMApatterns.h:84
bitPATTERN m_lowPt1
Definition CMApatterns.h:38
int sector(void) const
Definition CMApatterns.h:86
bitPATTERN m_highPt1
Definition CMApatterns.h:40
const CMAparameters * m_cma_parameters
Definition CMApatterns.h:33
bitPATTERN m_pivot0
Definition CMApatterns.h:35
unsigned long int m_debug
Definition CMApatterns.h:30
bitPATTERN m_lowPt0
Definition CMApatterns.h:37
RPCtrigDataObject(int, const std::string &)

◆ CMApatterns() [2/2]

CMApatterns::CMApatterns ( const CMApatterns & patterns)

Definition at line 32 of file CMApatterns.cxx.

32 :
34 m_debug(patterns.debug()),
35 m_sector(patterns.sector()),
36 m_cma_parameters(&patterns.cma_parameters()),
37 m_pivot0(patterns.pivot0()),
38 m_pivot1(patterns.pivot1()),
39 m_lowPt0(patterns.lowPt0()),
40 m_lowPt1(patterns.lowPt1()),
41 m_highPt0(patterns.highPt0()),
42 m_highPt1(patterns.highPt1())
43{}
std::vector< std::string > patterns
Definition listroot.cxx:187

Member Function Documentation

◆ cma_parameters()

const CMAparameters & CMApatterns::cma_parameters ( void ) const
inline

Definition at line 87 of file CMApatterns.h.

87{return *m_cma_parameters;}

◆ coincidence_distance()

void CMApatterns::coincidence_distance ( TRIGdistance & lowTr,
TRIGdistance & highTr ) const

Definition at line 198 of file CMApatterns.cxx.

200{
201
202 lowTr = no_distance;
203 highTr = no_distance;
204
205 bitPATTERN pivot0 = decluster(m_pivot0);
206 bitPATTERN pivot1 = decluster(m_pivot1);
207 bitPATTERN lowPt0 = decluster(m_lowPt0);
208 bitPATTERN lowPt1 = decluster(m_lowPt1);
209 bitPATTERN highPt0 = decluster(m_highPt0);
210 bitPATTERN highPt1 = decluster(m_highPt1);
211
212 bitPATTERN pivot2 = majority(pivot0,pivot1);
213 bitPATTERN lowPt2 = majority(lowPt0,lowPt1);
214 bitPATTERN highPt2 = majority(highPt0,highPt1);
215
216 update_distance( lowest_distance(pivot2,lowPt2) , lowTr );
217 update_distance( lowest_distance(pivot2,lowPt0) , lowTr );
218 update_distance( lowest_distance(pivot2,lowPt1) , lowTr );
219 update_distance( lowest_distance(pivot0,lowPt2) , lowTr );
220 update_distance( lowest_distance(pivot1,lowPt2) , lowTr );
221
222 update_distance( lowest_distance(pivot2,highPt2) , highTr );
223 update_distance( lowest_distance(pivot2,highPt0) , highTr );
224 update_distance( lowest_distance(pivot2,highPt1) , highTr );
225 update_distance( lowest_distance(pivot0,highPt2) , highTr );
226 update_distance( lowest_distance(pivot1,highPt2) , highTr );
227}
const TRIGdistance lowest_distance(const bitPATTERN &, const bitPATTERN &) const
const bitPATTERN & pivot1(void) const
Definition CMApatterns.h:90
static const TRIGdistance no_distance
Definition CMApatterns.h:24
bitPATTERN decluster(const bitPATTERN &) const
const bitPATTERN & lowPt0(void) const
Definition CMApatterns.h:91
bitPATTERN majority(bitPATTERN &, bitPATTERN &) const
const bitPATTERN & pivot0(void) const
Definition CMApatterns.h:89
const bitPATTERN & highPt0(void) const
Definition CMApatterns.h:93
void update_distance(const TRIGdistance &, TRIGdistance &) const
const bitPATTERN & highPt1(void) const
Definition CMApatterns.h:94
const bitPATTERN & lowPt1(void) const
Definition CMApatterns.h:92

◆ create_hardware()

void CMApatterns::create_hardware ( TrigType type,
uint NOBXS,
uint BCZERO )
private

Definition at line 722 of file CMApatterns.cxx.

723{
724
725 if(type == None) return;
726
727 int run = 0;
728 int event = 0;
729 unsigned int long debug = m_debug;
730 int subsystem = (m_sector<32)? 0 : 1;
731 int proj = cma_parameters().id().type();
732 int sector = m_sector%32;
733 int PADadd = cma_parameters().id().PAD_index();
734 int lohi = (type == Low) ? 0 : 1;
735 int address[2] = { cma_parameters().id().eta_index(),
737 int localAdd = cma_parameters().id().Ixx_index();
738
739
740 // Instanciate the Matrix
741
742 auto matrix = std::make_unique<Matrix>(run,event,debug,subsystem,proj,sector,PADadd,lohi,
743 address,localAdd, NOBXS, BCZERO);
744
746 // ****************** START PROGRAMMING THE MATRIX ****************** //
748
749
750 // Loading pivot data into Matrix
751 // load_data(0,0,m_pivot0,matrix);
752 // load_data(0,1,m_pivot1,matrix);
753
754
755 // Specify the readout threshold to be transmitted into the readout
756 matrix->setKReadOut(0);
757
758 // Specify the AND/OR logic for a matrix input (0=pivot, 1=coincidence)
759 matrix->setLocalDirection(0,7);
760 matrix->setLocalDirection(1,7);
761
762 // Specify the width of the pulse signal in Matrix clock thick (320 Mhz)
763 matrix->setPulseWidth(4);
764
765 if(type == Low)
766 {
767 // Loading pivot data into Matrix
768 load_data(0,0,m_pivot0,matrix.get());
769 load_data(0,1,m_pivot1,matrix.get());
770
771 // Load the theshold registers into Matrix hardware simulation
772 const CMAprogram* program = cma_parameters().lowPt_program();
773 const int pivot_ch = CMAparameters::pivot_channels;
774
775 CMAword ovl1 = 0x0;
776 CMAword ovl2 = 0x0;
777 CMAword maj_th0 = 0x2;
778 CMAword maj_th1 = 0x2;
779 CMAword maj_th2 = 0x2;
780
781
782 if(program)
783 {
784 if(cma_parameters().id().type() == Phi)
785 {
786 const uint32_t* bytes = program->bytes();
787
788 for(int th=0;th<3;++th) // loop over thresholds
789 for (int ch=0; ch<pivot_ch; ++ch) // loop over channels
790 for (int by=0;by<2;++by) // loop over bytes
791 {
792 // G.Bruni, M.Corradi 1/3/2010 set phi roads for new cabling
793 if (cma_parameters().conf_type() != CMAparameters::Atlas){
794 matrix->setRoad(th,ch,by,0xffffffff); // old cabling, keep the phi roads all open
795 } else {
796 int pos = th*pivot_ch*2 + ch*2 + by;
797 matrix->setRoad(th,ch,by,bytes[pos]);
798 }
799 }
800 }
801 else
802 {
803
804 const uint32_t* bytes = program->bytes();
805
806 for(int th=0;th<3;++th) // loop over thresholds
807 for (int ch=0; ch<pivot_ch; ++ch) // loop over channels
808 for (int by=0;by<2;++by) // loop over bytes
809 {
810 int pos = th*pivot_ch*2 + ch*2 + by;
811 matrix->setRoad(th,ch,by,bytes[pos]);
812 }
813 }
814
815 ovl1 = program->overlap1();
816 ovl2 = program->overlap2();
817 maj_th0 = program->trig_thr0_maj_reg();
818 maj_th1 = program->trig_thr1_maj_reg();
819 maj_th2 = program->trig_thr2_maj_reg();
820
821
822 }
823 else if (!program && cma_parameters().id().type() == Phi)
824 {
825 // open only the Phi matrix if no program is found
826
827 for(int th=0;th<3;++th) // loop over thresholds
828 for (int ch=0; ch<pivot_ch; ++ch) // loop over channels
829 for (int by=0;by<2;++by) // loop over bytes
830 {
831 matrix->setRoad(th,ch,by,0xffffffff);
832 }
833 }
834
835 // Load the Majority logic setup
836 matrix->setMajority(0,maj_th0);
837 matrix->setMajority(1,maj_th1);
838 matrix->setMajority(2,maj_th2);
839
840 //matrix->setMask1(0,1);
841
842 // Load the Overlap flag
843 matrix->setMatOverlap(0, ovl1);
844 matrix->setMatOverlap(1, ovl2);
845
846 // Load Low Pt plane data into Matrix
847 load_data(1,0,m_lowPt0,matrix.get());
848 load_data(1,1,m_lowPt1,matrix.get());
849
850 // Execute the matrix simulation
851 matrix->execute();
852 m_low_pt_matrix = std::move(matrix);
853 }
854 else
855 {
856 // Load the theshold registers into Matrix hardware simulation
857 const CMAprogram* program = cma_parameters().highPt_program();
858 const int pivot_ch = CMAparameters::pivot_channels;
859
860 CMAword ovl1 = 0x0;
861 CMAword ovl2 = 0x0;
862 CMAword maj_th0 = 0x1;
863 CMAword maj_th1 = 0x1;
864 CMAword maj_th2 = 0x1;
865
866 if(program)
867 {
868
869 if(cma_parameters().id().type() == Phi)
870 {
871 const uint32_t* bytes = program->bytes();
872
873 for(int th=0;th<3;++th) // loop over thresholds
874 for (int ch=0; ch<pivot_ch; ++ch) // loop over channels
875 for (int by=0;by<2;++by) // loop over bytes
876 {
877 // G.Bruni, M.Corradi 1/3/2010 set phi roads for new cabling
878 if (cma_parameters().conf_type()!= CMAparameters::Atlas){
879 matrix->setRoad(th,ch,by,0xffffffff); // old cabling, keep the phi roads all open
880 } else {
881 int pos = th*pivot_ch*2 + ch*2 + by;
882 matrix->setRoad(th,ch,by,bytes[pos]);
883 }
884 }
885 }
886 else
887 {
888 const uint32_t* bytes = program->bytes();
889 for(int th=0;th<3;++th) // loop over thresholds
890 for (int ch=0; ch<pivot_ch; ++ch) // loop over channels
891 for (int by=0;by<2;++by) // loop over bytes
892 {
893 int pos = th*pivot_ch*2 + ch*2 + by;
894 matrix->setRoad(th,ch,by,bytes[pos]);
895 }
896 }
897
898 ovl1 = program->overlap1();
899 ovl2 = program->overlap2();
900 maj_th0 = program->trig_thr0_maj_reg();
901 maj_th1 = program->trig_thr1_maj_reg();
902 maj_th2 = program->trig_thr2_maj_reg();
903
904 }
905 else if (!program && cma_parameters().id().type() == Phi)
906 {
907
908 // open only the Phi matrix if no program is found
909
910 for(int th=0;th<3;++th) // loop over thresholds
911 for (int ch=0; ch<pivot_ch; ++ch) // loop over channels
912 for (int by=0;by<2;++by) // loop over bytes
913 {
914 matrix->setRoad(th,ch,by,0xffffffff);
915 }
916 }
917 // Load the Majority logic setup
918 matrix->setMajority(0,maj_th0);
919 matrix->setMajority(1,maj_th1);
920 matrix->setMajority(2,maj_th2);
921
922 // Load the Overlap flag
923 matrix->setMatOverlap(0, ovl1);
924 matrix->setMatOverlap(1, ovl2);
925
926 // Load High Pt plane data into Matrix
927 load_data(1,0,m_highPt0,matrix.get());
928 load_data(1,1,m_highPt1,matrix.get());
929
930 if(!m_low_pt_matrix) create_hardware(Low, NOBXS, BCZERO);
931
932 // Put the Low Pt patterns into the High Pt Matrix input
933 matrix->putPatt(m_low_pt_matrix.get());
934
935 // Execute the matrix simulation
936 matrix->execute();
937 m_high_pt_matrix = std::move(matrix);
938 }
939}
uint32_t CMAword
Definition Lvl1Def.h:17
@ Phi
Definition RPCdef.h:8
@ Low
@ None
ViewType type() const
int Ixx_index() const
int PAD_index() const
int eta_index() const
int phi_index() const
const CMAidentity & id() const
const CMAprogram * lowPt_program() const
const CMAprogram * highPt_program() const
std::unique_ptr< Matrix > m_low_pt_matrix
Definition CMApatterns.h:42
std::unique_ptr< Matrix > m_high_pt_matrix
Definition CMApatterns.h:43
const CMAparameters & cma_parameters(void) const
Definition CMApatterns.h:87
void create_hardware(TrigType, uint NOBXS, uint BCZERO)
void load_data(int, int, const bitPATTERN &, Matrix *)
uint32_t overlap2(void) const
Definition CMAprogram.h:124
uint8_t trig_thr2_maj_reg() const
Definition CMAprogram.h:257
const uint32_t * bytes(void) const
Definition CMAprogram.h:120
uint8_t trig_thr0_maj_reg() const
Definition CMAprogram.h:245
uint8_t trig_thr1_maj_reg() const
Definition CMAprogram.h:251
uint32_t overlap1(void) const
Definition CMAprogram.h:123
setEventNumber uint32_t

◆ debug()

unsigned long int CMApatterns::debug ( void ) const
inline

Definition at line 84 of file CMApatterns.h.

84{return m_debug;}

◆ decluster()

bitPATTERN CMApatterns::decluster ( const bitPATTERN & data) const
private

Definition at line 120 of file CMApatterns.cxx.

121{
122
123 bitPATTERN pattern(data);
124
125 for(int i=0;i<pattern.size();++i)
126 {
127 if(pattern.test(i))
128 {
129 int cluster_size = 0;
130 do { ++cluster_size; } while( pattern.test(i+cluster_size) );
131
132 int decl_lower = 1;
133 int decl_upper = cluster_size;
134
135 switch (cluster_size%2)
136 {
137 case 0:
138 for( ;decl_lower+1 < decl_upper && decl_lower<=3; ++decl_lower)
139 {
140 pattern.unset(i - 1 + decl_lower);
141 pattern.unset(i - 1 + decl_upper);
142 --decl_upper;
143 }
144 break;
145 case 1:
146 for( ;decl_lower+1 < decl_upper && decl_lower<=3; ++decl_lower)
147 {
148 pattern.unset(i - 1 + decl_lower);
149 pattern.unset(i - 1 + decl_upper);
150 --decl_upper;
151 }
152 }
153 i += (cluster_size - 1);
154 }
155 }
156 return pattern;
157}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11

◆ distance()

const CMApatterns::TRIGdistance CMApatterns::distance ( const RPCdigit * pivot,
const RPCdigit * confirm ) const

Definition at line 255 of file CMApatterns.cxx.

256{
257
258
260 float pivrad = 0;
261 float conrad = 0;
262 if( pivot->station_radius(pivrad) && confirm->station_radius(conrad) )
263 {
264 if(pivot->decoding().view() == Eta)
265 {
266 if(pivot->station_eta(value.second))
267 {
268 float Zprime = pivot->z()*(conrad/pivrad);
269 value.first = confirm->z() - Zprime;
270 }
271 }
272 else if (pivot->decoding().view() == Phi)
273 {
274 float pivphi = 0;
275 float conphi = 0;
276 float staphi = 0;
277 if( pivot->phi(pivphi) &&
278 confirm->phi(conphi) &&
279 pivot->station_phi(staphi) &&
280 pivot->station_eta(value.second) )
281 {
282 float Sprime = std::tan(pivphi-staphi)*conrad;
283 value.first = std::tan(conphi-staphi)*conrad - Sprime;
284 }
285 }
286 }
287 return value;
288}
@ Eta
Definition RPCdef.h:8
std::pair< float, float > TRIGdistance
Definition CMApatterns.h:23
ViewType view(void) const
float z(void) const
Definition RPCdigit.h:55
const RPCdecoder & decoding(void) const
Definition RPCdigit.h:48
bool station_phi(float &) const
Definition RPCdigit.h:93
bool station_eta(float &) const
Definition RPCdigit.cxx:227
bool phi(float &) const
Definition RPCdigit.cxx:217
bool station_radius(float &) const
Definition RPCdigit.h:81

◆ find_trigger() [1/2]

CMAtrigger CMApatterns::find_trigger ( const bitPATTERN & pivot,
const bitPATTERN & lowPt,
const bitPATTERN & highPt ) const
private

Definition at line 468 of file CMApatterns.cxx.

470{
471
472
473 CMAtrigger trigger_result(GeometricAlgo,this);
474
475 if ( !pivot.any() || !lowPt.any() ) return trigger_result;
476
477 for(int i=0;i<pivot.size();++i)
478 {
479 if(const RPCdigit* pivot_digit = pivot[i])
480 {
481 // Start searching for Low Pt trigger signature
482 for(int j=0;j<lowPt.size();++j)
483 {
484 if(const RPCdigit* confirm_digit = lowPt[j])
485 {
486 TRIGdistance d = distance(pivot_digit,confirm_digit);
487 CMAtrigger signature = trigger_window(d,Low);
488 signature.set_pivot(pivot_digit);
489 signature.set_lowPt(confirm_digit);
490 trigger_result += signature;
491 }
492
493 // if Low Pt Third threshold has fired
494 if ( trigger_result.trigger().searchForHigh() )
495 {
496 // Start searching for High Pt trigger signature
497 for(int k=0;k<highPt.size();++k)
498 {
499 if(const RPCdigit* confirm_digit = highPt[k])
500 {
501 TRIGdistance d=distance(pivot_digit,confirm_digit);
502 CMAtrigger signature = trigger_window(d,High);
503 signature.set_highPt(confirm_digit);
504 trigger_result += signature;
505 }
506 if( trigger_result.trigger().highest(High) ) break;
507 }
508 }
509 if ( trigger_result.trigger().highest(High) ) break;
510 }
511 }
512 if ( trigger_result.trigger().highest(High) ) break;
513 }
514
515 return trigger_result;
516}
@ GeometricAlgo
Definition CMAtrigger.h:20
@ High
const TRIGdistance distance(const RPCdigit *, const RPCdigit *) const
CMAtrigger trigger_window(TRIGdistance, TrigType) const
void set_pivot(const RPCdigit *)
void set_highPt(const RPCdigit *)
void set_lowPt(const RPCdigit *)
bool any(void) const
int size(void) const
Definition bitPATTERN.h:41

◆ find_trigger() [2/2]

CMAtrigger CMApatterns::find_trigger ( const bitPATTERN & pivot,
const bitPATTERN & lowPt,
const bitPATTERN & highPt0,
const bitPATTERN & highPt1 ) const
private

Definition at line 520 of file CMApatterns.cxx.

522{
523
524 CMAtrigger trigger_result(GeometricAlgo,this);
525
526 if ( !pivot.any() || !lowPt.any() ) return trigger_result;
527
528 for(int i=0;i<pivot.size();++i)
529 {
530 if(const RPCdigit* pivot_digit = pivot[i])
531 {
532 // Start searching for Low Pt trigger signature
533 for(int j=0;j<lowPt.size();++j)
534 {
535 if(const RPCdigit* confirm_digit = lowPt[j])
536 {
537 TRIGdistance d = distance(pivot_digit,confirm_digit);
538 CMAtrigger signature = trigger_window(d,Low);
539 signature.set_pivot(pivot_digit);
540 signature.set_lowPt(confirm_digit);
541 trigger_result += signature;
542 }
543
544 // if Low Pt Third threshold has fired
545 if ( trigger_result.trigger().searchForHigh() )
546 {
547 // Start searching for High Pt trigger signature in plane 0
548 for(int k=0;k<highPt0.size();++k)
549 {
550 if(const RPCdigit* confirm_digit = highPt0[k])
551 {
552 TRIGdistance d=distance(pivot_digit,confirm_digit);
553 CMAtrigger signature = trigger_window(d,High);
554 signature.set_highPt(confirm_digit);
555 trigger_result += signature;
556 }
557 if( trigger_result.trigger().highest(High) ) break;
558 }
559 }
560
561 // if Low Pt Third threshold has fired
562 if ( trigger_result.trigger().searchForHigh() )
563 {
564 // Start searching for High Pt trigger signature in plane 1
565 for(int k=0;k<highPt1.size();++k)
566 {
567 if(const RPCdigit* confirm_digit = highPt1[k])
568 {
569 TRIGdistance d=distance(pivot_digit,confirm_digit);
570 CMAtrigger signature = trigger_window(d,High);
571 signature.set_highPt(confirm_digit);
572 trigger_result += signature;
573 }
574 if( trigger_result.trigger().highest(High) ) break;
575 }
576 }
577 if ( trigger_result.trigger().highest(High) ) break;
578 }
579 }
580 if ( trigger_result.trigger().highest(High) ) break;
581 }
582
583 return trigger_result;
584}

◆ give_high_pt_matrix()

Matrix * CMApatterns::give_high_pt_matrix ( uint NOBXS,
uint BCZERO )

Definition at line 965 of file CMApatterns.cxx.

966{
967
968 if(!m_high_pt_matrix) create_hardware(High, NOBXS, BCZERO);
969 return m_high_pt_matrix.get();
970}

◆ give_low_pt_matrix()

Matrix * CMApatterns::give_low_pt_matrix ( uint NOBXS,
uint BCZERO )

Definition at line 956 of file CMApatterns.cxx.

957{
958
959 if(!m_low_pt_matrix) create_hardware(Low, NOBXS, BCZERO);
960 return m_low_pt_matrix.get();
961}

◆ give_trigger()

const CMAtrigger CMApatterns::give_trigger ( Lvl1RPCalgo type) const

Definition at line 291 of file CMApatterns.cxx.

292{
293
294
295
296 if(type == HardwareEmulation)
297 {
298 return CMAtrigger(type,this);
299 }
300 else
301 {
303 search_for_lowPt(type,signatures);
304 if(!signatures.empty())
305 {
306 if(signatures.top().trigger().searchForHigh())
307 search_for_highPt(type,signatures);
308 return signatures.top();
309 }
310 else return CMAtrigger(type,this);
311 }
312}
@ HardwareEmulation
Definition CMAtrigger.h:20
void search_for_lowPt(Lvl1RPCalgo, TrigSigns &) const
std::priority_queue< CMAtrigger > TrigSigns
Definition CMApatterns.h:27
void search_for_highPt(Lvl1RPCalgo, TrigSigns &) const
std::vector< std::string > signatures(const std::string &chain)

◆ highPt0()

const bitPATTERN & CMApatterns::highPt0 ( void ) const
inline

Definition at line 93 of file CMApatterns.h.

93{return m_highPt0;}

◆ highPt1()

const bitPATTERN & CMApatterns::highPt1 ( void ) const
inline

Definition at line 94 of file CMApatterns.h.

94{return m_highPt1;}

◆ load_data()

void CMApatterns::load_data ( int side,
int layer,
const bitPATTERN & pattern,
Matrix * mat )
private

Definition at line 942 of file CMApatterns.cxx.

944{
945
946 if(pattern.any())
947 {
948 for (int i=0;i<pattern.size();++i)
949 {
950 if(pattern.test(i)) mat->putData(side,layer,i,pattern[i]->time());
951 }
952 }
953}
time(flags, cells_name, *args, **kw)

◆ load_digit()

void CMApatterns::load_digit ( const RPCdigit * digit)

Definition at line 90 of file CMApatterns.cxx.

91{
92 int station = digit->decoding().lvl1_station();
93 int cabling = digit->decoding().cabling_code();
94
95 CMAinput IO = NoInput;
96 int channel = 0;
97 int layer = 0;
98
99 if(m_cma_parameters->give_connection(station,cabling,IO,layer,channel))
100 {
101 if(IO == Pivot)
102 {
103 if(layer) m_pivot1.set(digit,channel);
104 else m_pivot0.set(digit,channel);
105 }
106 else if (IO == LowPt)
107 {
108 if(layer) m_lowPt1.set(digit,channel);
109 else m_lowPt0.set(digit,channel);
110 }
111 else if (IO == HighPt)
112 {
113 if(layer) m_highPt1.set(digit,channel);
114 else m_highPt0.set(digit,channel);
115 }
116 }
117}
CMAinput
@ NoInput
@ layer
Definition HitInfo.h:79

◆ lowest_distance()

const CMApatterns::TRIGdistance CMApatterns::lowest_distance ( const bitPATTERN & pivot,
const bitPATTERN & confirm ) const

Definition at line 230 of file CMApatterns.cxx.

232{
233 if ( !pivot.any() || !confirm.any() ) return no_distance;
234
236
237 for(int i=0;i<pivot.size();++i)
238 {
239 if(const RPCdigit* pivot_digit = pivot[i])
240 {
241 for(int j=0;j<confirm.size();++j)
242 {
243 if(const RPCdigit* confirm_digit = confirm[j])
244 {
245 update_distance(distance(pivot_digit,confirm_digit),value);
246 }
247 }
248 }
249 }
250
251 return value;
252}

◆ lowPt0()

const bitPATTERN & CMApatterns::lowPt0 ( void ) const
inline

Definition at line 91 of file CMApatterns.h.

91{return m_lowPt0;}

◆ lowPt1()

const bitPATTERN & CMApatterns::lowPt1 ( void ) const
inline

Definition at line 92 of file CMApatterns.h.

92{return m_lowPt1;}

◆ majority()

bitPATTERN CMApatterns::majority ( bitPATTERN & layer0,
bitPATTERN & layer1 ) const
private

Definition at line 161 of file CMApatterns.cxx.

162{
163
164 int left = 1;
165 int right = 1;
166
167 bitPATTERN result(layer0.name(),layer0.id(),layer0.size());
168 bitPATTERN tmp1(layer1);
169 bitPATTERN tmp2(layer1);
170
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);
174
175 for (int i=0;i<result.size();++i)
176 {
177 if(result.test(i))
178 {
179 layer0.unset(i);
180 layer0.unset(i-1);
181 layer0.unset(i+1);
182 layer1.unset(i);
183 layer1.unset(i-1);
184 layer1.unset(i+1);
185 }
186 }
187
188 return result;
189}
const std::string & name() const
Definition BaseObject.h:23
const PATTERNidentity & id(void) const
Definition bitPATTERN.h:39
void unset(int)

◆ name()

const std::string & BaseObject::name ( ) const
inlineinherited

Definition at line 23 of file BaseObject.h.

23{ return m_name; }
std::string m_name
Definition BaseObject.h:16

◆ number()

int RPCtrigDataObject::number ( void ) const
inlineinherited

Definition at line 29 of file RPCtrigDataObject.h.

29{return m_number;}

◆ operator!=()

bool CMApatterns::operator!= ( const CMApatterns & patterns) const

Definition at line 73 of file CMApatterns.cxx.

74{
75 return !(*this == patterns);
76}

◆ operator<()

bool CMApatterns::operator< ( const CMApatterns & patterns) const

Definition at line 79 of file CMApatterns.cxx.

81{
82 if(m_sector < patterns.sector())
83 {
84 if (m_cma_parameters->id() < patterns.cma_parameters().id()) return true;
85 }
86 return false;
87}

◆ operator<<()

CMApatterns & CMApatterns::operator<< ( const RPCdigit * digit)

Definition at line 679 of file CMApatterns.cxx.

681{
682 load_digit(digit);
683 return *this;
684}
void load_digit(const RPCdigit *)

◆ operator=()

CMApatterns CMApatterns::operator= ( const CMApatterns & patterns)

Definition at line 46 of file CMApatterns.cxx.

47{
48 static_cast<RPCtrigDataObject&>(*this) =
49 static_cast<const RPCtrigDataObject&>(patterns);
50 m_debug = patterns.debug();
51 m_sector = patterns.sector();
52 m_cma_parameters = &patterns.cma_parameters();
53 m_pivot0 = patterns.pivot0();
54 m_pivot1 = patterns.pivot1();
55 m_lowPt0 = patterns.lowPt0();
56 m_lowPt1 = patterns.lowPt1();
57 m_highPt0 = patterns.highPt0();
58 m_highPt1 = patterns.highPt1();
59 return *this;
60}

◆ operator==()

bool CMApatterns::operator== ( const CMApatterns & patterns) const

Definition at line 63 of file CMApatterns.cxx.

64{
65 if(m_sector == patterns.sector())
66 {
67 if (m_cma_parameters->id()==patterns.cma_parameters().id()) return true;
68 }
69 return false;
70}

◆ pivot0()

const bitPATTERN & CMApatterns::pivot0 ( void ) const
inline

Definition at line 89 of file CMApatterns.h.

89{return m_pivot0;}

◆ pivot1()

const bitPATTERN & CMApatterns::pivot1 ( void ) const
inline

Definition at line 90 of file CMApatterns.h.

90{return m_pivot1;}

◆ Print()

void CMApatterns::Print ( std::ostream & stream,
bool detail ) const
virtual

Reimplemented from BaseObject.

Definition at line 686 of file CMApatterns.cxx.

687{
688 //unsigned int upper = 19;
689 //unsigned int lower = 17;
690
691 unsigned int upper = 95;
692 unsigned int lower = 45;
693
694 for(int i=0;i<80;++i) stream << (char) upper;
695 stream << std::endl;
696
697 stream << name() << " giving input to: logic sector = " << m_sector
698 << ", sector type = " << cma_parameters().sector_type() << std::endl;
699 stream << cma_parameters() << std::endl;
700
701 //bitPATTERN layer0 = decluster(pivot0());
702 //bitPATTERN layer1 (pivot1());
703
704 pivot1().Print(stream,detail);
705 pivot0().Print(stream,detail);
706
707 //layer0.Print(stream,detail); // test for declustering
708 //stream << majority(layer0,layer1); // test for majority logic
709 //layer1.Print(stream,detail); // test for majority logic
710 //layer0.Print(stream,detail); // test for majority logic
711
712 lowPt1().Print(stream,detail);
713 lowPt0().Print(stream,detail);
714 highPt1().Print(stream,detail);
715 highPt0().Print(stream,detail);
716
717 for(int i=0;i<80;++i) stream << (char) lower;
718 stream << std::endl;
719}
int upper(int c)
int sector_type() const
void Print(std::ostream &, bool detail) const

◆ PrintElement()

void RPCtrigDataObject::PrintElement ( std::ostream & ,
std::string ,
bool  ) const
inlineinherited

Definition at line 31 of file RPCtrigDataObject.h.

31{}

◆ search_for_highPt()

void CMApatterns::search_for_highPt ( Lvl1RPCalgo type,
TrigSigns & signatures ) const
private

Definition at line 335 of file CMApatterns.cxx.

336{
337
338
339 bitPATTERN highPt0 = decluster(m_highPt0);
340 bitPATTERN highPt1 = decluster(m_highPt1);
341
342 bitPATTERN highPt2 = majority(highPt0,highPt1);
343
345
346 while(!signatures.empty())
347 {
348 CMAtrigger signature = signatures.top();
349 signatures.pop();
350 if(signature.trigger().searchForHigh())
351 {
352 search_signatures(type,High,signature,highPt2);
353 search_signatures(type,High,signature,highPt0);
354 search_signatures(type,High,signature,highPt1);
355 tmp.push(signature);
356 }
357 }
358
359 signatures = std::move(tmp);
360}
void search_signatures(Lvl1RPCalgo, TrigType, TrigSigns &, const bitPATTERN &, const bitPATTERN &) const
const TRIGGERidentity & trigger(void) const
Definition CMAtrigger.h:57
bool searchForHigh(void) const

◆ search_for_lowPt()

void CMApatterns::search_for_lowPt ( Lvl1RPCalgo type,
TrigSigns & signatures ) const
private

Definition at line 315 of file CMApatterns.cxx.

316{
317
318
319 bitPATTERN pivot0 = decluster(m_pivot0);
320 bitPATTERN pivot1 = decluster(m_pivot1);
321 bitPATTERN lowPt0 = decluster(m_lowPt0);
322 bitPATTERN lowPt1 = decluster(m_lowPt1);
323
324 bitPATTERN pivot2 = majority(pivot0,pivot1);
325 bitPATTERN lowPt2 = majority(lowPt0,lowPt1);
326
327 search_signatures(type,Low,signatures,pivot2,lowPt2);
328 search_signatures(type,Low,signatures,pivot2,lowPt0);
329 search_signatures(type,Low,signatures,pivot2,lowPt1);
330 search_signatures(type,Low,signatures,pivot0,lowPt2);
331 search_signatures(type,Low,signatures,pivot1,lowPt2);
332}

◆ search_signatures() [1/2]

void CMApatterns::search_signatures ( Lvl1RPCalgo algoType,
TrigType trigType,
CMAtrigger & trigger_result,
const bitPATTERN & confirm ) const
private

Definition at line 419 of file CMApatterns.cxx.

422{
423
424 if ( !confirm.any() ) return;
425
426
427 const RPCdigit* pivot_digit = trigger_result.pivot_hit();
428 const int Kpatt = trigger_result.Kpatt();
429
430 // Start searching for trigger signature
431 CMAtrigger signature(algoType,this);
432
433 for(int j=0;j<confirm.size();++j)
434 {
435 if(const RPCdigit* confirm_digit = confirm[j])
436 {
437 TRIGdistance d = distance(pivot_digit,confirm_digit);
438
439 if(algoType == GeometricAlgo)
440 {
441 signature = trigger_window(d,trigType);
442 }
443 else if (algoType == LogicEmulation)
444 {
445 signature = trigger_threshold(Kpatt,j,trigType);
446 }
447
448 if(trigType == Low)
449 {
450 signature.set_pivot(pivot_digit);
451 signature.set_lowPt(confirm_digit);
452 }
453 else if(trigType == High)
454 {
455 signature.set_highPt(confirm_digit);
456 }
457 signature.set_width(d.first);
458 signature.set_Kpatt(Kpatt);
459 trigger_result += signature;
460 }
461
462 //if ( trigger_result.trigger().highest(trigType) ) break;
463 }
464}
@ LogicEmulation
Definition CMAtrigger.h:20
CMAtrigger trigger_threshold(int, int, TrigType) const
int Kpatt(void) const
Definition CMAtrigger.h:63
const RPCdigit * pivot_hit(void) const
Definition CMAtrigger.h:59

◆ search_signatures() [2/2]

void CMApatterns::search_signatures ( Lvl1RPCalgo algoType,
TrigType trigType,
TrigSigns & signatures,
const bitPATTERN & pivot,
const bitPATTERN & confirm ) const
private

Definition at line 364 of file CMApatterns.cxx.

368{
369
370 if ( !pivot.any() || !confirm.any() ) return;
371
372 for(int i=0;i<pivot.size();++i)
373 {
374 if(const RPCdigit* pivot_digit = pivot[i])
375 {
376 // Start searching for trigger signature
377 CMAtrigger trigger_result(algoType,this);
378
379 for(int j=0;j<confirm.size();++j)
380 {
381 if(const RPCdigit* confirm_digit = confirm[j])
382 {
383 TRIGdistance d = distance(pivot_digit,confirm_digit);
384 CMAtrigger signature(algoType,this);
385
386 if(algoType == GeometricAlgo)
387 {
388 signature = trigger_window(d,trigType);
389 }
390 else if (algoType == LogicEmulation)
391 {
392 signature = trigger_threshold(i,j,trigType);
393 }
394
395 if(trigType == Low)
396 {
397 signature.set_pivot(pivot_digit);
398 signature.set_lowPt(confirm_digit);
399 }
400 else if(trigType == High)
401 {
402 signature.set_highPt(confirm_digit);
403 }
404 signature.set_width(d.first);
405 signature.set_Kpatt(i);
406 trigger_result += signature;
407 }
408
409 //if ( trigger_result.trigger().highest(trigType) ) break;
410 }
411 if(trigger_result.trigger().type()!=None)
412 signatures.push(trigger_result);
413 }
414 }
415}

◆ sector()

int CMApatterns::sector ( void ) const
inline

Definition at line 86 of file CMApatterns.h.

86{return m_sector;}

◆ set_number()

void RPCtrigDataObject::set_number ( int number)
inherited

Definition at line 42 of file RPCtrigDataObject.cxx.

43{
45}
int number(void) const

◆ tag()

ObjectType BaseObject::tag ( ) const
inlineinherited

Definition at line 22 of file BaseObject.h.

22{ return m_tag; }
ObjectType m_tag
Definition BaseObject.h:15

◆ trigger_threshold()

CMAtrigger CMApatterns::trigger_threshold ( int pivot,
int confirm,
TrigType type ) const
private

Definition at line 631 of file CMApatterns.cxx.

632{
633
634 if (type == None) return CMAtrigger(LogicEmulation,this);
635
636 const int pivch = CMAparameters::pivot_channels;
637 const int conch = CMAparameters::confirm_channels;
638
639 const bool* program = 0;
640
641 if(type == Low)
642 {
643 if(const CMAprogram* prog = cma_parameters().lowPt_program() )
644 {
645 // avoid to use the Phi program for the time being ///////////
646 if(cma_parameters().id().type() == Phi) //
647 return CMAtrigger(LogicEmulation,type,ThirdTh,this); //
649 program = prog->registers();
650 }
651 else return CMAtrigger(LogicEmulation,type,ThirdTh,this);
652 }
653 else
654 {
655 if(const CMAprogram* prog = cma_parameters().highPt_program() )
656 {
657 // avoid to use the Phi program for the time being ///////////
658 if(cma_parameters().id().type() == Phi) //
659 return CMAtrigger(LogicEmulation,type,ThirdTh,this); //
661 program = prog->registers();
662 }
663 else return CMAtrigger(LogicEmulation,type,ThirdTh,this);
664 }
665
666
667 for(int th=2;th>=0;--th)
668 {
669 int pos = th*pivch*conch + pivot*conch + confirm;
670 if(*(program+pos))
671 {
672 Threshold threshold = static_cast<Threshold>(th);
673 return CMAtrigger(LogicEmulation,type,threshold,this);
674 }
675 }
676 return CMAtrigger(LogicEmulation,this);
677}
Threshold
@ ThirdTh

◆ trigger_window()

CMAtrigger CMApatterns::trigger_window ( TRIGdistance dist,
TrigType type ) const
private

Definition at line 587 of file CMApatterns.cxx.

588{
589
590 if (type == None) return CMAtrigger(GeometricAlgo,this);
591
592 if(m_cma_parameters->id().type() == Eta)
593 {
594 //implement the geometric coincidence for the eta projection
595 int upper_threshold = (type == Low)? 2 : 4;
596 int lower_threshold = (type == Low)? 0 : 3;
597
598 for(int i=upper_threshold; i >= lower_threshold;--i)
599 {
600 if (windows(dist.first,dist.second,i,m_sector%32))
601 {
603 if ( (i%3) == 0 ) threshold = FirstTh;
604 else if ( (i%3) == 1 ) threshold = SecondTh;
605 else if ( (i%3) == 2 ) threshold = ThirdTh;
606 return CMAtrigger(GeometricAlgo,type,threshold,this);
607 }
608 }
609 }
610 else if (m_cma_parameters->id().type() == Phi)
611 {
612 //implement the geometric coincidence for the phi projection
613 if(type == Low)
614 {
615 // set the trigger window width equal to 10 centimeters
616 if(fabsf(dist.first)<10.0)
617 return CMAtrigger(GeometricAlgo,type,ThirdTh,this);
618 }
619 else if (type == High)
620 {
621 // set the trigger window width equal to 10 centimeters
622 if(fabsf(dist.first)<10.0)
623 return CMAtrigger(GeometricAlgo,type,SecondTh,this);
624 }
625 }
626
627 return CMAtrigger(GeometricAlgo,this);
628}
@ SecondTh
@ FirstTh
int windows(float distance, float eta_pivot, int thr, int sector)
Definition windows.cxx:14

◆ update_distance()

void CMApatterns::update_distance ( const TRIGdistance & NEW,
TRIGdistance & OLD ) const
private

Definition at line 192 of file CMApatterns.cxx.

193{
194 if(std::fabs(NEW.first) < std::fabs(OLD.first)) OLD = NEW;
195}

Member Data Documentation

◆ m_cma_parameters

const CMAparameters* CMApatterns::m_cma_parameters
private

Definition at line 33 of file CMApatterns.h.

◆ m_debug

unsigned long int CMApatterns::m_debug
private

Definition at line 30 of file CMApatterns.h.

◆ m_high_pt_matrix

std::unique_ptr<Matrix> CMApatterns::m_high_pt_matrix
private

Definition at line 43 of file CMApatterns.h.

◆ m_highPt0

bitPATTERN CMApatterns::m_highPt0
private

Definition at line 39 of file CMApatterns.h.

◆ m_highPt1

bitPATTERN CMApatterns::m_highPt1
private

Definition at line 40 of file CMApatterns.h.

◆ m_low_pt_matrix

std::unique_ptr<Matrix> CMApatterns::m_low_pt_matrix
private

Definition at line 42 of file CMApatterns.h.

◆ m_lowPt0

bitPATTERN CMApatterns::m_lowPt0
private

Definition at line 37 of file CMApatterns.h.

◆ m_lowPt1

bitPATTERN CMApatterns::m_lowPt1
private

Definition at line 38 of file CMApatterns.h.

◆ m_name

std::string BaseObject::m_name
privateinherited

Definition at line 16 of file BaseObject.h.

◆ m_number

int RPCtrigDataObject::m_number
privateinherited

Definition at line 17 of file RPCtrigDataObject.h.

◆ m_pivot0

bitPATTERN CMApatterns::m_pivot0
private

Definition at line 35 of file CMApatterns.h.

◆ m_pivot1

bitPATTERN CMApatterns::m_pivot1
private

Definition at line 36 of file CMApatterns.h.

◆ m_sector

int CMApatterns::m_sector
private

Definition at line 32 of file CMApatterns.h.

◆ m_tag

ObjectType BaseObject::m_tag
privateinherited

Definition at line 15 of file BaseObject.h.

◆ no_distance

const CMApatterns::TRIGdistance CMApatterns::no_distance
static
Initial value:
=
TRIGdistance(99999.,99999.)

Definition at line 24 of file CMApatterns.h.


The documentation for this class was generated from the following files: