CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
DeDxCalibrationDbCreator Class Reference
Inheritance diagram for DeDxCalibrationDbCreator:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Types

enum  AllDetector {
  PXB = 0, PXF = 1, TIB = 2, TID = 3,
  TOB = 4, TECThin = 5, TECThick = 6, nDets
}
 
typedef std::pair< uint32_t, unsigned char > ChipId
 
- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 DeDxCalibrationDbCreator (const edm::ParameterSet &)
 
 ~DeDxCalibrationDbCreator () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept 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 noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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 analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void readGainCorrection (std::map< ChipId, float > &)
 
void readStripProps (std::vector< double > &, std::vector< double > &, std::vector< double > &)
 

Private Attributes

const std::string gainFile_
 
const std::string propFile_
 

Additional Inherited Members

- 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 14 of file DeDxCalibrationDbCreator.cc.

Member Typedef Documentation

◆ ChipId

typedef std::pair<uint32_t, unsigned char> DeDxCalibrationDbCreator::ChipId

Definition at line 16 of file DeDxCalibrationDbCreator.cc.

Member Enumeration Documentation

◆ AllDetector

Constructor & Destructor Documentation

◆ DeDxCalibrationDbCreator()

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

Definition at line 32 of file DeDxCalibrationDbCreator.cc.

33  : propFile_(iConfig.getParameter<std::string>("propFile")),
34  gainFile_(iConfig.getParameter<std::string>("gainFile")) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:307

◆ ~DeDxCalibrationDbCreator()

DeDxCalibrationDbCreator::~DeDxCalibrationDbCreator ( )
inlineoverride

Definition at line 20 of file DeDxCalibrationDbCreator.cc.

20 {}

Member Function Documentation

◆ analyze()

void DeDxCalibrationDbCreator::analyze ( const edm::Event ,
const edm::EventSetup  
)
inlineoverrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 24 of file DeDxCalibrationDbCreator.cc.

24 {}

◆ beginJob()

void DeDxCalibrationDbCreator::beginJob ( )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 36 of file DeDxCalibrationDbCreator.cc.

References isotrackApplyRegressor::alpha, Hcal_Conditions_forGlobalTag_cff::gain, submitPVResolutionJobs::pool, readGainCorrection(), and readStripProps().

36  {
37  std::map<ChipId, float> gain;
38  std::vector<double> thr, alpha, sigma;
39  readStripProps(thr, alpha, sigma);
41  DeDxCalibration TD(thr, alpha, sigma, gain);
42 
44  if (pool.isAvailable())
45  pool->writeOneIOV(TD, pool->beginOfTime(), "DeDxCalibrationRcd");
46 }
void readGainCorrection(std::map< ChipId, float > &)
void readStripProps(std::vector< double > &, std::vector< double > &, std::vector< double > &)

◆ readGainCorrection()

void DeDxCalibrationDbCreator::readGainCorrection ( std::map< ChipId, float > &  gain)
private

Definition at line 82 of file DeDxCalibrationDbCreator.cc.

References gather_cfg::cout, ztail::d, TauDecayModes::dec, hcalRecHitTable_cff::detId, f, contentValuesFiles::fullPath, g, Hcal_Conditions_forGlobalTag_cff::gain, gainFile_, mps_fire::i, alignCSCRings::s, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by beginJob().

82  {
83  std::cout << " reading gain from " << gainFile_;
84  std::ifstream fileGain(edm::FileInPath(gainFile_).fullPath());
85 
86  int i = 0;
87  while (!fileGain.eof()) {
88  uint32_t det;
89  int chip;
90 
91  int d;
92  float g, f;
93  std::string s;
94 
95  fileGain >> std::hex >> det;
96  fileGain >> std::dec >> chip;
97 
98  ChipId detId(det, (unsigned char)chip);
99 
100  fileGain >> std::dec >> d;
101  fileGain >> g;
102  fileGain >> f;
103  fileGain >> s;
104 
105  if (!fileGain.eof()) {
106  if (g > 0.5 && g < 2.0)
107  gain[detId] = g;
108  else
109  gain[detId] = -1.;
110  }
111 
112  if (i++ % 5000 == 0)
113  std::cout << ".";
114  }
115 
116  fileGain.close();
117  std::cout << " [done]" << std::endl;
118 }
std::pair< uint32_t, unsigned char > ChipId
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
double f[11][100]
d
Definition: ztail.py:151

◆ readStripProps()

void DeDxCalibrationDbCreator::readStripProps ( std::vector< double > &  thr,
std::vector< double > &  alpha,
std::vector< double > &  sigma 
)
private

Definition at line 49 of file DeDxCalibrationDbCreator.cc.

References isotrackApplyRegressor::alpha, gather_cfg::cout, f, geometryDiff::file, contentValuesFiles::fullPath, propFile_, PXB, PXF, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by beginJob().

51  {
52  std::cout << " reading strip properties from " << propFile_;
53  std::ifstream file(edm::FileInPath(propFile_).fullPath());
54 
55  int det;
56  for (det = PXB; det <= PXF; det++) {
57  thr.emplace_back(0.);
58  alpha.emplace_back(0.);
59  sigma.emplace_back(0.);
60  }
61 
62  while (!file.eof()) {
63  std::string detName;
64  float f;
65 
66  file >> detName;
67  file >> f;
68  thr.emplace_back(f);
69  file >> f;
70  alpha.emplace_back(f);
71  file >> f;
72  sigma.emplace_back(f);
73 
74  det++;
75  }
76 
77  file.close();
78  std::cout << " [done]" << std::endl;
79 }
double f[11][100]

Member Data Documentation

◆ gainFile_

const std::string DeDxCalibrationDbCreator::gainFile_
private

Definition at line 29 of file DeDxCalibrationDbCreator.cc.

Referenced by readGainCorrection().

◆ propFile_

const std::string DeDxCalibrationDbCreator::propFile_
private

Definition at line 29 of file DeDxCalibrationDbCreator.cc.

Referenced by readStripProps().