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 // This Class's Header --
18 //-----------------------
20 
21 //---------------
22 // C++ Headers --
23 //---------------
24 #include <iostream>
25 
26 //----------------
27 // Constructors --
28 //---------------- // SM double TSM
29 DTSectCollPhCand::DTSectCollPhCand(DTSC* tsc, const DTChambPhSegm* tsmsegm, int ifs) : _tsc(tsc), _tsmsegm(tsmsegm) {
30  _dataword.one(); // reset dataword to 0x1ff
31  if (ifs == 1)
32  _dataword.unset(14); // set bit 14 (0=first, 1=second tracks)
33 }
34 
36 
37 //--------------
38 // Destructor --
39 //--------------
41 
42 //--------------
43 // Operations --
44 //--------------
45 
47  if (this != &tsccand) {
48  _tsc = tsccand._tsc;
49  _tsmsegm = tsccand._tsmsegm;
50  }
51  return *this;
52 }
53 
55  _tsmsegm = nullptr;
56  _dataword.one();
57  // std::cout << " clear dataword : " << _dataword.print() << std::endl;
58 }
59 
61  int sect = _tsmsegm->ChamberId().sector();
62  if (sect < 13)
63  return config()->CoarseSync(_tsmsegm->ChamberId().station());
64  else
65  return config()->CoarseSync(5);
66 }
67 
68 // SM double TSM: remove datawordbk and replace it with dataword
71 
72  if (abs(_tsmsegm->DeltaPsiR()) > 1024) { // Check phiB within 10 bits range
73  std::cout << "DTSectCollPhCand::setBitsSectColl phiB outside valid range: " << _tsmsegm->DeltaPsiR();
74  std::cout << " deltaPsiR set to 512" << std::endl;
75  } else {
76  // SM double TSM
77  // assign preview in dataword (common to any other assignment)
79  //
80  int a2 = 12;
81  int a1 = 11;
82  int a0 = 10;
83 
84  if (_tsmsegm->code() == 6) {
86  _dataword.unset(a1);
88  } // 1-000
89  if (_tsmsegm->code() == 5) {
91  _dataword.unset(a1);
92  } // 1-001
93  if (_tsmsegm->code() == 4) {
96  } // 1-010
97  if (_tsmsegm->code() == 3) {
98  _dataword.unset(a1);
99  } // 1-101
100  if (_tsmsegm->code() == 2) {
101  _dataword.unset(a1);
102  _dataword.unset(a0);
103  } // 1-100
104  // if( _tsmsegm->code()==1 ) no unset needed => 111
105  if (_tsmsegm->code() == 0) {
106  _dataword.unset(a0);
107  } // 1-110
108  }
109 }
110 
112  std::cout << "Sector Collector Phi Candidate: " << std::endl;
113  if (_dataword.element(14) == 0) {
114  std::cout << "First track type" << std::endl;
115  } else {
116  std::cout << "Second track type" << std::endl;
117  }
118  std::cout << " code=" << _tsmsegm->pvCode();
119  std::cout << " dataword=";
120  _dataword.print();
121  // SM double TSM remove datawordbk section
122  std::cout << " SC step=" << CoarseSync() + _tsmsegm->step();
123  std::cout << std::endl;
124 }
const DTChambPhSegm * _tsmsegm
int station() const
Return the station number.
Definition: DTChamberId.h:45
~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:41
int CoarseSync(int istat) const
Return coarsesync parameter in Sector Collector for station istat (5 is second MB4 station) ...
std::ostream & print(std::ostream &o=std::cout) const
Definition: BitArray.h:340
void setBitsSectColl()
Set the bits for DTTSM analysis.
int pvCode() const
Return the preview code (10*inner_code or outer_code; X_code=1,2,3,4,8)
DTChamberId ChamberId() const override
Return chamber identifier.
Definition: DTChambPhSegm.h:76
void one()
Definition: BitArray.h:217
DTSectCollPhCand()
Constructor.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void print() const
Print the trigger.
void unset(const int i)
Definition: BitArray.h:225
static constexpr float a0
int step() const
Return step number.
Definition: DTChambPhSegm.h:73
int DeltaPsiR() const
Return bending angle (bit pattern)
void assign(const int p, const int n, const int val)
Definition: BitArray.h:233
const DTConfigSectColl * config() const
Configuration set.
int sector() const
Definition: DTChamberId.h:52
BitArray< 15 > _dataword
int element(const int pos) const
Definition: BitArray.h:206
int CoarseSync() const
Return the Coarse Sync Parameter.
int code() const
Return trigger code (MTTF input format [0,7])
Definition: DTChambPhSegm.h:88