CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes | Static Private Attributes
CSCTriggerPrimitivesBuilder Class Reference

#include <CSCTriggerPrimitivesBuilder.h>

Public Types

enum  trig_cscs {
  MAX_ENDCAPS = 2, MAX_STATIONS = 4, MAX_SECTORS = 6, MAX_SUBSECTORS = 2,
  MAX_CHAMBERS = 9
}
 

Public Member Functions

void build (const CSCBadChambers *badChambers, const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, CSCALCTDigiCollection &oc_alct, CSCCLCTDigiCollection &oc_clct, CSCCLCTPreTriggerCollection &oc_pretrig, CSCCorrelatedLCTDigiCollection &oc_lct, CSCCorrelatedLCTDigiCollection &oc_sorted_lct)
 
 CSCTriggerPrimitivesBuilder (const edm::ParameterSet &)
 
void setConfigParameters (const CSCDBL1TPParameters *conf)
 
 ~CSCTriggerPrimitivesBuilder ()
 

Private Attributes

int m_maxBX
 
int m_minBX
 
CSCMuonPortCardm_muonportcard
 
CSCMotherboardtmb_ [MAX_ENDCAPS][MAX_STATIONS][MAX_SECTORS][MAX_SUBSECTORS][MAX_CHAMBERS]
 

Static Private Attributes

static const int max_chamber
 
static const int max_endcap = CSCDetId::maxEndcapId()
 
static const int max_sector
 
static const int max_station = CSCDetId::maxStationId()
 
static const int max_subsector
 
static const int min_chamber
 
static const int min_endcap = CSCDetId::minEndcapId()
 
static const int min_sector
 
static const int min_station = CSCDetId::minStationId()
 
static const int min_subsector
 

Detailed Description

Algorithm to build anode, cathode, and correlated LCTs from wire and comparator digis in endcap muon CSCs by implementing a 'build' function required by CSCTriggerPrimitivesProducer.

Configured via the Producer's ParameterSet.

Author
Slava Valuev, UCLA.
Date:
2010/08/04 10:21:24
Revision:
1.8

Definition at line 32 of file CSCTriggerPrimitivesBuilder.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

CSCTriggerPrimitivesBuilder::CSCTriggerPrimitivesBuilder ( const edm::ParameterSet conf)
explicit

Configure the algorithm via constructor. Receives ParameterSet percolated down from EDProducer which owns this Builder.

Definition at line 51 of file CSCTriggerPrimitivesBuilder.cc.

References relativeConstraints::cham, edm::ParameterSet::getParameter(), m_maxBX, m_minBX, m_muonportcard, max_chamber, MAX_CHAMBERS, max_endcap, MAX_ENDCAPS, max_sector, MAX_SECTORS, max_station, MAX_STATIONS, max_subsector, MAX_SUBSECTORS, min_chamber, min_endcap, min_sector, min_station, min_subsector, and tmb_.

51  {
52  // Receives ParameterSet percolated down from EDProducer.
53 
54  // ORCA way of initializing boards.
55  for (int endc = min_endcap; endc <= max_endcap; endc++) {
56  for (int stat = min_station; stat <= max_station; stat++) {
57  int numsubs = ((stat == 1) ? max_subsector : 1);
58  for (int sect = min_sector; sect <= max_sector; sect++) {
59  for (int subs = min_subsector; subs <= numsubs; subs++) {
60  for (int cham = min_chamber; cham <= max_chamber; cham++) {
61  if ((endc <= 0 || endc > MAX_ENDCAPS) ||
62  (stat <= 0 || stat > MAX_STATIONS) ||
63  (sect <= 0 || sect > MAX_SECTORS) ||
64  (subs <= 0 || subs > MAX_SUBSECTORS) ||
65  (cham <= 0 || stat > MAX_CHAMBERS)) {
66  edm::LogError("L1CSCTPEmulatorSetupError")
67  << "+++ trying to instantiate TMB of illegal CSC id ["
68  << " endcap = " << endc << " station = " << stat
69  << " sector = " << sect << " subsector = " << subs
70  << " chamber = " << cham << "]; skipping it... +++\n";
71  continue;
72  }
73  // When the motherboard is instantiated, it instantiates ALCT
74  // and CLCT processors.
75  tmb_[endc-1][stat-1][sect-1][subs-1][cham-1] =
76  new CSCMotherboard(endc, stat, sect, subs, cham, conf);
77  }
78  }
79  }
80  }
81  }
82 
83  // Get min and max BX to sort LCTs in MPC.
84  m_minBX = conf.getParameter<int>("MinBX");
85  m_maxBX = conf.getParameter<int>("MaxBX");
86 
87  // Init MPC
89 }
T getParameter(std::string const &) const
CSCMotherboard * tmb_[MAX_ENDCAPS][MAX_STATIONS][MAX_SECTORS][MAX_SUBSECTORS][MAX_CHAMBERS]
CSCTriggerPrimitivesBuilder::~CSCTriggerPrimitivesBuilder ( )

Definition at line 94 of file CSCTriggerPrimitivesBuilder.cc.

References relativeConstraints::cham, m_muonportcard, max_chamber, max_endcap, max_sector, max_station, max_subsector, min_chamber, min_endcap, min_sector, min_station, min_subsector, and tmb_.

94  {
95  for (int endc = min_endcap; endc <= max_endcap; endc++) {
96  for (int stat = min_station; stat <= max_station; stat++) {
97  int numsubs = ((stat == 1) ? max_subsector : 1);
98  for (int sect = min_sector; sect <= max_sector; sect++) {
99  for (int subs = min_subsector; subs <= numsubs; subs++) {
100  for (int cham = min_chamber; cham <= max_chamber; cham++) {
101  delete tmb_[endc-1][stat-1][sect-1][subs-1][cham-1];
102  }
103  }
104  }
105  }
106  }
107  delete m_muonportcard;
108 }
CSCMotherboard * tmb_[MAX_ENDCAPS][MAX_STATIONS][MAX_SECTORS][MAX_SUBSECTORS][MAX_CHAMBERS]

Member Function Documentation

void CSCTriggerPrimitivesBuilder::build ( const CSCBadChambers badChambers,
const CSCWireDigiCollection wiredc,
const CSCComparatorDigiCollection compdc,
CSCALCTDigiCollection oc_alct,
CSCCLCTDigiCollection oc_clct,
CSCCLCTPreTriggerCollection oc_pretrig,
CSCCorrelatedLCTDigiCollection oc_lct,
CSCCorrelatedLCTDigiCollection oc_sorted_lct 
)

Build anode, cathode, and correlated LCTs in each chamber and fill them into output collections. Select up to three best correlated LCTs in each (sub)sector and put them into an output collection as well.

Definition at line 141 of file CSCTriggerPrimitivesBuilder.cc.

References CSCMotherboard::alct, relativeConstraints::cham, CSCTriggerGeomManager::chamber(), CSCTriggerNumbering::chamberFromTriggerLabels(), CSCMotherboard::clct, CSCDetId, cond::rpcobgas::detid, alignCSCRings::e, CSCTriggerGeometry::get(), CSCBadChambers::isInBadChamber(), CSCMuonPortCard::loadDigis(), LogDebug, LogTrace, m_maxBX, m_minBX, m_muonportcard, max_chamber, max_endcap, max_sector, max_station, max_subsector, min_chamber, min_endcap, min_sector, min_station, min_subsector, CSCCathodeLCTProcessor::preTriggerBXs(), CSCAnodeLCTProcessor::readoutALCTs(), CSCCathodeLCTProcessor::readoutCLCTs(), query::result, relativeConstraints::ring, CSCTriggerNumbering::ringFromTriggerLabels(), CSCMotherboard::run(), CSCMuonPortCard::sort(), and tmb_.

Referenced by CSCTriggerPrimitivesProducer::produce().

148  {
149  // CSC geometry.
151 
152  for (int endc = min_endcap; endc <= max_endcap; endc++) {
153  for (int stat = min_station; stat <= max_station; stat++) {
154  int numsubs = ((stat == 1) ? max_subsector : 1);
155  for (int sect = min_sector; sect <= max_sector; sect++) {
156  for (int subs = min_subsector; subs <= numsubs; subs++) {
157  for (int cham = min_chamber; cham <= max_chamber; cham++) {
158  CSCMotherboard* tmb = tmb_[endc-1][stat-1][sect-1][subs-1][cham-1];
159 
160  // Run processors only if chamber exists in geometry.
161  if (tmb != 0 &&
162  theGeom->chamber(endc, stat, sect, subs, cham) != 0) {
163 
164  // Calculate DetId.
165  int ring =
167  int chid =
169  stat, cham);
170  // 0th layer means whole chamber.
171  CSCDetId detid(endc, stat, ring, chid, 0);
172 
173  // Skip chambers marked as bad (includes most of ME4/2 chambers).
174  if (badChambers->isInBadChamber(detid)) continue;
175 
176  std::vector<CSCCorrelatedLCTDigi> lctV = tmb->run(wiredc,compdc);
177 
178  std::vector<CSCALCTDigi> alctV = tmb->alct->readoutALCTs();
179  std::vector<CSCCLCTDigi> clctV = tmb->clct->readoutCLCTs();
180  std::vector<int> preTriggerBXs = tmb->clct->preTriggerBXs();
181 
182  // Skip to next chamber if there are no LCTs to save.
183  if (alctV.empty() && clctV.empty() && lctV.empty()) continue;
184 
185  // Correlated LCTs.
186  if (!lctV.empty()) {
187  LogTrace("L1CSCTrigger")
188  << "Put " << lctV.size() << " LCT digi"
189  << ((lctV.size() > 1) ? "s " : " ") << "in collection\n";
190  oc_lct.put(std::make_pair(lctV.begin(),lctV.end()), detid);
191  }
192 
193  // Anode LCTs.
194  if (!alctV.empty()) {
195  LogTrace("L1CSCTrigger")
196  << "Put " << alctV.size() << " ALCT digi"
197  << ((alctV.size() > 1) ? "s " : " ") << "in collection\n";
198  oc_alct.put(std::make_pair(alctV.begin(),alctV.end()), detid);
199  }
200 
201  // Cathode LCTs.
202  if (!clctV.empty()) {
203  LogTrace("L1CSCTrigger")
204  << "Put " << clctV.size() << " CLCT digi"
205  << ((clctV.size() > 1) ? "s " : " ") << "in collection\n";
206  oc_clct.put(std::make_pair(clctV.begin(),clctV.end()), detid);
207  }
208 
209  // Cathode LCTs pretriggers
210  if (!preTriggerBXs.empty()) {
211  LogTrace("L1CSCTrigger")
212  << "Put " << preTriggerBXs.size() << " CLCT pretriggers"
213  << ((preTriggerBXs.size() > 1) ? "s " : " ") << "in collection\n";
214  oc_pretrig.put(std::make_pair(preTriggerBXs.begin(),preTriggerBXs.end()), detid);
215  }
216  }
217  }
218  }
219  }
220  }
221  }
222 
223  // run MPC simulation
224  m_muonportcard->loadDigis(oc_lct);
225 
226  std::vector<csctf::TrackStub> result;
227  for(int bx = m_minBX; bx <= m_maxBX; ++bx)
228  for(int e = min_endcap; e <= max_endcap; ++e)
229  for(int st = min_station; st <= max_station; ++st)
230  for(int se = min_sector; se <= max_sector; ++se)
231  {
232  if(st == 1)
233  {
234  std::vector<csctf::TrackStub> subs1, subs2;
235  subs1 = m_muonportcard->sort(e, st, se, 1, bx);
236  subs2 = m_muonportcard->sort(e, st, se, 2, bx);
237  result.insert(result.end(), subs1.begin(), subs1.end());
238  result.insert(result.end(), subs2.begin(), subs2.end());
239  }
240  else
241  {
242  std::vector<csctf::TrackStub> sector;
243  sector = m_muonportcard->sort(e, st, se, 0, bx);
244  result.insert(result.end(), sector.begin(), sector.end());
245  }
246  }
247 
248  std::vector<csctf::TrackStub>::const_iterator itr = result.begin();
249  for (; itr != result.end(); itr++) {
250  oc_sorted_lct.insertDigi(CSCDetId(itr->getDetId().rawId()), *(itr->getDigi()));
251  LogDebug("L1CSCTrigger")
252  << "MPC " << *(itr->getDigi()) << " found in ME"
253  << ((itr->endcap() == 1) ? "+" : "-") << itr->station() << "/"
254  << CSCDetId(itr->getDetId().rawId()).ring() << "/"
255  << CSCDetId(itr->getDetId().rawId()).chamber()
256  << " (sector " << itr->sector()
257  << " trig id. " << itr->cscid() << ")" << "\n";
258  }
259 }
#define LogDebug(id)
bool isInBadChamber(const CSCDetId &id) const
Is the gven chamber flagged as bad?
std::vector< CSCCLCTDigi > readoutCLCTs()
void run(const std::vector< int > w_time[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES], const std::vector< int > hs_times[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS], const std::vector< int > ds_times[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS])
CSCChamber * chamber(unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned tcscid) const
Return the CSCChamber for a corresponding endcap/station/sector/subsector/trigger cscid...
static int ringFromTriggerLabels(int station, int triggerCSCID)
void loadDigis(const CSCCorrelatedLCTDigiCollection &thedigis)
static CSCTriggerGeomManager * get()
tuple result
Definition: query.py:137
CSCMotherboard * tmb_[MAX_ENDCAPS][MAX_STATIONS][MAX_SECTORS][MAX_SUBSECTORS][MAX_CHAMBERS]
#define LogTrace(id)
CSCAnodeLCTProcessor * alct
std::vector< int > preTriggerBXs() const
std::vector< CSCALCTDigi > readoutALCTs()
CSCCathodeLCTProcessor * clct
std::vector< csctf::TrackStub > sort(const unsigned endcap, const unsigned station, const unsigned sector, const unsigned subsector, const int bx)
static int chamberFromTriggerLabels(int TriggerSector, int TriggerSubSector, int station, int TriggerCSCID)
void CSCTriggerPrimitivesBuilder::setConfigParameters ( const CSCDBL1TPParameters conf)

Sets configuration parameters obtained via EventSetup mechanism.

Definition at line 114 of file CSCTriggerPrimitivesBuilder.cc.

References relativeConstraints::cham, max_chamber, max_endcap, max_sector, max_station, max_subsector, min_chamber, min_endcap, min_sector, min_station, min_subsector, CSCMotherboard::setConfigParameters(), and tmb_.

Referenced by CSCTriggerPrimitivesProducer::produce().

114  {
115  // Receives CSCDBL1TPParameters percolated down from ESProducer.
116 
117  for (int endc = min_endcap; endc <= max_endcap; endc++) {
118  for (int stat = min_station; stat <= max_station; stat++) {
119  int numsubs = ((stat == 1) ? max_subsector : 1);
120  for (int sect = min_sector; sect <= max_sector; sect++) {
121  for (int subs = min_subsector; subs <= numsubs; subs++) {
122  for (int cham = min_chamber; cham <= max_chamber; cham++) {
123  CSCMotherboard* tmb = tmb_[endc-1][stat-1][sect-1][subs-1][cham-1];
124  tmb->setConfigParameters(conf);
125  }
126  }
127  }
128  }
129  }
130 }
CSCMotherboard * tmb_[MAX_ENDCAPS][MAX_STATIONS][MAX_SECTORS][MAX_SUBSECTORS][MAX_CHAMBERS]
void setConfigParameters(const CSCDBL1TPParameters *conf)

Member Data Documentation

int CSCTriggerPrimitivesBuilder::m_maxBX
private

Definition at line 77 of file CSCTriggerPrimitivesBuilder.h.

Referenced by build(), and CSCTriggerPrimitivesBuilder().

int CSCTriggerPrimitivesBuilder::m_minBX
private

Definition at line 77 of file CSCTriggerPrimitivesBuilder.h.

Referenced by build(), and CSCTriggerPrimitivesBuilder().

CSCMuonPortCard* CSCTriggerPrimitivesBuilder::m_muonportcard
private

Pointer to MPC processor.

Definition at line 84 of file CSCTriggerPrimitivesBuilder.h.

Referenced by build(), CSCTriggerPrimitivesBuilder(), and ~CSCTriggerPrimitivesBuilder().

const int CSCTriggerPrimitivesBuilder::max_chamber
staticprivate
const int CSCTriggerPrimitivesBuilder::max_endcap = CSCDetId::maxEndcapId()
staticprivate
const int CSCTriggerPrimitivesBuilder::max_sector
staticprivate
const int CSCTriggerPrimitivesBuilder::max_station = CSCDetId::maxStationId()
staticprivate
const int CSCTriggerPrimitivesBuilder::max_subsector
staticprivate
const int CSCTriggerPrimitivesBuilder::min_chamber
staticprivate
const int CSCTriggerPrimitivesBuilder::min_endcap = CSCDetId::minEndcapId()
staticprivate

Min and max allowed values for various CSC elements, defined in CSCDetId and CSCTriggerNumbering classes.

Definition at line 66 of file CSCTriggerPrimitivesBuilder.h.

Referenced by build(), CSCTriggerPrimitivesBuilder(), setConfigParameters(), and ~CSCTriggerPrimitivesBuilder().

const int CSCTriggerPrimitivesBuilder::min_sector
staticprivate
const int CSCTriggerPrimitivesBuilder::min_station = CSCDetId::minStationId()
staticprivate
const int CSCTriggerPrimitivesBuilder::min_subsector
staticprivate
CSCMotherboard* CSCTriggerPrimitivesBuilder::tmb_[MAX_ENDCAPS][MAX_STATIONS][MAX_SECTORS][MAX_SUBSECTORS][MAX_CHAMBERS]
private

Pointers to TMB processors for all possible chambers.

Definition at line 81 of file CSCTriggerPrimitivesBuilder.h.

Referenced by build(), CSCTriggerPrimitivesBuilder(), setConfigParameters(), and ~CSCTriggerPrimitivesBuilder().