CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCGeometryESModule.cc
Go to the documentation of this file.
1 
2 #include "CSCGeometryESModule.h"
6 
9 
10 // #include "CondFormats/DataRecord/interface/RecoIdealGeometryRcd.h"
11 // #include "CondFormats/DataRecord/interface/CSCRecoDigiParametersRcd.h"
12 //#include "Geometry/Records/interface/RecoIdealGeometryRcd.h"
18 
19 // Alignments
26 
30 
31 #include <memory>
32 
33 using namespace edm;
34 
36  : recreateGeometry_(true),
37  alignmentsLabel_(p.getParameter<std::string>("alignmentsLabel")),
38  myLabel_(p.getParameter<std::string>("appendToDataLabel"))
39 {
40 
41  // Choose wire geometry modelling
42  // We now _require_ some wire geometry specification in the CSCOrcaSpec.xml file
43  // in the DDD Geometry.
44  // Default as of transition to CMSSW is to use real values.
45  // Alternative is to use pseudo-values which match reasonably closely
46  // the calculated geometry values used up to and including ORCA_8_8_1.
47  // (This was the default in ORCA.)
48 
49  useRealWireGeometry = p.getParameter<bool>("useRealWireGeometry");
50 
51  // Suppress strips altogether in ME1a region of ME11?
52 
53  useOnlyWiresInME1a = p.getParameter<bool>("useOnlyWiresInME1a");
54 
55  // Allow strips in ME1a region of ME11 but gang them?
56  // Default is now to treat ME1a with ganged strips (e.g. in clusterizer)
57 
58  useGangedStripsInME1a = p.getParameter<bool>("useGangedStripsInME1a");
59 
60  if ( useGangedStripsInME1a ) useOnlyWiresInME1a = false; // override possible inconsistentcy
61 
62  // Use the backed-out offsets that correct the CTI
63  useCentreTIOffsets = p.getParameter<bool>("useCentreTIOffsets");
64 
65  // Debug printout etc. in CSCGeometry etc.
66 
67  debugV = p.getUntrackedParameter<bool>("debugV", false);
68 
69  // Find out if using the DDD or CondDB Geometry source.
70  useDDD_ = p.getParameter<bool>("useDDD");
71 
72  // Feed these value to where I need them
73  applyAlignment_ = p.getParameter<bool>("applyAlignment");
74 
75 
76  edm::LogInfo("Geometry") << "@SUB=CSCGeometryESModule"
77  << "Label '" << myLabel_ << "' "
78  << (applyAlignment_ ? "looking for" : "IGNORING")
79  << " alignment labels '" << alignmentsLabel_ << "'.";
80  if(useDDD_) {
82  } else {
84  }
85 }
86 
87 
89 
90 
91 boost::shared_ptr<CSCGeometry> CSCGeometryESModule::produce(const MuonGeometryRecord& record) {
92 
93  initCSCGeometry_(record);
94 
95  // Called whenever the alignments or alignment errors change
96 
97  if ( applyAlignment_ ) {
98  // applyAlignment_ is scheduled for removal.
99  // Ideal geometry obtained by using 'fake alignment' (with applyAlignment_ = true)
100  edm::ESHandle<Alignments> globalPosition;
101  record.getRecord<GlobalPositionRcd>().get(alignmentsLabel_, globalPosition);
102  edm::ESHandle<Alignments> alignments;
103  record.getRecord<CSCAlignmentRcd>().get(alignmentsLabel_, alignments);
105 // <<<<<<< CSCGeometryESModule.cc
106 // record.getRecord<CSCAlignmentErrorExtendedRcd>().get( alignmentErrors );
107 // GeometryAligner aligner;
108 // aligner.applyAlignments<CSCGeometry>( &(*_cscGeometry),
109 // &(*alignments), &(*alignmentErrors),
110 // align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)));
111 // =======
112  record.getRecord<CSCAlignmentErrorExtendedRcd>().get(alignmentsLabel_, alignmentErrors);
113  // Only apply alignment if values exist
114  if (alignments->empty() && alignmentErrors->empty() && globalPosition->empty()) {
115  edm::LogInfo("Config") << "@SUB=CSCGeometryRecord::produce"
116  << "Alignment(Error)s and global position (label '"
117  << alignmentsLabel_ << "') empty: Geometry producer (label "
118  << "'" << myLabel_ << "') assumes fake and does not apply.";
119  } else {
120  GeometryAligner aligner;
121  aligner.applyAlignments<CSCGeometry>( &(*cscGeometry), &(*alignments), &(*alignmentErrors),
122  align::DetectorGlobalPosition(*globalPosition, DetId(DetId::Muon)) );
123  }
124 // >>>>>>> 1.8
125  }
126 
127  return cscGeometry;
128 }
129 
130 
132 {
133  if(not recreateGeometry_) return;
134 
135  // Updates whenever a dependent Record was changed
136 
138  useCentreTIOffsets ) );
139 
140  // cscGeometry->setUseRealWireGeometry( useRealWireGeometry );
141  // cscGeometry->setOnlyWiresInME1a( useOnlyWiresInME1a );
142  // cscGeometry->setGangedStripsInME1a( useGangedStripsInME1a );
143  // cscGeometry->setUseCentreTIOffsets( useCentreTIOffsets );
144  // cscGeometry->setDebugV( debugV );
145 
146  // if ( debugV ) cscGeometry->queryModelling();
147 
148  // Called whenever the muon numbering (or ideal geometry) changes
149  //
150  if ( useDDD_ ) {
153  record.getRecord<IdealGeometryRecord>().get(cpv);
154  record.getRecord<MuonNumberingRecord>().get( mdc );
156  // _cscGeometry = boost::shared_ptr<CSCGeometry>(builder.build(_cscGeometry, &(*cpv), *mdc));
157  builder.build(cscGeometry, &(*cpv), *mdc);
158  } else {
161  record.getRecord<CSCRecoGeometryRcd>().get(rig);
162  record.getRecord<CSCRecoDigiParametersRcd>().get(rdp);
163  CSCGeometryBuilder cscgb;
164  // _cscGeometry = boost::shared_ptr<CSCGeometry>(cscgb.build(_cscGeometry, *rig, *rdp));
165  cscgb.build(cscGeometry, *rig, *rdp);
166  }
167  recreateGeometry_=false;
168 }
169 
171  recreateGeometry_=true;
172 }
174  recreateGeometry_=true;
175 }
177  recreateGeometry_=true;
178 }
179 
180 
T getParameter(std::string const &) const
void cscRecoDigiParametersChanged_(const CSCRecoDigiParametersRcd &)
T getUntrackedParameter(std::string const &, T const &) const
depends_on::OneHolder< T, TDependsOnRecord > dependsOn(void(T::*iT)(const TDependsOnRecord &))
CSCGeometryESModule(const edm::ParameterSet &p)
Constructor.
const std::string alignmentsLabel_
Class to update a given geometry with a set of alignments.
JetCorrectorParameters::Record record
Definition: classes.h:7
void muonNumberingChanged_(const MuonNumberingRecord &)
Called when geometry description changes.
const std::string myLabel_
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
void build(boost::shared_ptr< CSCGeometry > geom, const DDCompactView *fv, const MuonDDDConstants &muonConstants)
Build the geometry.
virtual ~CSCGeometryESModule()
Destructor.
void cscRecoGeometryChanged_(const CSCRecoGeometryRcd &)
boost::shared_ptr< CSCGeometry > produce(const MuonGeometryRecord &record)
Produce CSCGeometry.
void initCSCGeometry_(const MuonGeometryRecord &)
Definition: DetId.h:18
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
void build(boost::shared_ptr< CSCGeometry > theGeometry, const RecoIdealGeometry &rig, const CSCRecoDigiParameters &cscpars)
Build the geometry.
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
boost::shared_ptr< CSCGeometry > cscGeometry