Skip to content

Commit

Permalink
Merge pull request #100 from kmcdermo/full-det-tracking
Browse files Browse the repository at this point in the history
Include seedID of cmssw track in cmssw validation; change n^2 cleaning to command line option
  • Loading branch information
osschar authored Aug 25, 2017
2 parents 9ac9458 + c2dd595 commit ed3ddb4
Show file tree
Hide file tree
Showing 21 changed files with 844 additions and 333 deletions.
1 change: 1 addition & 0 deletions Config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace Config

bool useCMSGeom = false;
bool readCmsswSeeds = false;
bool cleanCmsswSeeds = false;
bool readExtRecTracks = false;

bool findSeeds = false;
Expand Down
7 changes: 4 additions & 3 deletions Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ namespace Config
constexpr float cmsSelMinPt = 0.5;

// config on validation
constexpr int nMinFoundHits = 7;
constexpr float minCMSSWMatchChi2 = 50;
constexpr float minCMSSWMatchdPhi = 0.03;
constexpr int nMinFoundHits = 7;
constexpr float minCMSSWMatchChi2[6] = {100,100,50,50,30,20};
constexpr float minCMSSWMatchdPhi[6] = {0.2,0.2,0.1,0.05,0.01,0.005};
constexpr int nCMSSWMatchHitsAfterSeed = 5;
extern bool root_val;
extern bool cmssw_val;
Expand Down Expand Up @@ -262,6 +262,7 @@ namespace Config

extern bool useCMSGeom;
extern bool readCmsswSeeds;
extern bool cleanCmsswSeeds;
extern bool readExtRecTracks;

extern bool endcapTest;
Expand Down
42 changes: 33 additions & 9 deletions Event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ void Event::PrintStats(const TrackVec& trks, TrackExtraVec& trkextras)

for (auto&& trk : trks) {
auto&& extra = trkextras[trk.label()];
extra.setMCTrackIDInfoByLabel(trk, layerHits_, simHitsInfo_);
extra.setMCTrackIDInfoByLabel(trk, layerHits_, simHitsInfo_, simTracks_);
if (extra.mcTrackID() < 0) {
++miss;
} else {
Expand Down Expand Up @@ -459,7 +459,6 @@ void Event::write_out(DataFile &data_file)
// #define DUMP_TRACKS
// #define DUMP_TRACK_HITS
// #define DUMP_LAYER_HITS
// #define CLEAN_SEEDS

void Event::read_in(DataFile &data_file, FILE *in_fp)
{
Expand Down Expand Up @@ -515,10 +514,7 @@ void Event::read_in(DataFile &data_file, FILE *in_fp)
fseek(fp, ns * data_file.f_header.f_sizeof_track, SEEK_CUR);
ns = -ns;
}
#ifdef CLEAN_SEEDS

ns = clean_cms_seedtracks();//operates on seedTracks_; swaps cleaned seeds into seedTracks_; returns number of cleaned seedTracks
#endif

#ifdef DUMP_SEEDS
printf("Read %i seedtracks (neg value means actual reading was skipped)\n", ns);
for (int it = 0; it < ns; it++)
Expand Down Expand Up @@ -775,15 +771,43 @@ int Event::clean_cms_seedtracks()

seedTracks_.swap(cleanSeedTracks);

if (Config::root_val || Config::cmssw_val)
return seedTracks_.size();
}

int Event::clean_cms_seedtracks_badlabel()
{
printf("***\n*** REMOVING SEEDS WITH BAD LABEL. This is a development hack. ***\n***\n");
TrackVec buf; seedTracks_.swap(buf);
std::copy_if(buf.begin(), buf.end(), std::back_inserter(seedTracks_), [](const Track& t){ return t.label() >= 0; });
return seedTracks_.size();
}

int Event::use_seeds_from_cmsswtracks()
{
int ns = seedTracks_.size();

TrackVec cleanSeedTracks;
cleanSeedTracks.reserve(ns);

int i = 0;
for (auto&& cmsswtrack : extRecTracks_)
{
int newlabel = 0;
for (auto&& track : seedTracks_) if (track.label() < 0) track.setLabel(--newlabel);
cleanSeedTracks.emplace_back(seedTracks_[cmsswtrack.label()]);
}

seedTracks_.swap(cleanSeedTracks);

return seedTracks_.size();
}

void Event::relabel_bad_seedtracks()
{
int newlabel = 0;
for (auto&& track : seedTracks_)
{
if (track.label() < 0) track.setLabel(--newlabel);
}
}

//==============================================================================
// DataFile
Expand Down
5 changes: 4 additions & 1 deletion Event.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ class Event
void write_out(DataFile &data_file);
void read_in (DataFile &data_file, FILE *in_fp=0);

int use_seeds_from_cmsswtracks(); //special mode --> use only seeds which generated cmssw reco track
int clean_cms_simtracks();
int clean_cms_seedtracks(); //operates on seedTracks_; returns the number of cleaned seeds
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 print_tracks(const TrackVec& tracks, bool print_hits) const;

const Geometry& geom_;
Expand Down
Loading

0 comments on commit ed3ddb4

Please sign in to comment.