Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #include "L1Trigger/RPCTrigger/interface/RPCTriggerBoard.h"
00008 #include "L1Trigger/RPCTrigger/interface/RPCException.h"
00009 #include "L1Trigger/RPCTrigger/interface/MuonsGrabber.h"
00010
00011 #include<sstream>
00012
00013 RPCTriggerBoard::RPCTriggerBoard( RPCTriggerConfiguration* triggerConfig,
00014 int tbNum, int tcNum)
00015 {
00016
00017 m_TriggerConfig = triggerConfig;
00018 m_TBNumber = tbNum;
00019
00020 int towerMin=-16;
00021 int towerMax=-16;
00022
00023
00024 for (int i=0;i <= tbNum; i++){
00025 towerMin=towerMax;
00026 towerMax+=m_TriggerConfig->getTowsCntOnTB(i);
00027 }
00028 towerMax--;
00029
00030 for (int tower = towerMin; tower <= towerMax; tower++){
00031 for (int logSegment = 0; logSegment < 12; logSegment++){
00032
00033 RPCConst::l1RpcConeCrdnts coneCrds;
00034 coneCrds.m_Tower=tower;
00035 coneCrds.m_LogSector=tcNum;
00036 coneCrds.m_LogSegment=logSegment;
00037
00038 const RPCPacData *pacData = m_TriggerConfig->getPac(coneCrds);
00039
00040
00041
00042 boost::shared_ptr< RPCPac > pac (new RPCPac(pacData, tower, tcNum, logSegment) );
00043
00044 m_pacs[tower].push_back(pac);
00045
00046 }
00047 }
00048
00049
00050 }
00051
00052 bool RPCTriggerBoard::runCone(const RPCLogCone& cone) {
00053
00054
00055 if(m_pacs.find(cone.getTower())==m_pacs.end()){
00056 std::stringstream s;
00057 s << "RPCTriggerBoard::runCone() wrong tower: " << cone.getTower() << " in TB=" << m_TBNumber;
00058 throw RPCException(s.str());
00059 }
00060
00061 RPCTBMuon tbMuon(m_pacs[cone.getTower()][cone.getLogSegment()]->run(cone));
00062
00063
00064
00065
00066
00067
00068 if(tbMuon.getCode() > 0) {
00069 m_PacsMuonsVec.push_back(tbMuon);
00070 if (m_TriggerConfig->getDebugLevel()!=0){
00071 #ifndef _STAND_ALONE
00072
00073
00074 MuonsGrabber::Instance().addMuon(tbMuon, 0, -1, -1, -1);
00075 #else
00076 std::cout << "GB 0 -1 "
00077 << tbMuon.printDebugInfo(m_TriggerConfig->getDebugLevel())
00078 << std::endl;
00079 #endif //_STAND_ALONE
00080 }
00081 return true;
00082 }
00083 else
00084 return false;
00085
00086 }
00087
00088 L1RpcTBMuonsVec RPCTriggerBoard::runTBGB() {
00089 if(m_PacsMuonsVec.size() == 0)
00090 return L1RpcTBMuonsVec();
00091
00092 L1RpcTBMuonsVec2 gbMuons(RPCConst::m_TOWERS_ON_TB_CNT, L1RpcTBMuonsVec());
00093 for(unsigned int iMu = 0; iMu < m_PacsMuonsVec.size(); iMu++) {
00094 int tbTower = m_TriggerConfig->getTowerNumOnTb(m_PacsMuonsVec[iMu].getConeCrdnts());
00095
00096 if(gbMuons[tbTower].size() == 0)
00097 gbMuons[tbTower].assign(RPCConst::m_SEGMENTS_IN_SECTOR_CNT, RPCTBMuon());
00098
00099 gbMuons[tbTower][m_PacsMuonsVec[iMu].getLogSegment()] = m_PacsMuonsVec[iMu];
00100 }
00101
00102 m_PacsMuonsVec.clear();
00103 return m_TBGhostBuster.run(gbMuons);
00104 }
00105