CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
CTPPSProtonProducer Class Reference
Inheritance diagram for CTPPSProtonProducer:
edm::stream::EDProducer<>

Public Member Functions

 CTPPSProtonProducer (const edm::ParameterSet &)
 
 ~CTPPSProtonProducer () override=default
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

ProtonReconstructionAlgorithm algorithm_
 
double default_time_
 
bool doMultiRPReconstruction_
 
bool doSingleRPReconstruction_
 
const edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecordgeometryToken_
 
const std::string lhcInfoLabel_
 
const std::string lhcInfoPerFillLabel_
 
const edm::ESGetToken< LHCInfoPerFill, LHCInfoPerFillRcdlhcInfoPerFillToken_
 
const std::string lhcInfoPerLSLabel_
 
const edm::ESGetToken< LHCInfoPerLS, LHCInfoPerLSRcdlhcInfoPerLSToken_
 
const edm::ESGetToken< LHCInfo, LHCInfoRcdlhcInfoToken_
 
double localAngleXMax_
 
double localAngleXMin_
 
double localAngleYMax_
 
double localAngleYMin_
 
unsigned int max_n_timing_tracks_
 
std::string multiRPReconstructionLabel_
 
const edm::ESGetToken< LHCInterpolatedOpticalFunctionsSetCollection, CTPPSInterpolatedOpticsRcdopticalFunctionsToken_
 
const std::string opticsLabel_
 
bool opticsValid_
 
edm::ESWatcher< CTPPSInterpolatedOpticsRcdopticsWatcher_
 
bool pixelDiscardBXShiftedTracks_
 
const std::string ppsAssociationCutsLabel_
 
const edm::ESGetToken< PPSAssociationCuts, PPSAssociationCutsRcdppsAssociationCutsToken_
 
std::string singleRPReconstructionLabel_
 
edm::EDGetTokenT< CTPPSLocalTrackLiteCollectiontracksToken_
 
const bool useNewLHCInfo_
 
unsigned int verbosity_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 45 of file CTPPSProtonProducer.cc.

Constructor & Destructor Documentation

◆ CTPPSProtonProducer()

CTPPSProtonProducer::CTPPSProtonProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 94 of file CTPPSProtonProducer.cc.

References doMultiRPReconstruction_, doSingleRPReconstruction_, multiRPReconstructionLabel_, and singleRPReconstructionLabel_.

95  : tracksToken_(consumes<CTPPSLocalTrackLiteCollection>(iConfig.getParameter<edm::InputTag>("tagLocalTrackLite"))),
96 
97  pixelDiscardBXShiftedTracks_(iConfig.getParameter<bool>("pixelDiscardBXShiftedTracks")),
98 
99  lhcInfoPerLSLabel_(iConfig.getParameter<std::string>("lhcInfoPerLSLabel")),
100  lhcInfoPerFillLabel_(iConfig.getParameter<std::string>("lhcInfoPerFillLabel")),
101  lhcInfoLabel_(iConfig.getParameter<std::string>("lhcInfoLabel")),
102  opticsLabel_(iConfig.getParameter<std::string>("opticsLabel")),
103  ppsAssociationCutsLabel_(iConfig.getParameter<std::string>("ppsAssociationCutsLabel")),
104  useNewLHCInfo_(iConfig.getParameter<bool>("useNewLHCInfo")),
105  verbosity_(iConfig.getUntrackedParameter<unsigned int>("verbosity", 0)),
106  doSingleRPReconstruction_(iConfig.getParameter<bool>("doSingleRPReconstruction")),
107  doMultiRPReconstruction_(iConfig.getParameter<bool>("doMultiRPReconstruction")),
108  singleRPReconstructionLabel_(iConfig.getParameter<std::string>("singleRPReconstructionLabel")),
109  multiRPReconstructionLabel_(iConfig.getParameter<std::string>("multiRPReconstructionLabel")),
110 
111  localAngleXMin_(iConfig.getParameter<double>("localAngleXMin")),
112  localAngleXMax_(iConfig.getParameter<double>("localAngleXMax")),
113  localAngleYMin_(iConfig.getParameter<double>("localAngleYMin")),
114  localAngleYMax_(iConfig.getParameter<double>("localAngleYMax")),
115 
116  max_n_timing_tracks_(iConfig.getParameter<unsigned int>("max_n_timing_tracks")),
117  default_time_(iConfig.getParameter<double>("default_time")),
118 
119  algorithm_(iConfig.getParameter<bool>("fitVtxY"),
120  iConfig.getParameter<bool>("useImprovedInitialEstimate"),
121  iConfig.getParameter<std::string>("multiRPAlgorithm"),
122  verbosity_),
123  opticsValid_(false),
124  lhcInfoPerLSToken_(esConsumes<LHCInfoPerLS, LHCInfoPerLSRcd>(edm::ESInputTag("", lhcInfoPerLSLabel_))),
125  lhcInfoPerFillToken_(esConsumes<LHCInfoPerFill, LHCInfoPerFillRcd>(edm::ESInputTag("", lhcInfoPerFillLabel_))),
126  lhcInfoToken_(esConsumes<LHCInfo, LHCInfoRcd>(edm::ESInputTag("", lhcInfoLabel_))),
127  opticalFunctionsToken_(esConsumes<LHCInterpolatedOpticalFunctionsSetCollection, CTPPSInterpolatedOpticsRcd>(
129  geometryToken_(esConsumes<CTPPSGeometry, VeryForwardRealGeometryRecord>()),
131  esConsumes<PPSAssociationCuts, PPSAssociationCutsRcd>(edm::ESInputTag("", ppsAssociationCutsLabel_))) {
133  produces<reco::ForwardProtonCollection>(singleRPReconstructionLabel_);
134 
136  produces<reco::ForwardProtonCollection>(multiRPReconstructionLabel_);
137 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::ESGetToken< LHCInfoPerFill, LHCInfoPerFillRcd > lhcInfoPerFillToken_
const std::string opticsLabel_
const std::string ppsAssociationCutsLabel_
const edm::ESGetToken< PPSAssociationCuts, PPSAssociationCutsRcd > ppsAssociationCutsToken_
unsigned int max_n_timing_tracks_
const edm::ESGetToken< LHCInfoPerLS, LHCInfoPerLSRcd > lhcInfoPerLSToken_
T getUntrackedParameter(std::string const &, T const &) const
const std::string lhcInfoPerLSLabel_
const std::string lhcInfoLabel_
const edm::ESGetToken< LHCInfo, LHCInfoRcd > lhcInfoToken_
ProtonReconstructionAlgorithm algorithm_
const std::string lhcInfoPerFillLabel_
const edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > geometryToken_
std::string singleRPReconstructionLabel_
const edm::ESGetToken< LHCInterpolatedOpticalFunctionsSetCollection, CTPPSInterpolatedOpticsRcd > opticalFunctionsToken_
std::string multiRPReconstructionLabel_
edm::EDGetTokenT< CTPPSLocalTrackLiteCollection > tracksToken_

◆ ~CTPPSProtonProducer()

CTPPSProtonProducer::~CTPPSProtonProducer ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

void CTPPSProtonProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 141 of file CTPPSProtonProducer.cc.

References edm::ConfigurationDescriptions::add(), DiMuonV_cfg::config, submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

141  {
143 
144  desc.add<edm::InputTag>("tagLocalTrackLite", edm::InputTag("ctppsLocalTrackLiteProducer"))
145  ->setComment("specification of the input lite-track collection");
146 
147  desc.add<bool>("pixelDiscardBXShiftedTracks", false)
148  ->setComment("whether to discard pixel tracks built from BX-shifted planes");
149 
150  desc.add<std::string>("lhcInfoPerFillLabel", "")->setComment("label of the LHCInfoPerFill record");
151  desc.add<std::string>("lhcInfoPerLSLabel", "")->setComment("label of the LHCInfoPerLS record");
152  desc.add<std::string>("lhcInfoLabel", "")->setComment("label of the LHCInfo record");
153  desc.add<bool>("useNewLHCInfo", false)->setComment("flag whether to use new LHCInfoPer* records or old LHCInfo");
154 
155  desc.add<std::string>("opticsLabel", "")->setComment("label of the optics record");
156  desc.add<std::string>("ppsAssociationCutsLabel", "")->setComment("label of the association cuts record");
157 
158  desc.addUntracked<unsigned int>("verbosity", 0)->setComment("verbosity level");
159 
160  desc.add<bool>("doSingleRPReconstruction", true)
161  ->setComment("flag whether to apply single-RP reconstruction strategy");
162 
163  desc.add<bool>("doMultiRPReconstruction", true)->setComment("flag whether to apply multi-RP reconstruction strategy");
164 
165  desc.add<std::string>("singleRPReconstructionLabel", "singleRP")
166  ->setComment("output label for single-RP reconstruction products");
167 
168  desc.add<std::string>("multiRPReconstructionLabel", "multiRP")
169  ->setComment("output label for multi-RP reconstruction products");
170 
171  desc.add<double>("localAngleXMin", -0.03)->setComment("minimal accepted value of local horizontal angle (rad)");
172  desc.add<double>("localAngleXMax", +0.03)->setComment("maximal accepted value of local horizontal angle (rad)");
173  desc.add<double>("localAngleYMin", -0.04)->setComment("minimal accepted value of local vertical angle (rad)");
174  desc.add<double>("localAngleYMax", +0.04)->setComment("maximal accepted value of local vertical angle (rad)");
175 
176  std::vector<edm::ParameterSet> config;
177 
178  desc.add<unsigned int>("max_n_timing_tracks", 5)->setComment("maximum number of timing tracks per RP");
179 
180  desc.add<double>("default_time", 0.)->setComment("proton time to be used when no timing information available");
181 
182  desc.add<bool>("fitVtxY", true)
183  ->setComment("for multi-RP reconstruction, flag whether y* should be free fit parameter");
184 
185  desc.add<bool>("useImprovedInitialEstimate", true)
186  ->setComment(
187  "for multi-RP reconstruction, flag whether a quadratic estimate of the initial point should be used");
188 
189  desc.add<std::string>("multiRPAlgorithm", "chi2")
190  ->setComment("algorithm for multi-RP reco, options include chi2, newton, anal-iter");
191 
192  descriptions.add("ctppsProtonsDefault", desc);
193 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)
dictionary config
Read in AllInOne config in JSON format.
Definition: DiMuonV_cfg.py:30

◆ produce()

void CTPPSProtonProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 197 of file CTPPSProtonProducer.cc.

References funct::abs(), algorithm_, allShiftedPlanes, edm::ESWatcher< T >::check(), LHCInfoCombined::crossingAngle(), alignCSCRings::de_x, default_time_, doMultiRPReconstruction_, doSingleRPReconstruction_, LHCInfoCombined::energy, geometryToken_, PPSAssociationCuts::getAssociationCuts(), edm::EventSetup::getHandle(), mps_fire::i, heavyIonCSV_trainingSettings::idx, iEvent, dqmdumpme::indices, ProtonReconstructionAlgorithm::init(), dqmiolumiharvest::j, lhcInfoPerFillToken_, lhcInfoPerLSToken_, lhcInfoToken_, localAngleXMax_, localAngleXMin_, localAngleYMax_, localAngleYMin_, max_n_timing_tracks_, mixedPlanes, eostools::move(), multiRPReconstructionLabel_, opticalFunctionsToken_, opticsValid_, opticsWatcher_, AlCaHLTBitMon_ParallelJobs::p, pixelDiscardBXShiftedTracks_, ppsAssociationCutsToken_, edm::RefVector< C, T, F >::push_back(), alignCSCRings::r, ProtonReconstructionAlgorithm::reconstructFromMultiRP(), ProtonReconstructionAlgorithm::reconstructFromSingleRP(), ProtonReconstructionAlgorithm::release(), ctppsOpticalFunctions_non_DB_cff::rpId, ppsStraightTrackAligner_cfi::rpIds, CTPPSGeometry::rpTranslation(), CTPPSDetId::sdTrackingPixel, CTPPSDetId::sdTrackingStrip, reco::ForwardProton::setContributingLocalTracks(), reco::ForwardProton::setTime(), reco::ForwardProton::setTimeError(), singleRPReconstructionLabel_, mathSSE::sqrt(), hcalRecHitTable_cff::time, tracksToken_, useNewLHCInfo_, verbosity_, w(), and z.

197  {
198  // get input
200  iEvent.getByToken(tracksToken_, hTracks);
201 
202  // book output
203  std::unique_ptr<reco::ForwardProtonCollection> pOutSingleRP(new reco::ForwardProtonCollection);
204  std::unique_ptr<reco::ForwardProtonCollection> pOutMultiRP(new reco::ForwardProtonCollection);
205 
206  // continue only if there is something to process
207  // NB: this avoids loading (possibly non-existing) conditions in workflows without proton data
208  if (!hTracks->empty()) {
209  // get conditions
211 
214 
216 
218 
219  // re-initialise algorithm upon crossing-angle change
220  if (opticsWatcher_.check(iSetup)) {
221  if (hOpticalFunctions->empty()) {
222  edm::LogInfo("CTPPSProtonProducer") << "No optical functions available, reconstruction disabled.";
224  opticsValid_ = false;
225  } else {
226  algorithm_.init(*hOpticalFunctions);
227  opticsValid_ = true;
228  }
229  }
230 
231  // do reconstruction only if optics is valid
232  if (opticsValid_) {
233  // prepare log
234  std::ostringstream ssLog;
235  if (verbosity_)
236  ssLog << "* input tracks:" << std::endl;
237 
238  // select tracks with small local angles, split them by LHC sector and tracker/timing RPs
239  std::map<unsigned int, std::vector<unsigned int>> trackingSelection, timingSelection;
240 
241  for (unsigned int idx = 0; idx < hTracks->size(); ++idx) {
242  const auto &tr = hTracks->at(idx);
243 
244  if (tr.tx() < localAngleXMin_ || tr.tx() > localAngleXMax_ || tr.ty() < localAngleYMin_ ||
245  tr.ty() > localAngleYMax_)
246  continue;
247 
249  if (tr.pixelTrackRecoInfo() == CTPPSpixelLocalTrackReconstructionInfo::allShiftedPlanes ||
250  tr.pixelTrackRecoInfo() == CTPPSpixelLocalTrackReconstructionInfo::mixedPlanes)
251  continue;
252  }
253 
254  const CTPPSDetId rpId(tr.rpId());
255 
256  if (verbosity_)
257  ssLog << "\t"
258  << "[" << idx << "] " << tr.rpId() << " (" << (rpId.arm() * 100 + rpId.station() * 10 + rpId.rp())
259  << "): "
260  << "x=" << tr.x() << " +- " << tr.xUnc() << " mm, "
261  << "y=" << tr.y() << " +- " << tr.yUnc() << " mm" << std::endl;
262 
263  const bool trackerRP =
264  (rpId.subdetId() == CTPPSDetId::sdTrackingStrip || rpId.subdetId() == CTPPSDetId::sdTrackingPixel);
265 
266  if (trackerRP)
267  trackingSelection[rpId.arm()].push_back(idx);
268  else
269  timingSelection[rpId.arm()].push_back(idx);
270  }
271 
272  // process each arm
273  for (const auto &arm_it : trackingSelection) {
274  const auto &indices = arm_it.second;
275 
276  const auto &ac = ppsAssociationCuts->getAssociationCuts(arm_it.first);
277 
278  // do single-RP reco if needed
279  std::map<unsigned int, reco::ForwardProton> singleRPResultsIndexed;
280  if (doSingleRPReconstruction_ || ac.isApplied(ac.qXi) || ac.isApplied(ac.qThetaY)) {
281  for (const auto &idx : indices) {
282  if (verbosity_)
283  ssLog << std::endl << "* reconstruction from track " << idx << std::endl;
284 
285  singleRPResultsIndexed[idx] =
286  algorithm_.reconstructFromSingleRP(CTPPSLocalTrackLiteRef(hTracks, idx), lhcInfoCombined.energy, ssLog);
287  }
288  }
289 
290  // check that exactly two tracking RPs are involved
291  // - 1 is insufficient for multi-RP reconstruction
292  // - PPS did not use more than 2 tracking RPs per arm -> algorithms are tuned to this
293  std::set<unsigned int> rpIds;
294  for (const auto &idx : indices)
295  rpIds.insert(hTracks->at(idx).rpId());
296 
297  // do multi-RP reco if chosen
298  if (doMultiRPReconstruction_ && rpIds.size() == 2) {
299  // find matching track pairs from different tracking RPs, ordered: i=near, j=far RP
300  std::vector<std::pair<unsigned int, unsigned int>> idx_pairs;
301  std::map<unsigned int, unsigned int> idx_pair_multiplicity;
302  for (const auto &i : indices) {
303  for (const auto &j : indices) {
304  const auto &tr_i = hTracks->at(i);
305  const auto &tr_j = hTracks->at(j);
306 
307  const double z_i = hGeometry->rpTranslation(tr_i.rpId()).z();
308  const double z_j = hGeometry->rpTranslation(tr_j.rpId()).z();
309 
310  const auto &pr_i = singleRPResultsIndexed[i];
311  const auto &pr_j = singleRPResultsIndexed[j];
312 
313  if (tr_i.rpId() == tr_j.rpId())
314  continue;
315 
316  if (std::abs(z_i) >= std::abs(z_j))
317  continue;
318 
319  bool matching = true;
320 
321  if (!ac.isSatisfied(ac.qX, tr_i.x(), tr_i.y(), lhcInfoCombined.crossingAngle(), tr_i.x() - tr_j.x()))
322  matching = false;
323  else if (!ac.isSatisfied(ac.qY, tr_i.x(), tr_i.y(), lhcInfoCombined.crossingAngle(), tr_i.y() - tr_j.y()))
324  matching = false;
325  else if (!ac.isSatisfied(
326  ac.qXi, tr_i.x(), tr_i.y(), lhcInfoCombined.crossingAngle(), pr_i.xi() - pr_j.xi()))
327  matching = false;
328  else if (!ac.isSatisfied(ac.qThetaY,
329  tr_i.x(),
330  tr_i.y(),
331  lhcInfoCombined.crossingAngle(),
332  pr_i.thetaY() - pr_j.thetaY()))
333  matching = false;
334 
335  if (!matching)
336  continue;
337 
338  idx_pairs.emplace_back(i, j);
339  idx_pair_multiplicity[i]++;
340  idx_pair_multiplicity[j]++;
341  }
342  }
343 
344  // evaluate track multiplicity in each timing RP
345  std::map<unsigned int, unsigned int> timing_RP_track_multiplicity;
346  for (const auto &ti : timingSelection[arm_it.first]) {
347  const auto &tr = hTracks->at(ti);
348  timing_RP_track_multiplicity[tr.rpId()]++;
349  }
350 
351  // associate tracking-RP pairs with timing-RP tracks
352  std::map<unsigned int, std::vector<unsigned int>> matched_timing_track_indices;
353  std::map<unsigned int, unsigned int> matched_timing_track_multiplicity;
354  for (unsigned int pr_idx = 0; pr_idx < idx_pairs.size(); ++pr_idx) {
355  const auto &i = idx_pairs[pr_idx].first;
356  const auto &j = idx_pairs[pr_idx].second;
357 
358  // skip non-unique associations
359  if (idx_pair_multiplicity[i] > 1 || idx_pair_multiplicity[j] > 1)
360  continue;
361 
362  const auto &tr_i = hTracks->at(i);
363  const auto &tr_j = hTracks->at(j);
364 
365  const double z_i = hGeometry->rpTranslation(tr_i.rpId()).z();
366  const double z_j = hGeometry->rpTranslation(tr_j.rpId()).z();
367 
368  for (const auto &ti : timingSelection[arm_it.first]) {
369  const auto &tr_ti = hTracks->at(ti);
370 
371  // skip if timing RP saturated (high track multiplicity)
372  if (timing_RP_track_multiplicity[tr_ti.rpId()] > max_n_timing_tracks_)
373  continue;
374 
375  // interpolation from tracking RPs
376  const double z_ti = hGeometry->rpTranslation(tr_ti.rpId()).z();
377  const double f_i = (z_ti - z_j) / (z_i - z_j), f_j = (z_i - z_ti) / (z_i - z_j);
378  const double x_inter = f_i * tr_i.x() + f_j * tr_j.x();
379  const double x_inter_unc_sq =
380  f_i * f_i * tr_i.xUnc() * tr_i.xUnc() + f_j * f_j * tr_j.xUnc() * tr_j.xUnc();
381 
382  const double de_x = tr_ti.x() - x_inter;
383  const double de_x_unc = sqrt(tr_ti.xUnc() * tr_ti.xUnc() + x_inter_unc_sq);
384  const double r = (de_x_unc > 0.) ? de_x / de_x_unc : 1E100;
385 
386  const bool matching = (ac.getTiTrMin() < r && r < ac.getTiTrMax());
387 
388  if (verbosity_)
389  ssLog << "ti=" << ti << ", i=" << i << ", j=" << j << " | z_ti=" << z_ti << ", z_i=" << z_i
390  << ", z_j=" << z_j << " | x_ti=" << tr_ti.x() << ", x_inter=" << x_inter << ", de_x=" << de_x
391  << ", de_x_unc=" << de_x_unc << ", matching=" << matching << std::endl;
392 
393  if (!matching)
394  continue;
395 
396  matched_timing_track_indices[pr_idx].push_back(ti);
397  matched_timing_track_multiplicity[ti]++;
398  }
399  }
400 
401  // process associated tracks
402  for (unsigned int pr_idx = 0; pr_idx < idx_pairs.size(); ++pr_idx) {
403  const auto &i = idx_pairs[pr_idx].first;
404  const auto &j = idx_pairs[pr_idx].second;
405 
406  // skip non-unique associations of tracking-RP tracks
407  if (idx_pair_multiplicity[i] > 1 || idx_pair_multiplicity[j] > 1)
408  continue;
409 
410  if (verbosity_)
411  ssLog << std::endl
412  << "* reconstruction from tracking-RP tracks: " << i << ", " << j << " and timing-RP tracks: ";
413 
414  // buffer contributing tracks
415  CTPPSLocalTrackLiteRefVector sel_tracks;
416  sel_tracks.push_back(CTPPSLocalTrackLiteRef(hTracks, i));
417  sel_tracks.push_back(CTPPSLocalTrackLiteRef(hTracks, j));
418 
419  CTPPSLocalTrackLiteRefVector sel_track_for_kin_reco = sel_tracks;
420 
421  // process timing-RP data
422  double sw = 0., swt = 0.;
423  for (const auto &ti : matched_timing_track_indices[pr_idx]) {
424  // skip non-unique associations of timing-RP tracks
425  if (matched_timing_track_multiplicity[ti] > 1)
426  continue;
427 
428  sel_tracks.push_back(CTPPSLocalTrackLiteRef(hTracks, ti));
429 
430  if (verbosity_)
431  ssLog << ti << ", ";
432 
433  const auto &tr = hTracks->at(ti);
434  const double t_unc = tr.timeUnc();
435  const double w = (t_unc > 0.) ? 1. / t_unc / t_unc : 1.;
436  sw += w;
437  swt += w * tr.time();
438  }
439 
440  float time = default_time_, time_unc = 0.;
441  if (sw > 0.) {
442  time = swt / sw;
443  time_unc = 1. / sqrt(sw);
444  }
445 
446  if (verbosity_)
447  ssLog << std::endl << " time = " << time << " +- " << time_unc << std::endl;
448 
449  // process tracking-RP data
450  reco::ForwardProton proton =
451  algorithm_.reconstructFromMultiRP(sel_track_for_kin_reco, lhcInfoCombined.energy, ssLog);
452 
453  // save combined output
454  proton.setContributingLocalTracks(sel_tracks);
455  proton.setTime(time);
456  proton.setTimeError(time_unc);
457 
458  pOutMultiRP->emplace_back(proton);
459  }
460  }
461 
462  // save single-RP results (un-indexed)
463  for (const auto &p : singleRPResultsIndexed)
464  pOutSingleRP->emplace_back(p.second);
465  }
466 
467  // dump log
468  if (verbosity_)
469  edm::LogInfo("CTPPSProtonProducer") << ssLog.str();
470  }
471  }
472 
473  // save output
475  iEvent.put(std::move(pOutSingleRP), singleRPReconstructionLabel_);
476 
478  iEvent.put(std::move(pOutMultiRP), multiRPReconstructionLabel_);
479 }
const edm::ESGetToken< LHCInfoPerFill, LHCInfoPerFillRcd > lhcInfoPerFillToken_
reco::ForwardProton reconstructFromSingleRP(const CTPPSLocalTrackLiteRef &track, const float energy, std::ostream &os) const
run proton reconstruction using single-RP strategy
T w() const
const edm::ESGetToken< PPSAssociationCuts, PPSAssociationCutsRcd > ppsAssociationCutsToken_
unsigned int max_n_timing_tracks_
const edm::ESGetToken< LHCInfoPerLS, LHCInfoPerLSRcd > lhcInfoPerLSToken_
void init(const LHCInterpolatedOpticalFunctionsSetCollection &opticalFunctions)
const CutsPerArm & getAssociationCuts(const int sector) const
int iEvent
Definition: GenABIO.cc:224
void setTimeError(float time_err)
const edm::ESGetToken< LHCInfo, LHCInfoRcd > lhcInfoToken_
T sqrt(T t)
Definition: SSEVec.h:23
edm::ESWatcher< CTPPSInterpolatedOpticsRcd > opticsWatcher_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::Ref< CTPPSLocalTrackLiteCollection > CTPPSLocalTrackLiteRef
Persistent reference to a CTPPSLocalTrackLite.
void setTime(float time)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
reco::ForwardProton reconstructFromMultiRP(const CTPPSLocalTrackLiteRefVector &tracks, const float energy, std::ostream &os) const
run proton reconstruction using multiple-RP strategy
Log< level::Info, false > LogInfo
Vector rpTranslation(unsigned int id) const
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
ProtonReconstructionAlgorithm algorithm_
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67
std::vector< ForwardProton > ForwardProtonCollection
Collection of ForwardProton objects.
void setContributingLocalTracks(const CTPPSLocalTrackLiteRefVector &v)
store the list of RP tracks that contributed to this global track
const edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > geometryToken_
std::string singleRPReconstructionLabel_
def move(src, dest)
Definition: eostools.py:511
const edm::ESGetToken< LHCInterpolatedOpticalFunctionsSetCollection, CTPPSInterpolatedOpticsRcd > opticalFunctionsToken_
std::string multiRPReconstructionLabel_
edm::EDGetTokenT< CTPPSLocalTrackLiteCollection > tracksToken_

Member Data Documentation

◆ algorithm_

ProtonReconstructionAlgorithm CTPPSProtonProducer::algorithm_
private

Definition at line 79 of file CTPPSProtonProducer.cc.

Referenced by produce().

◆ default_time_

double CTPPSProtonProducer::default_time_
private

Definition at line 77 of file CTPPSProtonProducer.cc.

Referenced by produce().

◆ doMultiRPReconstruction_

bool CTPPSProtonProducer::doMultiRPReconstruction_
private

Definition at line 69 of file CTPPSProtonProducer.cc.

Referenced by CTPPSProtonProducer(), and produce().

◆ doSingleRPReconstruction_

bool CTPPSProtonProducer::doSingleRPReconstruction_
private

Definition at line 68 of file CTPPSProtonProducer.cc.

Referenced by CTPPSProtonProducer(), and produce().

◆ geometryToken_

const edm::ESGetToken<CTPPSGeometry, VeryForwardRealGeometryRecord> CTPPSProtonProducer::geometryToken_
private

Definition at line 88 of file CTPPSProtonProducer.cc.

Referenced by produce().

◆ lhcInfoLabel_

const std::string CTPPSProtonProducer::lhcInfoLabel_
private

Definition at line 61 of file CTPPSProtonProducer.cc.

◆ lhcInfoPerFillLabel_

const std::string CTPPSProtonProducer::lhcInfoPerFillLabel_
private

Definition at line 60 of file CTPPSProtonProducer.cc.

◆ lhcInfoPerFillToken_

const edm::ESGetToken<LHCInfoPerFill, LHCInfoPerFillRcd> CTPPSProtonProducer::lhcInfoPerFillToken_
private

Definition at line 85 of file CTPPSProtonProducer.cc.

Referenced by produce().

◆ lhcInfoPerLSLabel_

const std::string CTPPSProtonProducer::lhcInfoPerLSLabel_
private

Definition at line 59 of file CTPPSProtonProducer.cc.

◆ lhcInfoPerLSToken_

const edm::ESGetToken<LHCInfoPerLS, LHCInfoPerLSRcd> CTPPSProtonProducer::lhcInfoPerLSToken_
private

Definition at line 84 of file CTPPSProtonProducer.cc.

Referenced by produce().

◆ lhcInfoToken_

const edm::ESGetToken<LHCInfo, LHCInfoRcd> CTPPSProtonProducer::lhcInfoToken_
private

Definition at line 86 of file CTPPSProtonProducer.cc.

Referenced by produce().

◆ localAngleXMax_

double CTPPSProtonProducer::localAngleXMax_
private

Definition at line 74 of file CTPPSProtonProducer.cc.

Referenced by produce().

◆ localAngleXMin_

double CTPPSProtonProducer::localAngleXMin_
private

Definition at line 74 of file CTPPSProtonProducer.cc.

Referenced by produce().

◆ localAngleYMax_

double CTPPSProtonProducer::localAngleYMax_
private

Definition at line 74 of file CTPPSProtonProducer.cc.

Referenced by produce().

◆ localAngleYMin_

double CTPPSProtonProducer::localAngleYMin_
private

Definition at line 74 of file CTPPSProtonProducer.cc.

Referenced by produce().

◆ max_n_timing_tracks_

unsigned int CTPPSProtonProducer::max_n_timing_tracks_
private

Definition at line 76 of file CTPPSProtonProducer.cc.

Referenced by produce().

◆ multiRPReconstructionLabel_

std::string CTPPSProtonProducer::multiRPReconstructionLabel_
private

Definition at line 72 of file CTPPSProtonProducer.cc.

Referenced by CTPPSProtonProducer(), and produce().

◆ opticalFunctionsToken_

const edm::ESGetToken<LHCInterpolatedOpticalFunctionsSetCollection, CTPPSInterpolatedOpticsRcd> CTPPSProtonProducer::opticalFunctionsToken_
private

Definition at line 87 of file CTPPSProtonProducer.cc.

Referenced by produce().

◆ opticsLabel_

const std::string CTPPSProtonProducer::opticsLabel_
private

Definition at line 62 of file CTPPSProtonProducer.cc.

◆ opticsValid_

bool CTPPSProtonProducer::opticsValid_
private

Definition at line 81 of file CTPPSProtonProducer.cc.

Referenced by produce().

◆ opticsWatcher_

edm::ESWatcher<CTPPSInterpolatedOpticsRcd> CTPPSProtonProducer::opticsWatcher_
private

Definition at line 82 of file CTPPSProtonProducer.cc.

Referenced by produce().

◆ pixelDiscardBXShiftedTracks_

bool CTPPSProtonProducer::pixelDiscardBXShiftedTracks_
private

Definition at line 57 of file CTPPSProtonProducer.cc.

Referenced by produce().

◆ ppsAssociationCutsLabel_

const std::string CTPPSProtonProducer::ppsAssociationCutsLabel_
private

Definition at line 63 of file CTPPSProtonProducer.cc.

◆ ppsAssociationCutsToken_

const edm::ESGetToken<PPSAssociationCuts, PPSAssociationCutsRcd> CTPPSProtonProducer::ppsAssociationCutsToken_
private

Definition at line 89 of file CTPPSProtonProducer.cc.

Referenced by produce().

◆ singleRPReconstructionLabel_

std::string CTPPSProtonProducer::singleRPReconstructionLabel_
private

Definition at line 71 of file CTPPSProtonProducer.cc.

Referenced by CTPPSProtonProducer(), and produce().

◆ tracksToken_

edm::EDGetTokenT<CTPPSLocalTrackLiteCollection> CTPPSProtonProducer::tracksToken_
private

Definition at line 55 of file CTPPSProtonProducer.cc.

Referenced by produce().

◆ useNewLHCInfo_

const bool CTPPSProtonProducer::useNewLHCInfo_
private

Definition at line 64 of file CTPPSProtonProducer.cc.

Referenced by produce().

◆ verbosity_

unsigned int CTPPSProtonProducer::verbosity_
private

Definition at line 66 of file CTPPSProtonProducer.cc.

Referenced by produce().