Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:20:43

0001 ///////////////////////////////////////////////////////
0002 //
0003 // HLTTrackerHaloFilter
0004 //
0005 // See header file for infos on input parameters
0006 // Comments on the code flow are in the cc file
0007 //
0008 // S.Viret: 01/03/2011 (viret@in2p3.fr)
0009 //
0010 ///////////////////////////////////////////////////////
0011 
0012 #include "HLTTrackerHaloFilter.h"
0013 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0014 
0015 //
0016 // constructors and destructor
0017 //
0018 
0019 HLTTrackerHaloFilter::HLTTrackerHaloFilter(const edm::ParameterSet& config)
0020     : HLTFilter(config),
0021       inputTag_(config.getParameter<edm::InputTag>("inputTag")),
0022       max_clusTp_(config.getParameter<int>("MaxClustersTECp")),
0023       max_clusTm_(config.getParameter<int>("MaxClustersTECm")),
0024       sign_accu_(config.getParameter<int>("SignalAccumulation")),
0025       max_clusT_(config.getParameter<int>("MaxClustersTEC")),
0026       max_back_(config.getParameter<int>("MaxAccus")),
0027       fastproc_(config.getParameter<int>("FastProcessing")) {
0028   clusterInputToken_ = consumes<edmNew::DetSetVector<SiStripCluster> >(inputTag_);
0029 }
0030 
0031 HLTTrackerHaloFilter::~HLTTrackerHaloFilter() = default;
0032 
0033 void HLTTrackerHaloFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0034   edm::ParameterSetDescription desc;
0035   makeHLTFilterDescription(desc);
0036   desc.add<edm::InputTag>("inputTag", edm::InputTag("hltSiStripClusters"));
0037   desc.add<int>("MaxClustersTECp", 50);
0038   desc.add<int>("MaxClustersTECm", 50);
0039   desc.add<int>("SignalAccumulation", 5);
0040   desc.add<int>("MaxClustersTEC", 60);
0041   desc.add<int>("MaxAccus", 4);
0042   desc.add<int>("FastProcessing", 1);
0043   descriptions.add("hltTrackerHaloFilter", desc);
0044 }
0045 
0046 //
0047 // member functions
0048 //
0049 
0050 // ------------ method called to produce the data  ------------
0051 bool HLTTrackerHaloFilter::hltFilter(edm::Event& event,
0052                                      const edm::EventSetup& iSetup,
0053                                      trigger::TriggerFilterObjectWithRefs& filterproduct) const {
0054   /*
0055   //Retrieve tracker topology from geometry
0056   edm::ESHandle<TrackerTopology> tTopoHandle;
0057   iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
0058   const TrackerTopology* const tTopo = tTopoHandle.product();
0059 
0060   // All HLT filters must create and fill an HLT filter object,
0061   // recording any reconstructed physics objects satisfying (or not)
0062   // this HLT filter, and place it in the Event.
0063 
0064   // The filter object
0065   if (saveTags()) filterproduct.addCollectionTag(inputTag_);
0066 
0067   edm::Handle<edmNew::DetSetVector<SiStripCluster> > stripClusters;
0068   event.getByToken(clusterInputToken_, stripClusters);
0069 
0070 
0071   /// First initialize some variables
0072   int SST_clus_MAP_m[5][8][9]; memset(SST_clus_MAP_m,  0x00, sizeof(SST_clus_MAP_m));
0073   int SST_clus_MAP_p[5][8][9]; memset(SST_clus_MAP_p,  0x00, sizeof(SST_clus_MAP_p));
0074   int SST_clus_PROJ_m[5][8];   memset(SST_clus_PROJ_m, 0x00, sizeof(SST_clus_PROJ_m));
0075   int SST_clus_PROJ_p[5][8];   memset(SST_clus_PROJ_p, 0x00, sizeof(SST_clus_PROJ_p));
0076 
0077   int n_total_clus  = 0;
0078   int n_total_clusp = 0;
0079   int n_total_clusm = 0;
0080 
0081   int maxm          = 0;
0082   int maxp          = 0;
0083 
0084   int npeakm        = 0;
0085   int npeakp        = 0;
0086 
0087   for (auto di = stripClusters->begin(false), de=stripClusters->end(false); di!=de; ++di) {
0088 
0089     // Don't go further if one of the TEC cluster cut is not passed
0090     if (n_total_clus>max_clusT_)   return false;
0091     if (n_total_clusp>max_clusTp_) return false;
0092     if (n_total_clusm>max_clusTm_) return false;
0093 
0094 
0095     // Some cuts applied if fast processing requested
0096     if (fastproc_ && maxm<sign_accu_) return false;
0097     
0098     //    auto ds = *di;
0099     DetId id = di->id();
0100     uint32_t subdet = id.subdetId();
0101 
0102     // Look at the DetId, as we perform the quest only in TEC
0103     if ( subdet != SiStripDetId::TEC ) continue;
0104     if ( id%2 == 1 ) continue;
0105     if ( tTopo->tecRing(id)<3 || tTopo->tecIsStereo(id) ) continue;
0106 
0107     if ( !di->isValid() ) {
0108       auto dst = stripClusters->find(id,true);
0109       //      std::cout << "isValid: " << dst->isValid() << std::endl;
0110       if ( !dst->isValid() ) continue; // not umpacked
0111       if ( dst->empty()   ) continue;
0112       //    auto s1 = dst->size();
0113       //    std::cout << "s1: " << s1 << std::endl;
0114     }
0115     ++n_total_clus;
0116 
0117     int r_id = tTopo->tecRing(id)-3;
0118     int p_id = tTopo->tecPetalNumber(id)-1;
0119     int w_id = tTopo->tecWheel(id)-1;
0120     
0121     // Then we do accumulations and cuts 'on the fly'
0122     if ( tTopo->tecSide(id)==1 ) // Minus side (BEAM2)
0123       {
0124     ++n_total_clusm;
0125     ++SST_clus_MAP_m[r_id][p_id][w_id]; 
0126     ++SST_clus_PROJ_m[r_id][p_id]; // Accumulation
0127     
0128     if (SST_clus_PROJ_m[r_id][p_id]>maxm) maxm = SST_clus_PROJ_m[r_id][p_id];
0129     if (SST_clus_PROJ_m[r_id][p_id]==sign_accu_) ++npeakm;
0130     
0131     if (npeakm>=max_back_) return false; // Too many accumulations (PKAM)
0132       }
0133     else // Plus side (BEAM1)
0134       {
0135     ++n_total_clusp;
0136     if (!SST_clus_MAP_p[r_id][p_id][w_id])
0137     {
0138       ++SST_clus_MAP_p[r_id][p_id][w_id];   
0139       ++SST_clus_PROJ_p[r_id][p_id];
0140 
0141       if (SST_clus_PROJ_p[r_id][p_id]>maxp) maxp = SST_clus_PROJ_p[r_id][p_id];
0142       if (SST_clus_PROJ_p[r_id][p_id]==sign_accu_) ++npeakp;
0143 
0144       if (npeakp>=max_back_) return false;
0145     }
0146       }
0147 
0148   }
0149 
0150   // The final selection is applied here
0151   // Most of the cuts have already been applied tough
0152 
0153   if (n_total_clus>max_clusT_)                return false;
0154   if (n_total_clusp>max_clusTp_)              return false;
0155   if (n_total_clusm>max_clusTm_)              return false;
0156   if (n_total_clusp<sign_accu_)               return false;
0157   if (n_total_clusm<sign_accu_)               return false;
0158   if (maxm<sign_accu_ || maxp<sign_accu_)     return false;
0159   if (npeakm>=max_back_ || npeakp>=max_back_) return false;
0160 */
0161   return true;
0162 }
0163 
0164 // declare this class as a framework plugin
0165 #include "FWCore/Framework/interface/MakerMacros.h"
0166 DEFINE_FWK_MODULE(HLTTrackerHaloFilter);