CMS 3D CMS Logo

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

#include <HcalAutoPedestalValidator.h>

Inheritance diagram for HcalAutoPedestalValidator:
edm::EDAnalyzer 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::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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
 
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::vector< ModuleDescription const * > &modules, 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
 
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
 
std::string outfile
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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<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)
 

Detailed Description

Definition at line 41 of file HcalAutoPedestalValidator.h.

Constructor & Destructor Documentation

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

Definition at line 3 of file HcalAutoPedestalValidator.cc.

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

4 {
5  outfile = ps.getUntrackedParameter<std::string>("outFile","changed.bool");
6  epsilon = ps.getUntrackedParameter<double>("deltaP",.25);
7 }
HcalAutoPedestalValidator::~HcalAutoPedestalValidator ( )
override

Definition at line 9 of file HcalAutoPedestalValidator.cc.

10 {
11 }

Member Function Documentation

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

Definition at line 13 of file HcalAutoPedestalValidator.cc.

References gather_cfg::cout, TauDecayModes::dec, DEFINE_FWK_MODULE, epsilon, spr::find(), edm::EventSetup::get(), HcalCondObjectContainer< Item >::getAllChannels(), HcalCondObjectContainer< Item >::getValues(), outfile, edm::ESHandle< T >::product(), DetId::rawId(), and MuonErrorMatrixValues_cff::values.

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

Member Data Documentation

double HcalAutoPedestalValidator::epsilon
private
std::string HcalAutoPedestalValidator::outfile
private

Definition at line 51 of file HcalAutoPedestalValidator.h.

Referenced by analyze(), and HcalAutoPedestalValidator().