CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackerDigiGeometryESModule.cc
Go to the documentation of this file.
7 
8 // Alignments
18 
25 
26 #include <memory>
27 
28 //__________________________________________________________________
30  : alignmentsLabel_(p.getParameter<std::string>("alignmentsLabel")),
31  myLabel_(p.getParameter<std::string>("appendToDataLabel")),
32  m_pSet( p )
33 {
34  applyAlignment_ = p.getParameter<bool>("applyAlignment");
35  fromDDD_ = p.getParameter<bool>("fromDDD");
36 
37  setWhatProduced(this);
38 
39  edm::LogInfo("Geometry") << "@SUB=TrackerDigiGeometryESModule"
40  << "Label '" << myLabel_ << "' "
41  << (applyAlignment_ ? "looking for" : "IGNORING")
42  << " alignment labels '" << alignmentsLabel_ << "'.";
43 }
44 
45 //__________________________________________________________________
47 
48 void
50 {
51  edm::ParameterSetDescription descTrackerGeometryConstants;
52  descTrackerGeometryConstants.add<bool>( "upgradeGeometry", false );
53  descTrackerGeometryConstants.add<int>( "ROWS_PER_ROC", 80 );
54  descTrackerGeometryConstants.add<int>( "COLS_PER_ROC", 52 );
55  descTrackerGeometryConstants.add<int>( "BIG_PIX_PER_ROC_X", 1 );
56  descTrackerGeometryConstants.add<int>( "BIG_PIX_PER_ROC_Y", 2 );
57  descTrackerGeometryConstants.add<int>( "ROCS_X", 0 );
58  descTrackerGeometryConstants.add<int>( "ROCS_Y", 0 );
59 
60  edm::ParameterSetDescription descTrackerSLHCGeometryConstants;
61  descTrackerSLHCGeometryConstants.add<bool>( "upgradeGeometry", true );
62  descTrackerSLHCGeometryConstants.add<int>( "ROWS_PER_ROC", 80 );
63  descTrackerSLHCGeometryConstants.add<int>( "COLS_PER_ROC", 52 );
64  descTrackerSLHCGeometryConstants.add<int>( "BIG_PIX_PER_ROC_X", 0 );
65  descTrackerSLHCGeometryConstants.add<int>( "BIG_PIX_PER_ROC_Y", 0 );
66  descTrackerSLHCGeometryConstants.add<int>( "ROCS_X", 2 );
67  descTrackerSLHCGeometryConstants.add<int>( "ROCS_Y", 8 );
68 
70  descDB.add<std::string>( "appendToDataLabel", "" );
71  descDB.add<bool>( "fromDDD", false );
72  descDB.add<bool>( "applyAlignment", true );
73  descDB.add<std::string>( "alignmentsLabel", "" );
74  descDB.addOptional<edm::ParameterSetDescription>( "trackerGeometryConstants", descTrackerGeometryConstants );
75  descriptions.add( "trackerGeometryDB", descDB );
76 
78  desc.add<std::string>( "appendToDataLabel", "" );
79  desc.add<bool>( "fromDDD", true );
80  desc.add<bool>( "applyAlignment", true );
81  desc.add<std::string>( "alignmentsLabel", "" );
82  desc.addOptional<edm::ParameterSetDescription>( "trackerGeometryConstants", descTrackerGeometryConstants );
83  descriptions.add( "trackerGeometry", desc );
84 
86  descSLHCDB.add<std::string>( "appendToDataLabel", "" );
87  descSLHCDB.add<bool>( "fromDDD", false );
88  descSLHCDB.add<bool>( "applyAlignment", true );
89  descSLHCDB.add<std::string>( "alignmentsLabel", "" );
90  descSLHCDB.addOptional<edm::ParameterSetDescription>( "trackerGeometryConstants", descTrackerSLHCGeometryConstants );
91  descriptions.add( "trackerSLHCGeometryDB", descSLHCDB );
92 
94  descSLHC.add<std::string>( "appendToDataLabel", "" );
95  descSLHC.add<bool>( "fromDDD", true );
96  descSLHC.add<bool>( "applyAlignment", true );
97  descSLHC.add<std::string>( "alignmentsLabel", "" );
98  descSLHC.addOptional<edm::ParameterSetDescription>( "trackerGeometryConstants", descTrackerSLHCGeometryConstants );
99  descriptions.add( "trackerSLHCGeometry", descSLHC );
100 }
101 
102 //__________________________________________________________________
103 boost::shared_ptr<TrackerGeometry>
105 {
106  //
107  // Called whenever the alignments, alignment errors or global positions change
108  //
110  iRecord.getRecord<IdealGeometryRecord>().get( gD );
111 
113  _tracker = boost::shared_ptr<TrackerGeometry>(builder.build(&(*gD), m_pSet ));
114 
115  if (applyAlignment_) {
116  // Since fake is fully working when checking for 'empty', we should get rid of applyAlignment_!
117  edm::ESHandle<Alignments> globalPosition;
118  iRecord.getRecord<GlobalPositionRcd>().get(alignmentsLabel_, globalPosition);
119  edm::ESHandle<Alignments> alignments;
120  iRecord.getRecord<TrackerAlignmentRcd>().get(alignmentsLabel_, alignments);
121  edm::ESHandle<AlignmentErrors> alignmentErrors;
122  iRecord.getRecord<TrackerAlignmentErrorRcd>().get(alignmentsLabel_, alignmentErrors);
123  // apply if not empty:
124  if (alignments->empty() && alignmentErrors->empty() && globalPosition->empty()) {
125  edm::LogInfo("Config") << "@SUB=TrackerDigiGeometryRecord::produce"
126  << "Alignment(Error)s and global position (label '"
127  << alignmentsLabel_ << "') empty: Geometry producer (label "
128  << "'" << myLabel_ << "') assumes fake and does not apply.";
129  } else {
130  GeometryAligner ali;
131  ali.applyAlignments<TrackerGeometry>(&(*_tracker), &(*alignments), &(*alignmentErrors),
132  align::DetectorGlobalPosition(*globalPosition,
134  }
135 
137  iRecord.getRecord<TrackerSurfaceDeformationRcd>().get(alignmentsLabel_, surfaceDeformations);
138  // apply if not empty:
139  if (surfaceDeformations->empty()) {
140  edm::LogInfo("Config") << "@SUB=TrackerDigiGeometryRecord::produce"
141  << "AlignmentSurfaceDeformations (label '"
142  << alignmentsLabel_ << "') empty: Geometry producer (label "
143  << "'" << myLabel_ << "') assumes fake and does not apply.";
144  } else {
145  GeometryAligner ali;
146  ali.attachSurfaceDeformations<TrackerGeometry>(&(*_tracker), &(*surfaceDeformations));
147  }
148  }
149 
150  return _tracker;
151 }
152 
T getParameter(std::string const &) const
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
boost::shared_ptr< TrackerGeometry > _tracker
Called when geometry description changes.
Class to update a given geometry with a set of alignments.
TrackerGeometry * build(const GeometricDet *gd, const edm::ParameterSet &pSet)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
boost::shared_ptr< TrackerGeometry > produce(const TrackerDigiGeometryRecord &)
void attachSurfaceDeformations(C *geometry, const AlignmentSurfaceDeformations *surfaceDeformations)
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrors *alignmentErrors, const AlignTransform &globalCoordinates)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: DetId.h:20
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
void add(std::string const &label, ParameterSetDescription const &psetDescription)
TrackerDigiGeometryESModule(const edm::ParameterSet &p)
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)