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
 
 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 &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 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_
 
std::unique_ptr< TrackerTopologytTopo_
 
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::EndRun>();
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 369 of file SiStripGainsPCLHarvester.cc.

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

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 
66  const auto gainHandle = iSetup.getHandle(gainToken_);
67  if (!gainHandle.isValid()) {
68  edm::LogError("SiStripGainPCLHarvester") << "gainHandle is not valid\n";
69  exit(0);
70  }
71 
72  const auto& stripQuality = iSetup.getData(qualityToken_);
73 
74  for (unsigned int a = 0; a < APVsCollOrdered.size(); a++) {
75  std::shared_ptr<stAPVGain> APV = APVsCollOrdered[a];
76 
78  continue;
79 
80  APV->isMasked = stripQuality.IsApvBad(APV->DetId, APV->APVId);
81 
82  if (gainHandle->getNumberOfTags() != 2) {
83  edm::LogError("SiStripGainPCLHarvester") << "NUMBER OF GAIN TAG IS EXPECTED TO BE 2\n";
84  fflush(stdout);
85  exit(0);
86  };
87  float newPreviousGain = gainHandle->getApvGain(APV->APVId, gainHandle->getRange(APV->DetId, 1), 1);
88  if (APV->PreviousGain != 1 and newPreviousGain != APV->PreviousGain)
89  edm::LogWarning("SiStripGainPCLHarvester") << "WARNING: ParticleGain in the global tag changed\n";
90  APV->PreviousGain = newPreviousGain;
91 
92  float newPreviousGainTick =
93  APV->isMasked ? defaultGainTick : gainHandle->getApvGain(APV->APVId, gainHandle->getRange(APV->DetId, 0), 0);
94  if (APV->PreviousGainTick != 1 and newPreviousGainTick != APV->PreviousGainTick) {
95  edm::LogWarning("SiStripGainPCLHarvester")
96  << "WARNING: TickMarkGain in the global tag changed\n"
97  << std::endl
98  << " APV->SubDet: " << APV->SubDet << " APV->APVId:" << APV->APVId << std::endl
99  << " APV->PreviousGainTick: " << APV->PreviousGainTick << " newPreviousGainTick: " << newPreviousGainTick
100  << std::endl;
101  }
102  APV->PreviousGainTick = newPreviousGainTick;
103  }
104 }

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

◆ checkBookAPVColls()

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

Definition at line 509 of file SiStripGainsPCLHarvester.cc.

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

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 107 of file SiStripGainsPCLHarvester.cc.

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

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 701 of file SiStripGainsPCLHarvester.cc.

701  {
702  if (!tTopo_) {
703  tTopo_ = std::make_unique<TrackerTopology>(isetup.getData(tTopoToken_));
704  }
705 }

References edm::EventSetup::getData(), tTopo_, and tTopoToken_.

◆ fillDescriptions()

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

Definition at line 694 of file SiStripGainsPCLHarvester.cc.

694  {
696  desc.setUnknown();
697  descriptions.addDefault(desc);
698 }

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

◆ gainQualityMonitor()

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

Definition at line 148 of file SiStripGainsPCLHarvester.cc.

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

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 648 of file SiStripGainsPCLHarvester.cc.

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

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 473 of file SiStripGainsPCLHarvester.cc.

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

References MinNrEntries.

Referenced by algoComputeMPVandGain().

◆ IsGoodLandauFit()

bool SiStripGainsPCLHarvester::IsGoodLandauFit ( double *  FitResults)
private

Definition at line 499 of file SiStripGainsPCLHarvester.cc.

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

Referenced by algoComputeMPVandGain().

◆ produceTagFilter()

bool SiStripGainsPCLHarvester::produceTagFilter ( const MonitorElement Charge_Vs_Index)
private

Definition at line 619 of file SiStripGainsPCLHarvester.cc.

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

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 99 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 75 of file SiStripGainsPCLHarvester.h.

Referenced by algoComputeMPVandGain(), and produceTagFilter().

◆ bareTkGeomPtr_

const TrackerGeometry* SiStripGainsPCLHarvester::bareTkGeomPtr_ = nullptr
private

Definition at line 95 of file SiStripGainsPCLHarvester.h.

Referenced by checkBookAPVColls().

◆ CalibrationLevel

int SiStripGainsPCLHarvester::CalibrationLevel
private

Definition at line 93 of file SiStripGainsPCLHarvester.h.

Referenced by algoComputeMPVandGain(), and SiStripGainsPCLHarvester().

◆ doChargeMonitorPerPlane

bool SiStripGainsPCLHarvester::doChargeMonitorPerPlane
private

Charge monitor per detector plane

Definition at line 73 of file SiStripGainsPCLHarvester.h.

Referenced by gainQualityMonitor(), and SiStripGainsPCLHarvester().

◆ doStoreOnDB

bool SiStripGainsPCLHarvester::doStoreOnDB
private

Definition at line 72 of file SiStripGainsPCLHarvester.h.

Referenced by dqmEndJob(), and getNewObject().

◆ dqm_tag_

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

Definition at line 91 of file SiStripGainsPCLHarvester.h.

Referenced by dqmEndJob(), and SiStripGainsPCLHarvester().

◆ gainToken_

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

Definition at line 103 of file SiStripGainsPCLHarvester.h.

Referenced by beginRun(), and SiStripGainsPCLHarvester().

◆ GOOD

unsigned int SiStripGainsPCLHarvester::GOOD
private

Definition at line 74 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 88 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 87 of file SiStripGainsPCLHarvester.h.

Referenced by dqmEndJob(), and SiStripGainsPCLHarvester().

◆ m_Record

std::string SiStripGainsPCLHarvester::m_Record
private

Definition at line 85 of file SiStripGainsPCLHarvester.h.

Referenced by dqmEndJob(), and SiStripGainsPCLHarvester().

◆ MASKED

unsigned int SiStripGainsPCLHarvester::MASKED
private

Definition at line 76 of file SiStripGainsPCLHarvester.h.

Referenced by algoComputeMPVandGain().

◆ MinNrEntries

double SiStripGainsPCLHarvester::MinNrEntries
private

Definition at line 83 of file SiStripGainsPCLHarvester.h.

Referenced by getPeakOfLandau(), and SiStripGainsPCLHarvester().

◆ NPixelDets

int SiStripGainsPCLHarvester::NPixelDets
private

Definition at line 82 of file SiStripGainsPCLHarvester.h.

Referenced by checkBookAPVColls().

◆ NStripAPVs

int SiStripGainsPCLHarvester::NStripAPVs
private

Definition at line 81 of file SiStripGainsPCLHarvester.h.

Referenced by checkBookAPVColls(), and produceTagFilter().

◆ qualityToken_

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

Definition at line 104 of file SiStripGainsPCLHarvester.h.

Referenced by beginRun(), and SiStripGainsPCLHarvester().

◆ tagCondition_GoodFrac

double SiStripGainsPCLHarvester::tagCondition_GoodFrac
private

Definition at line 79 of file SiStripGainsPCLHarvester.h.

Referenced by produceTagFilter(), and SiStripGainsPCLHarvester().

◆ tagCondition_NClusters

double SiStripGainsPCLHarvester::tagCondition_NClusters
private

Definition at line 78 of file SiStripGainsPCLHarvester.h.

Referenced by produceTagFilter(), and SiStripGainsPCLHarvester().

◆ tkGeomToken_

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

Definition at line 102 of file SiStripGainsPCLHarvester.h.

Referenced by checkBookAPVColls(), and SiStripGainsPCLHarvester().

◆ tTopo_

std::unique_ptr<TrackerTopology> SiStripGainsPCLHarvester::tTopo_
private

Definition at line 96 of file SiStripGainsPCLHarvester.h.

Referenced by endRun(), and gainQualityMonitor().

◆ tTopoToken_

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

Definition at line 101 of file SiStripGainsPCLHarvester.h.

Referenced by endRun(), and SiStripGainsPCLHarvester().

◆ VChargeHisto

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

Charge monitor plots to be output

Definition at line 89 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:148
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
mps_fire.i
i
Definition: mps_fire.py:428
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
SiStripGainsPCLHarvester::dqm_tag_
std::vector< std::string > dqm_tag_
Definition: SiStripGainsPCLHarvester.h:91
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
SiStripGainsPCLHarvester::m_calibrationMode
std::string m_calibrationMode
Definition: SiStripGainsPCLHarvester.h:88
SiStripGainsPCLHarvester::produceTagFilter
bool produceTagFilter(const MonitorElement *Charge_Vs_Index)
Definition: SiStripGainsPCLHarvester.cc:619
edm
HLT enums.
Definition: AlignableModifier.h:19
SiStripGainsPCLHarvester::MASKED
unsigned int MASKED
Definition: SiStripGainsPCLHarvester.h:76
SiStripGainsPCLHarvester::APVsColl
std::unordered_map< unsigned int, std::shared_ptr< stAPVGain > > APVsColl
Definition: SiStripGainsPCLHarvester.h:99
SiStripGainsPCLHarvester::bareTkGeomPtr_
const TrackerGeometry * bareTkGeomPtr_
Definition: SiStripGainsPCLHarvester.h:95
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:102
SiStripGainsPCLHarvester::NStripAPVs
int NStripAPVs
Definition: SiStripGainsPCLHarvester.h:81
SiStripGainsPCLHarvester::APVsCollOrdered
std::vector< std::shared_ptr< stAPVGain > > APVsCollOrdered
Definition: SiStripGainsPCLHarvester.h:98
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:78
SiStripGainsPCLHarvester::NPixelDets
int NPixelDets
Definition: SiStripGainsPCLHarvester.h:82
h
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
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:104
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
SiStripGainsPCLHarvester::MinNrEntries
double MinNrEntries
Definition: SiStripGainsPCLHarvester.h:83
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
DetId
Definition: DetId.h:17
h
SiStripGainsPCLHarvester::BAD
unsigned int BAD
Definition: SiStripGainsPCLHarvester.h:75
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:14
SiStripGainsPCLHarvester::tTopoToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
Definition: SiStripGainsPCLHarvester.h:101
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
SiStripGainsPCLHarvester::VChargeHisto
std::vector< std::string > VChargeHisto
Definition: SiStripGainsPCLHarvester.h:89
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:473
PixelTopology
Definition: PixelTopology.h:10
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:125
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
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:648
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:509
mps_setup.stdout
stdout
Definition: mps_setup.py:250
beam_dqm_sourceclient-live_cfg.monitor
monitor
Definition: beam_dqm_sourceclient-live_cfg.py:244
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:93
sistrip::APV
Definition: ConstantsForGranularity.h:79
edm::Service< cond::service::PoolDBOutputService >
SiStripGainsPCLHarvester::gainToken_
edm::ESGetToken< SiStripGain, SiStripGainRcd > gainToken_
Definition: SiStripGainsPCLHarvester.h:103
APVGain::thickness
int thickness(uint32_t)
Definition: APVGainHelpers.cc:76
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
StripTopology::nstrips
virtual int nstrips() const =0
SiStripGainsPCLHarvester::doStoreOnDB
bool doStoreOnDB
Definition: SiStripGainsPCLHarvester.h:72
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
SiStripGainsPCLHarvester::tTopo_
std::unique_ptr< TrackerTopology > tTopo_
Definition: SiStripGainsPCLHarvester.h:96
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:87
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:499
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:673
SiStripGainsPCLHarvester::algoComputeMPVandGain
void algoComputeMPVandGain(const MonitorElement *Charge_Vs_Index)
Definition: SiStripGainsPCLHarvester.cc:369
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:73
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:52
GeometricSearchDet
Definition: GeometricSearchDet.h:17
SiStripGainsPCLHarvester::m_Record
std::string m_Record
Definition: SiStripGainsPCLHarvester.h:85
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:79
SiStripGainsPCLHarvester::GOOD
unsigned int GOOD
Definition: SiStripGainsPCLHarvester.h:74
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