CMS 3D CMS Logo

PPSStraightTrackAligner.cc
Go to the documentation of this file.
1 /****************************************************************************
2 * Authors:
3 * Jan Kašpar (jan.kaspar@gmail.com)
4 * Cristian Baldenegro (crisx.baldenegro@gmail.com)
5 ****************************************************************************/
6 
15 
17 
22 
29 
34 public:
36  ~PPSStraightTrackAligner() override {}
37 
38 private:
39  unsigned int verbosity_;
40 
45 
50 
52 
56 
59 
60  void analyze(const edm::Event &e, const edm::EventSetup &es) override;
61 
62  void endJob() override;
63 };
64 
65 using namespace std;
66 using namespace edm;
67 
68 //----------------------------------------------------------------------------------------------------
69 
71  : verbosity_(ps.getUntrackedParameter<unsigned int>("verbosity", 0)),
72 
73  tagUVPatternsStrip_(ps.getParameter<edm::InputTag>("tagUVPatternsStrip")),
74  tagDiamondHits_(ps.getParameter<edm::InputTag>("tagDiamondHits")),
75  tagPixelHits_(ps.getParameter<edm::InputTag>("tagPixelHits")),
76  tagPixelLocalTracks_(ps.getParameter<edm::InputTag>("tagPixelLocalTracks")),
77 
78  tokenUVPatternsStrip_(consumes<DetSetVector<TotemRPUVPattern>>(tagUVPatternsStrip_)),
79  tokenDiamondHits_(consumes<DetSetVector<CTPPSDiamondRecHit>>(tagDiamondHits_)),
80  tokenPixelHits_(consumes<DetSetVector<CTPPSPixelRecHit>>(tagPixelHits_)),
81  tokenPixelLocalTracks_(consumes<DetSetVector<CTPPSPixelLocalTrack>>(tagPixelLocalTracks_)),
82 
83  esTokenRealGeometry_(esConsumes()),
84  esTokenMisalignedGeometry_(esConsumes()),
85  esTokenRealAlignment_(esConsumes()),
86 
87  worker_initialized_(false),
88  worker_(ps) {
89  if (!tagPixelHits_.label().empty() && !tagPixelLocalTracks_.label().empty())
90  LogWarning("PPS")
91  << "Both tagPixelHits and tagPixelLocalTracks are not empty - most likely this not what you want.";
92 }
93 
94 //----------------------------------------------------------------------------------------------------
95 
97  // check if geometry hasn't changed
98  if (geometryWatcher_.check(es)) {
100  throw cms::Exception("PPS") << "PPSStraightTrackAligner can't cope with changing geometry - change in event "
101  << event.id() << endl;
102  }
103 
104  // check if worker already initialised
105  if (!worker_initialized_) {
106  auto hRealGeometry = es.getHandle(esTokenRealGeometry_);
107  auto hMisalignedGeometry = es.getHandle(esTokenMisalignedGeometry_);
108  auto hRealAlignment = es.getHandle(esTokenRealAlignment_);
109 
110  worker_.begin(hRealAlignment, hRealGeometry, hMisalignedGeometry);
111  worker_initialized_ = true;
112  }
113 
114  // get input
115  DetSetVector<TotemRPUVPattern> defaultStripUVPatterns;
116  const DetSetVector<TotemRPUVPattern> *pStripUVPatterns = &defaultStripUVPatterns;
117  Handle<DetSetVector<TotemRPUVPattern>> inputStripUVPatterns;
118  if (!tagUVPatternsStrip_.label().empty()) {
119  event.getByToken(tokenUVPatternsStrip_, inputStripUVPatterns);
120  pStripUVPatterns = &(*inputStripUVPatterns);
121  }
122 
123  DetSetVector<CTPPSDiamondRecHit> defaultDiamondHits;
124  const DetSetVector<CTPPSDiamondRecHit> *pDiamondHits = &defaultDiamondHits;
125  Handle<DetSetVector<CTPPSDiamondRecHit>> inputDiamondHits;
126  if (!tagDiamondHits_.label().empty()) {
127  event.getByToken(tokenDiamondHits_, inputDiamondHits);
128  pDiamondHits = &(*inputDiamondHits);
129  }
130 
131  DetSetVector<CTPPSPixelRecHit> defaultPixelHits;
132  const DetSetVector<CTPPSPixelRecHit> *pPixelHits = &defaultPixelHits;
134  if (!tagPixelHits_.label().empty()) {
135  event.getByToken(tokenPixelHits_, inputPixelHits);
136  pPixelHits = &(*inputPixelHits);
137  }
138 
139  DetSetVector<CTPPSPixelLocalTrack> defaultPixelLocalTracks;
140  const DetSetVector<CTPPSPixelLocalTrack> *pPixelLocalTracks = &defaultPixelLocalTracks;
141  Handle<DetSetVector<CTPPSPixelLocalTrack>> inputPixelLocalTracks;
142  if (!tagPixelLocalTracks_.label().empty()) {
143  event.getByToken(tokenPixelLocalTracks_, inputPixelLocalTracks);
144  pPixelLocalTracks = &(*inputPixelLocalTracks);
145  }
146 
147  // feed worker
148  worker_.processEvent(event.id(), *pStripUVPatterns, *pDiamondHits, *pPixelHits, *pPixelLocalTracks);
149 }
150 
151 //----------------------------------------------------------------------------------------------------
152 
155  worker_.finish();
156  else
157  throw cms::Exception("PPS") << "worker not initialized." << endl;
158 }
159 
PPSStraightTrackAligner::tagPixelHits_
edm::InputTag tagPixelHits_
Definition: PPSStraightTrackAligner.cc:46
edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
edm::DetSetVector
Definition: DetSetVector.h:61
StraightTrackAlignment
Track-based alignment using straight tracks.
Definition: StraightTrackAlignment.h:48
EDAnalyzer.h
PPSStraightTrackAligner::worker_initialized_
bool worker_initialized_
Definition: PPSStraightTrackAligner.cc:60
CTPPSPixelLocalTrack.h
CTPPSPixelRecHit
Definition: CTPPSPixelRecHit.h:17
funct::false
false
Definition: Factorize.h:29
edm::ESWatcher< VeryForwardRealGeometryRecord >
edm::EDGetTokenT
Definition: EDGetToken.h:33
CTPPSDiamondRecHit
Reconstructed hit in diamond detectors.
Definition: CTPPSDiamondRecHit.h:16
edm
HLT enums.
Definition: AlignableModifier.h:19
PPSStraightTrackAligner::tagUVPatternsStrip_
edm::InputTag tagUVPatternsStrip_
Definition: PPSStraightTrackAligner.cc:44
TotemRPRecHit.h
edm::one::EDAnalyzer
Definition: EDAnalyzer.h:30
edm::Handle
Definition: AssociativeIterator.h:50
PPSStraightTrackAligner::tagPixelLocalTracks_
edm::InputTag tagPixelLocalTracks_
Definition: PPSStraightTrackAligner.cc:47
CTPPSPixelRecHit.h
ESGetToken.h
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
VeryForwardMisalignedGeometryRecord.h
StraightTrackAlignment::finish
virtual void finish()
performs analyses and fill results variable
Definition: StraightTrackAlignment.cc:709
PPSStraightTrackAligner::tokenDiamondHits_
edm::EDGetTokenT< edm::DetSetVector< CTPPSDiamondRecHit > > tokenDiamondHits_
Definition: PPSStraightTrackAligner.cc:50
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
CTPPSGeometry.h
MakerMacros.h
PPSStraightTrackAligner::esTokenRealGeometry_
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > esTokenRealGeometry_
Definition: PPSStraightTrackAligner.cc:56
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
PPSStraightTrackAligner
An EDAnalyzer that runs StraightTrackAlignment.
Definition: PPSStraightTrackAligner.cc:33
PPSStraightTrackAligner::esTokenMisalignedGeometry_
edm::ESGetToken< CTPPSGeometry, VeryForwardMisalignedGeometryRecord > esTokenMisalignedGeometry_
Definition: PPSStraightTrackAligner.cc:57
CTPPSDiamondRecHit.h
RPRealAlignmentRecord.h
StraightTrackAlignment.h
PPSStraightTrackAligner::verbosity_
unsigned int verbosity_
Definition: PPSStraightTrackAligner.cc:42
PPSStraightTrackAligner::analyze
void analyze(const edm::Event &e, const edm::EventSetup &es) override
Definition: PPSStraightTrackAligner.cc:96
PPSStraightTrackAligner::~PPSStraightTrackAligner
~PPSStraightTrackAligner() override
Definition: PPSStraightTrackAligner.cc:39
TotemRPUVPattern
A linear pattern in U or V projection. The intercept b is taken at the middle of a RP: (geometry->Get...
Definition: TotemRPUVPattern.h:22
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
CTPPSPixelLocalTrack
Definition: CTPPSPixelLocalTrack.h:84
PPSStraightTrackAligner::tokenUVPatternsStrip_
edm::EDGetTokenT< edm::DetSetVector< TotemRPUVPattern > > tokenUVPatternsStrip_
Definition: PPSStraightTrackAligner.cc:49
StraightTrackAlignment::processEvent
virtual void processEvent(const edm::EventID &eventId, const edm::DetSetVector< TotemRPUVPattern > &uvPatternsStrip, const edm::DetSetVector< CTPPSDiamondRecHit > &hitsDiamond, const edm::DetSetVector< CTPPSPixelRecHit > &hitsPixel, const edm::DetSetVector< CTPPSPixelLocalTrack > &tracksPixel)
Definition: StraightTrackAlignment.cc:288
PPSStraightTrackAligner::tokenPixelHits_
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelRecHit > > tokenPixelHits_
Definition: PPSStraightTrackAligner.cc:51
PPSStraightTrackAligner::endJob
void endJob() override
Definition: PPSStraightTrackAligner.cc:153
createfilelist.int
int
Definition: createfilelist.py:10
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
PPSStraightTrackAligner::tagDiamondHits_
edm::InputTag tagDiamondHits_
Definition: PPSStraightTrackAligner.cc:45
edm::EventSetup
Definition: EventSetup.h:58
DetSetVector.h
VeryForwardRealGeometryRecord.h
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord >
InputTag.h
std
Definition: JetResolutionObject.h:76
PPSStraightTrackAligner::tokenPixelLocalTracks_
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelLocalTrack > > tokenPixelLocalTracks_
Definition: PPSStraightTrackAligner.cc:52
PPSStraightTrackAligner::esTokenRealAlignment_
edm::ESGetToken< CTPPSRPAlignmentCorrectionsData, RPRealAlignmentRecord > esTokenRealAlignment_
Definition: PPSStraightTrackAligner.cc:58
ESWatcher.h
PPSStraightTrackAligner::PPSStraightTrackAligner
PPSStraightTrackAligner(const edm::ParameterSet &ps)
Definition: PPSStraightTrackAligner.cc:70
Exception
Definition: hltDiff.cc:245
PPSStraightTrackAligner::geometryWatcher_
edm::ESWatcher< VeryForwardRealGeometryRecord > geometryWatcher_
Definition: PPSStraightTrackAligner.cc:54
EventSetup.h
TotemRPUVPattern.h
ParameterSet.h
StraightTrackAlignment::begin
virtual void begin(edm::ESHandle< CTPPSRPAlignmentCorrectionsData > hRealAlignment, edm::ESHandle< CTPPSGeometry > hRealGeometry, edm::ESHandle< CTPPSGeometry > hMisalignedGeometry)
Definition: StraightTrackAlignment.cc:251
event
Definition: event.py:1
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
PPSStraightTrackAligner::worker_
StraightTrackAlignment worker_
Definition: PPSStraightTrackAligner.cc:61