CMS 3D CMS Logo

CSCGEMMotherboard.cc
Go to the documentation of this file.
3 
5  unsigned sector, unsigned subsector,
6  unsigned chamber,
7  const edm::ParameterSet& conf) :
8  CSCUpgradeMotherboard(endcap, station, sector, subsector, chamber, conf)
9  , maxDeltaBXPad_(tmbParams_.getParameter<int>("maxDeltaBXPad"))
10  , maxDeltaBXCoPad_(tmbParams_.getParameter<int>("maxDeltaBXCoPad"))
11  , useOldLCTDataFormat_(tmbParams_.getParameter<bool>("useOldLCTDataFormat"))
12  , promoteALCTGEMpattern_(tmbParams_.getParameter<bool>("promoteALCTGEMpattern"))
13  , promoteALCTGEMquality_(tmbParams_.getParameter<bool>("promoteALCTGEMquality"))
14  , doLCTGhostBustingWithGEMs_(tmbParams_.getParameter<bool>("doLCTGhostBustingWithGEMs"))
15 {
17 
18  const edm::ParameterSet coPadParams(conf.getParameter<edm::ParameterSet>("copadParam"));
19  coPadProcessor.reset( new GEMCoPadProcessor(endcap, station, 1, chamber, coPadParams) );
20 
21  maxDeltaPadL1_ = (par ? tmbParams_.getParameter<int>("maxDeltaPadL1Even") :
22  tmbParams_.getParameter<int>("maxDeltaPadL1Odd") );
23  maxDeltaPadL2_ = (par ? tmbParams_.getParameter<int>("maxDeltaPadL2Even") :
24  tmbParams_.getParameter<int>("maxDeltaPadL2Odd") );
25 }
26 
28 {
29 }
30 
32 {
33 }
34 
36 {
37  pads_.clear();
38  coPads_.clear();
39 }
40 
41 
43  const CSCComparatorDigiCollection* compdc,
44  const GEMPadDigiClusterCollection* gemClusters)
45 {
46  std::unique_ptr<GEMPadDigiCollection> gemPads(new GEMPadDigiCollection());
47  coPadProcessor->declusterize(gemClusters, *gemPads);
48  run(wiredc, compdc, gemPads.get());
49 }
50 
51 
53 {
54  pads_.clear();
55  auto superChamber(gem_g->superChamber(id));
56  for (const auto& ch : superChamber->chambers()) {
57  for (const auto& roll : ch->etaPartitions()) {
58  GEMDetId roll_id(roll->id());
59  auto pads_in_det = gemPads->get(roll_id);
60  for (auto pad = pads_in_det.first; pad != pads_in_det.second; ++pad) {
61  const int bx_shifted(lct_central_bx + pad->bx());
62  for (int bx = bx_shifted - maxDeltaBXPad_;bx <= bx_shifted + maxDeltaBXPad_; ++bx) {
63  pads_[bx].emplace_back(roll_id, *pad);
64  }
65  }
66  }
67  }
68 }
69 
71 {
72  coPads_.clear();
73  for (const auto& copad: gemCoPadV){
74  if (copad.first().bx() != lct_central_bx) continue;
75  coPads_[copad.bx(1)].push_back(std::make_pair(copad.roll(), copad));
76  }
77 }
78 
80  const GEMCoPadDigi& gem,
81  enum CSCPart part,
82  int trknmb)
83 {
84  return constructLCTsGEM(alct, CSCCLCTDigi(), GEMPadDigi(), gem, part, trknmb);
85 }
86 
87 
89  const GEMCoPadDigi& gem,
90  enum CSCPart part,
91  int trknmb)
92 {
93  return constructLCTsGEM(CSCALCTDigi(), clct, GEMPadDigi(), gem, part, trknmb);
94 }
95 
97  const CSCCLCTDigi& clct,
98  const GEMCoPadDigi& gem,
99  enum CSCPart part,
100  int trknmb)
101 {
102  return constructLCTsGEM(alct, clct, GEMPadDigi(), gem, part, trknmb);
103 }
104 
105 
107  const CSCCLCTDigi& clct,
108  const GEMPadDigi& gem,
109  enum CSCPart part,
110  int trknmb)
111 {
112  return constructLCTsGEM(alct, clct, gem, GEMCoPadDigi(), part, trknmb);
113 }
114 
116  const CSCCLCTDigi& clct,
117  const GEMPadDigi& gem1,
118  const GEMCoPadDigi& gem2,
119  enum CSCPart p, int trknmb)
120 {
121  // step 1: determine the case
122  int lctCase = lctTypes::Invalid;
123  if (alct.isValid() and clct.isValid() and gem1 != GEMPadDigi() and gem2 == GEMCoPadDigi()) lctCase = lctTypes::ALCTCLCT2GEM;
124  else if (alct.isValid() and clct.isValid() and gem1 == GEMPadDigi() and gem2 != GEMCoPadDigi()) lctCase = lctTypes::ALCTCLCTGEM;
125  else if (alct.isValid() and gem2 != GEMCoPadDigi()) lctCase = lctTypes::ALCT2GEM;
126  else if (clct.isValid() and gem2 != GEMCoPadDigi()) lctCase = lctTypes::CLCT2GEM;
127 
128  // step 2: assign properties depending on the LCT dataformat (old/new)
129  int pattern = 0, quality = 0, bx = 0, keyStrip = 0, keyWG = 0;
130  switch(lctCase){
131  case lctTypes::ALCTCLCTGEM: {
132  pattern = encodePattern(clct.getPattern(), clct.getStripType());
133  quality = findQualityGEM(alct, clct, 1);
134  bx = alct.getBX();
135  keyStrip = clct.getKeyStrip();
136  keyWG = alct.getKeyWG();
137  break;
138  }
139  case lctTypes::ALCTCLCT2GEM: {
140  pattern = encodePattern(clct.getPattern(), clct.getStripType());
141  quality = findQualityGEM(alct, clct, 2);
142  bx = alct.getBX();
143  keyStrip = clct.getKeyStrip();
144  keyWG = alct.getKeyWG();
145  break;
146  }
147  case lctTypes::ALCT2GEM: {
148  const auto& mymap1 = getLUT()->get_gem_pad_to_csc_hs(par, p);
149  pattern = promoteALCTGEMpattern_ ? 10 : 0;
150  quality = promoteALCTGEMquality_ ? 15 : 11;
151  bx = alct.getBX();
152  keyStrip = mymap1[gem2.pad(2)];
153  keyWG = alct.getKeyWG();
154  break;
155  }
156  case lctTypes::CLCT2GEM: {
157  const auto& mymap2 = getLUT()->get_gem_roll_to_csc_wg(par, p);
158  pattern = encodePattern(clct.getPattern(), clct.getStripType());
159  quality = promoteCLCTGEMquality_ ? 15 : 11;
160  bx = gem2.bx(1) + lct_central_bx;;
161  keyStrip = clct.getKeyStrip();
162  // choose the corresponding wire-group in the middle of the partition
163  keyWG = mymap2[gem2.roll()];
164  break;
165  }
166  };
167 
168  // future work: add a section that produces LCTs according
169  // to the new LCT dataformat (not yet defined)
170 
171  // step 3: make new LCT with afore assigned properties}
172  return CSCCorrelatedLCTDigi(trknmb, 1, quality, keyWG, keyStrip,
173  pattern, 0, bx, 0, 0, 0, theTrigChamber);
174 }
175 
176 
178 {
179  // this only works for ME1A!
180  const auto& mymap = (getLUT()->get_csc_wg_to_gem_roll(par));
181  for (unsigned i=0; i<mymap.size(); i++) {
182  // overlap region are WGs 10-15
183  if ((i < 10) or (i > 15)) continue;
184  if ((mymap[i].first <= roll) and (roll <= mymap[i].second)) return true;
185  }
186  return false;
187 }
188 
190 {
191  return p.bx();
192 }
193 
195 {
196  return p.bx(1);
197 }
198 
200 {
201  return GEMDetId(p.first).roll();
202 }
203 
205 {
206  return p.second.roll();
207 }
208 
210 {
211  return (getLUT()->get_csc_wg_to_gem_roll(par))[alct.getKeyWG()].first;
212 }
213 
215 {
216  return p.pad();
217 }
218 
220 {
221  return 0.5*(p.pad(1) + p.pad(2));
222 }
223 
225 {
226  const auto& mymap = (getLUT()->get_csc_hs_to_gem_pad(par, part));
227  return 0.5*(mymap[clct.getKeyStrip()].first + mymap[clct.getKeyStrip()].second);
228 }
229 
231 {
233  generator_->setGEMGeometry(gem_g);
234 }
235 
236 void CSCGEMMotherboard::printGEMTriggerPads(int bx_start, int bx_stop, enum CSCPart part)
237 {
238  LogTrace("CSCGEMMotherboard") << "------------------------------------------------------------------------" << std::endl;
239  LogTrace("CSCGEMMotherboard") << "* GEM trigger pads: " << std::endl;
240 
241  for (int bx = bx_start; bx <= bx_stop; bx++) {
242  const auto& in_pads = pads_[bx];
243  LogTrace("CSCGEMMotherboard") << "N(pads) BX " << bx << " : " << in_pads.size() << std::endl;
244 
245  for (const auto& pad : in_pads){
246  LogTrace("CSCGEMMotherboard") << "\tdetId " << GEMDetId(pad.first) << ", pad = " << pad.second;
247  const auto& roll_id(GEMDetId(pad.first));
248 
249  if (part==CSCPart::ME11 and isPadInOverlap(GEMDetId(roll_id).roll())) LogTrace("CSCGEMMotherboard") << " (in overlap)" << std::endl;
250  else LogTrace("CSCGEMMotherboard") << std::endl;
251  }
252  }
253 }
254 
255 
256 void CSCGEMMotherboard::printGEMTriggerCoPads(int bx_start, int bx_stop, enum CSCPart part)
257 {
258  LogTrace("CSCGEMMotherboard") << "------------------------------------------------------------------------" << std::endl;
259  LogTrace("CSCGEMMotherboard") << "* GEM trigger coincidence pads: " << std::endl;
260 
261  for (int bx = bx_start; bx <= bx_stop; bx++) {
262  const auto& in_pads = coPads_[bx];
263  LogTrace("CSCGEMMotherboard") << "N(copads) BX " << bx << " : " << in_pads.size() << std::endl;
264 
265  for (const auto& pad : in_pads){
266  LogTrace("CSCGEMMotherboard") << "\tdetId " << GEMDetId(pad.first) << ", pad = " << pad.second;
267  const auto& roll_id(GEMDetId(pad.first));
268 
269  if (part==CSCPart::ME11 and isPadInOverlap(GEMDetId(roll_id).roll())) LogTrace("CSCGEMMotherboard") << " (in overlap)" << std::endl;
270  else LogTrace("CSCGEMMotherboard") << std::endl;
271  }
272  }
273 }
274 
275 
276 unsigned int CSCGEMMotherboard::findQualityGEM(const CSCALCTDigi& aLCT, const CSCCLCTDigi& cLCT, int gemlayers)
277 {
278  /*
279  Same LCT quality definition as standard LCTs
280  a4 and c4 take GEMs into account!!!
281  */
282 
283  unsigned int quality = 0;
284 
285  // 2008 definition.
286  if (!(aLCT.isValid()) || !(cLCT.isValid())) {
287  if (aLCT.isValid() && !(cLCT.isValid())) quality = 1; // no CLCT
288  else if (!(aLCT.isValid()) && cLCT.isValid()) quality = 2; // no ALCT
289  else quality = 0; // both absent; should never happen.
290  }
291  else {
292  const int pattern(cLCT.getPattern());
293  if (pattern == 1) quality = 3; // layer-trigger in CLCT
294  else {
295  // ALCT quality is the number of layers hit minus 3.
296  // CLCT quality is the number of layers hit.
297  bool a4;
298  // GE11
299  if (theStation==1) {
300  a4 = (aLCT.getQuality() >= 1);
301  }
302  // GE21
303  else if (theStation==2) {
304  a4 = (aLCT.getQuality() >= 1) or (aLCT.getQuality() >= 0 and gemlayers >=1);
305  }
306  else {
307  return -1;
308  }
309  const bool c4((cLCT.getQuality() >= 4) or (cLCT.getQuality() >= 3 and gemlayers>=1));
310  // quality = 4; "reserved for low-quality muons in future"
311  if (!a4 && !c4) quality = 5; // marginal anode and cathode
312  else if ( a4 && !c4) quality = 6; // HQ anode, but marginal cathode
313  else if (!a4 && c4) quality = 7; // HQ cathode, but marginal anode
314  else if ( a4 && c4) {
315  if (aLCT.getAccelerator()) quality = 8; // HQ muon, but accel ALCT
316  else {
317  // quality = 9; "reserved for HQ muons with future patterns
318  // quality = 10; "reserved for HQ muons with future patterns
319  if (pattern == 2 || pattern == 3) quality = 11;
320  else if (pattern == 4 || pattern == 5) quality = 12;
321  else if (pattern == 6 || pattern == 7) quality = 13;
322  else if (pattern == 8 || pattern == 9) quality = 14;
323  else if (pattern == 10) quality = 15;
324  else {
325  if (infoV >= 0) edm::LogWarning("L1CSCTPEmulatorWrongValues")
326  << "+++ findQuality: Unexpected CLCT pattern id = "
327  << pattern << "+++\n";
328  }
329  }
330  }
331  }
332  }
333  return quality;
334 }
int getQuality() const
return quality of a pattern (number of layers hit!)
Definition: CSCCLCTDigi.h:33
void retrieveGEMPads(const GEMPadDigiCollection *pads, unsigned id)
T getParameter(std::string const &) const
match< GEMCoPadDigi > GEMCoPadDigiId
CSCCorrelatedLCTDigi constructLCTsGEM(const CSCALCTDigi &alct, const GEMCoPadDigi &gem, enum CSCPart, int i)
std::unique_ptr< CSCUpgradeMotherboardLUTGenerator > generator_
const unsigned theTrigChamber
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:30
GEMCoPadDigiIdsBX coPads_
int roll() const
Definition: GEMDetId.h:80
int getRoll(const GEMPadDigiId &p)
std::vector< int > get_gem_roll_to_csc_wg(Parity par, int layer=1) const
int getBX(const GEMPadDigi &p)
virtual ~CSCGEMMotherboard()
int pad(int l) const
Definition: GEMCoPadDigi.cc:32
int getStripType() const
return striptype
Definition: CSCCLCTDigi.h:39
std::vector< GEMCoPadDigi > gemCoPadV
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
U second(std::pair< T, U > const &p)
match< GEMPadDigi > GEMPadDigiId
const unsigned theStation
std::unique_ptr< GEMCoPadProcessor > coPadProcessor
virtual void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const GEMPadDigiCollection *gemPads)=0
int bx(int l) const
Definition: GEMCoPadDigi.cc:40
virtual std::vector< std::pair< int, int > > get_csc_hs_to_gem_pad(Parity par, enum CSCPart) const =0
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
int pad() const
Definition: GEMPadDigi.h:26
unsigned int encodePattern(const int ptn, const int highPt)
void printGEMTriggerCoPads(int bx_start, int bx_stop, enum CSCPart)
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:30
CSCCorrelatedLCTDigi constructLCTsGEM(const CSCALCTDigi &alct, const CSCCLCTDigi &clct, const GEMCoPadDigi &gem, enum CSCPart p, int i)
#define LogTrace(id)
const GEMSuperChamber * superChamber(GEMDetId id) const
Definition: GEMGeometry.cc:91
int getBX() const
return BX - five low bits of BXN counter tagged by the ALCT
Definition: CSCALCTDigi.h:48
virtual std::vector< int > get_gem_pad_to_csc_hs(Parity par, enum CSCPart) const =0
edm::ParameterSet tmbParams_
int getQuality() const
return quality of a pattern
Definition: CSCALCTDigi.h:33
int getAccelerator() const
Definition: CSCALCTDigi.h:37
int bx() const
Definition: GEMPadDigi.h:27
int getPattern() const
return pattern
Definition: CSCCLCTDigi.h:36
part
Definition: HCALResponse.h:20
MuonDigiCollection< GEMDetId, GEMPadDigi > GEMPadDigiCollection
virtual const CSCGEMMotherboardLUT * getLUT() const =0
unsigned int findQualityGEM(const CSCALCTDigi &, const CSCCLCTDigi &, int gemlayer)
GEMPadDigiIdsBX pads_
std::unique_ptr< CSCAnodeLCTProcessor > alct
std::unique_ptr< CSCCathodeLCTProcessor > clct
bool isPadInOverlap(int roll)
int getKeyStrip() const
Definition: CSCCLCTDigi.h:65
const GEMGeometry * gem_g
float getAvePad(const GEMPadDigi &)
int getKeyWG() const
return key wire group
Definition: CSCALCTDigi.h:45
void printGEMTriggerPads(int bx_start, int bx_stop, enum CSCPart)
std::vector< std::pair< int, int > > get_csc_wg_to_gem_roll(Parity par, int layer=1) const