CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1AnalysisGMT.cc
Go to the documentation of this file.
2 
3 
5 {
6 }
7 
8 
10 {
11 }
12 
13 void L1Analysis::L1AnalysisGMT::Set(const L1MuGMTReadoutCollection* gmtrc, unsigned maxDTBX, unsigned maxCSC, unsigned maxRPC, unsigned maxGMT, bool physVal)
14 {
15 
16  std::vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
17  std::vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
18  for(igmtrr=gmt_records.begin(); igmtrr!=gmt_records.end(); igmtrr++) {
19 
20  std::vector<L1MuRegionalCand>::const_iterator iter1;
21  std::vector<L1MuRegionalCand> rmc;
22 
23  if(igmtrr->getBxInEvent()==0) {
24  gmt_.EvBx = igmtrr->getBxNr();
25  }
26 
27 
28  //
29  // DTBX Trigger
30  //
31 
32  int iidt = 0;
33  rmc = igmtrr->getDTBXCands();
34  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
35  if ( (unsigned) gmt_.Ndt < maxDTBX && !(*iter1).empty() ) {
36  gmt_.Bxdt.push_back((*iter1).bx());
37  if(physVal) {
38  gmt_.Etadt.push_back(float((*iter1).etaValue()));
39  gmt_.Phidt.push_back(float((*iter1).phiValue()));
40  gmt_.Ptdt.push_back(float((*iter1).ptValue()));
41  } else {
42  gmt_.Etadt.push_back(float((*iter1).eta_packed()));
43  gmt_.Phidt.push_back(float((*iter1).phi_packed()));
44  gmt_.Ptdt.push_back(float((*iter1).pt_packed()));
45  }
46  gmt_.Chadt.push_back((*iter1).chargeValue()); if(!(*iter1).chargeValid()) gmt_.Chadt.push_back(0);
47  gmt_.FineEtadt.push_back((*iter1).isFineHalo());
48  gmt_.Qualdt.push_back((*iter1).quality());
49  gmt_.Dwdt.push_back((*iter1).getDataWord());
50  gmt_.Chdt.push_back(iidt);
51 
52  gmt_.Ndt++;
53  }
54  iidt++;
55  }
56 
57  //
58  // CSC Trigger
59  //
60 
61  rmc = igmtrr->getCSCCands();
62  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
63  if ( (unsigned) gmt_.Ncsc < maxCSC && !(*iter1).empty() ) {
64  gmt_.Bxcsc.push_back((*iter1).bx());
65  if(physVal) {
66  gmt_.Etacsc.push_back((*iter1).etaValue());
67  gmt_.Phicsc.push_back((*iter1).phiValue());
68  gmt_.Ptcsc.push_back((*iter1).ptValue());
69  } else {
70  gmt_.Etacsc.push_back((*iter1).eta_packed());
71  gmt_.Phicsc.push_back((*iter1).phi_packed());
72  gmt_.Ptcsc.push_back((*iter1).pt_packed());
73  }
74  gmt_.Chacsc.push_back((*iter1).chargeValue()); if(!(*iter1).chargeValid()) gmt_.Chacsc.push_back(0);
75  gmt_.Qualcsc.push_back((*iter1).quality());
76  gmt_.Dwcsc.push_back((*iter1).getDataWord());
77 
78  gmt_.Ncsc++;
79  }
80  }
81 
82 
83 
84  //
85  // RPCb Trigger
86  //
87 
88  rmc = igmtrr->getBrlRPCCands();
89  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
90  if ( (unsigned) gmt_.Nrpcb < maxRPC && !(*iter1).empty() ) {
91  gmt_.Bxrpcb.push_back((*iter1).bx());
92  if(physVal) {
93  gmt_.Etarpcb.push_back((*iter1).etaValue());
94  gmt_.Phirpcb.push_back((*iter1).phiValue());
95  gmt_.Ptrpcb.push_back((*iter1).ptValue());
96  } else {
97  gmt_.Etarpcb.push_back((*iter1).eta_packed());
98  gmt_.Phirpcb.push_back((*iter1).phi_packed());
99  gmt_.Ptrpcb.push_back((*iter1).pt_packed());
100  }
101  gmt_.Charpcb.push_back((*iter1).chargeValue()); if(!(*iter1).chargeValid()) gmt_.Charpcb.push_back(0);
102  gmt_.Qualrpcb.push_back((*iter1).quality());
103  gmt_.Dwrpcb.push_back((*iter1).getDataWord());
104 
105  gmt_.Nrpcb++;
106  }
107  }
108 
109 
110  //
111  // RPCf Trigger
112  //
113 
114  rmc = igmtrr->getFwdRPCCands();
115  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
116  if ( (unsigned) gmt_.Nrpcf < maxRPC && !(*iter1).empty() ) {
117  gmt_.Bxrpcf.push_back((*iter1).bx());
118  if(physVal) {
119  gmt_.Etarpcf.push_back((*iter1).etaValue());
120  gmt_.Phirpcf.push_back((*iter1).phiValue());
121  gmt_.Ptrpcf.push_back((*iter1).ptValue());
122  } else {
123  gmt_.Etarpcf.push_back((*iter1).eta_packed());
124  gmt_.Phirpcf.push_back((*iter1).phi_packed());
125  gmt_.Ptrpcf.push_back((*iter1).pt_packed());
126  }
127  gmt_.Charpcf.push_back((*iter1).chargeValue()); if(!(*iter1).chargeValid()) gmt_.Charpcf.push_back(0);
128  gmt_.Qualrpcf.push_back((*iter1).quality());
129  gmt_.Dwrpcf.push_back((*iter1).getDataWord());
130 
131  gmt_.Nrpcf++;
132  }
133  }
134 
135  //
136  // GMT_. Trigger
137  //
138 
139  std::vector<L1MuGMTExtendedCand>::const_iterator gmt_iter;
140  std::vector<L1MuGMTExtendedCand> exc = igmtrr->getGMTCands();
141  for(gmt_iter=exc.begin(); gmt_iter!=exc.end(); gmt_iter++) {
142  if ( (unsigned) gmt_.N < maxGMT && !(*gmt_iter).empty() ) {
143  gmt_.CandBx.push_back((*gmt_iter).bx());
144  if(physVal) {
145  gmt_.Eta.push_back((*gmt_iter).etaValue());
146  gmt_.Phi.push_back((*gmt_iter).phiValue());
147  gmt_.Pt.push_back((*gmt_iter).ptValue());
148  } else {
149  gmt_.Eta.push_back((*gmt_iter).etaIndex());
150  gmt_.Phi.push_back((*gmt_iter).phiIndex());
151  gmt_.Pt.push_back((*gmt_iter).ptIndex());
152  }
153  gmt_.Cha.push_back((*gmt_iter).charge()); if(!(*gmt_iter).charge_valid()) gmt_.Cha.push_back(0);
154  gmt_.Qual.push_back((*gmt_iter).quality());
155  gmt_.Det.push_back((*gmt_iter).detector());
156  gmt_.Rank.push_back((*gmt_iter).rank());
157  gmt_.Isol.push_back((*gmt_iter).isol());
158  gmt_.Mip.push_back((*gmt_iter).mip());
159  gmt_.Dw.push_back((*gmt_iter).getDataWord());
160 
161  gmt_.IdxRPCb.push_back(-1);
162  gmt_.IdxRPCf.push_back(-1);
163  gmt_.IdxDTBX.push_back(-1);
164  gmt_.IdxCSC.push_back(-1);
165 
166  if ( (*gmt_iter).isMatchedCand() || (*gmt_iter).isRPC() ) {
167  if((*gmt_iter).isFwd()) {
168  gmt_.IdxRPCf.back() = (*gmt_iter).getRPCIndex();
169  } else {
170  gmt_.IdxRPCb.back() = (*gmt_iter).getRPCIndex();
171  }
172  }
173 
174  if ( (*gmt_iter).isMatchedCand() || ( !(*gmt_iter).isRPC() ) ) {
175  if ( (*gmt_iter).isFwd() ) {
176  gmt_.IdxCSC.back() = (*gmt_iter).getDTCSCIndex();
177  } else {
178  gmt_.IdxDTBX.back() = (*gmt_iter).getDTCSCIndex();
179  }
180  }
181  gmt_.N++;
182  }
183  }
184 
185  }
186 
187 
188 }
189 
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
void Set(const L1MuGMTReadoutCollection *gmtrc, unsigned maxDTBX, unsigned maxCSC, unsigned maxRPC, unsigned maxGMT, bool physVal)