CMS 3D CMS Logo

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

Public Member Functions

void clearVariables ()
 
void fillFromEvent (TracksterToTracksterMap const &recoToSimMap, TracksterToTracksterMap const &simToRecoMap)
 
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 484 of file TICLDumper.cc.

Member Function Documentation

◆ clearVariables()

void TracksterToSimTracksterAssociationHelper::clearVariables ( )
inline

Definition at line 500 of file TICLDumper.cc.

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

500  {
501  recoToSim.clear();
502  recoToSim_score.clear();
503  recoToSim_sharedE.clear();
504  simToReco.clear();
505  simToReco_score.clear();
506  simToReco_sharedE.clear();
507  }
std::vector< std::vector< float > > simToReco_score
Definition: TICLDumper.cc:544
std::vector< std::vector< uint32_t > > recoToSim
Definition: TICLDumper.cc:540
std::vector< std::vector< float > > simToReco_sharedE
Definition: TICLDumper.cc:545
std::vector< std::vector< uint32_t > > simToReco
Definition: TICLDumper.cc:543
std::vector< std::vector< float > > recoToSim_sharedE
Definition: TICLDumper.cc:542
std::vector< std::vector< float > > recoToSim_score
Definition: TICLDumper.cc:541

◆ fillFromEvent()

void TracksterToSimTracksterAssociationHelper::fillFromEvent ( TracksterToTracksterMap const &  recoToSimMap,
TracksterToTracksterMap const &  simToRecoMap 
)
inline

Definition at line 509 of file TICLDumper.cc.

References ticl::AssociationMap< MapType, Collection1, Collection2 >::getMap(), mps_fire::i, recoToSim, recoToSim_score, recoToSim_sharedE, simToReco, simToReco_score, and simToReco_sharedE.

509  {
510  // Reco -> Sim
511  const auto numberOfTracksters = recoToSimMap.getMap().size();
512  recoToSim.resize(numberOfTracksters);
513  recoToSim_score.resize(numberOfTracksters);
514  recoToSim_sharedE.resize(numberOfTracksters);
515 
516  for (size_t i = 0; i < numberOfTracksters; ++i) {
517  for (const auto& [simTracksterIndex, sharedEnergyAndScorePair] : recoToSimMap[i]) {
518  recoToSim[i].push_back(simTracksterIndex);
519  recoToSim_sharedE[i].push_back(sharedEnergyAndScorePair.first);
520  recoToSim_score[i].push_back(sharedEnergyAndScorePair.second);
521  }
522  }
523 
524  // Sim -> Reco
525  const auto numberOfSimTracksters = simToRecoMap.getMap().size();
526  simToReco.resize(numberOfSimTracksters);
527  simToReco_score.resize(numberOfSimTracksters);
528  simToReco_sharedE.resize(numberOfSimTracksters);
529 
530  for (size_t i = 0; i < numberOfSimTracksters; ++i) {
531  for (const auto& [recoTracksterIndex, sharedEnergyAndScorePair] : simToRecoMap[i]) {
532  simToReco[i].push_back(recoTracksterIndex);
533  simToReco_sharedE[i].push_back(sharedEnergyAndScorePair.first);
534  simToReco_score[i].push_back(sharedEnergyAndScorePair.second);
535  }
536  }
537  }
std::vector< std::vector< float > > simToReco_score
Definition: TICLDumper.cc:544
std::vector< std::vector< uint32_t > > recoToSim
Definition: TICLDumper.cc:540
std::vector< std::vector< float > > simToReco_sharedE
Definition: TICLDumper.cc:545
std::vector< std::vector< uint32_t > > simToReco
Definition: TICLDumper.cc:543
std::vector< std::vector< float > > recoToSim_sharedE
Definition: TICLDumper.cc:542
std::vector< std::vector< float > > recoToSim_score
Definition: TICLDumper.cc:541

◆ 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 491 of file TICLDumper.cc.

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

491  {
492  tree->Branch((branchPrefix + "_recoToSim_" + branchSuffix).c_str(), &recoToSim);
493  tree->Branch((branchPrefix + "_recoToSim_" + branchSuffix + "_score").c_str(), &recoToSim_score);
494  tree->Branch((branchPrefix + "_recoToSim_" + branchSuffix + "_sharedE").c_str(), &recoToSim_sharedE);
495  tree->Branch((branchPrefix + "_simToReco_" + branchSuffix).c_str(), &simToReco);
496  tree->Branch((branchPrefix + "_simToReco_" + branchSuffix + "_score").c_str(), &simToReco_score);
497  tree->Branch((branchPrefix + "_simToReco_" + branchSuffix + "_sharedE").c_str(), &simToReco_sharedE);
498  }
std::vector< std::vector< float > > simToReco_score
Definition: TICLDumper.cc:544
std::vector< std::vector< uint32_t > > recoToSim
Definition: TICLDumper.cc:540
std::vector< std::vector< float > > simToReco_sharedE
Definition: TICLDumper.cc:545
std::vector< std::vector< uint32_t > > simToReco
Definition: TICLDumper.cc:543
std::vector< std::vector< float > > recoToSim_sharedE
Definition: TICLDumper.cc:542
Definition: tree.py:1
std::vector< std::vector< float > > recoToSim_score
Definition: TICLDumper.cc:541

Member Data Documentation

◆ recoToSim

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

Definition at line 540 of file TICLDumper.cc.

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

◆ recoToSim_score

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

Definition at line 541 of file TICLDumper.cc.

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

◆ recoToSim_sharedE

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

Definition at line 542 of file TICLDumper.cc.

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

◆ simToReco

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

Definition at line 543 of file TICLDumper.cc.

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

◆ simToReco_score

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

Definition at line 544 of file TICLDumper.cc.

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

◆ simToReco_sharedE

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

Definition at line 545 of file TICLDumper.cc.

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