CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 Compute the ttrig by fiting the TB rising edge. More...
 
 DTTPGParamsWriter (const edm::ParameterSet &pset)
 Constructor. More...
 
void endJob ()
 Write ttrig in the DB. More...
 
virtual ~DTTPGParamsWriter ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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 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 25 of file DTTPGParamsWriter.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 30 of file DTTPGParamsWriter.cc.

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

30  {
31 
32  debug_ = pset.getUntrackedParameter<bool>("debug", false);
33  inputFileName_ = pset.getUntrackedParameter<string>("inputFile");
34  // Create the object to be written to DB
35  phaseMap_ = new DTTPGParameters();
36 
37  if(debug_)
38  cout << "[DTTPGParamsWriter]Constructor called!" << endl;
39 
40 }
T getUntrackedParameter(std::string const &, T const &) const
DTTPGParameters * phaseMap_
std::string inputFileName_
tuple cout
Definition: gather_cfg.py:121
DTTPGParamsWriter::~DTTPGParamsWriter ( )
virtual

Destructor.

Definition at line 45 of file DTTPGParamsWriter.cc.

References gather_cfg::cout.

45  {
46 
47  if(debug_)
48  cout << "[DTTPGParamsWriter]Destructor called!" << endl;
49 
50 }
tuple cout
Definition: gather_cfg.py:121

Member Function Documentation

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

Compute the ttrig by fiting the TB rising edge.

Implements edm::EDAnalyzer.

Definition at line 53 of file DTTPGParamsWriter.cc.

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

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

Write ttrig in the DB.

Reimplemented from edm::EDAnalyzer.

Definition at line 106 of file DTTPGParamsWriter.cc.

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

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

Definition at line 91 of file DTTPGParamsWriter.cc.

References gather_cfg::cout, DTChamberId, asciidump::elements, and split.

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

Member Data Documentation

bool DTTPGParamsWriter::debug_
private

Definition at line 45 of file DTTPGParamsWriter.h.

std::string DTTPGParamsWriter::inputFileName_
private

Definition at line 46 of file DTTPGParamsWriter.h.

DTTPGParameters* DTTPGParamsWriter::phaseMap_
private

Definition at line 47 of file DTTPGParamsWriter.h.