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