CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/L1Trigger/RPCTrigger/src/RPCPacTrigger.cc

Go to the documentation of this file.
00001 /*******************************************************************************
00002 *                                                                              *
00003 *  Karol Bunkowski                                                             *
00004 *  Warsaw University 2004                                                      *
00005 *                                                                              *
00006 *******************************************************************************/
00007 #include "L1Trigger/RPCTrigger/interface/RPCPacTrigger.h"
00008 #include "L1Trigger/RPCTrigger/interface/MuonsGrabber.h"
00009 
00010 RPCPacTrigger::RPCPacTrigger(RPCTriggerConfiguration* triggerConfig):
00011   m_FinalSorter(triggerConfig),
00012   m_HalfSorters(triggerConfig)
00013 {
00014   m_TrigCnfg = triggerConfig;
00015   for(int iTC = 0; iTC < m_TrigCnfg->getTCsCnt(); iTC++) {
00016     m_TriggerCratesVec.push_back(RPCTriggerCrate(m_TrigCnfg, iTC));
00017   }
00018 }
00019 
00021 
00022 L1RpcTBMuonsVec2 RPCPacTrigger::runEvent(const L1RpcLogConesVec& logConesVec, edm::ESHandle<L1RPCHsbConfig> hsbConf) {
00023   m_GBFinalMuons.clear();
00024 
00025  if (m_TrigCnfg->getDebugLevel()!=0){
00026 #ifdef _STAND_ALONE
00027    std::cout << "---TBMuons in new event" << std::endl;
00028 #endif // _STAND_ALONE
00029  }
00030   for(unsigned int iLC = 0; iLC < logConesVec.size(); iLC++) {
00031     if(logConesVec[iLC].getFiredPlanesCnt() >= 3) {
00032       m_TriggerCratesVec[m_TrigCnfg->getTCNum(logConesVec[iLC].getConeCrdnts())]
00033                                                       .runCone(logConesVec[iLC]);
00034     }
00035   }
00036 
00037   L1RpcTBMuonsVec2 tcsMuonsVec2;
00038   for(unsigned int iTC = 0; iTC < m_TriggerCratesVec.size(); iTC++) {
00039     tcsMuonsVec2.push_back(m_TriggerCratesVec[iTC].runTCGBSorter());
00040   }
00041       
00042   if (m_TrigCnfg->getDebugLevel()!=0){
00043     for (unsigned  int iTC = 0; iTC < tcsMuonsVec2.size(); iTC++){
00044         for (unsigned  int iTB = 0; iTB < tcsMuonsVec2[iTC].size(); iTB++){
00045 #ifdef _STAND_ALONE
00046           std::cout << "GB 2 " << iTB << " "
00047               <<tcsMuonsVec2[iTC][iTB].printDebugInfo(m_TrigCnfg->getDebugLevel()) 
00048               << std::endl;
00049 #else
00050          // LogDebug("RPCHwDebug") << "GB 2 " << iTB << " "
00051          //                  <<tcsMuonsVec2[iTC][iTB].printDebugInfo(m_TrigCnfg->getDebugLevel());
00052          MuonsGrabber::Instance().addMuon(tcsMuonsVec2[iTC][iTB], 2, -1, -1, iTB);  
00053 
00054           
00055 #endif // _STAND_ALONE
00056         }
00057     }
00058   }
00059 
00060   // It would be fine, if half sorters would just modify tcsMuonsVec2
00061   L1RpcTBMuonsVec2 halfMuons = m_HalfSorters.run(tcsMuonsVec2, hsbConf);
00062   m_GBFinalMuons = m_FinalSorter.run(halfMuons);
00063 
00064 #ifdef GETCONES
00065   bool foundMuons = false;
00066   L1RpcTBMuonsVec bMuons = m_GBFinalMuons[0];
00067   L1RpcTBMuonsVec fMuons = m_GBFinalMuons[1];
00068 
00069   std::cout<< "------------" << std::endl;
00070   for (unsigned int i = 0; i < bMuons.size(); i++){
00071     if (bMuons[i].getPtCode()!=0){ 
00072        /*
00073        std::cout<< "ptcode " << bMuons[i].getPtCode() 
00074                 << " t " <<  bMuons[i].getTower()
00075                 << " sec " <<  bMuons[i].getLogSector()
00076                 << " seg " <<  bMuons[i].getLogSegment()
00077                 << std::endl;*/
00078        foundMuons = true;
00079    }
00080   }
00081   for (unsigned int i = 0; i < fMuons.size(); i++){
00082     if (fMuons[i].getPtCode()!=0){
00083        /*std::cout<< "ptcode " << fMuons[i].getPtCode()
00084                 << " t " <<  fMuons[i].getTower()
00085                 << " sec " <<  fMuons[i].getLogSector()
00086                 << " seg " <<  fMuons[i].getLogSegment()
00087                 << std::endl;*/
00088        foundMuons = true;
00089        }
00090   }
00091   if (!foundMuons){
00092     for(unsigned int iLC = 0; iLC < logConesVec.size(); iLC++) {
00093       if(logConesVec[iLC].getFiredPlanesCnt() >= 3) {
00094         std::cout<< logConesVec[iLC].toString();
00095       }
00096     }
00097   }
00098 #endif
00099 
00100 
00101 
00102   return m_GBFinalMuons;
00103 }
00104 
00106 
00107 L1RpcTBMuonsVec RPCPacTrigger::getNotEmptyMuons()  {
00108   L1RpcTBMuonsVec notEmptyMuonsVec;
00109   for(unsigned int iMu = 0; iMu < m_GBFinalMuons[0].size(); iMu++)
00110     if(m_GBFinalMuons[0][iMu].getCode() != 0)
00111       notEmptyMuonsVec.push_back(m_GBFinalMuons[0][iMu]);
00112 
00113   for(unsigned int iMu = 0; iMu < m_GBFinalMuons[1].size(); iMu++)
00114     if(m_GBFinalMuons[1][iMu].getCode() != 0)
00115       notEmptyMuonsVec.push_back(m_GBFinalMuons[1][iMu]);
00116 
00117   return notEmptyMuonsVec;
00118 }