CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes | Static Private Attributes

CSCTriggerPrimitivesBuilder Class Reference

#include <CSCTriggerPrimitivesBuilder.h>

List of all members.

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

Max values of trigger labels for all CSCs; used to construct TMB processors.

Enumerator:
MAX_ENDCAPS 
MAX_STATIONS 
MAX_SECTORS 
MAX_SUBSECTORS 
MAX_CHAMBERS 

Definition at line 60 of file CSCTriggerPrimitivesBuilder.h.


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, testRegression::stat, and tmb_.

                                                                                    {
  // Receives ParameterSet percolated down from EDProducer.

  // ORCA way of initializing boards.
  for (int endc = min_endcap; endc <= max_endcap; endc++) {
    for (int stat = min_station; stat <= max_station; stat++) {
      int numsubs = ((stat == 1) ? max_subsector : 1);
      for (int sect = min_sector; sect <= max_sector; sect++) {
        for (int subs = min_subsector; subs <= numsubs; subs++) {
          for (int cham = min_chamber; cham <= max_chamber; cham++) {
            if ((endc <= 0 || endc > MAX_ENDCAPS)    ||
                (stat <= 0 || stat > MAX_STATIONS)   ||
                (sect <= 0 || sect > MAX_SECTORS)    ||
                (subs <= 0 || subs > MAX_SUBSECTORS) ||
                (cham <= 0 || stat > MAX_CHAMBERS)) {
              edm::LogError("L1CSCTPEmulatorSetupError")
                << "+++ trying to instantiate TMB of illegal CSC id ["
                << " endcap = "  << endc << " station = "   << stat
                << " sector = "  << sect << " subsector = " << subs
                << " chamber = " << cham << "]; skipping it... +++\n";
              continue;
            }
            // When the motherboard is instantiated, it instantiates ALCT
            // and CLCT processors.
            tmb_[endc-1][stat-1][sect-1][subs-1][cham-1] =
              new CSCMotherboard(endc, stat, sect, subs, cham, conf);
          }
        }
      }
    }
  }

  // Get min and max BX to sort LCTs in MPC.
  m_minBX = conf.getParameter<int>("MinBX");
  m_maxBX = conf.getParameter<int>("MaxBX");

  // Init MPC
  m_muonportcard = new CSCMuonPortCard();
}
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, testRegression::stat, and tmb_.

                                                          {
  for (int endc = min_endcap; endc <= max_endcap; endc++) {
    for (int stat = min_station; stat <= max_station; stat++) {
      int numsubs = ((stat == 1) ? max_subsector : 1);
      for (int sect = min_sector; sect <= max_sector; sect++) {
        for (int subs = min_subsector; subs <= numsubs; subs++) {
          for (int cham = min_chamber; cham <= max_chamber; cham++) {
            delete tmb_[endc-1][stat-1][sect-1][subs-1][cham-1];
          }
        }
      }
    }
  }
  delete m_muonportcard;
}

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, reco::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(), testRegression::stat, and tmb_.

Referenced by CSCTriggerPrimitivesProducer::produce().

                                                                                       {
  // CSC geometry.
  CSCTriggerGeomManager* theGeom = CSCTriggerGeometry::get();

  for (int endc = min_endcap; endc <= max_endcap; endc++) {
    for (int stat = min_station; stat <= max_station; stat++) {
      int numsubs = ((stat == 1) ? max_subsector : 1);
      for (int sect = min_sector; sect <= max_sector; sect++) {
        for (int subs = min_subsector; subs <= numsubs; subs++) {
          for (int cham = min_chamber; cham <= max_chamber; cham++) {
            CSCMotherboard* tmb = tmb_[endc-1][stat-1][sect-1][subs-1][cham-1];

            // Run processors only if chamber exists in geometry.
            if (tmb != 0 &&
                theGeom->chamber(endc, stat, sect, subs, cham) != 0) {

              // Calculate DetId.
              int ring =
                CSCTriggerNumbering::ringFromTriggerLabels(stat, cham);
              int chid =
                CSCTriggerNumbering::chamberFromTriggerLabels(sect, subs,
                                                              stat, cham);
              // 0th layer means whole chamber.
              CSCDetId detid(endc, stat, ring, chid, 0);

              // Skip chambers marked as bad (includes most of ME4/2 chambers).
              if (badChambers->isInBadChamber(detid)) continue;

              std::vector<CSCCorrelatedLCTDigi> lctV = tmb->run(wiredc,compdc);

              std::vector<CSCALCTDigi> alctV = tmb->alct->readoutALCTs();
              std::vector<CSCCLCTDigi> clctV = tmb->clct->readoutCLCTs();
              std::vector<int> preTriggerBXs = tmb->clct->preTriggerBXs();

              // Skip to next chamber if there are no LCTs to save.
              if (alctV.empty() && clctV.empty() && lctV.empty()) continue;

              // Correlated LCTs.
              if (!lctV.empty()) {
                LogTrace("L1CSCTrigger")
                  << "Put " << lctV.size() << " LCT digi"
                  << ((lctV.size() > 1) ? "s " : " ") << "in collection\n";
                oc_lct.put(std::make_pair(lctV.begin(),lctV.end()), detid);
              }

              // Anode LCTs.
              if (!alctV.empty()) {
                LogTrace("L1CSCTrigger")
                  << "Put " << alctV.size() << " ALCT digi"
                  << ((alctV.size() > 1) ? "s " : " ") << "in collection\n";
                oc_alct.put(std::make_pair(alctV.begin(),alctV.end()), detid);
              }

              // Cathode LCTs.
              if (!clctV.empty()) {
                LogTrace("L1CSCTrigger")
                  << "Put " << clctV.size() << " CLCT digi"
                  << ((clctV.size() > 1) ? "s " : " ") << "in collection\n";
                oc_clct.put(std::make_pair(clctV.begin(),clctV.end()), detid);
              }

              // Cathode LCTs pretriggers
              if (!preTriggerBXs.empty()) {
                LogTrace("L1CSCTrigger")
                  << "Put " << preTriggerBXs.size() << " CLCT pretriggers"
                  << ((preTriggerBXs.size() > 1) ? "s " : " ") << "in collection\n";
                oc_pretrig.put(std::make_pair(preTriggerBXs.begin(),preTriggerBXs.end()), detid);
              }
            }
          }
        }
      }
    }
  }

  // run MPC simulation
  m_muonportcard->loadDigis(oc_lct);

  std::vector<csctf::TrackStub> result;
  for(int bx = m_minBX; bx <= m_maxBX; ++bx)
    for(int e = min_endcap; e <= max_endcap; ++e)
      for(int st = min_station; st <= max_station; ++st)
        for(int se = min_sector; se <= max_sector; ++se)
          {
            if(st == 1)
              {
                std::vector<csctf::TrackStub> subs1, subs2;
                subs1 = m_muonportcard->sort(e, st, se, 1, bx);
                subs2 = m_muonportcard->sort(e, st, se, 2, bx);
                result.insert(result.end(), subs1.begin(), subs1.end());
                result.insert(result.end(), subs2.begin(), subs2.end());
              }
            else
              {
                std::vector<csctf::TrackStub> sector;
                sector = m_muonportcard->sort(e, st, se, 0, bx);
                result.insert(result.end(), sector.begin(), sector.end());
              }
          }

  std::vector<csctf::TrackStub>::const_iterator itr = result.begin();
  for (; itr != result.end(); itr++) {
    oc_sorted_lct.insertDigi(CSCDetId(itr->getDetId().rawId()), *(itr->getDigi()));
    LogDebug("L1CSCTrigger")
      << "MPC " << *(itr->getDigi()) << " found in ME"
      << ((itr->endcap() == 1) ? "+" : "-") << itr->station() << "/"
      << CSCDetId(itr->getDetId().rawId()).ring() << "/"
      << CSCDetId(itr->getDetId().rawId()).chamber()
      << " (sector " << itr->sector()
      << " trig id. " << itr->cscid() << ")" << "\n";
  }
}
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(), testRegression::stat, and tmb_.

Referenced by CSCTriggerPrimitivesProducer::produce().

                                                                                     {
  // Receives CSCDBL1TPParameters percolated down from ESProducer.

  for (int endc = min_endcap; endc <= max_endcap; endc++) {
    for (int stat = min_station; stat <= max_station; stat++) {
      int numsubs = ((stat == 1) ? max_subsector : 1);
      for (int sect = min_sector; sect <= max_sector; sect++) {
        for (int subs = min_subsector; subs <= numsubs; subs++) {
          for (int cham = min_chamber; cham <= max_chamber; cham++) {
            CSCMotherboard* tmb = tmb_[endc-1][stat-1][sect-1][subs-1][cham-1];
            tmb->setConfigParameters(conf);
          }
        }
      }
    }
  }
}

Member Data Documentation

Definition at line 77 of file CSCTriggerPrimitivesBuilder.h.

Referenced by build(), and CSCTriggerPrimitivesBuilder().

Definition at line 77 of file CSCTriggerPrimitivesBuilder.h.

Referenced by build(), and CSCTriggerPrimitivesBuilder().

Pointer to MPC processor.

Definition at line 84 of file CSCTriggerPrimitivesBuilder.h.

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

const int CSCTriggerPrimitivesBuilder::max_chamber [static, private]
const int CSCTriggerPrimitivesBuilder::max_endcap = CSCDetId::maxEndcapId() [static, private]
const int CSCTriggerPrimitivesBuilder::max_sector [static, private]
const int CSCTriggerPrimitivesBuilder::max_station = CSCDetId::maxStationId() [static, private]
const int CSCTriggerPrimitivesBuilder::max_subsector [static, private]
const int CSCTriggerPrimitivesBuilder::min_chamber [static, private]
const int CSCTriggerPrimitivesBuilder::min_endcap = CSCDetId::minEndcapId() [static, private]

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 [static, private]
const int CSCTriggerPrimitivesBuilder::min_station = CSCDetId::minStationId() [static, private]
const int CSCTriggerPrimitivesBuilder::min_subsector [static, private]
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().