Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:06

0001 #include "TauAnalysis/MCEmbeddingTools/plugins/MuonDetCleaner.h"
0002 
0003 #include "DataFormats/MuonDetId/interface/DTLayerId.h"
0004 #include "DataFormats/DTRecHit/interface/DTSLRecCluster.h"
0005 #include "DataFormats/DTRecHit/interface/DTRecHit1DPair.h"
0006 
0007 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
0008 #include "DataFormats/CSCRecHit/interface/CSCRecHit2D.h"
0009 #include "DataFormats/MuonDetId/interface/RPCDetId.h"
0010 #include "DataFormats/RPCRecHit/interface/RPCRecHit.h"
0011 
0012 typedef MuonDetCleaner<CSCDetId, CSCRecHit2D> CSCRecHitColCleaner;
0013 typedef MuonDetCleaner<DTLayerId, DTRecHit1DPair> DTRecHitColCleaner;
0014 typedef MuonDetCleaner<RPCDetId, RPCRecHit> RPCRecHitColCleaner;
0015 
0016 //-------------------------------------------------------------------------------
0017 // define 'getDetIds' functions used for different types of recHits
0018 //-------------------------------------------------------------------------------
0019 
0020 template <typename T1, typename T2>
0021 uint32_t MuonDetCleaner<T1, T2>::getRawDetId(const T2& recHit) {
0022   assert(0);  // CV: make sure general function never gets called;
0023               //     always use template specializations
0024 }
0025 
0026 template <>
0027 uint32_t MuonDetCleaner<CSCDetId, CSCRecHit2D>::getRawDetId(const CSCRecHit2D& recHit) {
0028   return recHit.cscDetId().rawId();
0029 }
0030 
0031 template <>
0032 uint32_t MuonDetCleaner<DTLayerId, DTRecHit1DPair>::getRawDetId(const DTRecHit1DPair& recHit) {
0033   return recHit.geographicalId().rawId();
0034 }
0035 
0036 template <>
0037 uint32_t MuonDetCleaner<RPCDetId, RPCRecHit>::getRawDetId(const RPCRecHit& recHit) {
0038   return recHit.rpcId().rawId();
0039 }
0040 
0041 //-------------------------------------------------------------------------------
0042 // find out what the kind of RecHit used by imput muons rechit
0043 //-------------------------------------------------------------------------------
0044 
0045 template <typename T1, typename T2>
0046 bool MuonDetCleaner<T1, T2>::checkrecHit(const TrackingRecHit& recHit) {
0047   edm::LogError("TauEmbedding") << "!!!! Please add the checkrecHit for the individual class templates " assert(0);
0048 }
0049 
0050 template <>
0051 bool MuonDetCleaner<CSCDetId, CSCRecHit2D>::checkrecHit(const TrackingRecHit& recHit) {
0052   const std::type_info& hit_type = typeid(recHit);
0053   if (hit_type == typeid(CSCSegment)) {
0054     return true;
0055   }  // This should be the default one (which are included in the global (outer) muon track)
0056   else if (hit_type == typeid(CSCRecHit2D)) {
0057     return true;
0058   }
0059   //else {std::cout<<"else "<<hit_type.name()<<std::endl;}
0060   return false;
0061 }
0062 
0063 template <>
0064 bool MuonDetCleaner<DTLayerId, DTRecHit1DPair>::checkrecHit(const TrackingRecHit& recHit) {
0065   const std::type_info& hit_type = typeid(recHit);
0066   if (hit_type == typeid(DTRecSegment4D)) {
0067     return true;
0068   }  // This should be the default one (which are included in the global (outer) muon track)
0069   else if (hit_type == typeid(DTRecHit1D)) {
0070     return true;
0071   } else if (hit_type == typeid(DTSLRecCluster)) {
0072     return true;
0073   } else if (hit_type == typeid(DTSLRecSegment2D)) {
0074     return true;
0075   }
0076   // else {std::cout<<"else "<<hit_type.name()<<std::endl;}
0077   return false;
0078 }
0079 
0080 template <>
0081 bool MuonDetCleaner<RPCDetId, RPCRecHit>::checkrecHit(const TrackingRecHit& recHit) {
0082   const std::type_info& hit_type = typeid(recHit);
0083   if (hit_type == typeid(RPCRecHit)) {
0084     return true;
0085   }  // This should be the default one (which are included in the global (outer) muon track)
0086   //else {std::cout<<"else "<<hit_type.name()<<std::endl;}
0087   return false;
0088 }
0089 
0090 DEFINE_FWK_MODULE(CSCRecHitColCleaner);
0091 DEFINE_FWK_MODULE(DTRecHitColCleaner);
0092 DEFINE_FWK_MODULE(RPCRecHitColCleaner);