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
StripCompactDigiSimLinksProducer Class Reference
Inheritance diagram for StripCompactDigiSimLinksProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &) override
 
 StripCompactDigiSimLinksProducer (const edm::ParameterSet &iConfig)
 
 ~StripCompactDigiSimLinksProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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

uint32_t maxHoleSize_
 
edm::InputTag src_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer 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::EDProducer
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 ( )

Definition at line 45 of file StripCompactDigiSimLinksProducer.cc.

46 {
47 }

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 50 of file StripCompactDigiSimLinksProducer.cc.

References edm::DetSet< T >::begin(), dtNoiseDBValidation_cfg::cerr, DEBUG, DEFINE_FWK_MODULE, edm::DetSet< T >::detId(), edm::DetSet< T >::end(), spr::find(), edm::Event::getByLabel(), relval_steps::key, maxHoleSize_, convertSQLitetoXML_cfg::output, edm::Event::put(), edm::DetSet< T >::size(), findQualityFiles::size, alcazmumu_cfi::src, src_, and 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::auto_ptr< StripCompactDigiSimLinks > ptr(new StripCompactDigiSimLinks(output));
119  iEvent.put(ptr);
120 }
iterator end()
Definition: DetSet.h:60
void swap(ora::Record &rh, ora::Record &lh)
Definition: Record.h:70
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:7
size_type size() const
Definition: DetSet.h:63
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
iterator begin()
Definition: DetSet.h:59
tuple size
Write out results.

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().