CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static 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 (edm::ParameterSet const &iConfig)
 
 DQMEDHarvester ()
 
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 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)
 

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_
 

Static Private Attributes

static constexpr double offset_ = 0.
 
static constexpr double resolution_ = 0.1
 

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
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- 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)
 
- 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 52 of file PPSTimingCalibrationPCLHarvester.cc.

References interp_, and edm::Service< T >::isAvailable().

53  : geomEsToken_(esConsumes<edm::Transition::BeginRun>()),
54  dqmDir_(iConfig.getParameter<std::string>("dqmDir")),
55  formula_(iConfig.getParameter<std::string>("formula")),
56  min_entries_(iConfig.getParameter<unsigned int>("minEntries")),
57  interp_("interp", formula_.c_str(), 10.5, 25.) {
58  // first ensure DB output service is available
60  if (!poolDbService.isAvailable())
61  throw cms::Exception("PPSTimingCalibrationPCLHarvester") << "PoolDBService required";
62 
63  // constrain the min/max fit values
64  interp_.SetParLimits(1, 9., 15.);
65  interp_.SetParLimits(2, 0.2, 2.5);
66 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > geomEsToken_
bool isAvailable() const
Definition: Service.h:40

Member Function Documentation

◆ beginRun()

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

Definition at line 70 of file PPSTimingCalibrationPCLHarvester.cc.

References CTPPSDiamondDetId::check(), detids_, relativeConstraints::geom, geomEsToken_, edm::EventSetup::getData(), and ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it.

70  {
71  const auto& geom = iSetup.getData(geomEsToken_);
72  for (auto it = geom.beginSensor(); it != geom.endSensor(); ++it) {
73  if (!CTPPSDiamondDetId::check(it->first))
74  continue;
75  const CTPPSDiamondDetId detid(it->first);
76  detids_.emplace_back(detid);
77  }
78 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > geomEsToken_
static bool check(unsigned int raw)
returns true if the raw ID is a PPS-timing one
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...

◆ dqmEndJob()

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

Implements DQMEDHarvester.

Definition at line 82 of file PPSTimingCalibrationPCLHarvester.cc.

References dqm::implementation::IBooker::bookProfile(), l1tEGammaCrystalsEmulatorProducer_cfi::calib, dqm::implementation::NavigatorBase::cd(), cond::service::PoolDBOutputService::currentTime(), detids_, dqmDir_, formula_, dqm::implementation::IGetter::get(), compare::hists, createfilelist::int, interp_, submitPVResolutionJobs::key, min_entries_, offset_, PostProcessor_cff::profile, resolution_, dqm::implementation::NavigatorBase::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and cond::service::PoolDBOutputService::writeOneIOV().

82  {
83  // book the parameters containers
86 
87  iGetter.cd();
88  iGetter.setCurrentFolder(dqmDir_);
89 
90  // compute the fit parameters for all monitored channels
92  std::string ch_name;
93  for (const auto& detid : detids_) {
94  detid.channelName(ch_name);
95  const auto chid = detid.rawId();
97  (int)detid.arm(), (int)detid.station(), (int)detid.plane(), (int)detid.channel()};
98 
99  calib_params[key] = {0, 0, 0, 0};
100  calib_time[key] = std::make_pair(offset_, resolution_);
101 
102  hists.leadingTime[chid] = iGetter.get(dqmDir_ + "/t_" + ch_name);
103  if (hists.leadingTime[chid] == nullptr) {
104  edm::LogInfo("PPSTimingCalibrationPCLHarvester:dqmEndJob")
105  << "Failed to retrieve leading time monitor for channel (" << detid << ").";
106  continue;
107  }
108  hists.toT[chid] = iGetter.get(dqmDir_ + "/tot_" + ch_name);
109  if (hists.toT[chid] == nullptr) {
110  edm::LogInfo("PPSTimingCalibrationPCLHarvester:dqmEndJob")
111  << "Failed to retrieve time over threshold monitor for channel (" << detid << ").";
112  continue;
113  }
114  hists.leadingTimeVsToT[chid] = iGetter.get(dqmDir_ + "/tvstot_" + ch_name);
115  if (hists.leadingTimeVsToT[chid] == nullptr) {
116  edm::LogInfo("PPSTimingCalibrationPCLHarvester:dqmEndJob")
117  << "Failed to retrieve leading time vs. time over threshold monitor for channel (" << detid << ").";
118  continue;
119  }
120  if (min_entries_ > 0 && hists.leadingTimeVsToT[chid]->getEntries() < min_entries_) {
121  edm::LogWarning("PPSTimingCalibrationPCLHarvester:dqmEndJob")
122  << "Not enough entries for channel (" << detid << "): " << hists.leadingTimeVsToT[chid]->getEntries() << " < "
123  << min_entries_ << ". Skipping calibration.";
124  continue;
125  }
126  const double upper_tot_range = hists.toT[chid]->getMean() + 2.5;
127  { // scope for x-profile
128 
129  std::string ch_name;
130  detid.channelName(ch_name);
131  auto profile = iBooker.bookProfile(ch_name + "_prof_x", ch_name + "_prof_x", 240, 0., 60., 450, -20., 25.);
132 
133  std::unique_ptr<TProfile> prof(hists.leadingTimeVsToT[chid]->getTH2F()->ProfileX("_prof_x", 1, -1));
134  *(profile->getTProfile()) = *((TProfile*)prof->Clone());
135  profile->getTProfile()->SetTitle(ch_name.c_str());
136  profile->getTProfile()->SetName(ch_name.c_str());
137 
138  interp_.SetParameters(hists.leadingTime[chid]->getRMS(),
139  hists.toT[chid]->getMean(),
140  0.8,
141  hists.leadingTime[chid]->getMean() - hists.leadingTime[chid]->getRMS());
142  const auto& res = profile->getTProfile()->Fit(&interp_, "B+", "", 10.4, upper_tot_range);
143  if (!(bool)res) {
144  calib_params[key] = {
145  interp_.GetParameter(0), interp_.GetParameter(1), interp_.GetParameter(2), interp_.GetParameter(3)};
146  calib_time[key] =
147  std::make_pair(offset_, resolution_); // hardcoded offset/resolution placeholder for the time being
148  // can possibly do something with interp_.GetChiSquare() in the near future
149 
150  } else
151  edm::LogWarning("PPSTimingCalibrationPCLHarvester:dqmEndJob")
152  << "Fit did not converge for channel (" << detid << ").";
153  }
154  }
155 
156  // fill the DB object record
157  PPSTimingCalibration calib(formula_, calib_params, calib_time);
158 
159  // write the object
161  poolDbService->writeOneIOV(calib, poolDbService->currentTime(), "PPSTimingCalibrationRcd_HPTDC");
162 }
std::map< Key, std::pair< double, double > > TimingMap
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
Definition: Electron.h:6
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:399
Helper structure for indexing calibration data.
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
key
prepare the HTCondor submission files and eventually submit them
Log< level::Info, false > LogInfo
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:712
std::map< Key, std::vector< double > > ParametersMap
Log< level::Warning, false > LogWarning

◆ fillDescriptions()

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

Definition at line 166 of file PPSTimingCalibrationPCLHarvester.cc.

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

166  {
168  desc.add<std::string>("dqmDir", "AlCaReco/PPSTimingCalibrationPCL")
169  ->setComment("input path for the various DQM plots");
170  desc.add<std::string>("formula", "[0]/(exp((x-[1])/[2])+1)+[3]")
171  ->setComment("interpolation formula for the time walk component");
172  desc.add<unsigned int>("minEntries", 100)->setComment("minimal number of hits to extract calibration");
173  descriptions.addWithDefaultLabel(desc);
174 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ detids_

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

Definition at line 41 of file PPSTimingCalibrationPCLHarvester.cc.

Referenced by beginRun(), and dqmEndJob().

◆ dqmDir_

const std::string PPSTimingCalibrationPCLHarvester::dqmDir_
private

Definition at line 42 of file PPSTimingCalibrationPCLHarvester.cc.

Referenced by dqmEndJob().

◆ formula_

const std::string PPSTimingCalibrationPCLHarvester::formula_
private

Definition at line 43 of file PPSTimingCalibrationPCLHarvester.cc.

Referenced by dqmEndJob().

◆ geomEsToken_

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

Definition at line 40 of file PPSTimingCalibrationPCLHarvester.cc.

Referenced by beginRun().

◆ interp_

TF1 PPSTimingCalibrationPCLHarvester::interp_
private

◆ min_entries_

const unsigned int PPSTimingCalibrationPCLHarvester::min_entries_
private

Definition at line 44 of file PPSTimingCalibrationPCLHarvester.cc.

Referenced by dqmEndJob().

◆ offset_

constexpr double PPSTimingCalibrationPCLHarvester::offset_ = 0.
staticprivate

Definition at line 46 of file PPSTimingCalibrationPCLHarvester.cc.

Referenced by dqmEndJob().

◆ resolution_

constexpr double PPSTimingCalibrationPCLHarvester::resolution_ = 0.1
staticprivate

Definition at line 45 of file PPSTimingCalibrationPCLHarvester.cc.

Referenced by dqmEndJob().