CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
module::EcalSRCondTools Class Reference
Inheritance diagram for module::EcalSRCondTools:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &evt, const edm::EventSetup &es) override
 
 EcalSRCondTools (const edm::ParameterSet &)
 
 ~EcalSRCondTools () 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

bool done_
 
edm::ESGetToken< EcalSRSettings, EcalSRSettingsRcdhSrToken_
 
bool iomode_write_
 
const std::string mode_
 
const edm::ParameterSet ps_
 
edm::ESGetToken< EcalTPGPhysicsConst, EcalTPGPhysicsConstRcdtpgPhysicsConstToken_
 

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 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 30 of file EcalSRCondTools.cc.

Constructor & Destructor Documentation

◆ EcalSRCondTools()

module::EcalSRCondTools::EcalSRCondTools ( const edm::ParameterSet ps)

Constructor

Parameters
psanalyser configuration

Definition at line 63 of file EcalSRCondTools.cc.

References edm::EDConsumerBase::esConsumes(), hSrToken_, iomode_write_, mode_, and tpgPhysicsConstToken_.

64  : ps_(ps), mode_(ps.getParameter<string>("mode")), iomode_write_(true), done_(false) {
65  if (mode_ == "read") {
66  iomode_write_ = false;
69  }
70  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::ParameterSet ps_
const std::string mode_
edm::ESGetToken< EcalSRSettings, EcalSRSettingsRcd > hSrToken_
edm::ESGetToken< EcalTPGPhysicsConst, EcalTPGPhysicsConstRcd > tpgPhysicsConstToken_

◆ ~EcalSRCondTools()

module::EcalSRCondTools::~EcalSRCondTools ( )
override

Destructor

Definition at line 72 of file EcalSRCondTools.cc.

72 {}

Member Function Documentation

◆ analyze()

void module::EcalSRCondTools::analyze ( const edm::Event evt,
const edm::EventSetup es 
)
overridevirtual

Called by CMSSW event loop

Parameters
evtthe event
esevents setup

Implements edm::one::EDAnalyzerBase.

Definition at line 74 of file EcalSRCondTools.cc.

References EcalSRSettings::automaticMasks_, EcalSRSettings::automaticSrpSelect_, EcalSRSettings::bxGlobalOffset_, gather_cfg::cout, dqmiodatasetharvest::db, done_, Exception, f, alignmentValidation::fname, edm::EventSetup::getHandle(), edm::ParameterSet::getParameter(), hSrToken_, ecalsrcondtools::importParameterSet(), ecalsrcondtools::importSrpConfigFile(), iomode_write_, edm::ESHandleBase::isValid(), mode_, edm::ESHandle< T >::product(), ps_, cmsswSequenceInfo::tp, and tpgPhysicsConstToken_.

74  {
75  if (done_)
76  return;
77  EcalSRSettings sr;
78 
79  if (mode_ == "online_config" || mode_ == "combine_config") {
80  string fname = ps_.getParameter<string>("onlineSrpConfigFile");
81  ifstream f(fname.c_str());
82  if (!f.good()) {
83  throw cms::Exception("EcalSRCondTools") << "Failed to open file " << fname;
84  }
85  importSrpConfigFile(sr, f, true);
86  }
87 
88  if (mode_ == "python_config" || mode_ == "combine_config") {
90  }
91 
92  if (!(mode_ == "python_config" || mode_ == "online_config" || mode_ == "combine_config" || (mode_ == "read"))) {
93  throw cms::Exception("Config") << "Invalid value," << mode_ << ", for parameter mode. "
94  << "Valid values: online_config, python_config, combine_config, read";
95  }
96 
97  if (iomode_write_) {
98  sr.bxGlobalOffset_ = ps_.getParameter<int>("bxGlobalOffset");
99  sr.automaticSrpSelect_ = ps_.getParameter<int>("automaticSrpSelect");
100  sr.automaticMasks_ = ps_.getParameter<int>("automaticMasks");
101 
103  if (!db.isAvailable()) {
104  throw cms::Exception("CondDBAccess") << "Failed to connect to PoolDBOutputService\n";
105  }
106  //fillup DB
107  //create new infinite IOV
108  cond::Time_t firstSinceTime = db->beginOfTime();
109  db->writeOneIOV(sr, firstSinceTime, "EcalSRSettingsRcd");
110  done_ = true;
111  } else { //read mode
113  if (!hSr.isValid()) {
114  cout << "EcalSRSettings record not found. Check the Cond DB Global tag.\n";
115  } else {
116  const EcalSRSettings* ssr = hSr.product();
117  cout << "ECAL Seletive readout settings:\n";
118  cout << *ssr << "\n" << endl;
119  }
120 
121  //trigger tower thresholds (from FENIX configuration):
123  if (!hTp.isValid()) {
124  cout << "EcalTPGPhysicsConst record not found. Check the Cond DB Global tag.\n";
125  } else {
126  const EcalTPGPhysicsConst* tp = hTp.product();
127  const EcalTPGPhysicsConstMap& mymap = tp->getMap();
128  if (mymap.size() != 2) {
129  cout << "Error: TPG physics record is of unexpected size: " << mymap.size()
130  << " elements instead of two (one for EB, one for EE)\n";
131  } else {
132  EcalTPGPhysicsConstMap::const_iterator it = mymap.begin();
133  cout << "----------------------------------------------------------------------\n"
134  "Trigger tower Et thresholds extracted from TPG configuration \n"
135  "(EcalSRCondTools modules supports only read mode for these parameters):\n\n";
136  cout << "EB: "
137  << "LT = " << it->second.ttf_threshold_Low << " GeV "
138  << "HT = " << it->second.ttf_threshold_High << " GeV\n";
139  ++it;
140  cout << "EE: "
141  << "LT = " << it->second.ttf_threshold_Low << " GeV "
142  << "HT = " << it->second.ttf_threshold_High << " GeV\n";
143  }
144  }
145  }
146  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::ParameterSet ps_
T const * product() const
Definition: ESHandle.h:86
unsigned long long Time_t
Definition: Time.h:14
double f[11][100]
const std::string mode_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
bool isValid() const
Definition: ESHandle.h:44
edm::ESGetToken< EcalSRSettings, EcalSRSettingsRcd > hSrToken_
string fname
main script
void importSrpConfigFile(EcalSRSettings &sr, std::istream &f, bool debug=false)
std::map< uint32_t, EcalTPGPhysicsConst::Item > EcalTPGPhysicsConstMap
void importParameterSet(EcalSRSettings &sr, const edm::ParameterSet &ps)
edm::ESGetToken< EcalTPGPhysicsConst, EcalTPGPhysicsConstRcd > tpgPhysicsConstToken_

Member Data Documentation

◆ done_

bool module::EcalSRCondTools::done_
private

Definition at line 54 of file EcalSRCondTools.cc.

Referenced by analyze().

◆ hSrToken_

edm::ESGetToken<EcalSRSettings, EcalSRSettingsRcd> module::EcalSRCondTools::hSrToken_
private

Definition at line 56 of file EcalSRCondTools.cc.

Referenced by analyze(), and EcalSRCondTools().

◆ iomode_write_

bool module::EcalSRCondTools::iomode_write_
private

Definition at line 53 of file EcalSRCondTools.cc.

Referenced by analyze(), and EcalSRCondTools().

◆ mode_

const std::string module::EcalSRCondTools::mode_
private

Definition at line 52 of file EcalSRCondTools.cc.

Referenced by analyze(), and EcalSRCondTools().

◆ ps_

const edm::ParameterSet module::EcalSRCondTools::ps_
private

Definition at line 50 of file EcalSRCondTools.cc.

Referenced by analyze().

◆ tpgPhysicsConstToken_

edm::ESGetToken<EcalTPGPhysicsConst, EcalTPGPhysicsConstRcd> module::EcalSRCondTools::tpgPhysicsConstToken_
private

Definition at line 57 of file EcalSRCondTools.cc.

Referenced by analyze(), and EcalSRCondTools().