CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
DTTPGParamsWriter Class Reference

#include <DTTPGParamsWriter.h>

Inheritance diagram for DTTPGParamsWriter:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup) override
 Compute the ttrig by fiting the TB rising edge. More...
 
 DTTPGParamsWriter (const edm::ParameterSet &pset)
 Constructor. More...
 
void endJob () override
 Write ttrig in the DB. More...
 
 ~DTTPGParamsWriter () override
 Destructor. More...
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void pharseLine (std::string &line, DTChamberId &chId, float &fine, int &coarse)
 

Private Attributes

bool debug_
 
std::string inputFileName_
 
DTTPGParametersphaseMap_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
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)
 
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 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 22 of file DTTPGParamsWriter.h.

Constructor & Destructor Documentation

◆ DTTPGParamsWriter()

DTTPGParamsWriter::DTTPGParamsWriter ( const edm::ParameterSet pset)

Constructor.

Definition at line 27 of file DTTPGParamsWriter.cc.

References gather_cfg::cout, L1DTConfigParams_cff::DTTPGParameters, and muonDTDigis_cfi::pset.

27  {
28  debug_ = pset.getUntrackedParameter<bool>("debug", false);
29  inputFileName_ = pset.getUntrackedParameter<string>("inputFile");
30  // Create the object to be written to DB
31  phaseMap_ = new DTTPGParameters();
32 
33  if (debug_)
34  cout << "[DTTPGParamsWriter]Constructor called!" << endl;
35 }
DTTPGParameters * phaseMap_
std::string inputFileName_

◆ ~DTTPGParamsWriter()

DTTPGParamsWriter::~DTTPGParamsWriter ( )
override

Destructor.

Definition at line 38 of file DTTPGParamsWriter.cc.

References gather_cfg::cout.

38  {
39  if (debug_)
40  cout << "[DTTPGParamsWriter]Destructor called!" << endl;
41 }

Member Function Documentation

◆ analyze()

void DTTPGParamsWriter::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)
overridevirtual

Compute the ttrig by fiting the TB rising edge.

Implements edm::one::EDAnalyzerBase.

Definition at line 44 of file DTTPGParamsWriter.cc.

References gather_cfg::cout, mps_splice::line, submitDQMOfflineCAF::nLines, DTTimeUnits::ns, and AlCaHLTBitMon_QueryRunRegistry::string.

44  {
45  if (debug_)
46  cout << "[DTTPGParamsWriter]Reading data from file." << endl;
47 
48  std::ifstream inputFile_(inputFileName_.c_str());
49  int nLines = 0;
51 
52  while (std::getline(inputFile_, line)) {
53  DTChamberId chId;
54  float fine = 0.;
55  int coarse = 0;
56  pharseLine(line, chId, fine, coarse);
57  phaseMap_->set(chId, coarse, fine, DTTimeUnits::ns);
58  if (debug_) {
59  float fineDB = 0.;
60  int coarseDB = 0;
61  phaseMap_->get(chId, coarseDB, fineDB, DTTimeUnits::ns);
62  std::cout << "[DTTPGParamsWriter] Read data for chamber " << chId << ". File params -> fine: " << fine
63  << " coarse: " << coarse << ". DB params -> fine: " << fineDB << " coarse: " << coarseDB << std::endl;
64  }
65  nLines++;
66  }
67  if (debug_) {
68  std::cout << "[DTTPGParamsWriter] # of entries written the the DB: " << nLines << std::endl;
69  }
70  if (nLines != 250) {
71  std::cout << "[DTTPGParamsWriter] # of DB entries != 250. Check you input file!" << std::endl;
72  }
73 
74  inputFile_.close();
75 }
int set(int wheelId, int stationId, int sectorId, int nc, float ph, DTTimeUnits::type unit)
DTTPGParameters * phaseMap_
void pharseLine(std::string &line, DTChamberId &chId, float &fine, int &coarse)
int get(int wheelId, int stationId, int sectorId, int &nc, float &ph, DTTimeUnits::type unit) const
get content
std::string inputFileName_

◆ endJob()

void DTTPGParamsWriter::endJob ( void  )
overridevirtual

Write ttrig in the DB.

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 95 of file DTTPGParamsWriter.cc.

References gather_cfg::cout, and DTCalibDBUtils::writeToDB().

95  {
96  if (debug_)
97  cout << "[DTTPGParamsWriter] Writing ttrig object to DB!" << endl;
98 
99  string delayRecord = "DTTPGParametersRcd";
100  DTCalibDBUtils::writeToDB(delayRecord, phaseMap_);
101 }
static void writeToDB(std::string record, const T &payload)
DTTPGParameters * phaseMap_

◆ pharseLine()

void DTTPGParamsWriter::pharseLine ( std::string &  line,
DTChamberId chId,
float &  fine,
int &  coarse 
)
private

Definition at line 77 of file DTTPGParamsWriter.cc.

References gather_cfg::cout, bookConverter::elements, mps_splice::line, and submitPVValidationJobs::split().

77  {
78  std::vector<std::string> elements;
80  elements,
81  line,
82  boost::algorithm::is_any_of(string(" \t\n"))); // making string conversion explicit (needed to
83  // cope with -Warray-bounds in slc5_ia32_gcc434
84  if (elements.size() != 5) {
85  std::cout << "[DTTPGParamsWriter] wrong number of entries in line : " << line
86  << " pleas check your input file syntax!" << std::endl;
87  } else {
88  chId = DTChamberId(atoi(elements[0].c_str()), atoi(elements[1].c_str()), atoi(elements[2].c_str()));
89  fine = atof(elements[3].c_str());
90  coarse = atoi(elements[4].c_str());
91  }
92 }

Member Data Documentation

◆ debug_

bool DTTPGParamsWriter::debug_
private

Definition at line 41 of file DTTPGParamsWriter.h.

◆ inputFileName_

std::string DTTPGParamsWriter::inputFileName_
private

Definition at line 42 of file DTTPGParamsWriter.h.

◆ phaseMap_

DTTPGParameters* DTTPGParamsWriter::phaseMap_
private

Definition at line 43 of file DTTPGParamsWriter.h.