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  : alignmentsLabel_(p.getParameter<std::string>("alignmentsLabel")),
37  myLabel_(p.getParameter<std::string>("appendToDataLabel"))
38 {
39 
41 
42  // Choose wire geometry modelling
43  // We now _require_ some wire geometry specification in the CSCOrcaSpec.xml file
44  // in the DDD Geometry.
45  // Default as of transition to CMSSW is to use real values.
46  // Alternative is to use pseudo-values which match reasonably closely
47  // the calculated geometry values used up to and including ORCA_8_8_1.
48  // (This was the default in ORCA.)
49 
50  useRealWireGeometry = p.getParameter<bool>("useRealWireGeometry");
51 
52  // Suppress strips altogether in ME1a region of ME11?
53 
54  useOnlyWiresInME1a = p.getParameter<bool>("useOnlyWiresInME1a");
55 
56  // Allow strips in ME1a region of ME11 but gang them?
57  // Default is now to treat ME1a with ganged strips (e.g. in clusterizer)
58 
59  useGangedStripsInME1a = p.getParameter<bool>("useGangedStripsInME1a");
60 
61  if ( useGangedStripsInME1a ) useOnlyWiresInME1a = false; // override possible inconsistentcy
62 
63  // Use the backed-out offsets that correct the CTI
64  useCentreTIOffsets = p.getParameter<bool>("useCentreTIOffsets");
65 
66  // Debug printout etc. in CSCGeometry etc.
67 
68  debugV = p.getUntrackedParameter<bool>("debugV", false);
69 
70  // Find out if using the DDD or CondDB Geometry source.
71  useDDD_ = p.getParameter<bool>("useDDD");
72 
73  // Feed these value to where I need them
74  applyAlignment_ = p.getParameter<bool>("applyAlignment");
75 
76 
77  edm::LogInfo("Geometry") << "@SUB=CSCGeometryESModule"
78  << "Label '" << myLabel_ << "' "
79  << (applyAlignment_ ? "looking for" : "IGNORING")
80  << " alignment labels '" << alignmentsLabel_ << "'.";
81 }
82 
83 
85 
86 
87 boost::shared_ptr<CSCGeometry> CSCGeometryESModule::produce(const MuonGeometryRecord& record) {
88 
89  // Called whenever the alignments or alignment errors change
90 
91  if ( applyAlignment_ ) {
92  // applyAlignment_ is scheduled for removal.
93  // Ideal geometry obtained by using 'fake alignment' (with applyAlignment_ = true)
94  edm::ESHandle<Alignments> globalPosition;
95  record.getRecord<GlobalPositionRcd>().get(alignmentsLabel_, globalPosition);
96  edm::ESHandle<Alignments> alignments;
97  record.getRecord<CSCAlignmentRcd>().get(alignmentsLabel_, alignments);
98  edm::ESHandle<AlignmentErrors> alignmentErrors;
99 // <<<<<<< CSCGeometryESModule.cc
100 // record.getRecord<CSCAlignmentErrorRcd>().get( alignmentErrors );
101 // GeometryAligner aligner;
102 // aligner.applyAlignments<CSCGeometry>( &(*_cscGeometry),
103 // &(*alignments), &(*alignmentErrors),
104 // align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Muon)));
105 // =======
106  record.getRecord<CSCAlignmentErrorRcd>().get(alignmentsLabel_, alignmentErrors);
107  // Only apply alignment if values exist
108  if (alignments->empty() && alignmentErrors->empty() && globalPosition->empty()) {
109  edm::LogInfo("Config") << "@SUB=CSCGeometryRecord::produce"
110  << "Alignment(Error)s and global position (label '"
111  << alignmentsLabel_ << "') empty: Geometry producer (label "
112  << "'" << myLabel_ << "') assumes fake and does not apply.";
113  } else {
114  GeometryAligner aligner;
115  aligner.applyAlignments<CSCGeometry>( &(*cscGeometry), &(*alignments), &(*alignmentErrors),
116  align::DetectorGlobalPosition(*globalPosition, DetId(DetId::Muon)) );
117  }
118 // >>>>>>> 1.8
119  }
120 
121  return cscGeometry;
122 }
123 
124 
126 {
127  // Called whenever the muon numbering (or ideal geometry) changes
128 
129  cscGeometry = boost::shared_ptr<CSCGeometry>( new CSCGeometry );
130 
131  cscGeometry->setUseRealWireGeometry( useRealWireGeometry );
132  cscGeometry->setOnlyWiresInME1a( useOnlyWiresInME1a );
133  cscGeometry->setGangedStripsInME1a( useGangedStripsInME1a );
134  cscGeometry->setUseCentreTIOffsets( useCentreTIOffsets );
135  cscGeometry->setDebugV( debugV );
136  if ( debugV ) cscGeometry->queryModelling();
137 
138  // Called whenever the muon numbering (or ideal geometry) changes
139  //
140  if ( useDDD_ ) {
143  record.getRecord<IdealGeometryRecord>().get(cpv);
144  record.get( mdc );
146  // _cscGeometry = boost::shared_ptr<CSCGeometry>(builder.build(_cscGeometry, &(*cpv), *mdc));
147  builder.build(cscGeometry, &(*cpv), *mdc);
148  } else {
151  record.getRecord<CSCRecoGeometryRcd>().get(rig);
152  record.getRecord<CSCRecoDigiParametersRcd>().get(rdp);
153  CSCGeometryBuilder cscgb;
154  // _cscGeometry = boost::shared_ptr<CSCGeometry>(cscgb.build(_cscGeometry, *rig, *rdp));
155  cscgb.build(cscGeometry, *rig, *rdp);
156  }
157 
158 }
159 
T getParameter(std::string const &) const
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
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.
boost::shared_ptr< CSCGeometry > produce(const MuonGeometryRecord &record)
Produce CSCGeometry.
void get(HolderT &iHolder) const
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrors *alignmentErrors, const AlignTransform &globalCoordinates)
Definition: DetId.h:20
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:48
void build(boost::shared_ptr< CSCGeometry > theGeometry, const RecoIdealGeometry &rig, const CSCRecoDigiParameters &cscpars)
Build the geometry.
void geometryCallback_(const MuonNumberingRecord &)
Called when geometry description changes.
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
boost::shared_ptr< CSCGeometry > cscGeometry