CMS 3D CMS Logo

CSCTriggerPrimitivesBuilder.cc
Go to the documentation of this file.
1 #include <memory>
2 
8 
19 
21  // special configuration parameters for ME11 treatment
22  edm::ParameterSet commonParams = conf.getParameter<edm::ParameterSet>("commonParam");
23  runPhase2_ = commonParams.getParameter<bool>("runPhase2");
24  infoV = commonParams.getParameter<int>("verbosity");
25  disableME42_ = commonParams.getParameter<bool>("disableME42");
26 
27  checkBadChambers_ = conf.getParameter<bool>("checkBadChambers");
28 
29  runME11Up_ = commonParams.getParameter<bool>("runME11Up");
30  runME21Up_ = commonParams.getParameter<bool>("runME21Up");
31 
32  runME11ILT_ = commonParams.getParameter<bool>("runME11ILT");
33  runME21ILT_ = commonParams.getParameter<bool>("runME21ILT");
34 
35  // Initializing boards.
36  for (int endc = min_endcap; endc <= max_endcap; endc++) {
37  for (int stat = min_station; stat <= max_station; stat++) {
38  int numsubs = ((stat == 1) ? max_subsector : 1);
39  for (int sect = min_sector; sect <= max_sector; sect++) {
40  for (int subs = min_subsector; subs <= numsubs; subs++) {
41  for (int cham = min_chamber; cham <= max_chamber; cham++) {
42  if ((endc <= 0 || endc > MAX_ENDCAPS) || (stat <= 0 || stat > MAX_STATIONS) ||
43  (sect <= 0 || sect > MAX_SECTORS) || (subs <= 0 || subs > MAX_SUBSECTORS) ||
44  (cham <= 0 || cham > MAX_CHAMBERS)) {
45  edm::LogError("CSCTriggerPrimitivesBuilder|SetupError")
46  << "+++ trying to instantiate TMB of illegal CSC id ["
47  << " endcap = " << endc << " station = " << stat << " sector = " << sect << " subsector = " << subs
48  << " chamber = " << cham << "]; skipping it... +++\n";
49  continue;
50  }
52  // When the motherboard is instantiated, it instantiates ALCT
53  // and CLCT processors.
54 
55  const bool upgrade = runPhase2_ and ring == 1;
56  const bool upgradeGE11 = upgrade and stat == 1 and runME11Up_ and runME11ILT_;
57  const bool upgradeGE21 = upgrade and stat == 2 and runME21Up_ and runME21ILT_;
58 
59  // GE1/1-ME1/1 integrated local trigger or GE2/1-ME2/1 integrated local trigger
60  if (upgradeGE11 or upgradeGE21)
61  tmb_[endc - 1][stat - 1][sect - 1][subs - 1][cham - 1] =
62  std::make_unique<CSCGEMMotherboard>(endc, stat, sect, subs, cham, conf);
63  // default case
64  else
65  tmb_[endc - 1][stat - 1][sect - 1][subs - 1][cham - 1] =
66  std::make_unique<CSCMotherboard>(endc, stat, sect, subs, cham, conf);
67  }
68  }
69  // Init MPC
70  mpc_[endc - 1][stat - 1][sect - 1] = std::make_unique<CSCMuonPortCard>(endc, stat, sect, conf);
71  }
72  }
73  }
74 }
75 
76 //------------
77 // Destructor
78 //------------
80 
82  // Receives CSCDBL1TPParameters percolated down from ESProducer.
83 
84  for (int endc = min_endcap; endc <= max_endcap; endc++) {
85  for (int stat = min_station; stat <= max_station; stat++) {
86  int numsubs = ((stat == 1) ? max_subsector : 1);
87  for (int sect = min_sector; sect <= max_sector; sect++) {
88  for (int subs = min_subsector; subs <= numsubs; subs++) {
89  for (int cham = min_chamber; cham <= max_chamber; cham++) {
90  tmb_[endc - 1][stat - 1][sect - 1][subs - 1][cham - 1]->setConfigParameters(conf);
91  }
92  }
93  }
94  }
95  }
96 }
97 
99  const CSCWireDigiCollection* wiredc,
100  const CSCComparatorDigiCollection* compdc,
101  const GEMPadDigiClusterCollection* gemClusters,
102  CSCALCTDigiCollection& oc_alct,
103  CSCCLCTDigiCollection& oc_clct,
104  CSCALCTPreTriggerDigiCollection& oc_alctpretrigger,
105  CSCCLCTPreTriggerDigiCollection& oc_pretrigger,
106  CSCCLCTPreTriggerCollection& oc_pretrig,
108  CSCCorrelatedLCTDigiCollection& oc_sorted_lct,
109  CSCShowerDigiCollection& oc_shower,
110  CSCShowerDigiCollection& oc_shower_anode,
111  GEMCoPadDigiCollection& oc_gemcopad) {
112  // CSC geometry.
113  for (int endc = min_endcap; endc <= max_endcap; endc++) {
114  for (int stat = min_station; stat <= max_station; stat++) {
115  int numsubs = ((stat == 1) ? max_subsector : 1);
116  for (int sect = min_sector; sect <= max_sector; sect++) {
117  for (int subs = min_subsector; subs <= numsubs; subs++) {
118  for (int cham = min_chamber; cham <= max_chamber; cham++) {
119  // extract the ring number
121 
122  // case when you want to ignore ME42
123  if (disableME42_ && stat == 4 && ring == 2)
124  continue;
125 
126  CSCMotherboard* tmb = tmb_[endc - 1][stat - 1][sect - 1][subs - 1][cham - 1].get();
127 
128  tmb->setCSCGeometry(csc_g);
129 
130  // actual chamber number =/= trigger chamber number
132 
133  // 0th layer means whole chamber.
134  CSCDetId detid(endc, stat, ring, chid, 0);
135 
136  // Run processors only if chamber exists in geometry.
137  if (tmb == nullptr || csc_g->chamber(detid) == nullptr)
138  continue;
139 
140  // Skip chambers marked as bad (usually includes most of ME4/2 chambers;
141  // also, there's no ME1/a-1/b separation, it's whole ME1/1)
142  if (checkBadChambers_ && badChambers->isInBadChamber(detid))
143  continue;
144 
145  const bool upgrade = runPhase2_ and ring == 1;
146  const bool upgradeGE11 = upgrade and stat == 1 and runME11Up_ and runME11ILT_;
147  const bool upgradeGE21 = upgrade and stat == 2 and runME21Up_ and runME21ILT_;
148 
149  // GE1/1-ME1/1 integrated local trigger or GE2/1-ME2/1 integrated local trigger
150  if (upgradeGE11 or upgradeGE21) {
151  // run the TMB
152  CSCGEMMotherboard* tmbGEM = static_cast<CSCGEMMotherboard*>(tmb);
153  tmbGEM->setGEMGeometry(gem_g);
154  tmbGEM->setCSCGeometry(csc_g);
155  tmbGEM->run(wiredc, compdc, gemClusters);
156 
157  // 0th layer means whole chamber.
158  GEMDetId gemId(detid.zendcap(), 1, stat, 0, chid, 0);
159  const std::vector<GEMCoPadDigi>& copads = tmbGEM->clusterProc()->readoutCoPads();
160  put(copads, oc_gemcopad, gemId, " GEM coincidence pad");
161  }
162  // default case: regular TMBs and OTMBs without GEMs
163  else {
164  // run the TMB
165  tmb->run(wiredc, compdc);
166  }
167 
168  // get the collections
169 
170  // trigger primitives
171  const std::vector<CSCALCTDigi>& alctV = tmb->alctProc->readoutALCTs();
172  const std::vector<CSCCLCTDigi>& clctV = tmb->clctProc->readoutCLCTs();
173  const std::vector<CSCCorrelatedLCTDigi>& lctV = tmb->readoutLCTs();
174 
175  // pre-triggers
176  const std::vector<int>& preTriggerBXs = tmb->clctProc->preTriggerBXs();
177  const std::vector<CSCCLCTPreTriggerDigi>& pretriggerV = tmb->clctProc->preTriggerDigis();
178  const std::vector<CSCALCTPreTriggerDigi>& alctpretriggerV = tmb->alctProc->preTriggerDigis();
179 
180  // showers
181  const CSCShowerDigi& shower = tmb->readoutShower();
182  const CSCShowerDigi& anodeShower = tmb->alctProc->readoutShower();
183 
184  put(alctV, oc_alct, detid, tmb->getCSCName() + " ALCT digi");
185  put(clctV, oc_clct, detid, tmb->getCSCName() + " CLCT digi");
186  put(lctV, oc_lct, detid, tmb->getCSCName() + " LCT digi");
187 
188  put(preTriggerBXs, oc_pretrig, detid, tmb->getCSCName() + " CLCT pre-trigger BX");
189  put(pretriggerV, oc_pretrigger, detid, tmb->getCSCName() + " CLCT pre-trigger digi");
190  put(alctpretriggerV, oc_alctpretrigger, detid, tmb->getCSCName() + " ALCT pre-trigger digi");
191 
192  if (shower.isValid())
193  oc_shower.insertDigi(detid, shower);
194  if (anodeShower.isValid())
195  oc_shower_anode.insertDigi(detid, anodeShower);
196 
197  if (!(alctV.empty() && clctV.empty() && lctV.empty()) and infoV > 1) {
198  LogTrace("L1CSCTrigger") << "CSCTriggerPrimitivesBuilder got results in " << detid;
199  }
200  } // end loop on cham
201  } // end loop on subs
202  } // end loop on sect
203  } // end loop on stat
204  } // end loop on endc
205 
206  // run MPC simulation
207  // there are 2 x 4 x 6 MPC VME cards
208  for (int endc = min_endcap; endc <= max_endcap; endc++) {
209  for (int stat = min_station; stat <= max_station; stat++) {
210  for (int sect = min_sector; sect <= max_sector; sect++) {
211  auto mpc = mpc_[endc - 1][stat - 1][sect - 1].get();
212 
213  // load the LCTs relevant for this MPC
214  mpc->loadLCTs(oc_lct);
215 
216  // sort and select the LCTs (if applicable)
217  mpc->sortLCTs();
218 
219  // get sorted+selected LCTs
220  const auto& result = mpc->getLCTs();
221 
222  // now convert csctf::TrackStub back into CSCCorrelatedLCTDigi
223  // put MPC stubs into the event
224  for (const auto& lct : result) {
225  oc_sorted_lct.insertDigi(CSCDetId(lct.getDetId().rawId()), *(lct.getDigi()));
226  if (infoV > 1)
227  LogDebug("CSCTriggerPrimitivesBuilder")
228  << "MPC " << *(lct.getDigi()) << " found in ME" << ((lct.endcap() == 1) ? "+" : "-") << lct.station()
229  << "/" << CSCDetId(lct.getDetId().rawId()).ring() << "/" << CSCDetId(lct.getDetId().rawId()).chamber()
230  << " (sector " << lct.sector() << " trig id. " << lct.cscid() << ")"
231  << "\n";
232  }
233  }
234  }
235  }
236 }
CSCCLCTPreTriggerCollection
CSCMotherboard::run
void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc)
Definition: CSCMotherboard.cc:124
CSCDBL1TPParameters
Definition: CSCDBL1TPParameters.h:14
CSCTriggerPrimitivesBuilder::max_sector
static const int max_sector
Definition: CSCTriggerPrimitivesBuilder.h:100
CSCDetId::maxStationId
static int maxStationId()
Definition: CSCDetId.h:237
CSCTriggerPrimitivesBuilder::tmb_
std::unique_ptr< CSCMotherboard > tmb_[MAX_ENDCAPS][MAX_STATIONS][MAX_SECTORS][MAX_SUBSECTORS][MAX_CHAMBERS]
Definition: CSCTriggerPrimitivesBuilder.h:129
CSCTriggerPrimitivesBuilder::max_endcap
static const int max_endcap
Definition: CSCTriggerPrimitivesBuilder.h:96
CSCMotherboard::readoutShower
CSCShowerDigi readoutShower() const
Definition: CSCMotherboard.cc:344
GEMCoPadDigiCollection
CSCTriggerPrimitivesBuilder::max_chamber
static const int max_chamber
Definition: CSCTriggerPrimitivesBuilder.h:104
CSCTriggerPrimitivesBuilder::put
void put(const T &, S &, const CSCDetId &, std::string comment)
Definition: CSCTriggerPrimitivesBuilder.h:140
relativeConstraints.cham
cham
Definition: relativeConstraints.py:69
CSCTriggerPrimitivesBuilder::checkBadChambers_
bool checkBadChambers_
a flag whether to skip chambers from the bad chambers map
Definition: CSCTriggerPrimitivesBuilder.h:110
CSCMotherboard::alctProc
std::unique_ptr< CSCAnodeLCTProcessor > alctProc
Definition: CSCMotherboard.h:98
CSCTriggerPrimitivesBuilder::min_subsector
static const int min_subsector
Definition: CSCTriggerPrimitivesBuilder.h:101
CSCDetId::zendcap
short int zendcap() const
Definition: CSCDetId.h:91
MuonDigiCollection
A container for a generic type of digis indexed by some index, implemented with a map<IndexType,...
Definition: MuonDigiCollection.h:87
CSCTriggerPrimitivesBuilder::max_subsector
static const int max_subsector
Definition: CSCTriggerPrimitivesBuilder.h:102
CSCShowerDigi
Definition: CSCShowerDigi.h:9
CSCTriggerPrimitivesBuilder::mpc_
std::unique_ptr< CSCMuonPortCard > mpc_[MAX_ENDCAPS][MAX_STATIONS][MAX_SECTORS]
Definition: CSCTriggerPrimitivesBuilder.h:132
showerParams.anodeShower
anodeShower
settings for anode showers (counting CSCWireDigi)
Definition: showerParams.py:46
CSCMotherboard
Definition: CSCMotherboard.h:47
CSCGEMMotherboard::setGEMGeometry
void setGEMGeometry(const GEMGeometry *g)
Definition: CSCGEMMotherboard.h:55
CSCTriggerPrimitivesBuilder::MAX_ENDCAPS
Definition: CSCTriggerPrimitivesBuilder.h:84
CSCTriggerNumbering::maxTriggerSectorId
static int maxTriggerSectorId()
Definition: CSCTriggerNumbering.h:112
CSCBadChambers
Definition: CSCBadChambers.h:9
CSCGEMMotherboard.h
CSCDetId::minStationId
static int minStationId()
Definition: CSCDetId.h:236
CSCMotherboard::clctProc
std::unique_ptr< CSCCathodeLCTProcessor > clctProc
Definition: CSCMotherboard.h:101
CSCTriggerPrimitivesBuilder::setConfigParameters
void setConfigParameters(const CSCDBL1TPParameters *conf)
Definition: CSCTriggerPrimitivesBuilder.cc:81
CSCBaseboard::setCSCGeometry
void setCSCGeometry(const CSCGeometry *g)
Definition: CSCBaseboard.cc:89
CSCTriggerPrimitivesBuilder::runME21Up_
bool runME21Up_
Definition: CSCTriggerPrimitivesBuilder.h:120
CSCDetId::minEndcapId
static int minEndcapId()
Definition: CSCDetId.h:234
CSCTriggerPrimitivesBuilder::MAX_SUBSECTORS
Definition: CSCTriggerPrimitivesBuilder.h:84
CSCTriggerPrimitivesBuilder::min_sector
static const int min_sector
Definition: CSCTriggerPrimitivesBuilder.h:99
CSCTriggerPrimitivesBuilder::infoV
int infoV
Definition: CSCTriggerPrimitivesBuilder.h:107
CSCMotherboard.h
GEMPadDigiClusterCollection
CSCTriggerPrimitivesBuilder::~CSCTriggerPrimitivesBuilder
~CSCTriggerPrimitivesBuilder()
Definition: CSCTriggerPrimitivesBuilder.cc:79
CSCBaseboard::getCSCName
std::string getCSCName() const
Definition: CSCBaseboard.h:32
CSCTriggerPrimitivesBuilder::MAX_CHAMBERS
Definition: CSCTriggerPrimitivesBuilder.h:84
CSCTriggerPrimitivesBuilder::disableME42_
bool disableME42_
Definition: CSCTriggerPrimitivesBuilder.h:116
CSCBadChambers::isInBadChamber
bool isInBadChamber(IndexType ichamber) const
Is the chamber with index 'ichamber' flagged as bad?
Definition: CSCBadChambers.cc:4
CSCShowerDigi::isValid
bool isValid() const
data
Definition: CSCShowerDigi.cc:21
CSCMuonPortCard.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::ParameterSet
Definition: ParameterSet.h:47
CSCTriggerPrimitivesBuilder::build
void build(const CSCBadChambers *badChambers, const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const GEMPadDigiClusterCollection *gemPadClusters, CSCALCTDigiCollection &oc_alct, CSCCLCTDigiCollection &oc_clct, CSCALCTPreTriggerDigiCollection &oc_alctpretrigger, CSCCLCTPreTriggerDigiCollection &oc_clctpretrigger, CSCCLCTPreTriggerCollection &oc_pretrig, CSCCorrelatedLCTDigiCollection &oc_lct, CSCCorrelatedLCTDigiCollection &oc_sorted_lct, CSCShowerDigiCollection &oc_shower, CSCShowerDigiCollection &oc_shower_anode, GEMCoPadDigiCollection &oc_gemcopad)
Definition: CSCTriggerPrimitivesBuilder.cc:98
CSCTriggerNumbering::minTriggerCscId
static int minTriggerCscId()
Definition: CSCTriggerNumbering.h:111
CSCTriggerNumbering::minTriggerSubSectorId
static int minTriggerSubSectorId()
Definition: CSCTriggerNumbering.h:115
CSCTriggerPrimitivesBuilder::gem_g
const GEMGeometry * gem_g
Definition: CSCTriggerPrimitivesBuilder.h:136
GEMDetId
Definition: GEMDetId.h:18
CSCDetId
Definition: CSCDetId.h:26
CSCTriggerPrimitivesBuilder::CSCTriggerPrimitivesBuilder
CSCTriggerPrimitivesBuilder(const edm::ParameterSet &)
Definition: CSCTriggerPrimitivesBuilder.cc:20
CSCALCTDigiCollection
CSCTriggerPrimitivesBuilder::MAX_SECTORS
Definition: CSCTriggerPrimitivesBuilder.h:84
CSCTriggerNumbering::minTriggerSectorId
static int minTriggerSectorId()
Definition: CSCTriggerNumbering.h:113
CSCTriggerNumbering::maxTriggerSubSectorId
static int maxTriggerSubSectorId()
Definition: CSCTriggerNumbering.h:114
CSCTriggerNumbering::ringFromTriggerLabels
static int ringFromTriggerLabels(int station, int triggerCSCID)
Definition: CSCTriggerNumbering.cc:5
CSCComparatorDigiCollection
CSCTriggerNumbering::chamberFromTriggerLabels
static int chamberFromTriggerLabels(int TriggerSector, int TriggerSubSector, int station, int TriggerCSCID)
Definition: CSCTriggerNumbering.cc:30
CSCDetId::maxEndcapId
static int maxEndcapId()
Definition: CSCDetId.h:235
CSCCorrelatedLCTDigiCollection
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
CSCTriggerPrimitivesBuilder.h
CSCMotherboard::readoutLCTs
virtual std::vector< CSCCorrelatedLCTDigi > readoutLCTs() const
Definition: CSCMotherboard.cc:247
CSCTriggerPrimitivesBuilder::runME11Up_
bool runME11Up_
Definition: CSCTriggerPrimitivesBuilder.h:119
CSCGEMMotherboard::run
void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const GEMPadDigiClusterCollection *gemPads)
Definition: CSCGEMMotherboard.cc:54
CSCGEMMotherboard
Definition: CSCGEMMotherboard.h:21
CSCTriggerPrimitivesBuilder::MAX_STATIONS
Definition: CSCTriggerPrimitivesBuilder.h:84
GEMGeometry.h
CSCWireDigiCollection
CSCTriggerPrimitivesBuilder::min_chamber
static const int min_chamber
Definition: CSCTriggerPrimitivesBuilder.h:103
CSCTriggerPrimitivesBuilder::csc_g
const CSCGeometry * csc_g
Definition: CSCTriggerPrimitivesBuilder.h:135
CSCCLCTDigiCollection
CSCGEMMotherboard::clusterProc
std::shared_ptr< GEMClusterProcessor > clusterProc() const
Definition: CSCGEMMotherboard.h:52
CSCTriggerPrimitivesBuilder::runPhase2_
bool runPhase2_
Definition: CSCTriggerPrimitivesBuilder.h:113
CSCTriggerPrimitivesBuilder::min_station
static const int min_station
Definition: CSCTriggerPrimitivesBuilder.h:97
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
MuonDigiCollection::insertDigi
void insertDigi(const IndexType &index, const DigiType &digi)
insert a digi for a given DetUnit
Definition: MuonDigiCollection.h:98
or
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
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CSCTriggerNumbering::maxTriggerCscId
static int maxTriggerCscId()
Definition: CSCTriggerNumbering.h:110
CSCALCTPreTriggerDigiCollection
CSCTriggerPrimitivesBuilder::min_endcap
static const int min_endcap
Definition: CSCTriggerPrimitivesBuilder.h:95
mps_fire.result
result
Definition: mps_fire.py:311
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
edm_modernize_messagelogger.stat
stat
Definition: edm_modernize_messagelogger.py:27
CSCTriggerPrimitivesBuilder::max_station
static const int max_station
Definition: CSCTriggerPrimitivesBuilder.h:98
CSCTriggerPrimitivesBuilder::runME21ILT_
bool runME21ILT_
Definition: CSCTriggerPrimitivesBuilder.h:126
CSCGeometry::chamber
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
Definition: CSCGeometry.cc:100
CSCTriggerPrimitivesBuilder::runME11ILT_
bool runME11ILT_
Definition: CSCTriggerPrimitivesBuilder.h:123