CMS 3D CMS Logo

TotemRPLocalTrackFitter.cc
Go to the documentation of this file.
1 /****************************************************************************
2 *
3 * This is a part of TOTEM offline software.
4 * Authors:
5 * Hubert Niewiadomski
6 * Jan Kašpar (jan.kaspar@gmail.com)
7 *
8 ****************************************************************************/
9 
11 
18 
23 
26 
28 
29 //----------------------------------------------------------------------------------------------------
30 
35 public:
36  explicit TotemRPLocalTrackFitter(const edm::ParameterSet &conf);
37 
38  ~TotemRPLocalTrackFitter() override {}
39 
40  void produce(edm::Event &e, const edm::EventSetup &c) override;
42 
43 private:
45 
48 
50 
53 
56 };
57 
58 //----------------------------------------------------------------------------------------------------
59 //----------------------------------------------------------------------------------------------------
60 
61 using namespace std;
62 using namespace edm;
63 
64 //----------------------------------------------------------------------------------------------------
65 
67  : verbosity_(conf.getParameter<int>("verbosity")), fitter_(conf) {
68  tagUVPattern = conf.getParameter<edm::InputTag>("tagUVPattern");
69  patternCollectionToken = consumes<DetSetVector<TotemRPUVPattern>>(tagUVPattern);
70 
71  produces<DetSetVector<TotemRPLocalTrack>>();
72 }
73 
74 //----------------------------------------------------------------------------------------------------
75 
77  if (verbosity_ > 5)
78  LogVerbatim("TotemRPLocalTrackFitter") << ">> TotemRPLocalTrackFitter::produce";
79 
80  // get geometry
83 
85  fitter_.reset();
86 
87  // get input
89  e.getByToken(patternCollectionToken, input);
90 
91  // run fit for each RP
93 
94  for (const auto &rpv : *input) {
95  CTPPSDetId rpId(rpv.detId());
96 
97  // is U-V association unique?
98  unsigned int n_U = 0, n_V = 0;
99  unsigned int idx_U = 0, idx_V = 0;
100  for (unsigned int pi = 0; pi < rpv.size(); pi++) {
101  const TotemRPUVPattern &pattern = rpv[pi];
102 
103  // here it would make sense to skip non-fittable patterns, but to keep the logic
104  // equivalent to version 7_0_4, nothing is skipped
105  /*
106  if (pattern.fittable() == false)
107  continue;
108  */
109 
110  switch (pattern.projection()) {
112  n_U++;
113  idx_U = pi;
114  break;
115 
117  n_V++;
118  idx_V = pi;
119  break;
120 
121  default:
122  break;
123  }
124  }
125 
126  if (n_U != 1 || n_V != 1) {
127  if (verbosity_)
128  LogVerbatim("TotemRPLocalTrackFitter")
129  << ">> TotemRPLocalTrackFitter::produce > Impossible to combine U and V patterns in RP " << rpId
130  << " (n_U=" << n_U << ", n_V=" << n_V << ").";
131 
132  continue;
133  }
134 
135  // again, to follow the logic from version 7_0_4, skip the non-fittable patterns here
136  if (!rpv[idx_U].fittable() || !rpv[idx_V].fittable())
137  continue;
138 
139  // combine U and V hits
141  for (auto &ids : rpv[idx_U].hits()) {
142  auto &ods = hits.find_or_insert(ids.detId());
143  for (auto &h : ids)
144  ods.push_back(h);
145  }
146 
147  for (auto &ids : rpv[idx_V].hits()) {
148  auto &ods = hits.find_or_insert(ids.detId());
149  for (auto &h : ids)
150  ods.push_back(h);
151  }
152 
153  // run fit
154  double z0 = geometry->rpTranslation(rpId).z();
155 
158 
159  DetSet<TotemRPLocalTrack> &ds = output.find_or_insert(rpId);
160  ds.push_back(track);
161 
162  if (verbosity_ > 5) {
163  unsigned int n_hits = 0;
164  for (auto &hds : track.hits())
165  n_hits += hds.size();
166 
167  LogVerbatim("TotemRPLocalTrackFitter")
168  << " track in RP " << rpId << ": valid = " << track.isValid() << ", hits = " << n_hits;
169  }
170  }
171 
172  // save results
173  e.put(make_unique<DetSetVector<TotemRPLocalTrack>>(output));
174 }
175 
176 //----------------------------------------------------------------------------------------------------
177 
180 
181  desc.add<edm::InputTag>("tagUVPattern", edm::InputTag("totemRPUVPatternFinder"))
182  ->setComment("input U-V patterns collection to retrieve");
183  desc.add<int>("verbosity", 0);
184 
185  descr.add("totemRPLocalTrackFitter", desc);
186 }
187 
188 //----------------------------------------------------------------------------------------------------
189 
TotemRPUVPattern::projV
Definition: TotemRPUVPattern.h:34
edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
VeryForwardRealGeometryRecord
Event setup record containing the real (actual) geometry information.
Definition: VeryForwardRealGeometryRecord.h:22
edm::DetSet::push_back
void push_back(const T &t)
Definition: DetSet.h:66
edm::DetSetVector
Definition: DetSetVector.h:61
geometry
ESHandle< TrackerGeometry > geometry
Definition: TkLasBeamFitter.cc:200
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
input
static const std::string input
Definition: EdmProvDump.cc:48
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
edm::ESWatcher< VeryForwardRealGeometryRecord >
ESHandle.h
TotemRPLocalTrackFitter::~TotemRPLocalTrackFitter
~TotemRPLocalTrackFitter() override
Definition: TotemRPLocalTrackFitter.cc:44
edm::DetSet
Definition: DetSet.h:23
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
TotemRPLocalTrackFitterAlgorithm::fitTrack
bool fitTrack(const edm::DetSetVector< TotemRPRecHit > &hits, double z_0, const CTPPSGeometry &tot_geom, TotemRPLocalTrack &fitted_track)
performs the track fit, returns true if successful
Definition: TotemRPLocalTrackFitterAlgorithm.cc:63
geometry
Definition: geometry.py:1
TotemRPLocalTrackFitterAlgorithm
Algorithm for fitting tracks through a single RP.
Definition: TotemRPLocalTrackFitterAlgorithm.h:31
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EDProducer.h
TotemRPRecHit.h
year_2016_postTS2_cff.rpId
rpId
Definition: year_2016_postTS2_cff.py:23
edm::Handle
Definition: AssociativeIterator.h:50
TotemRPLocalTrackFitter::produce
void produce(edm::Event &e, const edm::EventSetup &c) override
Definition: TotemRPLocalTrackFitter.cc:76
TotemRPLocalTrackFitter::geometryWatcher
edm::ESWatcher< VeryForwardRealGeometryRecord > geometryWatcher
A watcher to detect geometry changes.
Definition: TotemRPLocalTrackFitter.cc:58
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
CTPPSGeometry.h
MakerMacros.h
h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
TotemRPLocalTrackFitter
Fits tracks trough a single RP.
Definition: TotemRPLocalTrackFitter.cc:34
edm::ESHandle
Definition: DTSurvey.h:22
TotemRPLocalTrackFitterAlgorithm::reset
void reset()
Resets the reconstruction-data cache.
Definition: TotemRPLocalTrackFitterAlgorithm.cc:26
HLTMuonOfflineAnalyzer_cfi.z0
z0
Definition: HLTMuonOfflineAnalyzer_cfi.py:98
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
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
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
CTPPSDetId
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:31
createfilelist.int
int
Definition: createfilelist.py:10
edm::LogVerbatim
Definition: MessageLogger.h:297
topSingleLeptonDQM_PU_cfi.pattern
pattern
Definition: topSingleLeptonDQM_PU_cfi.py:39
edm::stream::EDProducer
Definition: EDProducer.h:38
TotemRPLocalTrackFitter::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: TotemRPLocalTrackFitter.cc:178
edm::EventSetup
Definition: EventSetup.h:57
DetSetVector.h
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
get
#define get
VeryForwardRealGeometryRecord.h
TotemRPLocalTrackFitter::fitter_
TotemRPLocalTrackFitterAlgorithm fitter_
The instance of the fitter module.
Definition: TotemRPLocalTrackFitter.cc:61
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
TotemRPLocalTrackFitter::tagUVPattern
edm::InputTag tagUVPattern
Selection of the pattern-recognition module.
Definition: TotemRPLocalTrackFitter.cc:53
std
Definition: JetResolutionObject.h:76
ESWatcher.h
TotemRPLocalTrack
A track fit through a single RP.
Definition: TotemRPLocalTrack.h:31
EventSetup.h
TotemRPUVPattern::projU
Definition: TotemRPUVPattern.h:34
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
TotemRPUVPattern.h
pi
const Double_t pi
Definition: trackSplitPlot.h:36
TotemRPLocalTrackFitter::TotemRPLocalTrackFitter
TotemRPLocalTrackFitter(const edm::ParameterSet &conf)
Definition: TotemRPLocalTrackFitter.cc:66
ParameterSet.h
TotemRPLocalTrack.h
TotemRPLocalTrackFitter::patternCollectionToken
edm::EDGetTokenT< edm::DetSetVector< TotemRPUVPattern > > patternCollectionToken
Definition: TotemRPLocalTrackFitter.cc:55
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
TotemRPLocalTrackFitter::verbosity_
int verbosity_
Definition: TotemRPLocalTrackFitter.cc:50
TotemRPLocalTrackFitterAlgorithm.h
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37