CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
TracksterToSimTracksterAssociationHelper Class Reference

Public Member Functions

void clearVariables ()
 
void fillFromEvent (edm::Handle< std::vector< ticl::Trackster >> tracksters_handle, edm::Handle< std::vector< ticl::Trackster >> simTracksters_h, ticl::RecoToSimCollectionSimTracksters const &tsRecoSimSCMap, ticl::SimToRecoCollectionSimTracksters const &tsSimToRecoSCMap)
 
void initTree (TTree *tree, std::string branchPrefix, std::string branchSuffix)
 

Private Attributes

std::vector< std::vector< uint32_t > > recoToSim
 
std::vector< std::vector< float > > recoToSim_score
 
std::vector< std::vector< float > > recoToSim_sharedE
 
std::vector< std::vector< uint32_t > > simToReco
 
std::vector< std::vector< float > > simToReco_score
 
std::vector< std::vector< float > > simToReco_sharedE
 

Detailed Description

Definition at line 482 of file TICLDumper.cc.

Member Function Documentation

◆ clearVariables()

void TracksterToSimTracksterAssociationHelper::clearVariables ( )
inline

Definition at line 498 of file TICLDumper.cc.

References recoToSim, recoToSim_score, recoToSim_sharedE, simToReco, simToReco_score, and simToReco_sharedE.

498  {
499  recoToSim.clear();
500  recoToSim_score.clear();
501  recoToSim_sharedE.clear();
502  simToReco.clear();
503  simToReco_score.clear();
504  simToReco_sharedE.clear();
505  }
std::vector< std::vector< float > > simToReco_score
Definition: TICLDumper.cc:559
std::vector< std::vector< uint32_t > > recoToSim
Definition: TICLDumper.cc:555
std::vector< std::vector< float > > simToReco_sharedE
Definition: TICLDumper.cc:560
std::vector< std::vector< uint32_t > > simToReco
Definition: TICLDumper.cc:558
std::vector< std::vector< float > > recoToSim_sharedE
Definition: TICLDumper.cc:557
std::vector< std::vector< float > > recoToSim_score
Definition: TICLDumper.cc:556

◆ fillFromEvent()

void TracksterToSimTracksterAssociationHelper::fillFromEvent ( edm::Handle< std::vector< ticl::Trackster >>  tracksters_handle,
edm::Handle< std::vector< ticl::Trackster >>  simTracksters_h,
ticl::RecoToSimCollectionSimTracksters const &  tsRecoSimSCMap,
ticl::SimToRecoCollectionSimTracksters const &  tsSimToRecoSCMap 
)
inline

Definition at line 507 of file TICLDumper.cc.

References edm::AssociationMap< Tag >::end(), edm::AssociationMap< Tag >::find(), mps_fire::i, recoToSim, recoToSim_score, recoToSim_sharedE, simToReco, simToReco_score, simToReco_sharedE, and edm::helpers::KeyVal< K, V >::val.

510  {
511  auto const& tracksters = *tracksters_handle;
512  auto const& simTracksters = *simTracksters_h;
513 
514  // Reco -> Sim
515  recoToSim.resize(tracksters.size());
516  recoToSim_score.resize(tracksters.size());
517  recoToSim_sharedE.resize(tracksters.size());
518  for (size_t i = 0; i < tracksters.size(); ++i) {
519  const edm::Ref<ticl::TracksterCollection> tsRef(tracksters_handle, i);
520 
521  const auto stsSC_iter = tsRecoSimSCMap.find(tsRef);
522  if (stsSC_iter != tsRecoSimSCMap.end()) {
523  const auto& stsSCassociated = stsSC_iter->val;
524  for (auto& sts : stsSCassociated) {
525  auto sts_id = (sts.first).get() - (edm::Ref<ticl::TracksterCollection>(simTracksters_h, 0)).get();
526  recoToSim[i].push_back(sts_id);
527  recoToSim_score[i].push_back(sts.second.second);
528  recoToSim_sharedE[i].push_back(sts.second.first);
529  }
530  }
531  }
532 
533  // Sim -> Reco
534  simToReco.resize(simTracksters.size());
535  simToReco_score.resize(simTracksters.size());
536  simToReco_sharedE.resize(simTracksters.size());
537  for (size_t i = 0; i < simTracksters.size(); ++i) {
538  const edm::Ref<ticl::TracksterCollection> stsSCRef(simTracksters_h, i);
539 
540  // STS-SC -> CLUE3D
541  const auto ts_iter = tsSimToRecoSCMap.find(stsSCRef);
542  if (ts_iter != tsSimToRecoSCMap.end()) {
543  const auto& tsAssociated = ts_iter->val;
544  for (auto& ts : tsAssociated) {
545  auto ts_idx = (ts.first).get() - (edm::Ref<ticl::TracksterCollection>(tracksters_handle, 0)).get();
546  simToReco[i].push_back(ts_idx);
547  simToReco_score[i].push_back(ts.second.second);
548  simToReco_sharedE[i].push_back(ts.second.first);
549  }
550  }
551  }
552  }
std::vector< std::vector< float > > simToReco_score
Definition: TICLDumper.cc:559
std::vector< std::vector< uint32_t > > recoToSim
Definition: TICLDumper.cc:555
std::vector< std::vector< float > > simToReco_sharedE
Definition: TICLDumper.cc:560
std::vector< std::vector< uint32_t > > simToReco
Definition: TICLDumper.cc:558
std::vector< std::vector< float > > recoToSim_sharedE
Definition: TICLDumper.cc:557
std::vector< std::vector< float > > recoToSim_score
Definition: TICLDumper.cc:556

◆ initTree()

void TracksterToSimTracksterAssociationHelper::initTree ( TTree *  tree,
std::string  branchPrefix,
std::string  branchSuffix 
)
inline

To be called once after tree creation. Output branches will be named prefix_recoToSim/simToReco_suffix_score/sharedE/ branchPrefix : for example tsCLUE3D. branchSuffix : usually one of SC or CP. Do not copy/move or resize vector holding object after calling this function

Definition at line 489 of file TICLDumper.cc.

References recoToSim, recoToSim_score, recoToSim_sharedE, simToReco, simToReco_score, and simToReco_sharedE.

489  {
490  tree->Branch((branchPrefix + "_recoToSim_" + branchSuffix).c_str(), &recoToSim);
491  tree->Branch((branchPrefix + "_recoToSim_" + branchSuffix + "_score").c_str(), &recoToSim_score);
492  tree->Branch((branchPrefix + "_recoToSim_" + branchSuffix + "_sharedE").c_str(), &recoToSim_sharedE);
493  tree->Branch((branchPrefix + "_simToReco_" + branchSuffix).c_str(), &simToReco);
494  tree->Branch((branchPrefix + "_simToReco_" + branchSuffix + "_score").c_str(), &simToReco_score);
495  tree->Branch((branchPrefix + "_simToReco_" + branchSuffix + "_sharedE").c_str(), &simToReco_sharedE);
496  }
std::vector< std::vector< float > > simToReco_score
Definition: TICLDumper.cc:559
std::vector< std::vector< uint32_t > > recoToSim
Definition: TICLDumper.cc:555
std::vector< std::vector< float > > simToReco_sharedE
Definition: TICLDumper.cc:560
std::vector< std::vector< uint32_t > > simToReco
Definition: TICLDumper.cc:558
std::vector< std::vector< float > > recoToSim_sharedE
Definition: TICLDumper.cc:557
Definition: tree.py:1
std::vector< std::vector< float > > recoToSim_score
Definition: TICLDumper.cc:556

Member Data Documentation

◆ recoToSim

std::vector<std::vector<uint32_t> > TracksterToSimTracksterAssociationHelper::recoToSim
private

Definition at line 555 of file TICLDumper.cc.

Referenced by clearVariables(), fillFromEvent(), and initTree().

◆ recoToSim_score

std::vector<std::vector<float> > TracksterToSimTracksterAssociationHelper::recoToSim_score
private

Definition at line 556 of file TICLDumper.cc.

Referenced by clearVariables(), fillFromEvent(), and initTree().

◆ recoToSim_sharedE

std::vector<std::vector<float> > TracksterToSimTracksterAssociationHelper::recoToSim_sharedE
private

Definition at line 557 of file TICLDumper.cc.

Referenced by clearVariables(), fillFromEvent(), and initTree().

◆ simToReco

std::vector<std::vector<uint32_t> > TracksterToSimTracksterAssociationHelper::simToReco
private

Definition at line 558 of file TICLDumper.cc.

Referenced by clearVariables(), fillFromEvent(), and initTree().

◆ simToReco_score

std::vector<std::vector<float> > TracksterToSimTracksterAssociationHelper::simToReco_score
private

Definition at line 559 of file TICLDumper.cc.

Referenced by clearVariables(), fillFromEvent(), and initTree().

◆ simToReco_sharedE

std::vector<std::vector<float> > TracksterToSimTracksterAssociationHelper::simToReco_sharedE
private

Definition at line 560 of file TICLDumper.cc.

Referenced by clearVariables(), fillFromEvent(), and initTree().