CMS 3D CMS Logo

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

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 Produce the misaligned Muon geometry and store iti. More...
 
 MuonMisalignedProducer (const edm::ParameterSet &)
 Constructor. More...
 
void saveToDB ()
 Save alignemnts and error to database. More...
 
 ~MuonMisalignedProducer () override
 Destructor. More...
 
- 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 Attributes

AlignmentErrorsExtended csc_AlignmentErrorsExtended
 
Alignments csc_Alignments
 
AlignmentErrorsExtended dt_AlignmentErrorsExtended
 
Alignments dt_Alignments
 
edm::ESGetToken< CSCGeometry, MuonGeometryRecordesTokenCSC_
 
edm::ESGetToken< DTGeometry, MuonGeometryRecordesTokenDT_
 
edm::ESGetToken< GEMGeometry, MuonGeometryRecordesTokenGEM_
 
AlignmentErrorsExtended gem_AlignmentErrorsExtended
 
Alignments gem_Alignments
 
std::string theCSCAlignRecordName
 
std::string theCSCErrorRecordName
 
std::string theDTAlignRecordName
 misalignment scenario More...
 
std::string theDTErrorRecordName
 
std::string theGEMAlignRecordName
 
std::string theGEMErrorRecordName
 
const bool theSaveToDB
 
const edm::ParameterSet theScenario
 whether or not writing to DB More...
 

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 39 of file MuonMisalignedProducer.cc.

Constructor & Destructor Documentation

◆ MuonMisalignedProducer()

MuonMisalignedProducer::MuonMisalignedProducer ( const edm::ParameterSet p)

Constructor.

Definition at line 73 of file MuonMisalignedProducer.cc.

74  : theSaveToDB(p.getUntrackedParameter<bool>("saveToDbase")),
75  theScenario(p.getParameter<edm::ParameterSet>("scenario")),
76  theDTAlignRecordName("DTAlignmentRcd"),
77  theDTErrorRecordName("DTAlignmentErrorExtendedRcd"),
78  theCSCAlignRecordName("CSCAlignmentRcd"),
79  theCSCErrorRecordName("CSCAlignmentErrorExtendedRcd"),
80  theGEMAlignRecordName("GEMAlignmentRcd"),
81  theGEMErrorRecordName("GEMAlignmentErrorExtendedRcd"),
82  esTokenDT_(esConsumes(edm::ESInputTag("", "idealForMuonMisalignedProducer"))),
83  esTokenCSC_(esConsumes(edm::ESInputTag("", "idealForMuonMisalignedProducer"))),
84  esTokenGEM_(esConsumes(edm::ESInputTag("", "idealForMuonMisalignedProducer"))) {}
edm::ESGetToken< DTGeometry, MuonGeometryRecord > esTokenDT_
const edm::ParameterSet theScenario
whether or not writing to DB
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > esTokenCSC_
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > esTokenGEM_
std::string theDTAlignRecordName
misalignment scenario

◆ ~MuonMisalignedProducer()

MuonMisalignedProducer::~MuonMisalignedProducer ( )
overridedefault

Destructor.

Member Function Documentation

◆ analyze()

void MuonMisalignedProducer::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)
overridevirtual

Produce the misaligned Muon geometry and store iti.

Implements edm::one::EDAnalyzerBase.

Definition at line 90 of file MuonMisalignedProducer.cc.

References align::AlignableMuon, MuonScenarioBuilder::applyScenario(), csc_AlignmentErrorsExtended, csc_Alignments, AlignableMuon::cscAlignmentErrorsExtended(), AlignableMuon::cscAlignments(), dt_AlignmentErrorsExtended, dt_Alignments, AlignableMuon::dtAlignmentErrorsExtended(), AlignableMuon::dtAlignments(), esTokenCSC_, esTokenDT_, esTokenGEM_, options_cfi::eventSetup, gem_AlignmentErrorsExtended, gem_Alignments, AlignableMuon::gemAlignmentErrorsExtended(), AlignableMuon::gemAlignments(), saveToDB(), theSaveToDB, and theScenario.

90  {
91  edm::LogInfo("MisalignedMuon") << "Producer called";
92  // Create the Muon geometry from ideal geometry
93  edm::ESHandle<DTGeometry> theDTGeometry = eventSetup.getHandle(esTokenDT_);
94  edm::ESHandle<CSCGeometry> theCSCGeometry = eventSetup.getHandle(esTokenCSC_);
95  edm::ESHandle<GEMGeometry> theGEMGeometry = eventSetup.getHandle(esTokenGEM_);
96 
97  // Create the alignable hierarchy
98  AlignableMuon* theAlignableMuon = new AlignableMuon(&(*theDTGeometry), &(*theCSCGeometry), &(*theGEMGeometry));
99 
100  // Create misalignment scenario
101  MuonScenarioBuilder scenarioBuilder(theAlignableMuon);
102  scenarioBuilder.applyScenario(theScenario);
103 
104  // Get alignments and errors
105  dt_Alignments = *(theAlignableMuon->dtAlignments());
106  dt_AlignmentErrorsExtended = *(theAlignableMuon->dtAlignmentErrorsExtended());
107  csc_Alignments = *(theAlignableMuon->cscAlignments());
109  gem_Alignments = *(theAlignableMuon->gemAlignments());
111 
112  // Misalign the EventSetup geometry
113  /* GeometryAligner aligner;
114  aligner.applyAlignments<DTGeometry>(&(*theDTGeometry), dt_Alignments, dt_AlignmentErrorsExtended, AlignTransform());
115  aligner.applyAlignments<CSCGeometry>(
116  &(*theCSCGeometry), csc_Alignments, csc_AlignmentErrorsExtended, AlignTransform());
117  aligner.applyAlignments<GEMGeometry>(
118  &(*theGEMGeometry), gem_Alignments, gem_AlignmentErrorsExtended, AlignTransform());
119  */
120  // Write alignments to DB
121  if (theSaveToDB)
122  this->saveToDB();
123 
124  edm::LogInfo("MisalignedMuon") << "Producer done";
125 }
Builds a scenario from configuration and applies it to the alignable Muon.
edm::ESGetToken< DTGeometry, MuonGeometryRecord > esTokenDT_
const edm::ParameterSet theScenario
whether or not writing to DB
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > esTokenCSC_
Alignments * dtAlignments()
Get DT alignments sorted by DetId.
AlignmentErrorsExtended dt_AlignmentErrorsExtended
AlignmentErrorsExtended * cscAlignmentErrorsExtended()
Get CSC alignment errors sorted by DetId.
Log< level::Info, false > LogInfo
Alignments * cscAlignments()
Get CSC alignments sorted by DetId.
Alignments * gemAlignments()
AlignmentErrorsExtended csc_AlignmentErrorsExtended
AlignmentErrorsExtended * dtAlignmentErrorsExtended()
Get DT alignment errors sorted by DetId.
AlignmentErrorsExtended * gemAlignmentErrorsExtended()
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > esTokenGEM_
void saveToDB()
Save alignemnts and error to database.
Constructor of the full muon geometry.
Definition: AlignableMuon.h:38
AlignmentErrorsExtended gem_AlignmentErrorsExtended

◆ saveToDB()

void MuonMisalignedProducer::saveToDB ( void  )

Save alignemnts and error to database.

Definition at line 128 of file MuonMisalignedProducer.cc.

References cond::service::PoolDBOutputService::beginOfTime(), csc_AlignmentErrorsExtended, csc_Alignments, dt_AlignmentErrorsExtended, dt_Alignments, gem_AlignmentErrorsExtended, gem_Alignments, edm::Service< T >::isAvailable(), theCSCAlignRecordName, theCSCErrorRecordName, theDTAlignRecordName, theDTErrorRecordName, theGEMAlignRecordName, theGEMErrorRecordName, and cond::service::PoolDBOutputService::writeOneIOV().

Referenced by analyze().

128  {
129  // Call service
131  if (!poolDbService.isAvailable()) // Die if not available
132  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
133 
134  // Store DT alignments and errors
135  poolDbService->writeOneIOV<Alignments>(dt_Alignments, poolDbService->beginOfTime(), theDTAlignRecordName);
136  poolDbService->writeOneIOV<AlignmentErrorsExtended>(
138 
139  // Store CSC alignments and errors
140  poolDbService->writeOneIOV<Alignments>(csc_Alignments, poolDbService->beginOfTime(), theCSCAlignRecordName);
141  poolDbService->writeOneIOV<AlignmentErrorsExtended>(
143  poolDbService->writeOneIOV<Alignments>(gem_Alignments, poolDbService->beginOfTime(), theGEMAlignRecordName);
144  poolDbService->writeOneIOV<AlignmentErrorsExtended>(
146 }
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
AlignmentErrorsExtended dt_AlignmentErrorsExtended
AlignmentErrorsExtended csc_AlignmentErrorsExtended
bool isAvailable() const
Definition: Service.h:40
std::string theDTAlignRecordName
misalignment scenario
AlignmentErrorsExtended gem_AlignmentErrorsExtended

Member Data Documentation

◆ csc_AlignmentErrorsExtended

AlignmentErrorsExtended MuonMisalignedProducer::csc_AlignmentErrorsExtended
private

Definition at line 67 of file MuonMisalignedProducer.cc.

Referenced by analyze(), and saveToDB().

◆ csc_Alignments

Alignments MuonMisalignedProducer::csc_Alignments
private

Definition at line 66 of file MuonMisalignedProducer.cc.

Referenced by analyze(), and saveToDB().

◆ dt_AlignmentErrorsExtended

AlignmentErrorsExtended MuonMisalignedProducer::dt_AlignmentErrorsExtended
private

Definition at line 65 of file MuonMisalignedProducer.cc.

Referenced by analyze(), and saveToDB().

◆ dt_Alignments

Alignments MuonMisalignedProducer::dt_Alignments
private

Definition at line 64 of file MuonMisalignedProducer.cc.

Referenced by analyze(), and saveToDB().

◆ esTokenCSC_

edm::ESGetToken<CSCGeometry, MuonGeometryRecord> MuonMisalignedProducer::esTokenCSC_
private

Definition at line 61 of file MuonMisalignedProducer.cc.

Referenced by analyze().

◆ esTokenDT_

edm::ESGetToken<DTGeometry, MuonGeometryRecord> MuonMisalignedProducer::esTokenDT_
private

Definition at line 60 of file MuonMisalignedProducer.cc.

Referenced by analyze().

◆ esTokenGEM_

edm::ESGetToken<GEMGeometry, MuonGeometryRecord> MuonMisalignedProducer::esTokenGEM_
private

Definition at line 62 of file MuonMisalignedProducer.cc.

Referenced by analyze().

◆ gem_AlignmentErrorsExtended

AlignmentErrorsExtended MuonMisalignedProducer::gem_AlignmentErrorsExtended
private

Definition at line 69 of file MuonMisalignedProducer.cc.

Referenced by analyze(), and saveToDB().

◆ gem_Alignments

Alignments MuonMisalignedProducer::gem_Alignments
private

Definition at line 68 of file MuonMisalignedProducer.cc.

Referenced by analyze(), and saveToDB().

◆ theCSCAlignRecordName

std::string MuonMisalignedProducer::theCSCAlignRecordName
private

Definition at line 57 of file MuonMisalignedProducer.cc.

Referenced by saveToDB().

◆ theCSCErrorRecordName

std::string MuonMisalignedProducer::theCSCErrorRecordName
private

Definition at line 57 of file MuonMisalignedProducer.cc.

Referenced by saveToDB().

◆ theDTAlignRecordName

std::string MuonMisalignedProducer::theDTAlignRecordName
private

misalignment scenario

Definition at line 56 of file MuonMisalignedProducer.cc.

Referenced by saveToDB().

◆ theDTErrorRecordName

std::string MuonMisalignedProducer::theDTErrorRecordName
private

Definition at line 56 of file MuonMisalignedProducer.cc.

Referenced by saveToDB().

◆ theGEMAlignRecordName

std::string MuonMisalignedProducer::theGEMAlignRecordName
private

Definition at line 58 of file MuonMisalignedProducer.cc.

Referenced by saveToDB().

◆ theGEMErrorRecordName

std::string MuonMisalignedProducer::theGEMErrorRecordName
private

Definition at line 58 of file MuonMisalignedProducer.cc.

Referenced by saveToDB().

◆ theSaveToDB

const bool MuonMisalignedProducer::theSaveToDB
private

Definition at line 53 of file MuonMisalignedProducer.cc.

Referenced by analyze().

◆ theScenario

const edm::ParameterSet MuonMisalignedProducer::theScenario
private

whether or not writing to DB

Definition at line 54 of file MuonMisalignedProducer.cc.

Referenced by analyze().