CMS 3D CMS Logo

RPCConeBuilderFromES.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     RPCTrigger
00004 // Class  :     RPCConeBuilderFromES
00005 // 
00006 // Implementation:
00007 //     <Notes on implementation>
00008 //
00009 // Original Author:  
00010 //         Created:  Mon Mar  3 13:34:20 CET 2008
00011 // $Id: RPCConeBuilderFromES.cc,v 1.4 2008/08/29 08:28:12 fruboes Exp $
00012 //
00013 
00014 // system include files
00015 
00016 // user include files
00017 #include "L1Trigger/RPCTrigger/interface/RPCConeBuilderFromES.h"
00018 
00019 
00020 //
00021 // constants, enums and typedefs
00022 //
00023 
00024 //
00025 // static data member definitions
00026 //
00027 
00028 //
00029 // constructors and destructor
00030 //
00031 RPCConeBuilderFromES::RPCConeBuilderFromES()
00032 {
00033 }
00034 
00035 // RPCConeBuilderFromES::RPCConeBuilderFromES(const RPCConeBuilderFromES& rhs)
00036 // {
00037 //    // do actual copying here;
00038 // }
00039 
00040 RPCConeBuilderFromES::~RPCConeBuilderFromES()
00041 {
00042 }
00043 
00044 L1RpcLogConesVec RPCConeBuilderFromES::getConesFromES(edm::Handle<RPCDigiCollection> rpcDigis, 
00045                                                       edm::ESHandle<L1RPCConeBuilder> coneBuilder,
00046                                                       edm::ESHandle<L1RPCHwConfig> hwConfig, int bx)
00047 {
00048   std::vector<RPCLogHit> logHits;
00049   
00050   // Build cones from digis
00051   // first build loghits
00052   RPCDigiCollection::DigiRangeIterator detUnitIt;
00053   for (detUnitIt=rpcDigis->begin();
00054        detUnitIt!=rpcDigis->end();
00055        ++detUnitIt)
00056   {
00057     const RPCDetId& id = (*detUnitIt).first;
00058 
00059     int rawId = id.rawId();
00060 
00061     const RPCDigiCollection::Range& range = (*detUnitIt).second;
00062 
00063     for (RPCDigiCollection::const_iterator digiIt = range.first;
00064          digiIt!=range.second;
00065          ++digiIt)
00066     {
00067  
00068       
00069       //std::cout << "bx = " << digiIt->bx() << " " << hwConfig->getFirstBX() << " "  << hwConfig->getLastBX() <<std::endl;
00070       if ( digiIt->bx() < hwConfig->getFirstBX() + bx || digiIt->bx() > hwConfig->getLastBX() +bx  ){
00071       //  std::cout << "   -->skip" << std::endl;
00072         //std::cout << "Skip" << std::endl;
00073         continue;
00074       }
00075       //std::cout << "   -->OK" << std::endl;
00076       
00077 
00078       std::pair<L1RPCConeBuilder::TStripConVec::const_iterator, L1RPCConeBuilder::TStripConVec::const_iterator> 
00079           itPair = coneBuilder->getConVec(rawId,digiIt->strip());
00080       
00081       L1RPCConeBuilder::TStripConVec::const_iterator it = itPair.first;
00082       for (; it!=itPair.second;++it){
00083 
00084          if ( hwConfig->isActive(it->m_tower, it->m_PAC)  )
00085              logHits.push_back( RPCLogHit(it->m_tower, it->m_PAC, it->m_logplane, it->m_logstrip) );
00086       }
00087       
00088     }
00089     
00090     
00091   }
00092   
00093   // build cones
00094   L1RpcLogConesVec ActiveCones;
00095 
00096   std::vector<RPCLogHit>::iterator p_lhit;
00097   for (p_lhit = logHits.begin(); p_lhit != logHits.end(); p_lhit++){
00098     bool hitTaken = false;
00099     L1RpcLogConesVec::iterator p_cone;
00100     for (p_cone = ActiveCones.begin(); p_cone != ActiveCones.end(); p_cone++){
00101       hitTaken = p_cone->addLogHit(*p_lhit);
00102       if(hitTaken)
00103         break;
00104     }
00105 
00106     if(!hitTaken) {
00107       RPCLogCone newcone(*p_lhit);
00108       newcone.setIdx(ActiveCones.size());
00109       ActiveCones.push_back(newcone);
00110     }
00111   }// for loghits
00112 
00113   return ActiveCones;
00114   
00115 }
00116 

Generated on Tue Jun 9 17:40:21 2009 for CMSSW by  doxygen 1.5.4