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
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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 selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
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
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 23 of file StripCompactDigiSimLinksProducer.cc.

Constructor & Destructor Documentation

◆ StripCompactDigiSimLinksProducer()

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

Definition at line 35 of file StripCompactDigiSimLinksProducer.cc.

36  : src_(iConfig.getParameter<edm::InputTag>("src")), maxHoleSize_(iConfig.getParameter<uint32_t>("maxHoleSize")) {
37  produces<StripCompactDigiSimLinks>();
38 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303

◆ ~StripCompactDigiSimLinksProducer()

StripCompactDigiSimLinksProducer::~StripCompactDigiSimLinksProducer ( )
override

Definition at line 40 of file StripCompactDigiSimLinksProducer.cc.

40 {}

Member Function Documentation

◆ produce()

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

Implements edm::one::EDProducerBase.

Definition at line 42 of file StripCompactDigiSimLinksProducer.cc.

References edm::DetSet< T >::begin(), DMR_cfg::cerr, DEBUG, spr::find(), iEvent, crabWrapper::key, maxHoleSize_, eostools::move(), convertSQLitetoXML_cfg::output, findQualityFiles::size, TrackRefitter_38T_cff::src, src_, and edm::swap().

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

Member Data Documentation

◆ maxHoleSize_

uint32_t StripCompactDigiSimLinksProducer::maxHoleSize_
private

Definition at line 32 of file StripCompactDigiSimLinksProducer.cc.

Referenced by produce().

◆ src_

edm::InputTag StripCompactDigiSimLinksProducer::src_
private

Definition at line 31 of file StripCompactDigiSimLinksProducer.cc.

Referenced by produce().