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
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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_
 
edm::ESGetToken< LHCInterpolatedOpticalFunctionsSetCollection, CTPPSInterpolatedOpticsRcdopticsESToken_
 
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
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 37 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Constructor & Destructor Documentation

◆ CTPPSProtonReconstructionEfficiencyEstimatorData()

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

Definition at line 211 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

214  : tokenTracks_(consumes<CTPPSLocalTrackLiteCollection>(iConfig.getParameter<edm::InputTag>("tagTracks"))),
215 
217  consumes<reco::ForwardProtonCollection>(iConfig.getParameter<InputTag>("tagRecoProtonsMultiRP"))),
218 
219  opticsESToken_(esConsumes(ESInputTag("", iConfig.getParameter<std::string>("opticsLabel")))),
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  n_prep_events_(iConfig.getParameter<unsigned int>("n_prep_events")),
229  n_exp_prot_max_(iConfig.getParameter<unsigned int>("n_exp_prot_max")),
230  n_sigmas_(iConfig.getParameter<std::vector<double>>("n_sigmas")),
231 
232  outputFile_(iConfig.getParameter<string>("outputFile")),
233 
234  verbosity_(iConfig.getUntrackedParameter<unsigned int>("verbosity")),
235 
236  ff_(new TF1("ff", "[0] * exp(- (x-[1])*(x-[1]) / 2 / [2]/[2]) + [4]")) {
237  data_[0].n_exp_prot_max = n_exp_prot_max_;
238  data_[0].n_sigmas = n_sigmas_;
239  data_[0].rpId_N = iConfig.getParameter<unsigned int>("rpId_45_N");
240  data_[0].rpId_F = iConfig.getParameter<unsigned int>("rpId_45_F");
241 
242  data_[1].n_exp_prot_max = n_exp_prot_max_;
243  data_[1].n_sigmas = n_sigmas_;
244  data_[1].rpId_N = iConfig.getParameter<unsigned int>("rpId_56_N");
245  data_[1].rpId_F = iConfig.getParameter<unsigned int>("rpId_56_F");

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

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 286 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

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

References allShiftedPlanes, protons_cff::arm, CTPPSDetId::arm(), edm::ESWatcher< T >::check(), data_, alignCSCRings::de_x, alignCSCRings::de_y, protons_cff::decRPId, ff_, edm::EventSetup::getData(), mps_fire::i, heavyIonCSV_trainingSettings::idx, iEvent, localAngleXMax_, localAngleXMin_, localAngleYMax_, localAngleYMin_, visualization-live-secondInstance_cfg::m, match(), mixedPlanes, n_prep_events_, OpticalFunctionsConfig_cfi::opticalFunctions, opticsESToken_, opticsWatcher_, AlCaHLTBitMon_ParallelJobs::p, pixelDiscardBXShiftedTracks_, profile_2016_postTS2_cff::rpId, tokenRecoProtonsMultiRP_, tokenTracks_, HLT_FULL_cff::track, heppy_batch::val, verbosity_, x, and y.

◆ endJob()

void CTPPSProtonReconstructionEfficiencyEstimatorData::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 663 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

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

References visDQMUpload::buf, data_, and outputFile_.

◆ fillDescriptions()

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

Definition at line 249 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

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

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, HLT_FULL_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

Member Data Documentation

◆ data_

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

◆ ff_

std::unique_ptr<TF1> CTPPSProtonReconstructionEfficiencyEstimatorData::ff_
private

Definition at line 204 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

◆ localAngleXMax_

double CTPPSProtonReconstructionEfficiencyEstimatorData::localAngleXMax_
private

Definition at line 56 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

◆ localAngleXMin_

double CTPPSProtonReconstructionEfficiencyEstimatorData::localAngleXMin_
private

Definition at line 56 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

◆ localAngleYMax_

double CTPPSProtonReconstructionEfficiencyEstimatorData::localAngleYMax_
private

Definition at line 56 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

◆ localAngleYMin_

double CTPPSProtonReconstructionEfficiencyEstimatorData::localAngleYMin_
private

Definition at line 56 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

◆ n_exp_prot_max_

unsigned int CTPPSProtonReconstructionEfficiencyEstimatorData::n_exp_prot_max_
private

◆ n_prep_events_

unsigned int CTPPSProtonReconstructionEfficiencyEstimatorData::n_prep_events_
private

Definition at line 58 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

◆ n_sigmas_

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

◆ opticsESToken_

edm::ESGetToken<LHCInterpolatedOpticalFunctionsSetCollection, CTPPSInterpolatedOpticsRcd> CTPPSProtonReconstructionEfficiencyEstimatorData::opticsESToken_
private

Definition at line 52 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

◆ opticsWatcher_

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

Definition at line 68 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

◆ outputFile_

std::string CTPPSProtonReconstructionEfficiencyEstimatorData::outputFile_
private

Definition at line 64 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by endJob().

◆ pixelDiscardBXShiftedTracks_

bool CTPPSProtonReconstructionEfficiencyEstimatorData::pixelDiscardBXShiftedTracks_
private

Definition at line 54 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

◆ tokenRecoProtonsMultiRP_

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

Definition at line 51 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

◆ tokenTracks_

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

Definition at line 50 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

◆ verbosity_

unsigned int CTPPSProtonReconstructionEfficiencyEstimatorData::verbosity_
private

Definition at line 66 of file CTPPSProtonReconstructionEfficiencyEstimatorData.cc.

Referenced by analyze().

edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
DDAxes::y
mps_fire.i
i
Definition: mps_fire.py:428
CTPPSProtonReconstructionEfficiencyEstimatorData::tokenRecoProtonsMultiRP_
edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsMultiRP_
Definition: CTPPSProtonReconstructionEfficiencyEstimatorData.cc:51
edm::ESInputTag
Definition: ESInputTag.h:87
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CTPPSProtonReconstructionEfficiencyEstimatorData::data_
std::map< unsigned int, ArmData > data_
Definition: CTPPSProtonReconstructionEfficiencyEstimatorData.cc:202
pos
Definition: PixelAliasList.h:18
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
CTPPSProtonReconstructionEfficiencyEstimatorData::n_sigmas_
std::vector< double > n_sigmas_
Definition: CTPPSProtonReconstructionEfficiencyEstimatorData.cc:62
CTPPSProtonReconstructionEfficiencyEstimatorData::localAngleXMin_
double localAngleXMin_
Definition: CTPPSProtonReconstructionEfficiencyEstimatorData.cc:56
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
DDAxes::x
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
CTPPSProtonReconstructionEfficiencyEstimatorData::tokenTracks_
edm::EDGetTokenT< CTPPSLocalTrackLiteCollection > tokenTracks_
Definition: CTPPSProtonReconstructionEfficiencyEstimatorData.cc:50
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
CTPPSProtonReconstructionEfficiencyEstimatorData::opticsESToken_
edm::ESGetToken< LHCInterpolatedOpticalFunctionsSetCollection, CTPPSInterpolatedOpticsRcd > opticsESToken_
Definition: CTPPSProtonReconstructionEfficiencyEstimatorData.cc:52
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CTPPSDetId::arm
uint32_t arm() const
Definition: CTPPSDetId.h:55
CTPPSpixelLocalTrackReconstructionInfo::mixedPlanes
sipixeldigitoraw
Definition: SiPixelDigiToRaw.cc:39
CTPPSProtonReconstructionEfficiencyEstimatorData::verbosity_
unsigned int verbosity_
Definition: CTPPSProtonReconstructionEfficiencyEstimatorData.cc:66
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
CTPPSDetId
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:31
CTPPSpixelLocalTrackReconstructionInfo::allShiftedPlanes
iEvent
int iEvent
Definition: GenABIO.cc:224
alignCSCRings.de_y
de_y
Definition: alignCSCRings.py:86
CTPPSProtonReconstructionEfficiencyEstimatorData::ff_
std::unique_ptr< TF1 > ff_
Definition: CTPPSProtonReconstructionEfficiencyEstimatorData.cc:204
CTPPSProtonReconstructionEfficiencyEstimatorData::pixelDiscardBXShiftedTracks_
bool pixelDiscardBXShiftedTracks_
Definition: CTPPSProtonReconstructionEfficiencyEstimatorData.cc:54
CTPPSProtonReconstructionEfficiencyEstimatorData::n_prep_events_
unsigned int n_prep_events_
Definition: CTPPSProtonReconstructionEfficiencyEstimatorData.cc:58
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
protons_cff.arm
arm
Definition: protons_cff.py:43
CTPPSProtonReconstructionEfficiencyEstimatorData::localAngleXMax_
double localAngleXMax_
Definition: CTPPSProtonReconstructionEfficiencyEstimatorData.cc:56
profile_2016_postTS2_cff.rpId
rpId
Definition: profile_2016_postTS2_cff.py:21
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
heppy_batch.val
val
Definition: heppy_batch.py:351
CTPPSProtonReconstructionEfficiencyEstimatorData::outputFile_
std::string outputFile_
Definition: CTPPSProtonReconstructionEfficiencyEstimatorData.cc:64
CTPPSProtonReconstructionEfficiencyEstimatorData::localAngleYMax_
double localAngleYMax_
Definition: CTPPSProtonReconstructionEfficiencyEstimatorData.cc:56
alignCSCRings.de_x
de_x
Definition: alignCSCRings.py:85
protons_cff.decRPId
decRPId
Definition: protons_cff.py:60
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDConsumerBase::esConsumes
auto esConsumes()
Definition: EDConsumerBase.h:202
CTPPSProtonReconstructionEfficiencyEstimatorData::n_exp_prot_max_
unsigned int n_exp_prot_max_
Definition: CTPPSProtonReconstructionEfficiencyEstimatorData.cc:60
CTPPSProtonReconstructionEfficiencyEstimatorData::opticsWatcher_
edm::ESWatcher< CTPPSInterpolatedOpticsRcd > opticsWatcher_
Definition: CTPPSProtonReconstructionEfficiencyEstimatorData.cc:68
edm::InputTag
Definition: InputTag.h:15
CTPPSProtonReconstructionEfficiencyEstimatorData::localAngleYMin_
double localAngleYMin_
Definition: CTPPSProtonReconstructionEfficiencyEstimatorData.cc:56
OpticalFunctionsConfig_cfi.opticalFunctions
opticalFunctions
Definition: OpticalFunctionsConfig_cfi.py:16