CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
virtual bool filter (edm::Event &e, edm::EventSetup const &c)
 
virtual ~ClusterMTCCFilter ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
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 &)
 
- 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 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
virtual cms::ClusterMTCCFilter::~ClusterMTCCFilter ( )
inlinevirtual

Definition at line 25 of file ClusterMTCCFilter.h.

25 {}

Member Function Documentation

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

Implements edm::EDFilter.

Definition at line 44 of file ClusterMTCCFilter.cc.

References end, edm::EventSetup::get(), edm::Event::getByLabel(), h, python.multivaluedict::map(), edm::ESHandle< class >::product(), edm::Event::put(), DetId::rawId(), findQualityFiles::size, 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(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

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].size()>0 || clusters_in_subcomponents[32].size()>0 ) nr_of_subcomps_with_clusters++; // TIB1 || TIB2
116  if( clusters_in_subcomponents[33].size()>0 ) nr_of_subcomps_with_clusters++; // TIB3
117  if( clusters_in_subcomponents[51].size()>0 ) nr_of_subcomps_with_clusters++; // TOB1
118  if( clusters_in_subcomponents[52].size()>0 ) 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  std::auto_ptr< int > output_decision( new int(decision) );
126  e.put(output_decision);
127 
128  std::auto_ptr< unsigned int > output_sumofcharges( new unsigned int(sum_of_cluster_charges) );
129  e.put(output_sumofcharges);
130 
131  std::auto_ptr< map<unsigned int,vector<SiStripCluster> > > output_clusters(new map<unsigned int,vector<SiStripCluster> > (clusters_in_subcomponents));
132  e.put(output_clusters);
133 
134  return decision;
135 }
unsigned int ChargeThresholdTOB
unsigned int tibLayer(const DetId &id) const
unsigned int ChargeThresholdTEC
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
unsigned int MinClustersDiffComponents
std::map< unsigned int, std::vector< SiStripCluster > > clusters_in_subcomponents
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
#define end
Definition: vmac.h:37
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:420
Definition: DetId.h:18
uint32_t tibGlued(const DetId &id) const
std::vector< uint32_t > ModulesToBeExcluded
T const * product() const
Definition: ESHandle.h:86
uint32_t tibStereo(const DetId &id) const
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:108
unsigned int ChargeThresholdTIB
tuple size
Write out results.
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.