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::EDAnalyzer 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::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices 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::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

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.

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 }

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

◆ ~DTTPGParamsWriter()

DTTPGParamsWriter::~DTTPGParamsWriter ( )
override

Destructor.

Definition at line 38 of file DTTPGParamsWriter.cc.

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

References gather_cfg::cout.

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::EDAnalyzer.

Definition at line 44 of file DTTPGParamsWriter.cc.

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 }

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

◆ endJob()

void DTTPGParamsWriter::endJob ( void  )
overridevirtual

Write ttrig in the DB.

Reimplemented from edm::EDAnalyzer.

Definition at line 95 of file DTTPGParamsWriter.cc.

95  {
96  if (debug_)
97  cout << "[DTTPGParamsWriter] Writing ttrig object to DB!" << endl;
98 
99  string delayRecord = "DTTPGParametersRcd";
100  DTCalibDBUtils::writeToDB(delayRecord, phaseMap_);
101 }

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

◆ pharseLine()

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

Definition at line 77 of file DTTPGParamsWriter.cc.

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 }

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

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.

DTTPGParameters::set
int set(int wheelId, int stationId, int sectorId, int nc, float ph, DTTimeUnits::type unit)
Definition: DTTPGParameters.cc:123
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DTTPGParamsWriter::inputFileName_
std::string inputFileName_
Definition: DTTPGParamsWriter.h:42
submitDQMOfflineCAF.nLines
nLines
Definition: submitDQMOfflineCAF.py:676
DTTPGParameters::get
int get(int wheelId, int stationId, int sectorId, int &nc, float &ph, DTTimeUnits::type unit) const
get content
Definition: DTTPGParameters.cc:68
submitPVValidationJobs.split
def split(sequence, size)
Definition: submitPVValidationJobs.py:352
DTTimeUnits::ns
Definition: DTTimeUnits.h:32
DTTPGParamsWriter::pharseLine
void pharseLine(std::string &line, DTChamberId &chId, float &fine, int &coarse)
Definition: DTTPGParamsWriter.cc:77
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DTTPGParamsWriter::phaseMap_
DTTPGParameters * phaseMap_
Definition: DTTPGParamsWriter.h:43
bookConverter.elements
elements
Definition: bookConverter.py:147
L1DTConfigParams_cff.DTTPGParameters
DTTPGParameters
Definition: L1DTConfigParams_cff.py:12
DTChamberId
Definition: DTChamberId.h:14
mps_splice.line
line
Definition: mps_splice.py:76
DTTPGParamsWriter::debug_
bool debug_
Definition: DTTPGParamsWriter.h:41
DTCalibDBUtils::writeToDB
static void writeToDB(std::string record, T *payload)
Definition: DTCalibDBUtils.h:28
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27