CMS 3D CMS Logo

AlignmentProducer.cc
Go to the documentation of this file.
1 
5 #include "AlignmentProducer.h"
6 
8 
11 
12 //------------------------------------------------------------------------------
14  : AlignmentProducerBase{config}, maxLoops_{config.getUntrackedParameter<unsigned int>("maxLoops")} {
15  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::AlignmentProducer";
16 
17  // Tell the framework what data is being produced
18  if (doTracker_) {
20  }
21  if (doMuon_) {
24  }
25 }
26 
27 //------------------------------------------------------------------------------
28 std::shared_ptr<TrackerGeometry> AlignmentProducer::produceTracker(const TrackerDigiGeometryRecord &) {
29  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::produceTracker";
30  return trackerGeometry_;
31 }
32 
33 //------------------------------------------------------------------------------
34 std::shared_ptr<DTGeometry> AlignmentProducer::produceDT(const MuonGeometryRecord &) {
35  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::produceDT";
36  return muonDTGeometry_;
37 }
38 
39 //------------------------------------------------------------------------------
40 std::shared_ptr<CSCGeometry> AlignmentProducer::produceCSC(const MuonGeometryRecord &) {
41  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::produceCSC";
42  return muonCSCGeometry_;
43 }
44 
45 //------------------------------------------------------------------------------
47  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::beginOfJob";
48  initAlignmentAlgorithm(iSetup);
49 }
50 
51 //------------------------------------------------------------------------------
53  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::endOfJob";
54 
55  if (!finish()) {
56  edm::LogError("Alignment") << "@SUB=AlignmentProducer::endOfJob"
57  << "Did not process any events in last loop, do not dare to store to DB.";
58  }
59 }
60 
61 //------------------------------------------------------------------------------
62 void AlignmentProducer::startingNewLoop(unsigned int iLoop) {
63  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::startingNewLoop"
64  << "Starting loop number " << iLoop;
66 }
67 
68 //------------------------------------------------------------------------------
70  if (0 == nEvent()) {
71  // beginOfJob is usually called by the framework in the first event of the first loop
72  // (a hack: beginOfJob needs the EventSetup that is not well defined without an event)
73  // and the algorithms rely on the initialisations done in beginOfJob. We cannot call
74  // this->beginOfJob(iSetup); here either since that will access the EventSetup to get
75  // some geometry information that is not defined either without having seen an event.
76  edm::LogError("Alignment") << "@SUB=AlignmentProducer::endOfLoop"
77  << "Did not process any events in loop " << iLoop
78  << ", stop processing without terminating algorithm.";
79  return kStop;
80  }
81 
82  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::endOfLoop"
83  << "Ending loop " << iLoop << ", terminating algorithm.";
84  terminateProcessing(&iSetup);
85 
86  if (iLoop == maxLoops_ - 1 || iLoop >= maxLoops_)
87  return kStop;
88  else
89  return kContinue;
90 }
91 
92 //------------------------------------------------------------------------------
94  if (processEvent(event, setup))
95  return kContinue;
96  else
97  return kStop;
98 }
99 
100 //------------------------------------------------------------------------------
102 
103 //------------------------------------------------------------------------------
105 
106 //------------------------------------------------------------------------------
108  beginLuminosityBlockImpl(lumiBlock, setup);
109 }
110 
111 //------------------------------------------------------------------------------
113  endLuminosityBlockImpl(lumiBlock, setup);
114 }
115 
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
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 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:45
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.