CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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;
41 
42 namespace edm {
43  class EventSetup;
44  class ParameterSet;
45 } // namespace edm
46 namespace reco {
47  class Track;
48  class BeamSpot;
49 } // namespace reco
50 
51 /*** Global typedefs part I (see EOF for part II) ***/
52 typedef std::pair<const Trajectory *, const reco::Track *> ConstTrajTrackPair;
53 typedef std::vector<ConstTrajTrackPair> ConstTrajTrackPairs;
54 
55 typedef std::vector<IntegratedCalibrationBase *> Calibrations;
56 typedef std::vector<std::unique_ptr<IntegratedCalibrationBase>> CalibrationsOwner;
57 
58 typedef std::vector<IntegratedCalibrationBase *> Calibrations;
59 
61 public:
62  // TODO: DEPRECATED: For not breaking the interface, used in serveral files.
63  // If possible use the global typedefs above.
64  // With global typedefs one does not have to typedef again like
65  // 'typedef AlignmentAlgorithmBase::ConstTrajTrackPair ConstTrajTrackPair;'
66  // in other files.
67  typedef std::pair<const Trajectory *, const reco::Track *> ConstTrajTrackPair;
68  typedef std::vector<ConstTrajTrackPair> ConstTrajTrackPairCollection;
71 
73  class EventInfo {
74  public:
75  EventInfo(const edm::EventID &theEventId,
76  const ConstTrajTrackPairCollection &theTrajTrackPairs,
77  const reco::BeamSpot &theBeamSpot,
78  const AliClusterValueMap *theClusterValueMap)
79  : eventId_(theEventId),
80  trajTrackPairs_(theTrajTrackPairs),
81  beamSpot_(theBeamSpot),
82  clusterValueMap_(theClusterValueMap) {}
83 
84  const edm::EventID eventId() const { return eventId_; }
86  const reco::BeamSpot &beamSpot() const { return beamSpot_; }
88 
89  private:
94  };
95 
97  class EndRunInfo {
98  public:
99  EndRunInfo(const edm::RunID &theRunId,
100  const TkFittedLasBeamCollection *theTkLasBeams,
101  const TsosVectorCollection *theTkLasBeamTsoses)
102  : runId_(theRunId), tkLasBeams_(theTkLasBeams), tkLasBeamTsoses_(theTkLasBeamTsoses) {}
103 
104  const edm::RunID runId() const { return runId_; }
107 
108  private:
112  };
113 
116 
119 
121  virtual void initialize(const edm::EventSetup &setup,
122  AlignableTracker *tracker,
124  AlignableExtras *extras,
125  AlignmentParameterStore *store) = 0;
126 
129  virtual bool supportsCalibrations() { return false; }
132  virtual bool addCalibrations(const Calibrations &) { return false; }
133  // Overloading for the owning vector
134  bool addCalibrations(const CalibrationsOwner &cals) {
136  tmp.reserve(cals.size());
137  for (const auto &ptr : cals) {
138  tmp.push_back(ptr.get());
139  }
140  return addCalibrations(tmp);
141  }
142 
144  virtual bool processesEvents() { return true; }
145 
147  virtual bool storeAlignments() { return true; }
148 
149  // TODO: DEPRECATED: Actually, there are no iterative algorithms, use
150  // initialze() and terminate()
153  virtual void startNewLoop() {}
154 
156  virtual void terminate(const edm::EventSetup &iSetup) = 0;
158  virtual void terminate() {}
159 
161  virtual void run(const edm::EventSetup &setup, const EventInfo &eventInfo) = 0;
162 
164  virtual void beginRun(const edm::Run &, const edm::EventSetup &, bool changed){};
165 
167  virtual void endRun(const EndRunInfo &runInfo, const edm::EventSetup &setup){};
168 
171 
173  virtual void endLuminosityBlock(const edm::EventSetup &setup){};
174 
177  virtual bool setParametersForRunRange(const RunRange &rr) { return false; };
178 };
179 
180 /*** Global typedefs part II ***/
183 
184 #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)
std::vector< ConstTrajTrackPair > ConstTrajTrackPairs
virtual void run(const edm::EventSetup &setup, const EventInfo &eventInfo)=0
Run the algorithm (must be implemented in derived class)
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
const TkFittedLasBeamCollection * tkLasBeams() const
AlignmentAlgorithmBase::EndRunInfo EndRunInfo
AlignmentAlgorithmBase(const edm::ParameterSet &, const edm::ConsumesCollector &)
Constructor.
virtual void initialize(const edm::EventSetup &setup, AlignableTracker *tracker, AlignableMuon *muon, AlignableExtras *extras, AlignmentParameterStore *store)=0
Call at beginning of job (must be implemented in derived class)
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
virtual void terminate()
Called at end of job (must be implemented in derived class)
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:38
const ConstTrajTrackPairCollection & trajTrackPairs_
Definition: Run.h:45
cond::RealTimeType< cond::runnumber >::type RunNumber
Definition: Utilities.h:37
std::vector< ConstTrajTrackPair > ConstTrajTrackPairCollection