CMS 3D CMS Logo

DTSectCollPhCand.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: DTSectCollPhCand.cpp
4 //
5 // Description: A Sector Collector Phi Candidate
6 //
7 //
8 // Author List:
9 // S.Marcellini D.Bonacorsi
10 // Modifications:
11 // 11/06 C. Battilana: Class moved from Cand to PhCand
12 //
13 //
14 //--------------------------------------------------
15 
16 
17 //-----------------------
18 // This Class's Header --
19 //-----------------------
21 
22 //---------------
23 // C++ Headers --
24 //---------------
25 #include <iostream>
26 
27 //----------------
28 // Constructors --
29 //---------------- // SM double TSM
30 DTSectCollPhCand::DTSectCollPhCand(DTSC* tsc, const DTChambPhSegm* tsmsegm, int ifs)
31  : _tsc(tsc), _tsmsegm(tsmsegm) {
32  _dataword.one(); // reset dataword to 0x1ff
33  if(ifs==1)_dataword.unset(14); // set bit 14 (0=first, 1=second tracks)
34 }
35 
36 
38 
39 }
40 
41 //--------------
42 // Destructor --
43 //--------------
45 }
46 
47 
48 //--------------
49 // Operations --
50 //--------------
51 
54  if(this != &tsccand){
55  _tsc = tsccand._tsc;
56  _tsmsegm = tsccand._tsmsegm;
57  }
58  return *this;
59 }
60 
61 void
63  _tsmsegm=nullptr;
64  _dataword.one();
65 // std::cout << " clear dataword : " << _dataword.print() << std::endl;
66 }
67 
68 int
70  int sect= _tsmsegm->ChamberId().sector();
71  if (sect<13)
72  return config()->CoarseSync(_tsmsegm->ChamberId().station());
73  else
74  return config()->CoarseSync(5);
75 }
76 
77 // SM double TSM: remove datawordbk and replace it with dataword
78 void
80 
82 
83  if(abs(_tsmsegm->DeltaPsiR())>1024 ){ // Check phiB within 10 bits range
84  std::cout << "DTSectCollPhCand::setBitsSectColl phiB outside valid range: " << _tsmsegm->DeltaPsiR();
85  std::cout << " deltaPsiR set to 512" << std::endl;
86  }
87  else {
88  // SM double TSM
89  // assign preview in dataword (common to any other assignment)
91  //
92  int a2 = 12;
93  int a1 = 11;
94  int a0 = 10;
95 
96  if( _tsmsegm->code()==6 ) { _dataword.unset(a2); _dataword.unset(a1); _dataword.unset(a0); } // 1-000
97  if( _tsmsegm->code()==5 ) { _dataword.unset(a2); _dataword.unset(a1); } // 1-001
98  if( _tsmsegm->code()==4 ) { _dataword.unset(a2); _dataword.unset(a0); } // 1-010
99  if( _tsmsegm->code()==3 ) { _dataword.unset(a1); } // 1-101
100  if( _tsmsegm->code()==2 ) { _dataword.unset(a1); _dataword.unset(a0); } // 1-100
101  // if( _tsmsegm->code()==1 ) no unset needed => 111
102  if( _tsmsegm->code()==0 ) { _dataword.unset(a0); } // 1-110
103 
104  }
105 
106 }
107 
108 
109  void
111  std::cout << "Sector Collector Phi Candidate: " << std::endl;
112  if(_dataword.element(14)==0) {std::cout << "First track type" << std::endl;}
113  else {std::cout << "Second track type" << std::endl;}
114  std::cout << " code=" << _tsmsegm->pvCode();
115  std::cout << " dataword=";
116  _dataword.print();
117  // SM double TSM remove datawordbk section
118  std::cout << " SC step=" << CoarseSync()+_tsmsegm->step();
119  std::cout << std::endl;
120  }
121 
const DTChambPhSegm * _tsmsegm
~DTSectCollPhCand()
Destructor.
DTSectCollPhCand & operator=(const DTSectCollPhCand &tsccand)
Assignment operator.
void clear()
Set the SC Candidate step.
void clearBitsSectColl()
Clear (set to 1) the quality bits for Sector Collector.
Definition: DTSC.h:42
int code() const
Return trigger code (MTTF input format [0,7])
Definition: DTChambPhSegm.h:90
int step() const
Return step number.
Definition: DTChambPhSegm.h:75
void setBitsSectColl()
Set the bits for DTTSM analysis.
void print() const
Print the trigger.
void one()
Definition: BitArray.h:223
DTSectCollPhCand()
Constructor.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int CoarseSync(int istat) const
Return coarsesync parameter in Sector Collector for station istat (5 is second MB4 station) ...
DTChamberId ChamberId() const override
Return chamber identifier.
Definition: DTChambPhSegm.h:78
int CoarseSync() const
Return the Coarse Sync Parameter.
void unset(const int i)
Definition: BitArray.h:231
int element(const int pos) const
Definition: BitArray.h:210
int pvCode() const
Return the preview code (10*inner_code or outer_code; X_code=1,2,3,4,8)
int DeltaPsiR() const
Return bending angle (bit pattern)
void assign(const int p, const int n, const int val)
Definition: BitArray.h:239
int sector() const
Definition: DTChamberId.h:61
const DTConfigSectColl * config() const
Configuration set.
BitArray< 15 > _dataword
std::ostream & print(std::ostream &o=std::cout) const
Definition: BitArray.h:345
int station() const
Return the station number.
Definition: DTChamberId.h:51