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);
104  edm::ESHandle<AlignmentErrors> alignmentErrors;
105 // <<<<<<< CSCGeometryESModule.cc
106 // record.getRecord<CSCAlignmentErrorRcd>().get( alignmentErrors );
107 // GeometryAligner aligner;
108 // aligner.applyAlignments<CSCGeometry>( &(*_cscGeometry),
109 // &(*alignments), &(*alignmentErrors),
110 // align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)));
111 // =======
112  record.getRecord<CSCAlignmentErrorRcd>().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 
137  cscGeometry = boost::shared_ptr<CSCGeometry>( new CSCGeometry );
138 
139  cscGeometry->setUseRealWireGeometry( useRealWireGeometry );
140  cscGeometry->setOnlyWiresInME1a( useOnlyWiresInME1a );
141  cscGeometry->setGangedStripsInME1a( useGangedStripsInME1a );
142  cscGeometry->setUseCentreTIOffsets( useCentreTIOffsets );
143  cscGeometry->setDebugV( debugV );
144  if ( debugV ) cscGeometry->queryModelling();
145 
146  // Called whenever the muon numbering (or ideal geometry) changes
147  //
148  if ( useDDD_ ) {
151  record.getRecord<IdealGeometryRecord>().get(cpv);
152  record.getRecord<MuonNumberingRecord>().get( mdc );
154  // _cscGeometry = boost::shared_ptr<CSCGeometry>(builder.build(_cscGeometry, &(*cpv), *mdc));
155  builder.build(cscGeometry, &(*cpv), *mdc);
156  } else {
159  record.getRecord<CSCRecoGeometryRcd>().get(rig);
160  record.getRecord<CSCRecoDigiParametersRcd>().get(rdp);
161  CSCGeometryBuilder cscgb;
162  // _cscGeometry = boost::shared_ptr<CSCGeometry>(cscgb.build(_cscGeometry, *rig, *rdp));
163  cscgb.build(cscGeometry, *rig, *rdp);
164  }
165  recreateGeometry_=false;
166 }
167 
169  recreateGeometry_=true;
170 }
172  recreateGeometry_=true;
173 }
175  recreateGeometry_=true;
176 }
177 
178 
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:11
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 applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrors *alignmentErrors, const AlignTransform &globalCoordinates)
void initCSCGeometry_(const MuonGeometryRecord &)
Definition: DetId.h:20
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:56
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