CMS 3D CMS Logo

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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Member Functions

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

Private Attributes

edm::Handle< DTDigiCollectionDTDigiHandle
 
edm::EDGetTokenT< DTDigiCollectiondtDigisToken
 
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<>
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

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 60 of file CalibratedDigis.cc.

Constructor & Destructor Documentation

◆ CalibratedDigis()

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

Definition at line 87 of file CalibratedDigis.cc.

87  {
88  //register your products
89  dtDigiTag = iConfig.getParameter<InputTag>("dtDigiTag");
90  dtDigisToken = consumes<DTDigiCollection>(dtDigiTag);
91 
92  theSync = DTTTrigSyncFactory::get()->create(iConfig.getParameter<string>("tTrigMode"),
93  iConfig.getParameter<ParameterSet>("tTrigModeConfig"));
94 
95  flat_calib_ = iConfig.getParameter<int>("flat_calib");
96  timeOffset_ = iConfig.getParameter<int>("timeOffset");
97 
98  scenario = iConfig.getUntrackedParameter<int>("scenario");
99 
100  produces<DTDigiCollection>();
101  //now do what ever other initialization is needed
102 }

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

◆ ~CalibratedDigis()

CalibratedDigis::~CalibratedDigis ( )
override

Definition at line 104 of file CalibratedDigis.cc.

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

Member Function Documentation

◆ produce()

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

Definition at line 114 of file CalibratedDigis.cc.

114  {
115  using namespace edm;
116  theSync->setES(iSetup);
117  iEvent.getByToken(dtDigisToken, DTDigiHandle);
118  DTDigiCollection mydigis;
119 
120  for (const auto& dtLayerIt : *DTDigiHandle) {
121  const DTLayerId& layerId = dtLayerIt.first;
122  for (DTDigiCollection::const_iterator digiIt = dtLayerIt.second.first; digiIt != dtLayerIt.second.second;
123  ++digiIt) {
124  DTWireId wireId(layerId, (*digiIt).wire());
125  float digiTime = (*digiIt).time();
126  int wire = (*digiIt).wire();
127  int number = (*digiIt).number();
128  float newTime = 0;
129  if (flat_calib_ != 0)
130  newTime = digiTime - flatcalib + bxspacing * iEvent.eventAuxiliary().bunchCrossing() + float(timeOffset_);
131  else {
132  if (scenario == MC) //FIX MC
133  newTime = digiTime + bxspacing * timeshift;
134  else if (scenario == SLICE_TEST) //FIX SliceTest
135  newTime = digiTime;
136  else
137  newTime = digiTime - theSync->offset(wireId) + bxspacing * iEvent.eventAuxiliary().bunchCrossing() +
139  }
140  DTDigi newDigi(wire, newTime, number);
141  mydigis.insertDigi(layerId, newDigi);
142  }
143  }
144  auto CorrectedDTDigiCollection = std::make_unique<DTDigiCollection>(mydigis);
145  iEvent.put(std::move(CorrectedDTDigiCollection));
146 }

References dqmMemoryStats::float, iEvent, cmsdt::MC, eostools::move(), contentValuesFiles::number, cmsdt::SLICE_TEST, and DTWireId::wire().

Member Data Documentation

◆ bxspacing

constexpr float CalibratedDigis::bxspacing = 25.0
staticconstexprprivate

Definition at line 79 of file CalibratedDigis.cc.

◆ DTDigiHandle

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

Definition at line 76 of file CalibratedDigis.cc.

◆ dtDigisToken

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

Definition at line 75 of file CalibratedDigis.cc.

◆ dtDigiTag

edm::InputTag CalibratedDigis::dtDigiTag
private

Definition at line 77 of file CalibratedDigis.cc.

◆ flat_calib_

int CalibratedDigis::flat_calib_
private

Definition at line 67 of file CalibratedDigis.cc.

◆ flatcalib

constexpr float CalibratedDigis::flatcalib = 325.0
staticconstexprprivate

Definition at line 81 of file CalibratedDigis.cc.

◆ scenario

int CalibratedDigis::scenario
private

Definition at line 68 of file CalibratedDigis.cc.

Referenced by validation.Sample::digest().

◆ theSync

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

Definition at line 72 of file CalibratedDigis.cc.

◆ timeOffset_

int CalibratedDigis::timeOffset_
private

Definition at line 66 of file CalibratedDigis.cc.

◆ timeshift

constexpr float CalibratedDigis::timeshift = 400.0
staticconstexprprivate

Definition at line 80 of file CalibratedDigis.cc.

DTWireId::wire
int wire() const
Return the wire number.
Definition: DTWireId.h:42
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
CalibratedDigis::timeshift
static constexpr float timeshift
Definition: CalibratedDigis.cc:80
CalibratedDigis::dtDigiTag
edm::InputTag dtDigiTag
Definition: CalibratedDigis.cc:77
edm
HLT enums.
Definition: AlignableModifier.h:19
CalibratedDigis::flat_calib_
int flat_calib_
Definition: CalibratedDigis.cc:67
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
CalibratedDigis::timeOffset_
int timeOffset_
Definition: CalibratedDigis.cc:66
MuonDigiCollection::const_iterator
std::vector< DigiType >::const_iterator const_iterator
Definition: MuonDigiCollection.h:94
CalibratedDigis::DTDigiHandle
edm::Handle< DTDigiCollection > DTDigiHandle
Definition: CalibratedDigis.cc:76
contentValuesFiles.number
number
Definition: contentValuesFiles.py:53
DTWireId
Definition: DTWireId.h:12
cmsdt::scenario
scenario
Definition: constants.h:166
DTLayerId
Definition: DTLayerId.h:12
edm::ParameterSet
Definition: ParameterSet.h:47
cmsdt::SLICE_TEST
Definition: constants.h:166
DTDigiCollection
iEvent
int iEvent
Definition: GenABIO.cc:224
cmsdt::MC
Definition: constants.h:166
get
#define get
CalibratedDigis::bxspacing
static constexpr float bxspacing
Definition: CalibratedDigis.cc:79
eostools.move
def move(src, dest)
Definition: eostools.py:511
CalibratedDigis::flatcalib
static constexpr float flatcalib
Definition: CalibratedDigis.cc:81
DTDigi
Definition: DTDigi.h:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CalibratedDigis::dtDigisToken
edm::EDGetTokenT< DTDigiCollection > dtDigisToken
Definition: CalibratedDigis.cc:75
edm::InputTag
Definition: InputTag.h:15
CalibratedDigis::theSync
std::unique_ptr< DTTTrigBaseSync > theSync
Definition: CalibratedDigis.cc:72