1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
/// \file AlignmentProducer.cc
///
/// \author : Frederic Ronga
#include "AlignmentProducer.h"
#include "FWCore/Framework/interface/LooperFactory.h"
#include "Geometry/Records/interface/MuonGeometryRecord.h"
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
//------------------------------------------------------------------------------
AlignmentProducer::AlignmentProducer(const edm::ParameterSet &config)
: AlignmentProducerBase(config, consumesCollector()),
maxLoops_{config.getUntrackedParameter<unsigned int>("maxLoops")} {
edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::AlignmentProducer";
// do now all the consumes
trajTrackAssociationCollectionToken_ = consumes<TrajTrackAssociationCollection>(tjTkAssociationMapTag_);
bsToken_ = consumes<reco::BeamSpot>(beamSpotTag_);
tkFittedLasBeamCollectionToken_ = consumes<TkFittedLasBeamCollection>(tkLasBeamTag_);
tsosVectorCollectionToken_ = consumes<TsosVectorCollection>(tkLasBeamTag_);
aliClusterValueMapToken_ = consumes<AliClusterValueMap>(clusterValueMapTag_);
// Tell the framework what data is being produced
if (doTracker_) {
setWhatProduced(this, &AlignmentProducer::produceTracker);
}
}
//------------------------------------------------------------------------------
std::shared_ptr<TrackerGeometry> AlignmentProducer::produceTracker(const TrackerDigiGeometryRecord &) {
edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::produceTracker";
return trackerGeometry_;
}
//------------------------------------------------------------------------------
void AlignmentProducer::beginOfJob(const edm::EventSetup &iSetup) {
edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::beginOfJob";
initAlignmentAlgorithm(iSetup);
}
//------------------------------------------------------------------------------
void AlignmentProducer::endOfJob() {
edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::endOfJob";
if (!finish()) {
edm::LogError("Alignment") << "@SUB=AlignmentProducer::endOfJob"
<< "Did not process any events in last loop, do not dare to store to DB.";
}
}
//------------------------------------------------------------------------------
void AlignmentProducer::startingNewLoop(unsigned int iLoop) {
edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::startingNewLoop"
<< "Starting loop number " << iLoop;
startProcessing();
}
//------------------------------------------------------------------------------
edm::EDLooper::Status AlignmentProducer::endOfLoop(const edm::EventSetup &iSetup, unsigned int iLoop) {
if (0 == nEvent()) {
// beginOfJob is usually called by the framework in the first event of the first loop
// (a hack: beginOfJob needs the EventSetup that is not well defined without an event)
// and the algorithms rely on the initialisations done in beginOfJob. We cannot call
// this->beginOfJob(iSetup); here either since that will access the EventSetup to get
// some geometry information that is not defined either without having seen an event.
edm::LogError("Alignment") << "@SUB=AlignmentProducer::endOfLoop"
<< "Did not process any events in loop " << iLoop
<< ", stop processing without terminating algorithm.";
return kStop;
}
edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::endOfLoop"
<< "Ending loop " << iLoop << ", terminating algorithm.";
terminateProcessing(&iSetup);
if (iLoop == maxLoops_ - 1 || iLoop >= maxLoops_)
return kStop;
else
return kContinue;
}
//------------------------------------------------------------------------------
edm::EDLooper::Status AlignmentProducer::duringLoop(const edm::Event &event, const edm::EventSetup &setup) {
if (processEvent(event, setup))
return kContinue;
else
return kStop;
}
//------------------------------------------------------------------------------
void AlignmentProducer::beginRun(const edm::Run &run, const edm::EventSetup &setup) { beginRunImpl(run, setup); }
//------------------------------------------------------------------------------
void AlignmentProducer::endRun(const edm::Run &run, const edm::EventSetup &setup) { endRunImpl(run, setup); }
//------------------------------------------------------------------------------
void AlignmentProducer::beginLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &setup) {
beginLuminosityBlockImpl(lumiBlock, setup);
}
//------------------------------------------------------------------------------
void AlignmentProducer::endLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &setup) {
endLuminosityBlockImpl(lumiBlock, setup);
}
DEFINE_FWK_LOOPER(AlignmentProducer);
|