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 Types | Private Member Functions | Private Attributes
SiStripClusterizer Class Reference

#include <SiStripClusterizer.h>

Inheritance diagram for SiStripClusterizer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginRun (const edm::Run &run, const edm::EventSetup &es) override
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 SiStripClusterizer (const edm::ParameterSet &conf)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

typedef edm::EDGetTokenT
< edm::DetSetVector
< SiStripDigi > > 
token_t
 
typedef std::vector< token_ttoken_v
 

Private Member Functions

template<class T >
bool findInput (const edm::EDGetTokenT< T > &, edm::Handle< T > &, const edm::Event &)
 
void refineCluster (const edm::Handle< edm::DetSetVector< SiStripDigi > > &input, std::auto_ptr< edmNew::DetSetVector< SiStripCluster > > &output)
 

Private Attributes

std::auto_ptr
< StripClusterizerAlgorithm
algorithm
 
edm::ParameterSet confClusterizer_
 
bool doRefineCluster_
 
const std::vector< edm::InputTaginputTags
 
token_v inputTokens
 
float occupancyThreshold_
 
edm::ESHandle< SiStripQualityquality_
 
edm::ESHandle< SiStripDetCablingSiStripDetCabling_
 
unsigned widthThreshold_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 15 of file SiStripClusterizer.h.

Member Typedef Documentation

Definition at line 34 of file SiStripClusterizer.h.

typedef std::vector<token_t> SiStripClusterizer::token_v
private

Definition at line 35 of file SiStripClusterizer.h.

Constructor & Destructor Documentation

SiStripClusterizer::SiStripClusterizer ( const edm::ParameterSet conf)
explicit

Definition at line 11 of file SiStripClusterizer.cc.

References confClusterizer_, doRefineCluster_, edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), inputTags, inputTokens, occupancyThreshold_, GlobalPosition_Frontier_DevDB_cff::tag, edm::vector_transform(), and widthThreshold_.

12  : confClusterizer_(conf.getParameter<edm::ParameterSet>("Clusterizer")),
13  inputTags( conf.getParameter<std::vector<edm::InputTag> >("DigiProducersList") ),
15  produces< edmNew::DetSetVector<SiStripCluster> > ();
16  inputTokens = edm::vector_transform( inputTags, [this](edm::InputTag const & tag) { return consumes< edm::DetSetVector<SiStripDigi> >(tag);} );
17  doRefineCluster_ = confClusterizer_.existsAs<bool>("doRefineCluster") ? confClusterizer_.getParameter<bool>("doRefineCluster") : false;
18  occupancyThreshold_ = confClusterizer_.existsAs<double>("occupancyThreshold") ? confClusterizer_.getParameter<double>("occupancyThreshold") : 0.05;
19  widthThreshold_ = confClusterizer_.existsAs<unsigned>("widthThreshold") ? confClusterizer_.getParameter<unsigned>("widthThreshold") : 4;
20 }
T getParameter(std::string const &) const
edm::ParameterSet confClusterizer_
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:184
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
const std::vector< edm::InputTag > inputTags
static std::auto_ptr< StripClusterizerAlgorithm > create(const edm::ParameterSet &)
std::auto_ptr< StripClusterizerAlgorithm > algorithm

Member Function Documentation

void SiStripClusterizer::beginRun ( const edm::Run run,
const edm::EventSetup es 
)
overridevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 84 of file SiStripClusterizer.cc.

References doRefineCluster_, edm::EventSetup::get(), quality_, and SiStripDetCabling_.

84  {
85  if (doRefineCluster_) {
87  es.get<SiStripQualityRcd>().get("", quality_);
88  }
89 }
edm::ESHandle< SiStripDetCabling > SiStripDetCabling_
edm::ESHandle< SiStripQuality > quality_
const T & get() const
Definition: EventSetup.h:55
template<class T >
bool SiStripClusterizer::findInput ( const edm::EDGetTokenT< T > &  tag,
edm::Handle< T > &  handle,
const edm::Event e 
)
inlineprivate

Definition at line 51 of file SiStripClusterizer.cc.

References edm::Event::getByToken(), and edm::HandleBase::isValid().

Referenced by produce().

51  {
52  e.getByToken( tag, handle);
53  return handle.isValid();
54 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
bool isValid() const
Definition: HandleBase.h:76
void SiStripClusterizer::produce ( edm::Event event,
const edm::EventSetup es 
)
virtual

Implements edm::stream::EDProducerBase.

Definition at line 23 of file SiStripClusterizer.cc.

References algorithm, doRefineCluster_, findInput(), inputTokens, LogDebug, convertSQLitetoXML_cfg::output, and refineCluster().

23  {
24 
25  std::auto_ptr< edmNew::DetSetVector<SiStripCluster> > output(new edmNew::DetSetVector<SiStripCluster>());
26  output->reserve(10000,4*10000);
27 
29 // edm::Handle< edmNew::DetSetVector<SiStripDigi> > inputNew;
30 
31  algorithm->initialize(es);
32 
33  BOOST_FOREACH( const edm::EDGetTokenT< edm::DetSetVector<SiStripDigi> >& token, inputTokens) {
34  if( findInput( token, inputOld, event) ) {
35  algorithm->clusterize(*inputOld, *output);
36  if (doRefineCluster_) refineCluster(inputOld, output);
37  }
38 // else if( findInput( tag, inputNew, event) ) algorithm->clusterize(*inputNew, *output);
39  else edm::LogError("Input Not Found") << "[SiStripClusterizer::produce] ";// << tag;
40  }
41 
42  LogDebug("Output") << output->dataSize() << " clusters from "
43  << output->size() << " modules";
44  output->shrink_to_fit();
45  event.put(output);
46 }
#define LogDebug(id)
bool findInput(const edm::EDGetTokenT< T > &, edm::Handle< T > &, const edm::Event &)
void refineCluster(const edm::Handle< edm::DetSetVector< SiStripDigi > > &input, std::auto_ptr< edmNew::DetSetVector< SiStripCluster > > &output)
std::auto_ptr< StripClusterizerAlgorithm > algorithm
void SiStripClusterizer::refineCluster ( const edm::Handle< edm::DetSetVector< SiStripDigi > > &  input,
std::auto_ptr< edmNew::DetSetVector< SiStripCluster > > &  output 
)
private

Definition at line 57 of file SiStripClusterizer.cc.

References input, occupancyThreshold_, convertSQLitetoXML_cfg::output, quality_, SiStripDetCabling_, edm::DetSetVector< T >::size(), and widthThreshold_.

Referenced by produce().

58  {
59  if (input->size() == 0) return;
60 
61  // Flag merge-prone clusters for relaxed CPE errors
62  // Criterion is sensor occupancy and cluster width exceeding thresholds
63 
64  for (edmNew::DetSetVector<SiStripCluster>::const_iterator det=output->begin(); det!=output->end(); det++) {
65  uint32_t detId = det->id();
66  // Find the number of good strips in this sensor
67  int nchannideal = SiStripDetCabling_->nApvPairs(detId) * 2 * 128;
68  int nchannreal = 0;
69  for(int strip = 0; strip < nchannideal; ++strip)
70  if(!quality_->IsStripBad(detId,strip)) ++nchannreal;
71 
73  if (digis != input->end()) {
74  int ndigi = digis->size();
75  for (edmNew::DetSet<SiStripCluster>::iterator clust = det->begin(); clust != det->end(); clust++) {
76  if (ndigi > occupancyThreshold_*nchannreal && clust->amplitudes().size() >= widthThreshold_) clust->setMerged(true);
77  else clust->setMerged(false);
78  }
79  // std::cout << "Sensor:strips_occStrips_clust " << nchannreal << " " << ndigi << " " << det->size() << std::endl;
80  }
81  } // traverse sensors
82 }
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
iterator find(det_id_type id)
Definition: DetSetVector.h:294
data_type * iterator
Definition: DetSetNew.h:29
edm::ESHandle< SiStripDetCabling > SiStripDetCabling_
edm::ESHandle< SiStripQuality > quality_
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:365
size_type size() const
Return the number of contained DetSets.
Definition: DetSetVector.h:287
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:108

Member Data Documentation

std::auto_ptr<StripClusterizerAlgorithm> SiStripClusterizer::algorithm
private

Definition at line 31 of file SiStripClusterizer.h.

Referenced by produce().

edm::ParameterSet SiStripClusterizer::confClusterizer_
private

Definition at line 25 of file SiStripClusterizer.h.

Referenced by SiStripClusterizer().

bool SiStripClusterizer::doRefineCluster_
private

Definition at line 26 of file SiStripClusterizer.h.

Referenced by beginRun(), produce(), and SiStripClusterizer().

const std::vector<edm::InputTag> SiStripClusterizer::inputTags
private
token_v SiStripClusterizer::inputTokens
private

Definition at line 36 of file SiStripClusterizer.h.

Referenced by produce(), and SiStripClusterizer().

float SiStripClusterizer::occupancyThreshold_
private

Definition at line 27 of file SiStripClusterizer.h.

Referenced by refineCluster(), and SiStripClusterizer().

edm::ESHandle<SiStripQuality> SiStripClusterizer::quality_
private

Definition at line 39 of file SiStripClusterizer.h.

Referenced by beginRun(), and refineCluster().

edm::ESHandle<SiStripDetCabling> SiStripClusterizer::SiStripDetCabling_
private

Definition at line 38 of file SiStripClusterizer.h.

Referenced by beginRun(), and refineCluster().

unsigned SiStripClusterizer::widthThreshold_
private

Definition at line 28 of file SiStripClusterizer.h.

Referenced by refineCluster(), and SiStripClusterizer().