CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
CTPPSProtonReconstructionEfficiencyEstimatorData Class Reference
Inheritance diagram for CTPPSProtonReconstructionEfficiencyEstimatorData:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Classes

struct  ArmData
 

Public Member Functions

 CTPPSProtonReconstructionEfficiencyEstimatorData (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void endJob () override
 

Private Attributes

std::map< unsigned int, ArmDatadata_
 
std::unique_ptr< TF1 > ff_
 
double localAngleXMax_
 
double localAngleXMin_
 
double localAngleYMax_
 
double localAngleYMin_
 
unsigned int n_exp_prot_max_
 
unsigned int n_prep_events_
 
std::vector< double > n_sigmas_
 
std::string opticsLabel_
 
edm::ESWatcher< CTPPSInterpolatedOpticsRcdopticsWatcher_
 
std::string outputFile_
 
bool pixelDiscardBXShiftedTracks_
 
edm::EDGetTokenT< reco::ForwardProtonCollectiontokenRecoProtonsMultiRP_
 
edm::EDGetTokenT< CTPPSLocalTrackLiteCollectiontokenTracks_
 
unsigned int verbosity_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 38 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Constructor & Destructor Documentation

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

Definition at line 214 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

References data_, edm::ParameterSet::getParameter(), n_exp_prot_max_, and n_sigmas_.

216  : tokenTracks_(consumes<CTPPSLocalTrackLiteCollection>(iConfig.getParameter<edm::InputTag>("tagTracks"))),
217 
219  consumes<reco::ForwardProtonCollection>(iConfig.getParameter<InputTag>("tagRecoProtonsMultiRP"))),
220 
221  pixelDiscardBXShiftedTracks_(iConfig.getParameter<bool>("pixelDiscardBXShiftedTracks")),
222 
223  localAngleXMin_(iConfig.getParameter<double>("localAngleXMin")),
224  localAngleXMax_(iConfig.getParameter<double>("localAngleXMax")),
225  localAngleYMin_(iConfig.getParameter<double>("localAngleYMin")),
226  localAngleYMax_(iConfig.getParameter<double>("localAngleYMax")),
227 
228  opticsLabel_(iConfig.getParameter<std::string>("opticsLabel")),
229  n_prep_events_(iConfig.getParameter<unsigned int>("n_prep_events")),
230  n_exp_prot_max_(iConfig.getParameter<unsigned int>("n_exp_prot_max")),
231  n_sigmas_(iConfig.getParameter<std::vector<double>>("n_sigmas")),
232 
233  outputFile_(iConfig.getParameter<string>("outputFile")),
234 
235  verbosity_(iConfig.getUntrackedParameter<unsigned int>("verbosity")),
236 
237  ff_(new TF1("ff", "[0] * exp(- (x-[1])*(x-[1]) / 2 / [2]/[2]) + [4]")) {
238  data_[0].n_exp_prot_max = n_exp_prot_max_;
239  data_[0].n_sigmas = n_sigmas_;
240  data_[0].rpId_N = iConfig.getParameter<unsigned int>("rpId_45_N");
241  data_[0].rpId_F = iConfig.getParameter<unsigned int>("rpId_45_F");
242 
243  data_[1].n_exp_prot_max = n_exp_prot_max_;
244  data_[1].n_sigmas = n_sigmas_;
245  data_[1].rpId_N = iConfig.getParameter<unsigned int>("rpId_56_N");
246  data_[1].rpId_F = iConfig.getParameter<unsigned int>("rpId_56_F");
247 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsMultiRP_

Member Function Documentation

void CTPPSProtonReconstructionEfficiencyEstimatorData::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 288 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

References allShiftedPlanes, CTPPSDetId::arm(), edm::ESWatcher< T >::check(), data_, alignCSCRings::de_x, alignCSCRings::de_y, ff_, edm::EventSetup::get(), edm::Event::getByToken(), mps_fire::i, training_settings::idx, localAngleXMax_, localAngleXMin_, localAngleYMax_, localAngleYMin_, funct::m, match(), mixedPlanes, n_prep_events_, opticsLabel_, opticsWatcher_, AlCaHLTBitMon_ParallelJobs::p, pixelDiscardBXShiftedTracks_, year_2016_postTS2_cff::rpId, tokenRecoProtonsMultiRP_, tokenTracks_, HiIsolationCommonParameters_cff::track, heppy_batch::val, verbosity_, x, and y.

289  {
290  std::ostringstream os;
291 
292  // get conditions
294  iSetup.get<CTPPSInterpolatedOpticsRcd>().get(opticsLabel_, hOpticalFunctions);
295 
296  // check optics change
297  if (opticsWatcher_.check(iSetup)) {
298  data_[0].UpdateOptics(*hOpticalFunctions);
299  data_[1].UpdateOptics(*hOpticalFunctions);
300  }
301 
302  // get input
304  iEvent.getByToken(tokenTracks_, hTracks);
305 
306  Handle<reco::ForwardProtonCollection> hRecoProtonsMultiRP;
307  iEvent.getByToken(tokenRecoProtonsMultiRP_, hRecoProtonsMultiRP);
308 
309  // pre-selection of tracks
310  std::vector<unsigned int> sel_track_idc;
311  for (unsigned int idx = 0; idx < hTracks->size(); ++idx) {
312  const auto &tr = hTracks->at(idx);
313 
314  if (tr.getTx() < localAngleXMin_ || tr.getTx() > localAngleXMax_ || tr.getTy() < localAngleYMin_ ||
315  tr.getTy() > localAngleYMax_)
316  continue;
317 
319  if (tr.getPixelTrackRecoInfo() == CTPPSpixelLocalTrackReconstructionInfo::allShiftedPlanes ||
320  tr.getPixelTrackRecoInfo() == CTPPSpixelLocalTrackReconstructionInfo::mixedPlanes)
321  continue;
322  }
323 
324  sel_track_idc.push_back(idx);
325  }
326 
327  // debug print
328  if (verbosity_ > 1) {
329  os << "* tracks (pre-selected):" << std::endl;
330 
331  for (const auto idx : sel_track_idc) {
332  const auto &tr = hTracks->at(idx);
333  CTPPSDetId rpId(tr.getRPId());
334  unsigned int decRPId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();
335 
336  os << " [" << idx << "] RP=" << decRPId << ", x=" << tr.getX() << ", y=" << tr.getY() << std::endl;
337  }
338 
339  os << "* protons:" << std::endl;
340  for (unsigned int i = 0; i < hRecoProtonsMultiRP->size(); ++i) {
341  const auto &pr = (*hRecoProtonsMultiRP)[i];
342  os << " [" << i << "] track indices: ";
343  for (const auto &trr : pr.contributingLocalTracks())
344  os << trr.key() << ", ";
345  os << std::endl;
346  }
347  }
348 
349  // make de_x and de_y plots
350  map<unsigned int, bool> hasTracksInArm;
351 
352  for (const auto idx_i : sel_track_idc) {
353  const auto &tr_i = hTracks->at(idx_i);
354  CTPPSDetId rpId_i(tr_i.getRPId());
355  unsigned int decRPId_i = rpId_i.arm() * 100 + rpId_i.station() * 10 + rpId_i.rp();
356 
357  for (const auto idx_j : sel_track_idc) {
358  const auto &tr_j = hTracks->at(idx_j);
359  CTPPSDetId rpId_j(tr_j.getRPId());
360  unsigned int decRPId_j = rpId_j.arm() * 100 + rpId_j.station() * 10 + rpId_j.rp();
361 
362  // check whether desired RP combination
363  unsigned int arm = 123;
364  for (const auto &ap : data_) {
365  if (ap.second.rpId_N == decRPId_i && ap.second.rpId_F == decRPId_j)
366  arm = ap.first;
367  }
368 
369  if (arm > 1)
370  continue;
371 
372  // update flag
373  hasTracksInArm[arm] = true;
374 
375  // update plots
376  auto &ad = data_[arm];
377  const double de_x = tr_j.getX() - tr_i.getX();
378  const double de_y = tr_j.getY() - tr_i.getY();
379 
380  if (ad.n_events_with_tracks < n_prep_events_) {
381  ad.h_de_x->Fill(de_x);
382  ad.h_de_y->Fill(de_y);
383  }
384 
385  ad.h2_de_y_vs_de_x->Fill(de_x, de_y);
386  }
387  }
388 
389  // update event counter
390  for (auto &ap : data_) {
391  if (hasTracksInArm[ap.first])
392  ap.second.n_events_with_tracks++;
393  }
394 
395  // if threshold reached do fits
396  for (auto &ap : data_) {
397  auto &ad = ap.second;
398 
399  if (ad.n_events_with_tracks == n_prep_events_) {
400  if (ad.de_x_sigma > 0. && ad.de_y_sigma > 0.)
401  continue;
402 
403  std::vector<std::pair<unsigned int, TH1D *>> m;
404  m.emplace_back(0, ad.h_de_x.get());
405  m.emplace_back(1, ad.h_de_y.get());
406 
407  for (const auto &p : m) {
408  double max_pos = -1E100, max_val = -1.;
409  for (int bi = 1; bi < p.second->GetNbinsX(); ++bi) {
410  const double pos = p.second->GetBinCenter(bi);
411  const double val = p.second->GetBinContent(bi);
412 
413  if (val > max_val) {
414  max_val = val;
415  max_pos = pos;
416  }
417  }
418 
419  const double sig = 0.2;
420 
421  ff_->SetParameters(max_val, max_pos, sig, 0.);
422  p.second->Fit(ff_.get(), "Q", "", max_pos - 3. * sig, max_pos + 3. * sig);
423  p.second->Fit(ff_.get(), "Q", "", max_pos - 3. * sig, max_pos + 3. * sig);
424 
425  if (p.first == 0) {
426  ad.de_x_mean = ff_->GetParameter(1);
427  ad.de_x_sigma = fabs(ff_->GetParameter(2));
428  }
429  if (p.first == 1) {
430  ad.de_y_mean = ff_->GetParameter(1);
431  ad.de_y_sigma = fabs(ff_->GetParameter(2));
432  }
433  }
434 
435  if (verbosity_) {
436  os << "* fitting arm " << ap.first << std::endl
437  << " de_x: mean = " << ad.de_x_mean << ", sigma = " << ad.de_x_sigma << std::endl
438  << " de_y: mean = " << ad.de_y_mean << ", sigma = " << ad.de_y_sigma;
439  }
440  }
441  }
442 
443  // data structures for efficiency analysis
444  struct ArmEventData {
445  std::map<unsigned int, std::set<unsigned int>> matched_track_idc;
446 
447  std::set<unsigned int> reco_proton_idc;
448 
449  std::map<unsigned int, std::set<unsigned int>> matched_track_with_prot_idc, matched_track_without_prot_idc;
450  };
451 
452  std::map<unsigned int, ArmEventData> armEventData;
453 
454  // determine the number of expected protons
455  for (const auto idx_i : sel_track_idc) {
456  const auto &tr_i = hTracks->at(idx_i);
457  CTPPSDetId rpId_i(tr_i.getRPId());
458  unsigned int decRPId_i = rpId_i.arm() * 100 + rpId_i.station() * 10 + rpId_i.rp();
459 
460  for (const auto idx_j : sel_track_idc) {
461  const auto &tr_j = hTracks->at(idx_j);
462  CTPPSDetId rpId_j(tr_j.getRPId());
463  unsigned int decRPId_j = rpId_j.arm() * 100 + rpId_j.station() * 10 + rpId_j.rp();
464 
465  // check whether desired RP combination
466  unsigned int arm = 123;
467  for (const auto &ap : data_) {
468  if (ap.second.rpId_N == decRPId_i && ap.second.rpId_F == decRPId_j)
469  arm = ap.first;
470  }
471 
472  if (arm > 1)
473  continue;
474 
475  // check near-far matching
476  auto &ad = data_[arm];
477  const double de_x = tr_j.getX() - tr_i.getX();
478  const double de_y = tr_j.getY() - tr_i.getY();
479 
480  for (unsigned int nsi = 0; nsi < ad.n_sigmas.size(); ++nsi) {
481  const double n_si = ad.n_sigmas[nsi];
482  const bool match_x = fabs(de_x - ad.de_x_mean) < n_si * ad.de_x_sigma;
483  const bool match_y = fabs(de_y - ad.de_y_mean) < n_si * ad.de_y_sigma;
484  if (match_x && match_y)
485  armEventData[arm].matched_track_idc[nsi].insert(idx_i);
486  }
487  }
488  }
489 
490  // determine the number of reconstructed protons
491  for (unsigned int i = 0; i < hRecoProtonsMultiRP->size(); ++i) {
492  const auto &proton = (*hRecoProtonsMultiRP)[i];
493 
494  CTPPSDetId rpId((*proton.contributingLocalTracks().begin())->getRPId());
495  unsigned int arm = rpId.arm();
496 
497  if (proton.validFit())
498  armEventData[arm].reco_proton_idc.insert(i);
499  }
500 
501  // compare matched tracks with reco protons
502  if (verbosity_ > 1)
503  os << "* cmp matched tracks vs. reco protons" << std::endl;
504 
505  for (auto &ap : armEventData) {
506  auto &ad = data_[ap.first];
507 
508  if (verbosity_ > 1)
509  os << " arm " << ap.first << std::endl;
510 
511  for (unsigned int nsi = 0; nsi < ad.n_sigmas.size(); ++nsi) {
512  if (verbosity_ > 1)
513  os << " nsi = " << nsi << std::endl;
514 
515  for (const auto &tri : ap.second.matched_track_idc[nsi]) {
516  const auto &track = hTracks->at(tri);
517 
518  bool some_proton_matching = false;
519 
520  if (verbosity_ > 1)
521  os << " tri = " << tri << std::endl;
522 
523  for (const auto &pri : ap.second.reco_proton_idc) {
524  const auto &proton = (*hRecoProtonsMultiRP)[pri];
525 
526  bool proton_matching = false;
527 
528  for (const auto &pr_tr : proton.contributingLocalTracks()) {
529  CTPPSDetId rpId(pr_tr->getRPId());
530  unsigned int decRPId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();
531 
532  if (decRPId != ad.rpId_N)
533  continue;
534 
535  const double x = pr_tr->getX();
536  const double y = pr_tr->getY();
537  const double th = 1E-3; // 1 um
538 
539  const bool match = (fabs(x - track.getX()) < th) && (fabs(y - track.getY()) < th);
540 
541  if (verbosity_ > 1)
542  os << " pri = " << pri << ": x_tr = " << track.getX() << ", x_pr = " << x
543  << ", match = " << match << std::endl;
544 
545  if (match) {
546  proton_matching = true;
547  break;
548  }
549  }
550 
551  if (proton_matching) {
552  some_proton_matching = true;
553  break;
554  }
555  }
556 
557  if (verbosity_ > 1)
558  os << " --> some_proton_matching " << some_proton_matching << std::endl;
559 
560  if (some_proton_matching)
561  ap.second.matched_track_with_prot_idc[nsi].insert(tri);
562  else
563  ap.second.matched_track_without_prot_idc[nsi].insert(tri);
564  }
565  }
566  }
567 
568  // debug print
569  if (verbosity_ > 1) {
570  for (auto &ap : armEventData) {
571  auto &ad = data_[ap.first];
572 
573  if (ad.de_x_sigma <= 0. && ad.de_y_sigma <= 0.)
574  continue;
575 
576  os << "* results for arm " << ap.first << std::endl;
577 
578  os << " reco_proton_idc: ";
579  for (const auto &idx : ap.second.reco_proton_idc)
580  os << idx << ", ";
581  os << std::endl;
582 
583  for (unsigned int nsi = 0; nsi < ad.n_sigmas.size(); ++nsi) {
584  os << " n_si = " << ad.n_sigmas[nsi] << std::endl;
585 
586  os << " matched_track_idc: ";
587  for (const auto &idx : ap.second.matched_track_idc[nsi])
588  os << idx << ", ";
589  os << std::endl;
590 
591  os << " matched_track_with_prot_idc: ";
592  for (const auto &idx : ap.second.matched_track_with_prot_idc[nsi])
593  os << idx << ", ";
594  os << std::endl;
595 
596  os << " matched_track_without_prot_idc: ";
597  for (const auto &idx : ap.second.matched_track_without_prot_idc[nsi])
598  os << idx << ", ";
599  os << std::endl;
600  }
601  }
602  }
603 
604  // update efficiency plots
605  for (auto &ap : armEventData) {
606  auto &ad = data_[ap.first];
607 
608  // stop if sigmas not yet determined
609  if (ad.de_x_sigma <= 0. && ad.de_y_sigma <= 0.)
610  continue;
611 
612  // loop over n_sigma choices
613  for (unsigned int nsi = 0; nsi < ad.n_sigmas.size(); ++nsi) {
614  const unsigned int n_exp_prot = ap.second.matched_track_idc[nsi].size();
615  const unsigned int n_rec_prot = ap.second.reco_proton_idc.size();
616 
617  // stop if N(expected protons) out of range
618  if (n_exp_prot < 1 || n_exp_prot > ad.n_exp_prot_max)
619  continue;
620 
621  // update method 1 plots
622  const double eff = double(n_rec_prot) / n_exp_prot;
623 
624  for (unsigned int tri : ap.second.matched_track_idc[nsi]) {
625  const double x_N = hTracks->at(tri).getX();
626  const double xi_N = ad.s_x_to_xi_N->Eval(x_N * 1E-1); // conversion mm to cm
627 
628  ad.effPlots[0][nsi].p_eff1_vs_x_N->Fill(x_N, eff);
629  ad.effPlots[0][nsi].p_eff1_vs_xi_N->Fill(xi_N, eff);
630 
631  ad.effPlots[n_exp_prot][nsi].p_eff1_vs_x_N->Fill(x_N, eff);
632  ad.effPlots[n_exp_prot][nsi].p_eff1_vs_xi_N->Fill(xi_N, eff);
633  }
634 
635  // update method 2 plots
636  for (const auto &tri : ap.second.matched_track_with_prot_idc[nsi]) {
637  const double x_N = hTracks->at(tri).getX();
638  const double xi_N = ad.s_x_to_xi_N->Eval(x_N * 1E-1); // conversion mm to cm
639 
640  ad.effPlots[0][nsi].p_eff2_vs_x_N->Fill(x_N, 1.);
641  ad.effPlots[0][nsi].p_eff2_vs_xi_N->Fill(xi_N, 1.);
642 
643  ad.effPlots[n_exp_prot][nsi].p_eff2_vs_x_N->Fill(x_N, 1.);
644  ad.effPlots[n_exp_prot][nsi].p_eff2_vs_xi_N->Fill(xi_N, 1.);
645  }
646 
647  for (const auto &tri : ap.second.matched_track_without_prot_idc[nsi]) {
648  const double x_N = hTracks->at(tri).getX();
649  const double xi_N = ad.s_x_to_xi_N->Eval(x_N * 1E-1); // conversion mm to cm
650 
651  ad.effPlots[0][nsi].p_eff2_vs_x_N->Fill(x_N, 0.);
652  ad.effPlots[0][nsi].p_eff2_vs_xi_N->Fill(xi_N, 0.);
653 
654  ad.effPlots[n_exp_prot][nsi].p_eff2_vs_x_N->Fill(x_N, 0.);
655  ad.effPlots[n_exp_prot][nsi].p_eff2_vs_xi_N->Fill(xi_N, 0.);
656  }
657  }
658  }
659 
660  if (verbosity_)
661  edm::LogInfo("CTPPSProtonReconstructionEfficiencyEstimatorData") << os.str();
662 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsMultiRP_
uint32_t arm() const
Definition: CTPPSDetId.h:51
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
T get() const
Definition: EventSetup.h:71
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
void CTPPSProtonReconstructionEfficiencyEstimatorData::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 666 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

References data_, DEFINE_FWK_MODULE, and outputFile_.

666  {
667  auto f_out = std::make_unique<TFile>(outputFile_.c_str(), "recreate");
668 
669  for (const auto &ait : data_) {
670  char buf[100];
671  sprintf(buf, "arm %u", ait.first);
672  TDirectory *d_arm = f_out->mkdir(buf);
673  gDirectory = d_arm;
674 
675  ait.second.write();
676  }
677 }
void CTPPSProtonReconstructionEfficiencyEstimatorData::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 251 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), edm::ParameterDescriptionNode::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

251  {
253 
254  desc.add<edm::InputTag>("tagTracks", edm::InputTag())->setComment("input tag for local lite tracks");
255  desc.add<edm::InputTag>("tagRecoProtonsMultiRP", edm::InputTag())->setComment("input tag for multi-RP reco protons");
256 
257  desc.add<bool>("pixelDiscardBXShiftedTracks", false)
258  ->setComment("whether to discard pixel tracks built from BX-shifted planes");
259 
260  desc.add<double>("localAngleXMin", -0.03)->setComment("minimal accepted value of local horizontal angle (rad)");
261  desc.add<double>("localAngleXMax", +0.03)->setComment("maximal accepted value of local horizontal angle (rad)");
262  desc.add<double>("localAngleYMin", -0.04)->setComment("minimal accepted value of local vertical angle (rad)");
263  desc.add<double>("localAngleYMax", +0.04)->setComment("maximal accepted value of local vertical angle (rad)");
264 
265  desc.add<std::string>("opticsLabel", "")->setComment("label of the optics records");
266 
267  desc.add<unsigned int>("n_prep_events", 1000)
268  ->setComment("number of preparatory events (to determine de x and de y window)");
269 
270  desc.add<unsigned int>("n_exp_prot_max", 5)->setComment("maximum number of expected protons per event and per arm");
271 
272  desc.add<std::vector<double>>("n_sigmas", {3., 5., 7.})->setComment("list of n_sigma values");
273 
274  desc.add<unsigned int>("rpId_45_N", 0)->setComment("decimal RP id for 45 near");
275  desc.add<unsigned int>("rpId_45_F", 0)->setComment("decimal RP id for 45 far");
276  desc.add<unsigned int>("rpId_56_N", 0)->setComment("decimal RP id for 56 near");
277  desc.add<unsigned int>("rpId_56_F", 0)->setComment("decimal RP id for 56 far");
278 
279  desc.add<std::string>("outputFile", "output.root")->setComment("output file name");
280 
281  desc.addUntracked<unsigned int>("verbosity", 0)->setComment("verbosity level");
282 
283  descriptions.add("ctppsProtonReconstructionEfficiencyEstimatorData", desc);
284 }
void setComment(std::string const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

std::map<unsigned int, ArmData> CTPPSProtonReconstructionEfficiencyEstimatorData::data_
private
std::unique_ptr<TF1> CTPPSProtonReconstructionEfficiencyEstimatorData::ff_
private

Definition at line 204 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

double CTPPSProtonReconstructionEfficiencyEstimatorData::localAngleXMax_
private

Definition at line 54 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

double CTPPSProtonReconstructionEfficiencyEstimatorData::localAngleXMin_
private

Definition at line 54 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

double CTPPSProtonReconstructionEfficiencyEstimatorData::localAngleYMax_
private

Definition at line 54 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

double CTPPSProtonReconstructionEfficiencyEstimatorData::localAngleYMin_
private

Definition at line 54 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

unsigned int CTPPSProtonReconstructionEfficiencyEstimatorData::n_exp_prot_max_
private
unsigned int CTPPSProtonReconstructionEfficiencyEstimatorData::n_prep_events_
private

Definition at line 58 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

std::vector<double> CTPPSProtonReconstructionEfficiencyEstimatorData::n_sigmas_
private
std::string CTPPSProtonReconstructionEfficiencyEstimatorData::opticsLabel_
private

Definition at line 56 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

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

Definition at line 68 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

std::string CTPPSProtonReconstructionEfficiencyEstimatorData::outputFile_
private

Definition at line 64 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by endJob().

bool CTPPSProtonReconstructionEfficiencyEstimatorData::pixelDiscardBXShiftedTracks_
private

Definition at line 52 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

edm::EDGetTokenT<reco::ForwardProtonCollection> CTPPSProtonReconstructionEfficiencyEstimatorData::tokenRecoProtonsMultiRP_
private

Definition at line 50 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

edm::EDGetTokenT<CTPPSLocalTrackLiteCollection> CTPPSProtonReconstructionEfficiencyEstimatorData::tokenTracks_
private

Definition at line 48 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

unsigned int CTPPSProtonReconstructionEfficiencyEstimatorData::verbosity_
private

Definition at line 66 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().