Skip to content
Snippets Groups Projects
Commit e7b4f0c9 authored by mingf2's avatar mingf2
Browse files

update image in parallel

parent 0feaa065
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# find_package(ROOT 6.22 CONFIG REQUIRED)
find_package(ROOT 6.22 CONFIG REQUIRED COMPONENTS Gui)
find_package(OpenMP REQUIRED)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Headers)
......
......@@ -11,7 +11,7 @@ add_library(gui SHARED gui.cpp)
ROOT_GENERATE_DICTIONARY(G__gui ../Headers/gui.h
LINKDEF ../Headers/guiLinkDef.h
MODULE gui)
target_link_libraries(gui PUBLIC setup ROOT::Gpad ROOT::Gui)
target_link_libraries(gui PUBLIC setup ROOT::Gpad ROOT::Gui OpenMP::OpenMP_CXX)
add_executable(main main.cpp)
target_link_libraries(main PUBLIC setup simulation gui ROOT::Gpad ROOT::Gui)
......
......@@ -189,18 +189,19 @@ void MyMainFrame::addCone(const std::vector<Cone> cones){
// std::cout << "Projecting cones onto the designated spherical surface..."<<std::endl;
double alpha(0);
double beta(0);
for (const Cone& event : cones)
// for (const Cone& event : cones)
for (int k = 0; k < cones.size(); k++)
{
// update the image
//TODO: add the uncertainty
alpha = event.cosHalfAngle;
alpha = cones[k].cosHalfAngle;
#pragma omp parallel for
for (int i = 0; i < config->thetaBins; i++)
{
for (int j = 0; j < config->phiBins; j++)
{
beta = getCosAngle(event.apex - config->xbs[i][j], event.axis);
double beta = getCosAngle(cones[k].apex - config->xbs[i][j], cones[k].axis);
histo->SetBinContent(j+1, i+1, histo->GetBinContent(j+1, i+1) + std::exp(-(beta-alpha)*(beta-alpha) / 0.002));
// histo->SetBinContent(j+1, i+1, std::exp(-(beta-alpha)*(beta-alpha) / 0.002));
}
}
}
......
......@@ -35,7 +35,7 @@ int main(int argc, char** argv) {
// update image
myMainFrame->addCone(cones);
myMainFrame->counts += config->chuckSize;
std::cout << "Total counts: " << myMainFrame->counts << ". " << coneQueue->size_approx() << " events left in queue." << '\n';
std::cout << "Total counts: " << myMainFrame->counts << ". \n";
}
// gSystem->Sleep(100);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment