CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
PPSTimingCalibrationPCLHarvester Class Reference
Inheritance diagram for PPSTimingCalibrationPCLHarvester:
DQMEDHarvester edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::EndProcessBlockProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &) override
 
 PPSTimingCalibrationPCLHarvester (const edm::ParameterSet &)
 
- Public Member Functions inherited from DQMEDHarvester
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
void beginJob () override
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &) override
 
virtual void dqmAnalyze (DQMStore::IBooker &, DQMStore::IGetter &, edm::Event const &, edm::EventSetup const &)
 
 DQMEDHarvester ()
 
 DQMEDHarvester (edm::ParameterSet const &iConfig)
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (DQMStore::IBooker &, DQMStore::IGetter &, edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &es) final
 
void endProcessBlockProduce (edm::ProcessBlock &) final
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &es) final
 
 ~DQMEDHarvester () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::EndProcessBlockProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 

Private Attributes

std::vector< CTPPSDiamondDetIddetids_
 
const std::string dqmDir_
 
const std::string formula_
 
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecordgeomEsToken_
 
TF1 interp_
 
const unsigned int min_entries_
 

Additional Inherited Members

- Public Types inherited from DQMEDHarvester
typedef dqm::harvesting::DQMStore DQMStore
 
typedef dqm::harvesting::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- 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)
 
- Protected Attributes inherited from DQMEDHarvester
DQMStoredqmstore_
 
edm::GetterOfProducts< DQMTokenjobmegetter_
 
edm::EDPutTokenT< DQMTokenjobToken_
 
edm::GetterOfProducts< DQMTokenlumimegetter_
 
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::GetterOfProducts< DQMTokenrunmegetter_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 31 of file PPSTimingCalibrationPCLHarvester.cc.

Constructor & Destructor Documentation

◆ PPSTimingCalibrationPCLHarvester()

PPSTimingCalibrationPCLHarvester::PPSTimingCalibrationPCLHarvester ( const edm::ParameterSet iConfig)

Definition at line 50 of file PPSTimingCalibrationPCLHarvester.cc.

51  : geomEsToken_(esConsumes<edm::Transition::BeginRun>()),
52  dqmDir_(iConfig.getParameter<std::string>("dqmDir")),
53  formula_(iConfig.getParameter<std::string>("formula")),
54  min_entries_(iConfig.getParameter<unsigned int>("minEntries")),
55  interp_("interp", formula_.c_str(), 10.5, 25.) {
56  // first ensure DB output service is available
58  if (!poolDbService.isAvailable())
59  throw cms::Exception("PPSTimingCalibrationPCLHarvester") << "PoolDBService required";
60 
61  // constrain the min/max fit values
62  interp_.SetParLimits(1, 9., 15.);
63  interp_.SetParLimits(2, 0.2, 2.5);
64 }

Member Function Documentation

◆ beginRun()

void PPSTimingCalibrationPCLHarvester::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
override

Definition at line 68 of file PPSTimingCalibrationPCLHarvester.cc.

68  {
69  const auto& geom = iSetup.getData(geomEsToken_);
70  for (auto it = geom.beginSensor(); it != geom.endSensor(); ++it) {
71  if (!CTPPSDiamondDetId::check(it->first))
72  continue;
73  const CTPPSDiamondDetId detid(it->first);
74  if (detid.station() == 1) // for the time being, only compute for this station (run 2 diamond)
75  detids_.emplace_back(detid);
76  }
77 }

References CTPPSDiamondDetId::check(), detids_, relativeConstraints::geom, geomEsToken_, edm::EventSetup::getData(), and CTPPSDetId::station().

◆ dqmEndJob()

void PPSTimingCalibrationPCLHarvester::dqmEndJob ( DQMStore::IBooker iBooker,
DQMStore::IGetter iGetter 
)
overrideprivatevirtual

Implements DQMEDHarvester.

Definition at line 81 of file PPSTimingCalibrationPCLHarvester.cc.

81  {
82  // book the parameters containers
85 
86  iGetter.cd();
87  iGetter.setCurrentFolder(dqmDir_);
88 
89  // compute the fit parameters for all monitored channels
91  std::string ch_name;
92  for (const auto& detid : detids_) {
93  detid.channelName(ch_name);
94  const auto chid = detid.rawId();
96  (int)detid.arm(), (int)detid.station(), (int)detid.plane(), (int)detid.channel()};
97  hists.leadingTime[chid] = iGetter.get("t_" + ch_name);
98  if (hists.leadingTime[chid] == nullptr) {
99  edm::LogInfo("PPSTimingCalibrationPCLHarvester:dqmEndJob")
100  << "Failed to retrieve leading time monitor for channel (" << detid << ").";
101  continue;
102  }
103  hists.toT[chid] = iGetter.get("tot_" + ch_name);
104  if (hists.toT[chid] == nullptr) {
105  edm::LogInfo("PPSTimingCalibrationPCLHarvester:dqmEndJob")
106  << "Failed to retrieve time over threshold monitor for channel (" << detid << ").";
107  continue;
108  }
109  hists.leadingTimeVsToT[chid] = iGetter.get("tvstot_" + ch_name);
110  if (hists.leadingTimeVsToT[chid] == nullptr) {
111  edm::LogInfo("PPSTimingCalibrationPCLHarvester:dqmEndJob")
112  << "Failed to retrieve leading time vs. time over threshold monitor for channel (" << detid << ").";
113  continue;
114  }
115  if (min_entries_ > 0 && hists.leadingTimeVsToT[chid]->getEntries() < min_entries_) {
116  edm::LogWarning("PPSTimingCalibrationPCLHarvester:dqmEndJob")
117  << "Not enough entries for channel (" << detid << "): " << hists.leadingTimeVsToT[chid]->getEntries() << " < "
118  << min_entries_ << ". Skipping calibration.";
119  continue;
120  }
121  const double upper_tot_range = hists.toT[chid]->getMean() + 2.5;
122  { // scope for x-profile
123  std::unique_ptr<TProfile> prof(hists.leadingTimeVsToT[chid]->getTH2D()->ProfileX("_prof_x", 1, -1));
124  interp_.SetParameters(hists.leadingTime[chid]->getRMS(),
125  hists.toT[chid]->getMean(),
126  0.8,
127  hists.leadingTime[chid]->getMean() - hists.leadingTime[chid]->getRMS());
128  const auto& res = prof->Fit(&interp_, "B+", "", 10.4, upper_tot_range);
129  if ((bool)res) {
130  calib_params[key] = {
131  interp_.GetParameter(0), interp_.GetParameter(1), interp_.GetParameter(2), interp_.GetParameter(3)};
132  calib_time[key] = std::make_pair(0.1, 0.); // hardcoded resolution/offset placeholder for the time being
133  // can possibly do something with interp_.GetChiSquare() in the near future
134  } else
135  edm::LogWarning("PPSTimingCalibrationPCLHarvester:dqmEndJob")
136  << "Fit did not converge for channel (" << detid << ").";
137  }
138  }
139 
140  // fill the DB object record
141  PPSTimingCalibration calib(formula_, calib_params, calib_time);
142 
143  // write the object
145  poolDbService->writeOne(&calib, poolDbService->currentTime(), "PPSTimingCalibrationRcd");
146 }

References L1EGammaCrystalsEmulatorProducer_cfi::calib, dqm::implementation::NavigatorBase::cd(), cond::service::PoolDBOutputService::currentTime(), detids_, dqmDir_, formula_, dqm::implementation::IGetter::get(), compare::hists, createfilelist::int, interp_, crabWrapper::key, min_entries_, dqm::implementation::NavigatorBase::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and cond::service::PoolDBOutputService::writeOne().

◆ fillDescriptions()

void PPSTimingCalibrationPCLHarvester::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 150 of file PPSTimingCalibrationPCLHarvester.cc.

150  {
152  desc.add<std::string>("dqmDir", "AlCaReco/PPSTimingCalibrationPCL")
153  ->setComment("input path for the various DQM plots");
154  desc.add<std::string>("formula", "[0]/(exp((x-[1])/[2])+1)+[3]")
155  ->setComment("interpolation formula for the time walk component");
156  desc.add<unsigned int>("minEntries", 100)->setComment("minimal number of hits to extract calibration");
157  descriptions.addWithDefaultLabel(desc);
158 }

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

Member Data Documentation

◆ detids_

std::vector<CTPPSDiamondDetId> PPSTimingCalibrationPCLHarvester::detids_
private

Definition at line 48 of file PPSTimingCalibrationPCLHarvester.cc.

Referenced by beginRun(), and dqmEndJob().

◆ dqmDir_

const std::string PPSTimingCalibrationPCLHarvester::dqmDir_
private

Definition at line 49 of file PPSTimingCalibrationPCLHarvester.cc.

Referenced by dqmEndJob().

◆ formula_

const std::string PPSTimingCalibrationPCLHarvester::formula_
private

Definition at line 50 of file PPSTimingCalibrationPCLHarvester.cc.

Referenced by dqmEndJob().

◆ geomEsToken_

edm::ESGetToken<CTPPSGeometry, VeryForwardRealGeometryRecord> PPSTimingCalibrationPCLHarvester::geomEsToken_
private

Definition at line 47 of file PPSTimingCalibrationPCLHarvester.cc.

Referenced by beginRun().

◆ interp_

TF1 PPSTimingCalibrationPCLHarvester::interp_
private

Definition at line 52 of file PPSTimingCalibrationPCLHarvester.cc.

Referenced by dqmEndJob().

◆ min_entries_

const unsigned int PPSTimingCalibrationPCLHarvester::min_entries_
private

Definition at line 51 of file PPSTimingCalibrationPCLHarvester.cc.

Referenced by dqmEndJob().

PPSTimingCalibration::TimingMap
std::map< Key, std::pair< double, double > > TimingMap
Definition: PPSTimingCalibration.h:38
PPSTimingCalibrationPCLHarvester::min_entries_
const unsigned int min_entries_
Definition: PPSTimingCalibrationPCLHarvester.cc:51
PPSTimingCalibration::Key
Helper structure for indexing calibration data.
Definition: PPSTimingCalibration.h:26
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
compare.hists
hists
Definition: compare.py:318
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
TimingCalibrationHistograms
Definition: TimingCalibrationStruct.h:7
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
PPSTimingCalibration::ParametersMap
std::map< Key, std::vector< double > > ParametersMap
Definition: PPSTimingCalibration.h:37
PPSTimingCalibrationPCLHarvester::detids_
std::vector< CTPPSDiamondDetId > detids_
Definition: PPSTimingCalibrationPCLHarvester.cc:48
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
PPSTimingCalibrationPCLHarvester::interp_
TF1 interp_
Definition: PPSTimingCalibrationPCLHarvester.cc:52
calib
Definition: CalibElectron.h:12
CTPPSDiamondDetId
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
Definition: CTPPSDiamondDetId.h:24
PPSTimingCalibrationPCLHarvester::geomEsToken_
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > geomEsToken_
Definition: PPSTimingCalibrationPCLHarvester.cc:47
edm::Service< cond::service::PoolDBOutputService >
createfilelist.int
int
Definition: createfilelist.py:10
PPSTimingCalibrationPCLHarvester::formula_
const std::string formula_
Definition: PPSTimingCalibrationPCLHarvester.cc:50
CTPPSDiamondDetId::check
static bool check(unsigned int raw)
returns true if the raw ID is a PPS-timing one
Definition: CTPPSDiamondDetId.h:40
res
Definition: Electron.h:6
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
L1EGammaCrystalsEmulatorProducer_cfi.calib
calib
Definition: L1EGammaCrystalsEmulatorProducer_cfi.py:6
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
PPSTimingCalibrationPCLHarvester::dqmDir_
const std::string dqmDir_
Definition: PPSTimingCalibrationPCLHarvester.cc:49
cond::service::PoolDBOutputService::writeOne
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
Definition: PoolDBOutputService.h:63
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:673
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
cms::Exception
Definition: Exception.h:70
PPSTimingCalibration
Definition: PPSTimingCalibration.h:17
crabWrapper.key
key
Definition: crabWrapper.py:19
cond::service::PoolDBOutputService::currentTime
cond::Time_t currentTime() const
Definition: PoolDBOutputService.cc:217
edm::ConfigurationDescriptions::addWithDefaultLabel
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:87