CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
cms::ClusterMTCCFilter Class Reference

#include <ClusterMTCCFilter.h>

Inheritance diagram for cms::ClusterMTCCFilter:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ClusterMTCCFilter (const edm::ParameterSet &ps)
 
bool filter (edm::Event &e, edm::EventSetup const &c) override
 
 ~ClusterMTCCFilter () override
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

unsigned int ChargeThresholdTEC
 
unsigned int ChargeThresholdTIB
 
unsigned int ChargeThresholdTOB
 
std::string clusterProducer
 
std::map< unsigned int, std::vector< SiStripCluster > > clusters_in_subcomponents
 
unsigned int MinClustersDiffComponents
 
std::vector< uint32_t > ModulesToBeExcluded
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 22 of file ClusterMTCCFilter.h.

Constructor & Destructor Documentation

cms::ClusterMTCCFilter::ClusterMTCCFilter ( const edm::ParameterSet ps)

Definition at line 24 of file ClusterMTCCFilter.cc.

References edm::ParameterSet::getParameter().

24  {
25  //
26  ModulesToBeExcluded.clear();
27  ModulesToBeExcluded = ps.getParameter< std::vector<unsigned> >("ModulesToBeExcluded");
28  edm::LogInfo("ClusterMTCCFilter")<<"Clusters from "<<ModulesToBeExcluded.size()<<" modules will be ignored in the filter:";
29  for( std::vector<uint32_t>::const_iterator imod = ModulesToBeExcluded.begin(); imod != ModulesToBeExcluded.end(); imod++){
30  edm::LogInfo("ClusterMTCCFilter")<< *imod;
31  }
32  //
33  ChargeThresholdTIB=ps.getParameter<int>("ChargeThresholdTIB");
34  ChargeThresholdTOB=ps.getParameter<int>("ChargeThresholdTOB");
35  ChargeThresholdTEC=ps.getParameter<int>("ChargeThresholdTEC");
36  MinClustersDiffComponents=ps.getParameter<int>("MinClustersDiffComponents");
37  clusterProducer = ps.getParameter<string>("ClusterProducer");
38  //
39  produces <int>();
40  produces <unsigned int >();
41  produces < map<unsigned int,vector<SiStripCluster> > >();
42 }
T getParameter(std::string const &) const
unsigned int ChargeThresholdTOB
unsigned int ChargeThresholdTEC
unsigned int MinClustersDiffComponents
std::vector< uint32_t > ModulesToBeExcluded
unsigned int ChargeThresholdTIB
cms::ClusterMTCCFilter::~ClusterMTCCFilter ( )
inlineoverride

Definition at line 25 of file ClusterMTCCFilter.h.

References EnergyCorrector::c, MillePedeFileConverter_cfg::e, and filter().

25 {}

Member Function Documentation

bool cms::ClusterMTCCFilter::filter ( edm::Event e,
edm::EventSetup const &  c 
)
overridevirtual

Implements edm::EDFilter.

Definition at line 44 of file ClusterMTCCFilter.cc.

References relativeConstraints::empty, end, edm::EventSetup::get(), edm::Event::getByLabel(), h, genParticles_cff::map, edm::ESHandle< T >::product(), edm::Event::put(), DetId::rawId(), DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, TrackerTopology::tibGlued(), TrackerTopology::tibLayer(), TrackerTopology::tibStereo(), StripSubdetector::TOB, and TrackerTopology::tobLayer().

Referenced by Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView(), and ~ClusterMTCCFilter().

44  {
45 
46  //Retrieve tracker topology from geometry
48  c.get<IdealGeometryRecord>().get(tTopoHandle);
49  const TrackerTopology* const tTopo = tTopoHandle.product();
50 
51  //get SiStripCluster
54 
55 
56  //
57  unsigned int sum_of_cluster_charges=0;
59  // first find all clusters that are over the threshold
60  for (edm::DetSetVector<SiStripCluster>::const_iterator it=h->begin();it!=h->end();it++) {
61  for(vector<SiStripCluster>::const_iterator vit=(it->data).begin(); vit!=(it->data).end(); vit++){
62  // calculate sum of amplitudes
63  unsigned int amplclus=0;
64  for(auto ia=vit->amplitudes().begin(); ia!=vit->amplitudes().end(); ia++) {
65  if ((*ia)>0) amplclus+=(*ia); // why should this be negative?
66  }
67  sum_of_cluster_charges += amplclus;
68  DetId thedetId = DetId(it->detId());
69  unsigned int generalized_layer = 0;
70  bool exclude_this_detid = false;
71  for( std::vector<uint32_t>::const_iterator imod = ModulesToBeExcluded.begin(); imod != ModulesToBeExcluded.end(); imod++ ){
72  if(*imod == thedetId.rawId()) exclude_this_detid = true; // found in exclusion list
73  }
74  // apply different thresholds for TIB/TOB/TEC
75  if( ! exclude_this_detid ){ // only consider if not in exclusion list
76  if ( ( thedetId.subdetId()==StripSubdetector::TIB && amplclus>ChargeThresholdTIB )
77  || ( thedetId.subdetId()==StripSubdetector::TOB && amplclus>ChargeThresholdTOB )
78  || ( thedetId.subdetId()==StripSubdetector::TEC && amplclus>ChargeThresholdTEC )
79  ){
80  // calculate generalized_layer: 31 = TIB1, 32 = TIB2, 33 = TIB3, 50 = TOB, 60 = TEC
81  if(thedetId.subdetId()==StripSubdetector::TIB){
82 
83  generalized_layer = 10*thedetId.subdetId() + tTopo->tibLayer(thedetId.rawId()) + tTopo->tibStereo(thedetId.rawId());
84  if (tTopo->tibLayer(thedetId.rawId())==2){
85  generalized_layer++;
86  if (tTopo->tibGlued(thedetId.rawId())) edm::LogError("ClusterMTCCFilter")<<"WRONGGGG"<<endl;
87  }
88  }else{
89  generalized_layer = 10*thedetId.subdetId();
90  if(thedetId.subdetId()==StripSubdetector::TOB){
91 
92  generalized_layer += tTopo->tobLayer(thedetId.rawId());
93  }
94  }
95  // fill clusters_in_subcomponents
96  map<unsigned int,vector<SiStripCluster> >::iterator layer_it = clusters_in_subcomponents.find(generalized_layer);
97  if(layer_it==clusters_in_subcomponents.end()){ // if layer not found yet, create DATA vector and generate map KEY + DATA
98  vector<SiStripCluster> local_vector;
99  local_vector.push_back(*vit);
100  clusters_in_subcomponents.insert( std::make_pair( generalized_layer, local_vector) );
101  }else{ // push into already existing vector
102  (layer_it->second).push_back(*vit);
103  }
104  }
105  }
106  }
107  }
108 
109  bool decision=false; // default value, only accept if set true in this loop
110  unsigned int nr_of_subcomps_with_clusters=0;
111 // dk: 2006.08.24 - change filter decision as proposed by V. Ciulli. || TIB1 TIB2 counted as 1, TEC excluded
112 // if( clusters_in_subcomponents[31].size()>0 ) nr_of_subcomps_with_clusters++; // TIB1
113 // if( clusters_in_subcomponents[32].size()>0 ) nr_of_subcomps_with_clusters++; // TIB2
114 // if( clusters_in_subcomponents[60].size()>0 ) nr_of_subcomps_with_clusters++; // TEC
115  if( !clusters_in_subcomponents[31].empty() || !clusters_in_subcomponents[32].empty() ) nr_of_subcomps_with_clusters++; // TIB1 || TIB2
116  if( !clusters_in_subcomponents[33].empty() ) nr_of_subcomps_with_clusters++; // TIB3
117  if( !clusters_in_subcomponents[51].empty() ) nr_of_subcomps_with_clusters++; // TOB1
118  if( !clusters_in_subcomponents[52].empty() ) nr_of_subcomps_with_clusters++; // TOB2
119  if(
120  nr_of_subcomps_with_clusters >= MinClustersDiffComponents // more than 'MinClustersDiffComponents' components have at least 1 cluster
121  ) {
122  decision = true; // accept event
123  }
124 
125  e.put(std::make_unique<int>(decision));
126 
127  e.put(std::make_unique<unsigned int>(sum_of_cluster_charges));
128 
129  e.put(std::make_unique<std::map<unsigned int,std::vector<SiStripCluster>>>(clusters_in_subcomponents));
130 
131  return decision;
132 }
unsigned int ChargeThresholdTOB
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
unsigned int tibLayer(const DetId &id) const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
unsigned int ChargeThresholdTEC
unsigned int MinClustersDiffComponents
std::map< unsigned int, std::vector< SiStripCluster > > clusters_in_subcomponents
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
#define end
Definition: vmac.h:39
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
Definition: DetId.h:18
uint32_t tibGlued(const DetId &id) const
std::vector< uint32_t > ModulesToBeExcluded
uint32_t tibStereo(const DetId &id) const
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:104
unsigned int ChargeThresholdTIB
T const * product() const
Definition: ESHandle.h:86
unsigned int tobLayer(const DetId &id) const

Member Data Documentation

unsigned int cms::ClusterMTCCFilter::ChargeThresholdTEC
private

Definition at line 32 of file ClusterMTCCFilter.h.

unsigned int cms::ClusterMTCCFilter::ChargeThresholdTIB
private

Definition at line 30 of file ClusterMTCCFilter.h.

unsigned int cms::ClusterMTCCFilter::ChargeThresholdTOB
private

Definition at line 31 of file ClusterMTCCFilter.h.

std::string cms::ClusterMTCCFilter::clusterProducer
private

Definition at line 29 of file ClusterMTCCFilter.h.

std::map<unsigned int,std::vector<SiStripCluster> > cms::ClusterMTCCFilter::clusters_in_subcomponents
private

Definition at line 36 of file ClusterMTCCFilter.h.

unsigned int cms::ClusterMTCCFilter::MinClustersDiffComponents
private

Definition at line 33 of file ClusterMTCCFilter.h.

std::vector<uint32_t> cms::ClusterMTCCFilter::ModulesToBeExcluded
private

Definition at line 34 of file ClusterMTCCFilter.h.