CMS 3D CMS Logo

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

Public Member Functions

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

typedef std::vector< edm::ParameterSetParameters
 

Private Member Functions

unsigned int HVgroup (unsigned int panel, unsigned int module)
 

Private Attributes

Parameters BPixParameters_
 
std::vector< std::pair< uint32_t, float > > detid_la
 
std::string fileName_
 
Parameters FPixParameters_
 
double magneticField_
 
Parameters ModuleParameters_
 
std::string recordName_
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtkGeomToken_
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtkTopoToken_
 
bool useFile_
 

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 28 of file SiPixelLorentzAngleDB.cc.

Member Typedef Documentation

◆ Parameters

Definition at line 44 of file SiPixelLorentzAngleDB.cc.

Constructor & Destructor Documentation

◆ SiPixelLorentzAngleDB()

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

Definition at line 58 of file SiPixelLorentzAngleDB.cc.

References BPixParameters_, fileName_, FPixParameters_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), magneticField_, ModuleParameters_, recordName_, AlCaHLTBitMon_QueryRunRegistry::string, and useFile_.

60  magneticField_ = conf.getParameter<double>("magneticField");
61  recordName_ = conf.getUntrackedParameter<std::string>("record", "SiPixelLorentzAngleRcd");
62  useFile_ = conf.getParameter<bool>("useFile");
63  fileName_ = conf.getParameter<string>("fileName");
64 
65  BPixParameters_ = conf.getUntrackedParameter<Parameters>("BPixParameters");
66  FPixParameters_ = conf.getUntrackedParameter<Parameters>("FPixParameters");
67  ModuleParameters_ = conf.getUntrackedParameter<Parameters>("ModuleParameters");
68 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< edm::ParameterSet > Parameters
T getUntrackedParameter(std::string const &, T const &) const
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tkTopoToken_

◆ ~SiPixelLorentzAngleDB()

SiPixelLorentzAngleDB::~SiPixelLorentzAngleDB ( )
overridedefault

Member Function Documentation

◆ analyze()

void SiPixelLorentzAngleDB::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 75 of file SiPixelLorentzAngleDB.cc.

References cond::service::PoolDBOutputService::appendOneIOV(), cond::service::PoolDBOutputService::beginOfTime(), BPixParameters_, cond::service::PoolDBOutputService::createOneIOV(), cond::service::PoolDBOutputService::currentTime(), TrackerGeometry::detUnits(), cppFunctionSkipper::exception, nano_mu_digi_cff::float, FPixParameters_, edm::EventSetup::getData(), HVgroup(), edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, SiStripSimParameters_cfi::LorentzAngle, ModuleParameters_, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, TrackerTopology::pxbLadder(), TrackerTopology::pxbLayer(), TrackerTopology::pxbModule(), TrackerTopology::pxfBlade(), TrackerTopology::pxfDisk(), TrackerTopology::pxfModule(), TrackerTopology::pxfPanel(), TrackerTopology::pxfSide(), DetId::rawId(), recordName_, DetId::subdetId(), tkGeomToken_, tkTopoToken_, useFile_, and cms::Exception::what().

75  {
77 
78  //Retrieve tracker topology from geometry
79  const TrackerTopology* tTopo = &es.getData(tkTopoToken_);
80 
81  //Retrieve old style tracker geometry from geometry
82  const TrackerGeometry* pDD = &es.getData(tkGeomToken_);
83  edm::LogInfo("SiPixelLorentzAngle (old)")
84  << " There are " << pDD->detUnits().size() << " detectors (old)" << std::endl;
85 
86  for (const auto& it : pDD->detUnits()) {
87  if (dynamic_cast<PixelGeomDetUnit const*>(it) != nullptr) {
88  DetId detid = it->geographicalId();
89  const DetId detidc = it->geographicalId();
90 
91  // fill bpix values for LA
92  if (detid.subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel)) {
93  edm::LogPrint("SiPixelLorentzAngleDB")
94  << " pixel barrel:"
95  << " layer=" << tTopo->pxbLayer(detidc.rawId()) << " ladder=" << tTopo->pxbLadder(detidc.rawId())
96  << " module=" << tTopo->pxbModule(detidc.rawId()) << " rawId=" << detidc.rawId() << endl;
97 
98  if (!useFile_) {
99  //first individuals are put
100  for (Parameters::iterator it = ModuleParameters_.begin(); it != ModuleParameters_.end(); ++it) {
101  if (it->getParameter<unsigned int>("rawid") == detidc.rawId()) {
102  float lorentzangle = (float)it->getParameter<double>("angle");
103  LorentzAngle.putLorentzAngle(detid.rawId(), lorentzangle);
104  edm::LogPrint("SiPixelLorentzAngleDB")
105  << " individual value=" << lorentzangle << " put into rawid=" << detid.rawId() << endl;
106  }
107  }
108 
109  //modules already put are automatically skipped
110  for (Parameters::iterator it = BPixParameters_.begin(); it != BPixParameters_.end(); ++it) {
111  if (it->getParameter<unsigned int>("module") == tTopo->pxbModule(detidc.rawId()) &&
112  it->getParameter<unsigned int>("layer") == tTopo->pxbLayer(detidc.rawId())) {
113  float lorentzangle = (float)it->getParameter<double>("angle");
114  LorentzAngle.putLorentzAngle(detid.rawId(), lorentzangle);
115  }
116  }
117 
118  } else {
119  edm::LogError("SiPixelLorentzAngleDB")
120  << "[SiPixelLorentzAngleDB::analyze] method for reading file not implemented yet" << std::endl;
121  }
122 
123  // fill fpix values for LA
124  } else if (detid.subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap)) {
125  edm::LogPrint("SiPixelLorentzAngleDB")
126  << " pixel endcap:"
127  << " side=" << tTopo->pxfSide(detidc.rawId()) << " disk=" << tTopo->pxfDisk(detidc.rawId())
128  << " blade=" << tTopo->pxfBlade(detidc.rawId()) << " panel=" << tTopo->pxfPanel(detidc.rawId())
129  << " module=" << tTopo->pxfModule(detidc.rawId()) << " rawId=" << detidc.rawId() << endl;
130 
131  //first individuals are put
132  for (Parameters::iterator it = ModuleParameters_.begin(); it != ModuleParameters_.end(); ++it) {
133  if (it->getParameter<unsigned int>("rawid") == detidc.rawId()) {
134  float lorentzangle = (float)it->getParameter<double>("angle");
135  LorentzAngle.putLorentzAngle(detid.rawId(), lorentzangle);
136  edm::LogPrint("SiPixelLorentzAngleDB")
137  << " individual value=" << lorentzangle << " put into rawid=" << detid.rawId() << endl;
138  }
139  }
140 
141  //modules already put are automatically skipped
142  for (Parameters::iterator it = FPixParameters_.begin(); it != FPixParameters_.end(); ++it) {
143  if (it->getParameter<unsigned int>("side") == tTopo->pxfSide(detidc.rawId()) &&
144  it->getParameter<unsigned int>("disk") == tTopo->pxfDisk(detidc.rawId()) &&
145  it->getParameter<unsigned int>("HVgroup") ==
146  HVgroup(tTopo->pxfPanel(detidc.rawId()), tTopo->pxfModule(detidc.rawId()))) {
147  float lorentzangle = (float)it->getParameter<double>("angle");
148  LorentzAngle.putLorentzAngle(detid.rawId(), lorentzangle);
149  }
150  }
151 
152  } else {
153  edm::LogError("SiPixelLorentzAngleDB")
154  << "[SiPixelLorentzAngleDB::analyze] detid is Pixel but neither bpix nor fpix" << std::endl;
155  }
156  }
157  }
158 
160  if (mydbservice.isAvailable()) {
161  try {
162  if (mydbservice->isNewTagRequest(recordName_)) {
163  mydbservice->createOneIOV<SiPixelLorentzAngle>(LorentzAngle, mydbservice->beginOfTime(), recordName_);
164  } else {
165  mydbservice->appendOneIOV<SiPixelLorentzAngle>(LorentzAngle, mydbservice->currentTime(), recordName_);
166  }
167  } catch (const cond::Exception& er) {
168  edm::LogError("SiPixelLorentzAngleDB") << er.what() << std::endl;
169  } catch (const std::exception& er) {
170  edm::LogError("SiPixelLorentzAngleDB") << "caught std::exception " << er.what() << std::endl;
171  } catch (...) {
172  edm::LogError("SiPixelLorentzAngleDB") << "Funny error" << std::endl;
173  }
174  } else {
175  edm::LogError("SiPixelLorentzAngleDB") << "Service is unavailable" << std::endl;
176  }
177 }
unsigned int pxbLayer(const DetId &id) const
Base exception class for the object to relational access.
Definition: Exception.h:11
unsigned int pxfBlade(const DetId &id) const
unsigned int pxfModule(const DetId &id) const
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
unsigned int pxbLadder(const DetId &id) const
Log< level::Error, false > LogError
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
void appendOneIOV(const T &payload, cond::Time_t sinceTime, const std::string &recordName)
bool isNewTagRequest(const std::string &recordName)
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
unsigned int pxfDisk(const DetId &id) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Log< level::Warning, true > LogPrint
unsigned int pxfPanel(const DetId &id) const
Log< level::Info, false > LogInfo
Definition: DetId.h:17
unsigned int pxfSide(const DetId &id) const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tkTopoToken_
unsigned int HVgroup(unsigned int panel, unsigned int module)
bool isAvailable() const
Definition: Service.h:40
unsigned int pxbModule(const DetId &id) const
char const * what() const noexcept override
Definition: Exception.cc:107

◆ HVgroup()

unsigned int SiPixelLorentzAngleDB::HVgroup ( unsigned int  panel,
unsigned int  module 
)
private

Definition at line 179 of file SiPixelLorentzAngleDB.cc.

Referenced by analyze().

179  {
180  if (1 == panel && (1 == module || 2 == module)) {
181  return 1;
182  } else if (1 == panel && (3 == module || 4 == module)) {
183  return 2;
184  } else if (2 == panel && 1 == module) {
185  return 1;
186  } else if (2 == panel && (2 == module || 3 == module)) {
187  return 2;
188  } else {
189  edm::LogPrint("SiPixelLorentzAngleDB") << " *** error *** in SiPixelLorentzAngleDB::HVgroup(...), panel = " << panel
190  << ", module = " << module << endl;
191  return 0;
192  }
193 }
Log< level::Warning, true > LogPrint

Member Data Documentation

◆ BPixParameters_

Parameters SiPixelLorentzAngleDB::BPixParameters_
private

Definition at line 45 of file SiPixelLorentzAngleDB.cc.

Referenced by analyze(), and SiPixelLorentzAngleDB().

◆ detid_la

std::vector<std::pair<uint32_t, float> > SiPixelLorentzAngleDB::detid_la
private

Definition at line 40 of file SiPixelLorentzAngleDB.cc.

◆ fileName_

std::string SiPixelLorentzAngleDB::fileName_
private

Definition at line 49 of file SiPixelLorentzAngleDB.cc.

Referenced by SiPixelLorentzAngleDB().

◆ FPixParameters_

Parameters SiPixelLorentzAngleDB::FPixParameters_
private

Definition at line 46 of file SiPixelLorentzAngleDB.cc.

Referenced by analyze(), and SiPixelLorentzAngleDB().

◆ magneticField_

double SiPixelLorentzAngleDB::magneticField_
private

Definition at line 41 of file SiPixelLorentzAngleDB.cc.

Referenced by SiPixelLorentzAngleDB().

◆ ModuleParameters_

Parameters SiPixelLorentzAngleDB::ModuleParameters_
private

Definition at line 47 of file SiPixelLorentzAngleDB.cc.

Referenced by analyze(), and SiPixelLorentzAngleDB().

◆ recordName_

std::string SiPixelLorentzAngleDB::recordName_
private

Definition at line 42 of file SiPixelLorentzAngleDB.cc.

Referenced by analyze(), and SiPixelLorentzAngleDB().

◆ tkGeomToken_

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

Definition at line 35 of file SiPixelLorentzAngleDB.cc.

Referenced by analyze().

◆ tkTopoToken_

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

Definition at line 36 of file SiPixelLorentzAngleDB.cc.

Referenced by analyze().

◆ useFile_

bool SiPixelLorentzAngleDB::useFile_
private

Definition at line 50 of file SiPixelLorentzAngleDB.cc.

Referenced by analyze(), and SiPixelLorentzAngleDB().