CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
CalibratedDigis Class Reference

#include <UserCode/CalibratedDigis/plugins/CalibratedDigis.cc>

Inheritance diagram for CalibratedDigis:
edm::stream::EDProducer<>

Public Member Functions

 CalibratedDigis (const edm::ParameterSet &)
 
 ~CalibratedDigis () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
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
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::Handle< DTDigiCollectionDTDigiHandle
 
edm::EDGetTokenT
< DTDigiCollection
dtDigisToken
 
edm::InputTag dtDigiTag
 
int flat_calib_
 
int scenario
 
std::unique_ptr< DTTTrigBaseSynctheSync
 
int timeOffset_
 

Static Private Attributes

static constexpr float bxspacing = 25.0
 
static constexpr float flatcalib = 325.0
 
static constexpr float timeshift = 400.0
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 61 of file CalibratedDigis.cc.

Constructor & Destructor Documentation

CalibratedDigis::CalibratedDigis ( const edm::ParameterSet iConfig)
explicit

Definition at line 88 of file CalibratedDigis.cc.

References get, edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

88  {
89  //register your products
90  dtDigiTag = iConfig.getParameter<InputTag>("dtDigiTag");
91  dtDigisToken = consumes<DTDigiCollection>(dtDigiTag);
92 
93  theSync = DTTTrigSyncFactory::get()->create(iConfig.getParameter<string>("tTrigMode"),
94  iConfig.getParameter<ParameterSet>("tTrigModeConfig"),
95  consumesCollector());
96 
97  flat_calib_ = iConfig.getParameter<int>("flat_calib");
98  timeOffset_ = iConfig.getParameter<int>("timeOffset");
99 
100  scenario = iConfig.getUntrackedParameter<int>("scenario");
101 
102  produces<DTDigiCollection>();
103  //now do what ever other initialization is needed
104 }
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< DTTTrigBaseSync > theSync
edm::EDGetTokenT< DTDigiCollection > dtDigisToken
scenario
Definition: constants.h:173
edm::InputTag dtDigiTag
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
#define get
CalibratedDigis::~CalibratedDigis ( )
override

Definition at line 106 of file CalibratedDigis.cc.

106  {
107  // do anything here that needs to be done at destruction time
108  // (e.g. close files, deallocate resources etc.)
109 }

Member Function Documentation

void CalibratedDigis::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 116 of file CalibratedDigis.cc.

References edm::EventAuxiliary::bunchCrossing(), edm::Event::eventAuxiliary(), edm::Event::getByToken(), cmsdt::MC, eostools::move(), contentValuesFiles::number, edm::Event::put(), cmsdt::SLICE_TEST, and DTWireId::wire().

116  {
117  using namespace edm;
118  theSync->setES(iSetup);
120  DTDigiCollection mydigis;
121 
122  for (const auto& dtLayerIt : *DTDigiHandle) {
123  const DTLayerId& layerId = dtLayerIt.first;
124  for (DTDigiCollection::const_iterator digiIt = dtLayerIt.second.first; digiIt != dtLayerIt.second.second;
125  ++digiIt) {
126  DTWireId wireId(layerId, (*digiIt).wire());
127  float digiTime = (*digiIt).time();
128  int wire = (*digiIt).wire();
129  int number = (*digiIt).number();
130  float newTime = 0;
131  if (flat_calib_ != 0)
132  newTime = digiTime - flatcalib + bxspacing * iEvent.eventAuxiliary().bunchCrossing() + float(timeOffset_);
133  else {
134  if (scenario == MC) //FIX MC
135  newTime = digiTime + bxspacing * timeshift;
136  else if (scenario == SLICE_TEST) //FIX SliceTest
137  newTime = digiTime;
138  else
139  newTime = digiTime - theSync->offset(wireId) + bxspacing * iEvent.eventAuxiliary().bunchCrossing() +
140  float(timeOffset_);
141  }
142  DTDigi newDigi(wire, newTime, number);
143  mydigis.insertDigi(layerId, newDigi);
144  }
145  }
146  auto CorrectedDTDigiCollection = std::make_unique<DTDigiCollection>(mydigis);
147  iEvent.put(std::move(CorrectedDTDigiCollection));
148 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
std::unique_ptr< DTTTrigBaseSync > theSync
EventAuxiliary const & eventAuxiliary() const override
Definition: Event.h:95
edm::EDGetTokenT< DTDigiCollection > dtDigisToken
int bunchCrossing() const
scenario
Definition: constants.h:173
def move
Definition: eostools.py:511
static constexpr float bxspacing
edm::Handle< DTDigiCollection > DTDigiHandle
Definition: DTDigi.h:17
int wire() const
Return the wire number.
Definition: DTWireId.h:42
static constexpr float timeshift
std::vector< DigiType >::const_iterator const_iterator
static constexpr float flatcalib

Member Data Documentation

constexpr float CalibratedDigis::bxspacing = 25.0
staticprivate

Definition at line 80 of file CalibratedDigis.cc.

edm::Handle<DTDigiCollection> CalibratedDigis::DTDigiHandle
private

Definition at line 77 of file CalibratedDigis.cc.

edm::EDGetTokenT<DTDigiCollection> CalibratedDigis::dtDigisToken
private

Definition at line 76 of file CalibratedDigis.cc.

edm::InputTag CalibratedDigis::dtDigiTag
private

Definition at line 78 of file CalibratedDigis.cc.

int CalibratedDigis::flat_calib_
private

Definition at line 68 of file CalibratedDigis.cc.

constexpr float CalibratedDigis::flatcalib = 325.0
staticprivate

Definition at line 82 of file CalibratedDigis.cc.

int CalibratedDigis::scenario
private

Definition at line 69 of file CalibratedDigis.cc.

Referenced by validation.Sample::digest().

std::unique_ptr<DTTTrigBaseSync> CalibratedDigis::theSync
private

Definition at line 73 of file CalibratedDigis.cc.

int CalibratedDigis::timeOffset_
private

Definition at line 67 of file CalibratedDigis.cc.

constexpr float CalibratedDigis::timeshift = 400.0
staticprivate

Definition at line 81 of file CalibratedDigis.cc.