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, consumesCollector()),
15  maxLoops_{config.getUntrackedParameter<unsigned int>("maxLoops")} {
16  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::AlignmentProducer";
17 
18  // do now all the consumes
19  trajTrackAssociationCollectionToken_ = consumes<TrajTrackAssociationCollection>(tjTkAssociationMapTag_);
20  bsToken_ = consumes<reco::BeamSpot>(beamSpotTag_);
21  tkFittedLasBeamCollectionToken_ = consumes<TkFittedLasBeamCollection>(tkLasBeamTag_);
22  tsosVectorCollectionToken_ = consumes<TsosVectorCollection>(tkLasBeamTag_);
23  aliClusterValueMapToken_ = consumes<AliClusterValueMap>(clusterValueMapTag_);
24 
25  // Tell the framework what data is being produced
26  if (doTracker_) {
27  setWhatProduced(this, &AlignmentProducer::produceTracker);
28  }
29 }
30 
31 //------------------------------------------------------------------------------
32 std::shared_ptr<TrackerGeometry> AlignmentProducer::produceTracker(const TrackerDigiGeometryRecord &) {
33  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::produceTracker";
34  return trackerGeometry_;
35 }
36 
37 //------------------------------------------------------------------------------
39  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::beginOfJob";
40  initAlignmentAlgorithm(iSetup);
41 }
42 
43 //------------------------------------------------------------------------------
45  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::endOfJob";
46 
47  if (!finish()) {
48  edm::LogError("Alignment") << "@SUB=AlignmentProducer::endOfJob"
49  << "Did not process any events in last loop, do not dare to store to DB.";
50  }
51 }
52 
53 //------------------------------------------------------------------------------
54 void AlignmentProducer::startingNewLoop(unsigned int iLoop) {
55  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::startingNewLoop"
56  << "Starting loop number " << iLoop;
58 }
59 
60 //------------------------------------------------------------------------------
62  if (0 == nEvent()) {
63  // beginOfJob is usually called by the framework in the first event of the first loop
64  // (a hack: beginOfJob needs the EventSetup that is not well defined without an event)
65  // and the algorithms rely on the initialisations done in beginOfJob. We cannot call
66  // this->beginOfJob(iSetup); here either since that will access the EventSetup to get
67  // some geometry information that is not defined either without having seen an event.
68  edm::LogError("Alignment") << "@SUB=AlignmentProducer::endOfLoop"
69  << "Did not process any events in loop " << iLoop
70  << ", stop processing without terminating algorithm.";
71  return kStop;
72  }
73 
74  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::endOfLoop"
75  << "Ending loop " << iLoop << ", terminating algorithm.";
76  terminateProcessing(&iSetup);
77 
78  if (iLoop == maxLoops_ - 1 || iLoop >= maxLoops_)
79  return kStop;
80  else
81  return kContinue;
82 }
83 
84 //------------------------------------------------------------------------------
86  if (processEvent(event, setup))
87  return kContinue;
88  else
89  return kStop;
90 }
91 
92 //------------------------------------------------------------------------------
94 
95 //------------------------------------------------------------------------------
97 
98 //------------------------------------------------------------------------------
100  beginLuminosityBlockImpl(lumiBlock, setup);
101 }
102 
103 //------------------------------------------------------------------------------
105  endLuminosityBlockImpl(lumiBlock, setup);
106 }
107 
void endOfJob() override
Called at end of job.
void terminateProcessing(const edm::EventSetup *=nullptr)
Terminate processing of events.
bool processEvent(const edm::Event &, const edm::EventSetup &)
Process event.
void initAlignmentAlgorithm(const edm::EventSetup &, bool update=false)
const unsigned int maxLoops_
#define DEFINE_FWK_LOOPER(type)
void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override
Called at lumi block start, calling algorithm&#39;s beginLuminosityBlock.
Definition: config.py:1
Log< level::Error, false > LogError
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.
Log< level::Info, false > LogInfo
virtual void beginOfJob()
void beginLuminosityBlockImpl(const edm::LuminosityBlock &, const edm::EventSetup &)
begin lumi block
virtual std::shared_ptr< TrackerGeometry > produceTracker(const TrackerDigiGeometryRecord &)
Produce the tracker geometry.
void beginRunImpl(const edm::Run &, const edm::EventSetup &)
begin run
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.