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 Member Functions | Private Attributes
PPSModifySingularModes Class Reference

Modifies the alignment modes unconstrained by the track-based alignment. More...

Inheritance diagram for PPSModifySingularModes:
edm::stream::EDAnalyzer< T > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 PPSModifySingularModes (const edm::ParameterSet &ps)
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< T >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
 EDAnalyzerBase (const EDAnalyzerBase &)=delete
 
ModuleDescription const & moduleDescription () const
 
const EDAnalyzerBaseoperator= (const EDAnalyzerBase &)=delete
 
 ~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 Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &es) override
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 

Private Attributes

edm::ParameterSet ps_
 
edm::ESGetToken< CTPPSGeometry,
VeryForwardRealGeometryRecord
tokenRealGeometry_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< T >
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::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

Modifies the alignment modes unconstrained by the track-based alignment.

Definition at line 27 of file PPSModifySingularModes.cc.

Constructor & Destructor Documentation

PPSModifySingularModes::PPSModifySingularModes ( const edm::ParameterSet ps)

Definition at line 46 of file PPSModifySingularModes.cc.

References edm::BeginRun.

47  : ps_(ps), tokenRealGeometry_(esConsumes<edm::Transition::BeginRun>()) {}
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > tokenRealGeometry_

Member Function Documentation

void PPSModifySingularModes::analyze ( const edm::Event e,
const edm::EventSetup es 
)
inlineoverrideprivatevirtual

Implements edm::stream::EDAnalyzerBase.

Definition at line 38 of file PPSModifySingularModes.cc.

38 {}
void PPSModifySingularModes::beginRun ( edm::Run const &  ,
edm::EventSetup const &  es 
)
overrideprivatevirtual

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 51 of file PPSModifySingularModes.cc.

References CTPPSDetId::arm(), AlignmentTask::buildGeometry(), c, ztail::d, Exception, factorRPFromSensorCorrections(), relativeConstraints::geometry, edm::EventSetup::getData(), edm::ParameterSet::getUntrackedParameter(), input, writeEcalDQMStatus::inputFile, CTPPSRPAlignmentCorrectionsMethods::loadFromXML(), convertSQLitetoXML_cfg::output, download_sqlite_cfg::outputFile, ps_, CTPPSDetId::rp(), CTPPSRPAlignmentCorrectionsData::setSensorCorrection(), CTPPSDetId::station(), tokenRealGeometry_, CTPPSRPAlignmentCorrectionsMethods::writeToXML(), and z.

51  {
52  // get config parameters
53  const double z1 = ps_.getUntrackedParameter<double>("z1");
54  const double z2 = ps_.getUntrackedParameter<double>("z2");
55  const double de_x1 = ps_.getUntrackedParameter<double>("de_x1");
56  const double de_x2 = ps_.getUntrackedParameter<double>("de_x2");
57  const double de_y1 = ps_.getUntrackedParameter<double>("de_y1");
58  const double de_y2 = ps_.getUntrackedParameter<double>("de_y2");
59  const double de_rho1 = ps_.getUntrackedParameter<double>("de_rho1");
60  const double de_rho2 = ps_.getUntrackedParameter<double>("de_rho2");
61 
62  FileInPath inputFileInPath(ps_.getUntrackedParameter<string>("inputFile"));
63  const string inputFile = inputFileInPath.fullPath();
64  const string outputFile = ps_.getUntrackedParameter<string>("outputFile");
65 
66  // validate config parameters
67  if (z1 == z2)
68  throw cms::Exception("PPS") << "z1 equals z2";
69 
70  // calculate slopes and intercepts
71  const double a_x = (de_x2 - de_x1) / (z2 - z1), b_x = de_x1 - a_x * z1;
72  const double a_y = (de_y2 - de_y1) / (z2 - z1), b_y = de_y1 - a_y * z1;
73  const double a_rho = (de_rho2 - de_rho1) / (z2 - z1), b_rho = de_rho1 - a_rho * z1;
74 
75  // get geometry
76  const auto &geometry = es.getData(tokenRealGeometry_);
77 
78  // get input alignments
80  const auto &input = inputSequence.begin()->second;
81 
82  // modify the singular modes
84 
85  for (auto &it : input.getSensorMap()) {
86  const auto &sensorId = it.first;
87 
88  const auto &c = geometry.sensorTranslation(sensorId);
89 
90  // pixels cannot be described by one single value of z, but no better approxiamtion can be made
91  const double z = c.z();
92 
93  double de_ShX = a_x * z + b_x;
94  double de_ShY = a_y * z + b_y;
95  const double de_RotZ = a_rho * z + b_rho;
96 
97  // add the effect of global rotation (about origin, not sensor centre)
98  de_ShX -= +de_RotZ * (c.y() + de_ShY);
99  de_ShY -= -de_RotZ * (c.x() + de_ShX);
100 
101  CTPPSRPAlignmentCorrectionData d = it.second;
102  d.setShX(d.getShX() + de_ShX);
103  d.setShY(d.getShY() + de_ShY);
104  d.setRotZ(d.getRotZ() + de_RotZ);
105 
106  output.setSensorCorrection(sensorId, d);
107  }
108 
109  // build list of RPs
110  vector<unsigned int> rps;
111  unsigned int last_rp = 123456;
112  for (auto &it : input.getSensorMap()) {
113  CTPPSDetId senId(it.first);
114  unsigned int rpDecId = senId.arm() * 100 + senId.station() * 10 + senId.rp();
115 
116  if (last_rp != rpDecId) {
117  rps.push_back(rpDecId);
118  last_rp = rpDecId;
119  }
120  }
121 
122  // build alignment geometry (needed for the factorisation below)
123  AlignmentGeometry alignmentGeometry;
124  vector<unsigned int> excludePlanes;
125  AlignmentTask::buildGeometry(rps, excludePlanes, &geometry, 0., alignmentGeometry);
126 
127  // factorise output
128  CTPPSRPAlignmentCorrectionsData outputExpanded;
129  CTPPSRPAlignmentCorrectionsData outputFactored;
130 
131  const bool equalWeights = false;
132  factorRPFromSensorCorrections(output, outputExpanded, outputFactored, alignmentGeometry, equalWeights, 1);
133 
134  // save output
135  CTPPSRPAlignmentCorrectionsMethods::writeToXML(outputFactored, outputFile, false, false, true, true, true, true);
136 }
T getUntrackedParameter(std::string const &, T const &) const
const edm::EventSetup & c
Time sequence of alignment corrections. I/O methods have been factored out to: CondFormats/PPSObjects...
static void buildGeometry(const std::vector< unsigned int > &rpDecIds, const std::vector< unsigned int > &excludedSensors, const CTPPSGeometry *, double z0, AlignmentGeometry &geometry)
builds the alignment geometry
static std::string const input
Definition: EdmProvDump.cc:47
tuple d
Definition: ztail.py:151
static CTPPSRPAlignmentCorrectionsDataSequence loadFromXML(const std::string &fileName)
loads sequence of alignment corrections from XML file
void factorRPFromSensorCorrections(const CTPPSRPAlignmentCorrectionsData &input, CTPPSRPAlignmentCorrectionsData &expanded, CTPPSRPAlignmentCorrectionsData &factored, const AlignmentGeometry &, bool equalWeights=false, unsigned int verbosity=0)
Definition: Utilities.cc:93
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
Container for CTPPS RP alignment corrections. The corrections are stored on two levels - RP and senso...
static void writeToXML(const CTPPSRPAlignmentCorrectionsDataSequence &seq, const std::string &fileName, bool precise=false, bool wrErrors=true, bool wrSh_xy=true, bool wrSh_z=false, bool wrRot_xy=false, bool wrRot_z=true)
writes sequence of alignment corrections into a single XML file
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > tokenRealGeometry_
void setSensorCorrection(unsigned int id, const CTPPSRPAlignmentCorrectionData &ac)
sets the alignment correction for the given sensor
Alignment correction for an element of the CT-PPS detector. Within the geometry description, every sensor (more generally every element) is given its translation and rotation. These two quantities shall be understood in local-to-global coordinate transform. That is, if r_l is a point in local coordinate system and x_g in global, then it holds.

Member Data Documentation

edm::ParameterSet PPSModifySingularModes::ps_
private

Definition at line 32 of file PPSModifySingularModes.cc.

Referenced by beginRun().

edm::ESGetToken<CTPPSGeometry, VeryForwardRealGeometryRecord> PPSModifySingularModes::tokenRealGeometry_
private

Definition at line 34 of file PPSModifySingularModes.cc.

Referenced by beginRun().