CMS 3D CMS Logo

SiStripLorentzAngleRunInfoTableProducer.cc
Go to the documentation of this file.
5 
8 
16 
18 
20 public:
22  : m_name{params.getParameter<std::string>("name")},
23  m_magFieldName{params.getParameter<std::string>("magFieldName")},
24  m_doc{params.existsAs<std::string>("doc") ? params.getParameter<std::string>("doc") : ""},
25  m_tkGeomToken{esConsumes<edm::Transition::BeginRun>()},
26  m_magFieldToken{esConsumes<edm::Transition::BeginRun>()},
27  m_lorentzAngleToken{esConsumes<edm::Transition::BeginRun>()} {
28  produces<nanoaod::FlatTable, edm::Transition::BeginRun>();
29  produces<nanoaod::FlatTable, edm::Transition::BeginRun>("magField");
30  }
31 
32  void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override {}
33 
34  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
36  desc.add<std::string>("name", "Det");
37  desc.add<std::string>("magFieldName", "magField");
38  desc.add<std::string>("doc", "Run info for the Lorentz angle measurement");
39  descriptions.add("siStripLorentzAngleRunInfoTable", desc);
40  }
41 
42  void globalBeginRunProduce(edm::Run& iRun, edm::EventSetup const& iSetup) const override;
43 
44 private:
50 };
51 
52 namespace {
53  template <typename VALUES>
54  void addColumn(nanoaod::FlatTable* table, const std::string& name, VALUES&& values, const std::string& doc) {
56  table->template addColumn<value_type>(name, values, doc);
57  }
58 } // namespace
59 
61  edm::EventSetup const& iSetup) const {
62  const auto& tkGeom = iSetup.getData(m_tkGeomToken);
63  const auto& magField = iSetup.getData(m_magFieldToken);
64  const auto& lorentzAngle = iSetup.getData(m_lorentzAngleToken);
65  std::vector<uint32_t> c_rawid;
66  std::vector<float> c_globalZofunitlocalY, c_localB, c_BdotY, c_driftx, c_drifty, c_driftz, c_lorentzAngle;
67 
68  auto dets = tkGeom.detsTIB();
69  dets.insert(dets.end(), tkGeom.detsTID().begin(), tkGeom.detsTID().end());
70  dets.insert(dets.end(), tkGeom.detsTOB().begin(), tkGeom.detsTOB().end());
71  dets.insert(dets.end(), tkGeom.detsTEC().begin(), tkGeom.detsTEC().end());
72  for (auto det : dets) {
73  auto detid = det->geographicalId().rawId();
74  const StripGeomDetUnit* stripDet = dynamic_cast<const StripGeomDetUnit*>(tkGeom.idToDet(det->geographicalId()));
75  if (stripDet) {
76  c_rawid.push_back(detid);
77  c_globalZofunitlocalY.push_back(stripDet->toGlobal(LocalVector(0, 1, 0)).z());
78  const auto locB = magField.inTesla(stripDet->surface().position());
79  c_localB.push_back(locB.mag());
80  c_BdotY.push_back(stripDet->surface().toLocal(locB).y());
81  const auto drift = shallow::drift(stripDet, magField, lorentzAngle);
82  c_driftx.push_back(drift.x());
83  c_drifty.push_back(drift.y());
84  c_driftz.push_back(drift.z());
85  c_lorentzAngle.push_back(lorentzAngle.getLorentzAngle(detid));
86  }
87  }
88  auto out = std::make_unique<nanoaod::FlatTable>(c_rawid.size(), m_name, false, false);
89  addColumn(out.get(), "rawid", c_rawid, "DetId");
90  addColumn(out.get(), "globalZofunitlocalY", c_globalZofunitlocalY, "z component of a local unit vector along y");
91  addColumn(out.get(), "localB", c_localB, "Local magnitude of the magnetic field");
92  addColumn(out.get(), "BdotY", c_BdotY, "Magnetic field projection on the local y axis");
93  addColumn(out.get(), "driftx", c_driftx, "x component of the drift vector");
94  addColumn(out.get(), "drifty", c_drifty, "y component of the drift vector");
95  addColumn(out.get(), "driftz", c_driftz, "z component of the drift vector");
96  addColumn(out.get(), "lorentzAngle", c_lorentzAngle, "Lorentz angle from database");
97  iRun.put(std::move(out));
98 
99  auto out2 = std::make_unique<nanoaod::FlatTable>(1, m_magFieldName, true, false);
100  out2->addColumnValue<float>(
101  "origin", magField.inTesla(GlobalPoint(0, 0, 0)).z(), "z-component of the magnetic field at (0,0,0) in Tesla");
102  iRun.put(std::move(out2), "magField");
103 }
104 
Vector3DBase< float, LocalTag >
ConfigurationDescriptions.h
edm::StreamID
Definition: StreamID.h:30
SiStripDependentRecords.h
SiStripLorentzAngleRunInfoTableProducer::m_name
const std::string m_name
Definition: SiStripLorentzAngleRunInfoTableProducer.cc:45
ShallowTools.h
StripGeomDetUnit.h
TrackerGeometry.h
boostedTaus_cff.doc
doc
Definition: boostedTaus_cff.py:20
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
edm::Run
Definition: Run.h:45
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
SiStripLorentzAngleRunInfoTableProducer::m_doc
const std::string m_doc
Definition: SiStripLorentzAngleRunInfoTableProducer.cc:46
SiStripLorentzAngleRunInfoTableProducer::produce
void produce(edm::StreamID, edm::Event &, edm::EventSetup const &) const override
Definition: SiStripLorentzAngleRunInfoTableProducer.cc:32
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
MakerMacros.h
shallow::drift
LocalVector drift(const StripGeomDetUnit *, const MagneticField &, const SiStripLorentzAngle &)
Definition: ShallowTools.cc:36
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::Run::put
void put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Run.h:109
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
IdealMagneticFieldRecord.h
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
ParameterSetDescription.h
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
SiStripLorentzAngleRunInfoTableProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: SiStripLorentzAngleRunInfoTableProducer.cc:34
SiStripLorentzAngleRunInfoTableProducer::globalBeginRunProduce
void globalBeginRunProduce(edm::Run &iRun, edm::EventSetup const &iSetup) const override
Definition: SiStripLorentzAngleRunInfoTableProducer.cc:60
TrackerDigiGeometryRecord.h
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
edm::ParameterSet
Definition: ParameterSet.h:47
SiStripLorentzAngleRunInfoTableProducer::m_lorentzAngleToken
edm::ESGetToken< SiStripLorentzAngle, SiStripLorentzAngleDepRcd > m_lorentzAngleToken
Definition: SiStripLorentzAngleRunInfoTableProducer.cc:49
SiStripLorentzAngleRunInfoTableProducer
Definition: SiStripLorentzAngleRunInfoTableProducer.cc:19
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
ModuleDef.h
MagneticField.h
edm::EventSetup
Definition: EventSetup.h:58
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord >
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FlatTable.h
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
SiStripLorentzAngleRunInfoTableProducer::m_magFieldName
const std::string m_magFieldName
Definition: SiStripLorentzAngleRunInfoTableProducer.cc:45
nanoaod::FlatTable
Definition: FlatTable.h:38
GloballyPositioned::position
const PositionType & position() const
Definition: GloballyPositioned.h:36
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
GloballyPositioned::toLocal
LocalPoint toLocal(const GlobalPoint &gp) const
Definition: GloballyPositioned.h:98
PointingDoubleMultiSkim_cfg.out2
out2
Definition: PointingDoubleMultiSkim_cfg.py:85
SiStripLorentzAngleRunInfoTableProducer::m_magFieldToken
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_magFieldToken
Definition: SiStripLorentzAngleRunInfoTableProducer.cc:48
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
SiStripLorentzAngleRunInfoTableProducer::SiStripLorentzAngleRunInfoTableProducer
SiStripLorentzAngleRunInfoTableProducer(const edm::ParameterSet &params)
Definition: SiStripLorentzAngleRunInfoTableProducer.cc:21
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
SiStripLorentzAngleRunInfoTableProducer::m_tkGeomToken
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > m_tkGeomToken
Definition: SiStripLorentzAngleRunInfoTableProducer.cc:47
ConsumesCollector.h
ParameterSet.h
EDProducer.h
TableParser.table
table
Definition: TableParser.py:111
SiStripLorentzAngle.h
edm::Event
Definition: Event.h:73
StripGeomDetUnit
Definition: StripGeomDetUnit.h:15