Skip to content

Commit

Permalink
Merge pull request cms-sw#133 from kmcdermo/cmssw_validation_with_sim…
Browse files Browse the repository at this point in the history
…tracks

Follow up of requests made at f2f: checklist from cms-sw#125
  • Loading branch information
osschar committed Mar 2, 2018
2 parents de28714 + 5d80226 commit 8b6e2c9
Show file tree
Hide file tree
Showing 27 changed files with 1,128 additions and 539 deletions.
6 changes: 4 additions & 2 deletions Config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,15 @@ namespace Config
bool cf_fitting = false;

bool quality_val = false;
bool sim_val_for_cmssw = false;
bool sim_val = false;
bool cmssw_val = false;
bool fit_val = false;
bool readSimTrackStates = false;
bool inclusiveShorts = false;
bool applyCMSSWHitMatch = false;
matchOpts cmsswMatching = hitBased;
bool keepHitInfo = false;
matchOpts cmsswMatchingFW = hitBased;
matchOpts cmsswMatchingBK = trkParamBased;

bool kludgeCmsHitErrors = false;
bool backwardFit = false;
Expand Down
12 changes: 7 additions & 5 deletions Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ struct PropagationFlags

// Enum for input seed options
enum seedOpts {simSeeds, cmsswSeeds, findSeeds};
typedef std::map<std::string,seedOpts> seedOptsMap;
typedef std::map<std::string, std::pair<seedOpts,std::string> > seedOptsMap;

// Enum for seed cleaning options
enum cleanOpts {noCleaning, cleanSeedsN2, cleanSeedsPure, cleanSeedsBadLabel};
typedef std::map<std::string,cleanOpts> cleanOptsMap;
typedef std::map<std::string, std::pair<cleanOpts,std::string> > cleanOptsMap;

// Enum for cmssw matching options
enum matchOpts {trkParamBased, hitBased, labelBased};
typedef std::map<std::string, matchOpts> matchOptsMap;
typedef std::map<std::string, std::pair<matchOpts,std::string> > matchOptsMap;

//------------------------------------------------------------------------------

Expand Down Expand Up @@ -307,13 +307,15 @@ namespace Config
constexpr float minCMSSWMatchdPhi[6] = {0.2,0.2,0.1,0.05,0.01,0.005};
constexpr int nCMSSWMatchHitsAfterSeed = 5;
extern bool quality_val;
extern bool sim_val_for_cmssw;
extern bool sim_val;
extern bool cmssw_val;
extern bool fit_val;
extern bool readSimTrackStates; // need this to fill pulls
extern bool inclusiveShorts;
extern bool applyCMSSWHitMatch;
extern matchOpts cmsswMatching;
extern bool keepHitInfo;
extern matchOpts cmsswMatchingFW;
extern matchOpts cmsswMatchingBK;

// config on seed cleaning
constexpr int minNHits_seedclean = 4;
Expand Down
26 changes: 23 additions & 3 deletions Event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ void Event::Fit()
void Event::Validate()
{
// standard eff/fr/dr validation
if (Config::sim_val) {
if (Config::sim_val || Config::sim_val_for_cmssw) {
validation_.setTrackExtras(*this);
validation_.makeSimTkToRecoTksMaps(*this);
validation_.makeSeedTkToRecoTkMaps(*this);
Expand Down Expand Up @@ -348,7 +348,7 @@ void Event::PrintStats(const TrackVec& trks, TrackExtraVec& trkextras)

for (auto&& trk : trks) {
auto&& extra = trkextras[trk.label()];
extra.setMCTrackIDInfoByLabel(trk, layerHits_, simHitsInfo_, simTracks_);
extra.setMCTrackIDInfo(trk, layerHits_, simHitsInfo_, simTracks_, false, true);
if (extra.mcTrackID() < 0) {
++miss;
} else {
Expand Down Expand Up @@ -710,7 +710,7 @@ int Event::clean_cms_simtracks()

t.sortHitsByLayer();

const int lyr_cnt = t.nUniqueLayers();
const int lyr_cnt = t.nUniqueLayers(false);

//const int lasthit = t.getLastFoundHitPos();
//const float eta = layerHits_[t.getHitLyr(lasthit)][t.getHitIdx(lasthit)].eta();
Expand Down Expand Up @@ -961,6 +961,26 @@ void Event::relabel_bad_seedtracks()
}
}

void Event::relabel_cmsswtracks_from_seeds()
{
std::map<int,int> cmsswLabelMap;
for (int iseed = 0; iseed < seedTracks_.size(); iseed++)
{
for (int icmssw = 0; icmssw < cmsswTracks_.size(); icmssw++)
{
if (cmsswTracks_[icmssw].label() == iseed)
{
cmsswLabelMap[icmssw] = seedTracks_[iseed].label();
break;
}
}
}
for (int icmssw = 0; icmssw < cmsswTracks_.size(); icmssw++)
{
cmsswTracks_[icmssw].setLabel(cmsswLabelMap[icmssw]);
}
}

//==============================================================================
// DataFile
//==============================================================================
Expand Down
1 change: 1 addition & 0 deletions Event.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Event
int clean_cms_seedtracks(); //operates on seedTracks_; returns the number of cleaned seeds
int clean_cms_seedtracks_badlabel(); //operates on seedTracks_, removes those with label == -1;
void relabel_bad_seedtracks();
void relabel_cmsswtracks_from_seeds();
void print_tracks(const TrackVec& tracks, bool print_hits) const;

const Geometry& geom_;
Expand Down
Loading

0 comments on commit 8b6e2c9

Please sign in to comment.