CMS 3D CMS Logo

MisalignedMuonESProducer.cc
Go to the documentation of this file.
1 
13 // Framework
22 
23 // Conditions database
26 
27 // Alignment
36 
37 #include <memory>
38 
40 public:
43 
45  ~MisalignedMuonESProducer() override;
46 
48  edm::ESProducts<std::unique_ptr<DTGeometry>, std::unique_ptr<CSCGeometry> > produce(const MuonGeometryRecord&);
49 
51  void saveToDB();
52 
53 private:
54  const bool theSaveToDB;
56 
59 
64 };
65 
66 //__________________________________________________________________________________________________
67 //__________________________________________________________________________________________________
68 //__________________________________________________________________________________________________
69 
70 //__________________________________________________________________________________________________
72  : theSaveToDB(p.getUntrackedParameter<bool>("saveToDbase")),
73  theScenario(p.getParameter<edm::ParameterSet>("scenario")),
74  theDTAlignRecordName("DTAlignmentRcd"),
75  theDTErrorRecordName("DTAlignmentErrorExtendedRcd"),
76  theCSCAlignRecordName("CSCAlignmentRcd"),
77  theCSCErrorRecordName("CSCAlignmentErrorExtendedRcd") {
78  setWhatProduced(this);
79 }
80 
81 //__________________________________________________________________________________________________
83 
84 //__________________________________________________________________________________________________
86  const MuonGeometryRecord& iRecord) {
87  edm::LogInfo("MisalignedMuon") << "Producer called";
88 
89  // Create the Muon geometry from ideal geometry
91  iRecord.getRecord<IdealGeometryRecord>().get(cpv);
92 
94  iRecord.getRecord<IdealGeometryRecord>().get(mdc);
95 
98 
99  auto theDTGeometry = std::make_unique<DTGeometry>();
100  DTGeometryBuilder.build(*theDTGeometry, &(*cpv), *mdc);
101  auto theCSCGeometry = std::make_unique<CSCGeometry>();
102  CSCGeometryBuilder.build(*theCSCGeometry, &(*cpv), *mdc);
103 
104  // Create the alignable hierarchy
105  AlignableMuon* theAlignableMuon = new AlignableMuon(&(*theDTGeometry), &(*theCSCGeometry));
106 
107  // Create misalignment scenario
108  MuonScenarioBuilder scenarioBuilder(theAlignableMuon);
109  scenarioBuilder.applyScenario(theScenario);
110 
111  // Get alignments and errors
112  dt_Alignments = theAlignableMuon->dtAlignments();
114  csc_Alignments = theAlignableMuon->cscAlignments();
116 
117  // Misalign the EventSetup geometry
118  GeometryAligner aligner;
119 
121  aligner.applyAlignments<CSCGeometry>(
123 
124  // Write alignments to DB
125  if (theSaveToDB)
126  this->saveToDB();
127 
128  edm::LogInfo("MisalignedMuon") << "Producer done";
129 
130  return edm::es::products(std::move(theDTGeometry), std::move(theCSCGeometry));
131 }
132 
133 //__________________________________________________________________________________________________
135  // Call service
137  if (!poolDbService.isAvailable()) // Die if not available
138  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
139 
140  // Store DT alignments and errors
141  poolDbService->writeOne<Alignments>(&(*dt_Alignments), poolDbService->beginOfTime(), theDTAlignRecordName);
142  poolDbService->writeOne<AlignmentErrorsExtended>(
143  &(*dt_AlignmentErrorsExtended), poolDbService->beginOfTime(), theDTErrorRecordName);
144 
145  // Store CSC alignments and errors
146  poolDbService->writeOne<Alignments>(&(*csc_Alignments), poolDbService->beginOfTime(), theCSCAlignRecordName);
147  poolDbService->writeOne<AlignmentErrorsExtended>(
148  &(*csc_AlignmentErrorsExtended), poolDbService->beginOfTime(), theCSCErrorRecordName);
149 }
150 //__________________________________________________________________________________________________
151 
edm::eventsetup::DependentRecordImplementation::getRecord
const DepRecordT getRecord() const
Definition: DependentRecordImplementation.h:51
DTGeometry
Definition: DTGeometry.h:28
AlignableMuon::dtAlignmentErrorsExtended
AlignmentErrorsExtended * dtAlignmentErrorsExtended()
Get DT alignment errors sorted by DetId.
Definition: AlignableMuon.cc:426
DTGeometryBuilder
MisalignedMuonESProducer
Definition: MisalignedMuonESProducer.cc:39
electrons_cff.bool
bool
Definition: electrons_cff.py:372
MisalignedMuonESProducer::theDTErrorRecordName
std::string theDTErrorRecordName
Definition: MisalignedMuonESProducer.cc:57
ESTransientHandle.h
MessageLogger.h
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:187
ESHandle.h
edm
HLT enums.
Definition: AlignableModifier.h:19
DTGeometryBuilderFromDDD
Definition: DTGeometryBuilderFromDDD.h:31
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
MisalignedMuonESProducer::~MisalignedMuonESProducer
~MisalignedMuonESProducer() override
Destructor.
Definition: MisalignedMuonESProducer.cc:82
MisalignedMuonESProducer::theScenario
const edm::ParameterSet theScenario
whether or not writing to DB
Definition: MisalignedMuonESProducer.cc:55
MisalignedMuonESProducer::dt_AlignmentErrorsExtended
AlignmentErrorsExtended * dt_AlignmentErrorsExtended
Definition: MisalignedMuonESProducer.cc:61
MisalignedMuonESProducer::theSaveToDB
const bool theSaveToDB
Definition: MisalignedMuonESProducer.cc:54
edm::LogInfo
Definition: MessageLogger.h:254
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
ESProducer.h
AlignableMuon::cscAlignments
Alignments * cscAlignments()
Get CSC alignments sorted by DetId.
Definition: AlignableMuon.cc:433
edm::ESProducts
Definition: ESProducts.h:105
MisalignedMuonESProducer::csc_AlignmentErrorsExtended
AlignmentErrorsExtended * csc_AlignmentErrorsExtended
Definition: MisalignedMuonESProducer.cc:63
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
AlignableMuon::dtAlignments
Alignments * dtAlignments()
Get DT alignments sorted by DetId.
Definition: AlignableMuon.cc:419
MisalignedMuonESProducer::theCSCErrorRecordName
std::string theCSCErrorRecordName
Definition: MisalignedMuonESProducer.cc:58
edm::es::products
ESProducts< std::remove_reference_t< TArgs >... > products(TArgs &&... args)
Definition: ESProducts.h:128
MuonScenarioBuilder.h
DTGeometryBuilderFromDDD.h
CSCGeometry
Definition: CSCGeometry.h:24
align::AlignableMuon
Definition: StructureType.h:84
MisalignedMuonESProducer::theCSCAlignRecordName
std::string theCSCAlignRecordName
Definition: MisalignedMuonESProducer.cc:58
CSCGeometryBuilder
Definition: CSCGeometryBuilder.h:20
PoolDBOutputService.h
MuonScenarioBuilder::applyScenario
void applyScenario(const edm::ParameterSet &scenario) override
Apply misalignment scenario to the Muon.
Definition: MuonScenarioBuilder.cc:35
Service.h
MisalignedMuonESProducer::produce
edm::ESProducts< std::unique_ptr< DTGeometry >, std::unique_ptr< CSCGeometry > > produce(const MuonGeometryRecord &)
Produce the misaligned Muon geometry and store it.
Definition: MisalignedMuonESProducer.cc:85
edm::ESHandle
Definition: DTSurvey.h:22
CSCGeometryBuilder::build
void build(CSCGeometry &theGeometry, const RecoIdealGeometry &rig, const CSCRecoDigiParameters &cscpars)
Build the geometry.
Definition: CSCGeometryBuilder.cc:17
MisalignedMuonESProducer::MisalignedMuonESProducer
MisalignedMuonESProducer(const edm::ParameterSet &p)
Constructor.
Definition: MisalignedMuonESProducer.cc:71
AlignTransform
Definition: AlignTransform.h:15
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ESProducts.h
edm::ParameterSet
Definition: ParameterSet.h:36
ParameterSet
Definition: Functions.h:16
AlignableMuon.h
MisalignedMuonESProducer::dt_Alignments
Alignments * dt_Alignments
Definition: MisalignedMuonESProducer.cc:60
AlignableMuon
Constructor of the full muon geometry.
Definition: AlignableMuon.h:33
edm::Service< cond::service::PoolDBOutputService >
MisalignedMuonESProducer::saveToDB
void saveToDB()
Save alignemnts and error to database.
Definition: MisalignedMuonESProducer.cc:134
CSCGeometryBuilderFromDDD.h
get
#define get
AlignmentErrorsExtended
Definition: AlignmentErrorsExtended.h:10
edm::ESTransientHandle
Definition: ESTransientHandle.h:41
ModuleFactory.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
MisalignedMuonESProducer::theDTAlignRecordName
std::string theDTAlignRecordName
misalignment scenario
Definition: MisalignedMuonESProducer.cc:57
GeometryAligner.h
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
CSCGeometryBuilderFromDDD
Definition: CSCGeometryBuilderFromDDD.h:30
cond::service::PoolDBOutputService::writeOne
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
Definition: PoolDBOutputService.h:57
Alignable.h
Exception.h
edm::ESProducer
Definition: ESProducer.h:101
cms::Exception
Definition: Exception.h:70
ParameterSet.h
AlignableMuon::cscAlignmentErrorsExtended
AlignmentErrorsExtended * cscAlignmentErrorsExtended()
Get CSC alignment errors sorted by DetId.
Definition: AlignableMuon.cc:445
MuonGeometryRecord.h
Alignments
Definition: Alignments.h:10
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
GeometryAligner::applyAlignments
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
Definition: GeometryAligner.h:52
MuonScenarioBuilder
Builds a scenario from configuration and applies it to the alignable Muon.
Definition: MuonScenarioBuilder.h:19
IdealGeometryRecord
Definition: IdealGeometryRecord.h:27
MisalignedMuonESProducer::csc_Alignments
Alignments * csc_Alignments
Definition: MisalignedMuonESProducer.cc:62
GeometryAligner
Class to update a given geometry with a set of alignments.
Definition: GeometryAligner.h:33
CSCGeometry.h