CMS 3D CMS Logo

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

#include <SiStripGainsPCLHarvester.h>

Inheritance diagram for SiStripGainsPCLHarvester:
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 (edm::Run const &run, edm::EventSetup const &isetup) override
 
void endRun (edm::Run const &run, edm::EventSetup const &isetup) override
 
 SiStripGainsPCLHarvester (const edm::ParameterSet &ps)
 
- 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
 
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
 
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
 
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 &descriptions)
 
- 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 algoComputeMPVandGain (const MonitorElement *Charge_Vs_Index)
 
virtual void checkAndRetrieveTopology (const edm::EventSetup &setup)
 
virtual void checkBookAPVColls (const edm::EventSetup &setup)
 
void dqmEndJob (DQMStore::IBooker &ibooker_, DQMStore::IGetter &igetter_) override
 
void gainQualityMonitor (DQMStore::IBooker &ibooker_, const MonitorElement *Charge_Vs_Index) const
 
std::unique_ptr< SiStripApvGaingetNewObject (const MonitorElement *Charge_Vs_Index)
 
void getPeakOfLandau (TH1 *InputHisto, double *FitResults, double LowRange=50, double HighRange=5400)
 
bool IsGoodLandauFit (double *FitResults)
 
bool produceTagFilter (const MonitorElement *Charge_Vs_Index)
 
int statCollectionFromMode (const char *tag) const
 

Private Attributes

std::unordered_map< unsigned int, std::shared_ptr< stAPVGain > > APVsColl
 
std::vector< std::shared_ptr< stAPVGain > > APVsCollOrdered
 
unsigned int BAD
 
const TrackerGeometrybareTkGeomPtr_ = nullptr
 
int CalibrationLevel
 
bool doChargeMonitorPerPlane
 
bool doStoreOnDB
 
std::vector< std::string > dqm_tag_
 
edm::ESGetToken< SiStripGain, SiStripGainRcdgainToken_
 
unsigned int GOOD
 
std::string m_calibrationMode
 
std::string m_DQMdir
 
std::string m_Record
 
unsigned int MASKED
 
double MinNrEntries
 
int NPixelDets
 
int NStripAPVs
 
edm::ESGetToken< SiStripQuality, SiStripQualityRcdqualityToken_
 
double tagCondition_GoodFrac
 
double tagCondition_NClusters
 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtkGeomToken_
 
const TrackerTopologytTopo_ = nullptr
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtTopoToken_
 
std::vector< std::string > VChargeHisto
 

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

Description: Harvests output of SiStripGainsPCLWorker and creates histograms and Gains Payload

Definition at line 50 of file SiStripGainsPCLHarvester.h.

Constructor & Destructor Documentation

◆ SiStripGainsPCLHarvester()

SiStripGainsPCLHarvester::SiStripGainsPCLHarvester ( const edm::ParameterSet ps)
explicit

Definition at line 29 of file SiStripGainsPCLHarvester.cc.

30  : doStoreOnDB(false), GOOD(0), BAD(0), MASKED(0), NStripAPVs(0), NPixelDets(0) {
31  m_Record = ps.getUntrackedParameter<std::string>("Record", "SiStripApvGainRcd");
32  CalibrationLevel = ps.getUntrackedParameter<int>("CalibrationLevel", 0);
33  MinNrEntries = ps.getUntrackedParameter<double>("minNrEntries", 20);
34  m_DQMdir = ps.getUntrackedParameter<std::string>("DQMdir", "AlCaReco/SiStripGains");
35  m_calibrationMode = ps.getUntrackedParameter<std::string>("calibrationMode", "StdBunch");
36  tagCondition_NClusters = ps.getUntrackedParameter<double>("NClustersForTagProd", 2E8);
37  tagCondition_GoodFrac = ps.getUntrackedParameter<double>("GoodFracForTagProd", 0.95);
38  doChargeMonitorPerPlane = ps.getUntrackedParameter<bool>("doChargeMonitorPerPlane", false);
39  VChargeHisto = ps.getUntrackedParameter<std::vector<std::string>>("ChargeHisto");
40 
41  //Set the monitoring element tag and store
42  dqm_tag_.reserve(7);
43  dqm_tag_.clear();
44  dqm_tag_.push_back("StdBunch"); // statistic collection from Standard Collision Bunch @ 3.8 T
45  dqm_tag_.push_back("StdBunch0T"); // statistic collection from Standard Collision Bunch @ 0 T
46  dqm_tag_.push_back("AagBunch"); // statistic collection from First Collision After Abort Gap @ 3.8 T
47  dqm_tag_.push_back("AagBunch0T"); // statistic collection from First Collision After Abort Gap @ 0 T
48  dqm_tag_.push_back("IsoMuon"); // statistic collection from Isolated Muon @ 3.8 T
49  dqm_tag_.push_back("IsoMuon0T"); // statistic collection from Isolated Muon @ 0 T
50  dqm_tag_.push_back("Harvest"); // statistic collection: Harvest
51 
52  tTopoToken_ = esConsumes<edm::Transition::BeginRun>();
53  tkGeomToken_ = esConsumes<edm::Transition::BeginRun>();
54  gainToken_ = esConsumes<edm::Transition::BeginRun>();
55  qualityToken_ = esConsumes<edm::Transition::BeginRun>();
56 }

References CalibrationLevel, doChargeMonitorPerPlane, dqm_tag_, gainToken_, edm::ParameterSet::getUntrackedParameter(), m_calibrationMode, m_DQMdir, m_Record, MinNrEntries, qualityToken_, AlCaHLTBitMon_QueryRunRegistry::string, tagCondition_GoodFrac, tagCondition_NClusters, tkGeomToken_, tTopoToken_, and VChargeHisto.

Member Function Documentation

◆ algoComputeMPVandGain()

void SiStripGainsPCLHarvester::algoComputeMPVandGain ( const MonitorElement Charge_Vs_Index)
private

Definition at line 367 of file SiStripGainsPCLHarvester.cc.

367  {
368  unsigned int I = 0;
369  TH1F* Proj = nullptr;
370  double FitResults[6];
371  double MPVmean = 300;
372 
373  if (Charge_Vs_Index == nullptr) {
374  edm::LogError("SiStripGainsPCLHarvester")
375  << "Harvesting: could not execute algoComputeMPVandGain method because " << m_calibrationMode
376  << " statistics cannot be retrieved.\n"
377  << "Please check if input contains " << m_calibrationMode << " data." << std::endl;
378  return;
379  }
380 
381  TH2S* chvsidx = (Charge_Vs_Index)->getTH2S();
382 
383  printf("Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
384  printf("Fitting Charge Distribution :");
385  int TreeStep = APVsColl.size() / 50;
386 
387  for (auto it = APVsColl.begin(); it != APVsColl.end(); it++, I++) {
388  if (I % TreeStep == 0) {
389  printf(".");
390  fflush(stdout);
391  }
392  std::shared_ptr<stAPVGain> APV = it->second;
393  if (APV->Bin < 0)
394  APV->Bin = chvsidx->GetXaxis()->FindBin(APV->Index);
395 
396  if (APV->isMasked) {
397  APV->Gain = APV->PreviousGain;
398  MASKED++;
399  continue;
400  }
401 
402  Proj = (TH1F*)(chvsidx->ProjectionY(
403  "", chvsidx->GetXaxis()->FindBin(APV->Index), chvsidx->GetXaxis()->FindBin(APV->Index), "e"));
404  if (!Proj)
405  continue;
406 
407  if (CalibrationLevel == 0) {
408  } else if (CalibrationLevel == 1) {
409  int SecondAPVId = APV->APVId;
410  if (SecondAPVId % 2 == 0) {
411  SecondAPVId = SecondAPVId + 1;
412  } else {
413  SecondAPVId = SecondAPVId - 1;
414  }
415  std::shared_ptr<stAPVGain> APV2 = APVsColl[(APV->DetId << 4) | SecondAPVId];
416  if (APV2->Bin < 0)
417  APV2->Bin = chvsidx->GetXaxis()->FindBin(APV2->Index);
418  TH1F* Proj2 = (TH1F*)(chvsidx->ProjectionY("", APV2->Bin, APV2->Bin, "e"));
419  if (Proj2) {
420  Proj->Add(Proj2, 1);
421  delete Proj2;
422  }
423  } else if (CalibrationLevel == 2) {
424  for (unsigned int i = 0; i < 16; i++) { //loop up to 6APV for Strip and up to 16 for Pixels
425  auto tmpit = APVsColl.find((APV->DetId << 4) | i);
426  if (tmpit == APVsColl.end())
427  continue;
428  std::shared_ptr<stAPVGain> APV2 = tmpit->second;
429  if (APV2->DetId != APV->DetId || APV2->APVId == APV->APVId)
430  continue;
431  if (APV2->Bin < 0)
432  APV2->Bin = chvsidx->GetXaxis()->FindBin(APV2->Index);
433  TH1F* Proj2 = (TH1F*)(chvsidx->ProjectionY("", APV2->Bin, APV2->Bin, "e"));
434  if (Proj2) {
435  Proj->Add(Proj2, 1);
436  delete Proj2;
437  }
438  }
439  } else {
440  CalibrationLevel = 0;
441  printf("Unknown Calibration Level, will assume %i\n", CalibrationLevel);
442  }
443 
444  getPeakOfLandau(Proj, FitResults);
445  APV->FitMPV = FitResults[0];
446  APV->FitMPVErr = FitResults[1];
447  APV->FitWidth = FitResults[2];
448  APV->FitWidthErr = FitResults[3];
449  APV->FitChi2 = FitResults[4];
450  APV->FitNorm = FitResults[5];
451  APV->NEntries = Proj->GetEntries();
452 
453  if (IsGoodLandauFit(FitResults)) {
454  APV->Gain = APV->FitMPV / MPVmean;
455  if (APV->SubDet > 2)
456  GOOD++;
457  } else {
458  APV->Gain = APV->PreviousGain;
459  if (APV->SubDet > 2)
460  BAD++;
461  }
462  if (APV->Gain <= 0)
463  APV->Gain = 1;
464 
465  delete Proj;
466  }
467  printf("\n");
468 }

References sistrip::APV, APVsColl, BAD, CalibrationLevel, getPeakOfLandau(), GOOD, Exhume::I, mps_fire::i, IsGoodLandauFit(), m_calibrationMode, MASKED, and mps_setup::stdout.

Referenced by dqmEndJob().

◆ beginRun()

void SiStripGainsPCLHarvester::beginRun ( edm::Run const &  run,
edm::EventSetup const &  isetup 
)
override

Definition at line 60 of file SiStripGainsPCLHarvester.cc.

60  {
61  using namespace edm;
62  static constexpr float defaultGainTick = 690. / 640.;
63 
64  this->checkBookAPVColls(iSetup); // check whether APV colls are booked and do so if not yet done
65  this->checkAndRetrieveTopology(iSetup);
66 
67  const auto gainHandle = iSetup.getHandle(gainToken_);
68  if (!gainHandle.isValid()) {
69  edm::LogError("SiStripGainPCLHarvester") << "gainHandle is not valid\n";
70  exit(0);
71  }
72 
73  const auto& stripQuality = iSetup.getData(qualityToken_);
74 
75  for (unsigned int a = 0; a < APVsCollOrdered.size(); a++) {
76  std::shared_ptr<stAPVGain> APV = APVsCollOrdered[a];
77 
79  continue;
80 
81  APV->isMasked = stripQuality.IsApvBad(APV->DetId, APV->APVId);
82 
83  if (gainHandle->getNumberOfTags() != 2) {
84  edm::LogError("SiStripGainPCLHarvester") << "NUMBER OF GAIN TAG IS EXPECTED TO BE 2\n";
85  fflush(stdout);
86  exit(0);
87  };
88  float newPreviousGain = gainHandle->getApvGain(APV->APVId, gainHandle->getRange(APV->DetId, 1), 1);
89  if (APV->PreviousGain != 1 and newPreviousGain != APV->PreviousGain)
90  edm::LogWarning("SiStripGainPCLHarvester") << "WARNING: ParticleGain in the global tag changed\n";
91  APV->PreviousGain = newPreviousGain;
92 
93  float newPreviousGainTick =
94  APV->isMasked ? defaultGainTick : gainHandle->getApvGain(APV->APVId, gainHandle->getRange(APV->DetId, 0), 0);
95  if (APV->PreviousGainTick != 1 and newPreviousGainTick != APV->PreviousGainTick) {
96  edm::LogWarning("SiStripGainPCLHarvester")
97  << "WARNING: TickMarkGain in the global tag changed\n"
98  << std::endl
99  << " APV->SubDet: " << APV->SubDet << " APV->APVId:" << APV->APVId << std::endl
100  << " APV->PreviousGainTick: " << APV->PreviousGainTick << " newPreviousGainTick: " << newPreviousGainTick
101  << std::endl;
102  }
103  APV->PreviousGainTick = newPreviousGainTick;
104  }
105 }

References a, sistrip::APV, APVsCollOrdered, checkAndRetrieveTopology(), checkBookAPVColls(), beamvalidation::exit(), gainToken_, edm::EventSetup::getData(), edm::EventSetup::getHandle(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, qualityToken_, and mps_setup::stdout.

◆ checkAndRetrieveTopology()

void SiStripGainsPCLHarvester::checkAndRetrieveTopology ( const edm::EventSetup setup)
privatevirtual

Definition at line 616 of file SiStripGainsPCLHarvester.cc.

616  {
617  if (!tTopo_) {
618  tTopo_ = &setup.getData(tTopoToken_);
619  }
620 }

References singleTopDQM_cfi::setup, tTopo_, and tTopoToken_.

Referenced by beginRun().

◆ checkBookAPVColls()

void SiStripGainsPCLHarvester::checkBookAPVColls ( const edm::EventSetup setup)
privatevirtual

Definition at line 507 of file SiStripGainsPCLHarvester.cc.

507  {
508  auto newBareTkGeomPtr = &es.getData(tkGeomToken_);
509  if (newBareTkGeomPtr == bareTkGeomPtr_)
510  return; // already filled APVColls, nothing changed
511 
512  if (!bareTkGeomPtr_) { // pointer not yet set: called the first time => fill the APVColls
513  auto const& Det = newBareTkGeomPtr->dets();
514 
515  unsigned int Index = 0;
516 
517  for (unsigned int i = 0; i < Det.size(); i++) {
518  DetId Detid = Det[i]->geographicalId();
519  int SubDet = Detid.subdetId();
520 
523  auto DetUnit = dynamic_cast<const StripGeomDetUnit*>(Det[i]);
524  if (!DetUnit)
525  continue;
526 
527  const StripTopology& Topo = DetUnit->specificTopology();
528  unsigned int NAPV = Topo.nstrips() / 128;
529 
530  for (unsigned int j = 0; j < NAPV; j++) {
531  auto APV = std::make_shared<stAPVGain>();
532  APV->Index = Index;
533  APV->Bin = -1;
534  APV->DetId = Detid.rawId();
535  APV->APVId = j;
536  APV->SubDet = SubDet;
537  APV->FitMPV = -1;
538  APV->FitMPVErr = -1;
539  APV->FitWidth = -1;
540  APV->FitWidthErr = -1;
541  APV->FitChi2 = -1;
542  APV->FitNorm = -1;
543  APV->Gain = -1;
544  APV->PreviousGain = 1;
545  APV->PreviousGainTick = 1;
546  APV->x = DetUnit->position().basicVector().x();
547  APV->y = DetUnit->position().basicVector().y();
548  APV->z = DetUnit->position().basicVector().z();
549  APV->Eta = DetUnit->position().basicVector().eta();
550  APV->Phi = DetUnit->position().basicVector().phi();
551  APV->R = DetUnit->position().basicVector().transverse();
552  APV->Thickness = DetUnit->surface().bounds().thickness();
553  APV->NEntries = 0;
554  APV->isMasked = false;
555 
556  APVsCollOrdered.push_back(APV);
557  APVsColl[(APV->DetId << 4) | APV->APVId] = APV;
558  Index++;
559  NStripAPVs++;
560  } // loop on APVs
561  } // if is Strips
562  } // loop on dets
563 
564  for (unsigned int i = 0; i < Det.size();
565  i++) { //Make two loop such that the Pixel information is added at the end --> make transition simpler
566  DetId Detid = Det[i]->geographicalId();
567  int SubDet = Detid.subdetId();
569  auto DetUnit = dynamic_cast<const PixelGeomDetUnit*>(Det[i]);
570  if (!DetUnit)
571  continue;
572 
573  const PixelTopology& Topo = DetUnit->specificTopology();
574  unsigned int NROCRow = Topo.nrows() / (80.);
575  unsigned int NROCCol = Topo.ncolumns() / (52.);
576 
577  for (unsigned int j = 0; j < NROCRow; j++) {
578  for (unsigned int i = 0; i < NROCCol; i++) {
579  auto APV = std::make_shared<stAPVGain>();
580  APV->Index = Index;
581  APV->Bin = -1;
582  APV->DetId = Detid.rawId();
583  APV->APVId = (j << 3 | i);
584  APV->SubDet = SubDet;
585  APV->FitMPV = -1;
586  APV->FitMPVErr = -1;
587  APV->FitWidth = -1;
588  APV->FitWidthErr = -1;
589  APV->FitChi2 = -1;
590  APV->Gain = -1;
591  APV->PreviousGain = 1;
592  APV->PreviousGainTick = 1;
593  APV->x = DetUnit->position().basicVector().x();
594  APV->y = DetUnit->position().basicVector().y();
595  APV->z = DetUnit->position().basicVector().z();
596  APV->Eta = DetUnit->position().basicVector().eta();
597  APV->Phi = DetUnit->position().basicVector().phi();
598  APV->R = DetUnit->position().basicVector().transverse();
599  APV->Thickness = DetUnit->surface().bounds().thickness();
600  APV->isMasked = false; //SiPixelQuality_->IsModuleBad(Detid.rawId());
601  APV->NEntries = 0;
602 
603  APVsCollOrdered.push_back(APV);
604  APVsColl[(APV->DetId << 4) | APV->APVId] = APV;
605  Index++;
606  NPixelDets++;
607 
608  } // loop on ROC cols
609  } // loop on ROC rows
610  } // if Pixel
611  } // loop on Dets
612  } //if (!bareTkGeomPtr_) ...
613  bareTkGeomPtr_ = newBareTkGeomPtr;
614 }

References sistrip::APV, APVsColl, APVsCollOrdered, bareTkGeomPtr_, edm::EventSetup::getData(), mps_fire::i, dqmiolumiharvest::j, PixelTopology::ncolumns(), NPixelDets, PixelTopology::nrows(), NStripAPVs, StripTopology::nstrips(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, DetId::rawId(), ntupleEnum::SubDet, DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, tkGeomToken_, and StripSubdetector::TOB.

Referenced by beginRun().

◆ dqmEndJob()

void SiStripGainsPCLHarvester::dqmEndJob ( DQMStore::IBooker ibooker_,
DQMStore::IGetter igetter_ 
)
overrideprivatevirtual

Implements DQMEDHarvester.

Definition at line 108 of file SiStripGainsPCLHarvester.cc.

108  {
109  edm::LogInfo("SiStripGainsPCLHarvester") << "Starting harvesting statistics" << std::endl;
110 
111  std::string DQM_dir = m_DQMdir;
112 
113  std::string stag = *(std::find(dqm_tag_.begin(), dqm_tag_.end(), m_calibrationMode));
114  if (!stag.empty() && stag[0] != '_')
115  stag.insert(0, 1, '_');
116 
117  std::string cvi = DQM_dir + std::string("/Charge_Vs_Index") + stag;
118 
119  MonitorElement* Charge_Vs_Index = igetter_.get(cvi);
120 
121  if (Charge_Vs_Index == nullptr) {
122  edm::LogError("SiStripGainsPCLHarvester")
123  << "Harvesting: could not retrieve " << cvi.c_str() << ", statistics will not be summed!" << std::endl;
124  } else {
125  edm::LogInfo("SiStripGainsPCLHarvester")
126  << "Harvesting " << (Charge_Vs_Index)->getTH2S()->GetEntries() << " more clusters" << std::endl;
127  }
128 
129  algoComputeMPVandGain(Charge_Vs_Index);
130  std::unique_ptr<SiStripApvGain> theAPVGains = this->getNewObject(Charge_Vs_Index);
131 
132  // write out the APVGains record
134 
135  if (doStoreOnDB) {
136  if (poolDbService.isAvailable())
137  poolDbService->writeOne(theAPVGains.get(), poolDbService->currentTime(), m_Record);
138  else
139  throw std::runtime_error("PoolDBService required.");
140  } else {
141  edm::LogInfo("SiStripGainsPCLHarvester") << "Will not produce payload!" << std::endl;
142  }
143 
144  //Collect the statistics for monitoring and validation
145  gainQualityMonitor(ibooker_, Charge_Vs_Index);
146 }

References algoComputeMPVandGain(), cond::service::PoolDBOutputService::currentTime(), doStoreOnDB, dqm_tag_, spr::find(), gainQualityMonitor(), dqm::implementation::IGetter::get(), getNewObject(), edm::Service< T >::isAvailable(), m_calibrationMode, m_DQMdir, m_Record, AlCaHLTBitMon_QueryRunRegistry::string, and cond::service::PoolDBOutputService::writeOne().

◆ endRun()

void SiStripGainsPCLHarvester::endRun ( edm::Run const &  run,
edm::EventSetup const &  isetup 
)
override

Definition at line 705 of file SiStripGainsPCLHarvester.cc.

705 {}

◆ fillDescriptions()

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

Definition at line 698 of file SiStripGainsPCLHarvester.cc.

698  {
700  desc.setUnknown();
701  descriptions.addDefault(desc);
702 }

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

◆ gainQualityMonitor()

void SiStripGainsPCLHarvester::gainQualityMonitor ( DQMStore::IBooker ibooker_,
const MonitorElement Charge_Vs_Index 
) const
private

Definition at line 149 of file SiStripGainsPCLHarvester.cc.

150  {
151  ibooker_.setCurrentFolder("AlCaReco/SiStripGainsHarvesting/");
152 
153  std::vector<APVGain::APVmon> new_charge_histos;
154  std::vector<std::pair<std::string, std::string>> cnames =
156  for (unsigned int i = 0; i < cnames.size(); i++) {
157  MonitorElement* monitor = ibooker_.book1DD((cnames[i]).first, (cnames[i]).second.c_str(), 100, 0., 1000.);
158  int thick = APVGain::thickness((cnames[i]).first);
159  int id = APVGain::subdetectorId((cnames[i]).first);
160  int side = APVGain::subdetectorSide((cnames[i]).first);
161  int plane = APVGain::subdetectorPlane((cnames[i]).first);
162  new_charge_histos.push_back(APVGain::APVmon(thick, id, side, plane, monitor));
163  }
164 
165  int MPVbin = 300;
166  float MPVmin = 0.;
167  float MPVmax = 600.;
168 
169  MonitorElement* MPV_Vs_EtaTIB =
170  ibooker_.book2DD("MPVvsEtaTIB", "MPV vs Eta TIB", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
171  MonitorElement* MPV_Vs_EtaTID =
172  ibooker_.book2DD("MPVvsEtaTID", "MPV vs Eta TID", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
173  MonitorElement* MPV_Vs_EtaTOB =
174  ibooker_.book2DD("MPVvsEtaTOB", "MPV vs Eta TOB", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
175  MonitorElement* MPV_Vs_EtaTEC =
176  ibooker_.book2DD("MPVvsEtaTEC", "MPV vs Eta TEC", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
177  MonitorElement* MPV_Vs_EtaTECthin =
178  ibooker_.book2DD("MPVvsEtaTEC1", "MPV vs Eta TEC-thin", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
179  MonitorElement* MPV_Vs_EtaTECthick =
180  ibooker_.book2DD("MPVvsEtaTEC2", "MPV vs Eta TEC-thick", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
181 
182  MonitorElement* MPV_Vs_PhiTIB =
183  ibooker_.book2DD("MPVvsPhiTIB", "MPV vs Phi TIB", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
184  MonitorElement* MPV_Vs_PhiTID =
185  ibooker_.book2DD("MPVvsPhiTID", "MPV vs Phi TID", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
186  MonitorElement* MPV_Vs_PhiTOB =
187  ibooker_.book2DD("MPVvsPhiTOB", "MPV vs Phi TOB", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
188  MonitorElement* MPV_Vs_PhiTEC =
189  ibooker_.book2DD("MPVvsPhiTEC", "MPV vs Phi TEC", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
190  MonitorElement* MPV_Vs_PhiTECthin =
191  ibooker_.book2DD("MPVvsPhiTEC1", "MPV vs Phi TEC-thin ", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
192  MonitorElement* MPV_Vs_PhiTECthick =
193  ibooker_.book2DD("MPVvsPhiTEC2", "MPV vs Phi TEC-thick", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
194 
195  MonitorElement* NoMPVfit = ibooker_.book2DD("NoMPVfit", "Modules with bad Landau Fit", 350, -350, 350, 240, 0, 120);
196  MonitorElement* NoMPVmasked = ibooker_.book2DD("NoMPVmasked", "Masked Modules", 350, -350, 350, 240, 0, 120);
197 
198  MonitorElement* Gains = ibooker_.book1DD("Gains", "Gains", 300, 0, 2);
199  MonitorElement* MPVs = ibooker_.book1DD("MPVs", "MPVs", MPVbin, MPVmin, MPVmax);
200  MonitorElement* MPVs320 = ibooker_.book1DD("MPV_320", "MPV 320 thickness", MPVbin, MPVmin, MPVmax);
201  MonitorElement* MPVs500 = ibooker_.book1DD("MPV_500", "MPV 500 thickness", MPVbin, MPVmin, MPVmax);
202  MonitorElement* MPVsTIB = ibooker_.book1DD("MPV_TIB", "MPV TIB", MPVbin, MPVmin, MPVmax);
203  MonitorElement* MPVsTID = ibooker_.book1DD("MPV_TID", "MPV TID", MPVbin, MPVmin, MPVmax);
204  MonitorElement* MPVsTIDP = ibooker_.book1DD("MPV_TIDP", "MPV TIDP", MPVbin, MPVmin, MPVmax);
205  MonitorElement* MPVsTIDM = ibooker_.book1DD("MPV_TIDM", "MPV TIDM", MPVbin, MPVmin, MPVmax);
206  MonitorElement* MPVsTOB = ibooker_.book1DD("MPV_TOB", "MPV TOB", MPVbin, MPVmin, MPVmax);
207  MonitorElement* MPVsTEC = ibooker_.book1DD("MPV_TEC", "MPV TEC", MPVbin, MPVmin, MPVmax);
208  MonitorElement* MPVsTECP = ibooker_.book1DD("MPV_TECP", "MPV TECP", MPVbin, MPVmin, MPVmax);
209  MonitorElement* MPVsTECM = ibooker_.book1DD("MPV_TECM", "MPV TECM", MPVbin, MPVmin, MPVmax);
210  MonitorElement* MPVsTECthin = ibooker_.book1DD("MPV_TEC1", "MPV TEC thin", MPVbin, MPVmin, MPVmax);
211  MonitorElement* MPVsTECthick = ibooker_.book1DD("MPV_TEC2", "MPV TEC thick", MPVbin, MPVmin, MPVmax);
212  MonitorElement* MPVsTECP1 = ibooker_.book1DD("MPV_TECP1", "MPV TECP thin ", MPVbin, MPVmin, MPVmax);
213  MonitorElement* MPVsTECP2 = ibooker_.book1DD("MPV_TECP2", "MPV TECP thick", MPVbin, MPVmin, MPVmax);
214  MonitorElement* MPVsTECM1 = ibooker_.book1DD("MPV_TECM1", "MPV TECM thin", MPVbin, MPVmin, MPVmax);
215  MonitorElement* MPVsTECM2 = ibooker_.book1DD("MPV_TECM2", "MPV TECM thick", MPVbin, MPVmin, MPVmax);
216 
217  MonitorElement* MPVError = ibooker_.book1DD("MPVError", "MPV Error", 150, 0, 150);
218  MonitorElement* MPVErrorVsMPV = ibooker_.book2DD("MPVErrorVsMPV", "MPV Error vs MPV", 300, 0, 600, 150, 0, 150);
219  MonitorElement* MPVErrorVsEta = ibooker_.book2DD("MPVErrorVsEta", "MPV Error vs Eta", 50, -3.0, 3.0, 150, 0, 150);
220  MonitorElement* MPVErrorVsPhi = ibooker_.book2DD("MPVErrorVsPhi", "MPV Error vs Phi", 50, -3.4, 3.4, 150, 0, 150);
221  MonitorElement* MPVErrorVsN = ibooker_.book2DD("MPVErrorVsN", "MPV Error vs N", 500, 0, 1000, 150, 0, 150);
222 
223  MonitorElement* DiffWRTPrevGainTIB = ibooker_.book1DD("DiffWRTPrevGainTIB", "Diff w.r.t. PrevGain TIB", 250, 0, 2);
224  MonitorElement* DiffWRTPrevGainTID = ibooker_.book1DD("DiffWRTPrevGainTID", "Diff w.r.t. PrevGain TID", 250, 0, 2);
225  MonitorElement* DiffWRTPrevGainTOB = ibooker_.book1DD("DiffWRTPrevGainTOB", "Diff w.r.t. PrevGain TOB", 250, 0, 2);
226  MonitorElement* DiffWRTPrevGainTEC = ibooker_.book1DD("DiffWRTPrevGainTEC", "Diff w.r.t. PrevGain TEC", 250, 0, 2);
227 
228  MonitorElement* GainVsPrevGainTIB =
229  ibooker_.book2DD("GainVsPrevGainTIB", "Gain vs PrevGain TIB", 100, 0, 2, 100, 0, 2);
230  MonitorElement* GainVsPrevGainTID =
231  ibooker_.book2DD("GainVsPrevGainTID", "Gain vs PrevGain TID", 100, 0, 2, 100, 0, 2);
232  MonitorElement* GainVsPrevGainTOB =
233  ibooker_.book2DD("GainVsPrevGainTOB", "Gain vs PrevGain TOB", 100, 0, 2, 100, 0, 2);
234  MonitorElement* GainVsPrevGainTEC =
235  ibooker_.book2DD("GainVsPrevGainTEC", "Gain vs PrevGain TEC", 100, 0, 2, 100, 0, 2);
236 
237  for (unsigned int a = 0; a < APVsCollOrdered.size(); a++) {
238  std::shared_ptr<stAPVGain> APV = APVsCollOrdered[a];
239  if (APV == nullptr)
240  continue;
241 
242  unsigned int Index = APV->Index;
243  unsigned int SubDet = APV->SubDet;
244  unsigned int DetId = APV->DetId;
245  float z = APV->z;
246  float Eta = APV->Eta;
247  float R = APV->R;
248  float Phi = APV->Phi;
249  float Thickness = APV->Thickness;
250  double FitMPV = APV->FitMPV;
251  double FitMPVErr = APV->FitMPVErr;
252  double Gain = APV->Gain;
253  double NEntries = APV->NEntries;
254  double PreviousGain = APV->PreviousGain;
255 
256  if (SubDet < 3)
257  continue; // avoid to loop over Pixel det id
258 
259  if (Gain != 1.) {
260  std::vector<MonitorElement*> charge_histos = APVGain::FetchMonitor(new_charge_histos, DetId, tTopo_);
261  TH2S* chvsidx = (Charge_Vs_Index)->getTH2S();
262  int bin = chvsidx->GetXaxis()->FindBin(Index);
263  TH1D* Proj = chvsidx->ProjectionY("proj", bin, bin);
264  for (int binId = 0; binId < Proj->GetXaxis()->GetNbins(); binId++) {
265  double new_charge = Proj->GetXaxis()->GetBinCenter(binId) / Gain;
266  if (Proj->GetBinContent(binId) != 0.) {
267  for (unsigned int h = 0; h < charge_histos.size(); h++) {
268  TH1D* chisto = (charge_histos[h])->getTH1D();
269  for (int e = 0; e < Proj->GetBinContent(binId); e++)
270  chisto->Fill(new_charge);
271  }
272  }
273  }
274  }
275 
276  if (FitMPV <= 0.) { // No fit of MPV
277  if (APV->isMasked)
278  NoMPVmasked->Fill(z, R);
279  else
280  NoMPVfit->Fill(z, R);
281 
282  } else { // Fit of MPV
283  if (FitMPV > 0.)
284  Gains->Fill(Gain);
285 
286  MPVs->Fill(FitMPV);
287  if (Thickness < 0.04)
288  MPVs320->Fill(FitMPV);
289  if (Thickness > 0.04)
290  MPVs500->Fill(FitMPV);
291 
292  MPVError->Fill(FitMPVErr);
293  MPVErrorVsMPV->Fill(FitMPV, FitMPVErr);
294  MPVErrorVsEta->Fill(Eta, FitMPVErr);
295  MPVErrorVsPhi->Fill(Phi, FitMPVErr);
296  MPVErrorVsN->Fill(NEntries, FitMPVErr);
297 
298  if (SubDet == 3) {
299  MPV_Vs_EtaTIB->Fill(Eta, FitMPV);
300  MPV_Vs_PhiTIB->Fill(Phi, FitMPV);
301  MPVsTIB->Fill(FitMPV);
302 
303  } else if (SubDet == 4) {
304  MPV_Vs_EtaTID->Fill(Eta, FitMPV);
305  MPV_Vs_PhiTID->Fill(Phi, FitMPV);
306  MPVsTID->Fill(FitMPV);
307  if (Eta < 0.)
308  MPVsTIDM->Fill(FitMPV);
309  if (Eta > 0.)
310  MPVsTIDP->Fill(FitMPV);
311 
312  } else if (SubDet == 5) {
313  MPV_Vs_EtaTOB->Fill(Eta, FitMPV);
314  MPV_Vs_PhiTOB->Fill(Phi, FitMPV);
315  MPVsTOB->Fill(FitMPV);
316 
317  } else if (SubDet == 6) {
318  MPV_Vs_EtaTEC->Fill(Eta, FitMPV);
319  MPV_Vs_PhiTEC->Fill(Phi, FitMPV);
320  MPVsTEC->Fill(FitMPV);
321  if (Eta < 0.)
322  MPVsTECM->Fill(FitMPV);
323  if (Eta > 0.)
324  MPVsTECP->Fill(FitMPV);
325  if (Thickness < 0.04) {
326  MPV_Vs_EtaTECthin->Fill(Eta, FitMPV);
327  MPV_Vs_PhiTECthin->Fill(Phi, FitMPV);
328  MPVsTECthin->Fill(FitMPV);
329  if (Eta > 0.)
330  MPVsTECP1->Fill(FitMPV);
331  if (Eta < 0.)
332  MPVsTECM1->Fill(FitMPV);
333  }
334  if (Thickness > 0.04) {
335  MPV_Vs_EtaTECthick->Fill(Eta, FitMPV);
336  MPV_Vs_PhiTECthick->Fill(Phi, FitMPV);
337  MPVsTECthick->Fill(FitMPV);
338  if (Eta > 0.)
339  MPVsTECP2->Fill(FitMPV);
340  if (Eta < 0.)
341  MPVsTECM2->Fill(FitMPV);
342  }
343  }
344  }
345 
346  if (SubDet == 3 && PreviousGain != 0.)
347  DiffWRTPrevGainTIB->Fill(Gain / PreviousGain);
348  else if (SubDet == 4 && PreviousGain != 0.)
349  DiffWRTPrevGainTID->Fill(Gain / PreviousGain);
350  else if (SubDet == 5 && PreviousGain != 0.)
351  DiffWRTPrevGainTOB->Fill(Gain / PreviousGain);
352  else if (SubDet == 6 && PreviousGain != 0.)
353  DiffWRTPrevGainTEC->Fill(Gain / PreviousGain);
354 
355  if (SubDet == 3)
356  GainVsPrevGainTIB->Fill(PreviousGain, Gain);
357  else if (SubDet == 4)
358  GainVsPrevGainTID->Fill(PreviousGain, Gain);
359  else if (SubDet == 5)
360  GainVsPrevGainTOB->Fill(PreviousGain, Gain);
361  else if (SubDet == 6)
362  GainVsPrevGainTEC->Fill(PreviousGain, Gain);
363  }
364 }

References a, sistrip::APV, APVsCollOrdered, newFWLiteAna::bin, dqm::implementation::IBooker::book1DD(), dqm::implementation::IBooker::book2DD(), doChargeMonitorPerPlane, MillePedeFileConverter_cfg::e, APVGain::FetchMonitor(), dqm::impl::MonitorElement::Fill(), first, IntegrityClient_cfi::Gain, h, mps_fire::i, APVGain::monHnames(), beam_dqm_sourceclient-live_cfg::monitor, VtxSmearedParameters_cfi::Phi, dttmaxenums::R, edm::second(), dqm::implementation::NavigatorBase::setCurrentFolder(), ntupleEnum::SubDet, APVGain::subdetectorId(), APVGain::subdetectorPlane(), APVGain::subdetectorSide(), APVGain::thickness(), tTopo_, VChargeHisto, and z.

Referenced by dqmEndJob().

◆ getNewObject()

std::unique_ptr< SiStripApvGain > SiStripGainsPCLHarvester::getNewObject ( const MonitorElement Charge_Vs_Index)
private

Definition at line 652 of file SiStripGainsPCLHarvester.cc.

652  {
653  std::unique_ptr<SiStripApvGain> obj = std::make_unique<SiStripApvGain>();
654 
655  if (!produceTagFilter(Charge_Vs_Index)) {
656  edm::LogWarning("SiStripGainsPCLHarvester")
657  << "getNewObject -> will not produce a paylaod because produceTagFilter returned false " << std::endl;
658  return obj;
659  } else {
660  doStoreOnDB = true;
661  }
662 
663  std::vector<float> theSiStripVector;
664  unsigned int PreviousDetId = 0;
665  for (unsigned int a = 0; a < APVsCollOrdered.size(); a++) {
666  std::shared_ptr<stAPVGain> APV = APVsCollOrdered[a];
667  if (APV == nullptr) {
668  printf("Bug\n");
669  continue;
670  }
671  if (APV->SubDet <= 2)
672  continue;
673  if (APV->DetId != PreviousDetId) {
674  if (!theSiStripVector.empty()) {
675  SiStripApvGain::Range range(theSiStripVector.begin(), theSiStripVector.end());
676  if (!obj->put(PreviousDetId, range))
677  printf("Bug to put detId = %i\n", PreviousDetId);
678  }
679  theSiStripVector.clear();
680  PreviousDetId = APV->DetId;
681  }
682  theSiStripVector.push_back(APV->Gain);
683 
684  LogDebug("SiStripGainsPCLHarvester") << " DetId: " << APV->DetId << " APV: " << APV->APVId
685  << " Gain: " << APV->Gain << std::endl;
686  }
687  if (!theSiStripVector.empty()) {
688  SiStripApvGain::Range range(theSiStripVector.begin(), theSiStripVector.end());
689  if (!obj->put(PreviousDetId, range))
690  printf("Bug to put detId = %i\n", PreviousDetId);
691  }
692 
693  return obj;
694 }

References a, sistrip::APV, APVsCollOrdered, doStoreOnDB, LogDebug, getGTfromDQMFile::obj, produceTagFilter(), and FastTimerService_cff::range.

Referenced by dqmEndJob().

◆ getPeakOfLandau()

void SiStripGainsPCLHarvester::getPeakOfLandau ( TH1 *  InputHisto,
double *  FitResults,
double  LowRange = 50,
double  HighRange = 5400 
)
private

Definition at line 471 of file SiStripGainsPCLHarvester.cc.

471  {
472  FitResults[0] = -0.5; //MPV
473  FitResults[1] = 0; //MPV error
474  FitResults[2] = -0.5; //Width
475  FitResults[3] = 0; //Width error
476  FitResults[4] = -0.5; //Fit Chi2/NDF
477  FitResults[5] = 0; //Normalization
478 
479  if (InputHisto->GetEntries() < MinNrEntries)
480  return;
481 
482  // perform fit with standard landau
483  TF1 MyLandau("MyLandau", "landau", LowRange, HighRange);
484  MyLandau.SetParameter(1, 300);
485  InputHisto->Fit(&MyLandau, "0QR WW");
486 
487  // MPV is parameter 1 (0=constant, 1=MPV, 2=Sigma)
488  FitResults[0] = MyLandau.GetParameter(1); //MPV
489  FitResults[1] = MyLandau.GetParError(1); //MPV error
490  FitResults[2] = MyLandau.GetParameter(2); //Width
491  FitResults[3] = MyLandau.GetParError(2); //Width error
492  FitResults[4] = MyLandau.GetChisquare() / MyLandau.GetNDF(); //Fit Chi2/NDF
493  FitResults[5] = MyLandau.GetParameter(0);
494 }

References MinNrEntries.

Referenced by algoComputeMPVandGain().

◆ IsGoodLandauFit()

bool SiStripGainsPCLHarvester::IsGoodLandauFit ( double *  FitResults)
private

Definition at line 497 of file SiStripGainsPCLHarvester.cc.

497  {
498  if (FitResults[0] <= 0)
499  return false;
500  // if(FitResults[1] > MaxMPVError )return false;
501  // if(FitResults[4] > MaxChi2OverNDF)return false;
502  return true;
503 }

Referenced by algoComputeMPVandGain().

◆ produceTagFilter()

bool SiStripGainsPCLHarvester::produceTagFilter ( const MonitorElement Charge_Vs_Index)
private

Definition at line 623 of file SiStripGainsPCLHarvester.cc.

623  {
624  // The goal of this function is to check wether or not there is enough statistics
625  // to produce a meaningful tag for the DB
626 
627  if (Charge_Vs_Index == nullptr) {
628  edm::LogError("SiStripGainsPCLHarvester")
629  << "produceTagFilter -> Return false: could not retrieve the " << m_calibrationMode << " statistics.\n"
630  << "Please check if input contains " << m_calibrationMode << " data." << std::endl;
631  return false;
632  }
633 
634  float integral = (Charge_Vs_Index)->getTH2S()->Integral();
635  if ((Charge_Vs_Index)->getTH2S()->Integral(0, NStripAPVs + 1, 0, 99999) < tagCondition_NClusters) {
636  edm::LogWarning("SiStripGainsPCLHarvester")
637  << "calibrationMode -> " << m_calibrationMode << "\n"
638  << "produceTagFilter -> Return false: Statistics is too low : " << integral << std::endl;
639  return false;
640  }
641  if ((1.0 * GOOD) / (GOOD + BAD) < tagCondition_GoodFrac) {
642  edm::LogWarning("SiStripGainsPCLHarvester")
643  << "calibrationMode -> " << m_calibrationMode << "\n"
644  << "produceTagFilter -> Return false: ratio of GOOD/TOTAL is too low: " << (1.0 * GOOD) / (GOOD + BAD)
645  << std::endl;
646  return false;
647  }
648  return true;
649 }

References BAD, GOOD, funct::integral(), m_calibrationMode, NStripAPVs, tagCondition_GoodFrac, and tagCondition_NClusters.

Referenced by getNewObject().

◆ statCollectionFromMode()

int SiStripGainsPCLHarvester::statCollectionFromMode ( const char *  tag) const
private

Member Data Documentation

◆ APVsColl

std::unordered_map<unsigned int, std::shared_ptr<stAPVGain> > SiStripGainsPCLHarvester::APVsColl
private

Definition at line 100 of file SiStripGainsPCLHarvester.h.

Referenced by algoComputeMPVandGain(), and checkBookAPVColls().

◆ APVsCollOrdered

std::vector<std::shared_ptr<stAPVGain> > SiStripGainsPCLHarvester::APVsCollOrdered
private

◆ BAD

unsigned int SiStripGainsPCLHarvester::BAD
private

Definition at line 76 of file SiStripGainsPCLHarvester.h.

Referenced by algoComputeMPVandGain(), and produceTagFilter().

◆ bareTkGeomPtr_

const TrackerGeometry* SiStripGainsPCLHarvester::bareTkGeomPtr_ = nullptr
private

Definition at line 96 of file SiStripGainsPCLHarvester.h.

Referenced by checkBookAPVColls().

◆ CalibrationLevel

int SiStripGainsPCLHarvester::CalibrationLevel
private

Definition at line 94 of file SiStripGainsPCLHarvester.h.

Referenced by algoComputeMPVandGain(), and SiStripGainsPCLHarvester().

◆ doChargeMonitorPerPlane

bool SiStripGainsPCLHarvester::doChargeMonitorPerPlane
private

Charge monitor per detector plane

Definition at line 74 of file SiStripGainsPCLHarvester.h.

Referenced by gainQualityMonitor(), and SiStripGainsPCLHarvester().

◆ doStoreOnDB

bool SiStripGainsPCLHarvester::doStoreOnDB
private

Definition at line 73 of file SiStripGainsPCLHarvester.h.

Referenced by dqmEndJob(), and getNewObject().

◆ dqm_tag_

std::vector<std::string> SiStripGainsPCLHarvester::dqm_tag_
private

Definition at line 92 of file SiStripGainsPCLHarvester.h.

Referenced by dqmEndJob(), and SiStripGainsPCLHarvester().

◆ gainToken_

edm::ESGetToken<SiStripGain, SiStripGainRcd> SiStripGainsPCLHarvester::gainToken_
private

Definition at line 104 of file SiStripGainsPCLHarvester.h.

Referenced by beginRun(), and SiStripGainsPCLHarvester().

◆ GOOD

unsigned int SiStripGainsPCLHarvester::GOOD
private

Definition at line 75 of file SiStripGainsPCLHarvester.h.

Referenced by algoComputeMPVandGain(), and produceTagFilter().

◆ m_calibrationMode

std::string SiStripGainsPCLHarvester::m_calibrationMode
private

Type of statistics for the calibration

Definition at line 89 of file SiStripGainsPCLHarvester.h.

Referenced by algoComputeMPVandGain(), dqmEndJob(), produceTagFilter(), and SiStripGainsPCLHarvester().

◆ m_DQMdir

std::string SiStripGainsPCLHarvester::m_DQMdir
private

DQM folder hosting the charge statistics and the monitor plots

Definition at line 88 of file SiStripGainsPCLHarvester.h.

Referenced by dqmEndJob(), and SiStripGainsPCLHarvester().

◆ m_Record

std::string SiStripGainsPCLHarvester::m_Record
private

Definition at line 86 of file SiStripGainsPCLHarvester.h.

Referenced by dqmEndJob(), and SiStripGainsPCLHarvester().

◆ MASKED

unsigned int SiStripGainsPCLHarvester::MASKED
private

Definition at line 77 of file SiStripGainsPCLHarvester.h.

Referenced by algoComputeMPVandGain().

◆ MinNrEntries

double SiStripGainsPCLHarvester::MinNrEntries
private

Definition at line 84 of file SiStripGainsPCLHarvester.h.

Referenced by getPeakOfLandau(), and SiStripGainsPCLHarvester().

◆ NPixelDets

int SiStripGainsPCLHarvester::NPixelDets
private

Definition at line 83 of file SiStripGainsPCLHarvester.h.

Referenced by checkBookAPVColls().

◆ NStripAPVs

int SiStripGainsPCLHarvester::NStripAPVs
private

Definition at line 82 of file SiStripGainsPCLHarvester.h.

Referenced by checkBookAPVColls(), and produceTagFilter().

◆ qualityToken_

edm::ESGetToken<SiStripQuality, SiStripQualityRcd> SiStripGainsPCLHarvester::qualityToken_
private

Definition at line 105 of file SiStripGainsPCLHarvester.h.

Referenced by beginRun(), and SiStripGainsPCLHarvester().

◆ tagCondition_GoodFrac

double SiStripGainsPCLHarvester::tagCondition_GoodFrac
private

Definition at line 80 of file SiStripGainsPCLHarvester.h.

Referenced by produceTagFilter(), and SiStripGainsPCLHarvester().

◆ tagCondition_NClusters

double SiStripGainsPCLHarvester::tagCondition_NClusters
private

Definition at line 79 of file SiStripGainsPCLHarvester.h.

Referenced by produceTagFilter(), and SiStripGainsPCLHarvester().

◆ tkGeomToken_

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

Definition at line 103 of file SiStripGainsPCLHarvester.h.

Referenced by checkBookAPVColls(), and SiStripGainsPCLHarvester().

◆ tTopo_

const TrackerTopology* SiStripGainsPCLHarvester::tTopo_ = nullptr
private

Definition at line 97 of file SiStripGainsPCLHarvester.h.

Referenced by checkAndRetrieveTopology(), and gainQualityMonitor().

◆ tTopoToken_

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SiStripGainsPCLHarvester::tTopoToken_
private

◆ VChargeHisto

std::vector<std::string> SiStripGainsPCLHarvester::VChargeHisto
private

Charge monitor plots to be output

Definition at line 90 of file SiStripGainsPCLHarvester.h.

Referenced by gainQualityMonitor(), and SiStripGainsPCLHarvester().

SiStripGainsPCLHarvester::gainQualityMonitor
void gainQualityMonitor(DQMStore::IBooker &ibooker_, const MonitorElement *Charge_Vs_Index) const
Definition: SiStripGainsPCLHarvester.cc:149
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
mps_fire.i
i
Definition: mps_fire.py:428
SiStripGainsPCLHarvester::tTopo_
const TrackerTopology * tTopo_
Definition: SiStripGainsPCLHarvester.h:97
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
SiStripGainsPCLHarvester::dqm_tag_
std::vector< std::string > dqm_tag_
Definition: SiStripGainsPCLHarvester.h:92
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
SiStripGainsPCLHarvester::m_calibrationMode
std::string m_calibrationMode
Definition: SiStripGainsPCLHarvester.h:89
SiStripGainsPCLHarvester::produceTagFilter
bool produceTagFilter(const MonitorElement *Charge_Vs_Index)
Definition: SiStripGainsPCLHarvester.cc:623
edm
HLT enums.
Definition: AlignableModifier.h:19
SiStripGainsPCLHarvester::MASKED
unsigned int MASKED
Definition: SiStripGainsPCLHarvester.h:77
h
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition: L1TUtmAlgorithmRcd.h:4
SiStripGainsPCLHarvester::APVsColl
std::unordered_map< unsigned int, std::shared_ptr< stAPVGain > > APVsColl
Definition: SiStripGainsPCLHarvester.h:100
SiStripGainsPCLHarvester::bareTkGeomPtr_
const TrackerGeometry * bareTkGeomPtr_
Definition: SiStripGainsPCLHarvester.h:96
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
SiStripGainsPCLHarvester::tkGeomToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
Definition: SiStripGainsPCLHarvester.h:103
SiStripGainsPCLHarvester::NStripAPVs
int NStripAPVs
Definition: SiStripGainsPCLHarvester.h:82
SiStripGainsPCLHarvester::APVsCollOrdered
std::vector< std::shared_ptr< stAPVGain > > APVsCollOrdered
Definition: SiStripGainsPCLHarvester.h:99
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
IntegrityClient_cfi.Gain
Gain
Definition: IntegrityClient_cfi.py:16
APVGain::APVmon
Definition: APVGainHelpers.h:30
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
APVGain::subdetectorPlane
int subdetectorPlane(uint32_t, const TrackerTopology *)
Definition: APVGainHelpers.cc:119
SiStripGainsPCLHarvester::tagCondition_NClusters
double tagCondition_NClusters
Definition: SiStripGainsPCLHarvester.h:79
SiStripGainsPCLHarvester::NPixelDets
int NPixelDets
Definition: SiStripGainsPCLHarvester.h:83
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
SiStripGainsPCLHarvester::qualityToken_
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > qualityToken_
Definition: SiStripGainsPCLHarvester.h:105
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
SiStripGainsPCLHarvester::MinNrEntries
double MinNrEntries
Definition: SiStripGainsPCLHarvester.h:84
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
DetId
Definition: DetId.h:17
h
SiStripGainsPCLHarvester::BAD
unsigned int BAD
Definition: SiStripGainsPCLHarvester.h:76
Exhume::I
const std::complex< double > I
Definition: I.h:8
funct::integral
Integral< F, X >::type integral(const F &f)
Definition: Integral.h:70
ntupleEnum.SubDet
SubDet
Definition: ntupleEnum.py:15
SiStripGainsPCLHarvester::tTopoToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
Definition: SiStripGainsPCLHarvester.h:102
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
SiStripGainsPCLHarvester::VChargeHisto
std::vector< std::string > VChargeHisto
Definition: SiStripGainsPCLHarvester.h:90
DDAxes::z
PixelTopology::ncolumns
virtual int ncolumns() const =0
StripSubdetector::TIB
static constexpr auto TIB
Definition: StripSubdetector.h:16
VtxSmearedParameters_cfi.Phi
Phi
Definition: VtxSmearedParameters_cfi.py:112
SiStripGainsPCLHarvester::getPeakOfLandau
void getPeakOfLandau(TH1 *InputHisto, double *FitResults, double LowRange=50, double HighRange=5400)
Definition: SiStripGainsPCLHarvester.cc:471
SiStripGainsPCLHarvester::checkAndRetrieveTopology
virtual void checkAndRetrieveTopology(const edm::EventSetup &setup)
Definition: SiStripGainsPCLHarvester.cc:616
PixelTopology
Definition: PixelTopology.h:10
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
dqm::implementation::IBooker::book1DD
MonitorElement * book1DD(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:155
SiStripGainsPCLHarvester::getNewObject
std::unique_ptr< SiStripApvGain > getNewObject(const MonitorElement *Charge_Vs_Index)
Definition: SiStripGainsPCLHarvester.cc:652
dqm::implementation::IBooker::book2DD
MonitorElement * book2DD(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:261
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
a
double a
Definition: hdecay.h:119
APVGain::subdetectorSide
int subdetectorSide(uint32_t, const TrackerTopology *)
Definition: APVGainHelpers.cc:49
SiStripGainsPCLHarvester::checkBookAPVColls
virtual void checkBookAPVColls(const edm::EventSetup &setup)
Definition: SiStripGainsPCLHarvester.cc:507
mps_setup.stdout
stdout
Definition: mps_setup.py:250
beam_dqm_sourceclient-live_cfg.monitor
monitor
Definition: beam_dqm_sourceclient-live_cfg.py:242
APVGain::FetchMonitor
std::vector< MonitorElement * > FetchMonitor(std::vector< APVmon >, uint32_t, const TrackerTopology *topo=nullptr)
Definition: APVGainHelpers.cc:151
SiStripGainsPCLHarvester::CalibrationLevel
int CalibrationLevel
Definition: SiStripGainsPCLHarvester.h:94
sistrip::APV
Definition: ConstantsForGranularity.h:79
edm::Service< cond::service::PoolDBOutputService >
SiStripGainsPCLHarvester::gainToken_
edm::ESGetToken< SiStripGain, SiStripGainRcd > gainToken_
Definition: SiStripGainsPCLHarvester.h:104
APVGain::thickness
int thickness(uint32_t)
Definition: APVGainHelpers.cc:76
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
StripTopology::nstrips
virtual int nstrips() const =0
SiStripGainsPCLHarvester::doStoreOnDB
bool doStoreOnDB
Definition: SiStripGainsPCLHarvester.h:73
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
StripSubdetector::TEC
static constexpr auto TEC
Definition: StripSubdetector.h:19
SiStripGainsPCLHarvester::m_DQMdir
std::string m_DQMdir
Definition: SiStripGainsPCLHarvester.h:88
SiStripApvGain::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripApvGain.h:28
cond::service::PoolDBOutputService::writeOne
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
Definition: PoolDBOutputService.h:63
SiStripGainsPCLHarvester::IsGoodLandauFit
bool IsGoodLandauFit(double *FitResults)
Definition: SiStripGainsPCLHarvester.cc:497
StripSubdetector::TOB
static constexpr auto TOB
Definition: StripSubdetector.h:18
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:651
SiStripGainsPCLHarvester::algoComputeMPVandGain
void algoComputeMPVandGain(const MonitorElement *Charge_Vs_Index)
Definition: SiStripGainsPCLHarvester.cc:367
APVGain::monHnames
std::vector< std::pair< std::string, std::string > > monHnames(std::vector< std::string >, bool, const char *tag)
Definition: APVGainHelpers.cc:215
SiStripGainsPCLHarvester::doChargeMonitorPerPlane
bool doChargeMonitorPerPlane
Definition: SiStripGainsPCLHarvester.h:74
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53
GeometricSearchDet
Definition: GeometricSearchDet.h:17
SiStripGainsPCLHarvester::m_Record
std::string m_Record
Definition: SiStripGainsPCLHarvester.h:86
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
PixelTopology::nrows
virtual int nrows() const =0
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
SiStripGainsPCLHarvester::tagCondition_GoodFrac
double tagCondition_GoodFrac
Definition: SiStripGainsPCLHarvester.h:80
SiStripGainsPCLHarvester::GOOD
unsigned int GOOD
Definition: SiStripGainsPCLHarvester.h:75
dttmaxenums::R
Definition: DTTMax.h:29
StripTopology
Definition: StripTopology.h:11
cond::service::PoolDBOutputService::currentTime
cond::Time_t currentTime() const
Definition: PoolDBOutputService.cc:217
StripSubdetector::TID
static constexpr auto TID
Definition: StripSubdetector.h:17
APVGain::subdetectorId
int subdetectorId(uint32_t)
Definition: APVGainHelpers.cc:16
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37