CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
BunchSpacingProducer Class Reference
Inheritance diagram for BunchSpacingProducer:
edm::stream::EDProducer<>

Public Member Functions

 BunchSpacingProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) final
 
 ~BunchSpacingProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 

Private Attributes

edm::EDGetTokenT< int > bunchSpacing_
 
unsigned int bunchSpacingOverride_
 
bool overRide_
 

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, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 18 of file BunchSpacingProducer.cc.

Constructor & Destructor Documentation

BunchSpacingProducer::BunchSpacingProducer ( const edm::ParameterSet )
explicit
BunchSpacingProducer::~BunchSpacingProducer ( )
override

Definition at line 57 of file BunchSpacingProducer.cc.

57  {
58 }

Member Function Documentation

void BunchSpacingProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 96 of file BunchSpacingProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and DEFINE_FWK_MODULE.

97 {
99  desc.add<bool>("overrideBunchSpacing",false); // true for prompt reco
100  desc.add<unsigned int>("bunchSpacingOverride",25); // override value
101 
102  descriptions.add("bunchSpacingProducer",desc) ;
103 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void BunchSpacingProducer::produce ( edm::Event e,
const edm::EventSetup iSetup 
)
final

Definition at line 63 of file BunchSpacingProducer.cc.

References edm::Event::getByToken(), edm::EventBase::isRealData(), edm::Event::put(), writedatasetfile::run, and edm::Event::run().

64 {
65  if ( overRide_ ) {
66  e.put(std::make_unique<unsigned int>(bunchSpacingOverride_));
67  return;
68  }
69 
70  unsigned int bunchSpacing=50;
71  unsigned int run=e.run();
72 
73  if ( e.isRealData()) {
74  if ( ( run > 252126 && run != 254833 )||
75  run == 178003 ||
76  run == 178004 ||
77  run == 209089 ||
78  run == 209106 ||
79  run == 209109 ||
80  run == 209146 ||
81  run == 209148 ||
82  run == 209151) {
83  bunchSpacing = 25;
84  }
85  }
86  else{
87  edm::Handle<int> bunchSpacingH;
88  e.getByToken(bunchSpacing_,bunchSpacingH);
89  bunchSpacing = *bunchSpacingH;
90  }
91 
92  e.put(std::make_unique<unsigned int>(bunchSpacing));
93  return;
94 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
unsigned int bunchSpacingOverride_
bool isRealData() const
Definition: EventBase.h:62
edm::EDGetTokenT< int > bunchSpacing_
RunNumber_t run() const
Definition: Event.h:101

Member Data Documentation

edm::EDGetTokenT<int> BunchSpacingProducer::bunchSpacing_
private

Definition at line 32 of file BunchSpacingProducer.cc.

unsigned int BunchSpacingProducer::bunchSpacingOverride_
private

Definition at line 33 of file BunchSpacingProducer.cc.

bool BunchSpacingProducer::overRide_
private

Definition at line 34 of file BunchSpacingProducer.cc.