From b08ca0b01250c68e35664564fbc60fa81ecf5a0c Mon Sep 17 00:00:00 2001 From: chchatte92 Date: Thu, 5 Oct 2023 22:11:46 +0200 Subject: [PATCH 1/9] fix shared ptr --- src/test_pixel_gap_cuts.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test_pixel_gap_cuts.cpp b/src/test_pixel_gap_cuts.cpp index 109234b..fecdc17 100644 --- a/src/test_pixel_gap_cuts.cpp +++ b/src/test_pixel_gap_cuts.cpp @@ -45,9 +45,9 @@ int main(int argc, char** argv) { auto compactFile = DETECTOR_PATH + "/" + DETECTOR_CONFIG + ".xml"; auto det = &dd4hep::Detector::getInstance(); det->fromXML(compactFile); - + const dd4hep::rec::CellIDPositionConverter *m_converter; // ReadoutGeo - richgeo::ReadoutGeo geo("DRICH", det, logger); + richgeo::ReadoutGeo geo("DRICH", det, m_converter,logger); // open input file auto reader = podio::ROOTFrameReader(); From a328bf27d1bbd040460a55a61a30b7986b5b7385 Mon Sep 17 00:00:00 2001 From: chchatte92 Date: Thu, 5 Oct 2023 23:10:02 +0200 Subject: [PATCH 2/9] no compilation crash, execution crash not fixed --- src/test_pixel_gap_cuts.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/test_pixel_gap_cuts.cpp b/src/test_pixel_gap_cuts.cpp index fecdc17..6221b22 100644 --- a/src/test_pixel_gap_cuts.cpp +++ b/src/test_pixel_gap_cuts.cpp @@ -9,6 +9,7 @@ #include #include +#include "DDRec/CellIDPositionConverter.h" #include @@ -43,11 +44,12 @@ int main(int argc, char** argv) { return 1; } auto compactFile = DETECTOR_PATH + "/" + DETECTOR_CONFIG + ".xml"; - auto det = &dd4hep::Detector::getInstance(); - det->fromXML(compactFile); - const dd4hep::rec::CellIDPositionConverter *m_converter; + dd4hep::Detector & det = dd4hep::Detector::getInstance(); + det.fromXML(compactFile); + dd4hep::rec::CellIDPositionConverter cellid_converter(det); + // ReadoutGeo - richgeo::ReadoutGeo geo("DRICH", det, m_converter,logger); + richgeo::ReadoutGeo geo("DRICH", gsl::not_null{ &det}, gsl::not_null{ &cellid_converter}, logger); // open input file auto reader = podio::ROOTFrameReader(); @@ -61,7 +63,7 @@ int main(int argc, char** argv) { for(unsigned e=0; etrace("EVENT {}", e); auto frame = podio::Frame(reader.readNextEntry(tree_name)); - + fmt::print("here\n"); const auto& hit_assocs = frame.get("DRICHRawHitsAssociations"); if(!hit_assocs.isValid()) throw std::runtime_error("cannot find hit associations"); From c82574f22b4e3ef237497a19e290272d93e057e2 Mon Sep 17 00:00:00 2001 From: Chandradoy Chatterjee Date: Fri, 6 Oct 2023 14:57:21 +0200 Subject: [PATCH 3/9] Update src/test_pixel_gap_cuts.cpp I had it in my local copy, and pushed and old commit yesterday before your suggestions. Co-authored-by: Wouter Deconinck --- src/test_pixel_gap_cuts.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test_pixel_gap_cuts.cpp b/src/test_pixel_gap_cuts.cpp index 6221b22..ee443f5 100644 --- a/src/test_pixel_gap_cuts.cpp +++ b/src/test_pixel_gap_cuts.cpp @@ -49,7 +49,7 @@ int main(int argc, char** argv) { dd4hep::rec::CellIDPositionConverter cellid_converter(det); // ReadoutGeo - richgeo::ReadoutGeo geo("DRICH", gsl::not_null{ &det}, gsl::not_null{ &cellid_converter}, logger); + richgeo::ReadoutGeo geo("DRICH", &det, &cellid_converter, logger); // open input file auto reader = podio::ROOTFrameReader(); From 8f7f0fe62f55a2957dd8599baf634a417eaeb3ee Mon Sep 17 00:00:00 2001 From: Christopher Dilks Date: Fri, 6 Oct 2023 21:27:36 -0400 Subject: [PATCH 4/9] ci: trigger From a5ea71afdf18b385525569b81e07fae7296d06bd Mon Sep 17 00:00:00 2001 From: Chandradoy Chatterjee Date: Sat, 7 Oct 2023 12:38:57 +0200 Subject: [PATCH 5/9] Update src/test_pixel_gap_cuts.cpp Accepted. Co-authored-by: Christopher Dilks --- src/test_pixel_gap_cuts.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test_pixel_gap_cuts.cpp b/src/test_pixel_gap_cuts.cpp index ee443f5..ff4cded 100644 --- a/src/test_pixel_gap_cuts.cpp +++ b/src/test_pixel_gap_cuts.cpp @@ -63,7 +63,6 @@ int main(int argc, char** argv) { for(unsigned e=0; etrace("EVENT {}", e); auto frame = podio::Frame(reader.readNextEntry(tree_name)); - fmt::print("here\n"); const auto& hit_assocs = frame.get("DRICHRawHitsAssociations"); if(!hit_assocs.isValid()) throw std::runtime_error("cannot find hit associations"); From ffd9b46d067553712e536f9b3b30ae325f81fd4a Mon Sep 17 00:00:00 2001 From: chchatte92 Date: Tue, 10 Oct 2023 23:51:53 +0200 Subject: [PATCH 6/9] test: incidence angle --- src/test_pixel_gap_cuts.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test_pixel_gap_cuts.cpp b/src/test_pixel_gap_cuts.cpp index ff4cded..2853352 100644 --- a/src/test_pixel_gap_cuts.cpp +++ b/src/test_pixel_gap_cuts.cpp @@ -50,7 +50,7 @@ int main(int argc, char** argv) { // ReadoutGeo richgeo::ReadoutGeo geo("DRICH", &det, &cellid_converter, logger); - + richgeo::IrtGeoDRICH drichGeo(&det, &cellid_converter, logger); // open input file auto reader = podio::ROOTFrameReader(); reader.openFile(root_file_name); @@ -72,6 +72,7 @@ int main(int argc, char** argv) { auto cellID = sim_hit.getCellID(); auto pos = sim_hit.getPosition(); + auto normZ = drichGeo.GetSensorSurface(cellID); dd4hep::Position pos_global(pos.x*dd4hep::mm, pos.y*dd4hep::mm, pos.z*dd4hep::mm); auto pos_local = geo.GetSensorLocalPosition(cellID, pos_global); h->Fill(pos_local.y()/dd4hep::mm, pos_local.x()/dd4hep::mm); From eedcb5aa459c28ca6c689f28fdca6dd149790eb3 Mon Sep 17 00:00:00 2001 From: chchatte92 Date: Wed, 11 Oct 2023 00:03:42 +0200 Subject: [PATCH 7/9] test: incidence angle hist added --- src/test_pixel_gap_cuts.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/test_pixel_gap_cuts.cpp b/src/test_pixel_gap_cuts.cpp index 2853352..e248265 100644 --- a/src/test_pixel_gap_cuts.cpp +++ b/src/test_pixel_gap_cuts.cpp @@ -14,6 +14,7 @@ #include #include +#include int main(int argc, char** argv) { @@ -57,8 +58,9 @@ int main(int argc, char** argv) { const std::string tree_name = "events"; // local hits histogram + double pi = TMath::Pi(); auto h = new TH2D("h","local MC SiPM hits",10000,-15,15,10000,-15,15); - + auto h1 = new TH1D("h1","Photon Incidence angle; rad",1000,-pi,pi); // event loop for(unsigned e=0; etrace("EVENT {}", e); @@ -72,7 +74,12 @@ int main(int argc, char** argv) { auto cellID = sim_hit.getCellID(); auto pos = sim_hit.getPosition(); + auto mom = sim_hit.getMomentum(); + TVector3 p; p.SetX(mom.x); p.SetY(mom.y); p.SetZ(mom.z); auto normZ = drichGeo.GetSensorSurface(cellID); + + double angle = normZ.Dot(p.Unit()); + h1->Fill(angle); dd4hep::Position pos_global(pos.x*dd4hep::mm, pos.y*dd4hep::mm, pos.z*dd4hep::mm); auto pos_local = geo.GetSensorLocalPosition(cellID, pos_global); h->Fill(pos_local.y()/dd4hep::mm, pos_local.x()/dd4hep::mm); @@ -93,8 +100,9 @@ int main(int argc, char** argv) { } gStyle->SetOptStat(0); - auto c = new TCanvas(); - h->Draw(); + auto c = new TCanvas(); c->Divide(2,1); + c->cd(1);h->Draw(); + c->cd(2);h1->Draw(); fmt::print("NUMBER OF DIGITIZED PHOTONS: {}\n", h->GetEntries()); if(interactiveOn) { fmt::print("\n\npress ^C to exit.\n\n"); From cd0356f74da461566519d2ccde40711c3fa012bb Mon Sep 17 00:00:00 2001 From: chchatte92 Date: Wed, 11 Oct 2023 19:28:42 +0200 Subject: [PATCH 8/9] Impinging angle [0,90] degrees --- src/test_pixel_gap_cuts.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/test_pixel_gap_cuts.cpp b/src/test_pixel_gap_cuts.cpp index e248265..6de7627 100644 --- a/src/test_pixel_gap_cuts.cpp +++ b/src/test_pixel_gap_cuts.cpp @@ -60,7 +60,7 @@ int main(int argc, char** argv) { // local hits histogram double pi = TMath::Pi(); auto h = new TH2D("h","local MC SiPM hits",10000,-15,15,10000,-15,15); - auto h1 = new TH1D("h1","Photon Incidence angle; rad",1000,-pi,pi); + auto h1 = new TH1D("h1","Photon Incidence angle; degrees",180,0,90); // event loop for(unsigned e=0; etrace("EVENT {}", e); @@ -78,8 +78,9 @@ int main(int argc, char** argv) { TVector3 p; p.SetX(mom.x); p.SetY(mom.y); p.SetZ(mom.z); auto normZ = drichGeo.GetSensorSurface(cellID); - double angle = normZ.Dot(p.Unit()); - h1->Fill(angle); + double cosAng = (normZ.Unit()).Dot(p.Unit()); + double angle = pi- acos(cosAng); + h1->Fill(angle*(180/pi)); dd4hep::Position pos_global(pos.x*dd4hep::mm, pos.y*dd4hep::mm, pos.z*dd4hep::mm); auto pos_local = geo.GetSensorLocalPosition(cellID, pos_global); h->Fill(pos_local.y()/dd4hep::mm, pos_local.x()/dd4hep::mm); @@ -102,7 +103,7 @@ int main(int argc, char** argv) { gStyle->SetOptStat(0); auto c = new TCanvas(); c->Divide(2,1); c->cd(1);h->Draw(); - c->cd(2);h1->Draw(); + c->cd(2);gPad->SetLogy();h1->Draw(); fmt::print("NUMBER OF DIGITIZED PHOTONS: {}\n", h->GetEntries()); if(interactiveOn) { fmt::print("\n\npress ^C to exit.\n\n"); From 1a2b8ee2e2077d2f8887536132a5b66d79fd5c42 Mon Sep 17 00:00:00 2001 From: chchatte92 Date: Mon, 23 Oct 2023 11:03:24 +0200 Subject: [PATCH 9/9] Wavelength Dependency of angle added --- src/test_pixel_gap_cuts.cpp | 50 +++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 11 deletions(-) diff --git a/src/test_pixel_gap_cuts.cpp b/src/test_pixel_gap_cuts.cpp index 6de7627..0b0a1bf 100644 --- a/src/test_pixel_gap_cuts.cpp +++ b/src/test_pixel_gap_cuts.cpp @@ -5,17 +5,28 @@ #include #include #include -#include +#include "TSystem.h" +#include "TStyle.h" +#include "TRegexp.h" +#include "TCanvas.h" +#include "TApplication.h" +#include "TBox.h" +#include "ROOT/RDataFrame.hxx" + #include #include #include "DDRec/CellIDPositionConverter.h" #include - +#include #include #include +using namespace ROOT; +using namespace ROOT::VecOps; +using namespace edm4hep; + int main(int argc, char** argv) { // args @@ -60,27 +71,41 @@ int main(int argc, char** argv) { // local hits histogram double pi = TMath::Pi(); auto h = new TH2D("h","local MC SiPM hits",10000,-15,15,10000,-15,15); - auto h1 = new TH1D("h1","Photon Incidence angle; degrees",180,0,90); + auto h1 = new TH1D("h1","Photon Incidence angle (filtered ring); degrees",180,0,90); + auto h2 = new TH2D("h2","Photon Incidence angle Vs Lambda(all);#lambda(nm);angle(degrees)",2000,0.,1000.,180,0.,90.); + auto h3 = new TH2D("h3","Photon Incidence angle Vs Lambda(X filtered);#lambda(nm);angle(degrees)",2000,0.,1000.,180,0.,90.); + auto h4 = new TH2D("h4","sim hits; X;Y",4000,-2000,2000,4000,-2000,2000); // event loop for(unsigned e=0; etrace("EVENT {}", e); auto frame = podio::Frame(reader.readNextEntry(tree_name)); const auto& hit_assocs = frame.get("DRICHRawHitsAssociations"); + auto isThrown = [](RVec parts){ + return Filter(parts, [](auto p){ return p.generatorStatus==1; } ); + }; + //if(!isThrown) continue; if(!hit_assocs.isValid()) throw std::runtime_error("cannot find hit associations"); for(const auto& hit_assoc : hit_assocs) { for(const auto& sim_hit : hit_assoc.getSimHits()) { - auto cellID = sim_hit.getCellID(); auto pos = sim_hit.getPosition(); + h4->Fill(pos.x,pos.y); auto mom = sim_hit.getMomentum(); - TVector3 p; p.SetX(mom.x); p.SetY(mom.y); p.SetZ(mom.z); + TVector3 p; p.SetX(mom.x); p.SetY(mom.y); p.SetZ(mom.z); + double Lambda = (1239.8/(p.Mag()*1.0e+9)); auto normZ = drichGeo.GetSensorSurface(cellID); - - double cosAng = (normZ.Unit()).Dot(p.Unit()); - double angle = pi- acos(cosAng); - h1->Fill(angle*(180/pi)); + double cosAng = (normZ.Unit()).Dot(p.Unit()); + double angle = pi- acos(cosAng); + h2->Fill(Lambda,angle*(180/pi)); + if (pos.x> 1180 && pos.x<1260){ + if(pos.y> -45 && pos.y<50){ + h1->Fill(angle*(180/pi)); + } + } + if(pos.x>1500 || pos.x<1000) + h3->Fill(Lambda,angle*(180/pi)); dd4hep::Position pos_global(pos.x*dd4hep::mm, pos.y*dd4hep::mm, pos.z*dd4hep::mm); auto pos_local = geo.GetSensorLocalPosition(cellID, pos_global); h->Fill(pos_local.y()/dd4hep::mm, pos_local.x()/dd4hep::mm); @@ -101,14 +126,17 @@ int main(int argc, char** argv) { } gStyle->SetOptStat(0); - auto c = new TCanvas(); c->Divide(2,1); - c->cd(1);h->Draw(); + auto c = new TCanvas(); c->Divide(2,2); + c->cd(1);h4->Draw(); c->cd(2);gPad->SetLogy();h1->Draw(); + c->cd(3);h2->Draw("colz"); + c->cd(4);h3->Draw("colz"); fmt::print("NUMBER OF DIGITIZED PHOTONS: {}\n", h->GetEntries()); if(interactiveOn) { fmt::print("\n\npress ^C to exit.\n\n"); app->Run(); } else { c->SaveAs("out/pixel_gaps.png"); + c->SaveAs("out/pixel_gaps.root"); } }