CMS 3D CMS Logo

AlignmentProducer.h
Go to the documentation of this file.
1 #ifndef Alignment_CommonAlignmentAlgorithm_TrackerAlignmentProducer_h
2 #define Alignment_CommonAlignmentAlgorithm_TrackerAlignmentProducer_h
3 
13 
14 #include <memory>
15 #include <vector>
16 
17 // Framework
21 
23 
24 // Geometry
26 
27 // Alignment
39 
40 // for watcher
47 
48 
49 class Alignments;
51 struct SurveyErrors;
52 namespace edm {
53  class Run;
54  class LuminosityBlock;
55 }
56 
58 {
59 
60  public:
62  typedef std::pair<const Trajectory*, const reco::Track*> ConstTrajTrackPair;
63  typedef std::vector<ConstTrajTrackPair> ConstTrajTrackPairCollection;
64 
68 
70  AlignmentProducer( const edm::ParameterSet& iConfig );
71 
74 
76  virtual std::shared_ptr<TrackerGeometry> produceTracker( const TrackerDigiGeometryRecord& iRecord );
78  virtual std::shared_ptr<DTGeometry> produceDT( const MuonGeometryRecord& iRecord );
80  virtual std::shared_ptr<CSCGeometry> produceCSC( const MuonGeometryRecord& iRecord );
81 
83  virtual void beginOfJob(const edm::EventSetup&);
84 
86  virtual void endOfJob();
87 
89  virtual void startingNewLoop( unsigned int iLoop );
90 
92  virtual Status endOfLoop( const edm::EventSetup&, unsigned int iLoop );
93 
95  virtual void beginRun(const edm::Run &run, const edm::EventSetup &setup);
97  virtual void endRun(const edm::Run &run, const edm::EventSetup &setup);
98 
100  virtual void beginLuminosityBlock(const edm::LuminosityBlock &lumiBlock,
101  const edm::EventSetup &setup);
103  virtual void endLuminosityBlock(const edm::LuminosityBlock &lumiBlock,
104  const edm::EventSetup &setup);
106  virtual Status duringLoop(const edm::Event &event, const edm::EventSetup &setup);
107 
108  private:
109 
110  // private member functions
111 
113  void createAlignmentAlgorithm(const edm::ParameterSet&);
114 
116  bool setupChanged(const edm::EventSetup&);
117 
120  void initAlignmentAlgorithm(const edm::EventSetup&, bool update = false);
121 
124  void applyAlignmentsToDB(const edm::EventSetup&);
125 
128  void createAlignables(const TrackerTopology*, bool update = false);
129 
131  void buildParameterStore();
132 
134  void applyMisalignment();
135 
137  void simpleMisalignment(const Alignables &alivec, const std::string &selection,
138  float shift, float rot, bool local);
139 
141  void createGeometries(const edm::EventSetup&, const TrackerTopology*);
142 
145  void applyAlignmentsToGeometry();
146 
149  template<class G, class Rcd, class ErrRcd>
150  void applyDB(G *geometry, const edm::EventSetup &iSetup,
151  const AlignTransform &globalPosition) const;
153  template<class G, class DeformationRcd>
154  void applyDB(G *geometry, const edm::EventSetup &iSetup) const;
155 
156  // write alignments and alignment errors for all sub detectors and
157  // the given run number
158  void writeForRunRange(cond::Time_t time);
159 
163  void writeDB(Alignments *alignments, const std::string &alignRcd,
164  AlignmentErrorsExtended *alignmentErrors, const std::string &errRcd,
165  const AlignTransform *globalCoordinates,
166  cond::Time_t time) const;
169  void writeDB(AlignmentSurfaceDeformations *alignmentSurfaceDeformations,
170  const std::string &surfaceDeformationRcd,
171  cond::Time_t time) const;
172 
174  void addSurveyInfo_(Alignable*);
175 
177  void readInSurveyRcds( const edm::EventSetup& );
178 
179 
180  // private data members
181 
182  unsigned int theSurveyIndex;
185 
188  std::vector<AlignmentMonitorBase*> theMonitors;
189  std::vector<IntegratedCalibrationBase*> theCalibrations;
190 
194 
195  std::shared_ptr<TrackerGeometry> theTracker;
196  std::shared_ptr<DTGeometry> theMuonDT;
197  std::shared_ptr<CSCGeometry> theMuonCSC;
200 
202  int nevent_;
204 
205  // steering parameters
206 
207  const unsigned int theMaxLoops; // Number of loops to loop
208 
209  const int stNFixAlignables_;
210  const double stRandomShift_,stRandomRotation_;
211  const bool applyDbAlignment_,checkDbAlignmentValidity_;
213  const bool saveToDB_, saveApeToDB_,saveDeformationsToDB_;
214  const bool doTracker_,doMuon_,useExtras_;
215  const bool useSurvey_; // true to read survey info from DB
217 
218  // event input tags
219  const edm::InputTag tjTkAssociationMapTag_; // map with tracks/trajectories
220  const edm::InputTag beamSpotTag_; // beam spot
221  const edm::InputTag tkLasBeamTag_; // LAS beams in edm::Run (ignore if empty)
222  const edm::InputTag clusterValueMapTag_; // ValueMap containing associtaion cluster - flag
223 
224  // ESWatcher
225 
228 
232 
237 
244 
245 };
246 
247 #endif
edm::ESWatcher< TrackerAlignmentErrorExtendedRcd > watchTrackerAlErrorExtRcd
align::RunRange RunRange
const bool doMisalignmentScenario_
AlignmentAlgorithmBase * theAlignmentAlgo
edm::ESWatcher< CSCAlignmentErrorExtendedRcd > watchCSCAlErrExtRcd
std::shared_ptr< TrackerGeometry > theTracker
edm::ESWatcher< DTAlignmentErrorExtendedRcd > watchDTAlErrExtRcd
std::vector< RunRange > RunRanges
Definition: Utilities.h:39
align::RunNumber RunNumber
selection
main part
Definition: corrVsCorr.py:98
std::vector< IntegratedCalibrationBase * > theCalibrations
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
edm::ParameterSet theParameterSet
const edm::InputTag tkLasBeamTag_
const Alignments * theSurveyValues
edm::ESWatcher< TrackerAlignmentRcd > watchTrackerAlRcd
Interface/Base class for alignment algorithms, each alignment algorithm has to be derived from this c...
edm::ESWatcher< CSCAlignmentRcd > watchCSCAlRcd
std::shared_ptr< DTGeometry > theMuonDT
edm::ESWatcher< GlobalPositionRcd > watchGlobalPositionRcd
const unsigned int theMaxLoops
AlignableExtras * theAlignableExtras
unsigned long long Time_t
Definition: Time.h:16
const bool checkDbAlignmentValidity_
const edm::InputTag clusterValueMapTag_
edm::ESWatcher< TrackerSurfaceDeformationRcd > watchTrackerSurDeRcd
unsigned int theSurveyIndex
std::vector< AlignmentMonitorBase * > theMonitors
AlignmentParameterStore * theAlignmentParameterStore
edm::ESWatcher< CSCSurveyRcd > watchCSCSurveyRcd_
const edm::InputTag beamSpotTag_
const SurveyErrors * theSurveyErrors
const edm::InputTag tjTkAssociationMapTag_
std::pair< RunNumber, RunNumber > RunRange
Definition: Utilities.h:38
edm::ESWatcher< CSCSurveyErrorExtendedRcd > watchCSCSurveyErrRcd_
AlignableMuon * theAlignableMuon
const double stRandomShift_
edm::ESWatcher< DTAlignmentRcd > watchDTAlRcd
edm::ESWatcher< DTSurveyErrorExtendedRcd > watchDTSurveyErrRcd_
edm::ESWatcher< IdealGeometryRecord > watchIdealGeometryRcd
const RunRanges uniqueRunRanges_
std::vector< ConstTrajTrackPair > ConstTrajTrackPairCollection
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
edm::ESWatcher< DTSurveyRcd > watchDTSurveyRcd_
align::Alignables Alignables
std::shared_ptr< CSCGeometry > theMuonCSC
HLT enums.
edm::ESWatcher< TrackerSurveyRcd > watchTkSurveyRcd_
#define update(a, b)
const bool enableAlignableUpdates_
AlignableTracker * theAlignableTracker
static unsigned int const shift
edm::ESWatcher< TrackerSurveyErrorExtendedRcd > watchTkSurveyErrRcd_
align::RunRanges RunRanges
std::pair< const Trajectory *, const reco::Track * > ConstTrajTrackPair
Constructor of the full muon geometry.
Definition: AlignableMuon.h:37
const Alignments * globalPositions_
GlobalPositions that might be read from DB, NULL otherwise.
Definition: event.py:1
Definition: Run.h:42
cond::RealTimeType< cond::runnumber >::type RunNumber
Definition: Utilities.h:37