CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonInternalTrack.cc
Go to the documentation of this file.
2 
5 
9 
10 using namespace L1TMuon;
11 
13  L1MuRegionalCand(dttrack) {
14  _mode = 0;
15  _wheel = dttrack.whNum();
16  _endcap = (_wheel < 0) ? -1 : 1;
17  _sector = dttrack.scNum()/2 + 1; // 0-11 -> 1 - 6
18 }
19 
21  L1MuRegionalCand(csctrack) {
22  _mode = 0;
23  _endcap = (csctrack.endcap() == 2) ? -1 : 1;
24  _wheel = (_endcap < 0) ? -4 : 4;
25  _sector = csctrack.sector();
26 }
27 
29  const RPCL1LinkRef& rpclink):
30  L1MuRegionalCand(rpctrack) {
31  _parentlink = rpclink;
32  _mode = 0;
33  _endcap = -99;
34  _wheel = -99;
35  _sector = -99;
36 }
37 
38 unsigned InternalTrack::type_idx() const {
40  return _type;
41 }
42 
44  unsigned station;
47  switch(type){
49  offset = kCSC;
50  station = stub.detId<CSCDetId>().station();
51  break;
53  offset = kDT;
54  station = stub.detId<DTChamberId>().station();
55  break;
57  offset = kRPCb;
58  if(stub.detId<RPCDetId>().region() != 0)
59  offset = kRPCf;
60  station = stub.detId<RPCDetId>().station();
61  break;
62  default:
63  throw cms::Exception("Invalid Subsytem")
64  << "The specified subsystem for this track stub is out of range"
65  << std::endl;
66  }
67 
68  const unsigned shift = 4*offset + station - 1;
69  const unsigned bit = 1 << shift;
70  // add this track to the mode
71  _mode = _mode | bit;
72  if( _associatedStubs.count(shift) == 0 ) {
74  }
75  _associatedStubs[shift].push_back(stub);
76 }
77 
78 // this magic file contains a DT TrackClass -> mode LUT
80 
81 void InternalTrack::print(std::ostream& out) const {
82  std::cout << "Internal Track -- endcap: " << std::dec << _endcap
83  << " wheel: " << _wheel
84  << " sector: " << _sector << std::endl;
85  std::cout << "\t eta index: " << eta_packed()
86  << "\t phi index: " << phi_packed() << std::endl;
87  std::cout << "\tMode: " << std::hex
88  << mode() << std::dec << std::endl;
89  std::cout << "\tMode Breakdown: " << std::hex
90  << " DT: " << dtMode() << " RPCb: " << rpcbMode()
91  << " CSC: " << cscMode() << " RPCf: " << rpcfMode()
92  << std::dec << std::endl;
93  std::cout << "\tQuality: " << quality() << std::endl;
94  DTTrackRef dtparent;
95  CSCTrackRef cscparent;
96  RegionalCandRef rpcparent;
97  unsigned mode;
98  switch( type_idx() ) {
99  case 0: // DT
100  dtparent = _parent.castTo<DTTrackRef>();
101  mode = tc2bitmap((TrackClass)dtparent->TCNum());
102  std::cout << "\tParent is a DT Track!" << std::endl;
103  std::cout << "\t Parent Track Class: " << dtparent->TCNum() << std::endl;
104  std::cout << "\t Parent Mode: " << std::hex
105  << mode
106  << std::dec << std::endl;
107  std::cout << "\t MB 1: " << dtparent->stNum(1)
108  << "\t MB 2: " << dtparent->stNum(2)
109  << "\t MB 3: " << dtparent->stNum(3)
110  << "\t MB 4: " << dtparent->stNum(4) << std::endl;
111  if( (mode & 0x1) != (dtMode() & 0x1) ) {
112  std::cout << "DT-Based Internal Track did not find expected DT"
113  << " segment in station 1!" << std::endl;
114  }
115  if( (mode & 0x2) != (dtMode() & 0x2) ) {
116  std::cout << "DT-Based Internal Track did not find expected DT"
117  << " segment in station 2!" << std::endl;
118  }
119  if( std::abs(dtparent->whNum()) == 3 ) {
120  if( dtparent->stNum(3) == 0 || dtparent->stNum(3) == 1) { // CSC track!
121  if( (mode & 0x4) != ((cscMode() & 0x1)<<2) ) {
122  std::cout << "DT-Based Internal Track did not find expected CSC"
123  << " segment in station 1!" << std::endl;
124  }
125  } else {
126  if( (mode & 0x4) != (dtMode() & 0x4) ) {
127  std::cout << "DT-Based Internal Track did not find expected DT"
128  << " segment in station 3!" << std::endl;
129  }
130  }
131  } else {
132  if( (mode & 0x4) != (dtMode() & 0x4) ) {
133  std::cout << "DT-Based Internal Track did not find expected DT"
134  << " segment in station 3!" << std::endl;
135  }
136  }
137  if( (mode & 0x8) != (dtMode() & 0x8) ) {
138  std::cout << "DT-Based Internal Track did not find expected DT"
139  << " segment in station 4!" << std::endl;
140  }
141  std::cout << "\t Parent Quality: " << dtparent->quality() << std::endl;
142  break;
143  case 1: // RPCb
144  rpcparent = _parent.castTo<RegionalCandRef>();
145  std::cout << "\tParent is a RPCb Track!" << std::endl;
146  std::cout << "\t Parent Quality: " << rpcparent->quality() << std::endl;
147  std::cout << "\t Parent phi: " << rpcparent->phi_packed() << std::endl;
148  std::cout << "\t Parent eta: " << rpcparent->eta_packed() << std::endl;
149  break;
150  case 2: // CSC
151  cscparent = _parent.castTo<CSCTrackRef>();
152  std::cout << "\tParent is a CSC Track!" << std::endl;
153  std::cout << "\t Parent Mode: " << std::hex
154  << cscparent->mode()
155  << std::dec << std::endl
156  << "\t ME 1: " << cscparent->me1ID()
157  << "\t ME 2: " << cscparent->me2ID()
158  << "\t ME 3: " << cscparent->me3ID()
159  << "\t ME 4: " << cscparent->me4ID()
160  << "\t MB 1: " << cscparent->mb1ID() << std::endl;
161  if( (bool)(cscparent->me1ID()) != (bool)(cscMode() & 0x1) ) {
162  std::cout << "CSC-Based Internal Track did not find expected CSC"
163  << " segment in station 1!" << std::endl;
164  }
165  if( (bool)(cscparent->me2ID()) != (bool)(cscMode() & 0x2) ) {
166  std::cout << "CSC-Based Internal Track did not find expected CSC"
167  << " segment in station 2!" << std::endl;
168  }
169  if( (bool)(cscparent->me3ID()) != (bool)(cscMode() & 0x4) ) {
170  std::cout << "CSC-Based Internal Track did not find expected CSC"
171  << " segment in station 3!" << std::endl;
172  }
173  if( (bool)(cscparent->me4ID()) != (bool)(cscMode() & 0x8) ) {
174  std::cout << "CSC-Based Internal Track did not find expected CSC"
175  << " segment in station 4!" << std::endl;
176  }
177  if( (bool)(cscparent->mb1ID()) != (bool)(dtMode() & 0x1) ) {
178  std::cout << "CSC-Based Internal Track did not find expected DT"
179  << " segment in station 1!" << std::endl;
180  }
181  std::cout << "\t Parent Quality: " << cscparent->quality() << std::endl;
182  break;
183  case 3: // RPCf
184  rpcparent = _parent.castTo<RegionalCandRef>();
185  std::cout << "\tParent is a RPCf Track!" << std::endl;
186  std::cout << "\t Parent Quality: " << rpcparent->quality() << std::endl;
187  std::cout << "\t Parent phi: " << rpcparent->phi_packed() << std::endl;
188  std::cout << "\t Parent eta: " << rpcparent->eta_packed() << std::endl;
189  break;
190  case 4: // L1ITMu ?
191  break;
192  default:
193  throw cms::Exception("Unknown Track Type")
194  << "L1ITMu::InternalTrack is of unknown track type: " << type_idx()
195  << std::endl;
196  }
197 }
type
Definition: HCALResponse.h:21
const subsystem_type subsystem() const
virtual void print() const
print candidate
unsigned long rpcbMode() const
unsigned long rpcfMode() const
int whNum() const
unsigned long cscMode() const
bool isNonnull() const
Checks for non-null.
Definition: RefToBase.h:322
const unsigned int tc2bitmap(const TrackClass tc)
RegionalCandBaseRef _parent
void addStub(const TriggerPrimitive &stub)
unsigned type_idx() const
std::vector< TriggerPrimitive > TriggerPrimitiveCollection
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
unsigned eta_packed() const
return eta packed as in hardware
unsigned long mode() const
unsigned sector() const
Definition: L1Track.h:45
int scNum() const
REF castTo() const
Definition: RefToBase.h:271
TriggerPrimitiveStationMap _associatedStubs
unsigned int quality() const
return quality
unsigned long dtMode() const
unsigned endcap() const
Definition: L1Track.h:44
static unsigned int const shift
tuple cout
Definition: gather_cfg.py:145
unsigned type_idx() const
return type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC
unsigned phi_packed() const
return phi packed as in hardware
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63