CMS 3D CMS Logo

CSCUpgradeMotherboard.cc
Go to the documentation of this file.
3 
5  : match_trig_window_size_(trig_window_size)
6 {
7 }
8 
11 {
12  return data[bx][match_bx][lct];
13 }
14 
15 void
17  std::vector<CSCCorrelatedLCTDigi>& lcts) const
18 {
19  for (unsigned int mbx = 0; mbx < match_trig_window_size_; mbx++) {
20  for (int i=0;i<2;i++) {
21  // consider only valid LCTs
22  if (not data[bx][mbx][i].isValid()) continue;
23 
24  // remove duplicated LCTs
25  if (std::find(lcts.begin(), lcts.end(), data[bx][mbx][i]) != lcts.end()) continue;
26 
27  lcts.push_back(data[bx][mbx][i]);
28  }
29  }
30 }
31 
32 void
33 CSCUpgradeMotherboard::LCTContainer::getMatched(std::vector<CSCCorrelatedLCTDigi>& lcts) const
34 {
35  for (int bx = 0; bx < CSCConstants::MAX_LCT_TBINS; bx++){
36  std::vector<CSCCorrelatedLCTDigi> temp_lcts;
38  lcts.insert(std::end(lcts), std::begin(temp_lcts), std::end(temp_lcts));
39  }
40 }
41 
42 void
44 {
45  // Loop over all time windows
46  for (int bx = 0; bx < CSCConstants::MAX_LCT_TBINS; bx++) {
47  // Loop over all matched trigger windows
48  for (unsigned int mbx = 0; mbx < match_trig_window_size_; mbx++) {
49  // Loop over all stubs
50  for (int i=0;i<CSCConstants::MAX_LCTS_PER_CSC;i++) {
51  data[bx][mbx][i].clear();
52  }
53  }
54  }
55 }
56 
58  unsigned sector, unsigned subsector,
59  unsigned chamber,
60  const edm::ParameterSet& conf) :
61  // special configuration parameters for ME11 treatment
62  CSCMotherboard(endcap, station, sector, subsector, chamber, conf)
64  // special configuration parameters for ME11 treatment
65  , disableME1a(commonParams_.getParameter<bool>("disableME1a"))
66  , gangedME1a(commonParams_.getParameter<bool>("gangedME1a"))
67 {
68  if (!isSLHC_) edm::LogError("CSCUpgradeMotherboard|ConfigError")
69  << "+++ Upgrade CSCUpgradeMotherboard constructed while isSLHC_ is not set! +++\n";
70 
71  theRegion = (theEndcap == 1) ? 1: -1;
74 
75  // generate the LUTs
77 
78  match_earliest_alct_only = tmbParams_.getParameter<bool>("matchEarliestAlctOnly");
79  match_earliest_clct_only = tmbParams_.getParameter<bool>("matchEarliestClctOnly");
80  clct_to_alct = tmbParams_.getParameter<bool>("clctToAlct");
81  drop_used_clcts = tmbParams_.getParameter<bool>("tmbDropUsedClcts");
82  tmb_cross_bx_algo = tmbParams_.getParameter<unsigned int>("tmbCrossBxAlgorithm");
83  max_lcts = tmbParams_.getParameter<unsigned int>("maxLCTs");
84  debug_matching = tmbParams_.getParameter<bool>("debugMatching");
85  debug_luts = tmbParams_.getParameter<bool>("debugLUTs");
86 
87  setPrefIndex();
88 }
89 
91  : CSCMotherboard()
93 {
94  if (!isSLHC_) edm::LogError("CSCUpgradeMotherboard|ConfigError")
95  << "+++ Upgrade CSCUpgradeMotherboard constructed while isSLHC_ is not set! +++\n";
96 
97  setPrefIndex();
98 }
99 
101 {
102 }
103 
105 {
106  if (theStation == 1 and (theRing ==1 or theRing == 4)){
107  if (keystrip > CSCConstants::MAX_HALF_STRIP_ME1B){
108  if ( !gangedME1a )
109  return CSCPart::ME1Ag;
110  else
111  return CSCPart::ME1A;
112  }else if (keystrip <= CSCConstants::MAX_HALF_STRIP_ME1B and keystrip >= 0)
113  return CSCPart::ME1B;
114  else
115  return CSCPart::ME11;
116  }else if (theStation == 2 and theRing == 1 )
117  return CSCPart::ME21;
118  else if (theStation == 3 and theRing == 1 )
119  return CSCPart::ME31;
120  else if (theStation == 4 and theRing == 1 )
121  return CSCPart::ME41;
122  else{
123  edm::LogError("CSCUpgradeMotherboard|Error") <<" ++ getCSCPart() failed to find the CSC chamber for in case ";
124  return CSCPart::ME11;// return ME11 by default
125  }
126 }
127 
129 {
131 }
132 
134 {
135  return lct1.getQuality() > lct2.getQuality();
136 }
137 
139 {
140  return true;
141 }
142 
143 void CSCUpgradeMotherboard::sortLCTs(std::vector<CSCCorrelatedLCTDigi>& lcts,
144  bool (*sorter)(const CSCCorrelatedLCTDigi&, const CSCCorrelatedLCTDigi&)) const
145 {
146  std::sort(lcts.begin(), lcts.end(), *sorter);
147  if (lcts.size() > max_lcts) lcts.erase(lcts.begin()+max_lcts, lcts.end());
148 }
149 
150 
152 {
153  // check whether chamber is even or odd
155  const CSCDetId csc_id(theEndcap, theStation, theStation, chid, 0);
156  cscChamber = csc_g->chamber(csc_id);
157  generator_->setCSCGeometry(csc_g);
158 }
159 
160 
162 {
164  for (unsigned int m=2; m<match_trig_window_size; m+=2)
165  {
166  pref[m-1] = pref[0] - m/2;
167  pref[m] = pref[0] + m/2;
168  }
169 }
170 
171 
173 {
175  allLCTs.clear();
176 }
T getParameter(std::string const &) const
const unsigned theSector
unsigned int match_trig_window_size
std::unique_ptr< CSCUpgradeMotherboardLUTGenerator > generator_
const unsigned theTrigChamber
int getQuality() const
return the 4 bit Correlated LCT Quality
const unsigned theEndcap
static bool sortLCTsByQuality(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
int pref[CSCConstants::MAX_LCT_TBINS]
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
const CSCChamber * cscChamber
const CSCGeometry * csc_g
edm::ParameterSet tmbParams_
void sortLCTs(std::vector< CSCCorrelatedLCTDigi > &lcts, bool(*sorter)(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)) const
const unsigned theStation
LCTContainer(unsigned int trig_window_size)
edm::ParameterSet commonParams_
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
CSCCorrelatedLCTDigi data[CSCConstants::MAX_LCT_TBINS][15][2]
const unsigned theSubsector
static bool sortLCTsByGEMDphi(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
#define end
Definition: vmac.h:39
void getTimeMatched(const int bx, std::vector< CSCCorrelatedLCTDigi > &) const
CSCCorrelatedLCTDigi & operator()(int bx, int match_bx, int lct)
void getMatched(std::vector< CSCCorrelatedLCTDigi > &) const
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
Definition: CSCGeometry.cc:133
#define begin
Definition: vmac.h:32
static int chamberFromTriggerLabels(int TriggerSector, int TriggerSubSector, int station, int TriggerCSCID)
enum CSCPart getCSCPart(int keystrip) const