CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
StripCompactDigiSimLinksProducer Class Reference
Inheritance diagram for StripCompactDigiSimLinksProducer:
edm::one::EDProducer<> edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
 StripCompactDigiSimLinksProducer (const edm::ParameterSet &iConfig)
 
 ~StripCompactDigiSimLinksProducer () override
 
- Public Member Functions inherited from edm::one::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () 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)
 
virtual ~ProducerBase () noexcept(false)
 
- 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
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

uint32_t maxHoleSize_
 
edm::InputTag src_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase 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::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 26 of file StripCompactDigiSimLinksProducer.cc.

Constructor & Destructor Documentation

StripCompactDigiSimLinksProducer::StripCompactDigiSimLinksProducer ( const edm::ParameterSet iConfig)

Definition at line 38 of file StripCompactDigiSimLinksProducer.cc.

38  :
39  src_(iConfig.getParameter<edm::InputTag>("src")),
40  maxHoleSize_(iConfig.getParameter<uint32_t>("maxHoleSize"))
41 {
42  produces<StripCompactDigiSimLinks>();
43 }
T getParameter(std::string const &) const
StripCompactDigiSimLinksProducer::~StripCompactDigiSimLinksProducer ( )
override

Definition at line 45 of file StripCompactDigiSimLinksProducer.cc.

46 {
47 }

Member Function Documentation

void StripCompactDigiSimLinksProducer::produce ( edm::Event iEvent,
const edm::EventSetup  
)
override

Definition at line 50 of file StripCompactDigiSimLinksProducer.cc.

References edm::DetSet< T >::begin(), MessageLogger_cfi::cerr, DEBUG, DEFINE_FWK_MODULE, edm::DetSet< T >::detId(), edm::DetSet< T >::end(), spr::find(), edm::Event::getByLabel(), StripCompactDigiSimLinks::Filler::insert(), crabWrapper::key, maxHoleSize_, eostools::move(), convertSQLitetoXML_cfg::output, edm::Event::put(), edm::DetSet< T >::size(), findQualityFiles::size, TrackRefitter_38T_cff::src, src_, and edm::swap().

51 {
52  using namespace edm;
54  iEvent.getByLabel(src_, src);
55 
57 
58  int previousStrip; // previous strip with at least one link (might not be the strip of the previous link there are overlapping clusters)
59  int previousLinkStrip; // strip of the previous link (can be the same as the one of this link if there are overlapping clusters)
60  std::vector<StripCompactDigiSimLinks::key_type> thisStripSignals; // particles on this strip
61  std::vector<StripCompactDigiSimLinks::key_type> previousStripSignals; // particles on the previous strip
62 
63  foreach(const DetSet<StripDigiSimLink> &det, *src) {
64  DEBUG(std::cerr << "\n\nProcessing detset " << det.detId() << ", size = " << det.size() << std::endl;)
65  previousStrip = -2; // previous strip with at least one link (might not be the strip of the previous link there are overlapping clusters)
66  previousLinkStrip = -2; // strip of the previous link (can be the same as the one of this link if there are overlapping clusters)
67  thisStripSignals.clear();
68  previousStripSignals.clear();
69  for (DetSet<StripDigiSimLink>::const_iterator it = det.begin(), ed = det.end(); it != ed; ++it) {
70  DEBUG(std::cerr << " processing digiSimLink on strip " << it->channel() << " left by particle " << it->SimTrackId() << ", event " << it->eventId().rawId() << std::endl;)
71  if (int(it->channel()) != previousLinkStrip) {
72  previousStrip = previousLinkStrip;
73  DEBUG(std::cerr << " strip changed!" << std::endl;)
74  swap(thisStripSignals, previousStripSignals);
75  thisStripSignals.clear();
76  }
77  DEBUG(std::cerr << " previous strip " << previousStrip << ", previous link strip " << previousLinkStrip << std::endl;)
78  //DEBUG(std::cerr << " on previous strip: "; foreach(StripCompactDigiSimLinks::key_type k, previousStripSignals) { std::cerr << "(ev " << k.first.rawId() << ", id " << k.second << ") "; } std::cerr << std::endl;)
79  //DEBUG(std::cerr << " on this strip: "; foreach(StripCompactDigiSimLinks::key_type k, thisStripSignals) { std::cerr << "(ev " << k.first.rawId() << ", id " << k.second << ") "; } std::cerr << std::endl;)
80  StripCompactDigiSimLinks::key_type key(it->eventId(), it->SimTrackId());
81  bool alreadyClusterized = false;
82  if (int(it->channel()) == previousStrip+1) {
83  DEBUG(std::cerr << " on next strip" << std::endl;)
84  if (std::find(previousStripSignals.begin(), previousStripSignals.end(), key) != previousStripSignals.end()) {
85  alreadyClusterized = true;
86  DEBUG(std::cerr << " and part of previous cluster" << std::endl;)
87  }
88  }
89  if (!alreadyClusterized) {
90  DEBUG(std::cerr << " clusterize!" << std::endl;)
91  unsigned int size = 1;
92  int myLastStrip = it->channel(); // last known strip with signals from this particle
93  for (DetSet<StripDigiSimLink>::const_iterator it2 = it+1; it2 < ed; ++it2) {
94  DEBUG(std::cerr << " digiSimLink on strip " << it2->channel() << " left by particle " << it2->SimTrackId() << ", event " << it2->eventId().rawId() << std::endl;)
95  if ((it2->channel() - myLastStrip) > maxHoleSize_+1) {
96  DEBUG(std::cerr << " found hole of size " << (it2->channel() - myLastStrip) << ", stopping." << std::endl;)
97  break;
98  }
99  if ((it2->eventId() == key.first) && (it2->SimTrackId() == key.second)) {
100  size++;
101  DEBUG(std::cerr << " extending cluster, now size = " << size << std::endl;)
102  myLastStrip = it2->channel();
103  }
104  }
105  output.insert(key, StripCompactDigiSimLinks::HitRecord(det.detId(), it->channel(), size));
106  }
107  if (int(it->channel()) != previousLinkStrip) {
108  previousLinkStrip = it->channel();
109  }
110  thisStripSignals.push_back(key);
111  DEBUG(std::cerr << " ending state " << previousStrip << ", previous link strip " << previousLinkStrip << std::endl;)
112  //DEBUG(std::cerr << " on previous strip: "; foreach(StripCompactDigiSimLinks::key_type k, previousStripSignals) { std::cerr << "(ev " << k.first.rawId() << ", id " << k.second << ") "; } std::cerr << std::endl;)
113  //DEBUG(std::cerr << " on this strip: "; foreach(StripCompactDigiSimLinks::key_type k, thisStripSignals) { std::cerr << "(ev " << k.first.rawId() << ", id " << k.second << ") "; } std::cerr << std::endl;)
114  DEBUG(std::cerr << std::endl;)
115  }
116  }
117 
118  std::unique_ptr< StripCompactDigiSimLinks > ptr(new StripCompactDigiSimLinks(output));
119  iEvent.put(std::move(ptr));
120 }
iterator end()
Definition: DetSet.h:60
size
Write out results.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
det_id_type detId() const
Definition: DetSet.h:72
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:116
size_type size() const
Definition: DetSet.h:63
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:464
iterator begin()
Definition: DetSet.h:59
HLT enums.
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

uint32_t StripCompactDigiSimLinksProducer::maxHoleSize_
private

Definition at line 35 of file StripCompactDigiSimLinksProducer.cc.

Referenced by produce().

edm::InputTag StripCompactDigiSimLinksProducer::src_
private

Definition at line 34 of file StripCompactDigiSimLinksProducer.cc.

Referenced by produce().