Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layer processing v2 #129

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions RecoTracker/MkFit/plugins/MkFitGeometryESProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ void MkFitGeometryESProducer::fillShapeAndPlacement(const GeomDet *det,
DetId detid = det->geographicalId();

float xy[4][2];
float dz;
float half_length, dz;
const Bounds *b = &((det->surface()).bounds());

if (const TrapezoidalPlaneBounds *b2 = dynamic_cast<const TrapezoidalPlaneBounds *>(b)) {
Expand All @@ -212,6 +212,7 @@ void MkFitGeometryESProducer::fillShapeAndPlacement(const GeomDet *det,
xy[2][1] = par[3];
xy[3][0] = par[0];
xy[3][1] = -par[3];
half_length = par[3];
dz = par[2];

#ifdef DUMP_MKF_GEO
Expand All @@ -229,6 +230,7 @@ void MkFitGeometryESProducer::fillShapeAndPlacement(const GeomDet *det,
xy[2][1] = dy;
xy[3][0] = dx;
xy[3][1] = -dy;
half_length = dy;
dz = b2->thickness() * 0.5; // half thickness

#ifdef DUMP_MKF_GEO
Expand Down Expand Up @@ -280,7 +282,8 @@ void MkFitGeometryESProducer::fillShapeAndPlacement(const GeomDet *det,
const auto &p = det->position();
auto z = det->rotation().z();
auto x = det->rotation().x();
layer_info.register_module({{p.x(), p.y(), p.z()}, {z.x(), z.y(), z.z()}, {x.x(), x.y(), x.z()}, detid.rawId()});
layer_info.register_module(
{{p.x(), p.y(), p.z()}, {z.x(), z.y(), z.z()}, {x.x(), x.y(), x.z()}, half_length, detid.rawId()});
// Set some layer parameters (repeatedly, would require hard-coding otherwise)
layer_info.set_subdet(detid.subdetId());
layer_info.set_is_pixel(detid.subdetId() <= 2);
Expand Down
23 changes: 15 additions & 8 deletions RecoTracker/MkFitCMS/standalone/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ CMS_DIR := ${SRCDIR}/RecoTracker/MkFitCMS

LIB_CMS := ../libMicCMS.so
MAIN := ../mkFit
MAIN_DEPS := ${LIB_CMS}
MAIN_LIBS := -lMicCore -lMicCMS
WRMEMF := ../writeMemoryFile
WMF_DICT_PCM := ../WriteMemFileDict_rdict.pcm
SHELL_DICT_PCM := ../ShellDict_rdict.pcm
ROOTOUT := WriteMemFileDict.cc ShellDict.cc

TGTS := ${LIB_CMS} ${MAIN}

ifdef WITH_ROOT
MAIN_DEPS += ../libMicRntDump.so
MAIN_LIBS += -lMicRntDump
TGTS += ${WRMEMF} ${WMF_DICT_PCM} ${SHELL_DICT_PCM}
endif

Expand All @@ -21,18 +26,19 @@ endif
all: ${TGTS}

SRCS := $(wildcard ${CMS_DIR}/src/*.cc) $(wildcard ${SACMS}/*.cc)

ifdef WITH_ROOT
SRCS += ${SACMS}/tkNtuple/WriteMemoryFile.cc
WriteMemFileDict.cc: ${SACMS}/tkNtuple/DictsLinkDef.h
WriteMemFileDict.cc ${WMF_DICT_PCM} &: ${SACMS}/tkNtuple/DictsLinkDef.h
rootcling -I=${SRCDIR} -f WriteMemFileDict.cc $<
${WMF_DICT_PCM}: WriteMemFileDict.cc
mv WriteMemFileDict_rdict.pcm ${WMF_DICT_PCM}

SRCS += ShellDict.cc
ShellDict.cc: ${SACMS}/Shell.h ${SACMS}/ShellLinkDef.h
ShellDict.cc ${SHELL_DICT_PCM} &: ${SACMS}/Shell.h ${SACMS}/ShellLinkDef.h
rootcling -I=${SRCDIR} -f ShellDict.cc ${SACMS}/Shell.h ${SACMS}/ShellLinkDef.h
${SHELL_DICT_PCM}: ShellDict.cc
mv ShellDict_rdict.pcm ${SHELL_DICT_PCM}
endif

SRCB := $(notdir ${SRCS})
DEPS := $(SRCB:.cc=.d)
OBJS := $(SRCB:.cc=.o)
Expand Down Expand Up @@ -60,11 +66,11 @@ ${LIB_CMS}: ${CMS_OBJS}
@mkdir -p $(@D)
${CXX} ${CXXFLAGS} ${VEC_HOST} ${CMS_OBJS} -shared -o $@ ${LDFLAGS_HOST} ${LDFLAGS}

${MAIN}: ${LIB_CMS} mkFit.o
${CXX} ${CXXFLAGS} ${VEC_HOST} ${LDFLAGS} mkFit.o -o $@ ${LDFLAGS_HOST} -ltbb -L.. -lMicCore -lMicCMS -Wl,-rpath=.
${MAIN}: ${MAIN_DEPS} mkFit.o
${CXX} ${CXXFLAGS} ${VEC_HOST} ${LDFLAGS} mkFit.o -o $@ ${LDFLAGS_HOST} -ltbb -L.. ${MAIN_LIBS} -Wl,-rpath=.

${WRMEMF}: WriteMemoryFile.o WriteMemFileDict.o
${CXX} ${CXXFLAGS} ${LDFLAGS} $^ -o $@ ${LDFLAGS_HOST} -ltbb -L.. -lMicCore -Wl,-rpath=.
${WRMEMF}: ${MAIN_DEPS} WriteMemoryFile.o WriteMemFileDict.o
${CXX} ${CXXFLAGS} ${LDFLAGS} $^ -o $@ ${LDFLAGS_HOST} -ltbb -L.. ${MAIN_LIBS} -Wl,-rpath=.

${OBJS}: %.o: %.cc %.d
${CXX} ${CPPFLAGS} ${CXXFLAGS} ${VEC_HOST} -c -o $@ $<
Expand All @@ -77,6 +83,7 @@ echo:
@echo SRCS = ${SRCS}
@echo DEPS = ${DEPS}
@echo OBJS = ${OBJS}
@echo MAIN_LIBS = ${MAIN_LIBS}

echo_cc_defs:
${CXX} -dM -E -mavx2 - < /dev/null
Expand Down
2 changes: 1 addition & 1 deletion RecoTracker/MkFitCMS/standalone/MkStandaloneSeqs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ namespace mkfit {

if (mctrk < 0 || static_cast<size_t>(mctrk) >= event->simTracks_.size()) {
++m_cnt_nomc;
dprint("XX bad track idx " << mctrk << ", orig label was " << label);
dprintf("XX bad track idx %d, orig label was %d\n", mctrk, label);
} else {
auto &simtrack = event->simTracks_[mctrk];
pTmc = simtrack.pT();
Expand Down
4 changes: 4 additions & 0 deletions RecoTracker/MkFitCMS/standalone/Shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ namespace mkfit {
s.sortHitsByLayer(); // sort seed hits for the matched hits (I hope it works here)
}

m_event->setCurrentSeedTracks(seeds);

builder.find_tracks_load_seeds(seeds, do_seed_clean);

builder.findTracksCloneEngine();
Expand Down Expand Up @@ -265,6 +267,8 @@ namespace mkfit {

printf("Shell::ProcessEvent post remove-duplicates: %d comb-cands\n", (int) out_tracks.size());

m_event->resetCurrentSeedTracks();

builder.end_event();
}

Expand Down
33 changes: 27 additions & 6 deletions RecoTracker/MkFitCMS/standalone/buildtestMPlex.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,8 @@ namespace mkfit {

const bool validation_on = (Config::sim_val || Config::quality_val);

TrackVec seeds1;
if (validation_on) {
TrackVec seeds1;

unsigned int algorithms[] = {4}; //only initialStep

for (auto const &s : ev.seedTracks_) {
Expand Down Expand Up @@ -187,6 +186,10 @@ namespace mkfit {

// ev.print_tracks(ev.candidateTracks_, true);

if (validation_on) {
ev.seedTracks_.swap(seeds1);
}

return time;
}

Expand All @@ -199,9 +202,8 @@ namespace mkfit {

const bool validation_on = (Config::sim_val || Config::quality_val);

TrackVec seeds1;
if (validation_on) {
TrackVec seeds1;

unsigned int algorithms[] = {4}; //only initialStep

for (auto const &s : ev.seedTracks_) {
Expand All @@ -226,6 +228,8 @@ namespace mkfit {

bool seeds_sorted = false;
// CCCC builder.PrepareSeeds();
ev.setCurrentSeedTracks(ev.seedTracks_);
ev.simLabelForCurrentSeed(0);

builder.find_tracks_load_seeds(ev.seedTracks_, seeds_sorted);

Expand All @@ -248,6 +252,7 @@ namespace mkfit {
check_nan_n_silly_candidates(ev);

// first store candidate tracks
ev.candidateTracks_.clear();
builder.export_best_comb_cands(ev.candidateTracks_);

job.switch_to_backward();
Expand All @@ -272,10 +277,16 @@ namespace mkfit {
StdSeq::root_val(&ev);
}

ev.resetCurrentSeedTracks();

builder.end_event();

// ev.print_tracks(ev.candidateTracks_, true);

if (validation_on) {
ev.seedTracks_.swap(seeds1);
}

return time;
}

Expand All @@ -288,9 +299,8 @@ namespace mkfit {

const bool validation_on = (Config::sim_val || Config::quality_val);

TrackVec seeds1;
if (validation_on) {
TrackVec seeds1;

unsigned int algorithms[] = {4}; //only initialStep

for (auto const &s : ev.seedTracks_) {
Expand All @@ -315,6 +325,7 @@ namespace mkfit {

bool seeds_sorted = false;
// CCCC builder.PrepareSeeds();
ev.setCurrentSeedTracks(ev.seedTracks_);

builder.find_tracks_load_seeds(ev.seedTracks_, seeds_sorted);

Expand All @@ -337,6 +348,7 @@ namespace mkfit {
check_nan_n_silly_candidates(ev);

// first store candidate tracks - needed for BH backward fit and root_validation
ev.candidateTracks_.clear();
builder.export_best_comb_cands(ev.candidateTracks_);

job.switch_to_backward();
Expand Down Expand Up @@ -365,10 +377,16 @@ namespace mkfit {
StdSeq::root_val(&ev);
}

ev.resetCurrentSeedTracks();

builder.end_event();

// ev.print_tracks(ev.candidateTracks_, true);

if (validation_on) {
ev.seedTracks_.swap(seeds1);
}

return time;
}

Expand Down Expand Up @@ -458,6 +476,8 @@ namespace mkfit {
// Add protection in case no seeds are found for iteration
if (seeds.size() <= 0)
continue;
ev.setCurrentSeedTracks(seeds);
ev.simLabelForCurrentSeed(0);

builder.find_tracks_load_seeds(seeds, do_seed_clean);

Expand Down Expand Up @@ -546,6 +566,7 @@ namespace mkfit {

builder.export_tracks(ev.fitTracks_);
}
ev.resetCurrentSeedTracks();

builder.end_event();
}
Expand Down
Loading