CMS 3D CMS Logo

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 >
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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, VeryForwardRealGeometryRecordtokenRealGeometry_
 

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
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

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::PPSModifySingularModes ( const edm::ParameterSet ps)

Definition at line 46 of file PPSModifySingularModes.cc.

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

References edm::BeginRun.

Member Function Documentation

◆ analyze()

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 40 of file PPSModifySingularModes.cc.

◆ beginRun()

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

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 51 of file PPSModifySingularModes.cc.

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 }

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

Member Data Documentation

◆ ps_

edm::ParameterSet PPSModifySingularModes::ps_
private

Definition at line 34 of file PPSModifySingularModes.cc.

Referenced by beginRun().

◆ tokenRealGeometry_

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

Definition at line 36 of file PPSModifySingularModes.cc.

Referenced by beginRun().

input
static const std::string input
Definition: EdmProvDump.cc:48
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
geometry
Definition: geometry.py:1
PPSModifySingularModes::tokenRealGeometry_
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > tokenRealGeometry_
Definition: PPSModifySingularModes.cc:36
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
testProducerWithPsetDescEmpty_cfi.z2
z2
Definition: testProducerWithPsetDescEmpty_cfi.py:41
edm::FileInPath
Definition: FileInPath.h:61
download_sqlite_cfg.outputFile
outputFile
Definition: download_sqlite_cfg.py:5
DDAxes::z
CTPPSRPAlignmentCorrectionsMethods::writeToXML
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
Definition: CTPPSRPAlignmentCorrectionsMethods.cc:314
CTPPSDetId
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:31
dtResolutionTest_cfi.inputFile
inputFile
Definition: dtResolutionTest_cfi.py:14
factorRPFromSensorCorrections
void factorRPFromSensorCorrections(const CTPPSRPAlignmentCorrectionsData &input, CTPPSRPAlignmentCorrectionsData &expanded, CTPPSRPAlignmentCorrectionsData &factored, const AlignmentGeometry &, bool equalWeights=false, unsigned int verbosity=0)
Definition: Utilities.cc:92
PPSModifySingularModes::ps_
edm::ParameterSet ps_
Definition: PPSModifySingularModes.cc:34
AlignmentTask::buildGeometry
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
Definition: AlignmentTask.cc:49
Exception
Definition: hltDiff.cc:245
CTPPSRPAlignmentCorrectionsData
Container for CTPPS RP alignment corrections. The corrections are stored on two levels - RP and senso...
Definition: CTPPSRPAlignmentCorrectionsData.h:24
AlignmentGeometry
Definition: AlignmentGeometry.h:55
ztail.d
d
Definition: ztail.py:151
CTPPSRPAlignmentCorrectionData
Alignment correction for an element of the CT-PPS detector. Within the geometry description,...
Definition: CTPPSRPAlignmentCorrectionData.h:58
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
CTPPSRPAlignmentCorrectionsMethods::loadFromXML
static CTPPSRPAlignmentCorrectionsDataSequence loadFromXML(const std::string &fileName)
loads sequence of alignment corrections from XML file
Definition: CTPPSRPAlignmentCorrectionsMethods.cc:108
CTPPSRPAlignmentCorrectionsDataSequence
Time sequence of alignment corrections. I/O methods have been factored out to: CondFormats/PPSObjects...
Definition: CTPPSRPAlignmentCorrectionsDataSequence.h:22