CMS 3D CMS Logo

AlignmentProducer.cc
Go to the documentation of this file.
1 
5 
6 #include "AlignmentProducer.h"
7 
9 
12 
13 
14 //------------------------------------------------------------------------------
16  AlignmentProducerBase{config},
17  maxLoops_{config.getUntrackedParameter<unsigned int>("maxLoops")}
18 {
19  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::AlignmentProducer";
20 
21  // Tell the framework what data is being produced
22  if (doTracker_) {
24  }
25  if (doMuon_) {
28  }
29 }
30 
31 
32 //------------------------------------------------------------------------------
33 std::shared_ptr<TrackerGeometry>
35 {
36  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::produceTracker";
37  return trackerGeometry_;
38 }
39 
40 
41 //------------------------------------------------------------------------------
42 std::shared_ptr<DTGeometry>
44 {
45  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::produceDT";
46  return muonDTGeometry_;
47 }
48 
49 
50 //------------------------------------------------------------------------------
51 std::shared_ptr<CSCGeometry>
53 {
54  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::produceCSC";
55  return muonCSCGeometry_;
56 }
57 
58 
59 //------------------------------------------------------------------------------
61 {
62  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::beginOfJob";
63  initAlignmentAlgorithm(iSetup);
64 }
65 
66 
67 //------------------------------------------------------------------------------
69 {
70  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::endOfJob";
71 
72  if (!finish()) {
73  edm::LogError("Alignment")
74  << "@SUB=AlignmentProducer::endOfJob"
75  << "Did not process any events in last loop, do not dare to store to DB.";
76  }
77 }
78 
79 
80 //------------------------------------------------------------------------------
81 void AlignmentProducer::startingNewLoop(unsigned int iLoop)
82 {
83  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::startingNewLoop"
84  << "Starting loop number " << iLoop;
86 }
87 
88 
89 //------------------------------------------------------------------------------
91 AlignmentProducer::endOfLoop(const edm::EventSetup& iSetup, unsigned int iLoop)
92 {
93 
94  if (0 == nEvent()) {
95  // beginOfJob is usually called by the framework in the first event of the first loop
96  // (a hack: beginOfJob needs the EventSetup that is not well defined without an event)
97  // and the algorithms rely on the initialisations done in beginOfJob. We cannot call
98  // this->beginOfJob(iSetup); here either since that will access the EventSetup to get
99  // some geometry information that is not defined either without having seen an event.
100  edm::LogError("Alignment")
101  << "@SUB=AlignmentProducer::endOfLoop"
102  << "Did not process any events in loop " << iLoop
103  << ", stop processing without terminating algorithm.";
104  return kStop;
105  }
106 
107  edm::LogInfo("Alignment")
108  << "@SUB=AlignmentProducer::endOfLoop"
109  << "Ending loop " << iLoop << ", terminating algorithm.";
110  terminateProcessing(&iSetup);
111 
112  if ( iLoop == maxLoops_-1 || iLoop >= maxLoops_ ) return kStop;
113  else return kContinue;
114 }
115 
116 
117 //------------------------------------------------------------------------------
120  const edm::EventSetup& setup)
121 {
122  if (processEvent(event, setup)) return kContinue;
123  else return kStop;
124 }
125 
126 
127 //------------------------------------------------------------------------------
129 {
130  beginRunImpl(run, setup);
131 }
132 
133 
134 //------------------------------------------------------------------------------
136 {
137  endRunImpl(run, setup);
138 }
139 
140 
141 //------------------------------------------------------------------------------
143  const edm::EventSetup &setup)
144 {
145  beginLuminosityBlockImpl(lumiBlock, setup);
146 }
147 
148 
149 //------------------------------------------------------------------------------
151  const edm::EventSetup &setup)
152 {
153  endLuminosityBlockImpl(lumiBlock, setup);
154 }
155 
156 
void endOfJob() override
Called at end of job.
std::shared_ptr< CSCGeometry > muonCSCGeometry_
bool processEvent(const edm::Event &, const edm::EventSetup &)
Process event.
void initAlignmentAlgorithm(const edm::EventSetup &, bool update=false)
void terminateProcessing(const edm::EventSetup *=0)
Terminate processing of events.
const unsigned int maxLoops_
#define DEFINE_FWK_LOOPER(type)
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override
Called at lumi block start, calling algorithm&#39;s beginLuminosityBlock.
Definition: config.py:1
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
void startingNewLoop(unsigned int iLoop) override
Called at beginning of loop.
std::shared_ptr< TrackerGeometry > trackerGeometry_
AlignmentProducer(const edm::ParameterSet &)
Constructor.
void endRunImpl(const edm::Run &, const edm::EventSetup &)
end run
void endLuminosityBlockImpl(const edm::LuminosityBlock &, const edm::EventSetup &)
end lumi block
Status endOfLoop(const edm::EventSetup &, unsigned int iLoop) override
Called at end of loop.
void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override
Called at lumi block end, calling algorithm&#39;s endLuminosityBlock.
void startProcessing()
Start processing of events.
virtual void beginOfJob()
Definition: EDLooperBase.cc:88
std::shared_ptr< DTGeometry > muonDTGeometry_
void beginLuminosityBlockImpl(const edm::LuminosityBlock &, const edm::EventSetup &)
begin lumi block
virtual std::shared_ptr< TrackerGeometry > produceTracker(const TrackerDigiGeometryRecord &)
Produce the tracker geometry.
virtual std::shared_ptr< DTGeometry > produceDT(const MuonGeometryRecord &)
Produce the muon DT geometry.
void beginRunImpl(const edm::Run &, const edm::EventSetup &)
begin run
virtual std::shared_ptr< CSCGeometry > produceCSC(const MuonGeometryRecord &)
Produce the muon CSC geometry.
Definition: event.py:1
Definition: Run.h:44
Status duringLoop(const edm::Event &, const edm::EventSetup &) override
Called at each event.
void endRun(const edm::Run &, const edm::EventSetup &) override
Called at run end - currently reading TkFittedLasBeam if an InpuTag is given for that.
void beginRun(const edm::Run &, const edm::EventSetup &) override
Called at run start and calling algorithms beginRun.