CMS 3D CMS Logo

DTTSTheta.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuDTTSTheta.cpp
4 //
5 // Description: Implementation of TS Theta trigger algorithm
6 //
7 //
8 // Author List:
9 // C. Grandi
10 // Modifications:
11 // III/2005 : Sara Vanini NEWGEO update
12 // I/2007 : Carlo Battilana Config class update
13 // mar07 - S. Vanini : parameters from DTConfigManager
14 //
15 //--------------------------------------------------
16 
17 //-----------------------
18 // This Class's Header --
19 //-----------------------
21 
22 //-------------------------------
23 // Collaborating Class Headers --
24 //-------------------------------
28 
29 //---------------
30 // C++ Headers --
31 //---------------
32 #include <iostream>
33 
34 //----------------
35 // Constructors --
36 //----------------
37 DTTSTheta::DTTSTheta(DTTrigGeom* geom, DTBtiCard* bticard) : DTGeomSupplier(geom), _bticard(bticard) {
38  for (int i = 0; i < DTConfigTSTheta::NSTEPL - DTConfigTSTheta::NSTEPF + 1; i++) {
39  _trig[i].zero();
40  _Htrig[i].zero();
41  _ntrig[i] = 0;
42  _nHtrig[i] = 0;
43  }
44 }
45 
46 //--------------
47 // Destructor --
48 //--------------
50  //delete _config;
51 }
52 
53 //--------------
54 // Operations --
55 //--------------
56 
58  for (int is = 0; is < DTConfigTSTheta::NSTEPL - DTConfigTSTheta::NSTEPF + 1; is++) {
59  // clear input bit masks
60  _trig[is].zero();
61  _Htrig[is].zero();
62  _ntrig[is] = 0;
63  _nHtrig[is] = 0;
64  }
65 }
66 
68  DTChamberId sid = ChamberId();
69  _config = conf->getDTConfigTSTheta(sid);
70 }
71 
73  localClear();
74  if (station() == 4)
75  return;
76 
77  if (config()->debug()) {
78  std::cout << "DTTSTheta::loadDTTSTheta called for wheel=" << wheel();
79  std::cout << ", station=" << station();
80  std::cout << ", sector=" << sector() << std::endl;
81  }
82 
83  // loop on all BTI triggers
84  std::vector<DTBtiTrigData>::const_iterator p;
85  std::vector<DTBtiTrigData>::const_iterator pend = _bticard->end();
86  for (p = _bticard->begin(); p != pend; p++) {
87  // Look only to BTIs in SL 2
88  if (p->btiSL() == 2) {
89  // BTI number
90  int step = p->step();
91  add_btiT(step, &(*p));
92  }
93  }
94 }
95 
96 void DTTSTheta::add_btiT(int step, const DTBtiTrigData* btitrig) {
97  int n = btitrig->btiNumber();
98 
99  /*
100 OBSOLETE! in NEWGEO the bti number order is the correct one!
101  // check where the BTI is, and reverse the order in stat 1 and 2 and 3 (only for some sectors)
102 
103  if( (wheel()==0 && (sector()==1 || sector()==4 || sector()==5 ||
104  sector()==8 || sector()==9 || sector()==12))
105  || wheel()==-1
106  || wheel()==-2)
107  {n=DTConfigTSTheta::NCELLTH + 1 - n; }
108 
109 */
110 
111  if (n < 1 || n > geom()->nCell(2)) {
112  std::cout << "DTTSTheta::add_btiT: BTI out of range: " << n;
113  std::cout << " trigger not added!" << std::endl;
114  return;
115  }
117  std::cout << "DTTSTheta::add_btiT: step out of range: " << step;
118  std::cout << " trigger not added!" << std::endl;
119  return;
120  }
123 
124  if (btitrig->code() == 8) {
127  }
128 
129  if (config()->debug()) {
130  std::cout << "BTI Trigger added at step " << step;
131  std::cout << " to DTTSTheta at position " << n << std::endl;
132  }
133  return;
134 }
135 
137  // Just make a DTChambThSegm for each step and store it
138  for (int is = DTConfigTSTheta::NSTEPF; is < DTConfigTSTheta::NSTEPL + 1; is++) {
139  if (_ntrig[is - DTConfigTSTheta::NSTEPF] > 0) {
140  int i = 0;
141  int code[8];
142  int pos[8];
143  int qual[8];
144  for (i = 0; i < 8; i++) {
145  //@@ MULT not implemented:
146  pos[i] = btiMask(is)->byte(i).any();
147  qual[i] = btiQual(is)->byte(i).any();
148  code[i] = pos[i] + qual[i];
149  }
150 
151  // SM .OR. response of BTI number 57 in previous group of 8 BTIs
152 
153  if (pos[7] > pos[6])
154  pos[6] = pos[7];
155  if (qual[7] > qual[6])
156  qual[6] = qual[7];
157  if (code[7] > code[6])
158  code[6] = code[7];
159 
160  if (config()->debug()) {
161  std::cout << " wheel = " << wheel() << " station = " << station() << " sector = " << sector() << std::endl;
162  std::cout << " pos : ";
163  for (i = 0; i < 8; i++) {
164  std::cout << pos[i] << " ";
165  }
166  std::cout << std::endl;
167  std::cout << " qual : ";
168  for (i = 0; i < 8; i++) {
169  std::cout << qual[i] << " ";
170  }
171  std::cout << std::endl;
172  std::cout << " code : ";
173  for (i = 0; i < 8; i++) {
174  std::cout << code[i] << " ";
175  }
176  std::cout << std::endl;
177  std::cout << std::endl;
178  }
179 
180  _cache.push_back(DTChambThSegm(ChamberId(), is, pos, qual));
181  }
182  }
183 
184  // debugging...
185  if (config()->debug()) {
186  if (!_cache.empty()) {
187  std::cout << "====================================================" << std::endl;
188  std::cout << " Theta segments " << std::endl;
189  std::vector<DTChambThSegm>::const_iterator p;
190  for (p = _cache.begin(); p < _cache.end(); p++) {
191  p->print();
192  }
193  std::cout << "====================================================" << std::endl;
194  }
195  }
196  // end debugging
197 }
198 
200  int n = 0;
201  std::vector<DTChambThSegm>::const_iterator p;
202  for (p = begin(); p < end(); p++) {
203  if (p->step() == step)
204  n++;
205  }
206  return n;
207 }
208 
209 const DTChambThSegm* DTTSTheta::segment(int step, unsigned n) {
210  std::vector<DTChambThSegm>::const_iterator p;
211  for (p = begin(); p < end(); p++) {
212  if (p->step() == step && n == 1)
213  return &(*p);
214  }
215  return nullptr;
216 }
217 
220  std::cout << "DTTSTheta::nTrig: step out of range " << step;
221  std::cout << " 0 returned" << std::endl;
222  return 0;
223  }
224  if (size() > 0)
226  return 0;
227 }
228 
231  std::cout << "DTTSTheta::nHTrig: step out of range " << step;
232  std::cout << " 0 returned" << std::endl;
233  return 0;
234  }
235  if (size() > 0)
237  return 0;
238 }
239 
242  std::cout << "DTTSTheta::btiMask: step out of range " << step;
243  std::cout << " empty pointer returned" << std::endl;
244  return nullptr;
245  }
247 }
248 
251  std::cout << "DTTSTheta::btiQual: step out of range " << step;
252  std::cout << " empty pointer returned" << std::endl;
253  return nullptr;
254  }
256 }
257 
259  //const DTChambThSegm* trig = dynamic_cast<const DTChambThSegm*>(tr);
260  //@@ Not implemented yet
261  return LocalPoint(0, 0, 0);
262 }
263 
265  //const DTChambThSegm* trig = dynamic_cast<const DTChambThSegm*>(tr);
266  //@@ Not implemented yet
267  return LocalVector(0, 0, 0);
268 }
269 
270 void DTTSTheta::print(const DTTrigData* trig) const {
271  trig->print();
272  //@@ coordinate printing not implemented yet
273  //@@ rermove this method as soon as the local coordinates are meaningful
274 }
Vector3DBase< float, LocalTag >
DTBtiCard
Definition: DTBtiCard.h:62
mps_fire.i
i
Definition: mps_fire.py:428
DTTSTheta::localClear
void localClear()
Clear.
Definition: DTTSTheta.cc:57
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
DTCache::size
int size() const
Get cache vector's size.
Definition: DTCache.h:44
DTTSTheta::_config
const DTConfigTSTheta * _config
Definition: DTTSTheta.h:108
DTTSTheta::localDirection
LocalVector localDirection(const DTTrigData *) const override
Local direction in chamber of a L1Trigger-data object.
Definition: DTTSTheta.cc:264
step
step
Definition: StallMonitor.cc:94
DTBtiTrigData::code
int code() const
Return trigger code.
Definition: DTBtiTrigData.h:105
DTGeomSupplier
Definition: DTGeomSupplier.h:42
DTChambThSegm.h
BitArray::zero
void zero()
Definition: BitArray.h:210
BitArray::any
int any()
Definition: BitArray.h:176
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
gather_cfg.cout
cout
Definition: gather_cfg.py:144
pos
Definition: PixelAliasList.h:18
DTTSTheta::setConfig
void setConfig(const DTConfigManager *conf)
Set configuration.
Definition: DTTSTheta.cc:67
DTTSTheta::config
const DTConfigTSTheta * config() const
Return configuration.
Definition: DTTSTheta.h:54
DTConfig::NSTEPL
static const int NSTEPL
Constants: first and last step to start trigger finding.
Definition: DTConfig.h:35
DTConfig::NSTEPF
static const int NSTEPF
Definition: DTConfig.h:35
DTTSTheta::print
void print(const DTTrigData *trig) const override
Print a L1Trigger-data object with also local and global position/direction.
Definition: DTTSTheta.cc:270
align::LocalPoint
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
DTTSTheta::_ntrig
int _ntrig[DTConfigTSTheta::NSTEPL - DTConfigTSTheta::NSTEPF+1]
Definition: DTTSTheta.h:113
DTCache::begin
const_iterator begin() const
Get first cache element.
Definition: DTCache.h:38
DTTSTheta::add_btiT
void add_btiT(int step, const DTBtiTrigData *btitrig)
Add a DTBtiChip L1Trigger to the DTTSTheta.
Definition: DTTSTheta.cc:96
DTGeomSupplier::ChamberId
DTChamberId ChamberId() const
Identifier of the associated chamber.
Definition: DTGeomSupplier.h:57
DTBtiTrigData::btiNumber
int btiNumber() const
Return parent BTI number.
Definition: DTBtiTrigData.h:96
DTGeomSupplier::sector
int sector() const
Return sector number.
Definition: DTGeomSupplier.h:66
DTTSTheta::_bticard
DTBtiCard * _bticard
Definition: DTTSTheta.h:106
debug
#define debug
Definition: HDRShower.cc:19
DTCache::_cache
my_collection _cache
Definition: DTCache.h:53
DTTSTheta::nHTrig
int nHTrig(int step)
Return number of DTBtiChip fired with a HTRIG (used by DTTracoChip)
Definition: DTTSTheta.cc:229
DTConfigManager::getDTConfigTSTheta
const DTConfigTSTheta * getDTConfigTSTheta(DTChamberId) const
Get desired Trigger Server Theta configuration.
Definition: DTConfigManager.cc:116
DTTSTheta.h
DTChambThSegm
Definition: DTChambThSegm.h:39
DTBtiTrigData
Definition: DTBtiTrigData.h:39
DTTSTheta::DTTSTheta
DTTSTheta(DTTrigGeom *, DTBtiCard *)
Constructor.
Definition: DTTSTheta.cc:37
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
DTTSTheta::btiQual
BitArray< DTConfigTSTheta::NCELLTH > * btiQual(int step) const
Return the BitArray of DTBtiChip fired with a HTRIG.
Definition: DTTSTheta.cc:249
Point3DBase< float, LocalTag >
DTTSTheta::localPosition
LocalPoint localPosition(const DTTrigData *) const override
Local position in chamber of a L1Trigger-data object.
Definition: DTTSTheta.cc:258
DTTSTheta::runDTTSTheta
void runDTTSTheta()
run DTTSTheta algorithm (build the mask)
Definition: DTTSTheta.cc:136
DTGeomSupplier::wheel
int wheel() const
Return wheel number.
Definition: DTGeomSupplier.h:60
DTTSTheta::nTrig
int nTrig(int step)
Return number of DTBtiChip fired (used by DTTracoChip)
Definition: DTTSTheta.cc:218
DTTrigData
Definition: DTTrigData.h:35
DTCache::end
const_iterator end() const
Get last cache element.
Definition: DTCache.h:41
LocalVector
Local3DVector LocalVector
Definition: LocalVector.h:12
DTTSTheta::loadDTTSTheta
void loadDTTSTheta()
store DTBtiChip L1Triggers in the TST
Definition: DTTSTheta.cc:72
DTTSTheta::nSegm
int nSegm(int step)
Return number of TStheta segments (just 1)
Definition: DTTSTheta.cc:199
DTTSTheta::segment
const DTChambThSegm * segment(int step, unsigned n)
Return the requested DTTSTheta segment (only the first)
Definition: DTTSTheta.cc:209
DTConfigManager
Definition: DTConfigManager.h:49
ClusterTask_cfi.trig
trig
Definition: ClusterTask_cfi.py:398
DTTSTheta::_nHtrig
int _nHtrig[DTConfigTSTheta::NSTEPL - DTConfigTSTheta::NSTEPF+1]
Definition: DTTSTheta.h:114
DTTSTheta::_trig
BitArray< DTConfigTSTheta::NCELLTH > _trig[DTConfigTSTheta::NSTEPL - DTConfigTSTheta::NSTEPF+1]
Definition: DTTSTheta.h:111
BitArray::byte
BitArray< 8 > byte(const int i) const
Definition: BitArray.h:282
DTTrigGeom
Definition: DTTrigGeom.h:41
DTGeomSupplier::station
int station() const
Return station number.
Definition: DTGeomSupplier.h:63
DTTSTheta::btiMask
BitArray< DTConfigTSTheta::NCELLTH > * btiMask(int step) const
Return the BitArray of DTBtiChip fired.
Definition: DTTSTheta.cc:240
BitArray::set
void set(const int i)
Definition: BitArray.h:224
DTGeomSupplier::geom
DTTrigGeom * geom() const
Associated geometry.
Definition: DTGeomSupplier.h:51
DTChamberId
Definition: DTChamberId.h:14
DTBtiTrigData.h
DTTSTheta::_Htrig
BitArray< DTConfigTSTheta::NCELLTH > _Htrig[DTConfigTSTheta::NSTEPL - DTConfigTSTheta::NSTEPF+1]
Definition: DTTSTheta.h:112
BitArray< DTConfigTSTheta::NCELLTH >
DTTSTheta::~DTTSTheta
~DTTSTheta() override
Destructor.
Definition: DTTSTheta.cc:49
DTBtiCard.h