CMS 3D CMS Logo

AlignmentAlgorithmBase.h
Go to the documentation of this file.
1 
2 #ifndef Alignment_CommonAlignmentAlgorithm_AlignmentAlgorithmBase_h
3 #define Alignment_CommonAlignmentAlgorithm_AlignmentAlgorithmBase_h
4 
19 #include <vector>
20 #include <utility>
21 #include <memory>
22 
23 class AlignableTracker;
24 class AlignableMuon;
25 class AlignableExtras;
28 class Trajectory;
29 // These data formats cannot be forward declared since they are typedef's,
30 // so include the headers that define the typedef's
31 // (no need to include in dependencies in BuildFile):
32 // class TsosVectorCollection;
33 // class TkFittedLasBeamCollection;
34 // class AliClusterValueMap;
40 
41 namespace edm {
42  class EventSetup;
43  class ParameterSet;
44 } // namespace edm
45 namespace reco {
46  class Track;
47  class BeamSpot;
48 } // namespace reco
49 
50 /*** Global typedefs part I (see EOF for part II) ***/
51 typedef std::pair<const Trajectory *, const reco::Track *> ConstTrajTrackPair;
52 typedef std::vector<ConstTrajTrackPair> ConstTrajTrackPairs;
53 
54 typedef std::vector<IntegratedCalibrationBase *> Calibrations;
55 typedef std::vector<std::unique_ptr<IntegratedCalibrationBase>> CalibrationsOwner;
56 
57 typedef std::vector<IntegratedCalibrationBase *> Calibrations;
58 
60 public:
61  // TODO: DEPRECATED: For not breaking the interface, used in serveral files.
62  // If possible use the global typedefs above.
63  // With global typedefs one does not have to typedef again like
64  // 'typedef AlignmentAlgorithmBase::ConstTrajTrackPair ConstTrajTrackPair;'
65  // in other files.
66  typedef std::pair<const Trajectory *, const reco::Track *> ConstTrajTrackPair;
67  typedef std::vector<ConstTrajTrackPair> ConstTrajTrackPairCollection;
70 
72  class EventInfo {
73  public:
74  EventInfo(const edm::EventID &theEventId,
75  const ConstTrajTrackPairCollection &theTrajTrackPairs,
76  const reco::BeamSpot &theBeamSpot,
77  const AliClusterValueMap *theClusterValueMap)
78  : eventId_(theEventId),
79  trajTrackPairs_(theTrajTrackPairs),
80  beamSpot_(theBeamSpot),
81  clusterValueMap_(theClusterValueMap) {}
82 
83  const edm::EventID eventId() const { return eventId_; }
84  const ConstTrajTrackPairCollection &trajTrackPairs() const { return trajTrackPairs_; }
85  const reco::BeamSpot &beamSpot() const { return beamSpot_; }
86  const AliClusterValueMap *clusterValueMap() const { return clusterValueMap_; }
87 
88  private:
90  const ConstTrajTrackPairCollection &trajTrackPairs_;
93  };
94 
96  class EndRunInfo {
97  public:
98  EndRunInfo(const edm::RunID &theRunId,
99  const TkFittedLasBeamCollection *theTkLasBeams,
100  const TsosVectorCollection *theTkLasBeamTsoses)
101  : runId_(theRunId), tkLasBeams_(theTkLasBeams), tkLasBeamTsoses_(theTkLasBeamTsoses) {}
102 
103  const edm::RunID runId() const { return runId_; }
104  const TkFittedLasBeamCollection *tkLasBeams() const { return tkLasBeams_; }
105  const TsosVectorCollection *tkLasBeamTsoses() const { return tkLasBeamTsoses_; }
106 
107  private:
111  };
112 
115 
118 
120  virtual void initialize(const edm::EventSetup &setup,
123  AlignableExtras *extras,
124  AlignmentParameterStore *store) = 0;
125 
128  virtual bool supportsCalibrations() { return false; }
131  virtual bool addCalibrations(const Calibrations &) { return false; }
132  // Overloading for the owning vector
133  bool addCalibrations(const CalibrationsOwner &cals) {
135  tmp.reserve(cals.size());
136  for (const auto &ptr : cals) {
137  tmp.push_back(ptr.get());
138  }
139  return addCalibrations(tmp);
140  }
141 
143  virtual bool processesEvents() { return true; }
144 
146  virtual bool storeAlignments() { return true; }
147 
148  // TODO: DEPRECATED: Actually, there are no iterative algorithms, use
149  // initialze() and terminate()
152  virtual void startNewLoop() {}
153 
155  virtual void terminate(const edm::EventSetup &iSetup) = 0;
157  virtual void terminate() {}
158 
160  virtual void run(const edm::EventSetup &setup, const EventInfo &eventInfo) = 0;
161 
163  virtual void beginRun(const edm::Run &, const edm::EventSetup &, bool changed){};
164 
166  virtual void endRun(const EndRunInfo &runInfo, const edm::EventSetup &setup){};
167 
169  virtual void beginLuminosityBlock(const edm::EventSetup &setup){};
170 
172  virtual void endLuminosityBlock(const edm::EventSetup &setup){};
173 
176  virtual bool setParametersForRunRange(const RunRange &rr) { return false; };
177 };
178 
179 /*** Global typedefs part II ***/
182 
183 #endif
virtual bool processesEvents()
Returns whether algorithm proccesses events in current configuration.
virtual void beginLuminosityBlock(const edm::EventSetup &setup)
called at begin of luminosity block (no lumi block info passed yet)
static AlgebraicMatrix initialize()
std::vector< ConstTrajTrackPair > ConstTrajTrackPairs
const TsosVectorCollection * tkLasBeamTsoses_
might be null!
std::vector< IntegratedCalibrationBase * > Calibrations
virtual void endLuminosityBlock(const edm::EventSetup &setup)
called at end of luminosity block (no lumi block info passed yet)
EndRunInfo(const edm::RunID &theRunId, const TkFittedLasBeamCollection *theTkLasBeams, const TsosVectorCollection *theTkLasBeamTsoses)
const edm::EventID eventId() const
std::pair< const Trajectory *, const reco::Track * > ConstTrajTrackPair
const ConstTrajTrackPairCollection & trajTrackPairs() const
define event information passed to algorithms
virtual void endRun(const EndRunInfo &runInfo, const edm::EventSetup &setup)
called at end of run - order of arguments like in EDProducer etc.
virtual bool addCalibrations(const Calibrations &)
virtual bool setParametersForRunRange(const RunRange &rr)
virtual ~AlignmentAlgorithmBase()
Destructor.
virtual void beginRun(const edm::Run &, const edm::EventSetup &, bool changed)
called at begin of run
AlignmentAlgorithmBase(const edm::ParameterSet &)
Constructor.
const TkFittedLasBeamCollection * tkLasBeams() const
AlignmentAlgorithmBase::EndRunInfo EndRunInfo
const TkFittedLasBeamCollection * tkLasBeams_
const edm::RunID runId_
might be null!
const edm::EventID eventId_
might be null!
std::pair< RunNumber, RunNumber > RunRange
Definition: Utilities.h:38
std::vector< std::unique_ptr< IntegratedCalibrationBase > > CalibrationsOwner
bool addCalibrations(const CalibrationsOwner &cals)
const AliClusterValueMap * clusterValueMap_
AlignmentAlgorithmBase::EventInfo EventInfo
fixed size matrix
virtual void terminate()
Called at end of job (must be implemented in derived class)
HLT enums.
const AliClusterValueMap * clusterValueMap() const
std::vector< TkFittedLasBeam > TkFittedLasBeamCollection
const reco::BeamSpot & beamSpot() const
EventInfo(const edm::EventID &theEventId, const ConstTrajTrackPairCollection &theTrajTrackPairs, const reco::BeamSpot &theBeamSpot, const AliClusterValueMap *theClusterValueMap)
virtual bool storeAlignments()
Returns whether algorithm produced results to be stored.
std::pair< const Trajectory *, const reco::Track * > ConstTrajTrackPair
std::vector< std::vector< TrajectoryStateOnSurface > > TsosVectorCollection
define run information passed to algorithms (in endRun)
tmp
align.sh
Definition: createJobs.py:716
const TsosVectorCollection * tkLasBeamTsoses() const
might be null!
Constructor of the full muon geometry.
Definition: AlignableMuon.h:33
const ConstTrajTrackPairCollection & trajTrackPairs_
Definition: Run.h:45
cond::RealTimeType< cond::runnumber >::type RunNumber
Definition: Utilities.h:37
std::vector< ConstTrajTrackPair > ConstTrajTrackPairCollection