CMS 3D CMS Logo

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

#include <SiStripNoiseNormalizedWithApvGainBuilder.h>

Inheritance diagram for SiStripNoiseNormalizedWithApvGainBuilder:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 SiStripNoiseNormalizedWithApvGainBuilder (const edm::ParameterSet &iConfig)
 
 ~SiStripNoiseNormalizedWithApvGainBuilder () 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
 
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
 
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 fillParameters (std::map< int, std::vector< double > > &mapToFill, const std::string &parameterName) const
 Fills the parameters read from cfg and matching the name in the given map. More...
 
void fillSubDetParameter (std::map< int, std::vector< double > > &mapToFill, const std::vector< double > &v, const int subDet, const unsigned short layers) const
 
void printLog (const uint32_t detId, const unsigned short strip, const double &noise) const
 

Private Attributes

double electronsPerADC_
 
edm::FileInPath fp_
 
edm::ESGetToken< SiStripApvGain, SiStripApvGainRcdinputApvGainToken_
 
double minimumPosValue_
 
bool printdebug_
 
uint32_t printDebug_
 
edm::ParameterSet pset_
 
bool stripLengthMode_
 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtGeomToken_
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtTopoToken_
 

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
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>
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)
 
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

Produces a noise tag using the same settings as the service used in the DummyDBWriter, but it receives a SiStripApvGain tag from the EventSetup and uses the gain values (per apv) to rescale the noise (per strip).

Definition at line 32 of file SiStripNoiseNormalizedWithApvGainBuilder.h.

Constructor & Destructor Documentation

◆ SiStripNoiseNormalizedWithApvGainBuilder()

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

Definition at line 12 of file SiStripNoiseNormalizedWithApvGainBuilder.cc.

13  : printdebug_(iConfig.getUntrackedParameter<uint32_t>("printDebug", 1)),
14  pset_(iConfig),
15  electronsPerADC_(0.),
16  minimumPosValue_(0.),
17  stripLengthMode_(true),
18  printDebug_(0) {
19  tTopoToken_ = esConsumes<TrackerTopology, TrackerTopologyRcd>();
20  tGeomToken_ = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>();
21  inputApvGainToken_ = esConsumes<SiStripApvGain, SiStripApvGainRcd>();
22 }

References inputApvGainToken_, tGeomToken_, and tTopoToken_.

◆ ~SiStripNoiseNormalizedWithApvGainBuilder()

SiStripNoiseNormalizedWithApvGainBuilder::~SiStripNoiseNormalizedWithApvGainBuilder ( )
inlineoverride

Definition at line 36 of file SiStripNoiseNormalizedWithApvGainBuilder.h.

36 {};

Member Function Documentation

◆ analyze()

void SiStripNoiseNormalizedWithApvGainBuilder::analyze ( const edm::Event evt,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDAnalyzer.

Definition at line 24 of file SiStripNoiseNormalizedWithApvGainBuilder.cc.

24  {
25  const auto& tTopo = iSetup.getData(tTopoToken_);
26  const auto& tGeom = iSetup.getData(tGeomToken_);
27  // Read the gain from the given tag
28  const auto& inputApvGain = iSetup.getData(inputApvGainToken_);
29  std::vector<uint32_t> inputDetIds;
30  inputApvGain.getDetIds(inputDetIds);
31 
32  // Prepare the new object
34 
35  stripLengthMode_ = pset_.getParameter<bool>("StripLengthMode");
36 
37  //parameters for random noise generation. not used if Strip length mode is chosen
38  SiStripFakeAPVParameters meanNoise{pset_, "MeanNoise"};
39  SiStripFakeAPVParameters sigmaNoise{pset_, "SigmaNoise"};
40  minimumPosValue_ = pset_.getParameter<double>("MinPositiveNoise");
41 
42  //parameters for strip length proportional noise generation. not used if random mode is chosen
43  SiStripFakeAPVParameters noiseStripLengthLinearSlope{pset_, "NoiseStripLengthSlope"};
44  SiStripFakeAPVParameters noiseStripLengthLinearQuote{pset_, "NoiseStripLengthQuote"};
45  electronsPerADC_ = pset_.getParameter<double>("electronPerAdc");
46 
47  printDebug_ = pset_.getUntrackedParameter<uint32_t>("printDebug", 5);
48 
49  unsigned int count = 0;
50  for (const auto det : tGeom.detUnits()) {
51  const StripGeomDetUnit* stripDet = dynamic_cast<const StripGeomDetUnit*>(det);
52  if (stripDet != nullptr) {
53  const DetId detId = stripDet->geographicalId();
54  // Find if this DetId is in the input tag and if so how many are the Apvs for which it contains information
55  SiStripApvGain::Range inputRange(inputApvGain.getRange(detId));
56 
57  //Generate Noises for det detid
58  SiStripNoises::InputVector theSiStripVector;
59  float noise = 0.;
61  unsigned short nApvs = stripDet->specificTopology().nstrips() / 128;
62 
63  if (stripLengthMode_) {
64  // Use strip length
65  double linearSlope = noiseStripLengthLinearSlope.get(sl);
66  double linearQuote = noiseStripLengthLinearQuote.get(sl);
67  double stripLength = stripDet->specificTopology().stripLength();
68  for (unsigned short j = 0; j < nApvs; ++j) {
69  double gain = inputApvGain.getApvGain(j, inputRange);
70 
71  for (unsigned short stripId = 0; stripId < 128; ++stripId) {
72  noise = ((linearSlope * stripLength + linearQuote) / electronsPerADC_) * gain;
73  if (count < printDebug_)
74  printLog(detId, stripId + 128 * j, noise);
75  obj->setData(noise, theSiStripVector);
76  }
77  }
78  } else {
79  // Use random generator
80  double meanN = meanNoise.get(sl);
81  double sigmaN = sigmaNoise.get(sl);
82  for (unsigned short j = 0; j < nApvs; ++j) {
83  double gain = inputApvGain.getApvGain(j, inputRange);
84 
85  for (unsigned short stripId = 0; stripId < 128; ++stripId) {
86  noise = (CLHEP::RandGauss::shoot(meanN, sigmaN)) * gain;
87  if (noise <= minimumPosValue_)
89  if (count < printDebug_)
90  printLog(detId, stripId + 128 * j, noise);
91  obj->setData(noise, theSiStripVector);
92  }
93  }
94  }
95  ++count;
96 
97  if (!obj->put(detId, theSiStripVector)) {
98  edm::LogError("SiStripNoisesFakeESSource::produce ") << " detid already exists" << std::endl;
99  }
100  }
101  }
102 
103  //End now write data in DB
105 
106  if (mydbservice.isAvailable()) {
107  if (mydbservice->isNewTagRequest("SiStripNoisesRcd")) {
108  mydbservice->createNewIOV<SiStripNoises>(
109  obj, mydbservice->beginOfTime(), mydbservice->endOfTime(), "SiStripNoisesRcd");
110  } else {
111  mydbservice->appendSinceTime<SiStripNoises>(obj, mydbservice->currentTime(), "SiStripNoisesRcd");
112  }
113  } else {
114  edm::LogError("SiStripNoiseNormalizedWithApvGainBuilder") << "Service is unavailable" << std::endl;
115  }
116 }

References cond::service::PoolDBOutputService::appendSinceTime(), cond::service::PoolDBOutputService::beginOfTime(), KineDebug3::count(), cond::service::PoolDBOutputService::createNewIOV(), cond::service::PoolDBOutputService::currentTime(), electronsPerADC_, cond::service::PoolDBOutputService::endOfTime(), PedestalClient_cfi::gain, GeomDet::geographicalId(), edm::EventSetup::getData(), SiStripFakeAPVParameters::getIndex(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), inputApvGainToken_, pileupCalc::inputRange, edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), dqmiolumiharvest::j, minimumPosValue_, hgcalDigitizer_cfi::noise, StripTopology::nstrips(), getGTfromDQMFile::obj, printDebug_, printLog(), pset_, StripGeomDetUnit::specificTopology(), StripTopology::stripLength(), stripLengthMode_, tGeomToken_, and tTopoToken_.

◆ fillParameters()

void SiStripNoiseNormalizedWithApvGainBuilder::fillParameters ( std::map< int, std::vector< double > > &  mapToFill,
const std::string &  parameterName 
) const
private

Fills the parameters read from cfg and matching the name in the given map.

◆ fillSubDetParameter()

void SiStripNoiseNormalizedWithApvGainBuilder::fillSubDetParameter ( std::map< int, std::vector< double > > &  mapToFill,
const std::vector< double > &  v,
const int  subDet,
const unsigned short  layers 
) const
private

Fills the map with the paramters for the given subdetector.
Each vector "v" holds the parameters for the layers/rings, if the vector has only one parameter all the layers/rings get that parameter.
The only other possibility is that the number of parameters equals the number of layers, otherwise an exception of type "Configuration" will be thrown.

◆ printLog()

void SiStripNoiseNormalizedWithApvGainBuilder::printLog ( const uint32_t  detId,
const unsigned short  strip,
const double &  noise 
) const
inlineprivate

Definition at line 55 of file SiStripNoiseNormalizedWithApvGainBuilder.h.

55  {
56  edm::LogInfo("SiStripNoisesDummyCalculator")
57  << "detid: " << detId << " strip: " << strip << " noise: " << noise << " \t" << std::endl;
58  }

References hgcalDigitizer_cfi::noise, and digitizers_cfi::strip.

Referenced by analyze().

Member Data Documentation

◆ electronsPerADC_

double SiStripNoiseNormalizedWithApvGainBuilder::electronsPerADC_
private

Definition at line 64 of file SiStripNoiseNormalizedWithApvGainBuilder.h.

Referenced by analyze().

◆ fp_

edm::FileInPath SiStripNoiseNormalizedWithApvGainBuilder::fp_
private

Definition at line 60 of file SiStripNoiseNormalizedWithApvGainBuilder.h.

◆ inputApvGainToken_

edm::ESGetToken<SiStripApvGain, SiStripApvGainRcd> SiStripNoiseNormalizedWithApvGainBuilder::inputApvGainToken_
private

◆ minimumPosValue_

double SiStripNoiseNormalizedWithApvGainBuilder::minimumPosValue_
private

Definition at line 65 of file SiStripNoiseNormalizedWithApvGainBuilder.h.

Referenced by analyze().

◆ printdebug_

bool SiStripNoiseNormalizedWithApvGainBuilder::printdebug_
private

Definition at line 61 of file SiStripNoiseNormalizedWithApvGainBuilder.h.

◆ printDebug_

uint32_t SiStripNoiseNormalizedWithApvGainBuilder::printDebug_
private

Definition at line 67 of file SiStripNoiseNormalizedWithApvGainBuilder.h.

Referenced by analyze().

◆ pset_

edm::ParameterSet SiStripNoiseNormalizedWithApvGainBuilder::pset_
private

Definition at line 62 of file SiStripNoiseNormalizedWithApvGainBuilder.h.

Referenced by analyze().

◆ stripLengthMode_

bool SiStripNoiseNormalizedWithApvGainBuilder::stripLengthMode_
private

Definition at line 66 of file SiStripNoiseNormalizedWithApvGainBuilder.h.

Referenced by analyze().

◆ tGeomToken_

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiStripNoiseNormalizedWithApvGainBuilder::tGeomToken_
private

◆ tTopoToken_

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SiStripNoiseNormalizedWithApvGainBuilder::tTopoToken_
private
SiStripFakeAPVParameters::getIndex
static index getIndex(const TrackerTopology *tTopo, DetId id)
Definition: SiStripFakeAPVParameters.h:34
SiStripNoiseNormalizedWithApvGainBuilder::electronsPerADC_
double electronsPerADC_
Definition: SiStripNoiseNormalizedWithApvGainBuilder.h:64
SiStripFakeAPVParameters
Definition: SiStripFakeAPVParameters.h:9
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:177
SiStripNoises
Definition: SiStripNoises.h:25
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
edm::LogInfo
Definition: MessageLogger.h:254
cond::service::PoolDBOutputService::appendSinceTime
void appendSinceTime(const T *payloadObj, cond::Time_t sinceTime, const std::string &recordName)
Definition: PoolDBOutputService.h:132
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
pileupCalc.inputRange
inputRange
Definition: pileupCalc.py:218
DetId
Definition: DetId.h:17
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition: PoolDBOutputService.h:107
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
SiStripFakeAPVParameters::index
std::pair< int, int > index
Definition: SiStripFakeAPVParameters.h:11
GeomDet::geographicalId
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
StripTopology::stripLength
virtual float stripLength() const =0
edm::LogError
Definition: MessageLogger.h:183
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
hgcalDigitizer_cfi.noise
noise
Definition: hgcalDigitizer_cfi.py:150
edm::Service< cond::service::PoolDBOutputService >
SiStripNoiseNormalizedWithApvGainBuilder::printdebug_
bool printdebug_
Definition: SiStripNoiseNormalizedWithApvGainBuilder.h:61
SiStripNoiseNormalizedWithApvGainBuilder::inputApvGainToken_
edm::ESGetToken< SiStripApvGain, SiStripApvGainRcd > inputApvGainToken_
Definition: SiStripNoiseNormalizedWithApvGainBuilder.h:71
SiStripNoiseNormalizedWithApvGainBuilder::stripLengthMode_
bool stripLengthMode_
Definition: SiStripNoiseNormalizedWithApvGainBuilder.h:66
StripTopology::nstrips
virtual int nstrips() const =0
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:113
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:175
SiStripNoiseNormalizedWithApvGainBuilder::tTopoToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
Definition: SiStripNoiseNormalizedWithApvGainBuilder.h:69
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
SiStripNoiseNormalizedWithApvGainBuilder::printLog
void printLog(const uint32_t detId, const unsigned short strip, const double &noise) const
Definition: SiStripNoiseNormalizedWithApvGainBuilder.h:55
SiStripApvGain::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripApvGain.h:28
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition: PoolDBOutputService.cc:90
StripGeomDetUnit::specificTopology
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
Definition: StripGeomDetUnit.cc:17
SiStripNoises::InputVector
std::vector< uint16_t > InputVector
Definition: SiStripNoises.h:50
SiStripNoiseNormalizedWithApvGainBuilder::minimumPosValue_
double minimumPosValue_
Definition: SiStripNoiseNormalizedWithApvGainBuilder.h:65
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
SiStripNoiseNormalizedWithApvGainBuilder::tGeomToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tGeomToken_
Definition: SiStripNoiseNormalizedWithApvGainBuilder.h:70
cond::service::PoolDBOutputService::currentTime
cond::Time_t currentTime() const
Definition: PoolDBOutputService.cc:179
SiStripNoiseNormalizedWithApvGainBuilder::pset_
edm::ParameterSet pset_
Definition: SiStripNoiseNormalizedWithApvGainBuilder.h:62
StripGeomDetUnit
Definition: StripGeomDetUnit.h:15
SiStripNoiseNormalizedWithApvGainBuilder::printDebug_
uint32_t printDebug_
Definition: SiStripNoiseNormalizedWithApvGainBuilder.h:67