CMS 3D CMS Logo

MuonMisalignedProducer.cc
Go to the documentation of this file.
1 
13 // Framework
20 
21 // Conditions database
24 
25 // Alignment
33 
34 #include <memory>
35 
37 public:
40 
42  ~MuonMisalignedProducer() override;
43 
45  void analyze(const edm::Event&, const edm::EventSetup&) override;
47  void saveToDB();
48 
49 private:
50  const bool theSaveToDB;
52 
56 
61 };
62 
63 //__________________________________________________________________________________________________
65  : theSaveToDB(p.getUntrackedParameter<bool>("saveToDbase")),
66  theScenario(p.getParameter<edm::ParameterSet>("scenario")),
67  theDTAlignRecordName("DTAlignmentRcd"),
68  theDTErrorRecordName("DTAlignmentErrorExtendedRcd"),
69  theCSCAlignRecordName("CSCAlignmentRcd"),
70  theCSCErrorRecordName("CSCAlignmentErrorExtendedRcd"),
71  theIdealGeometryLabel("idealForMuonMisalignedProducer") {}
72 
73 //__________________________________________________________________________________________________
75 
76 //__________________________________________________________________________________________________
78  edm::LogInfo("MisalignedMuon") << "Producer called";
79  // Create the Muon geometry from ideal geometry
80  edm::ESHandle<DTGeometry> theDTGeometry;
81  edm::ESHandle<CSCGeometry> theCSCGeometry;
82  eventSetup.get<MuonGeometryRecord>().get(theIdealGeometryLabel, theDTGeometry);
83  eventSetup.get<MuonGeometryRecord>().get(theIdealGeometryLabel, theCSCGeometry);
84 
85  // Create the alignable hierarchy
86  AlignableMuon* theAlignableMuon = new AlignableMuon(&(*theDTGeometry), &(*theCSCGeometry));
87 
88  // Create misalignment scenario
89  MuonScenarioBuilder scenarioBuilder(theAlignableMuon);
90  scenarioBuilder.applyScenario(theScenario);
91 
92  // Get alignments and errors
93  dt_Alignments = theAlignableMuon->dtAlignments();
95  csc_Alignments = theAlignableMuon->cscAlignments();
97 
98  // Misalign the EventSetup geometry
99  GeometryAligner aligner;
100 
102  aligner.applyAlignments<CSCGeometry>(
104 
105  // Write alignments to DB
106  if (theSaveToDB)
107  this->saveToDB();
108 
109  edm::LogInfo("MisalignedMuon") << "Producer done";
110 }
111 
112 //__________________________________________________________________________________________________
114  // Call service
116  if (!poolDbService.isAvailable()) // Die if not available
117  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
118 
119  // Store DT alignments and errors
120  poolDbService->writeOne<Alignments>(&(*dt_Alignments), poolDbService->beginOfTime(), theDTAlignRecordName);
121  poolDbService->writeOne<AlignmentErrorsExtended>(
122  &(*dt_AlignmentErrorsExtended), poolDbService->beginOfTime(), theDTErrorRecordName);
123 
124  // Store CSC alignments and errors
125  poolDbService->writeOne<Alignments>(&(*csc_Alignments), poolDbService->beginOfTime(), theCSCAlignRecordName);
126  poolDbService->writeOne<AlignmentErrorsExtended>(
127  &(*csc_AlignmentErrorsExtended), poolDbService->beginOfTime(), theCSCErrorRecordName);
128 }
129 //____________________________________________________________________________________________
DTGeometry
Definition: DTGeometry.h:28
AlignableMuon::dtAlignmentErrorsExtended
AlignmentErrorsExtended * dtAlignmentErrorsExtended()
Get DT alignment errors sorted by DetId.
Definition: AlignableMuon.cc:426
electrons_cff.bool
bool
Definition: electrons_cff.py:393
EDAnalyzer.h
MessageLogger.h
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:215
ESHandle.h
edm
HLT enums.
Definition: AlignableModifier.h:19
MuonMisalignedProducer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Produce the misaligned Muon geometry and store iti.
Definition: MuonMisalignedProducer.cc:77
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
MuonMisalignedProducer::MuonMisalignedProducer
MuonMisalignedProducer(const edm::ParameterSet &)
Constructor.
Definition: MuonMisalignedProducer.cc:64
AlignableMuon::cscAlignments
Alignments * cscAlignments()
Get CSC alignments sorted by DetId.
Definition: AlignableMuon.cc:433
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::one::EDAnalyzer
Definition: EDAnalyzer.h:30
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
MuonMisalignedProducer::saveToDB
void saveToDB()
Save alignemnts and error to database.
Definition: MuonMisalignedProducer.cc:113
AlignableMuon::dtAlignments
Alignments * dtAlignments()
Get DT alignments sorted by DetId.
Definition: AlignableMuon.cc:419
GeometryAligner::applyAlignments
void applyAlignments(const C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
Definition: GeometryAligner.h:52
MuonScenarioBuilder.h
CSCGeometry
Definition: CSCGeometry.h:24
align::AlignableMuon
Definition: StructureType.h:84
MakerMacros.h
PoolDBOutputService.h
MuonScenarioBuilder::applyScenario
void applyScenario(const edm::ParameterSet &scenario) override
Apply misalignment scenario to the Muon.
Definition: MuonScenarioBuilder.cc:35
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
MuonMisalignedProducer::theDTAlignRecordName
std::string theDTAlignRecordName
misalignment scenario
Definition: MuonMisalignedProducer.cc:53
MuonMisalignedProducer
Definition: MuonMisalignedProducer.cc:36
edm::ESHandle< DTGeometry >
MuonMisalignedProducer::csc_Alignments
Alignments * csc_Alignments
Definition: MuonMisalignedProducer.cc:59
MuonMisalignedProducer::csc_AlignmentErrorsExtended
AlignmentErrorsExtended * csc_AlignmentErrorsExtended
Definition: MuonMisalignedProducer.cc:60
MuonMisalignedProducer::theSaveToDB
const bool theSaveToDB
Definition: MuonMisalignedProducer.cc:50
AlignTransform
Definition: AlignTransform.h:15
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DTGeometry.h
edm::ParameterSet
Definition: ParameterSet.h:47
ParameterSet
Definition: Functions.h:16
AlignableMuon.h
AlignableMuon
Constructor of the full muon geometry.
Definition: AlignableMuon.h:33
edm::Service< cond::service::PoolDBOutputService >
MuonMisalignedProducer::theDTErrorRecordName
std::string theDTErrorRecordName
Definition: MuonMisalignedProducer.cc:53
edm::EventSetup
Definition: EventSetup.h:57
MuonMisalignedProducer::dt_Alignments
Alignments * dt_Alignments
Definition: MuonMisalignedProducer.cc:57
get
#define get
AlignmentErrorsExtended
Definition: AlignmentErrorsExtended.h:10
MuonMisalignedProducer::theCSCAlignRecordName
std::string theCSCAlignRecordName
Definition: MuonMisalignedProducer.cc:54
GeometryAligner.h
cond::service::PoolDBOutputService::writeOne
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
Definition: PoolDBOutputService.h:63
Alignable.h
MuonMisalignedProducer::~MuonMisalignedProducer
~MuonMisalignedProducer() override
Destructor.
Definition: MuonMisalignedProducer.cc:74
Exception.h
MuonMisalignedProducer::theCSCErrorRecordName
std::string theCSCErrorRecordName
Definition: MuonMisalignedProducer.cc:54
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
event
Definition: event.py:1
MuonMisalignedProducer::theIdealGeometryLabel
std::string theIdealGeometryLabel
Definition: MuonMisalignedProducer.cc:55
MuonMisalignedProducer::dt_AlignmentErrorsExtended
AlignmentErrorsExtended * dt_AlignmentErrorsExtended
Definition: MuonMisalignedProducer.cc:58
edm::Event
Definition: Event.h:73
Alignments
Definition: Alignments.h:10
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
MuonMisalignedProducer::theScenario
const edm::ParameterSet theScenario
whether or not writing to DB
Definition: MuonMisalignedProducer.cc:51
MuonScenarioBuilder
Builds a scenario from configuration and applies it to the alignable Muon.
Definition: MuonScenarioBuilder.h:19
GeometryAligner
Class to update a given geometry with a set of alignments.
Definition: GeometryAligner.h:33
CSCGeometry.h