CMS 3D CMS Logo

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

#include <SiStripGainRandomCalculator.h>

Inheritance diagram for SiStripGainRandomCalculator:
ConditionDBWriter< SiStripApvGain > edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 SiStripGainRandomCalculator (const edm::ParameterSet &)
 
 ~SiStripGainRandomCalculator () override
 
- Public Member Functions inherited from ConditionDBWriter< SiStripApvGain >
 ConditionDBWriter (const edm::ParameterSet &iConfig)
 
 ~ConditionDBWriter () override
 
- 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
 
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 algoAnalyze (const edm::Event &, const edm::EventSetup &) override
 
std::unique_ptr< SiStripApvGaingetNewObject () override
 

Private Attributes

std::vector< std::pair< uint32_t, unsigned short > > detid_apvs_
 
double meanGain_
 
double minimumPosValue_
 
bool printdebug_
 
double sigmaGain_
 
edm::ESWatcher< TrackerDigiGeometryRecordtkDigiGeomRcdWatcher_
 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtkGeomToken_
 

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 ConditionDBWriter< SiStripApvGain >
void setDoStore (const bool doStore)
 When set to false the payload will not be written to the db. More...
 
void storeOnDbNow ()
 
cond::Time_t timeOfLastIOV ()
 
- 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 31 of file SiStripGainRandomCalculator.h.

Constructor & Destructor Documentation

◆ SiStripGainRandomCalculator()

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

Definition at line 20 of file SiStripGainRandomCalculator.cc.

22  edm::LogInfo("SiStripGainRandomCalculator::SiStripGainRandomCalculator");
23 
24  // std::string Mode=iConfig.getParameter<std::string>("Mode");
25  // if (Mode==std::string("Gaussian")) GaussianMode_=true;
26  // else if (IOVMode==std::string("Constant")) ConstantMode_=true;
27  // else edm::LogError("SiStripGainRandomCalculator::SiStripGainRandomCalculator(): ERROR - unknown generation mode...will not store anything on the DB") << std::endl;
28 
29  detid_apvs_.clear();
30 
31  meanGain_ = iConfig.getParameter<double>("MeanGain");
32  sigmaGain_ = iConfig.getParameter<double>("SigmaGain");
33  minimumPosValue_ = iConfig.getParameter<double>("MinPositiveGain");
34  printdebug_ = iConfig.getUntrackedParameter<bool>("printDebug", false);
35 
37 }

References detid_apvs_, edm::EDConsumerBase::esConsumes(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), meanGain_, minimumPosValue_, printdebug_, sigmaGain_, and tkGeomToken_.

◆ ~SiStripGainRandomCalculator()

SiStripGainRandomCalculator::~SiStripGainRandomCalculator ( )
override

Definition at line 39 of file SiStripGainRandomCalculator.cc.

39  {
40  edm::LogInfo("SiStripGainRandomCalculator::~SiStripGainRandomCalculator");
41 }

Member Function Documentation

◆ algoAnalyze()

void SiStripGainRandomCalculator::algoAnalyze ( const edm::Event event,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from ConditionDBWriter< SiStripApvGain >.

Definition at line 43 of file SiStripGainRandomCalculator.cc.

43  {
44  if (tkDigiGeomRcdWatcher_.check(iSetup)) {
45  const auto& dd = iSetup.getData(tkGeomToken_);
46  edm::LogInfo("SiStripGainRandomCalculator::algoAnalyze - got new geometry ") << std::endl;
47 
48  detid_apvs_.clear();
49 
50  edm::LogInfo("SiStripGainCalculator") << " There are " << dd.detUnits().size() << " detectors" << std::endl;
51 
52  for (const auto& it : dd.detUnits()) {
53  if (dynamic_cast<const StripGeomDetUnit*>(it) != nullptr) {
54  uint32_t detid = (it->geographicalId()).rawId();
55  const StripTopology& p = dynamic_cast<const StripGeomDetUnit*>(it)->specificTopology();
56  unsigned short NAPVs = p.nstrips() / 128;
57  if (NAPVs < 1 || NAPVs > 6) {
58  edm::LogError("SiStripGainCalculator")
59  << " Problem with Number of strips in detector.. " << p.nstrips() << " Exiting program" << endl;
60  exit(1);
61  }
62  detid_apvs_.push_back(pair<uint32_t, unsigned short>(detid, NAPVs));
63  if (printdebug_)
64  edm::LogInfo("SiStripGainCalculator") << "detid " << detid << " apvs " << NAPVs;
65  }
66  }
67  }
68 }

References edm::ESWatcher< T >::check(), createTree::dd, detid_apvs_, beamvalidation::exit(), edm::EventSetup::getData(), AlCaHLTBitMon_ParallelJobs::p, printdebug_, tkDigiGeomRcdWatcher_, and tkGeomToken_.

◆ getNewObject()

std::unique_ptr< SiStripApvGain > SiStripGainRandomCalculator::getNewObject ( )
overrideprivatevirtual

Implements ConditionDBWriter< SiStripApvGain >.

Definition at line 70 of file SiStripGainRandomCalculator.cc.

70  {
71  std::cout << "SiStripGainRandomCalculator::getNewObject called" << std::endl;
72 
73  auto obj = std::make_unique<SiStripApvGain>();
74 
75  for (std::vector<pair<uint32_t, unsigned short> >::const_iterator it = detid_apvs_.begin(); it != detid_apvs_.end();
76  it++) {
77  //Generate Gain for det detid
78  std::vector<float> theSiStripVector;
79  for (unsigned short j = 0; j < it->second; j++) {
80  float gain;
81 
82  // if(sigmaGain_/meanGain_ < 0.00001) gain = meanGain_;
83  // else{
84  gain = CLHEP::RandGauss::shoot(meanGain_, sigmaGain_);
85  if (gain <= minimumPosValue_)
87  // }
88 
89  if (printdebug_)
90  edm::LogInfo("SiStripGainCalculator") << "detid " << it->first << " \t"
91  << " apv " << j << " \t" << gain << " \t" << std::endl;
92  theSiStripVector.push_back(gain);
93  }
94 
95  SiStripApvGain::Range range(theSiStripVector.begin(), theSiStripVector.end());
96  if (!obj->put(it->first, range))
97  edm::LogError("SiStripGainCalculator") << "[SiStripGainCalculator::beginJob] detid already exists" << std::endl;
98  }
99 
100  return obj;
101 }

References gather_cfg::cout, detid_apvs_, PedestalClient_cfi::gain, dqmiolumiharvest::j, meanGain_, minimumPosValue_, getGTfromDQMFile::obj, printdebug_, FastTimerService_cff::range, sigmaGain_, and trackerHitRTTI::vector.

Member Data Documentation

◆ detid_apvs_

std::vector<std::pair<uint32_t, unsigned short> > SiStripGainRandomCalculator::detid_apvs_
private

◆ meanGain_

double SiStripGainRandomCalculator::meanGain_
private

Definition at line 42 of file SiStripGainRandomCalculator.h.

Referenced by getNewObject(), and SiStripGainRandomCalculator().

◆ minimumPosValue_

double SiStripGainRandomCalculator::minimumPosValue_
private

Definition at line 44 of file SiStripGainRandomCalculator.h.

Referenced by getNewObject(), and SiStripGainRandomCalculator().

◆ printdebug_

bool SiStripGainRandomCalculator::printdebug_
private

◆ sigmaGain_

double SiStripGainRandomCalculator::sigmaGain_
private

Definition at line 43 of file SiStripGainRandomCalculator.h.

Referenced by getNewObject(), and SiStripGainRandomCalculator().

◆ tkDigiGeomRcdWatcher_

edm::ESWatcher<TrackerDigiGeometryRecord> SiStripGainRandomCalculator::tkDigiGeomRcdWatcher_
private

Definition at line 50 of file SiStripGainRandomCalculator.h.

Referenced by algoAnalyze().

◆ tkGeomToken_

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiStripGainRandomCalculator::tkGeomToken_
private

Definition at line 49 of file SiStripGainRandomCalculator.h.

Referenced by algoAnalyze(), and SiStripGainRandomCalculator().

edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
SiStripGainRandomCalculator::sigmaGain_
double sigmaGain_
Definition: SiStripGainRandomCalculator.h:43
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
SiStripGainRandomCalculator::meanGain_
double meanGain_
Definition: SiStripGainRandomCalculator.h:42
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
SiStripGainRandomCalculator::minimumPosValue_
double minimumPosValue_
Definition: SiStripGainRandomCalculator.h:44
SiStripGainRandomCalculator::tkDigiGeomRcdWatcher_
edm::ESWatcher< TrackerDigiGeometryRecord > tkDigiGeomRcdWatcher_
Definition: SiStripGainRandomCalculator.h:50
ConditionDBWriter< SiStripApvGain >
createTree.dd
string dd
Definition: createTree.py:154
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
SiStripGainRandomCalculator::tkGeomToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
Definition: SiStripGainRandomCalculator.h:49
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
SiStripGainRandomCalculator::detid_apvs_
std::vector< std::pair< uint32_t, unsigned short > > detid_apvs_
Definition: SiStripGainRandomCalculator.h:46
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
SiStripGainRandomCalculator::printdebug_
bool printdebug_
Definition: SiStripGainRandomCalculator.h:47
SiStripApvGain::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripApvGain.h:28
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDConsumerBase::esConsumes
auto esConsumes()
Definition: EDConsumerBase.h:202
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::Log
Definition: MessageLogger.h:70
StripTopology
Definition: StripTopology.h:11