CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Types | Private Attributes
SiPixelVCalDB Class Reference
Inheritance diagram for SiPixelVCalDB:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 SiPixelVCalDB (const edm::ParameterSet &conf)
 
 SiPixelVCalDB ()
 
 ~SiPixelVCalDB () 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 Types

typedef std::vector
< edm::ParameterSet
Parameters
 

Private Attributes

Parameters BPixParameters_
 
Parameters FPixParameters_
 
std::string recordName_
 
const edm::ESGetToken
< TrackerGeometry,
TrackerDigiGeometryRecord
tkGeomToken_
 
const edm::ESGetToken
< TrackerTopology,
TrackerTopologyRcd
tkTopoToken_
 

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 27 of file SiPixelVCalDB.cc.

Member Typedef Documentation

typedef std::vector<edm::ParameterSet> SiPixelVCalDB::Parameters
private

Definition at line 38 of file SiPixelVCalDB.cc.

Constructor & Destructor Documentation

SiPixelVCalDB::SiPixelVCalDB ( const edm::ParameterSet conf)
explicit

Definition at line 46 of file SiPixelVCalDB.cc.

References BPixParameters_, FPixParameters_, edm::ParameterSet::getUntrackedParameter(), recordName_, and AlCaHLTBitMon_QueryRunRegistry::string.

48  recordName_ = iConfig.getUntrackedParameter<std::string>("record", "SiPixelVCalRcd");
49  BPixParameters_ = iConfig.getUntrackedParameter<Parameters>("BPixParameters");
50  FPixParameters_ = iConfig.getUntrackedParameter<Parameters>("FPixParameters");
51 }
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
Parameters FPixParameters_
vector< ParameterSet > Parameters
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tkTopoToken_
Parameters BPixParameters_
std::string recordName_
SiPixelVCalDB::SiPixelVCalDB ( )
explicit
SiPixelVCalDB::~SiPixelVCalDB ( )
overridedefault

Member Function Documentation

void SiPixelVCalDB::analyze ( const edm::Event e,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 56 of file SiPixelVCalDB.cc.

References cond::service::PoolDBOutputService::appendOneIOV(), cond::service::PoolDBOutputService::beginOfTime(), BPixParameters_, cond::service::PoolDBOutputService::createOneIOV(), cond::service::PoolDBOutputService::currentTime(), TrackerGeometry::detUnits(), PixelEndcapName::diskName(), cppFunctionSkipper::exception, FPixParameters_, edm::EventSetup::getData(), edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), PVValHelper::ladder, phase1PixelTopology::layer, hltrates_dqm_sourceclient-live_cfg::offset, PVValHelper::phase1, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, SiPixelVCal::putSlopeAndOffset(), TrackerTopology::pxbLadder(), TrackerTopology::pxbLayer(), TrackerTopology::pxfDisk(), TrackerTopology::pxfSide(), DetId::rawId(), recordName_, relativeConstraints::ring, PixelEndcapName::ringName(), slope, DetId::subdetId(), tkGeomToken_, tkTopoToken_, and cms::Exception::what().

56  {
57  SiPixelVCal vcal;
58  bool phase1 = true;
59 
60  // Retrieve tracker topology from geometry
61  const TrackerTopology* const tTopo = &iSetup.getData(tkTopoToken_);
62 
63  // Retrieve old style tracker geometry from geometry
64  const TrackerGeometry* pDD = &iSetup.getData(tkGeomToken_);
65  edm::LogPrint("SiPixelVCalDB") << " There are " << pDD->detUnits().size() << " modules" << std::endl;
66 
67  for (const auto& it : pDD->detUnits()) {
68  if (dynamic_cast<PixelGeomDetUnit const*>(it) != nullptr) {
69  const DetId detid = it->geographicalId();
70  const unsigned int rawDetId = detid.rawId();
71  int subid = detid.subdetId();
72 
73  // FILL BPIX
74  if (subid == static_cast<int>(PixelSubdetector::PixelBarrel)) {
75  int layer = tTopo->pxbLayer(detid); // 1, 2, 3, 4
76  int ladder = tTopo->pxbLadder(detid); // 1-12/28/44/64
77  edm::LogPrint("SiPixelVCalDB") << " pixel barrel:"
78  << " detId=" << rawDetId << ", layer=" << layer << ", ladder=" << ladder;
79  for (Parameters::iterator it = BPixParameters_.begin(); it != BPixParameters_.end(); ++it) {
80  if (it->getParameter<int>("layer") == layer && it->getParameter<int>("ladder") == ladder) {
81  float slope = (float)it->getParameter<double>("slope");
82  float offset = (float)it->getParameter<double>("offset");
83  edm::LogPrint("SiPixelVCalDB") << "; VCal slope " << slope << ", offset " << offset;
84  // edm::LogInfo("SiPixelVCalDB") << " detId " << rawDetId << " \t
85  // VCal slope " << slope << ", offset " << offset;
86  vcal.putSlopeAndOffset(detid, slope, offset);
87  }
88  }
89  edm::LogPrint("SiPixelVCalDB") << std::endl;
90 
91  // FILL FPIX
92  } else if (subid == static_cast<int>(PixelSubdetector::PixelEndcap)) {
93  PixelEndcapName fpix(detid, tTopo, phase1);
94  int side = tTopo->pxfSide(detid); // 1 (-z), 2 for (+z)
95  int disk = fpix.diskName(); // 1, 2, 3
96  int disk2 = tTopo->pxfDisk(detid); // 1, 2, 3
97  int ring = fpix.ringName(); // 1 (lower), 2 (upper)
98  if (disk != disk2) {
99  edm::LogError("SiPixelVCalDB::analyze")
100  << "Found contradicting FPIX disk number: " << disk << " vs." << disk2 << std::endl;
101  }
102  edm::LogPrint("SiPixelVCalDB") << " pixel endcap:"
103  << " detId=" << rawDetId << ", side=" << side << ", disk=" << disk
104  << ", ring=" << ring;
105  for (Parameters::iterator it = FPixParameters_.begin(); it != FPixParameters_.end(); ++it) {
106  if (it->getParameter<int>("side") == side && it->getParameter<int>("disk") == disk &&
107  it->getParameter<int>("ring") == ring) {
108  float slope = (float)it->getParameter<double>("slope");
109  float offset = (float)it->getParameter<double>("offset");
110  edm::LogPrint("SiPixelVCalDB") << "; VCal slope " << slope << ", offset " << offset;
111  // edm::LogInfo("SiPixelVCalDB") << " detId " << rawDetId << " \t
112  // VCal slope " << slope << ", offset " << offset;
113  vcal.putSlopeAndOffset(rawDetId, slope, offset);
114  }
115  }
116  edm::LogPrint("SiPixelVCalDB") << std::endl;
117 
118  } else {
119  edm::LogError("SiPixelVCalDB::analyze") << "detid is Pixel but neither bpix nor fpix" << std::endl;
120  }
121  }
122  }
123 
124  // Save to DB
126  if (mydbservice.isAvailable()) {
127  try {
128  if (mydbservice->isNewTagRequest(recordName_)) {
129  mydbservice->createOneIOV<SiPixelVCal>(vcal, mydbservice->beginOfTime(), recordName_);
130  } else {
131  mydbservice->appendOneIOV<SiPixelVCal>(vcal, mydbservice->currentTime(), recordName_);
132  }
133  } catch (const cond::Exception& er) {
134  edm::LogError("SiPixelVCalDB") << er.what() << std::endl;
135  } catch (const std::exception& er) {
136  edm::LogError("SiPixelVCalDB") << "caught std::exception " << er.what() << std::endl;
137  } catch (...) {
138  edm::LogError("SiPixelVCalDB") << "Funny error" << std::endl;
139  }
140  } else {
141  edm::LogError("SiPixelVCalDB") << "Service is unavailable" << std::endl;
142  }
143 }
Base exception class for the object to relational access.
Definition: Exception.h:11
unsigned int pxfDisk(const DetId &id) const
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
static const double slope[3]
unsigned int pxbLadder(const DetId &id) const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
Parameters FPixParameters_
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
Log< level::Error, false > LogError
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
constexpr std::array< uint8_t, layerIndexSize > layer
bool getData(T &iHolder) const
Definition: EventSetup.h:122
void appendOneIOV(const T &payload, cond::Time_t sinceTime, const std::string &recordName)
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:40
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
char const * what() const noexceptoverride
Definition: Exception.cc:103
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tkTopoToken_
Log< level::Warning, true > LogPrint
unsigned int pxbLayer(const DetId &id) const
Definition: DetId.h:17
Parameters BPixParameters_
unsigned int pxfSide(const DetId &id) const
std::string recordName_
void putSlopeAndOffset(std::map< unsigned int, VCal > &vcal)
Definition: SiPixelVCal.h:22

Member Data Documentation

Parameters SiPixelVCalDB::BPixParameters_
private

Definition at line 39 of file SiPixelVCalDB.cc.

Referenced by analyze(), and SiPixelVCalDB().

Parameters SiPixelVCalDB::FPixParameters_
private

Definition at line 40 of file SiPixelVCalDB.cc.

Referenced by analyze(), and SiPixelVCalDB().

std::string SiPixelVCalDB::recordName_
private

Definition at line 37 of file SiPixelVCalDB.cc.

Referenced by analyze(), and SiPixelVCalDB().

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiPixelVCalDB::tkGeomToken_
private

Definition at line 35 of file SiPixelVCalDB.cc.

Referenced by analyze().

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SiPixelVCalDB::tkTopoToken_
private

Definition at line 36 of file SiPixelVCalDB.cc.

Referenced by analyze().