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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, 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
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
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 wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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)
 

Detailed Description

Definition at line 22 of file DTTPGParamsWriter.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 27 of file DTTPGParamsWriter.cc.

References gather_cfg::cout, and edm::ParameterSet::getUntrackedParameter().

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

Destructor.

Definition at line 39 of file DTTPGParamsWriter.cc.

References gather_cfg::cout.

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

Member Function Documentation

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

Compute the ttrig by fiting the TB rising edge.

Definition at line 46 of file DTTPGParamsWriter.cc.

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

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

Write ttrig in the DB.

Reimplemented from edm::EDAnalyzer.

Definition at line 107 of file DTTPGParamsWriter.cc.

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

107  {
108  if (debug_)
109  cout << "[DTTPGParamsWriter] Writing ttrig object to DB!" << endl;
110 
111  string delayRecord = "DTTPGParametersRcd";
112  DTCalibDBUtils::writeToDB(delayRecord, phaseMap_);
113 }
DTTPGParameters * phaseMap_
static void writeToDB(std::string record, T *payload)
void DTTPGParamsWriter::pharseLine ( std::string &  line,
DTChamberId chId,
float &  fine,
int &  coarse 
)
private

Definition at line 86 of file DTTPGParamsWriter.cc.

References gather_cfg::cout, allElectronIsolations_cfi::elements, and split.

87  {
88 
89  std::vector<std::string> elements;
91  elements, line,
92  boost::algorithm::is_any_of(
93  string(" \t\n"))); // making string conversion explicit (needed to
94  // cope with -Warray-bounds in slc5_ia32_gcc434
95  if (elements.size() != 5) {
96  std::cout << "[DTTPGParamsWriter] wrong number of entries in line : "
97  << line << " pleas check your input file syntax!" << std::endl;
98  } else {
99  chId = DTChamberId(atoi(elements[0].c_str()), atoi(elements[1].c_str()),
100  atoi(elements[2].c_str()));
101  fine = atof(elements[3].c_str());
102  coarse = atoi(elements[4].c_str());
103  }
104 }
double split
Definition: MVATrainer.cc:139

Member Data Documentation

bool DTTPGParamsWriter::debug_
private

Definition at line 43 of file DTTPGParamsWriter.h.

std::string DTTPGParamsWriter::inputFileName_
private

Definition at line 44 of file DTTPGParamsWriter.h.

DTTPGParameters* DTTPGParamsWriter::phaseMap_
private

Definition at line 45 of file DTTPGParamsWriter.h.