CMS 3D CMS Logo

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

#include <HcalAutoPedestalValidator.h>

Inheritance diagram for HcalAutoPedestalValidator:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &ev, const edm::EventSetup &es) override
 
 HcalAutoPedestalValidator (edm::ParameterSet const &ps)
 
 ~HcalAutoPedestalValidator () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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)
 

Private Attributes

double epsilon
 
edm::ESGetToken< HcalPedestals, HcalPedestalsRcdm_tok1
 
edm::ESGetToken< HcalPedestals, HcalPedestalsRcdm_tok2
 
std::string outfile
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 40 of file HcalAutoPedestalValidator.h.

Constructor & Destructor Documentation

◆ HcalAutoPedestalValidator()

HcalAutoPedestalValidator::HcalAutoPedestalValidator ( edm::ParameterSet const &  ps)

Definition at line 3 of file HcalAutoPedestalValidator.cc.

References epsilon, edm::ParameterSet::getUntrackedParameter(), m_tok1, m_tok2, outfile, and AlCaHLTBitMon_QueryRunRegistry::string.

3  {
4  outfile = ps.getUntrackedParameter<std::string>("outFile", "changed.bool");
5  epsilon = ps.getUntrackedParameter<double>("deltaP", .25);
6  m_tok1 = esConsumes<HcalPedestals, HcalPedestalsRcd>(edm::ESInputTag("", "update"));
7  m_tok2 = esConsumes<HcalPedestals, HcalPedestalsRcd>(edm::ESInputTag("", "reference"));
8 }
edm::ESGetToken< HcalPedestals, HcalPedestalsRcd > m_tok2
edm::ESGetToken< HcalPedestals, HcalPedestalsRcd > m_tok1

◆ ~HcalAutoPedestalValidator()

HcalAutoPedestalValidator::~HcalAutoPedestalValidator ( )
override

Definition at line 10 of file HcalAutoPedestalValidator.cc.

10 {}

Member Function Documentation

◆ analyze()

void HcalAutoPedestalValidator::analyze ( const edm::Event ev,
const edm::EventSetup es 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 12 of file HcalAutoPedestalValidator.cc.

References gather_cfg::cout, TauDecayModes::dec, epsilon, spr::find(), HcalCondObjectContainer< Item >::getAllChannels(), edm::EventSetup::getData(), HcalCondObjectContainer< Item >::getValues(), m_tok1, m_tok2, outfile, DetId::rawId(), and contentValuesCheck::values.

12  {
13  using namespace edm::eventsetup;
14  // get fake pedestals from file ("new pedestals")
15  const HcalPedestals* myNewPeds = &es.getData(m_tok1);
16 
17  // get DB pedestals from Frontier/OrcoX ("reference")
18  const HcalPedestals* myRefPeds = &es.getData(m_tok2);
19 
20  std::vector<DetId> listNewChan = myNewPeds->getAllChannels();
21  std::vector<DetId> listRefChan = myRefPeds->getAllChannels();
22  std::vector<DetId>::iterator cell;
23  bool failflag = false;
24  for (std::vector<DetId>::iterator it = listRefChan.begin(); it != listRefChan.end(); it++) {
25  DetId mydetid = *it;
26  cell = std::find(listNewChan.begin(), listNewChan.end(), mydetid);
27  if (cell == listNewChan.end()) {
28  continue;
29  } else {
30  const float* values = (myNewPeds->getValues(mydetid))->getValues();
31  const float* oldvalue = (myRefPeds->getValues(mydetid))->getValues();
32  if ((*values == 0) && (*(values + 1) == 0) && (*(values + 2) == 0) && (*(values + 3) == 0))
33  continue;
34  if ((*oldvalue - *values) + (*(oldvalue + 1) - *(values + 1)) + (*(oldvalue + 2) - *(values + 2)) +
35  (*(oldvalue + 3) - *(values + 3)) / 4 >
36  epsilon) {
37  std::cout << "Channel " << std::hex << mydetid.rawId() << " Values differ by " << std::dec
38  << (*oldvalue - *values) << " " << (*(oldvalue + 1) - *(values + 1)) << " "
39  << (*(oldvalue + 2) - *(values + 2)) << " " << (*(oldvalue + 3) - *(values + 3)) << std::endl;
40  failflag = true;
41  }
42  listNewChan.erase(cell); // fix 25.02.08
43  }
44  }
45 
46  if (!failflag)
47  std::cout << "These are identical to within deltaP" << std::endl;
48  if (failflag) {
49  // if changed, this creates the empty file changed.bool which the auto job uses as a flag
50  std::ofstream outStream3(outfile.c_str());
51  std::cout << "--- Pedestals changed! ---" << std::endl;
52  }
53 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::ESGetToken< HcalPedestals, HcalPedestalsRcd > m_tok2
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const Item * getValues(DetId fId, bool throwOnFail=true) const
std::vector< DetId > getAllChannels() const
edm::ESGetToken< HcalPedestals, HcalPedestalsRcd > m_tok1
Definition: DetId.h:17
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57

Member Data Documentation

◆ epsilon

double HcalAutoPedestalValidator::epsilon
private

◆ m_tok1

edm::ESGetToken<HcalPedestals, HcalPedestalsRcd> HcalAutoPedestalValidator::m_tok1
private

Definition at line 51 of file HcalAutoPedestalValidator.h.

Referenced by analyze(), and HcalAutoPedestalValidator().

◆ m_tok2

edm::ESGetToken<HcalPedestals, HcalPedestalsRcd> HcalAutoPedestalValidator::m_tok2
private

Definition at line 52 of file HcalAutoPedestalValidator.h.

Referenced by analyze(), and HcalAutoPedestalValidator().

◆ outfile

std::string HcalAutoPedestalValidator::outfile
private

Definition at line 49 of file HcalAutoPedestalValidator.h.

Referenced by analyze(), and HcalAutoPedestalValidator().