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_) {
19  setWhatProduced(this, &AlignmentProducer::produceTracker);
20  }
21  if (doMuon_) {
22  setWhatProduced(this, &AlignmentProducer::produceDT);
23  setWhatProduced(this, &AlignmentProducer::produceCSC);
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 
AlignmentProducerBase::initAlignmentAlgorithm
void initAlignmentAlgorithm(const edm::EventSetup &, bool update=false)
Definition: AlignmentProducerBase.cc:344
edm::EDLooperBase::Status
Status
Definition: EDLooperBase.h:79
AlignmentProducerBase::beginLuminosityBlockImpl
void beginLuminosityBlockImpl(const edm::LuminosityBlock &, const edm::EventSetup &)
begin lumi block
Definition: AlignmentProducerBase.cc:250
AlignmentProducer::maxLoops_
const unsigned int maxLoops_
Definition: AlignmentProducer.h:66
AlignmentProducerBase::endRunImpl
void endRunImpl(const edm::Run &, const edm::EventSetup &)
end run
Definition: AlignmentProducerBase.cc:234
AlignmentProducerBase::endLuminosityBlockImpl
void endLuminosityBlockImpl(const edm::LuminosityBlock &, const edm::EventSetup &)
end lumi block
Definition: AlignmentProducerBase.cc:256
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
AlignmentProducer::duringLoop
Status duringLoop(const edm::Event &, const edm::EventSetup &) override
Called at each event.
Definition: AlignmentProducer.cc:93
edm::Run
Definition: Run.h:45
AlignmentProducerBase::nEvent
int nEvent() const
Definition: AlignmentProducerBase.h:98
edm::LogInfo
Definition: MessageLogger.h:254
AlignmentProducer
Definition: AlignmentProducer.h:15
DEFINE_FWK_LOOPER
#define DEFINE_FWK_LOOPER(type)
Definition: LooperFactory.h:107
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
AlignmentProducer::startingNewLoop
void startingNewLoop(unsigned int iLoop) override
Called at beginning of loop.
Definition: AlignmentProducer.cc:62
AlignmentProducerBase::trackerGeometry_
std::shared_ptr< TrackerGeometry > trackerGeometry_
Definition: AlignmentProducerBase.h:114
config
Definition: config.py:1
AlignmentProducer::AlignmentProducer
AlignmentProducer(const edm::ParameterSet &)
Constructor.
Definition: AlignmentProducer.cc:13
edm::EDLooperBase::kStop
Definition: EDLooperBase.h:79
AlignmentProducer::beginLuminosityBlock
void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override
Called at lumi block start, calling algorithm's beginLuminosityBlock.
Definition: AlignmentProducer.cc:107
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
AlignmentProducerBase
Definition: AlignmentProducerBase.h:69
AlignmentProducerBase::finish
bool finish()
Definition: AlignmentProducerBase.cc:755
LooperFactory.h
TrackerDigiGeometryRecord.h
AlignmentProducerBase::processEvent
bool processEvent(const edm::Event &, const edm::EventSetup &)
Process event.
Definition: AlignmentProducerBase.cc:136
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
AlignmentProducerBase::terminateProcessing
void terminateProcessing(const edm::EventSetup *=nullptr)
Terminate processing of events.
Definition: AlignmentProducerBase.cc:114
AlignmentProducer::endOfLoop
Status endOfLoop(const edm::EventSetup &, unsigned int iLoop) override
Called at end of loop.
Definition: AlignmentProducer.cc:69
AlignmentProducerBase::muonCSCGeometry_
std::shared_ptr< CSCGeometry > muonCSCGeometry_
Definition: AlignmentProducerBase.h:116
AlignmentProducer::endLuminosityBlock
void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override
Called at lumi block end, calling algorithm's endLuminosityBlock.
Definition: AlignmentProducer.cc:112
edm::EventSetup
Definition: EventSetup.h:57
edm::EDLooperBase::kContinue
Definition: EDLooperBase.h:79
AlignmentProducer::produceTracker
virtual std::shared_ptr< TrackerGeometry > produceTracker(const TrackerDigiGeometryRecord &)
Produce the tracker geometry.
Definition: AlignmentProducer.cc:28
writedatasetfile.run
run
Definition: writedatasetfile.py:27
AlignmentProducer::endRun
void endRun(const edm::Run &, const edm::EventSetup &) override
Called at run end - currently reading TkFittedLasBeam if an InpuTag is given for that.
Definition: AlignmentProducer.cc:104
AlignmentProducer::beginRun
void beginRun(const edm::Run &, const edm::EventSetup &) override
Called at run start and calling algorithms beginRun.
Definition: AlignmentProducer.cc:101
AlignmentProducer.h
MuonGeometryRecord.h
AlignmentProducerBase::startProcessing
void startProcessing()
Start processing of events.
Definition: AlignmentProducerBase.cc:86
AlignmentProducer::produceCSC
virtual std::shared_ptr< CSCGeometry > produceCSC(const MuonGeometryRecord &)
Produce the muon CSC geometry.
Definition: AlignmentProducer.cc:40
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
AlignmentProducerBase::muonDTGeometry_
std::shared_ptr< DTGeometry > muonDTGeometry_
Definition: AlignmentProducerBase.h:115
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
AlignmentProducerBase::beginRunImpl
void beginRunImpl(const edm::Run &, const edm::EventSetup &)
begin run
Definition: AlignmentProducerBase.cc:207
AlignmentProducer::endOfJob
void endOfJob() override
Called at end of job.
Definition: AlignmentProducer.cc:52
AlignmentProducer::produceDT
virtual std::shared_ptr< DTGeometry > produceDT(const MuonGeometryRecord &)
Produce the muon DT geometry.
Definition: AlignmentProducer.cc:34
edm::EDLooperBase::beginOfJob
virtual void beginOfJob()
Definition: EDLooperBase.cc:88