CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TECClusterFilter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiStripChannelChargeFilter
4 // Class : TECClusterFilter
5 //
6 //
7 // Original Author: sfricke
8 
9 
15 
16 using namespace std;
17 
18 namespace cms
19 {
20 
22  //
23  ModulesToBeExcluded.clear();
24  ModulesToBeExcluded = ps.getParameter< std::vector<unsigned> >("ModulesToBeExcluded");
25  edm::LogInfo("TECClusterFilter")<<"Clusters from "<<ModulesToBeExcluded.size()<<" modules will be ignored in the filter:";
26  for( std::vector<uint32_t>::const_iterator imod = ModulesToBeExcluded.begin(); imod != ModulesToBeExcluded.end(); imod++){
27  edm::LogInfo("TECClusterFilter")<< *imod;
28  }
29  //
30  ChargeThresholdTEC=ps.getParameter<int>("ChargeThresholdTEC");
31  edm::LogInfo("TECClusterFilter")<<"ChargeThresholdTEC"<<ChargeThresholdTEC;
32  minNrOfTECClusters=ps.getParameter<int>("MinNrOfTECClusters");
33  edm::LogInfo("TECClusterFilter")<<"MinNrOfTECClusters"<<minNrOfTECClusters;
34  clusterProducer = ps.getParameter<string>("ClusterProducer");
35  edm::LogInfo("TECClusterFilter")<<"ClusterProducer"<<clusterProducer;
36 
37  // also put decision in the event
38  produces <int>();
39  }
40 
42  {
44  e.getByLabel(clusterProducer,h);
45  bool decision=false; // default value, only accept if set true in this loop
46  unsigned int nr_clusters_above_threshold = 0;
47  for (edm::DetSetVector<SiStripCluster>::const_iterator it=h->begin();it!=h->end();it++)
48  {
49  DetId thedetId = DetId(it->detId());
50  bool exclude_this_detid = false;
51  for(vector<SiStripCluster>::const_iterator vit=(it->data).begin(); vit!=(it->data).end(); vit++)
52  {
53  for( std::vector<uint32_t>::const_iterator imod = ModulesToBeExcluded.begin(); imod != ModulesToBeExcluded.end(); imod++ )
54  { if(*imod == thedetId.rawId()) exclude_this_detid = true; } // found in exclusion list
55  if( (! exclude_this_detid ) && (thedetId.subdetId()==StripSubdetector::TEC) ) // if not excluded and if TEC module
56  { // calculate sum of amplitudes
57  unsigned int amplclus=0;
58  // int amplclus=0;
59  for(auto ia=vit->amplitudes().begin(); ia!=vit->amplitudes().end(); ia++)
60  { if ((*ia)>0) amplclus+=(*ia); } // why should this be negative?
61  if(amplclus>ChargeThresholdTEC) nr_clusters_above_threshold++;
62  }
63  }
64  }
65  if(nr_clusters_above_threshold>=minNrOfTECClusters) decision=true;
66  std::auto_ptr< int > output_decision( new int(decision) );
67  e.put(output_decision);
68  return decision;
69  }
70 }
T getParameter(std::string const &) const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
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
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:108