From a888624ef7b9ccdd7d576b731df8b5e58e13c5df Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Tue, 15 Oct 2024 19:52:25 +0200 Subject: [PATCH 01/28] First commit to include CRTMatchingUtils --- icaruscode/CRT/CRTUtils/CMakeLists.txt | 2 + icaruscode/CRT/CRTUtils/CRTMatchingUtils.cc | 358 ++++++++++++++++++ icaruscode/CRT/CRTUtils/CRTMatchingUtils.h | 170 +++++++++ .../CRT/CRTUtils/CRTScripts/CMakeLists.txt | 6 + .../CRTScripts/TopCrtCorrectionByTPC.txt | 124 ++++++ icaruscode/CRT/CRTUtils/CRTT0MatchAlg.h | 1 + 6 files changed, 661 insertions(+) create mode 100644 icaruscode/CRT/CRTUtils/CRTMatchingUtils.cc create mode 100644 icaruscode/CRT/CRTUtils/CRTMatchingUtils.h create mode 100644 icaruscode/CRT/CRTUtils/CRTScripts/CMakeLists.txt create mode 100644 icaruscode/CRT/CRTUtils/CRTScripts/TopCrtCorrectionByTPC.txt diff --git a/icaruscode/CRT/CRTUtils/CMakeLists.txt b/icaruscode/CRT/CRTUtils/CMakeLists.txt index e726513b2..fe1281251 100644 --- a/icaruscode/CRT/CRTUtils/CMakeLists.txt +++ b/icaruscode/CRT/CRTUtils/CMakeLists.txt @@ -46,3 +46,5 @@ art_make_library(LIBRARY_NAME icaruscode_CRTUtils install_headers() install_fhicl() install_source() + +add_subdirectory(CRTScripts) \ No newline at end of file diff --git a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cc b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cc new file mode 100644 index 000000000..5d858e0e8 --- /dev/null +++ b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cc @@ -0,0 +1,358 @@ +/////////////////////////////////////////////// +// CRTMatchingUtils.h +// +// Functions for CRT matching +// Francesco Poppi (poppi@bo.infn.it), October 2024 +/////////////////////////////////////////////// + +#include "icaruscode/CRT/CRTUtils/CRTMatchingUtils.h" + +using namespace icarus::crt::matchingutils; + +Direction PCAfit (std::vector x, std::vector y, std::vector z) +{ + int min=0; + int max=x.size(); + int size=max-min; + double xavg=0, yavg=0, zavg=0; + for(int k=min; kmax_eval){ + max_eval = this_eval[k][k]; + maxevalpos = k; + }//end if(this_eval[k][k]>max_eval) + }//end loop looking for best eval + + Direction thDirection= {this_evec[0][maxevalpos] , this_evec[1][maxevalpos], this_evec[2][maxevalpos], xavg, yavg, zavg}; + return thDirection; +} + +CrtPlane DeterminePlane(sbn::crt::CRTHit CRThit) +{ + int Plane; + double Pos; + if(CRThit.plane==30) { + Plane=0; + Pos=CRThit.y_pos; + } + else if(CRThit.plane==31 || CRThit.plane== 32 || CRThit.plane==40 || CRThit.plane==41 || CRThit.plane==42 || CRThit.plane==43 || CRThit.plane==44 || CRThit.plane==45) { + Plane=1; + Pos=CRThit.x_pos; + } + else { + Plane=2; + Pos=CRThit.z_pos; + } + return std::make_pair(Plane, Pos); +} + +CrossPoint CalculateProjection(double& dirx, double& diry, double& dirz, double& x0, double& y0, double& z0, double position) +{ + double Lambda = (position-x0)/dirx; + double PosAtY = (Lambda*diry+y0); + double PosAtZ = (Lambda*dirz+z0); + + CrossPoint CrossingPoint = {position, PosAtY, PosAtZ}; + return CrossingPoint; +} + +CrossPoint DetermineProjection(Direction thisDir, int plane, double position) +{ + CrossPoint CrossingPoint; + if(plane==0) // Plane at Y e.g. Top CRT Horizontal Plane + { + CrossPoint thisCase=CalculateProjection(thisDir.diry, thisDir.dirx, thisDir.dirz, thisDir.meany, thisDir.meanx, thisDir.meanz, position); + CrossingPoint={thisCase.Y, thisCase.X, thisCase.Z}; + } + else if (plane==1) // Plane at X e.g. Side CRT West, East, Top CRT Vertical Rim West and East + { + CrossPoint thisCase=CalculateProjection(thisDir.dirx, thisDir.diry, thisDir.dirz, thisDir.meanx, thisDir.meany, thisDir.meanz, position); + CrossingPoint={thisCase.X, thisCase.Y, thisCase.Z}; + } + else if (plane==2) // Plane at Z e.g. Side CRT South, North, Top CRT Vertical Rime South and North + { + CrossPoint thisCase=CalculateProjection(thisDir.dirz, thisDir.diry, thisDir.dirx, thisDir.meanz, thisDir.meany, thisDir.meanx, position); + CrossingPoint={thisCase.Z, thisCase.Y, thisCase.X}; + } + return CrossingPoint; +} + +TrackBarycenter GetTrackBarycenter (std::vector hx, std::vector hy, std::vector hz, std::vector hw) +{ + float average_x_charge=0, average_y_charge=0, average_z_charge=0, total_charge=0; + bool isGood; + for (unsigned i = 0; i < hz.size(); i++) { + if(isnan(hz[i])) continue; + + if(hz[i]>-1000 && hz[i]<1000){ + average_z_charge+=hz[i]*hw[i]; + average_y_charge+=hy[i]*hw[i]; + average_x_charge+=hx[i]*hw[i]; + total_charge+=hw[i]; + } + } + average_z_charge=average_z_charge/total_charge; + average_y_charge=average_y_charge/total_charge; + average_x_charge=average_x_charge/total_charge; + if(total_charge==0) isGood=false; + else isGood=true; + TrackBarycenter ThisTrackBary = {average_x_charge, average_y_charge, average_z_charge, isGood}; + return ThisTrackBary; +} + +DriftedTrack DriftTrack(const std::vector>& trkHits, const std::vector& trkHitMetas, const geo::GeometryCore *GeometryService, detinfo::DetectorPropertiesData const& detProp, double time, int cryo, const recob::Track& tpcTrack){ + int outBound=0; + std::vector recX, recY, recZ, recI; + //double avgDisplacement=0, startX=0, endX=0, driftedStartX=0, driftedEndX=0; + for(size_t i=0; iIndex()); + const geo::TPCGeo& tpcGeo = GeometryService->TPC(trkHits[i]->WireID()); + int tpc=trkHits[i]->WireID().TPC; + double vDrift=detProp.DriftVelocity(); + double recoX=(trkHits[i]->PeakTime()-850-time/tics)*tics*vDrift; + double plane=tpcGeo.FirstPlane().GetCenter().X(); + double X=plane-tpcGeo.DetectDriftDirection()*recoX; + //double displacement= X-loc.X(); + if(cryo==0 && (tpc==0 || tpc==1) && (X>(cathE+exc)||X<(plane-exc))) outBound++; + else if(cryo==0 && (tpc==2 || tpc==3)&& (X<(cathE-exc)||X>(plane+exc))) outBound++; + else if(cryo==1 && (tpc==0 || tpc==1)&& (X>(cathW+exc)||X<(plane-exc))) outBound++; + else if(cryo==1 && (tpc==2 || tpc==3)&& (X<(cathW-exc)||X>(plane+exc))) outBound++; + recX.push_back(X); + recY.push_back(loc.Y()); + recZ.push_back(loc.Z()); + recI.push_back(trkHits[i]->Integral()); + //avgDisplacement +=displacement; + } + //avgDisplacement=avgDisplacement/trkHits.size(); + DriftedTrack thisDriftedTrack = {recX, recY, recZ, recI, outBound}; + return thisDriftedTrack; +} + +TopCRTCentersMap LoadTopCRTCenters() +{ + TopCRTCentersMap TopCRTCenters; + + TopCRTCenters = {{108, { -460.975, 617.388,-1050.61}}, + {109, { -460.975,617.388,-866.215}}, + {110, { -460.975,617.388,-681.825}}, + {111, { -460.975,617.388,-497.435}}, + {112, { -460.975,617.388,-313.045}}, + {113, { -460.975,617.388,-128.655}}, + {114, { -460.975,617.388,55.735}}, + {115, { -460.975,617.388,240.125}}, + {116, { -460.975,617.388,424.515}}, + {117, { -460.975,617.388,608.905}}, + {118, { -460.975,617.388,793.295}}, + {119, { -460.975,617.388,977.685}}, + {120, { -460.975,617.388,1162.07}}, + {121, { -460.975,617.388,1346.46}}, + {122, { -276.585,617.388,-1050.61}}, + {123, { -276.585,617.388,-866.215}}, + {124, { -276.585,617.388,-681.825}}, + {125, { -276.585,617.388,-497.435}}, + {126, { -276.585,617.388,-313.045}}, + {127, { -276.585,617.388,-128.655}}, + {128, { -276.585,617.388, 55.735}}, + {129, { -276.585,617.388, 240.125}}, + {130, { -276.585,617.388, 424.515}}, + {131, { -276.585,617.388, 608.905}}, + {132, { -276.585,617.388, 793.295}}, + {133, { -276.585,617.388, 977.685}}, + {134, { -276.585,617.388, 1162.07}}, + {135, { -276.585,617.388, 1346.46}}, + {136, { -92.195 ,617.388,-1050.61}}, + {137, { -92.195 ,617.388,-866.215}}, + {138, { -92.195 ,617.388,-681.825}}, + {139, { -92.195 ,617.388,-497.435}}, + {140, { -92.195 ,617.388,-313.045}}, + {141, { -92.195 ,617.388,-128.655}}, + {142, { -92.195 ,617.388, 55.735}}, + {143, { -92.195 ,617.388, 240.125}}, + {144, { -92.195 ,617.388, 424.515}}, + {145, { -92.195 ,617.388, 608.905}}, + {146, { -92.195 ,617.388, 793.295}}, + {147, { -92.195 ,617.388, 977.685}}, + {148, { -92.195 ,617.388, 1162.07}}, + {149, { -92.195 ,617.388, 1346.46}}, + {150, { 92.195 , 617.388, -1050.61}}, + {151, { 92.195 , 617.388, -866.215}}, + {152, { 92.195 , 617.388, -681.825}}, + {153, { 92.195 , 617.388, -497.435}}, + {154, { 92.195 , 617.388, -313.045}}, + {155, { 92.195 , 617.388, -128.655}}, + {156, { 92.195 ,617.388, 55.735}}, + {157, { 92.195 ,617.388, 240.125}}, + {158, { 92.195 ,617.388, 424.515}}, + {159, { 92.195 ,617.388, 608.905}}, + {160, { 92.195 ,617.388, 793.295}}, + {161, { 92.195 ,617.388, 977.685}}, + {162, { 92.195 ,617.388, 1162.07}}, + {163, { 92.195 ,617.388, 1346.46}}, + {164, { 276.585,617.388, -1050.61}}, + {165, { 276.585,617.388, -866.215}}, + {166, { 276.585,617.388, -681.825}}, + {167, { 276.585,617.388, -497.435}}, + {168, { 276.585,617.388, -313.045}}, + {169, { 276.585,617.388, -128.655}}, + {170, { 276.585,617.388, 55.735}}, + {171, { 276.585,617.388, 240.125}}, + {172, { 276.585,617.388, 424.515}}, + {173, { 276.585,617.388, 608.905}}, + {174, { 276.585,617.388, 793.295}}, + {175, { 276.585,617.388, 977.685}}, + {176, { 276.585,617.388, 1162.07}}, + {177, { 276.585,617.388, 1346.46}}, + {178, { 460.975,617.388, -1050.61}}, + {179, { 460.975,617.388, -866.215}}, + {180, { 460.975,617.388, -681.825}}, + {181, { 460.975,617.388, -497.435}}, + {182, { 460.975,617.388, -313.045}}, + {183, { 460.975,617.388, -128.655}}, + {184, { 460.975,617.388, 55.735}}, + {185, { 460.975,617.388, 240.125}}, + {186, { 460.975,617.388, 424.515}}, + {187, { 460.975,617.388, 608.905}}, + {188, { 460.975,617.388, 793.295}}, + {189, { 460.975,617.388, 977.685}}, + {190, { 460.975,617.388, 1162.07}}, + {191, { 460.975,617.388, 1346.46}}, + {192, { 555.265, 496.038, -1050.61}}, + {193, { 555.265, 496.038, -866.215}}, + {194, { 555.265, 496.038, -681.825}}, + {195, { 555.265, 496.038, -497.435}}, + {196, { 555.265, 496.038, -313.045}}, + {197, { 555.265, 496.038, -128.655}}, + {198, { 555.265, 496.038, 55.735}}, + {199, { 555.265, 496.038, 240.125}}, + {200, { 555.265, 496.038, 424.515}}, + {201, { 555.265, 496.038, 608.905}}, + {202, { 555.265, 496.038, 793.295}}, + {203, { 555.265, 496.038, 977.685}}, + {204, { 555.265, 496.038, 1162.07}}, + {205, { 555.265, 496.038, 1346.46}}, + {206, { -555.265, 496.038, -1050.61}}, + {207, { -555.265, 496.038, -866.215}}, + {208, { -555.265, 496.038, -681.825}}, + {209, { -555.265, 496.038, -497.435}}, + {210, { -555.265, 496.038, -313.045}}, + {211, { -555.265, 496.038, -128.655}}, + {212, { -555.265, 496.038, 55.735}}, + {213, { -555.265, 496.038, 240.125}}, + {214, { -555.265, 496.038, 424.515}}, + {215, { -555.265, 496.038, 608.905}}, + {216, { -555.265, 496.038, 793.295}}, + {217, { -555.265, 496.038, 977.685}}, + {218, { -555.265, 496.038, 1162.07}}, + {219, { -555.265, 496.038, 1346.46}}, + {220, { -460.975, 496.038, -1143.4}}, + {221, { -276.585, 496.038, -1143.4}}, + {222, { -92.195, 496.038, -1143.4}}, + {223, { 92.195, 496.038, -1143.4}}, + {224, { 276.585, 496.038, -1143.4}}, + {225, { 0, 0, 0}}, + {226, { -460.975, 525.038, 1533.608}}, + {227, { -276.585, 525.038, 1533.608}}, + {228, { -92.195, 525.038, 1533.608}}, + {229, { 92.195, 525.038, 1533.608}}, + {230, { 276.585, 525.038, 1533.608}}, + {231, { 460.975, 525.038, 1533.608}}}; + return TopCRTCenters; +} + +TransformedCrtHit AffineTransformation(double DX, double DZ,AffineTrans affine) +{ + double CRTX=affine.B1+DZ*affine.A12+DX*affine.A11; + double CRTZ=affine.B2+DZ*affine.A22+DX*affine.A21; + return std::make_pair(CRTX, CRTZ); +} + +TopCrtTransformations LoadTopCrtTransformations() +{ + std::string fullFileName; + cet::search_path searchPath("FW_SEARCH_PATH"); + searchPath.find_file("TopCrtCorrectionByTPC.txt",fullFileName); + std::ifstream corrFile.open(fullFileName,std::ios::in); + + std::map Type0Corr; + std::map Type1Corr; + std::map Type2Corr; + std::map Type3Corr; + std::map Type4Corr; + std::map Type5Corr; + + if (!corrFile.is_open()) { + mf::LogError("CRTMatchingUtils_LoadTopCrtTransformation") << "Top CRT Correction transformation file not found."; + } + std::string line; + while (std::getline(corrFile, line)) { + std::istringstream iss(line); + std::vector variables; + double var; + while (iss >> var) { + variables.push_back(var); + } + + int pos=0; + + AffineTrans Type0 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; + pos=pos+8; + AffineTrans Type1 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; + pos=pos+8; + AffineTrans Type2 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; + pos=pos+8; + AffineTrans Type3 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; + pos=pos+8; + AffineTrans Type4 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; + pos=pos+8; + AffineTrans Type5 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; + Type0Corr.insert({variables.at(0), Type0}); + Type1Corr.insert({variables.at(0), Type1}); + Type2Corr.insert({variables.at(0), Type2}); + Type3Corr.insert({variables.at(0), Type3}); + Type4Corr.insert({variables.at(0), Type4}); + Type5Corr.insert({variables.at(0), Type5}); + } + TopCrtTransformations LoadedTransformations={Type2Corr, Type1Corr, Type0Corr, Type4Corr, Type5Corr, Type3Corr}; + return LoadedTransformations; +} + + + diff --git a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h new file mode 100644 index 000000000..d9648c66f --- /dev/null +++ b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h @@ -0,0 +1,170 @@ +#ifndef CRTMATCHINGUTILS_H_SEEN +#define CRTMATCHINGUTILS_H_SEEN + +/////////////////////////////////////////////// +// CRTMatchingUtils.h +// +// Functions for CRT matching +// Francesco Poppi (poppi@bo.infn.it), October 2024 +/////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "canvas/Persistency/Common/Ptr.h" +#include "TMatrixD.h" +#include "TMatrixDEigen.h" +#include "TGraph2D.h" + +// LArSoft includes +#include "larcore/CoreUtils/ServiceUtil.h" +#include "larcore/Geometry/Geometry.h" +#include "larcorealg/Geometry/GeometryCore.h" +#include "lardata/DetectorInfoServices/DetectorClocksService.h" +#include "lardata/DetectorInfoServices/DetectorPropertiesService.h" +#include "lardataobj/RecoBase/PFParticle.h" +#include "lardataobj/AnalysisBase/T0.h" +#include "lardataobj/RecoBase/PFParticleMetadata.h" +#include "lardataobj/RecoBase/Hit.h" +#include "lardataobj/RecoBase/Track.h" +#include "lardataobj/RecoBase/TrackHitMeta.h" +#include "larsim/MCCheater/BackTracker.h" +#include "larsim/MCCheater/PhotonBackTracker.h" +#include "larsim/MCCheater/BackTrackerService.h" +#include "larsim/MCCheater/PhotonBackTrackerService.h" +#include "larsim/MCCheater/ParticleInventoryService.h" + +// Data product includes +#include "icaruscode/CRT/CRTUtils/CRTBackTracker.h" +#include "icaruscode/CRT/CRTUtils/CRTCommonUtils.h" +#include "icaruscode/Decode/DataProducts/TriggerConfiguration.h" +#include "larcorealg/CoreUtils/enumerate.h" +#include "lardataobj/RecoBase/OpFlash.h" +#include "lardataobj/RecoBase/OpHit.h" +#include "nusimdata/SimulationBase/MCGeneratorInfo.h" +#include "nusimdata/SimulationBase/MCParticle.h" +#include "nusimdata/SimulationBase/MCTruth.h" +#include "sbnobj/Common/CRT/CRTHit.hh" +#include "sbnobj/Common/CRT/CRTTrack.hh" +#include "sbnobj/Common/Trigger/ExtraTriggerInfo.h" +#include "sbnobj/Common/CRT/CRTPMTMatching.hh" + +// ROOT +#include +#include "TVector3.h" +#include "TGeoManager.h" + +namespace icarus::crt::matchingutils{ + +double const vdrift=0.157; //cm/us +double const tics=0.4; // 0.4 us, 400 ns +double const minLimitW=61.7; // cm Anode WE position +double const maxLimitW=358.73; // cm Anode WW position +double const minLimitE=-61.7; // cm Anode EW position +double const maxLimitE=-358.73; // cm Anode WW position +double const cathW=210; // cm Cathode W position +double const cathE=-210; // cm Cathode E position +double const exc=2; // cm max displacement out of boundaries + +struct CrossPoint +{ + double X; + double Y; + double Z; +}; + +struct TrackBarycenter +{ + float BarX; // Track Barycenter X coordinate + float BarY; // Track Barycenter Y coordinate + float BarZ; // Track Barycenter Z coordinate + bool isGood; // Track Barycenter quality +}; + +struct DriftedTrack +{ + std::vector spx; // Drifted Track Hit Points X coordinate + std::vector spy; // Drifted Track Hit Points Y coordinate + std::vector spz; // Drifted Track Hit Points Z coordinate + std::vector spi; // Drifted Track Hit Points Z coordinate + int outbound; // Number of hit points out of the logical volume of the TPC + //double drifted_startx; // + //double drifted_endx; +}; + +struct Direction +{ + double dirx; // Direction of the Track: X + double diry; // Direction of the Track: Y + double dirz; // Direction of the Track: Z + double meanx; // Mean Point of the Track: X + double meany; // Mean Point of the Track: Y + double meanz; // Mean Point of the Track: Z +}; + +struct ModuleCenter +{ + double X; + double Y; + double Z; +}; + +struct AffineTrans +{ + double A11; + double A12; + double A21; + double A22; + double B1; + double B2; + double Accuracy; + double N; +}; + +typedef int feb_index; + +typedef std::map TopCRTCorrectionMap; + +struct TopCrtTransformations +{ + TopCRTCorrectionMap EE; + TopCRTCorrectionMap EW; + TopCRTCorrectionMap EastCC; + TopCRTCorrectionMap WE; + TopCRTCorrectionMap WW; + TopCRTCorrectionMap WestCC; +}; + +typedef std::map TopCRTCentersMap; + +typedef std::pair CrtPlane; + +typedef std::pair TransformedCrtHit; + +TopCRTCentersMap LoadTopCRTCenters(); + +TransformedCrtHit AffineTransformation(double DX, double DZ,AffineTrans affine); + +TopCrtTransformations LoadTopCrtTransformations(); + +Direction PCAfit (std::vector x, std::vector y, std::vector z); + +CrtPlane DeterminePlane(sbn::crt::CRTHit CRThit); + +CrossPoint CalculateProjection(double&, double&, double&, double&, double&, double&, double); + +CrossPoint DetermineProjection(Direction thisDir, int plane, double position); + +TrackBarycenter GetTrackBarycenter(std::vector hx, std::vector hy, std::vector hz, std::vector hw); + +DriftedTrack DriftTrack(const std::vector>& trkHits, const std::vector& trkHitMetas, const geo::GeometryCore *GeometryService, detinfo::DetectorPropertiesData const& detProp, double time, int cryo, const recob::Track& tpcTrack); + +} + +#endif \ No newline at end of file diff --git a/icaruscode/CRT/CRTUtils/CRTScripts/CMakeLists.txt b/icaruscode/CRT/CRTUtils/CRTScripts/CMakeLists.txt new file mode 100644 index 000000000..d4518735d --- /dev/null +++ b/icaruscode/CRT/CRTUtils/CRTScripts/CMakeLists.txt @@ -0,0 +1,6 @@ +# The txt files here are used to load Top CRT corrections +# They need to be found via FW_SEARCH_PATH + +# install txt files +file(GLOB txt_file *.txt) +install_fw(LIST ${txt_file}) \ No newline at end of file diff --git a/icaruscode/CRT/CRTUtils/CRTScripts/TopCrtCorrectionByTPC.txt b/icaruscode/CRT/CRTUtils/CRTScripts/TopCrtCorrectionByTPC.txt new file mode 100644 index 000000000..658d93d8d --- /dev/null +++ b/icaruscode/CRT/CRTUtils/CRTScripts/TopCrtCorrectionByTPC.txt @@ -0,0 +1,124 @@ +108 0.990014 0.000730912 -0.0014043 1.00462 -456.38 -1044.45 15.6498 7501 0.996656 0.0022811 -0.00120142 1.00549 -462.081 -1045.78 14.7886 9522 1.00028 0.00328549 -0.0108595 1.00281 -460.295 -1043.45 16.1172 11698 0.996 0.00531438 0.00673602 1.01298 -454.049 -1046.78 15.5615 4524 1.0025 0.00713468 7.92409e-05 1.01303 -459.746 -1047.04 15.4166 3832 1.00297 0.0101686 -0.00398481 0.999977 -460.8 -1046.48 15.5258 1685 +109 0.983009 -0.00319798 -0.00193381 0.995038 -456.318 -859.836 15.0985 11833 0.999105 -0.00486906 0.000791451 0.9977 -462.484 -861.065 14.4911 13291 1.00122 -0.00282917 -0.00659032 0.996823 -460.591 -858.552 15.5447 17803 0.992526 -0.00105885 0.00104855 1.00503 -454.277 -861.205 15.4543 6535 0.996221 -0.00214472 0.00328342 0.998416 -459.977 -861.351 15.3887 5082 1.00592 -0.00472139 0.00277481 0.995553 -461.055 -860.994 15.4057 2176 +110 0.98664 -0.00419974 0.00187765 0.995419 -456.675 -675.397 15.1396 16147 1.00356 -0.0060217 0.0023732 0.999963 -463.415 -676.055 14.4197 18729 1.00157 -0.00351885 -0.00170026 0.992458 -460.971 -673.963 15.5062 26175 0.993209 0.00824833 0.000319891 1.00067 -454.414 -676.251 15.4443 8610 0.995668 -0.00178936 -0.00127458 1.00052 -460.518 -676.469 15.3617 6913 0.998333 0.00200041 -0.00419819 1.00278 -461.011 -675.643 15.3284 2645 +111 0.986478 -0.00297429 0.00196846 1.00202 -457.066 -490.441 15.3321 18764 1.00365 -0.00289387 0.000384214 1.00327 -464.265 -490.555 14.4962 22224 1.002 -0.00384269 -0.000809648 0.999536 -461.17 -489.584 15.6602 31610 0.998012 0.000402588 0.00538996 1.00159 -454.295 -490.33 15.5589 10116 1.00628 0.00138257 0.00153961 1.0042 -460.397 -490.337 15.4328 8293 1.00526 -0.000514298 0.00389664 1.00116 -461.505 -489.957 15.7465 3271 +112 0.984232 0.000464379 0.00113379 1.00224 -457.456 -304.999 15.4523 18924 1.00159 -0.00274187 0.00122707 1.00494 -464.707 -305.036 14.5347 22754 0.999822 -0.00367219 -0.00114618 1.00389 -461.639 -304.725 15.6957 32936 0.997188 -0.00314382 0.0064255 1.00863 -454.39 -304.743 15.4314 10532 0.999875 -0.003114 0.0027403 1.00528 -460.99 -305.011 15.1778 8550 1.00221 -0.0057823 -0.000452245 1.00975 -462.001 -304.356 15.1263 3231 +113 0.984793 -0.000117883 -0.000316148 1.0038 -457.99 -119.235 15.4192 19500 1.00337 -0.000950401 0.000862706 1.00597 -465.125 -119.123 14.5422 23521 0.998655 -0.00386865 0.00184487 1.00345 -462.157 -119.4 15.6549 33809 0.993667 -0.00622609 0.00304501 1.00706 -454.925 -118.964 15.4916 11016 1.00295 -0.00190276 0.0034775 1.005 -461.093 -118.999 15.3224 9077 1.00469 -0.000235791 0.00333375 1.00694 -462.305 -118.762 15.3972 3598 +114 0.982728 -0.00186376 0.000535842 1.00776 -458.288 66.5338 15.3622 20405 1.00109 0.000278976 0.00275216 1.00793 -465.219 66.7934 14.4959 24037 1.00104 -0.00210875 0.00287075 1.00369 -462.394 66.3651 15.7899 35371 0.995277 -0.0034344 0.00262087 1.00576 -454.975 66.8368 15.4787 11491 1.00303 -0.000387297 0.00598651 1.00247 -461.354 66.7369 15.335 9114 0.998823 0.00447964 0.00630797 1.00866 -462.225 67.1826 15.4175 3402 +115 0.98468 -0.00318468 0.00339054 1.0022 -458.448 252.22 15.2618 20030 1.00266 1.50043e-06 0.00324502 1.00352 -465.064 252.487 14.5019 23412 1.00459 -0.00199938 0.00401192 1.00343 -462.724 251.787 15.6469 33831 0.997116 0.00111924 0.00272299 1.00716 -455.537 252.513 15.6033 11155 1.00453 0.00174855 0.00230951 1.00405 -461.674 252.86 15.3222 8927 1.00314 0.00154085 0.00395838 1.00501 -463.041 252.679 15.6882 3311 +116 0.979413 -0.00343409 0.00264193 0.999535 -458.735 437.697 15.1775 18820 0.998835 -0.00200936 0.00355982 0.999896 -465.302 438.015 14.4869 21244 0.998627 -0.00173821 0.00252074 0.997824 -463.036 436.828 15.6149 30168 0.995074 -0.00620076 0.000334623 1.00477 -456.06 438.706 15.4307 10156 0.997062 -0.00784742 0.000121464 1.00354 -462.185 438.644 15.3397 7947 1.00149 -0.00212078 0.005705 1.00343 -463.725 438.393 15.7736 3008 +117 0.983625 -0.0022997 0.00538786 0.998778 -459.206 622.779 15.0392 19056 1.00185 0.000478103 0.00578851 1.00145 -465.495 623.418 14.5159 20230 1.00082 -0.00433543 0.00634911 0.995983 -463.383 621.571 15.5847 29845 0.991674 -0.00493849 0.00706322 1.00753 -456.735 624.412 15.5064 9648 1.00421 -0.00253822 0.00198978 1.0071 -462.832 624.303 15.2896 7676 0.995973 -0.0110582 0.00760223 1.00311 -463.82 624.18 15.7025 2861 +118 0.986208 -0.0036094 0.00760776 0.999872 -459.693 807.642 14.9833 14564 1.00066 0.000155828 0.00631594 0.995183 -465.668 808.537 14.5598 15460 1.00009 -0.00301822 0.00585876 1.00049 -463.899 806.248 15.5426 22328 0.996385 5.64608e-06 -0.000613018 1.00142 -456.895 809.841 15.4165 7696 1.0045 -0.00629354 -0.00157716 0.998194 -462.601 809.427 15.3724 6180 1.00428 -0.004484 0.00402954 0.998513 -463.921 809.316 15.8027 2269 +119 0.986233 -0.00340759 0.00312498 1.00221 -460.309 992.858 15.3524 8559 1.00141 -0.00186755 0.00157508 0.997625 -465.807 993.391 14.7066 9838 1.00207 -0.00479362 0.0105424 1.00449 -464.088 991.313 15.7651 12937 0.993052 0.00151572 -0.000198592 1.0009 -456.907 995.242 15.7176 5092 1.00342 -0.0034969 -0.00264682 1.00653 -462.882 994.698 15.47 4059 1.01163 0.000210577 -0.00196825 1.00809 -463.723 994.211 15.6097 1728 +120 0.985162 -0.00158986 0.00796496 1.00102 -460.987 1177.99 15.9966 3844 0.996857 -0.00580752 0.0115647 0.99625 -465.978 1177.65 15.045 5348 1.00021 -0.00453033 0.0196475 0.999507 -464.288 1176.17 16.409 6273 0.992312 -0.00312561 0.00279121 1.00468 -457.383 1180.29 15.8765 3111 1.00802 -0.00673674 0.00530174 1.00976 -463.267 1179.96 15.4844 2442 1.00129 0.000366142 0.0107656 0.996346 -463.739 1179.24 15.7856 1137 +121 0.985386 -0.01291 0.00658073 1.00855 -461.489 1362.23 16.2563 1606 0.993015 -0.00434321 0.0135935 1.00571 -466.094 1362.13 15.1294 2868 0.999825 -0.000273186 0.0349601 1.0108 -464.558 1360.89 16.8788 2878 1.00144 -0.00592024 -0.000224544 0.999512 -458.139 1365.63 16.0131 1684 1.01141 -0.00305484 -0.0057714 1.00802 -463.717 1364.77 15.8319 1346 1.01424 -0.0156981 -0.00703466 1.01486 -463.086 1364.49 15.5921 743 +122 0.975679 -0.00601526 -0.0041326 1.0037 -275.321 -1044.66 15.4742 3015 0.997972 -0.00378345 0.00274135 0.999661 -277.143 -1045.19 14.8303 16469 0.991639 -0.00529727 0.00734774 1.00693 -275.86 -1042.51 16.1259 15189 0.998494 -0.00189074 0.00451502 1.00598 -269.997 -1046.38 15.2249 6845 1.00578 -0.00415132 0.00426865 1.00156 -274.336 -1046.45 15.1842 6946 1.01216 -0.00142921 0.00455804 1.00791 -275.363 -1046.34 15.1026 3397 +123 0.976006 -0.00252076 0.00191148 0.993106 -275.652 -859.583 14.8384 5177 0.99678 -0.00258883 0.0052933 0.997577 -277.735 -860.611 14.526 25405 0.99066 -0.000990363 0.00721225 0.997929 -276.227 -857.812 15.412 25216 0.996601 -0.00692769 0.002854 0.99404 -270.253 -860.798 14.8799 9814 1.00839 -0.00477057 0.00744943 1.00015 -274.73 -860.986 14.9063 9704 1.00925 -0.00646063 0.00493347 1.00001 -275.404 -860.813 14.8239 4420 +124 0.969493 -0.00445316 0.00346963 0.997435 -276.101 -675.326 14.771 7088 0.999465 -0.00459417 0.00143423 0.999929 -278.289 -675.74 14.4432 35704 0.993226 -0.00171109 0.0031185 0.994261 -276.716 -673.691 15.1892 36554 0.996354 -0.000232261 0.00161858 1.00509 -270.403 -675.682 15.0247 12809 1.00329 -0.00318743 0.00250766 1.00346 -274.607 -675.908 14.8743 13054 1.00468 0.000602346 -0.000474069 1.00686 -276.028 -675.346 14.6195 5456 +125 0.970331 -0.0025715 0.003178 1.00332 -276.734 -490.292 14.9541 8404 1.00129 -0.00194114 0.00275098 1.00136 -279.009 -490.303 14.4169 42858 0.991702 -0.00209361 0.00171119 0.995556 -277.093 -489.319 15.3875 45302 0.999395 -0.000800086 -0.00103779 1.00496 -270.979 -489.897 15.0225 15949 1.00376 -0.00442708 0.00267003 1.00364 -275.428 -489.96 14.8136 15936 1.00246 -0.00320477 -5.32704e-05 1.00644 -276.672 -489.461 14.8893 6772 +126 0.96805 -0.0043442 0.00345692 1.00201 -277.003 -304.675 14.9032 7633 1.00102 -0.00390842 0.00380591 1.00254 -279.495 -304.54 14.4938 37848 0.990739 -0.000861207 0.00543834 0.999481 -277.45 -304.343 15.5048 40248 0.993121 -0.00157855 0.00161787 1.0043 -270.854 -304.106 15.0728 14442 1.00214 -0.00316091 0.00078263 1.00524 -275.637 -304.335 14.8635 14231 1.00503 -0.00587045 0.000297452 1.00961 -276.654 -303.674 14.8743 6029 +127 0.972971 0.00044896 -0.00015151 1.00692 -277.458 -118.719 15.0229 8807 1.00138 -0.000304122 0.00144475 1.00539 -279.944 -118.552 14.5006 45324 0.992699 -0.00196772 0.00117152 1.00544 -277.811 -118.718 15.5021 47983 0.993985 0.00079596 0.00185207 1.00292 -271.338 -118.173 14.9422 17461 1.00363 -0.000140558 0.000985879 1.00105 -276.012 -118.394 14.8852 17315 1.00499 0.0011978 0.001834 0.999701 -277.332 -118.053 14.8653 7473 +128 0.968975 -0.00591851 0.00320895 1.00638 -277.635 67.2063 14.9181 8428 1.00493 0.000544958 0.00215173 1.00531 -279.762 67.1964 14.4859 42864 0.993741 -0.00110948 0.00376383 1.00501 -277.936 67.0908 15.5634 44185 1.00289 0.000240032 0.000997435 1.00458 -271.299 67.6753 15.0245 16231 1.00861 -0.00124061 0.00205368 1.00619 -275.945 67.565 14.9872 16357 1.01098 0.00184527 0.00192841 1.00859 -277.193 67.636 14.9869 6995 +129 0.972918 -0.00324406 0.00502318 1.00015 -277.768 253.245 14.8006 8111 1.001 -0.00122717 0.00268162 1.0023 -279.984 253.14 14.5287 40838 0.991869 -0.00330223 0.00458311 1.0006 -278.143 252.739 15.4231 42070 0.99528 -0.000517841 -7.72316e-06 1.00257 -271.695 253.576 14.975 15923 1.00602 -0.000733471 0.00359942 1.00419 -276.408 253.563 14.8877 15498 1.00553 -0.00172064 0.000487773 1.00155 -277.777 253.428 15.0942 6661 +130 0.969208 -0.000898885 0.00299316 1.00194 -278.1 438.722 14.6467 8986 1.00099 -0.00206231 0.0010188 1.0027 -280.323 438.821 14.4858 43171 0.994002 -0.0022627 0.00181627 1.00014 -278.562 437.856 15.3745 43839 0.995515 -0.00869098 0.00256239 1.00631 -272.445 439.518 14.9542 15934 1.00369 -0.00414035 0.00356228 1.0047 -276.965 439.291 14.8421 15925 1.00731 -0.00906376 0.00340564 1.0064 -278.509 439.231 15.0285 6514 +131 0.970512 0.000123771 0.00959196 0.998142 -278.983 624.01 14.7883 7839 1.00452 0.00147965 0.005636 1.00143 -280.878 624.244 14.4574 36836 0.998748 -0.00171581 0.0057531 0.994764 -279.251 622.78 15.1689 37051 0.996961 0.00320484 0.00268335 1.00332 -272.962 625.122 15.012 13883 1.00684 -0.000173216 0.00131646 1.00779 -277.461 625.194 14.8881 13878 1.00681 0.00592129 0.00431751 1.00066 -279.035 624.979 14.8915 5719 +132 0.967692 -0.00245917 0.00487426 0.996356 -279.059 808.586 14.8222 6013 1.00063 -1.98938e-05 0.00199549 0.998369 -280.756 809.449 14.5054 26520 0.993202 0.000366138 0.000274074 0.996285 -279.131 806.991 15.2446 26422 0.997354 0.00200884 -0.00196619 1.00347 -272.769 810.571 14.9869 10232 1.00374 0.00180336 -0.00166599 1.0008 -277.391 810.503 14.9848 9587 1.00742 0.0110028 0.000986733 1.00072 -278.063 810.35 14.8784 4056 +133 0.981026 -0.00182312 0.00435249 0.998992 -279.277 994.086 15.1721 2894 1.00258 0.00348198 0.000557398 0.998649 -280.816 994.096 14.7578 14918 0.996717 0.00349191 0.000958932 0.997576 -279.26 991.698 15.6916 13977 1.00127 0.000647415 -0.00248975 1.00452 -273.196 995.782 14.8995 6358 1.00379 0.000784155 0.00251406 1.00066 -277.648 995.527 14.8775 5924 1.00913 0.00373422 0.00162772 1.00016 -278.004 995.415 15.0871 2800 +134 0.978286 -0.00816234 0.00530528 0.994992 -279.664 1179.34 16.0779 1359 1.00466 -0.00399302 -0.00131884 0.997089 -281.102 1178.49 14.8916 8027 1.0001 -0.00671173 -0.00559172 0.993065 -279.77 1176.8 16.5414 6704 0.998835 0.000421924 0.00578343 1.00949 -272.963 1180.96 15.3926 3590 1.00515 -0.00173609 0.00436062 1.0041 -277.853 1180.85 15.132 3594 1.01043 -0.000628466 -0.00276905 1.01084 -278.283 1179.97 15.3634 2001 +135 0.982617 -0.0219761 0.00685706 1.00046 -280.469 1364.22 15.9051 634 1.00431 -0.0064981 0.00412436 0.994233 -281.569 1363.98 15.2711 4292 0.996185 -0.00413283 -0.0103906 1.00133 -280.244 1363.57 17.011 3248 1.00089 -0.0056123 -0.000795654 0.999805 -273.644 1366.72 15.3286 2052 1.00704 -0.00115775 -0.00303695 0.991502 -277.902 1365.99 15.3729 2207 0.998259 -0.00434233 0.00487334 1.00976 -278.647 1365.53 15.6004 1336 +136 0.979708 -0.000947891 0.00037709 1.00044 -95.0563 -1042.8 15.0595 4561 1.00172 -0.00134831 -0.00399869 1.00144 -92.8273 -1044.88 15.3044 14610 0.985795 -0.00447594 0.00174015 1.00835 -93.5063 -1041.48 15.9899 11742 0.992681 -0.000982229 0.00257315 1.00346 -85.2058 -1046.1 14.8452 7689 1.00116 0.000564076 -0.00137125 0.998976 -88.1968 -1046.12 15.1767 11037 1.00799 -0.00347965 0.00414862 0.998575 -88.6767 -1045.63 14.7813 6869 +137 0.974499 -0.0046934 0.00530431 0.997446 -95.4419 -859.021 14.6633 7892 0.99973 -0.00513053 0.00268588 0.998897 -93.214 -860.418 14.9077 24294 0.979721 -0.00505594 0.0078337 0.999633 -94.2461 -857.338 15.1571 20860 0.996734 -0.00374549 0.000732245 1.00044 -86.0721 -861.043 14.5257 12913 1.00633 -0.00594329 -0.00118645 0.998919 -88.9406 -860.865 14.674 16931 1.00543 -0.00177528 0.000568235 1.00217 -89.684 -860.577 14.5242 10336 +138 0.972823 -0.00377733 0.0053396 1.00043 -95.5392 -674.055 14.6422 10910 0.995166 -0.00283807 0.0022052 0.99987 -93.4975 -675.3 14.7677 34629 0.974957 -0.00449145 0.00442439 0.99478 -94.5804 -673.025 15.0736 29739 0.993353 0.00116668 0.000839842 1.00318 -86.2559 -675.276 14.6204 18099 1.00209 -0.00306747 0.000168182 1.00119 -89.0083 -675.524 14.7746 24714 1.00418 -0.00273551 -0.00186688 1.00127 -89.9793 -675.248 14.4519 14606 +139 0.974764 -0.00257338 0.00620316 1.00192 -96.0226 -489.162 14.6636 12098 1.00235 -0.00216705 0.00490178 1.00428 -94.2163 -489.849 14.8706 41190 0.980985 -0.00363978 0.00674071 0.99993 -95.3375 -488.877 15.2234 36156 0.997769 -0.00343361 0.000128577 1.00404 -86.6215 -489.538 14.5622 21329 1.00373 -0.00379227 0.00160566 1.00342 -89.5757 -489.797 14.7514 29142 1.00952 -0.00830103 -0.00038761 1.00477 -90.5297 -489.356 14.6062 16416 +140 0.973958 -0.00326981 0.00551275 1.00606 -96.4426 -303.73 14.7012 12262 1.0042 -0.0011154 0.00332354 1.00154 -94.4901 -304.028 14.8789 42589 0.981189 -0.000234873 0.00222721 1.00016 -95.7307 -303.754 15.3264 37415 0.997293 0.0008827 0.00236471 1.0016 -87.0087 -303.624 14.5543 22412 1.00708 -0.000981796 0.000527758 1.00317 -90.0618 -303.888 14.7584 30015 1.00823 -0.00404466 -0.00034207 1.00289 -91.1154 -303.45 14.4092 17360 +141 0.979274 -0.00419814 0.00219157 1.00093 -96.6145 -118.131 14.6747 12844 1.00495 -0.00368042 0.00262182 1.00362 -94.7517 -118.168 14.9365 45350 0.98103 -0.00219999 0.00258169 1.00504 -95.8427 -118.185 15.4428 39147 0.994292 -0.00045657 0.00272033 1.00434 -87.3382 -117.692 14.6963 23449 1.00765 8.37708e-05 0.000547659 1.00497 -90.3352 -117.833 14.7809 30806 1.00865 -0.00245382 -0.000410549 1.00368 -91.504 -117.452 14.5023 18122 +142 0.974646 -0.00417852 -0.00130941 1.00294 -97.273 67.7991 14.7491 12416 1 -0.00048757 0.00273927 1.00263 -95.1873 67.5648 14.9085 44277 0.978398 -0.00277481 0.000642677 1.00104 -96.4357 67.3589 15.4404 37821 0.995521 -0.00204156 0.00413671 1.00243 -87.3849 67.9561 14.6287 23057 1.00391 -0.000304163 0.00384468 1.00493 -90.5233 67.9231 14.9039 30897 1.00368 -0.00349074 0.00175067 1.00346 -91.5266 68.095 14.6543 17609 +143 0.975515 -0.00433311 0.00216011 1.00046 -97.2036 253.619 14.56 12758 1.0034 -0.00267504 0.00340575 1.00505 -95.0973 253.674 14.8364 42879 0.981185 -0.00281797 -0.000688359 1.00376 -96.2416 253.119 15.3526 36478 0.996777 9.28749e-05 0.00111122 1.0034 -87.7084 254.203 14.625 22190 1.00717 0.000384793 0.00323778 1.00605 -90.8152 253.876 14.7803 29275 1.00813 -0.00228792 0.00200171 1.00438 -91.9711 254.107 14.7198 17218 +144 0.974033 0.000962279 0.00101885 1.00174 -97.7814 438.693 14.8003 12927 1.00031 -0.00128154 0.00424783 1.00418 -95.4578 439.303 14.9263 43213 0.981246 -0.000774299 0.00276416 1.00059 -96.6338 438.219 15.2619 35880 0.995273 -0.00275269 0.00240657 1.00497 -88.1493 439.954 14.5643 21618 1.00495 -0.00313749 0.00111745 1.0041 -91.1401 439.734 14.7834 28460 1.00854 0.000234259 0.000303246 1.00451 -92.2896 439.845 14.5829 16030 +145 0.973326 -0.00272212 0.000682319 0.998384 -98.0764 623.725 14.6039 12044 1.00191 0.000788453 0.00518253 1.00233 -95.6318 625.025 14.8492 38029 0.981449 -0.00189448 0.00151326 0.997511 -96.8565 622.839 15.0883 32174 0.997422 -0.000438084 0.00515657 1.0056 -88.5037 625.785 14.6181 19557 1.00549 -0.00203687 0.00308805 1.00584 -91.3659 625.648 14.6881 25315 1.00583 0.000926123 0.00367362 1.00552 -92.5891 625.548 14.6369 14693 +146 0.976902 -0.00478518 0.000435933 1.00013 -98.526 808.565 14.6747 9179 1.00259 -0.000283623 0.00498058 0.998854 -96.0331 810.463 14.8571 28885 0.985247 0.00114059 0.000240374 0.994977 -96.9597 807.416 15.0766 23870 0.998151 0.00155633 0.0020451 1.00323 -88.6106 811.286 14.5689 15036 1.00717 -0.000490052 0.00224307 1.00193 -91.6819 811.063 14.7133 18954 1.00944 0.00237337 0.0025238 0.998945 -92.5375 811.026 14.4878 11205 +147 0.974362 0.00148061 -0.000412809 0.995515 -98.618 993.416 14.7327 5200 1.00242 -0.0027872 0.0134048 0.996323 -96.0314 995.34 15.1881 16211 0.986696 0.000356065 -0.00227956 0.992875 -96.7017 991.877 15.6383 13076 1.00282 -0.00152806 -0.000600735 0.998146 -89.1795 996.355 14.7026 8906 1.00896 -0.00294386 0.00274981 1.00099 -92.0396 996.129 14.8134 11150 1.00863 0.00155703 0.00185354 0.998254 -92.5489 995.88 14.765 7171 +148 0.974041 -0.00320536 0.00162321 0.997139 -99.303 1177.53 15.1749 2354 0.998495 -0.00443722 0.0133021 0.990066 -96.4124 1179.65 15.6402 7988 0.988302 0.00232014 -0.0104053 0.994171 -96.8327 1176.53 16.6505 6363 1.00092 -0.00314591 -0.00103027 1.00257 -89.2533 1181.96 14.9695 4459 1.00539 -0.00399665 0.00667084 1.00441 -92.29 1181.49 15.1826 5946 1.00803 -0.00166505 0.000961611 1.00882 -92.6366 1181.02 15.0614 4106 +149 0.974757 0.00533844 -0.00831337 0.992255 -99.0769 1361.38 15.6795 1095 0.998769 -0.00178028 0.013598 1.00248 -96.3758 1365.14 15.7948 3797 0.982212 -0.00528492 0.00120767 1.00298 -97.046 1362.66 17.3507 3285 0.997823 0.00298446 0.0136408 1.00156 -89.4451 1367.43 15.3696 2290 1.00583 -0.00219516 -0.000217293 1.00639 -92.3871 1366.95 15.5801 3091 0.996837 0.00636603 0.00232999 1.00185 -92.6314 1365.73 15.4691 2463 +150 0.991701 -0.00378722 0.000863465 0.994548 86.9579 -1043.13 15.2003 7674 0.999875 -0.00264631 0.00262008 1.00166 91.8262 -1044.63 15.1455 11180 0.97933 -0.0126548 0.0029519 1.0105 87.5512 -1040.4 16.7049 5995 0.98616 -0.000941652 0.00239123 1.00547 97.9953 -1046.08 14.8514 4832 1.00162 -0.00447491 0.0106982 1.00072 97.1323 -1045.7 15.5474 17577 0.999826 -0.000374038 0.00335734 0.998738 96.5077 -1044.9 14.7586 14602 +151 0.992687 -0.00277453 0.00520706 0.996175 86.9649 -858.49 14.8805 11000 1.00248 -0.00336252 0.00495675 0.997647 91.8818 -859.917 14.7435 15190 0.971971 -0.0100815 0.00345377 0.988272 86.2748 -856.058 15.8991 8406 0.98912 -0.00528853 -0.00351442 0.999093 97.4768 -861.045 14.4553 7534 1.00468 -0.00531188 0.00797542 1.00182 96.8534 -860.818 14.9015 23008 1.00223 -0.00368826 0.00195016 0.99961 95.9802 -860.141 14.4379 20453 +152 0.991956 -0.00585658 0.00294319 0.998561 86.7792 -673.884 14.9345 14850 1.00276 -0.00267698 0.00520377 1.00015 91.7125 -674.876 14.6715 22404 0.971816 -0.00927086 0.00295738 0.992521 85.8433 -672.621 15.8421 12285 0.990243 0.00125106 0.000469614 1.0012 97.2975 -675.317 14.534 11340 1.00492 -0.000364372 0.00391332 1.00236 96.5754 -675.443 14.9012 34965 1.00692 0.000102926 -0.000488444 1.00304 95.7356 -674.949 14.3695 29430 +153 0.992939 0.0005265 0.00226264 1.00325 86.0668 -488.992 14.9849 13925 0.998088 -0.000975835 0.000582817 1.00429 90.8993 -489.609 14.6157 21660 0.974274 -0.00404513 0.00155275 1.00354 85.3816 -488.68 15.9998 12540 0.986555 -0.00241038 0.000165106 1.00583 96.6761 -489.562 14.518 10841 1.00662 -0.00270293 0.00246763 1.00413 96.0409 -489.689 14.9554 34502 1.00687 -0.00198302 0.0012454 1.00421 95.3707 -489.263 14.4589 29078 +154 0.99204 -0.00248769 0.00205398 1.00528 85.8278 -303.385 14.8832 16063 1.00091 -0.00182442 0.00139931 1.00651 90.7769 -303.703 14.7864 25604 0.975825 -0.0031787 0.00293838 1.00212 84.8629 -303.607 15.9534 14910 0.98496 0.000379333 -0.00294234 1.00387 96.4106 -303.802 14.3842 13199 1.00433 -0.000393802 0.000377186 1.00458 95.6934 -303.847 14.991 39794 1.00467 -0.00260221 -0.000185908 1.00521 94.7532 -303.483 14.3744 34289 +155 0.992862 -0.00285426 0.00183314 1.00493 85.7836 -117.629 14.915 18479 1.00355 -0.00301614 0.00309601 1.0045 90.7449 -117.868 14.7636 28817 0.978233 -0.00034723 0.00322277 1.00305 84.9977 -118.07 15.9998 17252 0.987259 -3.45141e-05 0.00398923 1.00367 96.2055 -117.451 14.4731 14704 1.00327 -0.00350317 0.0041472 1.00677 95.4213 -117.793 14.9112 44984 1.0048 -0.00144443 0.00174534 1.00596 94.555 -117.385 14.4981 39515 +156 0.992543 -0.00141451 0.00276645 1.00451 85.1571 67.8876 14.9329 18189 1.00342 -0.00123476 0.000870293 1.00184 90.245 67.8153 14.8922 28429 0.975484 -0.00332477 -0.000878443 1.00276 84.5175 67.4033 16.1001 16693 0.987558 -0.000947856 0.000826074 1.00433 96.1345 68.2911 14.4271 14711 1.00502 -0.00122868 0.00177431 1.00362 95.169 68.0549 14.9607 44201 1.0047 -0.00193671 -0.000485919 1.00268 94.3588 68.3886 14.5409 38633 +157 0.992178 -0.00402366 -0.000280829 1.0019 84.9893 253.646 14.8573 19225 1.00218 -0.00280906 -0.000317645 1.00377 90.2141 253.769 14.7631 29190 0.971342 -0.00347876 0.00200026 1.0035 84.4227 253.187 16.0075 16798 0.98525 -0.00103524 -0.00312762 1.00199 95.8245 254.139 14.4235 15065 1.00438 -0.00267276 0.000574519 1.00292 94.8858 253.983 14.842 44984 1.00604 -0.00260596 0.000296003 1.00417 93.8303 254.298 14.5368 39918 +158 0.992619 -0.00414296 0.00359175 1.00279 84.5046 438.91 14.8515 17824 1.00391 -0.00309028 0.00232144 1.00406 89.8675 439.517 14.7439 26563 0.97512 0.00253255 0.00104229 1.00033 83.9648 438.477 15.9269 15017 0.987244 0.000127988 -0.000679753 1.00378 95.2145 440.231 14.4818 14004 1.00559 -0.0024585 0.000903954 1.0046 94.5133 439.823 14.8328 40286 1.00642 -0.00227897 0.00241607 1.0028 93.635 439.884 14.5927 35843 +159 0.99159 -0.0039259 0.00385679 0.998866 83.836 623.825 14.8998 16404 1.00311 -0.00494737 7.7374e-05 1.00126 89.5197 625.082 14.6736 24101 0.975812 -0.00156791 -0.00123219 0.997607 83.7661 622.756 15.9044 13076 0.983785 1.23902e-05 0.00540886 1.00334 94.872 626.141 14.3388 12424 1.00464 -0.00131285 -0.00133378 1.00465 94.1122 625.882 14.7331 35672 1.00454 0.000383832 0.000673132 1.00473 93.4152 625.736 14.5016 31760 +160 0.991803 -0.00410433 0.00408452 0.999668 83.2921 808.582 14.7729 12711 1.00214 -0.00321481 0.00148373 1.00123 88.9632 810.282 14.7068 17985 0.972733 -0.00397288 0.000577513 0.994867 83.236 806.89 15.7181 9854 0.988178 -0.000430674 0.00245607 1.00032 94.8274 811.558 14.3041 9329 1.00551 0.000522921 -0.000437402 0.997037 94.0126 811.193 14.6925 26708 1.00628 0.000829426 0.00187823 0.998197 93.2424 811.031 14.5449 24436 +161 0.987567 -0.00672299 -0.00120389 0.99016 83.0634 992.825 14.9728 8161 0.999712 -0.00212204 -0.010096 0.996767 88.8545 995.141 14.8737 11358 0.974441 0.00684849 -0.00565714 0.998721 83.9401 991.023 16.2402 5999 0.988625 -0.00193626 0.000817174 0.9955 94.7725 996.637 14.6463 5670 1.00326 -0.00162457 -0.00130081 0.997464 93.7534 996.174 15.0927 16281 1.00752 0.00145934 -0.00394073 0.996938 93.4491 995.894 14.6124 15176 +162 0.987881 0.00268618 -0.00406276 0.998981 82.4362 1177 15.4876 3909 0.997322 6.36504e-05 -0.00343022 1.00401 88.5808 1179.75 15.0745 5727 0.976431 0.00424631 -0.00433728 1.00216 84.7783 1175.66 17.4504 3075 0.986083 0.00552203 0.00583671 0.999051 94.2912 1182.29 14.9526 2442 1.00558 -0.00246427 -0.00494202 0.997788 93.304 1181.07 15.3826 7829 1.00135 -0.00190114 0.000840981 0.998625 93.1919 1180.63 14.9896 7583 +163 0.99369 -0.00332186 -0.00587483 0.997583 82.4635 1361.42 15.9773 1951 0.995039 -0.00616928 -0.00532043 1.0039 88.5579 1365.38 15.7066 3030 0.984887 -0.00274645 -0.00602343 1.03423 85.4154 1363.22 18.1179 1689 0.985371 -0.00647205 0.0123091 1.01238 94.1496 1368.4 15.5065 1212 1.00627 0.0028957 -0.00895885 1.01172 92.6536 1366.64 15.6692 3765 1.00858 0.00232094 -0.0016492 1.00791 92.5533 1366.17 15.3274 4120 +164 0.99611 0.00343419 0.0053285 0.999321 270.221 -1042.56 15.6263 6020 0.99817 0.000150421 0.0070082 1.00197 276.761 -1043.91 15.3158 6665 1.00795 -0.0068848 -0.00478994 1.00619 270.708 -1040.29 17.6873 2230 0.977814 -0.00319894 0.00635936 0.999045 281.367 -1045.97 14.7675 3489 1.00066 -0.00364877 -1.49901e-05 1.00023 282.009 -1044.81 15.1577 17949 0.999598 -0.00167567 -0.00555632 0.996782 281.337 -1044.51 15.3067 17631 +165 0.987522 -0.00134237 0.00189376 0.997022 270.022 -858.411 15.3878 8204 0.998695 -0.00271966 0.00156688 1.00163 276.561 -859.34 14.9176 8915 1.00173 0.00116605 -0.00708094 0.990311 269.25 -856.298 17.178 2979 0.968543 0.000844244 0.00590078 0.996173 281.327 -860.945 14.4347 5117 0.998068 0.00214078 0.00209611 0.998487 281.691 -859.975 14.5101 23581 0.998335 -0.000207659 -0.00190316 1.00016 280.899 -859.865 14.7964 25250 +166 0.991219 -0.00792338 0.000858851 1.00231 270.196 -673.288 15.3038 11492 0.99875 -0.00450642 0.00453825 1.00487 276.905 -674.134 14.7917 12761 1.0038 -0.00193092 0.00634687 0.99907 268.954 -672.414 17.0381 4389 0.986475 -0.00636569 0.00420795 1.00509 280.678 -675.533 14.5726 7831 1.00191 -0.00173427 0.00280405 1.00458 281.654 -674.579 14.5064 35618 1.00346 -0.00359336 0.000816668 1.00228 280.94 -674.517 14.7126 37794 +167 0.990617 -0.0046496 -0.000120943 1.00034 269.459 -488.321 15.4717 13517 0.999256 -0.00421104 0.00363506 1.00288 276.158 -488.879 14.8356 15869 1.00765 -0.00743196 0.00118861 0.997288 268.115 -487.877 17.0368 5649 0.985502 -0.00194626 0.00191783 1.00567 280.203 -489.174 14.5946 9681 0.998449 -0.0022674 0.00461575 1.00175 281.189 -488.942 14.5397 44606 1.00345 -0.00342139 0.00161512 1.00261 280.47 -488.961 14.7474 46610 +168 0.995653 -0.00227504 0.0051954 1.00691 269.719 -302.515 15.386 13865 1.00249 0.00070448 0.00228192 1.00246 276.117 -303.148 14.878 15930 1.00416 -0.00114805 0.000550627 1.00252 268.135 -302.835 17.116 6294 0.984858 -0.00126113 0.000204505 1.00632 280.134 -303.07 14.4092 10107 1.0022 -0.00293457 0.000479524 1.00443 280.875 -302.96 14.5191 44658 1.00509 -0.00213094 0.00131864 1.00376 280.237 -302.856 14.8695 47276 +169 0.994774 -0.00338171 0.00338784 1.00696 269.205 -117.383 15.3656 14156 1.00393 -0.00233277 0.00234259 1.00299 276.166 -117.581 14.9057 15997 1.00675 -0.00783407 0.00390587 1.00314 268.285 -118.078 17.061 6335 0.985097 -0.00169817 0.00171538 1.00222 279.873 -117.113 14.5064 9954 1.0011 -0.00489458 0.00325984 1.00449 280.66 -117.318 14.6173 44811 1.00548 -0.00274586 0.0048784 1.00278 280.033 -117.133 14.8069 47724 +170 0.995582 0.00114868 -0.000787843 1.0027 268.61 68.3507 15.4545 14502 1.00372 -0.00125352 0.00215931 1.0084 275.632 68.3909 14.9221 16826 1.01128 -0.00728606 0.00174957 1.00864 268.116 67.7095 17.1178 6341 0.988616 -0.00103431 0.00279513 1.00301 279.258 68.6932 14.5465 10424 0.999348 -0.00121888 0.00257363 1.00495 280.099 68.648 14.5274 46018 1.00305 -0.00130152 0.00192717 1.00351 279.586 68.7629 14.9099 49041 +171 0.991978 -0.00439327 0.000265855 0.999701 268.469 253.907 15.3238 14423 1.00204 -0.005502 -0.00116942 1.00461 275.492 254.013 14.8305 16519 1.0038 -0.00336838 0.00638265 1.00115 267.968 253.466 17.1825 6028 0.985177 -0.00167691 0.00613559 1.00425 279.187 254.42 14.5831 10483 1.00123 -0.00235866 0.00161109 1.00408 279.989 254.344 14.5349 45327 1.00486 -0.00335143 0.00100208 1.00459 279.188 254.565 14.9407 49492 +172 0.99609 -0.00605048 0.00324038 1.00157 268.043 439.277 15.4034 13510 1.00285 -0.00324073 0.000300897 1.0033 275.401 439.404 14.9042 15324 1.01351 -9.29791e-05 -0.000565067 1.00353 267.693 438.27 17.189 5399 0.987611 0.000949254 0.00612043 1.00475 278.684 440.294 14.54 10016 0.999605 -0.0030675 0.00446506 1.00393 279.735 440.174 14.4496 42044 1.0046 -0.00209284 0.00439327 1.00341 279.01 440.288 14.9375 47537 +173 0.992725 -0.0103446 -0.00154711 0.997522 267.041 624.037 15.2067 11921 1.00504 -0.00655679 0.00251371 1.00194 274.604 625.219 14.8297 13526 1.01303 0.000243524 0.00524285 0.997171 266.759 623.128 17.3403 4685 0.988877 -0.00399593 -0.00425706 0.996849 278.436 626.67 14.4448 8693 1.00059 -0.00187132 0.00152651 1.00306 279.249 625.97 14.4284 37496 1.00339 -0.00342307 0.00424293 1.00246 278.73 626.281 14.8548 41115 +174 0.991928 -0.000421685 0.00261026 0.998017 266.361 808.8 15.363 8890 0.99935 0.00151547 0.00189312 0.99883 274.275 810.181 14.8278 9482 1.01003 0.00432354 0.0121613 0.996995 266.476 807.652 17.2723 3342 0.982637 0.00411357 -0.00838533 0.99648 278.506 812.187 14.4702 5960 0.9976 -0.00239006 0.000536644 0.9982 279.024 811.167 14.3103 25566 1.00151 -0.0024124 0.00514768 0.995635 278.541 811.54 14.9374 28383 +175 0.987146 -0.0051638 0.00172959 0.997559 265.9 993.188 15.4516 6202 0.999152 -0.00386263 0.00377919 0.993438 273.618 994.95 15.1997 6494 1.00196 0.000730951 0.0161351 0.998993 266.406 991.45 17.5802 2250 0.987706 -0.00440173 0.00674163 0.995587 278.031 996.281 14.6879 3794 0.995976 -0.00466757 0.00212935 0.997114 278.518 995.793 14.6625 17025 1.00074 -0.000687974 0.00856657 0.995425 278.641 995.915 15.2782 18546 +176 0.989488 0.00534947 0.00110972 1.00299 265.693 1177.66 15.9351 3206 1.00675 -0.00142532 0.0118535 1.00733 273.624 1180.29 15.3429 3418 1.00712 0.00544885 0.01438 1.00389 267.99 1176.62 18.0668 1241 0.993009 0.00372653 0.00559225 1.00866 277.092 1182.56 15.0809 1491 0.998737 0.00137119 0.0041662 0.9981 278.111 1180.4 14.9968 7767 1.00338 0.00047737 0.00986051 0.998677 278.06 1180.58 15.5425 8197 +177 0.997639 -0.00608658 -3.91784e-05 0.98547 265.308 1361.46 16.2677 1822 0.996025 0.000484972 0.00231534 1.00251 273.665 1364.47 15.6508 2107 1.00719 0.0170973 0.00878718 1.02217 268.862 1362.72 18.9549 774 1.0059 -0.00856846 0.0088281 1.00325 277.372 1366.3 15.0456 731 0.999296 -0.00765599 -0.000126065 1.00475 278.175 1365.91 15.1709 4126 1.00167 -0.0111117 0.0145278 0.99805 278.131 1365.94 15.6282 4073 +178 0.98548 -0.00307998 0.00659283 1.00695 453.749 -1042.22 16.3497 3910 0.999352 -0.00622839 0.0052462 1.00359 461.918 -1043.44 15.5374 3545 1.00851 0.00233529 -0.00339028 1.00328 456.862 -1040.49 17.7712 872 0.991245 -0.000673719 0.00636095 1.00065 464.16 -1044.39 15.0617 8226 1.00109 -0.00382349 0.00487042 0.996022 467.354 -1043.85 14.906 9141 1.00087 -0.00244168 0.00659311 0.998276 466.765 -1044.04 15.123 12340 +179 0.992471 0.000293845 0.00546942 0.994648 453.644 -857.395 16.0793 5133 0.992021 0.00704671 0.00216401 0.998411 461.5 -858.702 15.2754 4563 1.00052 -0.000194135 -0.00663683 1.00139 455.961 -856.627 17.363 1277 0.989894 0.000481558 0.00491897 1.00043 463.773 -859.607 14.6357 11261 1.00056 0.000626383 0.00585709 0.999502 467.224 -858.961 14.5371 12053 1.00099 0.00116659 0.0021534 1.00008 466.461 -859.077 14.7249 16514 +180 0.989005 -0.00956456 0.00563675 1.003 453.392 -672.57 15.9708 7506 0.992295 -0.00771934 0.000262179 0.997286 461.554 -673.941 15.2948 6822 1.00509 -0.0185121 -0.00157988 1.00216 456.051 -672.333 17.4579 1895 0.992907 -0.00237779 0.00328793 1.00527 463.721 -674.48 14.6659 19066 1.0016 -0.00323533 0.00554721 1.00398 466.895 -673.92 14.6081 18858 1.00153 -0.00196626 0.00505426 1.00338 466.244 -674.095 14.7859 28079 +181 0.993866 -0.00702881 0.00222575 1.00289 453.216 -487.546 16.068 8724 0.997573 -0.000783918 0.000444587 1.00417 461.076 -488.354 15.4901 8409 1.01393 -0.00292493 0.000249996 1.00601 455.105 -487.042 17.323 2463 0.993407 -0.00418492 0.00373031 1.00293 463.341 -488.608 14.6415 23188 1.00141 -0.00109211 0.00160348 1.00231 466.373 -488.058 14.5569 23106 1.00305 -0.00324098 0.00144012 1.003 465.864 -488.325 14.8562 33588 +182 0.994327 0.000945898 0.00244455 1.00005 453.016 -302.651 15.9852 9082 0.997012 -0.00248228 -0.000468512 1.0012 461.155 -302.977 15.2096 8644 1.01585 -0.00411315 0.00663643 0.999666 454.965 -303.201 17.0605 2679 0.994692 -0.00103699 0.00312631 1.00392 463.124 -302.587 14.6367 23388 1.00183 -0.0022969 0.0028709 1.00563 466.025 -302.599 14.6136 23354 1.00253 -0.00397916 0.00125513 1.00423 465.689 -302.55 14.7503 33171 +183 0.991712 -0.00343954 0.00173884 1.00343 452.646 -116.667 16.1381 9673 0.99938 -0.000178981 0.00341442 1.00395 460.967 -116.974 15.2768 9207 1.00452 0.00389493 0.00391948 0.996047 454.805 -117.497 17.149 2858 0.992485 -0.00313207 0.00110111 1.0047 462.825 -116.743 14.7594 25535 1.00356 -0.00185166 0.00233501 1.00468 465.884 -116.773 14.532 24994 1.00475 -0.00215378 0.00163597 1.00488 465.513 -116.663 14.8649 36421 +184 0.996754 -0.00585887 0.00248674 1.00217 452.252 68.3174 16.0401 9390 1.00111 -0.00631417 -0.004717 1.00015 460.777 68.4273 15.3797 8993 1.01733 0.00530772 0.00187229 0.997603 455.184 67.284 17.1671 2701 0.992569 -0.000578273 0.00126476 1.00422 462.347 68.9822 14.6401 24190 1.00158 -0.00324812 -0.000416641 1.00298 465.496 68.9422 14.5417 23910 1.00274 -0.00288024 -0.000531122 1.00282 465.055 69.1059 14.8918 34091 +185 0.995334 -0.00269549 0.00266115 0.999232 451.882 254.041 16.1264 9107 1.00234 -0.000522948 -0.000581644 1.0024 460.702 254.174 15.261 8617 1.00933 -0.00529043 -0.00493725 1.00885 455.188 253.145 17.2501 2508 0.99477 -0.00156245 0.00304152 1.00339 462.375 254.905 14.6823 23616 1.00377 -0.00351033 0.00313977 1.00402 465.303 254.81 14.5156 23315 1.00519 -0.00200362 0.00460168 1.00509 465.017 255.095 14.8145 34221 +186 0.994824 -0.00122843 0.000358538 0.999034 451.205 439.233 16.0834 9024 0.998979 -0.0063405 0.00184733 1.00112 460.189 439.921 15.3041 8409 1.00391 -0.0044671 0.0104984 1.00785 454.492 438.568 17.4681 2326 0.995206 -0.00447511 0.00365765 1.00395 461.658 440.65 14.7274 23895 1.00398 -0.00223121 0.00224529 1.00351 464.672 440.499 14.4667 23465 1.00467 -0.00194781 0.000152122 1.00307 464.497 440.805 14.9201 34517 +187 0.993275 -0.00784374 -0.000243411 0.997359 450.231 624.175 16.1012 7812 1.00341 -0.00761999 -0.00152011 0.999518 459.792 625.159 15.348 7271 1.01432 0.00035144 0.00316026 1.00718 454.256 623.919 17.4492 1881 0.993837 -0.0044443 0.00059657 0.999515 461.289 626.59 14.7006 21279 0.999149 -0.0074809 -0.000237478 1.00144 464.277 625.996 14.5745 20572 1.00329 -0.0041236 -0.00217799 1.00226 464.243 626.517 14.9146 30874 +188 0.996196 -0.00323528 -0.00254546 0.997839 448.927 808.889 15.9926 6212 0.998966 0.00233507 -0.00208685 0.995191 458.771 810.21 15.3554 5648 1.01548 0.000585661 0.00294865 0.998738 452.913 809.04 17.4502 1492 0.996024 -0.000812176 -0.000799318 0.99871 460.876 811.648 14.7128 15553 1.00125 -0.00459018 0.000239622 0.997991 463.699 810.97 14.4808 15064 1.00376 -0.00258039 -0.00169302 0.993246 463.753 811.587 14.9396 21785 +189 0.996489 -0.000226034 0.00423688 1.00608 448.447 993.155 16.2237 4095 1.00234 -0.00150231 0.00431755 0.997335 457.822 994.753 15.6697 3676 1.01769 -0.0029949 0.0129639 0.988771 453.395 992.471 17.7161 1012 0.995122 -0.00138977 -0.00148772 0.993437 460.563 996.151 14.7704 9188 1.00166 -0.00134886 0.00110012 0.995983 463.225 995.572 14.6166 9604 1.00111 -0.000674909 -0.00174231 0.998089 463.635 996.314 15.0131 12796 +190 0.980755 0.00138386 -0.0023434 1.00114 448.294 1177.66 16.441 2527 0.997575 -0.00402063 -0.00344924 0.994509 458.051 1179.89 15.6137 2353 1.00366 0.0020583 -0.000600025 0.993895 454.267 1178.47 18.327 657 0.991278 0.00103183 0.00090762 1.00208 459.941 1181.33 14.8606 4672 0.99367 -0.00430711 -0.00202699 0.997259 463.053 1180.72 14.7962 5622 0.999831 -0.000602656 0.000309565 1.00089 463.713 1181.23 15.2243 6972 +191 1.00702 0.00408707 0.00204789 0.997061 449.154 1362.35 16.6548 1435 1.01003 -0.00102957 -0.00522083 0.992076 458.684 1364.97 16.012 1482 1.02139 -0.0126679 0.00885551 0.980829 454.757 1363.22 18.0471 444 0.996158 -0.0038866 -0.00374096 1.00051 460.041 1366.39 15.1959 2164 0.99802 0.00483544 -0.00493169 1.00521 463.121 1365.27 15.2085 3127 0.997791 0.00326904 -0.0105413 1.00604 463.374 1366.4 15.6324 3411 +192 0.996953 -0.0102682 0.0111724 1.01088 495.799 -1048.71 15.7765 3848 0.987849 -0.0106141 -0.000450444 0.993054 488.255 -1044.42 15.078 2431 0.99461 0.00203856 0.0181232 1.00146 493.131 -1045.11 17.1942 913 0.983826 0.00410509 0.00803011 0.992143 483.671 -1043.02 15.1748 5562 0.983001 0.00374488 0.00228539 0.977394 480.866 -1039.79 14.7467 4104 0.987694 0.00204263 0.00178393 0.980929 477.175 -1039.57 15.541 3291 +193 0.999009 -0.0104097 0.00899529 0.99966 495.517 -862.744 15.4828 4274 0.996016 -0.00751168 0.00483723 1.00148 487.633 -860.723 15.1276 2662 1.00732 -0.0113705 0.0136099 1.01419 493.292 -860.707 16.5499 1078 0.972501 -0.0018379 0.00686573 0.992926 483.467 -860.272 14.7921 9153 0.972656 -0.00623714 0.00903029 0.986981 480.559 -858.238 14.7043 5325 0.966553 -0.00648023 0.00836041 0.979953 476.291 -858.256 15.5284 5665 +194 0.998903 -0.00125205 0.00206848 1.00509 494.163 -676.774 15.4624 5811 0.992639 -0.00794654 0.00351425 0.99203 486.707 -675.259 15.2364 3936 1.01293 -0.00425762 0.0131243 1.00733 492.532 -674.998 16.7712 1631 0.971346 -0.00922503 0.00570729 0.999895 482.388 -675.978 14.8807 13663 0.972206 -0.00225686 0.00599534 0.992932 479.308 -674.746 14.6684 8039 0.971106 -0.00807145 0.00195478 0.996041 475.072 -675.598 15.6832 8577 +195 0.997493 0.00395477 -0.000184963 0.999227 494.278 -491.699 15.4667 6935 0.995354 -0.000382178 -0.00405576 0.996527 486.696 -490.572 14.9922 4690 1.0068 -0.000428994 -0.00136361 1.0024 492.777 -490.88 16.3582 2025 0.971061 0.00419879 0.00409465 1.00355 482.08 -491.148 14.8179 17504 0.968835 0.00628731 0.000631172 0.995223 479.43 -490.6 15.0271 9588 0.970358 0.00137821 0.0018088 1.00023 475.118 -491.28 16.1479 10693 +196 0.993089 0.00727153 0.00143503 1.0042 494.782 -306.13 15.5871 7495 0.987565 -0.00226413 0.00439834 1.00655 486.926 -305.805 15.2096 5234 0.986993 -0.00343534 -0.00562955 1.00001 492.955 -305.458 16.4256 2371 0.97202 0.0085577 0.00297971 1.00365 483.213 -305.727 14.9262 17824 0.970214 0.00666771 0.00226497 1.0025 480.382 -305.577 14.9613 10258 0.968559 0.0111472 0.000167518 1.0077 476.495 -305.755 16.2497 10626 +197 0.99561 0.000583182 0.0025803 0.999184 495.376 -120.9 15.5029 8892 0.987963 0.000732478 0.00397195 1.00181 487.387 -119.898 15.1252 5941 0.999703 0.00759235 -0.000397216 1.00056 493.025 -120.694 16.3164 2715 0.971911 0.00674193 0.000151979 1.00482 484.224 -120.214 14.7539 20040 0.972787 0.00743419 0.00278202 1.00332 481.734 -120.272 14.966 11488 0.970201 0.00743649 0.00255527 1.01268 478.079 -120.381 16.0009 11822 +198 1.00001 0.0058565 0.00100987 0.999926 495.984 65.2808 15.5201 8613 0.992477 -0.00125877 -0.000686396 1.00135 488.022 65.0787 15.1082 5943 1.00181 0.00542969 -0.00265703 0.999197 494.034 64.8078 16.3853 2651 0.976725 0.00474664 -0.00165159 1.00463 485.385 65.7086 14.8363 19639 0.974036 9.70022e-05 -0.0014509 1.00487 482.732 65.5319 14.8864 11528 0.969182 0.00109293 -0.00167827 1.00327 478.888 65.7236 15.8049 11722 +199 0.995476 0.00193355 -0.000322541 1.00439 496.783 250.9 15.5639 8277 0.992174 -0.00192101 -0.00283408 1.00325 488.384 250.741 15.18 5459 1.00245 0.000847782 -0.00813098 1.00756 493.237 250.009 16.4825 2321 0.9712 0.00101051 0.00233797 1.00501 486.187 251.586 14.7458 19245 0.972567 0.00222507 -4.57315e-05 1.00266 483.078 250.978 14.7463 11093 0.965198 0.00211208 -0.000392968 1.00367 479.757 251.464 15.878 11793 +200 0.995967 0.010098 -0.00142705 1.0084 497.299 437.001 15.5857 5798 0.983102 0.00810019 -0.00464094 1.00834 488.782 436.366 14.8076 3967 0.99678 0.0114733 -0.00510829 1.00594 494.581 435.058 16.5275 1613 0.972507 0.00203969 -0.00259123 1.00778 486.745 437.402 14.5977 15131 0.973306 -2.26992e-05 -0.0030099 1.00207 483.839 436.393 14.398 8200 0.966875 0.0107645 -0.000856691 1.00338 480.58 437.384 15.4365 9349 +201 0.993149 0.000479662 -0.00548042 0.999214 498.027 623.088 15.5288 6849 0.979308 0.0104864 -0.00210257 0.99816 489.467 621.964 14.7537 4591 0.99426 -0.00150908 0.00130103 1.00781 494.526 621.881 16.7536 1845 0.972404 0.0055325 -0.00768507 1.00456 487.631 623.143 14.723 17008 0.970147 0.00845106 -0.00767291 0.997231 484.663 621.663 14.3916 9688 0.959251 0.00675437 -0.00525507 0.999993 481.407 622.773 15.3269 10629 +202 1.00866 0.0002268 -0.00764333 1.00295 498.655 809.201 15.7973 5351 0.99274 -0.0045845 -0.00603324 0.999431 489.653 807.28 15.0012 3553 1.01343 0.00162908 2.31332e-05 1.01121 494.351 807.083 16.6599 1438 0.977306 -0.00105726 -0.00914959 0.999386 488.298 808.543 14.6782 12117 0.977771 -0.00190224 -0.0157122 0.993964 485.595 806.285 14.3337 7261 0.970551 -0.00227734 -0.0120126 0.990853 482.101 806.879 15.097 7502 +203 1.01074 -0.00830368 -0.00572718 1.00933 498.993 995.653 15.9567 4120 1.00275 -0.00287552 -0.00784957 0.997645 490.187 992.472 14.7404 2570 1.0042 -0.00679541 -0.00491965 0.994726 494.307 992.017 17.0598 1097 0.97999 -0.000612752 -0.00992155 0.994569 488.42 992.889 14.7557 7067 0.979698 0.00208011 -0.0158108 0.99014 485.331 990.131 14.5499 4792 0.96904 -0.0024484 -0.0113983 0.994616 481.888 990.014 15.225 4087 +204 0.986277 0.000959546 -0.0108711 1.01108 498.6 1181.83 15.6649 1218 0.990959 0.00802544 -0.00562045 1.00602 489.907 1176.94 15.0246 858 1.02849 0.00184599 -0.00424814 1.01089 494.164 1177.26 17.5222 360 0.963228 0.00517734 -0.0264563 1.00712 488.205 1177.05 15.143 1510 0.977923 0.00305308 -0.0099929 0.990713 485.618 1172.84 14.666 1440 0.961353 0.00853302 -0.0163733 0.994209 481.823 1172.46 15.7876 914 +205 1.00558 0.00336818 -0.0185832 1.01008 499.104 1368.98 16.0541 1393 0.993154 -0.0172267 -0.0165105 0.999707 490.87 1363.05 15.2186 951 0.999947 -0.0154678 -0.0215095 1.0119 494.379 1365.13 17.9138 407 0.990523 0.00281522 -0.00407685 1.00285 488.741 1361.68 15.4973 1096 0.986692 -0.00335694 -0.0170271 0.993793 485.939 1357.26 15.0137 1407 0.972448 0.0107866 -0.0221457 1.01357 481.706 1356.81 16.5618 654 +206 0.982707 0.00544087 0.0300123 1.00864 496.463 -1052.29 15.8507 3800 0.971863 -0.0131335 0.0195674 1.00106 488.546 -1046.85 14.6562 3326 0.962552 -0.00255917 0.026637 1.00731 491.763 -1047.39 17.2525 2189 0.985375 -0.00476217 0.0147274 1.00774 494.752 -1052.76 15.3587 3215 0.986668 -0.00886651 0.0124989 1.00494 489.701 -1049.04 15.3322 1878 0.980459 -0.007788 0.00827661 0.99716 489.642 -1047.33 15.0407 1172 +207 0.978086 -0.00265882 0.0107079 1.0125 496.202 -865.448 15.237 9468 0.975403 -0.0109391 0.0101452 0.997703 486.863 -862.215 14.4457 6769 0.965094 -0.00731288 0.0107054 1.00645 489.648 -861.526 16.3608 5976 0.991487 -0.00058335 0.00979895 1.00823 494.149 -866.37 15.0221 6008 0.987454 -0.00148701 0.0119561 1.0054 488.743 -863.56 14.9663 3402 0.989251 -0.00181283 0.0083896 1.01174 488.259 -862.221 14.8447 1914 +208 0.977706 0.00308761 0.00503266 1.00685 496.24 -678.595 15.1726 11534 0.971793 -0.0046552 0.00579696 0.998337 486.249 -676.867 14.3096 7895 0.966101 -0.00158959 0.00925611 0.996636 489.388 -676.4 16.2236 8077 0.994001 0.00197863 0.0064875 1.00163 494.667 -679.902 15.113 6680 0.987162 -0.000759079 0.00798213 1.00122 489.035 -678.165 14.9548 3920 0.989437 -0.00275129 -4.67405e-05 0.99659 488.105 -676.773 14.5033 2018 +209 0.972605 -0.00550936 0.00293999 1.00595 495.38 -492.868 15.3067 14186 0.971433 -0.0045764 0.00451704 1.00246 485.021 -492.022 14.5852 10242 0.970049 -0.00727685 0.00705368 0.999893 488.726 -491.951 16.3882 10584 0.989045 -0.00504455 0.00426561 1.00762 494.514 -493.798 14.9336 8811 0.983439 0.0013914 0.00344323 1.0012 488.731 -492.504 15.0486 5193 0.98266 -0.00548939 0.00677957 0.992452 487.778 -491.654 14.7437 2539 +210 0.975345 -0.00305848 -0.0026432 1.00639 494.334 -307.173 15.284 14926 0.973963 -0.000797406 0.00348499 1.0049 483.948 -306.7 14.5001 11129 0.972889 0.000334933 0.00105834 1.00686 487.773 -306.875 16.5685 11094 0.991665 0.000931533 0.000531702 1.00788 494.056 -307.377 15.0842 9977 0.985223 -0.0036378 0.00103013 1.00992 487.951 -306.995 15.0613 5853 0.981056 -0.00268797 -0.00131494 1.00653 487.259 -306.407 14.7885 3046 +211 0.975416 -0.00414177 3.96762e-05 1.00965 493.952 -121.6 15.28 12800 0.970922 -0.00335462 0.00181518 1.00777 483.671 -121.328 14.8151 9587 0.97405 -0.00676854 -0.0001607 1.00715 487.236 -121.606 16.6033 9504 0.987555 -0.00133165 0.00155995 1.00843 494.232 -121.21 15.0235 8894 0.982674 -0.00281473 -0.00269393 1.00819 487.856 -121.088 15.0868 5139 0.986615 -0.0030364 0.000876282 1.01223 487.385 -120.674 14.809 2636 +212 0.969135 -0.000727648 -0.00454047 1.0044 493.299 64.1546 15.2497 15322 0.969523 0.00122075 -0.00193676 1.00287 483.415 64.1639 14.7395 11471 0.962718 -0.000575689 -0.00496455 1.00939 486.583 64.2328 16.7284 11040 0.985168 -0.00676577 -0.0063891 1.00699 493.716 64.8389 14.9912 10737 0.981948 0.00484132 -0.00918951 1.00066 487.507 64.3832 14.9435 6172 0.985974 -0.00232616 -0.00503568 0.994531 487.016 64.8611 14.977 3045 +213 0.964937 -0.00824605 -0.000484055 1.00466 492.713 250.351 15.3136 15549 0.965961 0.00117367 0.00076869 1.00397 483.474 249.916 14.8983 10884 0.972881 -0.00239921 0.000686004 1.00461 485.813 250.095 16.808 10852 0.981732 -0.00335783 -0.00040349 1.00412 493.408 251.173 15.0481 9902 0.978836 -0.00119353 0.00246842 1.0069 487.435 250.503 15.0552 5674 0.979321 -0.0069558 -0.00165429 1.00018 486.815 250.607 15.1963 2837 +214 0.971728 -0.00645457 0.000785514 1.00527 491.53 435.949 15.2747 15429 0.967483 -0.00126789 -0.00350441 1.00367 483.029 435.34 14.7241 10631 0.971722 -0.011811 -0.0031063 1.0008 484.441 435.305 16.7519 10378 0.992269 -0.00648454 -0.00450704 1.00645 492.712 437.245 14.848 9655 0.98507 -0.00373478 -0.00894252 0.997699 486.837 435.787 15.01 5487 0.987816 -0.00601038 -0.00129778 0.991714 486.362 435.508 14.7968 2682 +215 0.972517 -0.00015264 -0.00296177 1.00246 490.137 621.044 15.2324 14250 0.968162 -0.00125145 -0.00264868 1.00052 482.347 620.013 14.6007 9402 0.973768 -0.000576893 -0.00343099 0.999791 483.093 619.646 16.7536 9471 0.983171 -0.00162561 -0.00433408 1.00921 492.066 623.404 14.9008 8535 0.979418 -0.00663386 -0.00857805 1.00488 485.888 621.23 15.0369 4873 0.979237 0.00389223 -0.0036998 1.00644 485.515 620.397 14.7005 2464 +216 0.977049 -0.0037096 -0.00715515 1.00449 489.526 806.271 15.2968 11283 0.968865 0.00115479 -0.00746729 0.989722 482.206 803.796 14.5614 7222 0.98474 -0.00536518 -0.0120735 0.992819 482.516 802.694 16.5044 7001 0.988557 -0.000526925 -0.0109712 0.999878 491.685 808.825 14.9493 6648 0.98834 -0.00290094 -0.00138415 0.996077 485.901 805.749 15.085 3830 0.981554 -0.00409184 -0.00691535 0.994737 485.601 804.979 14.7976 1859 +217 0.982925 -0.0109047 -0.0160694 0.997495 488.17 990.996 15.696 6345 0.974544 0.000937198 -0.00737005 0.991653 482.052 986.969 14.6091 4586 0.986815 -0.00691806 -0.00414143 0.990905 481.958 986.369 16.7064 3800 0.989753 -0.00597115 -0.00421966 0.999103 491.142 994.411 15.0136 4803 0.987922 -0.00502063 0.00185122 0.995848 485.601 990.451 15.2193 2645 0.994727 0.00637758 0.00563481 1.00097 485.915 989.255 15.1446 1418 +218 0.984088 -0.00843856 -0.022323 0.990263 487.016 1174.99 16.3432 2549 0.978865 0.00499547 -0.00750338 0.98365 482.147 1169.51 14.8826 2698 0.976252 0.00183127 -0.00753455 0.990245 482.338 1169.74 17.7718 1474 0.996922 -0.00588553 -0.011556 0.993533 490.075 1179.9 15.1331 2939 0.985141 -0.000733548 -0.0134961 0.99021 485.134 1174.51 14.9794 1766 0.987895 5.58871e-05 0.000873246 0.994674 485.196 1173.69 14.9021 1039 +219 0.982468 -0.0208053 -0.0182035 0.973038 484.932 1356.35 16.7745 863 0.980344 -0.00372555 -0.0211956 0.973156 480.758 1350.44 14.9031 1303 0.956091 -0.00971368 -0.0181817 0.965599 482.203 1350.26 17.7782 436 0.999022 -0.00865727 -0.0145297 0.990428 490.102 1364.97 15.1288 1641 0.986916 -0.00890747 -0.0109883 0.984882 484.862 1358.43 15.5575 939 0.984534 -0.000882773 -0.00657948 0.975154 485.666 1357.13 15.2038 723 +220 0.982293 -0.00176362 -0.00431919 0.99696 -461.174 487.908 15.8835 4321 0.996625 -0.00141302 -0.00510011 0.987434 -465.076 485.672 14.6429 5028 1.00216 0.000808676 -0.0166554 0.994115 -466.049 488.587 16.065 5949 0.995019 0.00289869 -0.00835173 0.985869 -453.791 485.516 15.4456 2735 0.999725 0.000963278 -0.000237189 0.989363 -460.497 484.502 15.5057 2117 1.00584 0.000360141 0.00554122 0.999308 -461.587 485.347 15.4239 1056 +221 0.965791 0.00228957 0.0118067 1.0008 -279.72 487.252 15.2299 2006 0.985961 0.000123034 0.00767907 0.989745 -281.129 486.219 14.4526 9086 0.987641 0.00162263 0.0128789 1.01035 -280.532 490.211 16.3929 7756 0.99708 0.000997695 -0.00204265 0.985265 -271.034 485.04 15.1336 4219 0.997606 0.00333386 -0.00106164 0.985368 -276 484.948 15.3343 3819 1.00201 -0.000855577 -0.00575273 0.989894 -276.479 485.624 15.0042 1998 +222 0.968937 0.00139467 -0.00452255 0.990426 -100.297 488.013 14.9454 3112 0.991723 -0.000570983 -0.0121866 0.991045 -98.2942 485.913 15.1773 8679 0.989201 0.000605183 0.00643554 1.00478 -97.891 492.13 16.397 6642 0.991065 0.00331629 -0.00849021 0.975549 -87.8448 484.504 14.887 5301 0.997232 0.00527702 -0.0134774 0.982103 -91.9189 484.848 15.1689 6583 1.00711 0.00952454 -0.0142044 0.977851 -91.7425 486.074 14.6048 4101 +223 0.986971 -0.00174319 0.00759761 0.989083 81.9765 488.385 15.0556 4428 0.997492 0.00348515 0.0053028 0.982559 86.2506 485.998 14.8777 5547 0.990261 0.0102009 0.00663905 1.00863 85.6436 493.677 16.8403 2674 0.971413 0.00755796 -0.00283851 0.975364 94.0137 484.019 14.5816 3008 0.991562 0.00149107 0.00329027 0.985007 92.4634 484.354 15.3484 8464 0.994428 0.00740919 -0.00580346 0.98339 93.0587 485.43 14.6054 7499 +224 1.00442 -0.00328019 0.0239222 0.985718 265.171 489.55 15.8195 3824 1.00996 -0.00557442 0.0132886 0.985174 270.871 486.874 15.1708 3840 1.01349 -0.00758982 0.0135231 1.01022 270.697 492.961 16.7927 1215 0.97307 -0.000313847 0.0267117 0.980107 276.491 483.598 14.3793 2048 0.996061 -0.000585259 0.008064 0.983028 276.296 485.876 14.8265 9616 0.992688 0.00334766 -0.00447104 0.98558 276.707 485.673 15.0998 9213 +225 1 0 0 1 0 0 -1 0 1 0 0 1 0 0 -1 0 1 0 0 1 0 0 -1 0 1 0 0 1 0 0 -1 0 1 0 0 1 0 0 -1 0 1 0 0 1 0 0 -1 0 +226 0.973206 0.00242448 -0.0183804 0.97785 -464.321 506.164 16.0601 1154 0.973133 -0.00181658 -0.010302 0.977345 -467.06 505.946 14.9401 2257 0.992024 -0.00443582 -0.0372496 0.978852 -468.971 507.726 16.5482 2192 0.974117 0.00428125 0.00146148 0.973041 -451 505.423 15.7543 1570 0.98116 0.00703982 0.00847623 0.974151 -458.512 503.42 16.0963 1251 1.00259 0.0031202 -0.00335943 0.977489 -457.276 505.016 15.6571 812 +227 0.943476 -0.0234379 0.0151033 0.998615 -284.263 505.32 15.5908 440 0.974268 -0.00547684 0.00500938 0.993435 -282.87 505.772 15.4053 2998 0.979604 0.00538023 0.0184976 0.986777 -284.723 506.809 16.8004 2253 0.970542 0.0017637 -0.00125605 0.964145 -267.391 504.991 15.4087 1803 0.981473 -0.00110414 0.000905759 0.983988 -273.722 503.685 15.285 1691 0.996716 0.0041969 -0.00424218 0.979709 -271.4 504.899 15.1078 1294 +228 0.950465 0.0121111 -0.00241124 0.985749 -102.892 509.582 15.3113 679 0.973858 -0.00433784 -0.0103024 0.983322 -99.6449 504.95 15.8437 2489 0.971838 0.00340854 -0.00607845 0.991044 -102.118 507.348 16.8454 2324 0.97814 0.00515578 -0.00155061 0.966802 -83.6012 504.053 15.3955 1562 0.984133 -0.00241645 -0.00726368 0.971491 -89.2491 502.86 15.1394 2172 0.984892 0.000475877 -0.0109994 0.971476 -86.421 504.9 15.0365 1977 +229 0.967331 0.00812282 0.00074923 0.983923 78.4881 509.74 15.3921 1343 0.984551 0.00112075 0.00690411 0.994745 84.4353 504.2 15.5056 1955 0.985949 0.0197209 0.0106753 1.02152 79.5642 506.76 17.7953 1288 0.963679 -0.00139368 -0.0226036 0.978652 97.4808 501.914 14.9779 721 0.978432 0.00299532 0.00356103 0.974703 94.538 502.401 15.6245 2280 0.979728 -0.00134909 -0.00410109 0.979955 97.6709 503.38 14.9913 2708 +230 0.974033 -0.0117638 0.0092515 0.97522 262.172 509.835 15.4784 1376 0.985898 -0.0119297 0.00660684 0.971156 269.42 505.718 15.5299 1499 1.00379 -0.00213605 0.013694 1.00631 264.191 508.756 17.9241 632 0.950069 0.000212448 0.0173454 0.96918 278.934 502.398 14.8418 556 0.965359 0.00272747 -0.00397204 0.973373 278.53 504.366 15.2722 2783 0.97252 -0.0059961 -0.00629525 0.976544 281.481 503.446 15.9409 2524 +231 0.973039 -0.016299 -0.00424167 0.973329 445.278 511.213 15.9642 1288 0.979699 -0.0141966 -0.00655447 0.975566 453.822 506.917 15.6733 1225 0.974587 -0.0455613 -0.0210376 0.980656 450.459 510.34 18.0467 461 0.9684 -0.009314 0.00884711 0.963792 459.895 505.013 14.9392 1496 0.973162 -0.0111986 -0.00494824 0.970142 461.656 504.843 15.0546 2252 0.975176 -0.0111494 -0.00383869 0.971198 464.851 503.587 15.9097 2377 diff --git a/icaruscode/CRT/CRTUtils/CRTT0MatchAlg.h b/icaruscode/CRT/CRTUtils/CRTT0MatchAlg.h index 69d30bd46..72c268eae 100644 --- a/icaruscode/CRT/CRTUtils/CRTT0MatchAlg.h +++ b/icaruscode/CRT/CRTUtils/CRTT0MatchAlg.h @@ -56,6 +56,7 @@ #include // ROOT +#include #include "TVector3.h" #include "TGeoManager.h" From 75cac7948cc8dadbaa802df8ac47e8cbd4c007fc Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Wed, 16 Oct 2024 14:23:06 +0200 Subject: [PATCH 02/28] completed the utils files and corrected errors for the compiler --- icaruscode/CRT/CRTUtils/CRTMatchingUtils.cc | 69 ++++++++++++++------- icaruscode/CRT/CRTUtils/CRTMatchingUtils.h | 11 +++- 2 files changed, 57 insertions(+), 23 deletions(-) diff --git a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cc b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cc index 5d858e0e8..2759582a7 100644 --- a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cc +++ b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cc @@ -84,7 +84,7 @@ CrtPlane DeterminePlane(sbn::crt::CRTHit CRThit) return std::make_pair(Plane, Pos); } -CrossPoint CalculateProjection(double& dirx, double& diry, double& dirz, double& x0, double& y0, double& z0, double position) +ProjectionPoint CalculateProjection(double dirx, double diry, double dirz, double x0, double y0, double z0, double position) { double Lambda = (position-x0)/dirx; double PosAtY = (Lambda*diry+y0); @@ -94,25 +94,47 @@ CrossPoint CalculateProjection(double& dirx, double& diry, double& dirz, double& return CrossingPoint; } -CrossPoint DetermineProjection(Direction thisDir, int plane, double position) +CrossPoint CalculateForPlane(const Direction& dir, int plane, double position) { - CrossPoint CrossingPoint; - if(plane==0) // Plane at Y e.g. Top CRT Horizontal Plane - { - CrossPoint thisCase=CalculateProjection(thisDir.diry, thisDir.dirx, thisDir.dirz, thisDir.meany, thisDir.meanx, thisDir.meanz, position); - CrossingPoint={thisCase.Y, thisCase.X, thisCase.Z}; - } - else if (plane==1) // Plane at X e.g. Side CRT West, East, Top CRT Vertical Rim West and East - { - CrossPoint thisCase=CalculateProjection(thisDir.dirx, thisDir.diry, thisDir.dirz, thisDir.meanx, thisDir.meany, thisDir.meanz, position); - CrossingPoint={thisCase.X, thisCase.Y, thisCase.Z}; - } - else if (plane==2) // Plane at Z e.g. Side CRT South, North, Top CRT Vertical Rime South and North - { - CrossPoint thisCase=CalculateProjection(thisDir.dirz, thisDir.diry, thisDir.dirx, thisDir.meanz, thisDir.meany, thisDir.meanx, position); - CrossingPoint={thisCase.Z, thisCase.Y, thisCase.X}; + double dirX, dirY, dirZ; + double meanX, meanY, meanZ; + + switch(plane) { + case 0: // Piano a Y + dirX = dir.diry; dirY = dir.dirx; dirZ = dir.dirz; + meanX = dir.meany; meanY = dir.meanx; meanZ = dir.meanz; + break; + case 1: // Piano a X + dirX = dir.dirx; dirY = dir.diry; dirZ = dir.dirz; + meanX = dir.meanx; meanY = dir.meany; meanZ = dir.meanz; + break; + case 2: // Piano a Z + dirX = dir.dirz; dirY = dir.diry; dirZ = dir.dirx; + meanX = dir.meanz; meanY = dir.meany; meanZ = dir.meanx; + break; + default: + throw std::invalid_argument("Error"); + } + return CalculateProjection(static_cast(dirX), + static_cast(dirY), + static_cast(dirZ), + static_cast(meanX), + static_cast(meanY), + static_cast(meanZ), + static_cast(position)); +} + +CrossPoint DetermineProjection(const Direction& dir, int plane, double position) +{ + CrossPoint thisCase = CalculateForPlane(dir, plane, position); + + switch(plane) { + case 0: return {thisCase.Y, thisCase.X, thisCase.Z}; // Plane at Y e.g. Top CRT Horizontal Plane + case 1: return {thisCase.X, thisCase.Y, thisCase.Z}; // Plane at X e.g. Side CRT West, East, Top CRT + case 2: return {thisCase.Z, thisCase.Y, thisCase.X}; // Plane at Z e.g. Side CRT South, North, Top CRT + default: + throw std::invalid_argument("Error"); } - return CrossingPoint; } TrackBarycenter GetTrackBarycenter (std::vector hx, std::vector hy, std::vector hz, std::vector hw) @@ -308,8 +330,12 @@ TopCrtTransformations LoadTopCrtTransformations() { std::string fullFileName; cet::search_path searchPath("FW_SEARCH_PATH"); - searchPath.find_file("TopCrtCorrectionByTPC.txt",fullFileName); - std::ifstream corrFile.open(fullFileName,std::ios::in); + searchPath.find_file("TopCrtCorrectionByTPC.txt", fullFileName); + /*if (!searchPath.find_file("TopCrtCorrectionByTPC.txt", fullFileName)) { + mf::LogError("CRTMatchingUtils_LoadTopCrtTransformation") + << "Top CRT Correction transformation file not found in FW_SEARCH_PATH."; + }*/ + std::ifstream corrFile(fullFileName, std::ios::in); std::map Type0Corr; std::map Type1Corr; @@ -319,7 +345,8 @@ TopCrtTransformations LoadTopCrtTransformations() std::map Type5Corr; if (!corrFile.is_open()) { - mf::LogError("CRTMatchingUtils_LoadTopCrtTransformation") << "Top CRT Correction transformation file not found."; + mf::LogError("CRTMatchingUtils_LoadTopCrtTransformation") + << "Failed to open Top CRT Correction transformation file: " << fullFileName; } std::string line; while (std::getline(corrFile, line)) { diff --git a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h index d9648c66f..a2f9d52f1 100644 --- a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h +++ b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h @@ -11,6 +11,9 @@ #include #include #include +#include // Aggiunto per l'uso di ifstream +#include +#include #include #include #include @@ -79,6 +82,8 @@ struct CrossPoint double Z; }; +typedef CrossPoint ProjectionPoint; + struct TrackBarycenter { float BarX; // Track Barycenter X coordinate @@ -157,9 +162,11 @@ Direction PCAfit (std::vector x, std::vector y, std::vector CrtPlane DeterminePlane(sbn::crt::CRTHit CRThit); -CrossPoint CalculateProjection(double&, double&, double&, double&, double&, double&, double); +// ProjectionPoint CalculateProjection(double, double, double, double, double, double, double); + +// CrossPoint CalculateForPlane(const Direction& dir, int plane, double position); -CrossPoint DetermineProjection(Direction thisDir, int plane, double position); +CrossPoint DetermineProjection(const Direction& dir, int plane, double position); TrackBarycenter GetTrackBarycenter(std::vector hx, std::vector hy, std::vector hz, std::vector hw); From e1ae4c4a07421b2dff8673450638a7c9005c0baf Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Thu, 17 Oct 2024 10:49:37 +0200 Subject: [PATCH 03/28] This commit includes the introduction of a new module: CRTT0Tagging which create T0 objects for tracks matched with CRTs. It also create associations between tracks, CRT Hits and T0 objects. --- icaruscode/CRT/CRTT0Tagging_module.cc | 394 ++++++++++++++++++++ icaruscode/CRT/CRTUtils/CRTMatchingUtils.cc | 4 +- icaruscode/CRT/CRTUtils/CRTMatchingUtils.h | 11 +- 3 files changed, 405 insertions(+), 4 deletions(-) create mode 100644 icaruscode/CRT/CRTT0Tagging_module.cc diff --git a/icaruscode/CRT/CRTT0Tagging_module.cc b/icaruscode/CRT/CRTT0Tagging_module.cc new file mode 100644 index 000000000..6b14ed799 --- /dev/null +++ b/icaruscode/CRT/CRTT0Tagging_module.cc @@ -0,0 +1,394 @@ +///////////////////////////////////////////////////////////////////////////// +/// Class: CRTT0Tagging +/// Module Type: producer +/// File: CRTT0Tagging_module.cc +/// +/// Author: Francesco Poppi +/// E-mail address: poppi@bo.infn.it +/// October 2024 +/// +///////////////////////////////////////////////////////////////////////////// + +// sbndcode includes +#include "sbnobj/Common/CRT/CRTHit.hh" +#include "icaruscode/CRT/CRTUtils/CRTT0MatchAlg.h" + +// Framework includes +#include "art/Framework/Core/EDProducer.h" +#include "art/Framework/Core/ModuleMacros.h" +#include "canvas/Persistency/Common/FindManyP.h" +#include "art/Framework/Principal/Handle.h" +#include "art/Framework/Principal/Event.h" +#include "canvas/Persistency/Common/Ptr.h" +#include "canvas/Persistency/Common/PtrVector.h" +#include "art/Framework/Principal/Run.h" +#include "art/Framework/Principal/SubRun.h" +#include "art_root_io/TFileService.h" +#include "art_root_io/TFileDirectory.h" + +#include "canvas/Utilities/InputTag.h" +#include "fhiclcpp/ParameterSet.h" +#include "messagefacility/MessageLogger/MessageLogger.h" + +#include +#include +#include +#include +#include + +// LArSoft +#include "larcore/Geometry/Geometry.h" +#include "larcorealg/Geometry/GeometryCore.h" +#include "larcorealg/Geometry/PlaneGeo.h" +#include "larcorealg/Geometry/WireGeo.h" +#include "lardataobj/AnalysisBase/T0.h" +#include "lardataobj/RecoBase/Hit.h" +#include "lardataobj/RecoBase/Track.h" +#include "larcore/CoreUtils/ServiceUtil.h" // lar::providerFrom() +#include "lardata/Utilities/AssociationUtil.h" +#include "lardata/DetectorInfoServices/LArPropertiesService.h" +#include "lardata/DetectorInfoServices/DetectorPropertiesService.h" +#include "lardataobj/RawData/ExternalTrigger.h" +#include "larcoreobj/SimpleTypesAndConstants/PhysicalConstants.h" +#include "lardataobj/AnalysisBase/ParticleID.h" +#include "larsim/MCCheater/BackTrackerService.h" +#include "sbnobj/Common/Trigger/ExtraTriggerInfo.h" +#include "lardataobj/RecoBase/PFParticle.h" +#include "lardataobj/AnalysisBase/T0.h" +#include "lardataobj/RecoBase/PFParticleMetadata.h" +// ROOT +#include "TVector3.h" +#include "TH1.h" +#include "TH2.h" +#include "TVector3.h" +#include "TTree.h" + +#include "CRTMatchingUtils.h" + +namespace icarus { +namespace crt { + +class CRTT0Tagging; + +} // namespace crt +} // namespace icarus + +using namespace icarus::crt; + +class icarus::crt::CRTT0Tagging : public art::EDProducer { +public: + + using CRTHit = sbn::crt::CRTHit; + using CRTPMTMatching = sbn::crt::CRTPMTMatching; + + explicit CRTT0Tagging(fhicl::ParameterSet const& p); + + // The compiler-generated destructor is fine for non-base + // classes without bare pointers or other resource use. + + // Plugins should not be copied or assigned. + CRTT0Tagging(CRTT0Tagging const&) = delete; + CRTT0Tagging(CRTT0Tagging&&) = delete; + CRTT0Tagging& operator=(CRTT0Tagging const&) = delete; + CRTT0Tagging& operator=(CRTT0Tagging&&) = delete; + + // Required functions. + void beginRun(art::Run const& r) override; + void produce(art::Event const& e) override; + void endJob() override; + +private: + + // Declare member data here. + + art::InputTag fCrtHitModuleLabel; + art::InputTag fTriggerLabel; + art::InputTag fTriggerConfigurationLabel; + + std::vector fTPCTrackLabel; ///< labels for source of tracks + std::vector fPFParticleLabel; ///< labels for source of PFParticle + std::vector fHitLabel; ///< labels for source of hits + art::InputTag fTRKHMproducer; ///< labels for hit metadata + + std::optional fTriggerConfiguration; + + geo::GeometryCore const* fGeometryService; ///< pointer to Geometry provider + CRTCommonUtils* fCrtutils; + icarus::crt::matchingutils::TopCRTCentersMap fTopCRTCenterMap; + icarus::crt::matchingutils::TopCrtTransformations fTopCrtTransformations; + +}; + +icarus::crt::CRTT0Tagging::CRTT0Tagging(fhicl::ParameterSet const& p) + : EDProducer{p}, + fCrtHitModuleLabel(p.get("CrtHitModuleLabel", "crthit")), + fTriggerLabel(p.get("TriggerLabel", "daqTrigger")), + fTriggerConfigurationLabel( + p.get("TriggerConfiguration", "triggerconfig")), + fTPCTrackLabel(p.get< std::vector >("TPCTrackLabel", {""})), + fPFParticleLabel(p.get< std::vector >("PFParticleLabel", {""})), + fHitLabel(p.get< std::vector >("HitLabel", {""})), + fTRKHMproducer(p.get< art::InputTag > ("TRKHMproducer", "")), + crtutil(new CRTCommonUtils()) +{ + + // Get a pointer to the geometry service provider. + produces< std::vector >(); + produces< art::Assns >(); + produces< art::Assns >(); + fGeometryService = lar::providerFrom(); + + art::ServiceHandle tfs; + +} + +void icarus::crt::CRTT0Tagging::beginRun(art::Run const& r) +{ + // we don't know if this is data or not; if not, there will be no trigger config + auto const& trigConfHandle = + r.getHandle(fTriggerConfigurationLabel); + + fTriggerConfiguration + = trigConfHandle.isValid()? std::make_optional(*trigConfHandle): std::nullopt; + + fTopCRTCenterMap=icarus::crt::matchingutils::LoadTopCRTCenters(); + fTopCrtTransformations=icarus::crt::matchingutils::LoadTopCrtTransformations(); + +} + +void icarus::crt::CRTT0Tagging::produce(art::Event & e) +{ + + auto const clockData = art::ServiceHandle()->DataFor(e); + auto const detProp = art::ServiceHandle()->DataFor(e, clockData); + if (!fTriggerConfiguration) { + mf::LogDebug("CRTT0Tagging") + << "Skipping because no data (or at least no trigger configuration)."; + return; + } + + mf::LogDebug("CRTT0Tagging: ") << "beginning production" << '\n'; + + fEvent = e.id().event(); + fRun = e.run(); + fSubRun = e.subRun(); + + // add trigger info + if (!fTriggerLabel.empty()) { + art::Handle trigger_handle; + e.getByLabel(fTriggerLabel, trigger_handle); + if (trigger_handle.isValid()) { + sbn::triggerSource bit = trigger_handle->sourceType; + m_gate_type = (unsigned int)bit; + m_gate_name = bitName(bit); + m_trigger_timestamp = trigger_handle->triggerTimestamp; + m_gate_start_timestamp = trigger_handle->beamGateTimestamp; + m_trigger_gate_diff = + trigger_handle->triggerTimestamp - trigger_handle->beamGateTimestamp; + // Read Beam Gate Size + m_gate_width = fTriggerConfiguration->getGateWidth(m_gate_type); + } else { + mf::LogError("CRTT0Tagging:") + << "No sbn::ExtraTriggerInfo associated to label: " + << fTriggerLabel.encode() << "\n"; + } + } + + std::unique_ptr< std::vector > t0Col( new std::vector); + std::unique_ptr< art::Assns > trackAssn( new art::Assns); + std::unique_ptr< art::Assns > t0CrtHitAssn( new art::Assns ); + + // CRTHits + std::vector> CRTHitList; + art::ValidHandle> crthits = e.getValidHandle>(fCrtHitModuleLabel); + art::fill_ptr_vector(CRTHitList, crthits); + + int cryo=-1; + for(const auto& PFPLabel : fPFParticleLabel) { + cryo++; + auto it = &PFPLabel - fPFParticleLabel.data(); + std::vector> PFParticleList; + art::ValidHandle> pfparticles = e.getValidHandle>(PFPLabel); + art::fill_ptr_vector(PFParticleList, pfparticles); + + // Pandora MetaData + art::FindManyP fmt0pandora(pfparticles, e, PFPLabel); + art::FindManyP PFPMetaDataAssoc(pfparticles, e, PFPLabel); + + // Tracks + art::ValidHandle> tracks = e.getValidHandle>(fTPCTrackLabel[it]); + + // Track - associated data + art::FindManyP fmTracks(PFParticleList, e, fTPCTrackLabel[it]); + + // Collect all hits + art::ValidHandle> allhit_handle = e.getValidHandle>(fHitLabel[it]); + std::vector> allHits; + art::fill_ptr_vector(allHits, allhit_handle); + + // Start looping on the particles + for (art::Ptr p_pfp: PFParticleList) { + const std::vector> thisTrack = fmTracks.at(p_pfp.key()); + if (thisTrack.size() != 1) continue; + art::Ptr trkPtr = thisTrack.at(0); + const recob::Track &track = *trkPtr; + art::InputTag thm_label = fTRKHMproducer.empty() ? fTPCTrackLabel[it] : fTRKHMproducer; + art::FindManyP fmtrkHits(tracks, e, thm_label); + std::vector> emptyHitVector; + const std::vector> &trkHits = fmtrkHits.isValid() ? fmtrkHits.at(trkPtr.key()) : emptyHitVector; + std::vector emptyTHMVector; + const std::vector &trkHitMetas = fmtrkHits.isValid() ? fmtrkHits.data(trkPtr.key()) : emptyTHMVector; + + // T0 + float t0 = std::numeric_limits::signaling_NaN(); + auto t0s = fmt0pandora.at(p_pfp.key()); + if (!t0s.empty()){ + t0 = t0s[0]->Time(); //Get T0 + } + + int goodHits=0; + int countE=0, countW=0; + // These counters are used to determine if track is CC-E, EE, EW, CC-W, WE, WW + // depending on the track type, the Top CRT uses the appropriate position corretions + double trackRes=0, deltaP=0; + + std::vector hx, hy, hz, ht; + for(size_t i=0; iIndex() == std::numeric_limits::max()) || + (!track.HasValidPoint(trkHitMetas[i]->Index())); + geo::Point_t loc = track.LocationAtPoint(trkHitMetas[i]->Index()); + if(loc.X()==-999) continue; + if(badhit) continue; + hx.push_back(loc.X()); hy.push_back(loc.Y()); hz.push_back(loc.Z()); + ht.push_back(trkHits[i]->PeakTime()); + goodHits++; + if(trkHits[i]->WireID().TPC==0 || trkHits[i]->WireID().TPC==1) countE++; + else countW++; + + } + + if(countW!=0 && countE!=0 && cryo==0) trackType=0; //CCEast + else if(countW!=0 && countE==0 && cryo==0) trackType=2; //East-West + else if(countW==0 && countE!=0 && cryo==0) trackType=1; //East-East + else if(countW!=0 && countE!=0 && cryo==1) trackType=3; //CCWest + else if(countW!=0 && countE==0 && cryo==1) trackType=5; //West-West + else if(countW==0 && countE!=0 && cryo==1) trackType=4; //West-East + + icarus::crt::matchingutils::TopCRTCorrectionMap TopCrtCorrection; + if(trackType==0) TopCrtCorrection=fTopCrtTransformations.EastCC; + else if(trackType==1) TopCrtCorrection=fTopCrtTransformations.EE; + else if(trackType==2) TopCrtCorrection=fTopCrtTransformations.EW; + else if(trackType==3) TopCrtCorrection=fTopCrtTransformations.WestCC; + else if(trackType==4) TopCrtCorrection=fTopCrtTransformations.WE; + else if(trackType==5) TopCrtCorrection=fTopCrtTransformations.WW; + + for(size_t j=1; j crtCands; + + for(art::Ptr p_crthit: CRTHitList){ + const CRTHit &crtHit = *p_crthit; + double crtTime=crtHit.ts1_ns/1e3; + icarus::crt::matchingutils::DriftedTrack thisDriftedTrack = icarus::crt::matchingutils::DriftTrack(trkHits, trkHitMetas, fGeometryService, detProp, crtTime, cryo, track); + if(thisDriftedTrack.outbound>0) continue; + driftedTrackDir=icarus::crt::matchingutils::PCAfit(thisDriftedTrack.spx, thisDriftedTrack.spy, thisDriftedTrack.spz); + + int crtSys=-1; + if(crtHit.plane<=34) crtSys=0; + else if (crtHit.plane==50) crtSys=2; + else crtSys=1; + if(crtSys==2) continue; // lets discard Bottom CRT Hits for the moment + + double deltaX=std::numeric_limits::signaling_NaN(); + double deltaZ=std::numeric_limits::signaling_NaN(); + double crtDistance=std::numeric_limits::signaling_NaN(); + + icarus::crt::matchingutils::CrtPlane thisCrtPlane = icarus::crt::triplematching::DeterminePlane(crtHit); + icarus::crt::matchingutils::CrossPoint crossPoint = icarus::crt::matchingutils::DetermineProjection(driftedTrackDir, thisCrtPlane); + + double crtX=crtHit.x_pos; + double crtY=crtHit.y_pos; + double crtZ=crtHit.z_pos; + + if(crtSys==0){ + double centerDX, centerDY, centerDZ; + centerDX=crtX-fTopCRTCenterMap[(int)crtHit.feb_id[0]].X; + centerDY=crtY-fTopCRTCenterMap[(int)crtHit.feb_id[0]].Y; + centerDZ=crtZ-fTopCRTCenterMap[(int)crtHit.feb_id[0]].Z; + icarus::crt::matchingutils::AffineTrans thisAffine=TopCrtCorrection[(int)crtHit.feb_id[0]]; + std::pair transCrt; + if(crtHit.plane==30) { + transCrt=icarus::crt::matchingutils::AffineTransformation(centerDX, centerDZ, thisAffine); + crtX=transCrt.first; + crtZ=transCrt.second; + } else if(crtHit.plane==31 ||crtHit.plane==32) { + transCrt=icarus::crt::matchingutils::AffineTransformation(centerDY, centerDZ, thisAffine); + crtY=transCrt.first; + crtZ=transCrt.second; + } else if(crtHit.plane==33 ||crtHit.plane==34){ + transCrt=icarus::crt::matchingutils::AffineTransformation(centerDX, centerDY, thisAffine); + crtX=transCrt.first; + crtY=transCrt.second; + } + } + if(thisCrtPlane.first==0){ + deltaX=crtX-crossPoint.X; + deltaZ=crtZ-crossPoint.Z; + } else if(thisCrtPlane.first==1){ + deltaX=crtY-crossPoint.Y; + deltaZ=crtZ-crossPoint.Z; + } else if(thisCrtPlane.first==2){ + deltaX=crtX-crossPoint.X; + deltaZ=crtY-crossPoint.Y; + } + crtDistance=sqrt(pow(deltaX,2)+pow(deltaZ,2)); + if(crtDistance>300) continue; + icarus::crt::matchingutils::CandCRT thisCrtCand={crtHit, crtDistance, deltaX, deltaZ}; + crtCands.push_back(thisCrtCand); + } // End of CRT Hit loop + if(crtCands.empty()) { + mf::LogDebug("CRTT0Tagging:")<<"No Good CRT match candidates for this track"; + continue; + } + auto minElementIt = std::min_element(crtCands.begin(), crtCands.end(), [](const icarus::crt::matchingutils::CandCRT& a, const icarus::crt::matchingutils::CandCRT& b) { + return a.distance < b.distance; + }); + icarus::crt::matchingutils::CandCRT& bestCrtCand=*minElementIt; + if(bestCrtCand.distance<=96){ + int matchedSys=-1; + if(bestCrtCand.crtHit.plane<=34) matchedSys=0; + else if (bestCrtCand.crtHit.plane==50) matchedSys=2; + else matchedSys=1; + if(matchedSys==2) continue; // lets discard Bottom CRT Hits for the moment + mf::LogInfo("CRTT0Tagging") + <<"Matched CRT time = "< fTriggerConfiguration; geo::GeometryCore const* fGeometryService; ///< pointer to Geometry provider - CRTCommonUtils* fCrtutils; + CRTCommonUtils* fCrtUtils; icarus::crt::matchingutils::TopCRTCentersMap fTopCRTCenterMap; icarus::crt::matchingutils::TopCrtTransformations fTopCrtTransformations; @@ -129,20 +128,21 @@ icarus::crt::CRTT0Tagging::CRTT0Tagging(fhicl::ParameterSet const& p) fPFParticleLabel(p.get< std::vector >("PFParticleLabel", {""})), fHitLabel(p.get< std::vector >("HitLabel", {""})), fTRKHMproducer(p.get< art::InputTag > ("TRKHMproducer", "")), - crtutil(new CRTCommonUtils()) + fCrtUtils(new CRTCommonUtils()) { // Get a pointer to the geometry service provider. produces< std::vector >(); produces< art::Assns >(); produces< art::Assns >(); + fGeometryService = lar::providerFrom(); art::ServiceHandle tfs; } -void icarus::crt::CRTT0Tagging::beginRun(art::Run const& r) +void icarus::crt::CRTT0Tagging::beginRun(art::Run& r) { // we don't know if this is data or not; if not, there will be no trigger config auto const& trigConfHandle = @@ -156,7 +156,7 @@ void icarus::crt::CRTT0Tagging::beginRun(art::Run const& r) } -void icarus::crt::CRTT0Tagging::produce(art::Event & e) +void icarus::crt::CRTT0Tagging::produce(art::Event& e) { auto const clockData = art::ServiceHandle()->DataFor(e); @@ -168,35 +168,12 @@ void icarus::crt::CRTT0Tagging::produce(art::Event & e) } mf::LogDebug("CRTT0Tagging: ") << "beginning production" << '\n'; - - fEvent = e.id().event(); - fRun = e.run(); - fSubRun = e.subRun(); - - // add trigger info - if (!fTriggerLabel.empty()) { - art::Handle trigger_handle; - e.getByLabel(fTriggerLabel, trigger_handle); - if (trigger_handle.isValid()) { - sbn::triggerSource bit = trigger_handle->sourceType; - m_gate_type = (unsigned int)bit; - m_gate_name = bitName(bit); - m_trigger_timestamp = trigger_handle->triggerTimestamp; - m_gate_start_timestamp = trigger_handle->beamGateTimestamp; - m_trigger_gate_diff = - trigger_handle->triggerTimestamp - trigger_handle->beamGateTimestamp; - // Read Beam Gate Size - m_gate_width = fTriggerConfiguration->getGateWidth(m_gate_type); - } else { - mf::LogError("CRTT0Tagging:") - << "No sbn::ExtraTriggerInfo associated to label: " - << fTriggerLabel.encode() << "\n"; - } - } - std::unique_ptr< std::vector > t0Col( new std::vector); - std::unique_ptr< art::Assns > trackAssn( new art::Assns); - std::unique_ptr< art::Assns > t0CrtHitAssn( new art::Assns ); + auto t0TaggedTracksColl = std::make_unique>(); + art::PtrMaker const makeInfoPtr(e); + auto trackAssociation = std::make_unique>(); + auto crtAssociation = std::make_unique>(); + auto trackAndCrtAssociation = std::make_unique>(); // CRTHits std::vector> CRTHitList; @@ -239,13 +216,15 @@ void icarus::crt::CRTT0Tagging::produce(art::Event & e) std::vector emptyTHMVector; const std::vector &trkHitMetas = fmtrkHits.isValid() ? fmtrkHits.data(trkPtr.key()) : emptyTHMVector; + if(track.Length()<40) continue; + // T0 float t0 = std::numeric_limits::signaling_NaN(); auto t0s = fmt0pandora.at(p_pfp.key()); if (!t0s.empty()){ t0 = t0s[0]->Time(); //Get T0 } - + if(!isnan(t0)) std::cout<<"This Track T0 "<10) std::cout<<"Track Res very bad "< crtCands; for(art::Ptr p_crthit: CRTHitList){ @@ -301,7 +281,7 @@ void icarus::crt::CRTT0Tagging::produce(art::Event & e) double crtTime=crtHit.ts1_ns/1e3; icarus::crt::matchingutils::DriftedTrack thisDriftedTrack = icarus::crt::matchingutils::DriftTrack(trkHits, trkHitMetas, fGeometryService, detProp, crtTime, cryo, track); if(thisDriftedTrack.outbound>0) continue; - driftedTrackDir=icarus::crt::matchingutils::PCAfit(thisDriftedTrack.spx, thisDriftedTrack.spy, thisDriftedTrack.spz); + icarus::crt::matchingutils::Direction driftedTrackDir=icarus::crt::matchingutils::PCAfit(thisDriftedTrack.spx, thisDriftedTrack.spy, thisDriftedTrack.spz); int crtSys=-1; if(crtHit.plane<=34) crtSys=0; @@ -313,7 +293,7 @@ void icarus::crt::CRTT0Tagging::produce(art::Event & e) double deltaZ=std::numeric_limits::signaling_NaN(); double crtDistance=std::numeric_limits::signaling_NaN(); - icarus::crt::matchingutils::CrtPlane thisCrtPlane = icarus::crt::triplematching::DeterminePlane(crtHit); + icarus::crt::matchingutils::CrtPlane thisCrtPlane = icarus::crt::matchingutils::DeterminePlane(crtHit); icarus::crt::matchingutils::CrossPoint crossPoint = icarus::crt::matchingutils::DetermineProjection(driftedTrackDir, thisCrtPlane); double crtX=crtHit.x_pos; @@ -353,7 +333,7 @@ void icarus::crt::CRTT0Tagging::produce(art::Event & e) } crtDistance=sqrt(pow(deltaX,2)+pow(deltaZ,2)); if(crtDistance>300) continue; - icarus::crt::matchingutils::CandCRT thisCrtCand={crtHit, crtDistance, deltaX, deltaZ}; + icarus::crt::matchingutils::CandCRT thisCrtCand={crtHit,p_crthit, crtDistance, deltaX, deltaZ}; crtCands.push_back(thisCrtCand); } // End of CRT Hit loop if(crtCands.empty()) { @@ -366,23 +346,30 @@ void icarus::crt::CRTT0Tagging::produce(art::Event & e) icarus::crt::matchingutils::CandCRT& bestCrtCand=*minElementIt; if(bestCrtCand.distance<=96){ int matchedSys=-1; - if(bestCrtCand.crtHit.plane<=34) matchedSys=0; - else if (bestCrtCand.crtHit.plane==50) matchedSys=2; + if(bestCrtCand.CRThit.plane<=34) matchedSys=0; + else if (bestCrtCand.CRThit.plane==50) matchedSys=2; else matchedSys=1; if(matchedSys==2) continue; // lets discard Bottom CRT Hits for the moment mf::LogInfo("CRTT0Tagging") <<"Matched CRT time = "< ptrCRThit; double distance; double deltaX; double deltaZ; From 3fa0f3f76e8cb959da83b98bee37c4265414d71a Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Thu, 17 Oct 2024 16:44:50 +0200 Subject: [PATCH 06/28] Some More changes but the compiler still does not like it. --- icaruscode/CRT/CMakeLists.txt | 107 +++++++++++------- icaruscode/CRT/CRTT0Tagging_module.cc | 2 +- icaruscode/CRT/CRTUtils/CMakeLists.txt | 6 +- ...TMatchingUtils.cc => CRTMatchingUtils.cxx} | 0 icaruscode/CRT/CRTUtils/CRTMatchingUtils.h | 2 +- icaruscode/CRT/crtt0tagging_icarus.fcl | 16 +++ 6 files changed, 87 insertions(+), 46 deletions(-) rename icaruscode/CRT/CRTUtils/{CRTMatchingUtils.cc => CRTMatchingUtils.cxx} (100%) create mode 100644 icaruscode/CRT/crtt0tagging_icarus.fcl diff --git a/icaruscode/CRT/CMakeLists.txt b/icaruscode/CRT/CMakeLists.txt index 55f30fe69..5fa14791a 100644 --- a/icaruscode/CRT/CMakeLists.txt +++ b/icaruscode/CRT/CMakeLists.txt @@ -2,7 +2,6 @@ add_subdirectory(CRTUtils) add_subdirectory(CRTDecoder) - art_make( NO_PLUGINS EXCLUDE @@ -13,7 +12,6 @@ art_make( CRTTrueHitProducer_module.cc CRTTzeroProducer_module.cc CRTTrackProducer_module.cc - CRTT0Tagging_module.cc CRTSimAnalysis_module.cc CRTDataAnalysis_module.cc CrtOpHitMatchAnalysis_module.cc @@ -25,6 +23,7 @@ art_make( CRTTPCMatchingAna_module.cc CRTPMTMatchingAna_module.cc CRTTPCTruthEff_module.cc + CRTT0Tagging_module.cc LIBRARY_NAME icaruscode_CRTData SOURCE @@ -63,6 +62,41 @@ art_make_library( cetlib::cetlib ) +art_make_library( + LIBRARY_NAME + icaruscode_CRTMatchingUtils + SOURCE + CRTUtils/CRTMatchingUtils.cxx + LIBRARIES + sbnobj::ICARUS_CRT + sbnobj::Common_CRT + icaruscode_CRTUtils + larcorealg::Geometry + larcore::Geometry_Geometry_service + larsim::Simulation lardataobj::Simulation + larsim::MCCheater_BackTrackerService_service + larsim::MCCheater_ParticleInventoryService_service + lardata::Utilities + larevt::Filters + lardataobj::RawData + lardataobj::RecoBase + lardataobj::AnalysisBase + lardata::RecoObjects + larpandora::LArPandoraInterface + larcorealg::Geometry + nusimdata::SimulationBase + art::Persistency_Common canvas::canvas + art::Persistency_Provenance + art::Utilities + ROOT::Core + ROOT::Geom + ROOT::XMLIO + ROOT::Gdml + ROOT::Spectrum + ROOT::RooFit + ROOT::RooFitCore + ) + cet_build_plugin(CRTGeometryHelper art::service LIBRARIES larcorealg::Geometry @@ -165,44 +199,6 @@ cet_build_plugin(CRTTrackProducer art::module CLHEP::CLHEP ) -cet_build_plugin(CRTT0Tagging art::module - LIBRARIES - icaruscode_CRTData - icaruscode_CRT - sbnobj::Common_CRT - icaruscode_CRTUtils - larcore::Geometry_Geometry_service - larsim::Simulation lardataobj::Simulation - larsim::MCCheater_BackTrackerService_service - larsim::MCCheater_ParticleInventoryService_service - lardata::Utilities - larevt::Filters - lardataobj::RawData - lardataobj::RecoBase - lardataobj::AnalysisBase - lardata::RecoObjects - larpandora::LArPandoraInterface - larcorealg::Geometry - nusimdata::SimulationBase - art::Framework_Core - art::Framework_Principal - art::Framework_Services_Registry - art_root_io::tfile_support - art_root_io::TFileService_service - art::Persistency_Common canvas::canvas - art::Persistency_Provenance - art::Utilities - messagefacility::MF_MessageLogger - ROOT::Core - ROOT::Geom - ROOT::XMLIO - ROOT::Gdml - ROOT::Tree - ROOT::Spectrum - ROOT::RooFit - ROOT::RooFitCore - ) - cet_build_plugin(CRTSimAnalysis art::module LIBRARIES sbnobj::ICARUS_CRT @@ -556,6 +552,37 @@ simple_plugin(CRTTPCTruthEff module ) +cet_build_plugin(CRTT0Tagging art::module + LIBRARIES + icaruscode_CRTMatchingUtils + sbnobj::ICARUS_CRT + sbnobj::Common_CRT + icaruscode_CRTUtils + larcorealg::Geometry + larcore::Geometry_Geometry_service + larsim::Simulation lardataobj::Simulation + larsim::MCCheater_BackTrackerService_service + larsim::MCCheater_ParticleInventoryService_service + lardata::Utilities + larevt::Filters + lardataobj::RawData + lardataobj::RecoBase + lardataobj::AnalysisBase + lardata::RecoObjects + larpandora::LArPandoraInterface + larcorealg::Geometry + nusimdata::SimulationBase + art::Persistency_Common canvas::canvas + art::Persistency_Provenance + art::Utilities + ROOT::Core + ROOT::Geom + ROOT::XMLIO + ROOT::Gdml + ROOT::Spectrum + ROOT::RooFit + ROOT::RooFitCore + ) install_headers() install_fhicl() diff --git a/icaruscode/CRT/CRTT0Tagging_module.cc b/icaruscode/CRT/CRTT0Tagging_module.cc index 95c026959..3a0869ce3 100644 --- a/icaruscode/CRT/CRTT0Tagging_module.cc +++ b/icaruscode/CRT/CRTT0Tagging_module.cc @@ -62,7 +62,7 @@ #include "TVector3.h" #include "TTree.h" -#include "CRTUtils/CRTMatchingUtils.h" +#include "icaruscode/CRT/CRTUtils/CRTMatchingUtils.h" namespace icarus { namespace crt { diff --git a/icaruscode/CRT/CRTUtils/CMakeLists.txt b/icaruscode/CRT/CRTUtils/CMakeLists.txt index 74c5401f0..2c36bdafa 100644 --- a/icaruscode/CRT/CRTUtils/CMakeLists.txt +++ b/icaruscode/CRT/CRTUtils/CMakeLists.txt @@ -1,9 +1,9 @@ +add_subdirectory(CRTScripts) + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") cet_add_compiler_flags(CXX -Wno-maybe-uninitialized) endif() art_make_library(LIBRARY_NAME icaruscode_CRTUtils - SOURCES - CRTMatchingUtils.cc LIBRARIES larcorealg::Geometry larcore::Geometry_Geometry_service @@ -48,5 +48,3 @@ art_make_library(LIBRARY_NAME icaruscode_CRTUtils install_headers() install_fhicl() install_source() - -add_subdirectory(CRTScripts) \ No newline at end of file diff --git a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cc b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx similarity index 100% rename from icaruscode/CRT/CRTUtils/CRTMatchingUtils.cc rename to icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx diff --git a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h index f2961a6de..2816bfd8c 100644 --- a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h +++ b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h @@ -182,4 +182,4 @@ DriftedTrack DriftTrack(const std::vector>& trkHits, const } -#endif \ No newline at end of file +#endif // CRTMATCHINGUTILS_H \ No newline at end of file diff --git a/icaruscode/CRT/crtt0tagging_icarus.fcl b/icaruscode/CRT/crtt0tagging_icarus.fcl new file mode 100644 index 000000000..ab9815dee --- /dev/null +++ b/icaruscode/CRT/crtt0tagging_icarus.fcl @@ -0,0 +1,16 @@ +#include "CRTUtils/CRTMatchingUtils.h" + +BEGIN_PROLOG + +standard_crtt0tagging: +{ + module_type: "CRTT0Tagging" + CrtHitModuleLabel: "crthit" + TriggerLabel: "daqTrigger" + TriggerConfiguration: "triggerconfig" + TPCTrackLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # Track producer module label + PFParticleLabel: ["pandoraGausCryoE", "pandoraGausCryoW"] # PFParticle producer module label + HitLabel: ["cluster3DCryoE" , "cluster3DCryoW"] +} + +END_PROLOG From 4333f9c257798f882cbccd5760848afd12cba7e7 Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Mon, 21 Oct 2024 14:10:28 +0200 Subject: [PATCH 07/28] Moved CRTMatching namespace to a class. Adjusted CRTT0Tagging module. Compilation works. --- icaruscode/CRT/CMakeLists.txt | 1 - icaruscode/CRT/CRTT0Tagging_module.cc | 46 +- icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx | 707 ++++++++++--------- icaruscode/CRT/CRTUtils/CRTMatchingUtils.h | 31 +- 4 files changed, 406 insertions(+), 379 deletions(-) diff --git a/icaruscode/CRT/CMakeLists.txt b/icaruscode/CRT/CMakeLists.txt index 5fa14791a..1a1f6c0b6 100644 --- a/icaruscode/CRT/CMakeLists.txt +++ b/icaruscode/CRT/CMakeLists.txt @@ -23,7 +23,6 @@ art_make( CRTTPCMatchingAna_module.cc CRTPMTMatchingAna_module.cc CRTTPCTruthEff_module.cc - CRTT0Tagging_module.cc LIBRARY_NAME icaruscode_CRTData SOURCE diff --git a/icaruscode/CRT/CRTT0Tagging_module.cc b/icaruscode/CRT/CRTT0Tagging_module.cc index 3a0869ce3..20ebc8093 100644 --- a/icaruscode/CRT/CRTT0Tagging_module.cc +++ b/icaruscode/CRT/CRTT0Tagging_module.cc @@ -11,6 +11,7 @@ #include "sbnobj/Common/CRT/CRTHit.hh" //#include "icaruscode/CRT/CRTUtils/CRTT0MatchAlg.h" +#include "icaruscode/CRT/CRTUtils/CRTMatchingUtils.h" // Framework includes #include "art/Framework/Core/EDProducer.h" @@ -62,8 +63,6 @@ #include "TVector3.h" #include "TTree.h" -#include "icaruscode/CRT/CRTUtils/CRTMatchingUtils.h" - namespace icarus { namespace crt { @@ -113,8 +112,10 @@ class icarus::crt::CRTT0Tagging : public art::EDProducer { geo::GeometryCore const* fGeometryService; ///< pointer to Geometry provider CRTCommonUtils* fCrtUtils; - icarus::crt::matchingutils::TopCRTCentersMap fTopCRTCenterMap; - icarus::crt::matchingutils::TopCrtTransformations fTopCrtTransformations; + icarus::crt::TopCRTCentersMap fTopCRTCenterMap; + icarus::crt::TopCrtTransformations fTopCrtTransformations; + + CRTMatchingAlg fMatchingAlg; }; @@ -128,7 +129,8 @@ icarus::crt::CRTT0Tagging::CRTT0Tagging(fhicl::ParameterSet const& p) fPFParticleLabel(p.get< std::vector >("PFParticleLabel", {""})), fHitLabel(p.get< std::vector >("HitLabel", {""})), fTRKHMproducer(p.get< art::InputTag > ("TRKHMproducer", "")), - fCrtUtils(new CRTCommonUtils()) + fCrtUtils(new CRTCommonUtils()), + fMatchingAlg(p.get ("MatchingAlg")) { // Get a pointer to the geometry service provider. @@ -151,8 +153,8 @@ void icarus::crt::CRTT0Tagging::beginRun(art::Run& r) fTriggerConfiguration = trigConfHandle.isValid()? std::make_optional(*trigConfHandle): std::nullopt; - fTopCRTCenterMap=icarus::crt::matchingutils::LoadTopCRTCenters(); - fTopCrtTransformations=icarus::crt::matchingutils::LoadTopCrtTransformations(); + fTopCRTCenterMap=icarus::crt::LoadTopCRTCenters(); + fTopCrtTransformations=icarus::crt::LoadTopCrtTransformations(); } @@ -254,7 +256,7 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) else if(countW!=0 && countE==0 && cryo==1) trackType=5; //West-West else if(countW==0 && countE!=0 && cryo==1) trackType=4; //West-East - icarus::crt::matchingutils::TopCRTCorrectionMap TopCrtCorrection; + icarus::crt::TopCRTCorrectionMap TopCrtCorrection; if(trackType==0) TopCrtCorrection=fTopCrtTransformations.EastCC; else if(trackType==1) TopCrtCorrection=fTopCrtTransformations.EE; else if(trackType==2) TopCrtCorrection=fTopCrtTransformations.EW; @@ -267,21 +269,21 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) trackRes= track.Length()/goodHits; deltaP = deltaP/(goodHits-1); if(trackRes>10) std::cout<<"Track Res very bad "< crtCands; + trackPCADir=fMatchingAlg.PCAfit(hx, hy, hz); + std::vector crtCands; for(art::Ptr p_crthit: CRTHitList){ const CRTHit &crtHit = *p_crthit; double crtTime=crtHit.ts1_ns/1e3; - icarus::crt::matchingutils::DriftedTrack thisDriftedTrack = icarus::crt::matchingutils::DriftTrack(trkHits, trkHitMetas, fGeometryService, detProp, crtTime, cryo, track); + icarus::crt::DriftedTrack thisDriftedTrack = fMatchingAlg.DriftTrack(trkHits, trkHitMetas, fGeometryService, detProp, crtTime, cryo, track); if(thisDriftedTrack.outbound>0) continue; - icarus::crt::matchingutils::Direction driftedTrackDir=icarus::crt::matchingutils::PCAfit(thisDriftedTrack.spx, thisDriftedTrack.spy, thisDriftedTrack.spz); + icarus::crt::Direction driftedTrackDir=fMatchingAlg.PCAfit(thisDriftedTrack.spx, thisDriftedTrack.spy, thisDriftedTrack.spz); int crtSys=-1; if(crtHit.plane<=34) crtSys=0; @@ -293,8 +295,8 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) double deltaZ=std::numeric_limits::signaling_NaN(); double crtDistance=std::numeric_limits::signaling_NaN(); - icarus::crt::matchingutils::CrtPlane thisCrtPlane = icarus::crt::matchingutils::DeterminePlane(crtHit); - icarus::crt::matchingutils::CrossPoint crossPoint = icarus::crt::matchingutils::DetermineProjection(driftedTrackDir, thisCrtPlane); + icarus::crt::CrtPlane thisCrtPlane = fMatchingAlg.DeterminePlane(crtHit); + icarus::crt::CrossPoint crossPoint = fMatchingAlg.DetermineProjection(driftedTrackDir, thisCrtPlane); double crtX=crtHit.x_pos; double crtY=crtHit.y_pos; @@ -305,18 +307,18 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) centerDX=crtX-fTopCRTCenterMap[(int)crtHit.feb_id[0]].X; centerDY=crtY-fTopCRTCenterMap[(int)crtHit.feb_id[0]].Y; centerDZ=crtZ-fTopCRTCenterMap[(int)crtHit.feb_id[0]].Z; - icarus::crt::matchingutils::AffineTrans thisAffine=TopCrtCorrection[(int)crtHit.feb_id[0]]; + icarus::crt::AffineTrans thisAffine=TopCrtCorrection[(int)crtHit.feb_id[0]]; std::pair transCrt; if(crtHit.plane==30) { - transCrt=icarus::crt::matchingutils::AffineTransformation(centerDX, centerDZ, thisAffine); + transCrt=icarus::crt::AffineTransformation(centerDX, centerDZ, thisAffine); crtX=transCrt.first; crtZ=transCrt.second; } else if(crtHit.plane==31 ||crtHit.plane==32) { - transCrt=icarus::crt::matchingutils::AffineTransformation(centerDY, centerDZ, thisAffine); + transCrt=icarus::crt::AffineTransformation(centerDY, centerDZ, thisAffine); crtY=transCrt.first; crtZ=transCrt.second; } else if(crtHit.plane==33 ||crtHit.plane==34){ - transCrt=icarus::crt::matchingutils::AffineTransformation(centerDX, centerDY, thisAffine); + transCrt=icarus::crt::AffineTransformation(centerDX, centerDY, thisAffine); crtX=transCrt.first; crtY=transCrt.second; } @@ -333,17 +335,17 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) } crtDistance=sqrt(pow(deltaX,2)+pow(deltaZ,2)); if(crtDistance>300) continue; - icarus::crt::matchingutils::CandCRT thisCrtCand={crtHit,p_crthit, crtDistance, deltaX, deltaZ}; + icarus::crt::CandCRT thisCrtCand={crtHit,p_crthit, crtDistance, deltaX, deltaZ}; crtCands.push_back(thisCrtCand); } // End of CRT Hit loop if(crtCands.empty()) { mf::LogDebug("CRTT0Tagging:")<<"No Good CRT match candidates for this track"; continue; } - auto minElementIt = std::min_element(crtCands.begin(), crtCands.end(), [](const icarus::crt::matchingutils::CandCRT& a, const icarus::crt::matchingutils::CandCRT& b) { + auto minElementIt = std::min_element(crtCands.begin(), crtCands.end(), [](const icarus::crt::CandCRT& a, const icarus::crt::CandCRT& b) { return a.distance < b.distance; }); - icarus::crt::matchingutils::CandCRT& bestCrtCand=*minElementIt; + icarus::crt::CandCRT& bestCrtCand=*minElementIt; if(bestCrtCand.distance<=96){ int matchedSys=-1; if(bestCrtCand.CRThit.plane<=34) matchedSys=0; diff --git a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx index d560cd80b..e467aae6e 100644 --- a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx +++ b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx @@ -7,379 +7,392 @@ #include "icaruscode/CRT/CRTUtils/CRTMatchingUtils.h" -using namespace icarus::crt::matchingutils; +namespace icarus::crt{ -Direction PCAfit (std::vector x, std::vector y, std::vector z) -{ - int min=0; - int max=x.size(); - int size=max-min; - double xavg=0, yavg=0, zavg=0; - for(int k=min; kmax_eval){ - max_eval = this_eval[k][k]; - maxevalpos = k; - }//end if(this_eval[k][k]>max_eval) - }//end loop looking for best eval - - Direction thDirection= {this_evec[0][maxevalpos] , this_evec[1][maxevalpos], this_evec[2][maxevalpos], xavg, yavg, zavg}; - return thDirection; -} + TopCRTCentersMap LoadTopCRTCenters() + { + TopCRTCentersMap TopCRTCenters; -CrtPlane DeterminePlane(sbn::crt::CRTHit CRThit) -{ - int Plane; - double Pos; - if(CRThit.plane==30) { - Plane=0; - Pos=CRThit.y_pos; + TopCRTCenters = {{108, { -460.975, 617.388,-1050.61}}, + {109, { -460.975,617.388,-866.215}}, + {110, { -460.975,617.388,-681.825}}, + {111, { -460.975,617.388,-497.435}}, + {112, { -460.975,617.388,-313.045}}, + {113, { -460.975,617.388,-128.655}}, + {114, { -460.975,617.388,55.735}}, + {115, { -460.975,617.388,240.125}}, + {116, { -460.975,617.388,424.515}}, + {117, { -460.975,617.388,608.905}}, + {118, { -460.975,617.388,793.295}}, + {119, { -460.975,617.388,977.685}}, + {120, { -460.975,617.388,1162.07}}, + {121, { -460.975,617.388,1346.46}}, + {122, { -276.585,617.388,-1050.61}}, + {123, { -276.585,617.388,-866.215}}, + {124, { -276.585,617.388,-681.825}}, + {125, { -276.585,617.388,-497.435}}, + {126, { -276.585,617.388,-313.045}}, + {127, { -276.585,617.388,-128.655}}, + {128, { -276.585,617.388, 55.735}}, + {129, { -276.585,617.388, 240.125}}, + {130, { -276.585,617.388, 424.515}}, + {131, { -276.585,617.388, 608.905}}, + {132, { -276.585,617.388, 793.295}}, + {133, { -276.585,617.388, 977.685}}, + {134, { -276.585,617.388, 1162.07}}, + {135, { -276.585,617.388, 1346.46}}, + {136, { -92.195 ,617.388,-1050.61}}, + {137, { -92.195 ,617.388,-866.215}}, + {138, { -92.195 ,617.388,-681.825}}, + {139, { -92.195 ,617.388,-497.435}}, + {140, { -92.195 ,617.388,-313.045}}, + {141, { -92.195 ,617.388,-128.655}}, + {142, { -92.195 ,617.388, 55.735}}, + {143, { -92.195 ,617.388, 240.125}}, + {144, { -92.195 ,617.388, 424.515}}, + {145, { -92.195 ,617.388, 608.905}}, + {146, { -92.195 ,617.388, 793.295}}, + {147, { -92.195 ,617.388, 977.685}}, + {148, { -92.195 ,617.388, 1162.07}}, + {149, { -92.195 ,617.388, 1346.46}}, + {150, { 92.195 , 617.388, -1050.61}}, + {151, { 92.195 , 617.388, -866.215}}, + {152, { 92.195 , 617.388, -681.825}}, + {153, { 92.195 , 617.388, -497.435}}, + {154, { 92.195 , 617.388, -313.045}}, + {155, { 92.195 , 617.388, -128.655}}, + {156, { 92.195 ,617.388, 55.735}}, + {157, { 92.195 ,617.388, 240.125}}, + {158, { 92.195 ,617.388, 424.515}}, + {159, { 92.195 ,617.388, 608.905}}, + {160, { 92.195 ,617.388, 793.295}}, + {161, { 92.195 ,617.388, 977.685}}, + {162, { 92.195 ,617.388, 1162.07}}, + {163, { 92.195 ,617.388, 1346.46}}, + {164, { 276.585,617.388, -1050.61}}, + {165, { 276.585,617.388, -866.215}}, + {166, { 276.585,617.388, -681.825}}, + {167, { 276.585,617.388, -497.435}}, + {168, { 276.585,617.388, -313.045}}, + {169, { 276.585,617.388, -128.655}}, + {170, { 276.585,617.388, 55.735}}, + {171, { 276.585,617.388, 240.125}}, + {172, { 276.585,617.388, 424.515}}, + {173, { 276.585,617.388, 608.905}}, + {174, { 276.585,617.388, 793.295}}, + {175, { 276.585,617.388, 977.685}}, + {176, { 276.585,617.388, 1162.07}}, + {177, { 276.585,617.388, 1346.46}}, + {178, { 460.975,617.388, -1050.61}}, + {179, { 460.975,617.388, -866.215}}, + {180, { 460.975,617.388, -681.825}}, + {181, { 460.975,617.388, -497.435}}, + {182, { 460.975,617.388, -313.045}}, + {183, { 460.975,617.388, -128.655}}, + {184, { 460.975,617.388, 55.735}}, + {185, { 460.975,617.388, 240.125}}, + {186, { 460.975,617.388, 424.515}}, + {187, { 460.975,617.388, 608.905}}, + {188, { 460.975,617.388, 793.295}}, + {189, { 460.975,617.388, 977.685}}, + {190, { 460.975,617.388, 1162.07}}, + {191, { 460.975,617.388, 1346.46}}, + {192, { 555.265, 496.038, -1050.61}}, + {193, { 555.265, 496.038, -866.215}}, + {194, { 555.265, 496.038, -681.825}}, + {195, { 555.265, 496.038, -497.435}}, + {196, { 555.265, 496.038, -313.045}}, + {197, { 555.265, 496.038, -128.655}}, + {198, { 555.265, 496.038, 55.735}}, + {199, { 555.265, 496.038, 240.125}}, + {200, { 555.265, 496.038, 424.515}}, + {201, { 555.265, 496.038, 608.905}}, + {202, { 555.265, 496.038, 793.295}}, + {203, { 555.265, 496.038, 977.685}}, + {204, { 555.265, 496.038, 1162.07}}, + {205, { 555.265, 496.038, 1346.46}}, + {206, { -555.265, 496.038, -1050.61}}, + {207, { -555.265, 496.038, -866.215}}, + {208, { -555.265, 496.038, -681.825}}, + {209, { -555.265, 496.038, -497.435}}, + {210, { -555.265, 496.038, -313.045}}, + {211, { -555.265, 496.038, -128.655}}, + {212, { -555.265, 496.038, 55.735}}, + {213, { -555.265, 496.038, 240.125}}, + {214, { -555.265, 496.038, 424.515}}, + {215, { -555.265, 496.038, 608.905}}, + {216, { -555.265, 496.038, 793.295}}, + {217, { -555.265, 496.038, 977.685}}, + {218, { -555.265, 496.038, 1162.07}}, + {219, { -555.265, 496.038, 1346.46}}, + {220, { -460.975, 496.038, -1143.4}}, + {221, { -276.585, 496.038, -1143.4}}, + {222, { -92.195, 496.038, -1143.4}}, + {223, { 92.195, 496.038, -1143.4}}, + {224, { 276.585, 496.038, -1143.4}}, + {225, { 0, 0, 0}}, + {226, { -460.975, 525.038, 1533.608}}, + {227, { -276.585, 525.038, 1533.608}}, + {228, { -92.195, 525.038, 1533.608}}, + {229, { 92.195, 525.038, 1533.608}}, + {230, { 276.585, 525.038, 1533.608}}, + {231, { 460.975, 525.038, 1533.608}}}; + return TopCRTCenters; } - else if(CRThit.plane==31 || CRThit.plane== 32 || CRThit.plane==40 || CRThit.plane==41 || CRThit.plane==42 || CRThit.plane==43 || CRThit.plane==44 || CRThit.plane==45) { - Plane=1; - Pos=CRThit.x_pos; - } - else { - Plane=2; - Pos=CRThit.z_pos; + + TransformedCrtHit AffineTransformation(double DX, double DZ,AffineTrans affine) + { + double CRTX=affine.B1+DZ*affine.A12+DX*affine.A11; + double CRTZ=affine.B2+DZ*affine.A22+DX*affine.A21; + return std::make_pair(CRTX, CRTZ); } - return std::make_pair(Plane, Pos); -} -ProjectionPoint CalculateProjection(double dirx, double diry, double dirz, double x0, double y0, double z0, double position) -{ - double Lambda = (position-x0)/dirx; - double PosAtY = (Lambda*diry+y0); - double PosAtZ = (Lambda*dirz+z0); + TopCrtTransformations LoadTopCrtTransformations() + { + std::string fullFileName; + cet::search_path searchPath("FW_SEARCH_PATH"); + searchPath.find_file("TopCrtCorrectionByTPC.txt", fullFileName); + /*if (!searchPath.find_file("TopCrtCorrectionByTPC.txt", fullFileName)) { + mf::LogError("CRTMatchingUtils_LoadTopCrtTransformation") + << "Top CRT Correction transformation file not found in FW_SEARCH_PATH."; + }*/ + std::ifstream corrFile(fullFileName, std::ios::in); - CrossPoint CrossingPoint = {position, PosAtY, PosAtZ}; - return CrossingPoint; -} + std::map Type0Corr; + std::map Type1Corr; + std::map Type2Corr; + std::map Type3Corr; + std::map Type4Corr; + std::map Type5Corr; + + if (!corrFile.is_open()) { + mf::LogError("CRTMatchingUtils_LoadTopCrtTransformation") + << "Failed to open Top CRT Correction transformation file: " << fullFileName; + } + std::string line; + while (std::getline(corrFile, line)) { + std::istringstream iss(line); + std::vector variables; + double var; + while (iss >> var) { + variables.push_back(var); + } -CrossPoint CalculateForPlane(const Direction& dir, int plane, double position) -{ - double dirX, dirY, dirZ; - double meanX, meanY, meanZ; + int pos=0; - switch(plane) { - case 0: // Piano a Y - dirX = dir.diry; dirY = dir.dirx; dirZ = dir.dirz; - meanX = dir.meany; meanY = dir.meanx; meanZ = dir.meanz; - break; - case 1: // Piano a X - dirX = dir.dirx; dirY = dir.diry; dirZ = dir.dirz; - meanX = dir.meanx; meanY = dir.meany; meanZ = dir.meanz; - break; - case 2: // Piano a Z - dirX = dir.dirz; dirY = dir.diry; dirZ = dir.dirx; - meanX = dir.meanz; meanY = dir.meany; meanZ = dir.meanx; - break; - default: - throw std::invalid_argument("Error"); + AffineTrans Type0 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; + pos=pos+8; + AffineTrans Type1 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; + pos=pos+8; + AffineTrans Type2 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; + pos=pos+8; + AffineTrans Type3 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; + pos=pos+8; + AffineTrans Type4 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; + pos=pos+8; + AffineTrans Type5 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; + Type0Corr.insert({variables.at(0), Type0}); + Type1Corr.insert({variables.at(0), Type1}); + Type2Corr.insert({variables.at(0), Type2}); + Type3Corr.insert({variables.at(0), Type3}); + Type4Corr.insert({variables.at(0), Type4}); + Type5Corr.insert({variables.at(0), Type5}); + } + TopCrtTransformations LoadedTransformations={Type2Corr, Type1Corr, Type0Corr, Type4Corr, Type5Corr, Type3Corr}; + return LoadedTransformations; } - return CalculateProjection(static_cast(dirX), - static_cast(dirY), - static_cast(dirZ), - static_cast(meanX), - static_cast(meanY), - static_cast(meanZ), - static_cast(position)); -} -CrossPoint DetermineProjection(const Direction& dir, CrtPlane plane) -{ - CrossPoint thisCase = CalculateForPlane(dir, plane.first, plane.second); + CRTMatchingAlg::CRTMatchingAlg(const fhicl::ParameterSet& pset) + { + this->reconfigure(pset); + return; + } + + CRTMatchingAlg::CRTMatchingAlg() = default; + + void CRTMatchingAlg::reconfigure(const fhicl::ParameterSet& pset){ - switch(plane.first) { - case 0: return {thisCase.Y, thisCase.X, thisCase.Z}; // Plane at Y e.g. Top CRT Horizontal Plane - case 1: return {thisCase.X, thisCase.Y, thisCase.Z}; // Plane at X e.g. Side CRT West, East, Top CRT - case 2: return {thisCase.Z, thisCase.Y, thisCase.X}; // Plane at Z e.g. Side CRT South, North, Top CRT - default: - throw std::invalid_argument("Error"); + return; } -} -TrackBarycenter GetTrackBarycenter (std::vector hx, std::vector hy, std::vector hz, std::vector hw) -{ - float average_x_charge=0, average_y_charge=0, average_z_charge=0, total_charge=0; - bool isGood; - for (unsigned i = 0; i < hz.size(); i++) { - if(isnan(hz[i])) continue; - - if(hz[i]>-1000 && hz[i]<1000){ - average_z_charge+=hz[i]*hw[i]; - average_y_charge+=hy[i]*hw[i]; - average_x_charge+=hx[i]*hw[i]; - total_charge+=hw[i]; + Direction CRTMatchingAlg::PCAfit (std::vector x, std::vector y, std::vector z) + { + int min=0; + int max=x.size(); + int size=max-min; + double xavg=0, yavg=0, zavg=0; + for(int k=min; kmax_eval){ + max_eval = this_eval[k][k]; + maxevalpos = k; + }//end if(this_eval[k][k]>max_eval) + }//end loop looking for best eval -DriftedTrack DriftTrack(const std::vector>& trkHits, const std::vector& trkHitMetas, const geo::GeometryCore *GeometryService, detinfo::DetectorPropertiesData const& detProp, double time, int cryo, const recob::Track& tpcTrack){ - int outBound=0; - std::vector recX, recY, recZ, recI; - //double avgDisplacement=0, startX=0, endX=0, driftedStartX=0, driftedEndX=0; - for(size_t i=0; iIndex()); - const geo::TPCGeo& tpcGeo = GeometryService->TPC(trkHits[i]->WireID()); - int tpc=trkHits[i]->WireID().TPC; - double vDrift=detProp.DriftVelocity(); - double recoX=(trkHits[i]->PeakTime()-850-time/tics)*tics*vDrift; - double plane=tpcGeo.FirstPlane().GetCenter().X(); - double X=plane-tpcGeo.DetectDriftDirection()*recoX; - //double displacement= X-loc.X(); - if(cryo==0 && (tpc==0 || tpc==1) && (X>(cathE+exc)||X<(plane-exc))) outBound++; - else if(cryo==0 && (tpc==2 || tpc==3)&& (X<(cathE-exc)||X>(plane+exc))) outBound++; - else if(cryo==1 && (tpc==0 || tpc==1)&& (X>(cathW+exc)||X<(plane-exc))) outBound++; - else if(cryo==1 && (tpc==2 || tpc==3)&& (X<(cathW-exc)||X>(plane+exc))) outBound++; - recX.push_back(X); - recY.push_back(loc.Y()); - recZ.push_back(loc.Z()); - recI.push_back(trkHits[i]->Integral()); - //avgDisplacement +=displacement; + Direction thDirection= {this_evec[0][maxevalpos] , this_evec[1][maxevalpos], this_evec[2][maxevalpos], xavg, yavg, zavg}; + return thDirection; } - //avgDisplacement=avgDisplacement/trkHits.size(); - DriftedTrack thisDriftedTrack = {recX, recY, recZ, recI, outBound}; - return thisDriftedTrack; -} -TopCRTCentersMap LoadTopCRTCenters() -{ - TopCRTCentersMap TopCRTCenters; + CrtPlane CRTMatchingAlg::DeterminePlane(sbn::crt::CRTHit CRThit) + { + int Plane; + double Pos; + if(CRThit.plane==30) { + Plane=0; + Pos=CRThit.y_pos; + } + else if(CRThit.plane==31 || CRThit.plane== 32 || CRThit.plane==40 || CRThit.plane==41 || CRThit.plane==42 || CRThit.plane==43 || CRThit.plane==44 || CRThit.plane==45) { + Plane=1; + Pos=CRThit.x_pos; + } + else { + Plane=2; + Pos=CRThit.z_pos; + } + return std::make_pair(Plane, Pos); + } + + ProjectionPoint CRTMatchingAlg::CalculateProjection(double dirx, double diry, double dirz, double x0, double y0, double z0, double position) + { + double Lambda = (position-x0)/dirx; + double PosAtY = (Lambda*diry+y0); + double PosAtZ = (Lambda*dirz+z0); - TopCRTCenters = {{108, { -460.975, 617.388,-1050.61}}, - {109, { -460.975,617.388,-866.215}}, - {110, { -460.975,617.388,-681.825}}, - {111, { -460.975,617.388,-497.435}}, - {112, { -460.975,617.388,-313.045}}, - {113, { -460.975,617.388,-128.655}}, - {114, { -460.975,617.388,55.735}}, - {115, { -460.975,617.388,240.125}}, - {116, { -460.975,617.388,424.515}}, - {117, { -460.975,617.388,608.905}}, - {118, { -460.975,617.388,793.295}}, - {119, { -460.975,617.388,977.685}}, - {120, { -460.975,617.388,1162.07}}, - {121, { -460.975,617.388,1346.46}}, - {122, { -276.585,617.388,-1050.61}}, - {123, { -276.585,617.388,-866.215}}, - {124, { -276.585,617.388,-681.825}}, - {125, { -276.585,617.388,-497.435}}, - {126, { -276.585,617.388,-313.045}}, - {127, { -276.585,617.388,-128.655}}, - {128, { -276.585,617.388, 55.735}}, - {129, { -276.585,617.388, 240.125}}, - {130, { -276.585,617.388, 424.515}}, - {131, { -276.585,617.388, 608.905}}, - {132, { -276.585,617.388, 793.295}}, - {133, { -276.585,617.388, 977.685}}, - {134, { -276.585,617.388, 1162.07}}, - {135, { -276.585,617.388, 1346.46}}, - {136, { -92.195 ,617.388,-1050.61}}, - {137, { -92.195 ,617.388,-866.215}}, - {138, { -92.195 ,617.388,-681.825}}, - {139, { -92.195 ,617.388,-497.435}}, - {140, { -92.195 ,617.388,-313.045}}, - {141, { -92.195 ,617.388,-128.655}}, - {142, { -92.195 ,617.388, 55.735}}, - {143, { -92.195 ,617.388, 240.125}}, - {144, { -92.195 ,617.388, 424.515}}, - {145, { -92.195 ,617.388, 608.905}}, - {146, { -92.195 ,617.388, 793.295}}, - {147, { -92.195 ,617.388, 977.685}}, - {148, { -92.195 ,617.388, 1162.07}}, - {149, { -92.195 ,617.388, 1346.46}}, - {150, { 92.195 , 617.388, -1050.61}}, - {151, { 92.195 , 617.388, -866.215}}, - {152, { 92.195 , 617.388, -681.825}}, - {153, { 92.195 , 617.388, -497.435}}, - {154, { 92.195 , 617.388, -313.045}}, - {155, { 92.195 , 617.388, -128.655}}, - {156, { 92.195 ,617.388, 55.735}}, - {157, { 92.195 ,617.388, 240.125}}, - {158, { 92.195 ,617.388, 424.515}}, - {159, { 92.195 ,617.388, 608.905}}, - {160, { 92.195 ,617.388, 793.295}}, - {161, { 92.195 ,617.388, 977.685}}, - {162, { 92.195 ,617.388, 1162.07}}, - {163, { 92.195 ,617.388, 1346.46}}, - {164, { 276.585,617.388, -1050.61}}, - {165, { 276.585,617.388, -866.215}}, - {166, { 276.585,617.388, -681.825}}, - {167, { 276.585,617.388, -497.435}}, - {168, { 276.585,617.388, -313.045}}, - {169, { 276.585,617.388, -128.655}}, - {170, { 276.585,617.388, 55.735}}, - {171, { 276.585,617.388, 240.125}}, - {172, { 276.585,617.388, 424.515}}, - {173, { 276.585,617.388, 608.905}}, - {174, { 276.585,617.388, 793.295}}, - {175, { 276.585,617.388, 977.685}}, - {176, { 276.585,617.388, 1162.07}}, - {177, { 276.585,617.388, 1346.46}}, - {178, { 460.975,617.388, -1050.61}}, - {179, { 460.975,617.388, -866.215}}, - {180, { 460.975,617.388, -681.825}}, - {181, { 460.975,617.388, -497.435}}, - {182, { 460.975,617.388, -313.045}}, - {183, { 460.975,617.388, -128.655}}, - {184, { 460.975,617.388, 55.735}}, - {185, { 460.975,617.388, 240.125}}, - {186, { 460.975,617.388, 424.515}}, - {187, { 460.975,617.388, 608.905}}, - {188, { 460.975,617.388, 793.295}}, - {189, { 460.975,617.388, 977.685}}, - {190, { 460.975,617.388, 1162.07}}, - {191, { 460.975,617.388, 1346.46}}, - {192, { 555.265, 496.038, -1050.61}}, - {193, { 555.265, 496.038, -866.215}}, - {194, { 555.265, 496.038, -681.825}}, - {195, { 555.265, 496.038, -497.435}}, - {196, { 555.265, 496.038, -313.045}}, - {197, { 555.265, 496.038, -128.655}}, - {198, { 555.265, 496.038, 55.735}}, - {199, { 555.265, 496.038, 240.125}}, - {200, { 555.265, 496.038, 424.515}}, - {201, { 555.265, 496.038, 608.905}}, - {202, { 555.265, 496.038, 793.295}}, - {203, { 555.265, 496.038, 977.685}}, - {204, { 555.265, 496.038, 1162.07}}, - {205, { 555.265, 496.038, 1346.46}}, - {206, { -555.265, 496.038, -1050.61}}, - {207, { -555.265, 496.038, -866.215}}, - {208, { -555.265, 496.038, -681.825}}, - {209, { -555.265, 496.038, -497.435}}, - {210, { -555.265, 496.038, -313.045}}, - {211, { -555.265, 496.038, -128.655}}, - {212, { -555.265, 496.038, 55.735}}, - {213, { -555.265, 496.038, 240.125}}, - {214, { -555.265, 496.038, 424.515}}, - {215, { -555.265, 496.038, 608.905}}, - {216, { -555.265, 496.038, 793.295}}, - {217, { -555.265, 496.038, 977.685}}, - {218, { -555.265, 496.038, 1162.07}}, - {219, { -555.265, 496.038, 1346.46}}, - {220, { -460.975, 496.038, -1143.4}}, - {221, { -276.585, 496.038, -1143.4}}, - {222, { -92.195, 496.038, -1143.4}}, - {223, { 92.195, 496.038, -1143.4}}, - {224, { 276.585, 496.038, -1143.4}}, - {225, { 0, 0, 0}}, - {226, { -460.975, 525.038, 1533.608}}, - {227, { -276.585, 525.038, 1533.608}}, - {228, { -92.195, 525.038, 1533.608}}, - {229, { 92.195, 525.038, 1533.608}}, - {230, { 276.585, 525.038, 1533.608}}, - {231, { 460.975, 525.038, 1533.608}}}; - return TopCRTCenters; -} + CrossPoint CrossingPoint = {position, PosAtY, PosAtZ}; + return CrossingPoint; + } -TransformedCrtHit AffineTransformation(double DX, double DZ,AffineTrans affine) -{ - double CRTX=affine.B1+DZ*affine.A12+DX*affine.A11; - double CRTZ=affine.B2+DZ*affine.A22+DX*affine.A21; - return std::make_pair(CRTX, CRTZ); -} + CrossPoint CRTMatchingAlg::CalculateForPlane(const Direction& dir, int plane, double position) + { + double dirX, dirY, dirZ; + double meanX, meanY, meanZ; -TopCrtTransformations LoadTopCrtTransformations() -{ - std::string fullFileName; - cet::search_path searchPath("FW_SEARCH_PATH"); - searchPath.find_file("TopCrtCorrectionByTPC.txt", fullFileName); - /*if (!searchPath.find_file("TopCrtCorrectionByTPC.txt", fullFileName)) { - mf::LogError("CRTMatchingUtils_LoadTopCrtTransformation") - << "Top CRT Correction transformation file not found in FW_SEARCH_PATH."; - }*/ - std::ifstream corrFile(fullFileName, std::ios::in); + switch(plane) { + case 0: // Piano a Y + dirX = dir.diry; dirY = dir.dirx; dirZ = dir.dirz; + meanX = dir.meany; meanY = dir.meanx; meanZ = dir.meanz; + break; + case 1: // Piano a X + dirX = dir.dirx; dirY = dir.diry; dirZ = dir.dirz; + meanX = dir.meanx; meanY = dir.meany; meanZ = dir.meanz; + break; + case 2: // Piano a Z + dirX = dir.dirz; dirY = dir.diry; dirZ = dir.dirx; + meanX = dir.meanz; meanY = dir.meany; meanZ = dir.meanx; + break; + default: + throw std::invalid_argument("Error"); + } + return CRTMatchingAlg::CalculateProjection(static_cast(dirX), + static_cast(dirY), + static_cast(dirZ), + static_cast(meanX), + static_cast(meanY), + static_cast(meanZ), + static_cast(position)); + } - std::map Type0Corr; - std::map Type1Corr; - std::map Type2Corr; - std::map Type3Corr; - std::map Type4Corr; - std::map Type5Corr; + CrossPoint CRTMatchingAlg::DetermineProjection(const Direction& dir, CrtPlane plane) + { + CrossPoint thisCase = CRTMatchingAlg::CalculateForPlane(dir, plane.first, plane.second); - if (!corrFile.is_open()) { - mf::LogError("CRTMatchingUtils_LoadTopCrtTransformation") - << "Failed to open Top CRT Correction transformation file: " << fullFileName; - } - std::string line; - while (std::getline(corrFile, line)) { - std::istringstream iss(line); - std::vector variables; - double var; - while (iss >> var) { - variables.push_back(var); + switch(plane.first) { + case 0: return {thisCase.Y, thisCase.X, thisCase.Z}; // Plane at Y e.g. Top CRT Horizontal Plane + case 1: return {thisCase.X, thisCase.Y, thisCase.Z}; // Plane at X e.g. Side CRT West, East, Top CRT + case 2: return {thisCase.Z, thisCase.Y, thisCase.X}; // Plane at Z e.g. Side CRT South, North, Top CRT + default: + throw std::invalid_argument("Error"); } + } - int pos=0; + TrackBarycenter CRTMatchingAlg::GetTrackBarycenter (std::vector hx, std::vector hy, std::vector hz, std::vector hw) + { + float average_x_charge=0, average_y_charge=0, average_z_charge=0, total_charge=0; + bool isGood; + for (unsigned i = 0; i < hz.size(); i++) { + if(isnan(hz[i])) continue; - AffineTrans Type0 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; - pos=pos+8; - AffineTrans Type1 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; - pos=pos+8; - AffineTrans Type2 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; - pos=pos+8; - AffineTrans Type3 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; - pos=pos+8; - AffineTrans Type4 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; - pos=pos+8; - AffineTrans Type5 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; - Type0Corr.insert({variables.at(0), Type0}); - Type1Corr.insert({variables.at(0), Type1}); - Type2Corr.insert({variables.at(0), Type2}); - Type3Corr.insert({variables.at(0), Type3}); - Type4Corr.insert({variables.at(0), Type4}); - Type5Corr.insert({variables.at(0), Type5}); + if(hz[i]>-1000 && hz[i]<1000){ + average_z_charge+=hz[i]*hw[i]; + average_y_charge+=hy[i]*hw[i]; + average_x_charge+=hx[i]*hw[i]; + total_charge+=hw[i]; + } + } + average_z_charge=average_z_charge/total_charge; + average_y_charge=average_y_charge/total_charge; + average_x_charge=average_x_charge/total_charge; + if(total_charge==0) isGood=false; + else isGood=true; + TrackBarycenter ThisTrackBary = {average_x_charge, average_y_charge, average_z_charge, isGood}; + return ThisTrackBary; } - TopCrtTransformations LoadedTransformations={Type2Corr, Type1Corr, Type0Corr, Type4Corr, Type5Corr, Type3Corr}; - return LoadedTransformations; -} - + DriftedTrack CRTMatchingAlg::DriftTrack(const std::vector>& trkHits, const std::vector& trkHitMetas, const geo::GeometryCore *GeometryService, detinfo::DetectorPropertiesData const& detProp, double time, int cryo, const recob::Track& tpcTrack) + { + int outBound=0; + std::vector recX, recY, recZ, recI; + //double avgDisplacement=0, startX=0, endX=0, driftedStartX=0, driftedEndX=0; + for(size_t i=0; iIndex()); + const geo::TPCGeo& tpcGeo = GeometryService->TPC(trkHits[i]->WireID()); + int tpc=trkHits[i]->WireID().TPC; + double vDrift=detProp.DriftVelocity(); + double recoX=(trkHits[i]->PeakTime()-850-time/tics)*tics*vDrift; + double plane=tpcGeo.FirstPlane().GetCenter().X(); + double X=plane-tpcGeo.DetectDriftDirection()*recoX; + //double displacement= X-loc.X(); + if(cryo==0 && (tpc==0 || tpc==1) && (X>(cathE+exc)||X<(plane-exc))) outBound++; + else if(cryo==0 && (tpc==2 || tpc==3)&& (X<(cathE-exc)||X>(plane+exc))) outBound++; + else if(cryo==1 && (tpc==0 || tpc==1)&& (X>(cathW+exc)||X<(plane-exc))) outBound++; + else if(cryo==1 && (tpc==2 || tpc==3)&& (X<(cathW-exc)||X>(plane+exc))) outBound++; + recX.push_back(X); + recY.push_back(loc.Y()); + recZ.push_back(loc.Z()); + recI.push_back(trkHits[i]->Integral()); + //avgDisplacement +=displacement; + } + //avgDisplacement=avgDisplacement/trkHits.size(); + DriftedTrack thisDriftedTrack = {recX, recY, recZ, recI, outBound}; + return thisDriftedTrack; + } +} diff --git a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h index 2816bfd8c..2282dff7a 100644 --- a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h +++ b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h @@ -11,7 +11,7 @@ #include #include #include -#include // Aggiunto per l'uso di ifstream +#include #include #include #include @@ -63,7 +63,7 @@ #include "TVector3.h" #include "TGeoManager.h" -namespace icarus::crt::matchingutils{ +namespace icarus::crt{ double const vdrift=0.157; //cm/us double const tics=0.4; // 0.4 us, 400 ns @@ -166,19 +166,32 @@ TransformedCrtHit AffineTransformation(double DX, double DZ,AffineTrans affine); TopCrtTransformations LoadTopCrtTransformations(); -Direction PCAfit (std::vector x, std::vector y, std::vector z); -CrtPlane DeterminePlane(sbn::crt::CRTHit CRThit); +class CRTMatchingAlg { +public: -// ProjectionPoint CalculateProjection(double, double, double, double, double, double, double); + explicit CRTMatchingAlg(const fhicl::ParameterSet& pset); + CRTMatchingAlg(); -// CrossPoint CalculateForPlane(const Direction& dir, int plane, double position); + void reconfigure(const fhicl::ParameterSet& pset); -CrossPoint DetermineProjection(const Direction& dir, CrtPlane plane); + Direction PCAfit (std::vector x, std::vector y, std::vector z); -TrackBarycenter GetTrackBarycenter(std::vector hx, std::vector hy, std::vector hz, std::vector hw); + CrtPlane DeterminePlane(sbn::crt::CRTHit CRThit); -DriftedTrack DriftTrack(const std::vector>& trkHits, const std::vector& trkHitMetas, const geo::GeometryCore *GeometryService, detinfo::DetectorPropertiesData const& detProp, double time, int cryo, const recob::Track& tpcTrack); + ProjectionPoint CalculateProjection(double, double, double, double, double, double, double); + + CrossPoint CalculateForPlane(const Direction& dir, int plane, double position); + + CrossPoint DetermineProjection(const Direction& dir, CrtPlane plane); + + TrackBarycenter GetTrackBarycenter(std::vector hx, std::vector hy, std::vector hz, std::vector hw); + + DriftedTrack DriftTrack(const std::vector>& trkHits, const std::vector& trkHitMetas, const geo::GeometryCore *GeometryService, detinfo::DetectorPropertiesData const& detProp, double time, int cryo, const recob::Track& tpcTrack); + +private: + +}; } From a0dc62db7854812e4b740653e10a1929b0524313 Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Tue, 22 Oct 2024 09:20:10 +0200 Subject: [PATCH 08/28] updated the fcl files, now the lar command gets correctly exectuded. There is still one issue: after processing the first event returns: No product is registered for CRTT0Tagging --- icaruscode/CRT/CRTT0Tagging_module.cc | 25 +++---- icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx | 6 +- icaruscode/CRT/CRTUtils/CRTMatchingUtils.h | 3 +- .../CRT/CRTUtils/crtmatchingalg_icarus.fcl | 31 ++++++++ icaruscode/CRT/crtt0tagging.fcl | 17 +++++ icaruscode/CRT/crtt0tagging_icarus.fcl | 70 ++++++++++++++++--- 6 files changed, 124 insertions(+), 28 deletions(-) create mode 100644 icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl create mode 100644 icaruscode/CRT/crtt0tagging.fcl diff --git a/icaruscode/CRT/CRTT0Tagging_module.cc b/icaruscode/CRT/CRTT0Tagging_module.cc index 20ebc8093..00093289c 100644 --- a/icaruscode/CRT/CRTT0Tagging_module.cc +++ b/icaruscode/CRT/CRTT0Tagging_module.cc @@ -114,9 +114,9 @@ class icarus::crt::CRTT0Tagging : public art::EDProducer { CRTCommonUtils* fCrtUtils; icarus::crt::TopCRTCentersMap fTopCRTCenterMap; icarus::crt::TopCrtTransformations fTopCrtTransformations; - CRTMatchingAlg fMatchingAlg; - + double fMinimalTrackLength; + int fMinimumGoodHits; }; icarus::crt::CRTT0Tagging::CRTT0Tagging(fhicl::ParameterSet const& p) @@ -139,6 +139,9 @@ icarus::crt::CRTT0Tagging::CRTT0Tagging(fhicl::ParameterSet const& p) produces< art::Assns >(); fGeometryService = lar::providerFrom(); + fMinimalTrackLength = p.get("MinimalTrackLength", 40.0); + fMinimumGoodHits = p.get("MinimumGoodHits", 5); + art::ServiceHandle tfs; @@ -155,7 +158,6 @@ void icarus::crt::CRTT0Tagging::beginRun(art::Run& r) fTopCRTCenterMap=icarus::crt::LoadTopCRTCenters(); fTopCrtTransformations=icarus::crt::LoadTopCrtTransformations(); - } void icarus::crt::CRTT0Tagging::produce(art::Event& e) @@ -218,7 +220,7 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) std::vector emptyTHMVector; const std::vector &trkHitMetas = fmtrkHits.isValid() ? fmtrkHits.data(trkPtr.key()) : emptyTHMVector; - if(track.Length()<40) continue; + if(track.Length()::signaling_NaN(); @@ -247,7 +249,6 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) else countW++; } - int trackType=-1; if(countW!=0 && countE!=0 && cryo==0) trackType=0; //CCEast else if(countW!=0 && countE==0 && cryo==0) trackType=2; //East-West @@ -255,7 +256,6 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) else if(countW!=0 && countE!=0 && cryo==1) trackType=3; //CCWest else if(countW!=0 && countE==0 && cryo==1) trackType=5; //West-West else if(countW==0 && countE!=0 && cryo==1) trackType=4; //West-East - icarus::crt::TopCRTCorrectionMap TopCrtCorrection; if(trackType==0) TopCrtCorrection=fTopCrtTransformations.EastCC; else if(trackType==1) TopCrtCorrection=fTopCrtTransformations.EE; @@ -263,7 +263,6 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) else if(trackType==3) TopCrtCorrection=fTopCrtTransformations.WestCC; else if(trackType==4) TopCrtCorrection=fTopCrtTransformations.WE; else if(trackType==5) TopCrtCorrection=fTopCrtTransformations.WW; - for(size_t j=1; j10) std::cout<<"Track Res very bad "< crtCands; - for(art::Ptr p_crthit: CRTHitList){ const CRTHit &crtHit = *p_crthit; double crtTime=crtHit.ts1_ns/1e3; - icarus::crt::DriftedTrack thisDriftedTrack = fMatchingAlg.DriftTrack(trkHits, trkHitMetas, fGeometryService, detProp, crtTime, cryo, track); + icarus::crt::DriftedTrack thisDriftedTrack = fMatchingAlg.DriftTrack(trkHits, trkHitMetas, fGeometryService, detProp, crtTime, cryo, track); if(thisDriftedTrack.outbound>0) continue; icarus::crt::Direction driftedTrackDir=fMatchingAlg.PCAfit(thisDriftedTrack.spx, thisDriftedTrack.spy, thisDriftedTrack.spz); - int crtSys=-1; if(crtHit.plane<=34) crtSys=0; else if (crtHit.plane==50) crtSys=2; @@ -297,7 +294,6 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) icarus::crt::CrtPlane thisCrtPlane = fMatchingAlg.DeterminePlane(crtHit); icarus::crt::CrossPoint crossPoint = fMatchingAlg.DetermineProjection(driftedTrackDir, thisCrtPlane); - double crtX=crtHit.x_pos; double crtY=crtHit.y_pos; double crtZ=crtHit.z_pos; @@ -321,7 +317,8 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) transCrt=icarus::crt::AffineTransformation(centerDX, centerDY, thisAffine); crtX=transCrt.first; crtY=transCrt.second; - } + } + } if(thisCrtPlane.first==0){ deltaX=crtX-crossPoint.X; @@ -346,7 +343,7 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) return a.distance < b.distance; }); icarus::crt::CandCRT& bestCrtCand=*minElementIt; - if(bestCrtCand.distance<=96){ + if(bestCrtCand.distance<=96){ /////// MAGIC int matchedSys=-1; if(bestCrtCand.CRThit.plane<=34) matchedSys=0; else if (bestCrtCand.CRThit.plane==50) matchedSys=2; diff --git a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx index e467aae6e..4d3b1ca39 100644 --- a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx +++ b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx @@ -212,7 +212,7 @@ namespace icarus::crt{ CRTMatchingAlg::CRTMatchingAlg() = default; void CRTMatchingAlg::reconfigure(const fhicl::ParameterSet& pset){ - + fMinimalTrackLength = pset.get("MinimalTrackLength", 40.0); return; } @@ -372,7 +372,11 @@ namespace icarus::crt{ std::vector recX, recY, recZ, recI; //double avgDisplacement=0, startX=0, endX=0, driftedStartX=0, driftedEndX=0; for(size_t i=0; iIndex() == std::numeric_limits::max()) || + (!tpcTrack.HasValidPoint(trkHitMetas[i]->Index())); + if(badhit) continue; geo::Point_t loc = tpcTrack.LocationAtPoint(trkHitMetas[i]->Index()); + if(loc.X()==-999) continue; const geo::TPCGeo& tpcGeo = GeometryService->TPC(trkHits[i]->WireID()); int tpc=trkHits[i]->WireID().TPC; double vDrift=detProp.DriftVelocity(); diff --git a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h index 2282dff7a..9464e44d6 100644 --- a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h +++ b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h @@ -65,7 +65,6 @@ namespace icarus::crt{ -double const vdrift=0.157; //cm/us double const tics=0.4; // 0.4 us, 400 ns double const minLimitW=61.7; // cm Anode WE position double const maxLimitW=358.73; // cm Anode WW position @@ -190,7 +189,7 @@ class CRTMatchingAlg { DriftedTrack DriftTrack(const std::vector>& trkHits, const std::vector& trkHitMetas, const geo::GeometryCore *GeometryService, detinfo::DetectorPropertiesData const& detProp, double time, int cryo, const recob::Track& tpcTrack); private: - + double fMinimalTrackLength; }; } diff --git a/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl b/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl new file mode 100644 index 000000000..8cf0435b9 --- /dev/null +++ b/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl @@ -0,0 +1,31 @@ +BEGIN_PROLOG + +standard_crtmatchingalg: +{ + MinimalTrackLength: 40. # Minimal TrackLength to match with a CRT + MinimumGoodHits: 5 # Minimum number of good hits to perform the fit + + CrtHitModuleLabel: "crthit" + TriggerLabel: "daqTrigger" + TriggerConfiguration: "triggerconfig" + TPCTrackLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # Track producer module label + PFParticleLabel: ["pandoraGausCryoE", "pandoraGausCryoW"] # PFParticle producer module label + HitLabel: ["cluster3DCryoE" , "cluster3DCryoW"] + +} + + +icarus_crtt0tagging: +{ + module_type: "icaruscode/CRT/CRTMatchingAlg" + CrtHitModuleLabel: "crthit" + TriggerLabel: "daqTrigger" + TriggerConfiguration: "triggerconfig" + TPCTrackLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # Track producer module label + PFParticleLabel: ["pandoraGausCryoE", "pandoraGausCryoW"] # PFParticle producer module label + HitLabel: ["cluster3DCryoE" , "cluster3DCryoW"] + MatchingAlg: @local::standard_crtmatchingalg +} + + +END_PROLOG diff --git a/icaruscode/CRT/crtt0tagging.fcl b/icaruscode/CRT/crtt0tagging.fcl new file mode 100644 index 000000000..9151b59a5 --- /dev/null +++ b/icaruscode/CRT/crtt0tagging.fcl @@ -0,0 +1,17 @@ +#include "crtmatchingalg_icarus.fcl" + +BEGIN_PROLOG + +standard_crtt0tagging: +{ + module_type: "CRTT0Tagging" + CrtHitModuleLabel: "crthit" + TriggerLabel: "daqTrigger" + TriggerConfiguration: "triggerconfig" + TPCTrackLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # Track producer module label + PFParticleLabel: ["pandoraGausCryoE", "pandoraGausCryoW"] # PFParticle producer module label + HitLabel: ["cluster3DCryoE" , "cluster3DCryoW"] + MatchingAlg: @local::standard_crtmatchingalg +} + +END_PROLOG diff --git a/icaruscode/CRT/crtt0tagging_icarus.fcl b/icaruscode/CRT/crtt0tagging_icarus.fcl index ab9815dee..57e3e6112 100644 --- a/icaruscode/CRT/crtt0tagging_icarus.fcl +++ b/icaruscode/CRT/crtt0tagging_icarus.fcl @@ -1,16 +1,64 @@ -#include "CRTUtils/CRTMatchingUtils.h" +#include "services_common_icarus.fcl" +#include "crtt0matchingalg_icarus.fcl" -BEGIN_PROLOG +##include "messages_icarus.fcl" +##include "services_icarus.fcl" -standard_crtt0tagging: +#include "crtt0tagging.fcl" + + +process_name: CRTT0Tagging + +services: +{ + # Load the service that manages root files for histograms. + TFileService: { fileName: "crtt0tagging_hist.root" } + + message: @local::icarus_message_services_prod_debug + @table::icarus_common_services + +} # services + +source: +{ + module_type: RootInput + + # Number of events to analyze; "-1" means all of the events in the input + # file. You can override this value with the "-n" option on the command line. + maxEvents: -1 + +} + +outputs: { - module_type: "CRTT0Tagging" - CrtHitModuleLabel: "crthit" - TriggerLabel: "daqTrigger" - TriggerConfiguration: "triggerconfig" - TPCTrackLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # Track producer module label - PFParticleLabel: ["pandoraGausCryoE", "pandoraGausCryoW"] # PFParticle producer module label - HitLabel: ["cluster3DCryoE" , "cluster3DCryoW"] + out1: + { + module_type: RootOutput + fileName: "%ifb_%tc_reco.root" + dataTier: "reconstructed" + saveMemoryObjectThreshold: 0 + compressionLevel: 1 + fastCloning: false + } } -END_PROLOG +# The 'physics' section defines and configures some modules to do work on each event. +physics: +{ + producers: + { + CRTT0Tagging: @local::standard_crtt0tagging + } + + # Schedule job step(s) for execution by defining the analysis module for this job. + reco: [ CRTT0Tagging ] + + stream1: [ out1 ] + + trigger_paths: [reco] + + # "end_paths" is a keyword and contains the modules that do not modify the art::Event; + # i.e., analyzers and output streams. + end_paths: [ stream1 ] + +} From 6f40e85401009742e80337bc530cc9f1da34ec64 Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Tue, 22 Oct 2024 14:22:09 +0200 Subject: [PATCH 09/28] This commit makes sure the correct data product is stored. --- icaruscode/CRT/CRTT0Tagging_module.cc | 34 ++++++++++----------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/icaruscode/CRT/CRTT0Tagging_module.cc b/icaruscode/CRT/CRTT0Tagging_module.cc index 00093289c..a24ae7fa5 100644 --- a/icaruscode/CRT/CRTT0Tagging_module.cc +++ b/icaruscode/CRT/CRTT0Tagging_module.cc @@ -133,16 +133,15 @@ icarus::crt::CRTT0Tagging::CRTT0Tagging(fhicl::ParameterSet const& p) fMatchingAlg(p.get ("MatchingAlg")) { - // Get a pointer to the geometry service provider. produces< std::vector >(); produces< art::Assns >(); produces< art::Assns >(); + // Get a pointer to the geometry service provider. fGeometryService = lar::providerFrom(); fMinimalTrackLength = p.get("MinimalTrackLength", 40.0); fMinimumGoodHits = p.get("MinimumGoodHits", 5); - art::ServiceHandle tfs; } @@ -162,7 +161,6 @@ void icarus::crt::CRTT0Tagging::beginRun(art::Run& r) void icarus::crt::CRTT0Tagging::produce(art::Event& e) { - auto const clockData = art::ServiceHandle()->DataFor(e); auto const detProp = art::ServiceHandle()->DataFor(e, clockData); if (!fTriggerConfiguration) { @@ -173,11 +171,9 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) mf::LogDebug("CRTT0Tagging: ") << "beginning production" << '\n'; - auto t0TaggedTracksColl = std::make_unique>(); - art::PtrMaker const makeInfoPtr(e); - auto trackAssociation = std::make_unique>(); - auto crtAssociation = std::make_unique>(); - auto trackAndCrtAssociation = std::make_unique>(); + std::unique_ptr< std::vector > t0col( new std::vector); + std::unique_ptr< art::Assns > trackAssn( new art::Assns); + std::unique_ptr< art::Assns > t0CrtHitAssn( new art::Assns ); // CRTHits std::vector> CRTHitList; @@ -350,25 +346,19 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) else matchedSys=1; if(matchedSys==2) continue; // lets discard Bottom CRT Hits for the moment mf::LogInfo("CRTT0Tagging") - <<"Matched CRT time = "<("MinimumGoodHits", 5); + fMaximalCRTDistance = p.get("MaximalCRTDistance", 300.); + fGoodCandidateDistance = p.get("GoodCandidateDistance", 100.); art::ServiceHandle tfs; @@ -327,7 +332,7 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) deltaZ=crtY-crossPoint.Y; } crtDistance=sqrt(pow(deltaX,2)+pow(deltaZ,2)); - if(crtDistance>300) continue; + if(crtDistance>fMaximalCRTDistance) continue; icarus::crt::CandCRT thisCrtCand={crtHit,p_crthit, crtDistance, deltaX, deltaZ}; crtCands.push_back(thisCrtCand); } // End of CRT Hit loop @@ -339,7 +344,7 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) return a.distance < b.distance; }); icarus::crt::CandCRT& bestCrtCand=*minElementIt; - if(bestCrtCand.distance<=96){ /////// MAGIC + if(bestCrtCand.distance<=fGoodCandidateDistance){ int matchedSys=-1; if(bestCrtCand.CRThit.plane<=34) matchedSys=0; else if (bestCrtCand.CRThit.plane==50) matchedSys=2; diff --git a/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl b/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl index 8cf0435b9..a1b54455b 100644 --- a/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl +++ b/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl @@ -3,7 +3,9 @@ BEGIN_PROLOG standard_crtmatchingalg: { MinimalTrackLength: 40. # Minimal TrackLength to match with a CRT - MinimumGoodHits: 5 # Minimum number of good hits to perform the fit + MinimumGoodHits: 5 # Minimum number of good hits to perform the fit + MaximalCRTDistance: 300. # Maximal distance between CRT Hit Candidate and Track Projection + GoodCandidateDistance: 100. # 96 cm maximizes EfficiencyXPurity (both > 92%) CrtHitModuleLabel: "crthit" TriggerLabel: "daqTrigger" From 1762068d66b188e244817435e110f344a3a008fb Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Tue, 22 Oct 2024 16:30:36 +0200 Subject: [PATCH 11/28] added a check that rejects CRT and Track combinations for T0Tagged tracks (cathode crossers) when the time difference between the two is bigget than 10 us --- icaruscode/CRT/CRTT0Tagging_module.cc | 10 +++++++--- icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl | 7 ++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/icaruscode/CRT/CRTT0Tagging_module.cc b/icaruscode/CRT/CRTT0Tagging_module.cc index 86dab7abb..2168ff41d 100644 --- a/icaruscode/CRT/CRTT0Tagging_module.cc +++ b/icaruscode/CRT/CRTT0Tagging_module.cc @@ -119,6 +119,7 @@ class icarus::crt::CRTT0Tagging : public art::EDProducer { int fMinimumGoodHits; double fMaximalCRTDistance; double fGoodCandidateDistance; + double fMaximumDeltaT; }; @@ -146,7 +147,7 @@ icarus::crt::CRTT0Tagging::CRTT0Tagging(fhicl::ParameterSet const& p) fMinimumGoodHits = p.get("MinimumGoodHits", 5); fMaximalCRTDistance = p.get("MaximalCRTDistance", 300.); fGoodCandidateDistance = p.get("GoodCandidateDistance", 100.); - + fMaximumDeltaT = p.get("MaximumDeltaT", 10000.); art::ServiceHandle tfs; } @@ -229,7 +230,6 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) if (!t0s.empty()){ t0 = t0s[0]->Time(); //Get T0 } - if(!isnan(t0)) std::cout<<"This Track T0 "< p_crthit: CRTHitList){ const CRTHit &crtHit = *p_crthit; double crtTime=crtHit.ts1_ns/1e3; + if(!isnan(t0)){ + if(fabs(t0-crtHit.ts1_ns)>fMaximumDeltaT) continue; + } icarus::crt::DriftedTrack thisDriftedTrack = fMatchingAlg.DriftTrack(trkHits, trkHitMetas, fGeometryService, detProp, crtTime, cryo, track); if(thisDriftedTrack.outbound>0) continue; icarus::crt::Direction driftedTrackDir=fMatchingAlg.PCAfit(thisDriftedTrack.spx, thisDriftedTrack.spy, thisDriftedTrack.spz); @@ -351,7 +354,8 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) else matchedSys=1; if(matchedSys==2) continue; // lets discard Bottom CRT Hits for the moment mf::LogInfo("CRTT0Tagging") - <<"Matched CRT time = "<push_back(anab::T0(bestCrtCand.CRThit.ts1_ns, track.ID(), matchedSys, bestCrtCand.CRThit.plane,bestCrtCand.distance)); util::CreateAssn(*this, e, *t0col, trkPtr, *trackAssn); util::CreateAssn(*this, e, *t0col, bestCrtCand.ptrCRThit, *t0CrtHitAssn); diff --git a/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl b/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl index a1b54455b..e34c7b5f9 100644 --- a/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl +++ b/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl @@ -3,9 +3,10 @@ BEGIN_PROLOG standard_crtmatchingalg: { MinimalTrackLength: 40. # Minimal TrackLength to match with a CRT - MinimumGoodHits: 5 # Minimum number of good hits to perform the fit - MaximalCRTDistance: 300. # Maximal distance between CRT Hit Candidate and Track Projection - GoodCandidateDistance: 100. # 96 cm maximizes EfficiencyXPurity (both > 92%) + MinimumGoodHits: 5 # Minimum number of good hits to perform the fit + MaximalCRTDistance: 300. # Maximal distance between CRT Hit Candidate and Track Projection + GoodCandidateDistance: 100. # 96 cm maximizes EfficiencyXPurity (both > 92%) + MaximumDeltaT: 10000. # Maximal Time difference between a T0 tagged track and CRT Hit time for the combination to be considered acceptable. [ns] CrtHitModuleLabel: "crthit" TriggerLabel: "daqTrigger" From 571264bb159a09060989a1c891229b73af464379 Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Wed, 23 Oct 2024 12:15:08 +0200 Subject: [PATCH 12/28] I think I removed all the magic numbers and added them to fcl file configuration with explanations. --- icaruscode/CRT/CRTT0Tagging_module.cc | 17 ++++++-------- icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx | 22 +++++++++---------- icaruscode/CRT/CRTUtils/CRTMatchingUtils.h | 17 +++++--------- .../CRT/CRTUtils/crtmatchingalg_icarus.fcl | 14 ++++++++++-- icaruscode/CRT/crtt0tagging.fcl | 7 ++++++ 5 files changed, 43 insertions(+), 34 deletions(-) diff --git a/icaruscode/CRT/CRTT0Tagging_module.cc b/icaruscode/CRT/CRTT0Tagging_module.cc index 2168ff41d..b498cc170 100644 --- a/icaruscode/CRT/CRTT0Tagging_module.cc +++ b/icaruscode/CRT/CRTT0Tagging_module.cc @@ -174,6 +174,7 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) << "Skipping because no data (or at least no trigger configuration)."; return; } + std::cout<<"Maximal CRT-Track distance "<> crthits = e.getValidHandle>(fCrtHitModuleLabel); art::fill_ptr_vector(CRTHitList, crthits); - int cryo=-1; for(const auto& PFPLabel : fPFParticleLabel) { - cryo++; auto it = &PFPLabel - fPFParticleLabel.data(); std::vector> PFParticleList; art::ValidHandle> pfparticles = e.getValidHandle>(PFPLabel); @@ -232,9 +231,9 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) } int goodHits=0; int countE=0, countW=0; + // These counters are used to determine if track is CC-E, EE, EW, CC-W, WE, WW // depending on the track type, the Top CRT uses the appropriate position corretions - double trackRes=0, deltaP=0; std::vector hx, hy, hz, ht; for(size_t i=0; iWireID().Cryostat; if(countW!=0 && countE!=0 && cryo==0) trackType=0; //CCEast else if(countW!=0 && countE==0 && cryo==0) trackType=2; //East-West else if(countW==0 && countE!=0 && cryo==0) trackType=1; //East-East else if(countW!=0 && countE!=0 && cryo==1) trackType=3; //CCWest else if(countW!=0 && countE==0 && cryo==1) trackType=5; //West-West - else if(countW==0 && countE!=0 && cryo==1) trackType=4; //West-East + else if(countW==0 && countE!=0 && cryo==1) trackType=4; //West-East + icarus::crt::TopCRTCorrectionMap TopCrtCorrection; if(trackType==0) TopCrtCorrection=fTopCrtTransformations.EastCC; else if(trackType==1) TopCrtCorrection=fTopCrtTransformations.EE; @@ -264,11 +265,7 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) else if(trackType==3) TopCrtCorrection=fTopCrtTransformations.WestCC; else if(trackType==4) TopCrtCorrection=fTopCrtTransformations.WE; else if(trackType==5) TopCrtCorrection=fTopCrtTransformations.WW; - for(size_t j=1; j10) std::cout<<"Track Res very bad "<fMaximumDeltaT) continue; } - icarus::crt::DriftedTrack thisDriftedTrack = fMatchingAlg.DriftTrack(trkHits, trkHitMetas, fGeometryService, detProp, crtTime, cryo, track); + icarus::crt::DriftedTrack thisDriftedTrack = fMatchingAlg.DriftTrack(trkHits, trkHitMetas, fGeometryService, detProp, crtTime, track); if(thisDriftedTrack.outbound>0) continue; icarus::crt::Direction driftedTrackDir=fMatchingAlg.PCAfit(thisDriftedTrack.spx, thisDriftedTrack.spy, thisDriftedTrack.spz); int crtSys=-1; @@ -355,7 +352,7 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) if(matchedSys==2) continue; // lets discard Bottom CRT Hits for the moment mf::LogInfo("CRTT0Tagging") <<"Matched CRT time = "<push_back(anab::T0(bestCrtCand.CRThit.ts1_ns, track.ID(), matchedSys, bestCrtCand.CRThit.plane,bestCrtCand.distance)); util::CreateAssn(*this, e, *t0col, trkPtr, *trackAssn); util::CreateAssn(*this, e, *t0col, bestCrtCand.ptrCRThit, *t0CrtHitAssn); diff --git a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx index 4d3b1ca39..ff8b85fc9 100644 --- a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx +++ b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx @@ -212,7 +212,9 @@ namespace icarus::crt{ CRTMatchingAlg::CRTMatchingAlg() = default; void CRTMatchingAlg::reconfigure(const fhicl::ParameterSet& pset){ - fMinimalTrackLength = pset.get("MinimalTrackLength", 40.0); + fTickPeriod = pset.get("TickPeriod", 0.4); + fTickAtAnode = pset.get("TickAtAnode", 850.); + fAllowedOffsetCM = pset.get("AllowedOffsetCM", 1.57); return; } @@ -366,11 +368,10 @@ namespace icarus::crt{ return ThisTrackBary; } - DriftedTrack CRTMatchingAlg::DriftTrack(const std::vector>& trkHits, const std::vector& trkHitMetas, const geo::GeometryCore *GeometryService, detinfo::DetectorPropertiesData const& detProp, double time, int cryo, const recob::Track& tpcTrack) + DriftedTrack CRTMatchingAlg::DriftTrack(const std::vector>& trkHits, const std::vector& trkHitMetas, const geo::GeometryCore *GeometryService, detinfo::DetectorPropertiesData const& detProp, double time, const recob::Track& tpcTrack) { int outBound=0; std::vector recX, recY, recZ, recI; - //double avgDisplacement=0, startX=0, endX=0, driftedStartX=0, driftedEndX=0; for(size_t i=0; iIndex() == std::numeric_limits::max()) || (!tpcTrack.HasValidPoint(trkHitMetas[i]->Index())); @@ -378,23 +379,22 @@ namespace icarus::crt{ geo::Point_t loc = tpcTrack.LocationAtPoint(trkHitMetas[i]->Index()); if(loc.X()==-999) continue; const geo::TPCGeo& tpcGeo = GeometryService->TPC(trkHits[i]->WireID()); + int const cryo = trkHits[i]->WireID().Cryostat; int tpc=trkHits[i]->WireID().TPC; double vDrift=detProp.DriftVelocity(); - double recoX=(trkHits[i]->PeakTime()-850-time/tics)*tics*vDrift; + double recoX=(trkHits[i]->PeakTime()-fTickAtAnode-time/fTickPeriod)*fTickPeriod*vDrift; double plane=tpcGeo.FirstPlane().GetCenter().X(); + double cathode=tpcGeo.GetCathodeCenter().X(); double X=plane-tpcGeo.DetectDriftDirection()*recoX; - //double displacement= X-loc.X(); - if(cryo==0 && (tpc==0 || tpc==1) && (X>(cathE+exc)||X<(plane-exc))) outBound++; - else if(cryo==0 && (tpc==2 || tpc==3)&& (X<(cathE-exc)||X>(plane+exc))) outBound++; - else if(cryo==1 && (tpc==0 || tpc==1)&& (X>(cathW+exc)||X<(plane-exc))) outBound++; - else if(cryo==1 && (tpc==2 || tpc==3)&& (X<(cathW-exc)||X>(plane+exc))) outBound++; + if(cryo==0 && (tpc==0 || tpc==1) && (X>(cathode+fAllowedOffsetCM)||X<(plane-fAllowedOffsetCM))) outBound++; + else if(cryo==0 && (tpc==2 || tpc==3)&& (X<(cathode-fAllowedOffsetCM)||X>(plane+fAllowedOffsetCM))) outBound++; + else if(cryo==1 && (tpc==0 || tpc==1)&& (X>(cathode+fAllowedOffsetCM)||X<(plane-fAllowedOffsetCM))) outBound++; + else if(cryo==1 && (tpc==2 || tpc==3)&& (X<(cathode-fAllowedOffsetCM)||X>(plane+fAllowedOffsetCM))) outBound++; recX.push_back(X); recY.push_back(loc.Y()); recZ.push_back(loc.Z()); recI.push_back(trkHits[i]->Integral()); - //avgDisplacement +=displacement; } - //avgDisplacement=avgDisplacement/trkHits.size(); DriftedTrack thisDriftedTrack = {recX, recY, recZ, recI, outBound}; return thisDriftedTrack; } diff --git a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h index 9464e44d6..6d337d53b 100644 --- a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h +++ b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h @@ -65,15 +65,6 @@ namespace icarus::crt{ -double const tics=0.4; // 0.4 us, 400 ns -double const minLimitW=61.7; // cm Anode WE position -double const maxLimitW=358.73; // cm Anode WW position -double const minLimitE=-61.7; // cm Anode EW position -double const maxLimitE=-358.73; // cm Anode WW position -double const cathW=210; // cm Cathode W position -double const cathE=-210; // cm Cathode E position -double const exc=2; // cm max displacement out of boundaries - struct CrossPoint { double X; @@ -186,10 +177,14 @@ class CRTMatchingAlg { TrackBarycenter GetTrackBarycenter(std::vector hx, std::vector hy, std::vector hz, std::vector hw); - DriftedTrack DriftTrack(const std::vector>& trkHits, const std::vector& trkHitMetas, const geo::GeometryCore *GeometryService, detinfo::DetectorPropertiesData const& detProp, double time, int cryo, const recob::Track& tpcTrack); + DriftedTrack DriftTrack(const std::vector>& trkHits, const std::vector& trkHitMetas, const geo::GeometryCore *GeometryService, detinfo::DetectorPropertiesData const& detProp, double time, const recob::Track& tpcTrack); private: - double fMinimalTrackLength; + + double fTickPeriod; + double fTickAtAnode; + double fAllowedOffsetCM; + }; } diff --git a/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl b/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl index e34c7b5f9..68f18974b 100644 --- a/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl +++ b/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl @@ -6,8 +6,18 @@ standard_crtmatchingalg: MinimumGoodHits: 5 # Minimum number of good hits to perform the fit MaximalCRTDistance: 300. # Maximal distance between CRT Hit Candidate and Track Projection GoodCandidateDistance: 100. # 96 cm maximizes EfficiencyXPurity (both > 92%) - MaximumDeltaT: 10000. # Maximal Time difference between a T0 tagged track and CRT Hit time for the combination to be considered acceptable. [ns] - + MaximumDeltaT: 10000. # Maximal Time difference between a T0 tagged track and CRT Hit time for the combination to be considered acceptable. [ns] + TickPeriod: 0.4 # 0.4 us tick period + TickAtAnode: 850 # Tick at the Anode, de facto Offset Ticks + AllowedOffsetCM: 1.57 # When trying to determine if a track and a time are compatible, you reconstructruct the track at that time + # you then check if the reconstructed track is out of the boundaries of the cathode and of the anode, + # this variable gives you the maximum excess of the track wrt cathode or anode to consider the track/time pair. + # Since we are allowing for MaximumDeltaT of 10 us (see above), this corresponds to a maximum excess + # of 10 us * 0.157 cm/us = 1.57 cm. + # As this is phrased, one could think of this as the two variables are related, that is not necessarily + # the case, but is still a good guess. + + CrtHitModuleLabel: "crthit" TriggerLabel: "daqTrigger" TriggerConfiguration: "triggerconfig" diff --git a/icaruscode/CRT/crtt0tagging.fcl b/icaruscode/CRT/crtt0tagging.fcl index 9151b59a5..0b60f3490 100644 --- a/icaruscode/CRT/crtt0tagging.fcl +++ b/icaruscode/CRT/crtt0tagging.fcl @@ -4,6 +4,13 @@ BEGIN_PROLOG standard_crtt0tagging: { + + MinimalTrackLength: 40. # Minimal TrackLength to match with a CRT + MinimumGoodHits: 5 # Minimum number of good hits to perform the fit + MaximalCRTDistance: 300. # Maximal distance between CRT Hit Candidate and Track Projection + GoodCandidateDistance: 100. # 96 cm maximizes EfficiencyXPurity (both > 92%) + MaximumDeltaT: 10000. # Maximal Time difference between a T0 tagged track and CRT Hit time for the combination to be considered acceptable. [ns] + module_type: "CRTT0Tagging" CrtHitModuleLabel: "crthit" TriggerLabel: "daqTrigger" From f5384b967731236bf078a2eccb5af1fa5b000677 Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Wed, 23 Oct 2024 16:48:19 +0200 Subject: [PATCH 13/28] now it works also on MC --- icaruscode/CRT/CRTT0Tagging_module.cc | 53 ++++++++------- .../CRT/CRTUtils/crtmatchingalg_icarus.fcl | 2 +- icaruscode/CRT/crtt0tagging.fcl | 23 +++++++ icaruscode/CRT/crtt0taggingmc_icarus.fcl | 65 +++++++++++++++++++ 4 files changed, 115 insertions(+), 28 deletions(-) create mode 100644 icaruscode/CRT/crtt0taggingmc_icarus.fcl diff --git a/icaruscode/CRT/CRTT0Tagging_module.cc b/icaruscode/CRT/CRTT0Tagging_module.cc index b498cc170..cb1e67dfa 100644 --- a/icaruscode/CRT/CRTT0Tagging_module.cc +++ b/icaruscode/CRT/CRTT0Tagging_module.cc @@ -120,6 +120,7 @@ class icarus::crt::CRTT0Tagging : public art::EDProducer { double fMaximalCRTDistance; double fGoodCandidateDistance; double fMaximumDeltaT; + bool fData; }; @@ -148,6 +149,7 @@ icarus::crt::CRTT0Tagging::CRTT0Tagging(fhicl::ParameterSet const& p) fMaximalCRTDistance = p.get("MaximalCRTDistance", 300.); fGoodCandidateDistance = p.get("GoodCandidateDistance", 100.); fMaximumDeltaT = p.get("MaximumDeltaT", 10000.); + fData = p.get("isData", true); art::ServiceHandle tfs; } @@ -169,24 +171,20 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) { auto const clockData = art::ServiceHandle()->DataFor(e); auto const detProp = art::ServiceHandle()->DataFor(e, clockData); + if (!fTriggerConfiguration) { mf::LogDebug("CRTT0Tagging") << "Skipping because no data (or at least no trigger configuration)."; - return; } - std::cout<<"Maximal CRT-Track distance "< > t0col( new std::vector); std::unique_ptr< art::Assns > trackAssn( new art::Assns); std::unique_ptr< art::Assns > t0CrtHitAssn( new art::Assns ); - + // CRTHits std::vector> CRTHitList; art::ValidHandle> crthits = e.getValidHandle>(fCrtHitModuleLabel); art::fill_ptr_vector(CRTHitList, crthits); - for(const auto& PFPLabel : fPFParticleLabel) { auto it = &PFPLabel - fPFParticleLabel.data(); std::vector> PFParticleList; @@ -207,7 +205,6 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) art::ValidHandle> allhit_handle = e.getValidHandle>(fHitLabel[it]); std::vector> allHits; art::fill_ptr_vector(allHits, allhit_handle); - // Start looping on the particles for (art::Ptr p_pfp: PFParticleList) { const std::vector> thisTrack = fmTracks.at(p_pfp.key()); @@ -299,27 +296,29 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) double crtY=crtHit.y_pos; double crtZ=crtHit.z_pos; - if(crtSys==0){ - double centerDX, centerDY, centerDZ; - centerDX=crtX-fTopCRTCenterMap[(int)crtHit.feb_id[0]].X; - centerDY=crtY-fTopCRTCenterMap[(int)crtHit.feb_id[0]].Y; - centerDZ=crtZ-fTopCRTCenterMap[(int)crtHit.feb_id[0]].Z; - icarus::crt::AffineTrans thisAffine=TopCrtCorrection[(int)crtHit.feb_id[0]]; - std::pair transCrt; - if(crtHit.plane==30) { - transCrt=icarus::crt::AffineTransformation(centerDX, centerDZ, thisAffine); - crtX=transCrt.first; - crtZ=transCrt.second; - } else if(crtHit.plane==31 ||crtHit.plane==32) { - transCrt=icarus::crt::AffineTransformation(centerDY, centerDZ, thisAffine); - crtY=transCrt.first; - crtZ=transCrt.second; - } else if(crtHit.plane==33 ||crtHit.plane==34){ - transCrt=icarus::crt::AffineTransformation(centerDX, centerDY, thisAffine); - crtX=transCrt.first; - crtY=transCrt.second; + if(fData){ // Realignment only applies to Data, not MC + if(crtSys==0){ + double centerDX, centerDY, centerDZ; + centerDX=crtX-fTopCRTCenterMap[(int)crtHit.feb_id[0]].X; + centerDY=crtY-fTopCRTCenterMap[(int)crtHit.feb_id[0]].Y; + centerDZ=crtZ-fTopCRTCenterMap[(int)crtHit.feb_id[0]].Z; + icarus::crt::AffineTrans thisAffine=TopCrtCorrection[(int)crtHit.feb_id[0]]; + std::pair transCrt; + if(crtHit.plane==30) { + transCrt=icarus::crt::AffineTransformation(centerDX, centerDZ, thisAffine); + crtX=transCrt.first; + crtZ=transCrt.second; + } else if(crtHit.plane==31 ||crtHit.plane==32) { + transCrt=icarus::crt::AffineTransformation(centerDY, centerDZ, thisAffine); + crtY=transCrt.first; + crtZ=transCrt.second; + } else if(crtHit.plane==33 ||crtHit.plane==34){ + transCrt=icarus::crt::AffineTransformation(centerDX, centerDY, thisAffine); + crtX=transCrt.first; + crtY=transCrt.second; + } + } - } if(thisCrtPlane.first==0){ deltaX=crtX-crossPoint.X; diff --git a/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl b/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl index 68f18974b..2994dcc92 100644 --- a/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl +++ b/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl @@ -16,7 +16,7 @@ standard_crtmatchingalg: # of 10 us * 0.157 cm/us = 1.57 cm. # As this is phrased, one could think of this as the two variables are related, that is not necessarily # the case, but is still a good guess. - + isData: true # IsData CrtHitModuleLabel: "crthit" TriggerLabel: "daqTrigger" diff --git a/icaruscode/CRT/crtt0tagging.fcl b/icaruscode/CRT/crtt0tagging.fcl index 0b60f3490..a66a84d36 100644 --- a/icaruscode/CRT/crtt0tagging.fcl +++ b/icaruscode/CRT/crtt0tagging.fcl @@ -11,6 +11,29 @@ standard_crtt0tagging: GoodCandidateDistance: 100. # 96 cm maximizes EfficiencyXPurity (both > 92%) MaximumDeltaT: 10000. # Maximal Time difference between a T0 tagged track and CRT Hit time for the combination to be considered acceptable. [ns] + isData: true # Data + + module_type: "CRTT0Tagging" + CrtHitModuleLabel: "crthit" + TriggerLabel: "daqTrigger" + TriggerConfiguration: "triggerconfig" + TPCTrackLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # Track producer module label + PFParticleLabel: ["pandoraGausCryoE", "pandoraGausCryoW"] # PFParticle producer module label + HitLabel: ["cluster3DCryoE" , "cluster3DCryoW"] + MatchingAlg: @local::standard_crtmatchingalg +} + +standard_crtt0taggingmc: +{ + + MinimalTrackLength: 40. # Minimal TrackLength to match with a CRT + MinimumGoodHits: 5 # Minimum number of good hits to perform the fit + MaximalCRTDistance: 300. # Maximal distance between CRT Hit Candidate and Track Projection + GoodCandidateDistance: 100. # 96 cm maximizes EfficiencyXPurity (both > 92%) + MaximumDeltaT: 10000. # Maximal Time difference between a T0 tagged track and CRT Hit time for the combination to be considered acceptable. [ns] + + isData: false #MC + module_type: "CRTT0Tagging" CrtHitModuleLabel: "crthit" TriggerLabel: "daqTrigger" diff --git a/icaruscode/CRT/crtt0taggingmc_icarus.fcl b/icaruscode/CRT/crtt0taggingmc_icarus.fcl new file mode 100644 index 000000000..db621fe75 --- /dev/null +++ b/icaruscode/CRT/crtt0taggingmc_icarus.fcl @@ -0,0 +1,65 @@ +#include "services_common_icarus.fcl" +#include "crtt0matchingalg_icarus.fcl" + +#include "services_icarus_simulation.fcl" +#include "simulationservices.fcl" + +#include "crtt0tagging.fcl" + + + +process_name: CRTT0Tagging + +services: +{ + # Load the service that manages root files for histograms. + TFileService: { fileName: "crtt0tagging_hist.root" } + + message: @local::icarus_message_services_prod_debug + @table::icarus_common_services + +} # services + +source: +{ + module_type: RootInput + + # Number of events to analyze; "-1" means all of the events in the input + # file. You can override this value with the "-n" option on the command line. + maxEvents: -1 + +} + +outputs: +{ + out1: + { + module_type: RootOutput + fileName: "%ifb_%tc_reco.root" + dataTier: "reconstructed" + saveMemoryObjectThreshold: 0 + compressionLevel: 1 + fastCloning: false + } +} + +# The 'physics' section defines and configures some modules to do work on each event. +physics: +{ + producers: + { + CRTT0Tagging: @local::standard_crtt0taggingmc + } + + # Schedule job step(s) for execution by defining the analysis module for this job. + reco: [ CRTT0Tagging ] + + stream1: [ out1 ] + + trigger_paths: [reco] + + # "end_paths" is a keyword and contains the modules that do not modify the art::Event; + # i.e., analyzers and output streams. + end_paths: [ stream1 ] + +} From 39bd6543216a198c32648951d019625c4bd11c01 Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Wed, 23 Oct 2024 19:31:46 +0200 Subject: [PATCH 14/28] Ok now everything works fine and an additional data product is stored which include extra inforamations on the CRT-TPC match. --- icaruscode/CRT/CMakeLists.txt | 1 + icaruscode/CRT/CRTT0Tagging_module.cc | 42 +++++++++++++++++----- icaruscode/CRT/CRTUtils/CRTMatchingUtils.h | 5 +++ icaruscode/IcarusObj/CRTTPCMatchingInfo.h | 41 ++++++++++++++++----- icaruscode/IcarusObj/classes_def.xml | 4 ++- 5 files changed, 74 insertions(+), 19 deletions(-) diff --git a/icaruscode/CRT/CMakeLists.txt b/icaruscode/CRT/CMakeLists.txt index 1a1f6c0b6..e30e923e0 100644 --- a/icaruscode/CRT/CMakeLists.txt +++ b/icaruscode/CRT/CMakeLists.txt @@ -553,6 +553,7 @@ simple_plugin(CRTTPCTruthEff module cet_build_plugin(CRTT0Tagging art::module LIBRARIES + icaruscode::IcarusObj icaruscode_CRTMatchingUtils sbnobj::ICARUS_CRT sbnobj::Common_CRT diff --git a/icaruscode/CRT/CRTT0Tagging_module.cc b/icaruscode/CRT/CRTT0Tagging_module.cc index cb1e67dfa..cf18048e3 100644 --- a/icaruscode/CRT/CRTT0Tagging_module.cc +++ b/icaruscode/CRT/CRTT0Tagging_module.cc @@ -12,6 +12,7 @@ #include "sbnobj/Common/CRT/CRTHit.hh" //#include "icaruscode/CRT/CRTUtils/CRTT0MatchAlg.h" #include "icaruscode/CRT/CRTUtils/CRTMatchingUtils.h" +#include "icaruscode/IcarusObj/CRTTPCMatchingInfo.h" // Framework includes #include "art/Framework/Core/EDProducer.h" @@ -56,6 +57,7 @@ #include "lardataobj/RecoBase/PFParticle.h" #include "lardataobj/AnalysisBase/T0.h" #include "lardataobj/RecoBase/PFParticleMetadata.h" + // ROOT #include "TVector3.h" #include "TH1.h" @@ -140,7 +142,11 @@ icarus::crt::CRTT0Tagging::CRTT0Tagging(fhicl::ParameterSet const& p) produces< std::vector >(); produces< art::Assns >(); - produces< art::Assns >(); + produces< art::Assns >(); + produces< art::Assns >(); + produces< std::vector >(); + produces< art::Assns >(); + produces< art::Assns >(); // Get a pointer to the geometry service provider. fGeometryService = lar::providerFrom(); @@ -176,11 +182,16 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) mf::LogDebug("CRTT0Tagging") << "Skipping because no data (or at least no trigger configuration)."; } + mf::LogDebug("CRTT0Tagging: ") << "beginning production" << '\n'; std::unique_ptr< std::vector > t0col( new std::vector); std::unique_ptr< art::Assns > trackAssn( new art::Assns); - std::unique_ptr< art::Assns > t0CrtHitAssn( new art::Assns ); - + std::unique_ptr< art::Assns > t0CrtHitAssn( new art::Assns); + std::unique_ptr< std::vector > matchInfoCol( new std::vector); + std::unique_ptr< art::Assns > t0matchInfoAssn( new art::Assns); + std::unique_ptr< art::Assns > trackMatchInfoAssn( new art::Assns); + std::unique_ptr< art::Assns > matchInfoCrtHitAssn( new art::Assns); + // CRTHits std::vector> CRTHitList; art::ValidHandle> crthits = e.getValidHandle>(fCrtHitModuleLabel); @@ -287,6 +298,7 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) if(crtSys==2) continue; // lets discard Bottom CRT Hits for the moment double deltaX=std::numeric_limits::signaling_NaN(); + double deltaY=std::numeric_limits::signaling_NaN(); double deltaZ=std::numeric_limits::signaling_NaN(); double crtDistance=std::numeric_limits::signaling_NaN(); @@ -317,22 +329,25 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) crtX=transCrt.first; crtY=transCrt.second; } - } } + if(thisCrtPlane.first==0){ deltaX=crtX-crossPoint.X; + deltaY=0; deltaZ=crtZ-crossPoint.Z; } else if(thisCrtPlane.first==1){ - deltaX=crtY-crossPoint.Y; + deltaX=0; + deltaY=crtY-crossPoint.Y; deltaZ=crtZ-crossPoint.Z; } else if(thisCrtPlane.first==2){ deltaX=crtX-crossPoint.X; - deltaZ=crtY-crossPoint.Y; + deltaY=crtY-crossPoint.Y; + deltaZ=0; } - crtDistance=sqrt(pow(deltaX,2)+pow(deltaZ,2)); + crtDistance=sqrt(pow(deltaX,2)+pow(deltaZ,2)+pow(deltaY,2)); if(crtDistance>fMaximalCRTDistance) continue; - icarus::crt::CandCRT thisCrtCand={crtHit,p_crthit, crtDistance, deltaX, deltaZ}; + icarus::crt::CandCRT thisCrtCand={crtHit,p_crthit, thisCrtPlane.first, crtDistance, deltaX, deltaY, deltaZ, crossPoint.X, crossPoint.Y, crossPoint.Z}; crtCands.push_back(thisCrtCand); } // End of CRT Hit loop if(crtCands.empty()) { @@ -349,13 +364,18 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) else if (bestCrtCand.CRThit.plane==50) matchedSys=2; else matchedSys=1; if(matchedSys==2) continue; // lets discard Bottom CRT Hits for the moment + mf::LogInfo("CRTT0Tagging") <<"Matched CRT time = "<push_back(anab::T0(bestCrtCand.CRThit.ts1_ns, track.ID(), matchedSys, bestCrtCand.CRThit.plane,bestCrtCand.distance)); util::CreateAssn(*this, e, *t0col, trkPtr, *trackAssn); util::CreateAssn(*this, e, *t0col, bestCrtCand.ptrCRThit, *t0CrtHitAssn); - + //icarus::CRTTPCMatchingInfo matchInfo = {bestCrtCand.distance, matchedSys, bestCrtCand.CRThit.plane, bestCrtCand.CRThit.ts1_ns, bestCrtCand.deltaX, bestCrtCand.deltaY, bestCrtCand.deltaZ, bestCrtCand.crossX, bestCrtCand.crossY, bestCrtCand.crossZ, bestCrtCand.plane}; + //matchInfoCol->push_back(matchInfo); + //util::CreateAssn(*this, e, *t0col, *matchInfoCol, *t0matchInfoAssn); + //util::CreateAssn(*this, e, *matchInfoCol, trkPtr, *trackMatchInfoAssn); + //util::CreateAssn(*this, e, *matchInfoCol, bestCrtCand.ptrCRThit, *matchInfoCrtHitAssn); } } // End of Track Loop @@ -364,6 +384,10 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) e.put(std::move(t0col)); e.put(std::move(trackAssn)); e.put(std::move(t0CrtHitAssn)); + e.put(std::move(matchInfoCol)); + e.put(std::move(t0matchInfoAssn)); + e.put(std::move(trackMatchInfoAssn)); + e.put(std::move(matchInfoCrtHitAssn)); } void CRTT0Tagging::endJob() diff --git a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h index 6d337d53b..6d0c61e4c 100644 --- a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h +++ b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h @@ -106,9 +106,14 @@ struct Direction struct CandCRT{ sbn::crt::CRTHit CRThit; art::Ptr ptrCRThit; + int plane; double distance; double deltaX; + double deltaY; double deltaZ; + double crossX; + double crossY; + double crossZ; }; struct ModuleCenter diff --git a/icaruscode/IcarusObj/CRTTPCMatchingInfo.h b/icaruscode/IcarusObj/CRTTPCMatchingInfo.h index a4522a7ee..1efdc0385 100644 --- a/icaruscode/IcarusObj/CRTTPCMatchingInfo.h +++ b/icaruscode/IcarusObj/CRTTPCMatchingInfo.h @@ -24,20 +24,43 @@ struct icarus::CRTTPCMatchingInfo { /// Magic value denoting the absence of DCA information. static constexpr double NoDistance = std::numeric_limits::lowest(); - + static constexpr double noTime = std::numeric_limits::lowest(); + + /// Magic value denoting the absence of CRTs. + static constexpr int noCRT = std::numeric_limits::lowest(); // --- BEGIN -- Data members ------------------------------------------------- /// Distance of closest approach between track extension and CRT hit [cm] - double DCA = NoDistance; - - /// How far the track extension meets the relevant CRT plane [cm] - double extrapLength = NoDistance; - + double trackCrtHitDistance = NoDistance; + + /// Matched CRT Hit sub detector: 0 Top, 1 Side, 2 Bottom + int crtSys = noCRT; + + /// Matched CRT Hit region: 30-34 Top CRT, 40-48 Side CRT, 50 Bottom CRT + int crtRegion = noCRT; + + /// Matched CRT Hit time w.r.t. trigger [ns] + double crtTime = noTime; + + /// Distance distinguished into its components DX, DY, DZ [cm] + double deltaX = NoDistance; + double deltaY = NoDistance; + double deltaZ = NoDistance; + + /// Extrapolated Track Projection Crossing Point onto the CRT Plane + double crossX = NoDistance; + double crossY = NoDistance; + double crossZ = NoDistance; + + /// Fix Coordinate for the CRT Plane: + /// For Top CRT region 30 Y coordinate is constant: plane=0 + /// For Top CRT region 31/32 and Side CRT 40/41/42/43/44/45 X coordinate is constant: plane=1 + /// For Top CRT region 33/34 and Side CRT 46/47 Z coordinate is constant: plane=2 + int plane=-1; + // --- END ---- Data members ------------------------------------------------- - - - + }; // icarus::CRTTPCMatchingInfo diff --git a/icaruscode/IcarusObj/classes_def.xml b/icaruscode/IcarusObj/classes_def.xml index 5c32eb98c..97fe5b0be 100644 --- a/icaruscode/IcarusObj/classes_def.xml +++ b/icaruscode/IcarusObj/classes_def.xml @@ -66,7 +66,9 @@ - + + + From b7783d4683347ed775cbcc9654131e72bcf244e9 Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Fri, 25 Oct 2024 19:40:20 +0200 Subject: [PATCH 15/28] This Commit introduces a summary tree which gets produced along with the data product. Another improvements which is introduced is the access of truth level information for MC. In particular, I set up a variabile which is called TruthMatch which address whether at truth level the CRT hit and the Tracks are generated by the same Geant4 ID particle. So far, this variable is only stored in the tree, but I am planning to include it in the icart::CRTTPCMatchingInfo object --- icaruscode/CRT/CRTT0Tagging_module.cc | 227 +++++++++++++++++++++-- icaruscode/CRT/CRTUtils/RecoUtils.cc | 28 +++ icaruscode/CRT/CRTUtils/RecoUtils.h | 4 + icaruscode/CRT/crtt0tagging.fcl | 3 + icaruscode/CRT/crtt0taggingmc_icarus.fcl | 7 +- icaruscode/IcarusObj/classes_def.xml | 18 +- 6 files changed, 267 insertions(+), 20 deletions(-) diff --git a/icaruscode/CRT/CRTT0Tagging_module.cc b/icaruscode/CRT/CRTT0Tagging_module.cc index cf18048e3..bd7e62ba6 100644 --- a/icaruscode/CRT/CRTT0Tagging_module.cc +++ b/icaruscode/CRT/CRTT0Tagging_module.cc @@ -13,6 +13,8 @@ //#include "icaruscode/CRT/CRTUtils/CRTT0MatchAlg.h" #include "icaruscode/CRT/CRTUtils/CRTMatchingUtils.h" #include "icaruscode/IcarusObj/CRTTPCMatchingInfo.h" +#include "icaruscode/CRT/CRTUtils/RecoUtils.h" +#include "icaruscode/CRT/CRTUtils/CRTCommonUtils.h" // Framework includes #include "art/Framework/Core/EDProducer.h" @@ -38,6 +40,9 @@ #include // LArSoft +#include "larsim/MCCheater/BackTrackerService.h" +#include "larsim/MCCheater/BackTracker.h" +#include "larsim/MCCheater/ParticleInventoryService.h" #include "larcore/Geometry/Geometry.h" #include "larcorealg/Geometry/GeometryCore.h" #include "larcorealg/Geometry/PlaneGeo.h" @@ -101,6 +106,15 @@ class icarus::crt::CRTT0Tagging : public art::EDProducer { // Declare member data here. + // MC Truth + art::InputTag fSimulationProducerLabel; + art::InputTag fAuxDetSimProducerLabel; + //art::InputTag fCRTSimHitProducerLabel; + //art::InputTag fCRTTrueHitProducerLabel; + //art::InputTag fCRTDetSimProducerLabel; + //art::InputTag fCRTSimTrackProducerLabel; + std::string fSimChannelProducerLabel; + art::InputTag fCrtHitModuleLabel; art::InputTag fTriggerLabel; art::InputTag fTriggerConfigurationLabel; @@ -111,12 +125,16 @@ class icarus::crt::CRTT0Tagging : public art::EDProducer { art::InputTag fTRKHMproducer; ///< labels for hit metadata std::optional fTriggerConfiguration; + art::ServiceHandle tfs; geo::GeometryCore const* fGeometryService; ///< pointer to Geometry provider CRTCommonUtils* fCrtUtils; icarus::crt::TopCRTCentersMap fTopCRTCenterMap; icarus::crt::TopCrtTransformations fTopCrtTransformations; + + CRTMatchingAlg fMatchingAlg; + double fMinimalTrackLength; int fMinimumGoodHits; double fMaximalCRTDistance; @@ -124,10 +142,33 @@ class icarus::crt::CRTT0Tagging : public art::EDProducer { double fMaximumDeltaT; bool fData; + TTree* fTree; + int fEvent; ///< number of the event being processed + int fRun; ///< number of the run being processed + int fSubRun; ///< number of the sub-run being processed + int fCrtRegion; + int fCrtSys; + int fCryo; + double fTrackLength; + double fTrackCrtDistance; + double fTrackCrtDeltaX; + double fTrackCrtDeltaY; + double fTrackCrtDeltaZ; + double fCrtX; + double fCrtY; + double fCrtZ; + double fCrossPointX; + double fCrossPointY; + double fCrossPointZ; + bool fTrueMatch; + }; icarus::crt::CRTT0Tagging::CRTT0Tagging(fhicl::ParameterSet const& p) : EDProducer{p}, + fSimulationProducerLabel(p.get("SimulationLabel","largeant")), + fAuxDetSimProducerLabel(p.get("AuxDetSimProducerLabel","genericcrt")), + fSimChannelProducerLabel(p.get< std::string>("SimChannelProducer", {"daq:simpleSC"})), fCrtHitModuleLabel(p.get("CrtHitModuleLabel", "crthit")), fTriggerLabel(p.get("TriggerLabel", "daqTrigger")), fTriggerConfigurationLabel( @@ -143,10 +184,10 @@ icarus::crt::CRTT0Tagging::CRTT0Tagging(fhicl::ParameterSet const& p) produces< std::vector >(); produces< art::Assns >(); produces< art::Assns >(); - produces< art::Assns >(); produces< std::vector >(); - produces< art::Assns >(); - produces< art::Assns >(); + //produces< art::Assns >(); + //produces< art::Assns >(); + //produces< art::Assns >(); // Get a pointer to the geometry service provider. fGeometryService = lar::providerFrom(); @@ -156,7 +197,6 @@ icarus::crt::CRTT0Tagging::CRTT0Tagging(fhicl::ParameterSet const& p) fGoodCandidateDistance = p.get("GoodCandidateDistance", 100.); fMaximumDeltaT = p.get("MaximumDeltaT", 10000.); fData = p.get("isData", true); - art::ServiceHandle tfs; } @@ -171,6 +211,27 @@ void icarus::crt::CRTT0Tagging::beginRun(art::Run& r) fTopCRTCenterMap=icarus::crt::LoadTopCRTCenters(); fTopCrtTransformations=icarus::crt::LoadTopCrtTransformations(); + + fTree = tfs->make("matchTree","CRTHit - TPC track matching analysis"); + + fTree->Branch("Event", &fEvent, "Event/I"); + fTree->Branch("SubRun", &fSubRun, "SubRun/I"); + fTree->Branch("Run", &fRun, "Run/I"); + fTree->Branch("Cryo", &fCryo, "Cryo/I"); + fTree->Branch("CrtSys", &fCrtSys, "CrtSys/I"); + fTree->Branch("CrtRegion", &fCrtRegion, "CrtRegion/I"); + fTree->Branch("TrackLength", &fTrackLength ); + fTree->Branch("TrackCrtDistance", &fTrackCrtDistance ); + fTree->Branch("TrackCrtDeltaX", &fTrackCrtDeltaX ); + fTree->Branch("TrackCrtDeltaY", &fTrackCrtDeltaY ); + fTree->Branch("TrackCrtDeltaZ", &fTrackCrtDeltaZ ); + fTree->Branch("CrtX", &fCrtX ); + fTree->Branch("CrtY", &fCrtY ); + fTree->Branch("CrtZ", &fCrtZ ); + fTree->Branch("CrossPointX", &fCrossPointX ); + fTree->Branch("CrossPointY", &fCrossPointY ); + fTree->Branch("CrossPointZ", &fCrossPointZ ); + fTree->Branch("TrueMatch", &fTrueMatch ); } void icarus::crt::CRTT0Tagging::produce(art::Event& e) @@ -186,16 +247,106 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) mf::LogDebug("CRTT0Tagging: ") << "beginning production" << '\n'; std::unique_ptr< std::vector > t0col( new std::vector); std::unique_ptr< art::Assns > trackAssn( new art::Assns); - std::unique_ptr< art::Assns > t0CrtHitAssn( new art::Assns); + std::unique_ptr< art::Assns > t0CrtHitAssn( new art::Assns); std::unique_ptr< std::vector > matchInfoCol( new std::vector); - std::unique_ptr< art::Assns > t0matchInfoAssn( new art::Assns); - std::unique_ptr< art::Assns > trackMatchInfoAssn( new art::Assns); - std::unique_ptr< art::Assns > matchInfoCrtHitAssn( new art::Assns); + //std::unique_ptr< art::Assns > t0matchInfoAssn( new art::Assns); + //std::unique_ptr< art::Assns > trackMatchInfoAssn( new art::Assns); + //std::unique_ptr< art::Assns > matchInfoCrtHitAssn( new art::Assns); + + std::map< int, const simb::MCParticle*> particleMap; + std::map,std::vector> crtParticleMap; + std::map isNuMap; + std::vector> simchannels; // CRTHits std::vector> CRTHitList; art::ValidHandle> crthits = e.getValidHandle>(fCrtHitModuleLabel); art::fill_ptr_vector(CRTHitList, crthits); + + if(!fData){ + art::ServiceHandle partInventory; + if (fSimChannelProducerLabel.size()) { + art::ValidHandle> simchannel_handle = e.getValidHandle>(fSimChannelProducerLabel); + art::fill_ptr_vector(simchannels, simchannel_handle); + } + + // Define "handle" to Generator level MCTruth objects + art::Handle< vector> genHandle; + // Define a "handle" to point to a vector of MCParticle objects. + art::Handle< vector > particleHandle; + + if (!e.getByLabel("generator", genHandle)) { + std::cout << "could not get handle to gen objects!!!" << std::endl; + } + + if (!e.getByLabel(fSimulationProducerLabel, particleHandle)) + { + // If we have no MCParticles at all in an event, then we're in + // big trouble. Throw an exception. + throw cet::exception("CRTT0Tagging") + << " No simb::MCParticle objects in this event - " + << " Line " << __LINE__ << " in file " << __FILE__ << std::endl; + } + + // Handle to AuxDetSimChannel (CRT module) objects generated by LArG4 + art::Handle > auxDetSimChannelHandle; + if (!e.getByLabel(fAuxDetSimProducerLabel, auxDetSimChannelHandle)) { + throw cet::exception("CRTT0Tagging") + << " No sim::AuxDetSimChannel objects in this event - " + << " Line " << __LINE__ << " in file " << __FILE__ << std::endl; + } + //if((*genHandle).size()>1) + // throw cet::exception("CRTT0Tagging") << "gen stage MCParticle vector has more than 1 entry!" << '\n'; + + for ( auto const& particle : (*particleHandle) ){ + // Add the address of the MCParticle to the map, with the + // track ID as the key. + particleMap.insert(std::make_pair(particle.TrackId(),&particle)); + + art::Ptr getMCTruth=partInventory->ParticleToMCTruth_P(&particle); + + bool isNu=false; + + if (getMCTruth->Origin() == simb::kBeamNeutrino) isNu=true; + + isNuMap.insert(std::make_pair(particle.TrackId(),isNu)); + + for ( auto const& channel : (*auxDetSimChannelHandle) ){ + auto const& auxDetIDEs = channel.AuxDetIDEs(); + for ( auto const& ide : auxDetIDEs ){ + if ( ide.trackID != particle.TrackId() ) continue; + if ( ide.energyDeposited * 1.0e6 < 50 ) continue; + size_t adid = channel.AuxDetID(); + uint32_t region=fCrtUtils->AuxDetRegionNameToNum(fCrtUtils->GetAuxDetRegion(adid)); + uint32_t modID=channel.AuxDetID(); + float entryT=ide.entryT; + float exitT=ide.exitT; + + for(auto const& crthit : CRTHitList){ + if(crthit->plane!=(int)region) continue; + if(abs((entryT+exitT)/2-crthit->ts1_ns)>200) continue; + bool modFound=false; + for(auto const& mactopes : crthit->pesmap){ + for(auto const& chanpe : mactopes.second) { + int thisModID =(int)fCrtUtils->MacToAuxDetID(mactopes.first, chanpe.first); + if(thisModID==(int)modID) modFound=true; + } + } + if(!modFound)continue; + std::pair thisMatch=std::make_pair((int)crthit->feb_id[0],crthit->ts1_ns); + if (crtParticleMap.find(thisMatch) != crtParticleMap.end()){ + crtParticleMap[thisMatch].push_back(particle.TrackId()); + } else { + crtParticleMap.insert(std::pair,std::vector>(thisMatch, std::vector())); + crtParticleMap[thisMatch].push_back(particle.TrackId()); + } + } + } + } + } + + } + for(const auto& PFPLabel : fPFParticleLabel) { auto it = &PFPLabel - fPFParticleLabel.data(); std::vector> PFParticleList; @@ -216,6 +367,16 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) art::ValidHandle> allhit_handle = e.getValidHandle>(fHitLabel[it]); std::vector> allHits; art::fill_ptr_vector(allHits, allhit_handle); + + std::map>> id_to_ide_map; + std::map>> id_to_truehit_map; + + if(simchannels.size() && !fData){ + art::ServiceHandle btServ; + id_to_ide_map = RecoUtils::PrepSimChannels(simchannels, *fGeometryService); + id_to_truehit_map = RecoUtils::PrepTrueHits(allHits, clockData, *btServ.get()); + } + // Start looping on the particles for (art::Ptr p_pfp: PFParticleList) { const std::vector> thisTrack = fmTracks.at(p_pfp.key()); @@ -231,6 +392,9 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) if(track.Length()::signaling_NaN(); auto t0s = fmt0pandora.at(p_pfp.key()); @@ -364,18 +528,51 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) else if (bestCrtCand.CRThit.plane==50) matchedSys=2; else matchedSys=1; if(matchedSys==2) continue; // lets discard Bottom CRT Hits for the moment + bool trueMatch=false; + if(!fData){ + std::vector crtTracks, crtPdgs; + std::pair thisMatch=std::make_pair((int)bestCrtCand.CRThit.feb_id[0], bestCrtCand.CRThit.ts1_ns); + if(crtParticleMap.find(thisMatch) != crtParticleMap.end()){ + for(size_t j=0; jPdgCode()); + } + } + for(size_t thisID=0; thisIDFill(); mf::LogInfo("CRTT0Tagging") <<"Matched CRT time = "<push_back(anab::T0(bestCrtCand.CRThit.ts1_ns, track.ID(), matchedSys, bestCrtCand.CRThit.plane,bestCrtCand.distance)); util::CreateAssn(*this, e, *t0col, trkPtr, *trackAssn); util::CreateAssn(*this, e, *t0col, bestCrtCand.ptrCRThit, *t0CrtHitAssn); - //icarus::CRTTPCMatchingInfo matchInfo = {bestCrtCand.distance, matchedSys, bestCrtCand.CRThit.plane, bestCrtCand.CRThit.ts1_ns, bestCrtCand.deltaX, bestCrtCand.deltaY, bestCrtCand.deltaZ, bestCrtCand.crossX, bestCrtCand.crossY, bestCrtCand.crossZ, bestCrtCand.plane}; - //matchInfoCol->push_back(matchInfo); + icarus::CRTTPCMatchingInfo matchInfo = {bestCrtCand.distance, matchedSys, bestCrtCand.CRThit.plane, bestCrtCand.CRThit.ts1_ns, bestCrtCand.deltaX, bestCrtCand.deltaY, bestCrtCand.deltaZ, bestCrtCand.crossX, bestCrtCand.crossY, bestCrtCand.crossZ, bestCrtCand.plane}; + matchInfoCol->push_back(matchInfo); //util::CreateAssn(*this, e, *t0col, *matchInfoCol, *t0matchInfoAssn); - //util::CreateAssn(*this, e, *matchInfoCol, trkPtr, *trackMatchInfoAssn); - //util::CreateAssn(*this, e, *matchInfoCol, bestCrtCand.ptrCRThit, *matchInfoCrtHitAssn); + // util::CreateAssn(*this, e, *matchInfoCol, trkPtr, *trackMatchInfoAssn); + // util::CreateAssn(*this, e, *matchInfoCol, bestCrtCand.ptrCRThit, *matchInfoCrtHitAssn); } } // End of Track Loop @@ -385,9 +582,9 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) e.put(std::move(trackAssn)); e.put(std::move(t0CrtHitAssn)); e.put(std::move(matchInfoCol)); - e.put(std::move(t0matchInfoAssn)); - e.put(std::move(trackMatchInfoAssn)); - e.put(std::move(matchInfoCrtHitAssn)); + //e.put(std::move(t0matchInfoAssn)); + //e.put(std::move(trackMatchInfoAssn)); + //e.put(std::move(matchInfoCrtHitAssn)); } void CRTT0Tagging::endJob() diff --git a/icaruscode/CRT/CRTUtils/RecoUtils.cc b/icaruscode/CRT/CRTUtils/RecoUtils.cc index 00ca4c99e..ae1421deb 100644 --- a/icaruscode/CRT/CRTUtils/RecoUtils.cc +++ b/icaruscode/CRT/CRTUtils/RecoUtils.cc @@ -25,7 +25,35 @@ int RecoUtils::TrueParticleID(detinfo::DetectorClocksData const& clockData, return likely_track_id; } +std::map>> RecoUtils::PrepSimChannels(const std::vector> &simchannels, const geo::GeometryCore &geo) { + std::map>> ret; + + for (const art::Ptr sc : simchannels) { + // Lookup the wire of this channel + raw::ChannelID_t channel = sc->Channel(); + std::vector maybewire = geo.ChannelToWire(channel); + geo::WireID thisWire; // Default constructor makes invalid wire + if (maybewire.size()) thisWire = maybewire[0]; + for (const auto &item : sc->TDCIDEMap()) { + for (const sim::IDE &ide: item.second) { + // indexing initializes empty vector + ret[abs(ide.trackID)].push_back({thisWire, &ide}); + } + } + } + return ret; +} +std::map>> RecoUtils::PrepTrueHits(const std::vector> &allHits, + const detinfo::DetectorClocksData &clockData, const cheat::BackTrackerService &backtracker) { + std::map>> ret; + for (const art::Ptr h: allHits) { + for (int ID: backtracker.HitToTrackIds(clockData, *h)) { + ret[abs(ID)].push_back(h); + } + } + return ret; +} int RecoUtils::TrueParticleIDFromTotalTrueEnergy(detinfo::DetectorClocksData const& clockData, const std::vector >& hits, bool rollup_unsaved_ids) { art::ServiceHandle bt_serv; diff --git a/icaruscode/CRT/CRTUtils/RecoUtils.h b/icaruscode/CRT/CRTUtils/RecoUtils.h index 3f90f4d0e..de6d11026 100644 --- a/icaruscode/CRT/CRTUtils/RecoUtils.h +++ b/icaruscode/CRT/CRTUtils/RecoUtils.h @@ -76,6 +76,10 @@ namespace RecoUtils{ double CalculateTrackLength(const art::Ptr track); + std::map>> PrepSimChannels(const std::vector> &simchannels, const geo::GeometryCore &geo); + + std::map>> PrepTrueHits(const std::vector> &allHits, const detinfo::DetectorClocksData &clockData, const cheat::BackTrackerService &backtracker); + } #endif diff --git a/icaruscode/CRT/crtt0tagging.fcl b/icaruscode/CRT/crtt0tagging.fcl index a66a84d36..c847895f9 100644 --- a/icaruscode/CRT/crtt0tagging.fcl +++ b/icaruscode/CRT/crtt0tagging.fcl @@ -42,6 +42,9 @@ standard_crtt0taggingmc: PFParticleLabel: ["pandoraGausCryoE", "pandoraGausCryoW"] # PFParticle producer module label HitLabel: ["cluster3DCryoE" , "cluster3DCryoW"] MatchingAlg: @local::standard_crtmatchingalg + SimulationLabel: "largeant" + AuxDetSimProducerLabel: "genericcrt" + SimChannelProducer: "daq:simpleSC" } END_PROLOG diff --git a/icaruscode/CRT/crtt0taggingmc_icarus.fcl b/icaruscode/CRT/crtt0taggingmc_icarus.fcl index db621fe75..7ad1b6e9b 100644 --- a/icaruscode/CRT/crtt0taggingmc_icarus.fcl +++ b/icaruscode/CRT/crtt0taggingmc_icarus.fcl @@ -1,9 +1,8 @@ #include "services_common_icarus.fcl" #include "crtt0matchingalg_icarus.fcl" - #include "services_icarus_simulation.fcl" #include "simulationservices.fcl" - +#include "backtrackerservice.fcl" #include "crtt0tagging.fcl" @@ -14,11 +13,13 @@ services: { # Load the service that manages root files for histograms. TFileService: { fileName: "crtt0tagging_hist.root" } - + ParticleInventoryService: @local::standard_particleinventoryservice + BackTrackerService: @local::standard_backtrackerservice # from `backtrackerservice.fcl` (`larsim`) message: @local::icarus_message_services_prod_debug @table::icarus_common_services } # services +services.BackTrackerService.BackTracker.SimChannelModuleLabel: "daq:simpleSC" source: { diff --git a/icaruscode/IcarusObj/classes_def.xml b/icaruscode/IcarusObj/classes_def.xml index 97fe5b0be..3b2752bd4 100644 --- a/icaruscode/IcarusObj/classes_def.xml +++ b/icaruscode/IcarusObj/classes_def.xml @@ -72,7 +72,16 @@ - + + + + - + + From d8e4334e9c6a6dd3319c346336f8477cf1970fdd Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Fri, 10 Jan 2025 15:45:51 +0100 Subject: [PATCH 16/28] Addressing some of the easier comments from Gianluca --- icaruscode/CRT/CRTT0Tagging_module.cc | 58 ++++++++++----------------- 1 file changed, 22 insertions(+), 36 deletions(-) diff --git a/icaruscode/CRT/CRTT0Tagging_module.cc b/icaruscode/CRT/CRTT0Tagging_module.cc index bd7e62ba6..d86c7f65d 100644 --- a/icaruscode/CRT/CRTT0Tagging_module.cc +++ b/icaruscode/CRT/CRTT0Tagging_module.cc @@ -1,13 +1,8 @@ -///////////////////////////////////////////////////////////////////////////// -/// Class: CRTT0Tagging -/// Module Type: producer -/// File: CRTT0Tagging_module.cc -/// -/// Author: Francesco Poppi -/// E-mail address: poppi@bo.infn.it -/// October 2024 -/// -///////////////////////////////////////////////////////////////////////////// +/** + * @file icaruscode/CRT/CRTT0Tagging_module.cc + * @author Francesco Poppi (poppi@bo.infn.it) + * @date October 2024 + */ #include "sbnobj/Common/CRT/CRTHit.hh" //#include "icaruscode/CRT/CRTUtils/CRTT0MatchAlg.h" @@ -70,13 +65,11 @@ #include "TVector3.h" #include "TTree.h" -namespace icarus { -namespace crt { +namespace icarus::crt { class CRTT0Tagging; -} // namespace crt -} // namespace icarus +} // namespace icarus::crt using namespace icarus::crt; @@ -128,7 +121,7 @@ class icarus::crt::CRTT0Tagging : public art::EDProducer { art::ServiceHandle tfs; geo::GeometryCore const* fGeometryService; ///< pointer to Geometry provider - CRTCommonUtils* fCrtUtils; + CRTCommonUtils fCrtUtils; icarus::crt::TopCRTCentersMap fTopCRTCenterMap; icarus::crt::TopCrtTransformations fTopCrtTransformations; @@ -171,14 +164,20 @@ icarus::crt::CRTT0Tagging::CRTT0Tagging(fhicl::ParameterSet const& p) fSimChannelProducerLabel(p.get< std::string>("SimChannelProducer", {"daq:simpleSC"})), fCrtHitModuleLabel(p.get("CrtHitModuleLabel", "crthit")), fTriggerLabel(p.get("TriggerLabel", "daqTrigger")), - fTriggerConfigurationLabel( - p.get("TriggerConfiguration", "triggerconfig")), + fTriggerConfigurationLabel(p.get("TriggerConfiguration", "triggerconfig")), fTPCTrackLabel(p.get< std::vector >("TPCTrackLabel", {""})), fPFParticleLabel(p.get< std::vector >("PFParticleLabel", {""})), fHitLabel(p.get< std::vector >("HitLabel", {""})), fTRKHMproducer(p.get< art::InputTag > ("TRKHMproducer", "")), fCrtUtils(new CRTCommonUtils()), - fMatchingAlg(p.get ("MatchingAlg")) + fMatchingAlg(p.get ("MatchingAlg")), + fGeometryService(lar::providerFrom()), + fMinimalTrackLength(p.get("MinimalTrackLength", 40.0)), + fMinimumGoodHits(p.get("MinimumGoodHits", 5)), + fMaximalCRTDistance(p.get("MaximalCRTDistance", 300.)), + fGoodCandidateDistance(p.get("GoodCandidateDistance", 100.)), + fMaximumDeltaT(p.get("MaximumDeltaT", 10000.)), + fData(p.get("isData", true)) { produces< std::vector >(); @@ -188,26 +187,13 @@ icarus::crt::CRTT0Tagging::CRTT0Tagging(fhicl::ParameterSet const& p) //produces< art::Assns >(); //produces< art::Assns >(); //produces< art::Assns >(); - - // Get a pointer to the geometry service provider. - fGeometryService = lar::providerFrom(); - fMinimalTrackLength = p.get("MinimalTrackLength", 40.0); - fMinimumGoodHits = p.get("MinimumGoodHits", 5); - fMaximalCRTDistance = p.get("MaximalCRTDistance", 300.); - fGoodCandidateDistance = p.get("GoodCandidateDistance", 100.); - fMaximumDeltaT = p.get("MaximumDeltaT", 10000.); - fData = p.get("isData", true); - } void icarus::crt::CRTT0Tagging::beginRun(art::Run& r) { - // we don't know if this is data or not; if not, there will be no trigger config - auto const& trigConfHandle = - r.getHandle(fTriggerConfigurationLabel); - - fTriggerConfiguration - = trigConfHandle.isValid()? std::make_optional(*trigConfHandle): std::nullopt; + fTriggerConfiguration = (fData && fTriggerConfigurationLabel) + ? std::make_optional(r.getProduct(fTriggerConfigurationLabel)) + : std::nullopt; fTopCRTCenterMap=icarus::crt::LoadTopCRTCenters(); fTopCrtTransformations=icarus::crt::LoadTopCrtTransformations(); @@ -317,7 +303,7 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) if ( ide.trackID != particle.TrackId() ) continue; if ( ide.energyDeposited * 1.0e6 < 50 ) continue; size_t adid = channel.AuxDetID(); - uint32_t region=fCrtUtils->AuxDetRegionNameToNum(fCrtUtils->GetAuxDetRegion(adid)); + uint32_t region=fCrtUtils.AuxDetRegionNameToNum(fCrtUtils.GetAuxDetRegion(adid)); uint32_t modID=channel.AuxDetID(); float entryT=ide.entryT; float exitT=ide.exitT; @@ -328,7 +314,7 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) bool modFound=false; for(auto const& mactopes : crthit->pesmap){ for(auto const& chanpe : mactopes.second) { - int thisModID =(int)fCrtUtils->MacToAuxDetID(mactopes.first, chanpe.first); + int thisModID =(int)fCrtUtils.MacToAuxDetID(mactopes.first, chanpe.first); if(thisModID==(int)modID) modFound=true; } } From 10d8bd30841c66223a44441401ce76d0f6634007 Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Tue, 14 Jan 2025 12:13:42 +0100 Subject: [PATCH 17/28] This commits includes a lot of Gianluca's requests --- icaruscode/CRT/CMakeLists.txt | 36 ++--- icaruscode/CRT/CRTT0Tagging_module.cc | 134 +++++++-------- icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx | 162 +++++++++++++------ icaruscode/CRT/CRTUtils/CRTMatchingUtils.h | 146 ++++++++--------- icaruscode/CRT/CRTUtils/CRTT0MatchAlg.h | 23 +-- icaruscode/CRT/CRTUtils/RecoUtils.cc | 8 +- icaruscode/IcarusObj/CRTTPCMatchingInfo.h | 16 +- 7 files changed, 271 insertions(+), 254 deletions(-) diff --git a/icaruscode/CRT/CMakeLists.txt b/icaruscode/CRT/CMakeLists.txt index e30e923e0..b543402e2 100644 --- a/icaruscode/CRT/CMakeLists.txt +++ b/icaruscode/CRT/CMakeLists.txt @@ -67,33 +67,15 @@ art_make_library( SOURCE CRTUtils/CRTMatchingUtils.cxx LIBRARIES - sbnobj::ICARUS_CRT - sbnobj::Common_CRT - icaruscode_CRTUtils - larcorealg::Geometry - larcore::Geometry_Geometry_service - larsim::Simulation lardataobj::Simulation - larsim::MCCheater_BackTrackerService_service - larsim::MCCheater_ParticleInventoryService_service - lardata::Utilities - larevt::Filters - lardataobj::RawData - lardataobj::RecoBase - lardataobj::AnalysisBase - lardata::RecoObjects - larpandora::LArPandoraInterface - larcorealg::Geometry - nusimdata::SimulationBase - art::Persistency_Common canvas::canvas - art::Persistency_Provenance - art::Utilities - ROOT::Core - ROOT::Geom - ROOT::XMLIO - ROOT::Gdml - ROOT::Spectrum - ROOT::RooFit - ROOT::RooFitCore + fhiclcpp::fhiclcpp + canvas::canvas + lardataobj::RecoBase + larcorealg::Geometry + lardataalg::DetectorInfo + sbnobj::Common_CRT + cetlib::cetlib + messagefacility::MF_MessageLogger + ROOT::Matrix ) cet_build_plugin(CRTGeometryHelper art::service diff --git a/icaruscode/CRT/CRTT0Tagging_module.cc b/icaruscode/CRT/CRTT0Tagging_module.cc index d86c7f65d..f3d04dd44 100644 --- a/icaruscode/CRT/CRTT0Tagging_module.cc +++ b/icaruscode/CRT/CRTT0Tagging_module.cc @@ -77,7 +77,7 @@ class icarus::crt::CRTT0Tagging : public art::EDProducer { public: using CRTHit = sbn::crt::CRTHit; - using CRTPMTMatching = sbn::crt::CRTPMTMatching; + //using CRTPMTMatching = sbn::crt::CRTPMTMatching; explicit CRTT0Tagging(fhicl::ParameterSet const& p); @@ -91,7 +91,8 @@ class icarus::crt::CRTT0Tagging : public art::EDProducer { CRTT0Tagging& operator=(CRTT0Tagging&&) = delete; // Required functions. - void beginRun(art::Run& r) override; + //void beginRun(art::Run& r) override; + void beginJob() override; void produce(art::Event& e) override; void endJob() override; @@ -106,28 +107,21 @@ class icarus::crt::CRTT0Tagging : public art::EDProducer { //art::InputTag fCRTTrueHitProducerLabel; //art::InputTag fCRTDetSimProducerLabel; //art::InputTag fCRTSimTrackProducerLabel; - std::string fSimChannelProducerLabel; + art::InputTag fSimChannelProducerLabel; art::InputTag fCrtHitModuleLabel; - art::InputTag fTriggerLabel; - art::InputTag fTriggerConfigurationLabel; std::vector fTPCTrackLabel; ///< labels for source of tracks std::vector fPFParticleLabel; ///< labels for source of PFParticle std::vector fHitLabel; ///< labels for source of hits art::InputTag fTRKHMproducer; ///< labels for hit metadata - std::optional fTriggerConfiguration; art::ServiceHandle tfs; - geo::GeometryCore const* fGeometryService; ///< pointer to Geometry provider CRTCommonUtils fCrtUtils; - icarus::crt::TopCRTCentersMap fTopCRTCenterMap; - icarus::crt::TopCrtTransformations fTopCrtTransformations; - - CRTMatchingAlg fMatchingAlg; - + geo::GeometryCore const* fGeometryService; ///< pointer to Geometry provider + double fMinimalTrackLength; int fMinimumGoodHits; double fMaximalCRTDistance; @@ -135,6 +129,10 @@ class icarus::crt::CRTT0Tagging : public art::EDProducer { double fMaximumDeltaT; bool fData; + icarus::crt::TopCRTCentersMap fTopCRTCenterMap; + icarus::crt::TopCRTTransformations fTopCRTTransformations; + + TTree* fTree; int fEvent; ///< number of the event being processed int fRun; ///< number of the run being processed @@ -161,15 +159,12 @@ icarus::crt::CRTT0Tagging::CRTT0Tagging(fhicl::ParameterSet const& p) : EDProducer{p}, fSimulationProducerLabel(p.get("SimulationLabel","largeant")), fAuxDetSimProducerLabel(p.get("AuxDetSimProducerLabel","genericcrt")), - fSimChannelProducerLabel(p.get< std::string>("SimChannelProducer", {"daq:simpleSC"})), + fSimChannelProducerLabel(p.get("SimChannelProducer", {"daq:simpleSC"})), fCrtHitModuleLabel(p.get("CrtHitModuleLabel", "crthit")), - fTriggerLabel(p.get("TriggerLabel", "daqTrigger")), - fTriggerConfigurationLabel(p.get("TriggerConfiguration", "triggerconfig")), fTPCTrackLabel(p.get< std::vector >("TPCTrackLabel", {""})), fPFParticleLabel(p.get< std::vector >("PFParticleLabel", {""})), fHitLabel(p.get< std::vector >("HitLabel", {""})), fTRKHMproducer(p.get< art::InputTag > ("TRKHMproducer", "")), - fCrtUtils(new CRTCommonUtils()), fMatchingAlg(p.get ("MatchingAlg")), fGeometryService(lar::providerFrom()), fMinimalTrackLength(p.get("MinimalTrackLength", 40.0)), @@ -189,14 +184,11 @@ icarus::crt::CRTT0Tagging::CRTT0Tagging(fhicl::ParameterSet const& p) //produces< art::Assns >(); } -void icarus::crt::CRTT0Tagging::beginRun(art::Run& r) +//void icarus::crt::CRTT0Tagging::beginRun(art::Run& r) +void icarus::crt::CRTT0Tagging::beginJob() { - fTriggerConfiguration = (fData && fTriggerConfigurationLabel) - ? std::make_optional(r.getProduct(fTriggerConfigurationLabel)) - : std::nullopt; - fTopCRTCenterMap=icarus::crt::LoadTopCRTCenters(); - fTopCrtTransformations=icarus::crt::LoadTopCrtTransformations(); + fTopCRTTransformations=icarus::crt::LoadTopCRTTransformations(); fTree = tfs->make("matchTree","CRTHit - TPC track matching analysis"); @@ -224,20 +216,16 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) { auto const clockData = art::ServiceHandle()->DataFor(e); auto const detProp = art::ServiceHandle()->DataFor(e, clockData); - - if (!fTriggerConfiguration) { - mf::LogDebug("CRTT0Tagging") - << "Skipping because no data (or at least no trigger configuration)."; - } mf::LogDebug("CRTT0Tagging: ") << "beginning production" << '\n'; - std::unique_ptr< std::vector > t0col( new std::vector); - std::unique_ptr< art::Assns > trackAssn( new art::Assns); - std::unique_ptr< art::Assns > t0CrtHitAssn( new art::Assns); - std::unique_ptr< std::vector > matchInfoCol( new std::vector); - //std::unique_ptr< art::Assns > t0matchInfoAssn( new art::Assns); - //std::unique_ptr< art::Assns > trackMatchInfoAssn( new art::Assns); - //std::unique_ptr< art::Assns > matchInfoCrtHitAssn( new art::Assns); + + auto t0col = std::make_unique< std::vector > (); + auto trackAssn = std::make_unique< art::Assns >(); + auto t0CrtHitAssn = std::make_unique< art::Assns >(); + auto matchInfoCol = std::make_unique< std::vector >(); + //auto t0matchInfoAssn = std::make_unique< art::Assns >(); + //auto trackMatchInfoAssn = std::make_unique< art::Assns >(); + //auto matchInfoCrtHitAssn = std::make_unique< art::Assns >(); std::map< int, const simb::MCParticle*> particleMap; std::map,std::vector> crtParticleMap; @@ -251,10 +239,14 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) if(!fData){ art::ServiceHandle partInventory; - if (fSimChannelProducerLabel.size()) { - art::ValidHandle> simchannel_handle = e.getValidHandle>(fSimChannelProducerLabel); - art::fill_ptr_vector(simchannels, simchannel_handle); + + art::Handle< std::vector> simChannelHandle; + if (!e.getByLabel(fSimChannelProducerLabel, simChannelHandle)){ + throw cet::exception("CRTT0Tagging") + << " No sim::SimChannel objects in this event - " + << " Line " << __LINE__ << " in file " << __FILE__ << std::endl; } + art::fill_ptr_vector(simchannels, simChannelHandle); // Define "handle" to Generator level MCTruth objects art::Handle< vector> genHandle; @@ -265,21 +257,20 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) std::cout << "could not get handle to gen objects!!!" << std::endl; } - if (!e.getByLabel(fSimulationProducerLabel, particleHandle)) - { - // If we have no MCParticles at all in an event, then we're in - // big trouble. Throw an exception. - throw cet::exception("CRTT0Tagging") - << " No simb::MCParticle objects in this event - " - << " Line " << __LINE__ << " in file " << __FILE__ << std::endl; - } + if (!e.getByLabel(fSimulationProducerLabel, particleHandle)) { + // If we have no MCParticles at all in an event, then we're in + // big trouble. Throw an exception. + throw cet::exception("CRTT0Tagging") + << " No simb::MCParticle objects in this event - " + << " Line " << __LINE__ << " in file " << __FILE__ << std::endl; + } // Handle to AuxDetSimChannel (CRT module) objects generated by LArG4 art::Handle > auxDetSimChannelHandle; if (!e.getByLabel(fAuxDetSimProducerLabel, auxDetSimChannelHandle)) { - throw cet::exception("CRTT0Tagging") - << " No sim::AuxDetSimChannel objects in this event - " - << " Line " << __LINE__ << " in file " << __FILE__ << std::endl; + throw cet::exception("CRTT0Tagging") + << " No sim::AuxDetSimChannel objects in this event - " + << " Line " << __LINE__ << " in file " << __FILE__ << std::endl; } //if((*genHandle).size()>1) // throw cet::exception("CRTT0Tagging") << "gen stage MCParticle vector has more than 1 entry!" << '\n'; @@ -287,30 +278,27 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) for ( auto const& particle : (*particleHandle) ){ // Add the address of the MCParticle to the map, with the // track ID as the key. - particleMap.insert(std::make_pair(particle.TrackId(),&particle)); - - art::Ptr getMCTruth=partInventory->ParticleToMCTruth_P(&particle); + particleMap[particle.TrackId()] = &particle; + art::Ptr mcTruth=partInventory->ParticleToMCTruth_P(&particle); bool isNu=false; - if (getMCTruth->Origin() == simb::kBeamNeutrino) isNu=true; + if (mcTruth->Origin() == simb::kBeamNeutrino) isNu=true; - isNuMap.insert(std::make_pair(particle.TrackId(),isNu)); + isNuMap[particle.TrackId()] = isNu; for ( auto const& channel : (*auxDetSimChannelHandle) ){ auto const& auxDetIDEs = channel.AuxDetIDEs(); for ( auto const& ide : auxDetIDEs ){ if ( ide.trackID != particle.TrackId() ) continue; - if ( ide.energyDeposited * 1.0e6 < 50 ) continue; + if ( ide.energyDeposited * 1.0e6 < 50 ) continue; // skip energy deposits of less then 50 keV size_t adid = channel.AuxDetID(); uint32_t region=fCrtUtils.AuxDetRegionNameToNum(fCrtUtils.GetAuxDetRegion(adid)); uint32_t modID=channel.AuxDetID(); - float entryT=ide.entryT; - float exitT=ide.exitT; - + float aveT = (ide.entryT + ide.exitT) / 2.0; for(auto const& crthit : CRTHitList){ if(crthit->plane!=(int)region) continue; - if(abs((entryT+exitT)/2-crthit->ts1_ns)>200) continue; + if(abs(aveT-crthit->ts1_ns)>200) continue; bool modFound=false; for(auto const& mactopes : crthit->pesmap){ for(auto const& chanpe : mactopes.second) { @@ -393,7 +381,7 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) // These counters are used to determine if track is CC-E, EE, EW, CC-W, WE, WW // depending on the track type, the Top CRT uses the appropriate position corretions - std::vector hx, hy, hz, ht; + std::vector hx, hy, hz, ht; for(size_t i=0; iIndex() == std::numeric_limits::max()) || (!track.HasValidPoint(trkHitMetas[i]->Index())); @@ -416,13 +404,13 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) else if(countW!=0 && countE==0 && cryo==1) trackType=5; //West-West else if(countW==0 && countE!=0 && cryo==1) trackType=4; //West-East - icarus::crt::TopCRTCorrectionMap TopCrtCorrection; - if(trackType==0) TopCrtCorrection=fTopCrtTransformations.EastCC; - else if(trackType==1) TopCrtCorrection=fTopCrtTransformations.EE; - else if(trackType==2) TopCrtCorrection=fTopCrtTransformations.EW; - else if(trackType==3) TopCrtCorrection=fTopCrtTransformations.WestCC; - else if(trackType==4) TopCrtCorrection=fTopCrtTransformations.WE; - else if(trackType==5) TopCrtCorrection=fTopCrtTransformations.WW; + icarus::crt::TopCRTCorrectionMap TopCRTCorrection; + if(trackType==0) TopCRTCorrection=fTopCRTTransformations.EastCC; + else if(trackType==1) TopCRTCorrection=fTopCRTTransformations.EE; + else if(trackType==2) TopCRTCorrection=fTopCRTTransformations.EW; + else if(trackType==3) TopCRTCorrection=fTopCRTTransformations.WestCC; + else if(trackType==4) TopCRTCorrection=fTopCRTTransformations.WE; + else if(trackType==5) TopCRTCorrection=fTopCRTTransformations.WW; icarus::crt::Direction trackPCADir={-5,-5,-5,0,0,0}; @@ -452,8 +440,8 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) double deltaZ=std::numeric_limits::signaling_NaN(); double crtDistance=std::numeric_limits::signaling_NaN(); - icarus::crt::CrtPlane thisCrtPlane = fMatchingAlg.DeterminePlane(crtHit); - icarus::crt::CrossPoint crossPoint = fMatchingAlg.DetermineProjection(driftedTrackDir, thisCrtPlane); + icarus::crt::CRTPlane thisCRTPlane = fMatchingAlg.DeterminePlane(crtHit); + icarus::crt::CrossPoint crossPoint = fMatchingAlg.DetermineProjection(driftedTrackDir, thisCRTPlane); double crtX=crtHit.x_pos; double crtY=crtHit.y_pos; double crtZ=crtHit.z_pos; @@ -464,7 +452,7 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) centerDX=crtX-fTopCRTCenterMap[(int)crtHit.feb_id[0]].X; centerDY=crtY-fTopCRTCenterMap[(int)crtHit.feb_id[0]].Y; centerDZ=crtZ-fTopCRTCenterMap[(int)crtHit.feb_id[0]].Z; - icarus::crt::AffineTrans thisAffine=TopCrtCorrection[(int)crtHit.feb_id[0]]; + icarus::crt::AffineTrans thisAffine=TopCRTCorrection[(int)crtHit.feb_id[0]]; std::pair transCrt; if(crtHit.plane==30) { transCrt=icarus::crt::AffineTransformation(centerDX, centerDZ, thisAffine); @@ -482,22 +470,22 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) } } - if(thisCrtPlane.first==0){ + if(thisCRTPlane.first==0){ deltaX=crtX-crossPoint.X; deltaY=0; deltaZ=crtZ-crossPoint.Z; - } else if(thisCrtPlane.first==1){ + } else if(thisCRTPlane.first==1){ deltaX=0; deltaY=crtY-crossPoint.Y; deltaZ=crtZ-crossPoint.Z; - } else if(thisCrtPlane.first==2){ + } else if(thisCRTPlane.first==2){ deltaX=crtX-crossPoint.X; deltaY=crtY-crossPoint.Y; deltaZ=0; } crtDistance=sqrt(pow(deltaX,2)+pow(deltaZ,2)+pow(deltaY,2)); if(crtDistance>fMaximalCRTDistance) continue; - icarus::crt::CandCRT thisCrtCand={crtHit,p_crthit, thisCrtPlane.first, crtDistance, deltaX, deltaY, deltaZ, crossPoint.X, crossPoint.Y, crossPoint.Z}; + icarus::crt::CandCRT thisCrtCand={crtHit,p_crthit, thisCRTPlane.first, crtDistance, deltaX, deltaY, deltaZ, crossPoint.X, crossPoint.Y, crossPoint.Z}; crtCands.push_back(thisCrtCand); } // End of CRT Hit loop if(crtCands.empty()) { diff --git a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx index ff8b85fc9..d4248f182 100644 --- a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx +++ b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx @@ -1,12 +1,23 @@ -/////////////////////////////////////////////// -// CRTMatchingUtils.h -// -// Functions for CRT matching -// Francesco Poppi (poppi@bo.infn.it), October 2024 -/////////////////////////////////////////////// +/** + * @file icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx + * @author Francesco Poppi (poppi@bo.infn.it) + * @date January 2025 + */ #include "icaruscode/CRT/CRTUtils/CRTMatchingUtils.h" +#include +#include +#include +#include +#include +#include +#include "messagefacility/MessageLogger/MessageLogger.h" +#include "TMatrixD.h" +#include "TMatrixDEigen.h" +#include "larcorealg/Geometry/TPCGeo.h" +#include "larcorealg/Geometry/PlaneGeo.h" + namespace icarus::crt{ @@ -14,6 +25,49 @@ namespace icarus::crt{ { TopCRTCentersMap TopCRTCenters; + // The follwing numbers have been extracted from the Top CRT modules geometry. + // The numbers are respectively moduleID and X,Y,Z coordinates of the + // module center (X markes the spot in the sketch below). + // The CRT modules are perfect square with 8 bars per side. + // The fixed coordinate (e.g. Y for Top CRT Horizontal) is returned from geometry. + // The transverce coordinate is returned from the average position of P1 and P2 + // the average position of P1 and P3. + // The transformed CRT Hits are in cm. + // + // --------------------------------------------------------- + // | | | | | | | | | + // | | | | | | | | | + // | | | | | | | | | + // --------------------------------------------------------- + // | | | | | | | | | + // | | | | | | | | | + // | | | | | | | | | + // --------------------------------------------------------- + // | | | | | | | | | + // | | | | | | | | | + // | | | | | | | | | + // --------------------------------------------------------- + // | | | | | | | | | + // | | | | P1 | P2 | | | | + // | | | | | | | | | + // --------------------------- X --------------------------- + // | | | | | | | | | + // | | | | P3 | | | | | + // | | | | | | | | | + // --------------------------------------------------------- + // | | | | | | | | | + // | | | | | | | | | + // | | | | | | | | | + // --------------------------------------------------------- + // | | | | | | | | | + // | | | | | | | | | + // | | | | | | | | | + // --------------------------------------------------------- + // | | | | | | | | | + // | | | | | | | | | + // | | | | | | | | | + // --------------------------------------------------------- + // TopCRTCenters = {{108, { -460.975, 617.388,-1050.61}}, {109, { -460.975,617.388,-866.215}}, {110, { -460.975,617.388,-681.825}}, @@ -131,6 +185,7 @@ namespace icarus::crt{ {222, { -92.195, 496.038, -1143.4}}, {223, { 92.195, 496.038, -1143.4}}, {224, { 276.585, 496.038, -1143.4}}, + // This module does not exist in reality, but exists in simulation {225, { 0, 0, 0}}, {226, { -460.975, 525.038, 1533.608}}, {227, { -276.585, 525.038, 1533.608}}, @@ -141,14 +196,14 @@ namespace icarus::crt{ return TopCRTCenters; } - TransformedCrtHit AffineTransformation(double DX, double DZ,AffineTrans affine) + TransformedCRTHit AffineTransformation(double DX, double DZ,AffineTrans affine) { double CRTX=affine.B1+DZ*affine.A12+DX*affine.A11; double CRTZ=affine.B2+DZ*affine.A22+DX*affine.A21; return std::make_pair(CRTX, CRTZ); } - TopCrtTransformations LoadTopCrtTransformations() + TopCRTTransformations LoadTopCRTTransformations() { std::string fullFileName; cet::search_path searchPath("FW_SEARCH_PATH"); @@ -167,7 +222,7 @@ namespace icarus::crt{ std::map Type5Corr; if (!corrFile.is_open()) { - mf::LogError("CRTMatchingUtils_LoadTopCrtTransformation") + mf::LogError("CRTMatchingUtils_LoadTopCRTTransformation") << "Failed to open Top CRT Correction transformation file: " << fullFileName; } std::string line; @@ -199,7 +254,7 @@ namespace icarus::crt{ Type4Corr.insert({variables.at(0), Type4}); Type5Corr.insert({variables.at(0), Type5}); } - TopCrtTransformations LoadedTransformations={Type2Corr, Type1Corr, Type0Corr, Type4Corr, Type5Corr, Type3Corr}; + TopCRTTransformations LoadedTransformations={Type2Corr, Type1Corr, Type0Corr, Type4Corr, Type5Corr, Type3Corr}; return LoadedTransformations; } @@ -218,7 +273,7 @@ namespace icarus::crt{ return; } - Direction CRTMatchingAlg::PCAfit (std::vector x, std::vector y, std::vector z) + Direction CRTMatchingAlg::PCAfit (std::vector const& x, std::vector const& y, std::vector const& z) { int min=0; int max=x.size(); @@ -230,11 +285,11 @@ namespace icarus::crt{ xavg=xavg/size; yavg=yavg/size; zavg=zavg/size; - float x2=0, y2=0, z2=0, xiy=0, xiz=0, yiz=0; + double x2=0, y2=0, z2=0, xiy=0, xiz=0, yiz=0; for(int k=min; k::lowest(); int maxevalpos = -1; for(int k = 0; k < 3; k++){ if(this_eval[k][k]>max_eval){ max_eval = this_eval[k][k]; @@ -273,27 +328,31 @@ namespace icarus::crt{ return thDirection; } - CrtPlane CRTMatchingAlg::DeterminePlane(sbn::crt::CRTHit CRThit) + CRTPlane CRTMatchingAlg::DeterminePlane(sbn::crt::CRTHit const& CRThit) { int Plane; double Pos; - if(CRThit.plane==30) { + switch (CRThit.plane) { + case 30: Plane=0; Pos=CRThit.y_pos; - } - else if(CRThit.plane==31 || CRThit.plane== 32 || CRThit.plane==40 || CRThit.plane==41 || CRThit.plane==42 || CRThit.plane==43 || CRThit.plane==44 || CRThit.plane==45) { + break; + case 31: case 32: + case 40: case 41: case 42: case 43: case 44: case 45: Plane=1; Pos=CRThit.x_pos; - } - else { + break; + default: Plane=2; Pos=CRThit.z_pos; - } + break; + } // switch return std::make_pair(Plane, Pos); } - ProjectionPoint CRTMatchingAlg::CalculateProjection(double dirx, double diry, double dirz, double x0, double y0, double z0, double position) + ProjectionPoint CRTMatchingAlg::TranslatePointTo(double dirx, double diry, double dirz, double x0, double y0, double z0, double position) { + if(dirx==0) throw std::invalid_argument("CRTMatchingAlg::TranslatePointTo: dirx is 0"); double Lambda = (position-x0)/dirx; double PosAtY = (Lambda*diry+y0); double PosAtZ = (Lambda*dirz+z0); @@ -308,31 +367,25 @@ namespace icarus::crt{ double meanX, meanY, meanZ; switch(plane) { - case 0: // Piano a Y + case 0: // Fixed Coordinate: Y dirX = dir.diry; dirY = dir.dirx; dirZ = dir.dirz; meanX = dir.meany; meanY = dir.meanx; meanZ = dir.meanz; break; - case 1: // Piano a X + case 1: // Fixed Coordinate: X dirX = dir.dirx; dirY = dir.diry; dirZ = dir.dirz; meanX = dir.meanx; meanY = dir.meany; meanZ = dir.meanz; break; - case 2: // Piano a Z + case 2: // Fixed Coordinate: Z dirX = dir.dirz; dirY = dir.diry; dirZ = dir.dirx; meanX = dir.meanz; meanY = dir.meany; meanZ = dir.meanx; break; default: - throw std::invalid_argument("Error"); + throw std::invalid_argument("CRTMatchingAlg::CalculateForPlane(): invalid plane"); } - return CRTMatchingAlg::CalculateProjection(static_cast(dirX), - static_cast(dirY), - static_cast(dirZ), - static_cast(meanX), - static_cast(meanY), - static_cast(meanZ), - static_cast(position)); + return CRTMatchingAlg::TranslatePointTo(dirX, dirY, dirZ, meanX, meanY, meanZ, position); } - CrossPoint CRTMatchingAlg::DetermineProjection(const Direction& dir, CrtPlane plane) + CrossPoint CRTMatchingAlg::DetermineProjection(const Direction& dir, CRTPlane plane) { CrossPoint thisCase = CRTMatchingAlg::CalculateForPlane(dir, plane.first, plane.second); @@ -341,13 +394,13 @@ namespace icarus::crt{ case 1: return {thisCase.X, thisCase.Y, thisCase.Z}; // Plane at X e.g. Side CRT West, East, Top CRT case 2: return {thisCase.Z, thisCase.Y, thisCase.X}; // Plane at Z e.g. Side CRT South, North, Top CRT default: - throw std::invalid_argument("Error"); + throw std::invalid_argument("CRTMatchingAlg::DetermineProjection(): invalid plane"); } } - TrackBarycenter CRTMatchingAlg::GetTrackBarycenter (std::vector hx, std::vector hy, std::vector hz, std::vector hw) + TrackBarycenter CRTMatchingAlg::GetTrackBarycenter (std::vector hx, std::vector hy, std::vector hz, std::vector hw) { - float average_x_charge=0, average_y_charge=0, average_z_charge=0, total_charge=0; + double average_x_charge=0, average_y_charge=0, average_z_charge=0, total_charge=0; bool isGood; for (unsigned i = 0; i < hz.size(); i++) { if(isnan(hz[i])) continue; @@ -368,34 +421,51 @@ namespace icarus::crt{ return ThisTrackBary; } - DriftedTrack CRTMatchingAlg::DriftTrack(const std::vector>& trkHits, const std::vector& trkHitMetas, const geo::GeometryCore *GeometryService, detinfo::DetectorPropertiesData const& detProp, double time, const recob::Track& tpcTrack) + DriftedTrack CRTMatchingAlg::DriftTrack(const std::vector>& trkHits, const std::vector& trkHitMetas, const geo::GeometryCore *GeometryService, detinfo::DetectorPropertiesData const& detProp, double time, const recob::Track& tpcTrack) const { int outBound=0; - std::vector recX, recY, recZ, recI; + int outBound1=0; + int count=0; + std::vector recX, recY, recZ, recI; for(size_t i=0; iIndex() == std::numeric_limits::max()) || + bool badhit = !trkHitMetas[i] || (trkHitMetas[i]->Index() == std::numeric_limits::max()) || (!tpcTrack.HasValidPoint(trkHitMetas[i]->Index())); if(badhit) continue; geo::Point_t loc = tpcTrack.LocationAtPoint(trkHitMetas[i]->Index()); - if(loc.X()==-999) continue; + //if(loc.X()==-999) continue; const geo::TPCGeo& tpcGeo = GeometryService->TPC(trkHits[i]->WireID()); int const cryo = trkHits[i]->WireID().Cryostat; int tpc=trkHits[i]->WireID().TPC; double vDrift=detProp.DriftVelocity(); + // recoX: distance of the hit charge from the plane + // * `trkHits[i]->PeakTime()-fTickAtAnode`: TPC ticks from the trigger to when charge gets to plane + // * `time`: t0 [CRT or Flash] (with respect to trigger) in TPC ticks + // * difference is how many ticks passed from the track to when charge gets to plane: drift ticks double recoX=(trkHits[i]->PeakTime()-fTickAtAnode-time/fTickPeriod)*fTickPeriod*vDrift; - double plane=tpcGeo.FirstPlane().GetCenter().X(); + + double plane=tpcGeo.PlanePtr(trkHits[i]->WireID().Plane)->GetCenter().X(); double cathode=tpcGeo.GetCathodeCenter().X(); - double X=plane-tpcGeo.DetectDriftDirection()*recoX; + double X=plane-tpcGeo.DriftDir().X()*recoX; if(cryo==0 && (tpc==0 || tpc==1) && (X>(cathode+fAllowedOffsetCM)||X<(plane-fAllowedOffsetCM))) outBound++; else if(cryo==0 && (tpc==2 || tpc==3)&& (X<(cathode-fAllowedOffsetCM)||X>(plane+fAllowedOffsetCM))) outBound++; else if(cryo==1 && (tpc==0 || tpc==1)&& (X>(cathode+fAllowedOffsetCM)||X<(plane-fAllowedOffsetCM))) outBound++; else if(cryo==1 && (tpc==2 || tpc==3)&& (X<(cathode-fAllowedOffsetCM)||X>(plane+fAllowedOffsetCM))) outBound++; + + double fAllowedRel = 1+fAllowedOffsetCM / tpcGeo.DriftDistance(); + if(!tpcGeo.ActiveBoundingBox().ContainsX(X, fAllowedRel)) outBound1++; + + if(outBound!=outBound1 && count<=10){ + std::cout<<"Active Bounding Box MinX "<WireID().Plane<<" X "<Integral()); } DriftedTrack thisDriftedTrack = {recX, recY, recZ, recI, outBound}; + std::cout<<"--> Outbound cm "< -#include -#include -#include -#include -#include +#ifndef ICARUSCODE_CRT_CRTUTILS_CRTMATCHINGUTILS_H +#define ICARUSCODE_CRT_CRTUTILS_CRTMATCHINGUTILS_H + +/** + * @file icaruscode/CRT/CRTUtils/CRTMatchingUtils.h + * @author Francesco Poppi (poppi@bo.infn.it) + * @date January 2025 + */ + #include +#include // std::pair #include -#include -#include -#include +#include "fhiclcpp/ParameterSet.h" #include "canvas/Persistency/Common/Ptr.h" -#include "TMatrixD.h" -#include "TMatrixDEigen.h" -#include "TGraph2D.h" - -// LArSoft includes -#include "larcore/CoreUtils/ServiceUtil.h" -#include "larcore/Geometry/Geometry.h" -#include "larcorealg/Geometry/GeometryCore.h" -#include "lardata/DetectorInfoServices/DetectorClocksService.h" -#include "lardata/DetectorInfoServices/DetectorPropertiesService.h" -#include "lardataobj/RecoBase/PFParticle.h" -#include "lardataobj/AnalysisBase/T0.h" -#include "lardataobj/RecoBase/PFParticleMetadata.h" +// LArSoft headers #include "lardataobj/RecoBase/Hit.h" #include "lardataobj/RecoBase/Track.h" #include "lardataobj/RecoBase/TrackHitMeta.h" -#include "larsim/MCCheater/BackTracker.h" -#include "larsim/MCCheater/PhotonBackTracker.h" -#include "larsim/MCCheater/BackTrackerService.h" -#include "larsim/MCCheater/PhotonBackTrackerService.h" -#include "larsim/MCCheater/ParticleInventoryService.h" - -// Data product includes -#include "icaruscode/CRT/CRTUtils/CRTBackTracker.h" -#include "icaruscode/CRT/CRTUtils/CRTCommonUtils.h" -#include "icaruscode/Decode/DataProducts/TriggerConfiguration.h" -#include "larcorealg/CoreUtils/enumerate.h" -#include "lardataobj/RecoBase/OpFlash.h" -#include "lardataobj/RecoBase/OpHit.h" -#include "nusimdata/SimulationBase/MCGeneratorInfo.h" -#include "nusimdata/SimulationBase/MCParticle.h" -#include "nusimdata/SimulationBase/MCTruth.h" +#include "larcorealg/Geometry/GeometryCore.h" +#include "lardataalg/DetectorInfo/DetectorPropertiesData.h" +// Data product headers #include "sbnobj/Common/CRT/CRTHit.hh" -#include "sbnobj/Common/CRT/CRTTrack.hh" #include "sbnobj/Common/Trigger/ExtraTriggerInfo.h" #include "sbnobj/Common/CRT/CRTPMTMatching.hh" -// ROOT -#include -#include "TVector3.h" -#include "TGeoManager.h" - namespace icarus::crt{ struct CrossPoint @@ -72,22 +33,22 @@ struct CrossPoint double Z; }; -typedef CrossPoint ProjectionPoint; +using ProjectionPoint = CrossPoint; struct TrackBarycenter { - float BarX; // Track Barycenter X coordinate - float BarY; // Track Barycenter Y coordinate - float BarZ; // Track Barycenter Z coordinate + double BarX; // Track Barycenter X coordinate + double BarY; // Track Barycenter Y coordinate + double BarZ; // Track Barycenter Z coordinate bool isGood; // Track Barycenter quality }; struct DriftedTrack { - std::vector spx; // Drifted Track Hit Points X coordinate - std::vector spy; // Drifted Track Hit Points Y coordinate - std::vector spz; // Drifted Track Hit Points Z coordinate - std::vector spi; // Drifted Track Hit Points integral + std::vector spx; // Drifted Track Hit Points X coordinate + std::vector spy; // Drifted Track Hit Points Y coordinate + std::vector spz; // Drifted Track Hit Points Z coordinate + std::vector spi; // Drifted Track Hit Points integral int outbound; // Number of hit points out of the logical volume of the TPC //double drifted_startx; // //double drifted_endx; @@ -135,11 +96,11 @@ struct AffineTrans double N; }; -typedef int feb_index; +using FebIndex_t = int; -typedef std::map TopCRTCorrectionMap; +using TopCRTCorrectionMap = std::map; -struct TopCrtTransformations +struct TopCRTTransformations { TopCRTCorrectionMap EE; TopCRTCorrectionMap EW; @@ -149,17 +110,25 @@ struct TopCrtTransformations TopCRTCorrectionMap WestCC; }; -typedef std::map TopCRTCentersMap; +using TopCRTCentersMap = std::map; -typedef std::pair CrtPlane; +/// CRTPlane corresponds to a pair of: +/// 1st CRT fixed coordinate plane (e.g. 0 is X coordinate) +/// 2nd value of the CRT fixed coordinate plane (e.g. for Top CRT Horizontal this value is ~618 cm. +using CRTPlane = std::pair; -typedef std::pair TransformedCrtHit; +/// The transformed CRT Hits are in cm +using TransformedCRTHit = std::pair; +/// This function loads the Top CRT modules centers. TopCRTCentersMap LoadTopCRTCenters(); -TransformedCrtHit AffineTransformation(double DX, double DZ,AffineTrans affine); +/// This function performs the affine transformation of the CRT hit points. +/// The AffineTransformation requires input variables in cm. +TransformedCRTHit AffineTransformation(double DX, double DZ, AffineTrans affine); -TopCrtTransformations LoadTopCrtTransformations(); +/// This functions loads the Affine Transformation TXT files. +TopCRTTransformations LoadTopCRTTransformations(); class CRTMatchingAlg { @@ -169,20 +138,37 @@ class CRTMatchingAlg { CRTMatchingAlg(); void reconfigure(const fhicl::ParameterSet& pset); - - Direction PCAfit (std::vector x, std::vector y, std::vector z); - - CrtPlane DeterminePlane(sbn::crt::CRTHit CRThit); - - ProjectionPoint CalculateProjection(double, double, double, double, double, double, double); - + + /// This function runs the PCA analysis on three vectors of spatial coordinates x,y,z and return the principal eigenvector. + /// The entries in the i-th index of X, Y and Z vectors must correspond to the same point. + static Direction PCAfit (std::vector const& x, std::vector const& y, std::vector const& z); + + /// This function determines the coordinate in which the CRT module is constant. + /// e.g. in the Top CRT Horizontal Plane, the Y coordinate is fixed, in the Side CRT West Walll, the X Coordinate is fixed, ... + CRTPlane DeterminePlane(sbn::crt::CRTHit const& CRThit); + + /// This function evaluates the Track Crossing point onto the CRT plane considered. + /// dir1, dir2, dir3 are the three cosine directors of a track. + /// p1, p2 and p3 are the coordinates of the CRT hit position. + static ProjectionPoint TranslatePointTo(double dir1, double dir2, double dir3, double p1, double p2, double p3, double position); + //static ProjectionPoint CalculateProjection(double dir1, double dir2, double dir3, double p1, double p2, double p3, double position); + + /// This function runs the CalculateProjection function, after deciding the director cosine order expected from + /// the CalculateProjection function, assuming the evaluated CRTPlane (fixed coordinate and value of the coordinate). CrossPoint CalculateForPlane(const Direction& dir, int plane, double position); - CrossPoint DetermineProjection(const Direction& dir, CrtPlane plane); + /// This function returns the "correct" predicted crossing point given the cosine directors of the track fitted with PCA + /// and a CRTPlane (fixed coordinate and value of the coordinate). + CrossPoint DetermineProjection(const Direction& dir, CRTPlane plane); - TrackBarycenter GetTrackBarycenter(std::vector hx, std::vector hy, std::vector hz, std::vector hw); + /// This function evaluates the TrackBarycenter with weighted mean. hx, hy, hz and hw are vectors with the x, y z coordinates + /// and w is the weight (e.g. one could use integral or peak amplitude or more...). + /// The entries in the i-th index of hx, hy, hz and hw vectors must correspond to the same point. + TrackBarycenter GetTrackBarycenter(std::vector hx, std::vector hy, std::vector hz, std::vector hw); - DriftedTrack DriftTrack(const std::vector>& trkHits, const std::vector& trkHitMetas, const geo::GeometryCore *GeometryService, detinfo::DetectorPropertiesData const& detProp, double time, const recob::Track& tpcTrack); + /// Function which drifts the track x coordinates assuming a time (in the trigger reference system). + /// The function also returns the number of hit points which would be outside of the physical boundaries of the TPCs at the considered time. + DriftedTrack DriftTrack(const std::vector>& trkHits, const std::vector& trkHitMetas, const geo::GeometryCore *GeometryService, detinfo::DetectorPropertiesData const& detProp, double time, const recob::Track& tpcTrack) const; private: diff --git a/icaruscode/CRT/CRTUtils/CRTT0MatchAlg.h b/icaruscode/CRT/CRTUtils/CRTT0MatchAlg.h index 72c268eae..fffa3abc0 100644 --- a/icaruscode/CRT/CRTUtils/CRTT0MatchAlg.h +++ b/icaruscode/CRT/CRTUtils/CRTT0MatchAlg.h @@ -1,13 +1,11 @@ #ifndef CRTT0MATCHALG_H_SEEN #define CRTT0MATCHALG_H_SEEN - -/////////////////////////////////////////////// -// CRTT0MatchAlg.h -// -// Functions for CRT t0 matching -// T Brooks (tbrooks@fnal.gov), November 2018 -/////////////////////////////////////////////// +/** + * @file icaruscode/CRT/CRTUtils/CRTT0MatchAlg.h + * @author Francesco Poppi (poppi@bo.infn.it) + * @date January 2025 + */ // framework #include "art/Framework/Principal/Event.h" @@ -45,18 +43,7 @@ //#include "icaruscode/Geometry/GeometryWrappers/TPCGeoAlg.h" #include "icaruscode/CRT/CRTUtils/TPCGeoUtil.h" -// c++ -#include -#include -#include -#include -#include -#include -#include -#include - // ROOT -#include #include "TVector3.h" #include "TGeoManager.h" diff --git a/icaruscode/CRT/CRTUtils/RecoUtils.cc b/icaruscode/CRT/CRTUtils/RecoUtils.cc index ae1421deb..770e85ae7 100644 --- a/icaruscode/CRT/CRTUtils/RecoUtils.cc +++ b/icaruscode/CRT/CRTUtils/RecoUtils.cc @@ -25,15 +25,15 @@ int RecoUtils::TrueParticleID(detinfo::DetectorClocksData const& clockData, return likely_track_id; } -std::map>> RecoUtils::PrepSimChannels(const std::vector> &simchannels, const geo::GeometryCore &geo) { +std::map>> RecoUtils::PrepSimChannels(const std::vector> &simchannels, const geo::GeometryCore &geom) { std::map>> ret; - for (const art::Ptr sc : simchannels) { + for (const art::Ptr& sc : simchannels) { // Lookup the wire of this channel raw::ChannelID_t channel = sc->Channel(); - std::vector maybewire = geo.ChannelToWire(channel); + std::vector maybewire = geom.ChannelToWire(channel); geo::WireID thisWire; // Default constructor makes invalid wire - if (maybewire.size()) thisWire = maybewire[0]; + if (!maybewire.empty()) thisWire = maybewire[0]; for (const auto &item : sc->TDCIDEMap()) { for (const sim::IDE &ide: item.second) { // indexing initializes empty vector diff --git a/icaruscode/IcarusObj/CRTTPCMatchingInfo.h b/icaruscode/IcarusObj/CRTTPCMatchingInfo.h index 1efdc0385..8e420104a 100644 --- a/icaruscode/IcarusObj/CRTTPCMatchingInfo.h +++ b/icaruscode/IcarusObj/CRTTPCMatchingInfo.h @@ -24,24 +24,28 @@ struct icarus::CRTTPCMatchingInfo { /// Magic value denoting the absence of DCA information. static constexpr double NoDistance = std::numeric_limits::lowest(); - static constexpr double noTime = std::numeric_limits::lowest(); + static constexpr double NoTime = std::numeric_limits::lowest(); /// Magic value denoting the absence of CRTs. - static constexpr int noCRT = std::numeric_limits::lowest(); + static constexpr int NoCRT = std::numeric_limits::lowest(); + + /// Magic value denoting the absence of CRT Plane. + static constexpr int NoPlane = std::numeric_limits::lowest(); + // --- BEGIN -- Data members ------------------------------------------------- /// Distance of closest approach between track extension and CRT hit [cm] double trackCrtHitDistance = NoDistance; /// Matched CRT Hit sub detector: 0 Top, 1 Side, 2 Bottom - int crtSys = noCRT; + int crtSys = NoCRT; /// Matched CRT Hit region: 30-34 Top CRT, 40-48 Side CRT, 50 Bottom CRT - int crtRegion = noCRT; + int crtRegion = NoCRT; /// Matched CRT Hit time w.r.t. trigger [ns] - double crtTime = noTime; + double crtTime = NoTime; /// Distance distinguished into its components DX, DY, DZ [cm] double deltaX = NoDistance; @@ -57,7 +61,7 @@ struct icarus::CRTTPCMatchingInfo { /// For Top CRT region 30 Y coordinate is constant: plane=0 /// For Top CRT region 31/32 and Side CRT 40/41/42/43/44/45 X coordinate is constant: plane=1 /// For Top CRT region 33/34 and Side CRT 46/47 Z coordinate is constant: plane=2 - int plane=-1; + int plane=NoPlane; // --- END ---- Data members ------------------------------------------------- From 26d3850814f18bfd58dc20cd370fc48653ca34d5 Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Wed, 15 Jan 2025 00:40:51 +0100 Subject: [PATCH 18/28] This is another round of commit. Last of today. In this one several important things: structs have been changed quite a bit, in addition I am now willingly saving information of the full PCA analysis and I am saving also second and third eigenValues/Vectors. --- icaruscode/CRT/CRTT0Tagging_module.cc | 192 ++++++++++-------- icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx | 127 +++++------- icaruscode/CRT/CRTUtils/CRTMatchingUtils.h | 59 +++--- icaruscode/CRT/CRTUtils/RecoUtils.cc | 4 +- icaruscode/CRT/CRTUtils/RecoUtils.h | 3 +- .../CRT/CRTUtils/crtmatchingalg_icarus.fcl | 6 +- icaruscode/CRT/crtt0tagging.fcl | 10 +- 7 files changed, 204 insertions(+), 197 deletions(-) diff --git a/icaruscode/CRT/CRTT0Tagging_module.cc b/icaruscode/CRT/CRTT0Tagging_module.cc index f3d04dd44..47dec920d 100644 --- a/icaruscode/CRT/CRTT0Tagging_module.cc +++ b/icaruscode/CRT/CRTT0Tagging_module.cc @@ -15,6 +15,7 @@ #include "art/Framework/Core/EDProducer.h" #include "art/Framework/Core/ModuleMacros.h" #include "canvas/Persistency/Common/FindManyP.h" +#include "canvas/Persistency/Common/FindOne.h" #include "art/Framework/Principal/Handle.h" #include "art/Framework/Principal/Event.h" #include "canvas/Persistency/Common/Ptr.h" @@ -42,6 +43,7 @@ #include "larcorealg/Geometry/GeometryCore.h" #include "larcorealg/Geometry/PlaneGeo.h" #include "larcorealg/Geometry/WireGeo.h" +#include "larcorealg/CoreUtils/zip.h" #include "lardataobj/AnalysisBase/T0.h" #include "lardataobj/RecoBase/Hit.h" #include "lardataobj/RecoBase/Track.h" @@ -91,6 +93,7 @@ class icarus::crt::CRTT0Tagging : public art::EDProducer { CRTT0Tagging& operator=(CRTT0Tagging&&) = delete; // Required functions. + bool hasModID(std::uint32_t modID, sbn::crt::CRTHit const& crthit); //void beginRun(art::Run& r) override; void beginJob() override; void produce(art::Event& e) override; @@ -114,7 +117,7 @@ class icarus::crt::CRTT0Tagging : public art::EDProducer { std::vector fTPCTrackLabel; ///< labels for source of tracks std::vector fPFParticleLabel; ///< labels for source of PFParticle std::vector fHitLabel; ///< labels for source of hits - art::InputTag fTRKHMproducer; ///< labels for hit metadata + std::vector fTRKHMLabel; ///< labels for hit metadata art::ServiceHandle tfs; @@ -128,11 +131,11 @@ class icarus::crt::CRTT0Tagging : public art::EDProducer { double fGoodCandidateDistance; double fMaximumDeltaT; bool fData; + bool fSkipTruth; icarus::crt::TopCRTCentersMap fTopCRTCenterMap; icarus::crt::TopCRTTransformations fTopCRTTransformations; - TTree* fTree; int fEvent; ///< number of the event being processed int fRun; ///< number of the run being processed @@ -164,7 +167,7 @@ icarus::crt::CRTT0Tagging::CRTT0Tagging(fhicl::ParameterSet const& p) fTPCTrackLabel(p.get< std::vector >("TPCTrackLabel", {""})), fPFParticleLabel(p.get< std::vector >("PFParticleLabel", {""})), fHitLabel(p.get< std::vector >("HitLabel", {""})), - fTRKHMproducer(p.get< art::InputTag > ("TRKHMproducer", "")), + fTRKHMLabel(p.get< std::vector > ("TRKHMLabel", {""})), fMatchingAlg(p.get ("MatchingAlg")), fGeometryService(lar::providerFrom()), fMinimalTrackLength(p.get("MinimalTrackLength", 40.0)), @@ -172,7 +175,8 @@ icarus::crt::CRTT0Tagging::CRTT0Tagging(fhicl::ParameterSet const& p) fMaximalCRTDistance(p.get("MaximalCRTDistance", 300.)), fGoodCandidateDistance(p.get("GoodCandidateDistance", 100.)), fMaximumDeltaT(p.get("MaximumDeltaT", 10000.)), - fData(p.get("isData", true)) + fData(p.get("isData", true)), + fSkipTruth(p.get("skipTruth", false)) { produces< std::vector >(); @@ -182,6 +186,38 @@ icarus::crt::CRTT0Tagging::CRTT0Tagging(fhicl::ParameterSet const& p) //produces< art::Assns >(); //produces< art::Assns >(); //produces< art::Assns >(); + + if (fTPCTrackLabel.size() != fPFParticleLabel.size()) { + throw art::Exception{ art::errors::Configuration } + << fTPCTrackLabel.size() << " TPC track data products configured (`TPCTrackLabel`), should have been " + << fPFParticleLabel.size(); + } + if (fHitLabel.size() != fPFParticleLabel.size()) { + throw art::Exception{ art::errors::Configuration } + << fHitLabel.size() << " TPC hit data products configured (`HitLabel`), should have been " + << fPFParticleLabel.size(); + } + + if (fTRKHMLabel.size() > fPFParticleLabel.size()) { + throw art::Exception{ art::errors::Configuration } + << fTRKHMLabel.size() << " track-hit metadata data products configured (`TRKHMproducer`), should have been " + << fPFParticleLabel.size(); + } + fTRKHMLabel.resize(fPFParticleLabel.size()); // extend with empty labels + // replace empty defaults with the actual input tag value, assumed the same as tracks + for (std::size_t i = 0; i < fTRKHMLabel.size(); ++i) + if (fTRKHMLabel[i].empty()) fTRKHMLabel[i] = fTPCTrackLabel[i]; + +} + +bool icarus::crt::CRTT0Tagging::hasModID(std::uint32_t modID, sbn::crt::CRTHit const& crthit){ + for(auto const& mactopes: crthit.pesmap){ + for(auto const& chanpe: mactopes.second){ + int thisModID=(int)fCrtUtils.MacToAuxDetID(mactopes.first, chanpe.first); + if(thisModID==(int)modID) return true; + } + } + return false; } //void icarus::crt::CRTT0Tagging::beginRun(art::Run& r) @@ -237,7 +273,22 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) art::ValidHandle> crthits = e.getValidHandle>(fCrtHitModuleLabel); art::fill_ptr_vector(CRTHitList, crthits); + // If it is not data is MC. + // Retrieving MC truth information. + // Three maps (particleMap, crtParticleMap and isNuMap) are filled. + // -> particleMap maps truth level informations for all the MC particles. The key is the Geant4 TrackID + // -> crtParticleMap maps the CRTHits at truth level. The key is a pair of reconstructed CRT Hit module and time. + // The object of the map is a vector of Geant4 Track IDs of the particles that generated that hit. + // -> isNuMap maps the reconstructed tracks. The key is the Track ID and the object is a boolean True/False if + // the Track was a neutrino related interaction or not. if(!fData){ + if(fSkipTruth){ + mf::LogInfo("CRTT0Tagging") <<"This is MC, but MC truth is not considered!"; + } else{ + mf::LogInfo("CRTT0Tagging") <<"This is MC, MC truth is considered!"; + } + } + if(!fData && !fSkipTruth){ art::ServiceHandle partInventory; art::Handle< std::vector> simChannelHandle; @@ -258,8 +309,8 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) } if (!e.getByLabel(fSimulationProducerLabel, particleHandle)) { - // If we have no MCParticles at all in an event, then we're in - // big trouble. Throw an exception. + // If we have no MCParticles at all in an event, but we are requiring + // to have MC truth information, throw exception. throw cet::exception("CRTT0Tagging") << " No simb::MCParticle objects in this event - " << " Line " << __LINE__ << " in file " << __FILE__ << std::endl; @@ -274,7 +325,6 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) } //if((*genHandle).size()>1) // throw cet::exception("CRTT0Tagging") << "gen stage MCParticle vector has more than 1 entry!" << '\n'; - for ( auto const& particle : (*particleHandle) ){ // Add the address of the MCParticle to the map, with the // track ID as the key. @@ -299,101 +349,82 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) for(auto const& crthit : CRTHitList){ if(crthit->plane!=(int)region) continue; if(abs(aveT-crthit->ts1_ns)>200) continue; - bool modFound=false; - for(auto const& mactopes : crthit->pesmap){ - for(auto const& chanpe : mactopes.second) { - int thisModID =(int)fCrtUtils.MacToAuxDetID(mactopes.first, chanpe.first); - if(thisModID==(int)modID) modFound=true; - } - } + bool modFound=hasModID(modID, *crthit); if(!modFound)continue; - std::pair thisMatch=std::make_pair((int)crthit->feb_id[0],crthit->ts1_ns); - if (crtParticleMap.find(thisMatch) != crtParticleMap.end()){ - crtParticleMap[thisMatch].push_back(particle.TrackId()); - } else { - crtParticleMap.insert(std::pair,std::vector>(thisMatch, std::vector())); - crtParticleMap[thisMatch].push_back(particle.TrackId()); - } - } - } - } - } - - } - - for(const auto& PFPLabel : fPFParticleLabel) { - auto it = &PFPLabel - fPFParticleLabel.data(); + std::pair thisMatch = std::make_pair((int)crthit->feb_id[0],crthit->ts1_ns); + crtParticleMap[thisMatch].push_back(particle.TrackId()); + } // CRT Hits loop + } // Energy deposits loop + } // CRT sim channels loop + } // MC particles loop + } // End MC Only + for(const auto& [ PFPLabel, TPCTrackLabel, HitLabel, TRKHMLabel ]: util::zip(fPFParticleLabel, fTPCTrackLabel, fHitLabel, fTRKHMLabel)){ std::vector> PFParticleList; art::ValidHandle> pfparticles = e.getValidHandle>(PFPLabel); art::fill_ptr_vector(PFParticleList, pfparticles); // Pandora MetaData - art::FindManyP fmt0pandora(pfparticles, e, PFPLabel); - art::FindManyP PFPMetaDataAssoc(pfparticles, e, PFPLabel); + art::FindOne fmt0pandora(pfparticles, e, PFPLabel); + art::FindOne PFPMetaDataAssoc(pfparticles, e, PFPLabel); // Tracks - art::ValidHandle> tracks = e.getValidHandle>(fTPCTrackLabel[it]); + art::ValidHandle> tracks = e.getValidHandle>(TPCTrackLabel); // Track - associated data - art::FindManyP fmTracks(PFParticleList, e, fTPCTrackLabel[it]); + art::FindManyP fmTracks(PFParticleList, e, TPCTrackLabel); // Collect all hits - art::ValidHandle> allhit_handle = e.getValidHandle>(fHitLabel[it]); + art::ValidHandle> allhit_handle = e.getValidHandle>(HitLabel); std::vector> allHits; art::fill_ptr_vector(allHits, allhit_handle); std::map>> id_to_ide_map; std::map>> id_to_truehit_map; - - if(simchannels.size() && !fData){ + if(!simchannels.empty() && !fData){ art::ServiceHandle btServ; + // ID (TrackID) refers to the reconstructed TrackID, it is not the Geant4 ID. id_to_ide_map = RecoUtils::PrepSimChannels(simchannels, *fGeometryService); - id_to_truehit_map = RecoUtils::PrepTrueHits(allHits, clockData, *btServ.get()); + id_to_truehit_map = RecoUtils::buildTrackIDtoHitsMap(allHits, clockData, *btServ.get()); } - // Start looping on the particles - for (art::Ptr p_pfp: PFParticleList) { + for (art::Ptr const& p_pfp: PFParticleList) { const std::vector> thisTrack = fmTracks.at(p_pfp.key()); if (thisTrack.size() != 1) continue; art::Ptr trkPtr = thisTrack.at(0); const recob::Track &track = *trkPtr; - art::InputTag thm_label = fTRKHMproducer.empty() ? fTPCTrackLabel[it] : fTRKHMproducer; + if(track.Length() fmtrkHits(tracks, e, thm_label); std::vector> emptyHitVector; const std::vector> &trkHits = fmtrkHits.isValid() ? fmtrkHits.at(trkPtr.key()) : emptyHitVector; std::vector emptyTHMVector; const std::vector &trkHitMetas = fmtrkHits.isValid() ? fmtrkHits.data(trkPtr.key()) : emptyTHMVector; - - if(track.Length()::signaling_NaN(); - auto t0s = fmt0pandora.at(p_pfp.key()); - if (!t0s.empty()){ - t0 = t0s[0]->Time(); //Get T0 - } + double t0 = std::numeric_limits::signaling_NaN(); + if( auto const& t0ref = fmt0pandora.at(p_pfp.key())) t0 = t0ref.ref().Time(); + int goodHits=0; int countE=0, countW=0; // These counters are used to determine if track is CC-E, EE, EW, CC-W, WE, WW - // depending on the track type, the Top CRT uses the appropriate position corretions - + // depending on the track type, the Top CRT uses the appropriate position corrections std::vector hx, hy, hz, ht; - for(size_t i=0; iIndex() == std::numeric_limits::max()) || - (!track.HasValidPoint(trkHitMetas[i]->Index())); - geo::Point_t loc = track.LocationAtPoint(trkHitMetas[i]->Index()); - if(loc.X()==-999) continue; - if(badhit) continue; + for(auto const& [trkHit, trkHitMeta]: util::zip(trkHits, trkHitMetas)){ + bool badhit = (trkHitMeta->Index() == std::numeric_limits::max()) || + (!track.HasValidPoint(trkHitMeta->Index())); + if(badhit) continue; + geo::Point_t loc = track.LocationAtPoint(trkHitMeta->Index()); hx.push_back(loc.X()); hy.push_back(loc.Y()); hz.push_back(loc.Z()); - ht.push_back(trkHits[i]->PeakTime()); + ht.push_back(trkHit->PeakTime()); goodHits++; - if(trkHits[i]->WireID().TPC==0 || trkHits[i]->WireID().TPC==1) countE++; + if(trkHit->WireID().TPC==0 || trkHit->WireID().TPC==1) countE++; else countW++; - + } + if(goodHitsWireID().Cryostat; @@ -403,7 +434,6 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) else if(countW!=0 && countE!=0 && cryo==1) trackType=3; //CCWest else if(countW!=0 && countE==0 && cryo==1) trackType=5; //West-West else if(countW==0 && countE!=0 && cryo==1) trackType=4; //West-East - icarus::crt::TopCRTCorrectionMap TopCRTCorrection; if(trackType==0) TopCRTCorrection=fTopCRTTransformations.EastCC; else if(trackType==1) TopCRTCorrection=fTopCRTTransformations.EE; @@ -412,13 +442,6 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) else if(trackType==4) TopCRTCorrection=fTopCRTTransformations.WE; else if(trackType==5) TopCRTCorrection=fTopCRTTransformations.WW; - icarus::crt::Direction trackPCADir={-5,-5,-5,0,0,0}; - - if(goodHits crtCands; for(art::Ptr p_crthit: CRTHitList){ const CRTHit &crtHit = *p_crthit; @@ -428,7 +451,8 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) } icarus::crt::DriftedTrack thisDriftedTrack = fMatchingAlg.DriftTrack(trkHits, trkHitMetas, fGeometryService, detProp, crtTime, track); if(thisDriftedTrack.outbound>0) continue; - icarus::crt::Direction driftedTrackDir=fMatchingAlg.PCAfit(thisDriftedTrack.spx, thisDriftedTrack.spy, thisDriftedTrack.spz); + icarus::crt::PCAResults driftedPCAResults=fMatchingAlg.PCAfit(thisDriftedTrack.spx, thisDriftedTrack.spy, thisDriftedTrack.spz); + icarus::crt::TranslationVector translVector = {driftedPCAResults.eigenVector1, driftedPCAResults.mean}; int crtSys=-1; if(crtHit.plane<=34) crtSys=0; else if (crtHit.plane==50) crtSys=2; @@ -441,7 +465,8 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) double crtDistance=std::numeric_limits::signaling_NaN(); icarus::crt::CRTPlane thisCRTPlane = fMatchingAlg.DeterminePlane(crtHit); - icarus::crt::CrossPoint crossPoint = fMatchingAlg.DetermineProjection(driftedTrackDir, thisCRTPlane); + icarus::crt::CrossingPoint crossPoint = fMatchingAlg.DetermineProjection(translVector, thisCRTPlane); + double crtX=crtHit.x_pos; double crtY=crtHit.y_pos; double crtZ=crtHit.z_pos; @@ -471,21 +496,21 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) } if(thisCRTPlane.first==0){ - deltaX=crtX-crossPoint.X; + deltaX=crtX-crossPoint.X(); deltaY=0; - deltaZ=crtZ-crossPoint.Z; + deltaZ=crtZ-crossPoint.Z(); } else if(thisCRTPlane.first==1){ deltaX=0; - deltaY=crtY-crossPoint.Y; - deltaZ=crtZ-crossPoint.Z; + deltaY=crtY-crossPoint.Y(); + deltaZ=crtZ-crossPoint.Z(); } else if(thisCRTPlane.first==2){ - deltaX=crtX-crossPoint.X; - deltaY=crtY-crossPoint.Y; + deltaX=crtX-crossPoint.X(); + deltaY=crtY-crossPoint.Y(); deltaZ=0; } crtDistance=sqrt(pow(deltaX,2)+pow(deltaZ,2)+pow(deltaY,2)); if(crtDistance>fMaximalCRTDistance) continue; - icarus::crt::CandCRT thisCrtCand={crtHit,p_crthit, thisCRTPlane.first, crtDistance, deltaX, deltaY, deltaZ, crossPoint.X, crossPoint.Y, crossPoint.Z}; + icarus::crt::CandCRT thisCrtCand={crtHit,p_crthit, thisCRTPlane.first, crtDistance, deltaX, deltaY, deltaZ, crossPoint}; crtCands.push_back(thisCrtCand); } // End of CRT Hit loop if(crtCands.empty()) { @@ -503,7 +528,7 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) else matchedSys=1; if(matchedSys==2) continue; // lets discard Bottom CRT Hits for the moment bool trueMatch=false; - if(!fData){ + if(!fData && !fSkipTruth){ std::vector crtTracks, crtPdgs; std::pair thisMatch=std::make_pair((int)bestCrtCand.CRThit.feb_id[0], bestCrtCand.CRThit.ts1_ns); if(crtParticleMap.find(thisMatch) != crtParticleMap.end()){ @@ -531,9 +556,9 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) fCrtX=bestCrtCand.CRThit.x_pos; fCrtY=bestCrtCand.CRThit.y_pos; fCrtZ=bestCrtCand.CRThit.z_pos; - fCrossPointX=bestCrtCand.crossX; - fCrossPointY=bestCrtCand.crossY; - fCrossPointZ=bestCrtCand.crossZ; + fCrossPointX=bestCrtCand.crossPoint.X(); + fCrossPointY=bestCrtCand.crossPoint.Y(); + fCrossPointZ=bestCrtCand.crossPoint.Z(); fTrueMatch=trueMatch; fTree->Fill(); mf::LogInfo("CRTT0Tagging") @@ -542,13 +567,12 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) t0col->push_back(anab::T0(bestCrtCand.CRThit.ts1_ns, track.ID(), matchedSys, bestCrtCand.CRThit.plane,bestCrtCand.distance)); util::CreateAssn(*this, e, *t0col, trkPtr, *trackAssn); util::CreateAssn(*this, e, *t0col, bestCrtCand.ptrCRThit, *t0CrtHitAssn); - icarus::CRTTPCMatchingInfo matchInfo = {bestCrtCand.distance, matchedSys, bestCrtCand.CRThit.plane, bestCrtCand.CRThit.ts1_ns, bestCrtCand.deltaX, bestCrtCand.deltaY, bestCrtCand.deltaZ, bestCrtCand.crossX, bestCrtCand.crossY, bestCrtCand.crossZ, bestCrtCand.plane}; + icarus::CRTTPCMatchingInfo matchInfo = {bestCrtCand.distance, matchedSys, bestCrtCand.CRThit.plane, bestCrtCand.CRThit.ts1_ns, bestCrtCand.deltaX, bestCrtCand.deltaY, bestCrtCand.deltaZ, bestCrtCand.crossPoint.X(), bestCrtCand.crossPoint.Y(), bestCrtCand.crossPoint.Z(), bestCrtCand.plane}; matchInfoCol->push_back(matchInfo); //util::CreateAssn(*this, e, *t0col, *matchInfoCol, *t0matchInfoAssn); // util::CreateAssn(*this, e, *matchInfoCol, trkPtr, *trackMatchInfoAssn); // util::CreateAssn(*this, e, *matchInfoCol, bestCrtCand.ptrCRThit, *matchInfoCrtHitAssn); } - } // End of Track Loop } // End of Cryo Loop diff --git a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx index d4248f182..9e8bd3ec9 100644 --- a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx +++ b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx @@ -14,7 +14,9 @@ #include #include "messagefacility/MessageLogger/MessageLogger.h" #include "TMatrixD.h" +#include "TMatrixDSym.h" #include "TMatrixDEigen.h" +#include "TMatrixDSymEigen.h" #include "larcorealg/Geometry/TPCGeo.h" #include "larcorealg/Geometry/PlaneGeo.h" @@ -273,7 +275,7 @@ namespace icarus::crt{ return; } - Direction CRTMatchingAlg::PCAfit (std::vector const& x, std::vector const& y, std::vector const& z) + PCAResults CRTMatchingAlg::PCAfit (std::vector const& x, std::vector const& y, std::vector const& z) { int min=0; int max=x.size(); @@ -282,50 +284,35 @@ namespace icarus::crt{ for(int k=min; k::lowest(); int maxevalpos = -1; - for(int k = 0; k < 3; k++){ - if(this_eval[k][k]>max_eval){ - max_eval = this_eval[k][k]; - maxevalpos = k; - }//end if(this_eval[k][k]>max_eval) - }//end loop looking for best eval - Direction thDirection= {this_evec[0][maxevalpos] , this_evec[1][maxevalpos], this_evec[2][maxevalpos], xavg, yavg, zavg}; - return thDirection; + if(this_eval.NonZeros()!=3) throw std::logic_error("CRTMatchingAlg::PCAfit: evals/evects wrong size!"); + geo::Point_t mean = {xavg, yavg, zavg}; + geo::Vector_t first = {this_evec[0][0], this_evec[1][0], this_evec[2][0]}; + geo::Vector_t second = {this_evec[0][1], this_evec[1][1], this_evec[2][1]}; + geo::Vector_t third = {this_evec[0][2], this_evec[1][2], this_evec[2][2]}; + + PCAResults thPCAResult = {first, second, third, this_eval[0], this_eval[1], this_eval[2], mean}; + return thPCAResult; } CRTPlane CRTMatchingAlg::DeterminePlane(sbn::crt::CRTHit const& CRThit) @@ -349,55 +336,52 @@ namespace icarus::crt{ } // switch return std::make_pair(Plane, Pos); } - - ProjectionPoint CRTMatchingAlg::TranslatePointTo(double dirx, double diry, double dirz, double x0, double y0, double z0, double position) - { - if(dirx==0) throw std::invalid_argument("CRTMatchingAlg::TranslatePointTo: dirx is 0"); - double Lambda = (position-x0)/dirx; - double PosAtY = (Lambda*diry+y0); - double PosAtZ = (Lambda*dirz+z0); - CrossPoint CrossingPoint = {position, PosAtY, PosAtZ}; - return CrossingPoint; + CrossingPoint CRTMatchingAlg::TranslatePointTo(geo::Vector_t dirVector, geo::Point_t meanPos, CRTPlane CRTwall){ + + if(dirVector.X()==0) throw std::invalid_argument("CRTMatchingAlg::TranslatePointTo: Cosine Director is null"); + return meanPos + dirVector * (CRTwall.second - meanPos.X()) / dirVector.X(); } - CrossPoint CRTMatchingAlg::CalculateForPlane(const Direction& dir, int plane, double position) - { - double dirX, dirY, dirZ; - double meanX, meanY, meanZ; + TranslationVector CRTMatchingAlg::RotateToLocalCRTPlane(const TranslationVector& transl, CRTPlane CRTwall){ + geo::Vector_t rotatedDir; + geo::Point_t rotatedMean; - switch(plane) { + switch(CRTwall.first) { case 0: // Fixed Coordinate: Y - dirX = dir.diry; dirY = dir.dirx; dirZ = dir.dirz; - meanX = dir.meany; meanY = dir.meanx; meanZ = dir.meanz; + rotatedDir={transl.dir.Y(), transl.dir.X(), transl.dir.Z()}; + rotatedMean={transl.mean.Y(), transl.mean.X(), transl.mean.Z()}; break; case 1: // Fixed Coordinate: X - dirX = dir.dirx; dirY = dir.diry; dirZ = dir.dirz; - meanX = dir.meanx; meanY = dir.meany; meanZ = dir.meanz; + rotatedDir={transl.dir.X(), transl.dir.Y(), transl.dir.Z()}; + rotatedMean={transl.mean.X(), transl.mean.Y(), transl.mean.Z()}; break; case 2: // Fixed Coordinate: Z - dirX = dir.dirz; dirY = dir.diry; dirZ = dir.dirx; - meanX = dir.meanz; meanY = dir.meany; meanZ = dir.meanx; + rotatedDir={transl.dir.Z(), transl.dir.Y(), transl.dir.X()}; + rotatedMean={transl.mean.Z(), transl.mean.Y(), transl.mean.X()}; break; default: - throw std::invalid_argument("CRTMatchingAlg::CalculateForPlane(): invalid plane"); + throw std::invalid_argument("CRTMatchingAlg::RotateToLocalCRTPlane(): invalid plane"); } - return CRTMatchingAlg::TranslatePointTo(dirX, dirY, dirZ, meanX, meanY, meanZ, position); + return {rotatedDir, rotatedMean}; } - CrossPoint CRTMatchingAlg::DetermineProjection(const Direction& dir, CRTPlane plane) - { - CrossPoint thisCase = CRTMatchingAlg::CalculateForPlane(dir, plane.first, plane.second); - - switch(plane.first) { - case 0: return {thisCase.Y, thisCase.X, thisCase.Z}; // Plane at Y e.g. Top CRT Horizontal Plane - case 1: return {thisCase.X, thisCase.Y, thisCase.Z}; // Plane at X e.g. Side CRT West, East, Top CRT - case 2: return {thisCase.Z, thisCase.Y, thisCase.X}; // Plane at Z e.g. Side CRT South, North, Top CRT + CrossingPoint CRTMatchingAlg::RotateFromLocalCRTPlane(CrossingPoint crossPointCRT, CRTPlane CRTWall){ + switch(CRTWall.first) { + case 0: return {crossPointCRT.Y(), crossPointCRT.X(), crossPointCRT.Z()}; // Plane at Y e.g. Top CRT Horizontal Plane + case 1: return {crossPointCRT.X(), crossPointCRT.Y(), crossPointCRT.Z()}; // Plane at X e.g. Side CRT West, East, Top CRT + case 2: return {crossPointCRT.Z(), crossPointCRT.Y(), crossPointCRT.X()}; // Plane at Z e.g. Side CRT South, North, Top CRT default: - throw std::invalid_argument("CRTMatchingAlg::DetermineProjection(): invalid plane"); + throw std::invalid_argument("CRTMatchingAlg::RotateFromLocalCRTPlane(): invalid plane"); } } + CrossingPoint CRTMatchingAlg::DetermineProjection(const TranslationVector& dir, CRTPlane CRTWall){ + TranslationVector directionPlaneCoordinate = CRTMatchingAlg::RotateToLocalCRTPlane(dir, CRTWall); + CrossingPoint crossingPointPlaneCoordinate = CRTMatchingAlg::TranslatePointTo(directionPlaneCoordinate.dir, directionPlaneCoordinate.mean, CRTWall); + return CRTMatchingAlg::RotateFromLocalCRTPlane(crossingPointPlaneCoordinate, CRTWall); + } + TrackBarycenter CRTMatchingAlg::GetTrackBarycenter (std::vector hx, std::vector hy, std::vector hz, std::vector hw) { double average_x_charge=0, average_y_charge=0, average_z_charge=0, total_charge=0; @@ -455,8 +439,8 @@ namespace icarus::crt{ if(!tpcGeo.ActiveBoundingBox().ContainsX(X, fAllowedRel)) outBound1++; if(outBound!=outBound1 && count<=10){ - std::cout<<"Active Bounding Box MinX "<WireID().Plane<<" X "<WireID().Plane<<" X "<Integral()); } DriftedTrack thisDriftedTrack = {recX, recY, recZ, recI, outBound}; - std::cout<<"--> Outbound cm "< Outbound cm "< ptrCRThit; @@ -72,9 +70,7 @@ struct CandCRT{ double deltaX; double deltaY; double deltaZ; - double crossX; - double crossY; - double crossZ; + CrossingPoint crossPoint; }; struct ModuleCenter @@ -141,26 +137,28 @@ class CRTMatchingAlg { /// This function runs the PCA analysis on three vectors of spatial coordinates x,y,z and return the principal eigenvector. /// The entries in the i-th index of X, Y and Z vectors must correspond to the same point. - static Direction PCAfit (std::vector const& x, std::vector const& y, std::vector const& z); + //static Direction PCAfit (std::vector const& x, std::vector const& y, std::vector const& z); + static PCAResults PCAfit (std::vector const& x, std::vector const& y, std::vector const& z); /// This function determines the coordinate in which the CRT module is constant. + /// 0 for fixed Y, 1 for fixed X, 2 for fixed Z, /// e.g. in the Top CRT Horizontal Plane, the Y coordinate is fixed, in the Side CRT West Walll, the X Coordinate is fixed, ... CRTPlane DeterminePlane(sbn::crt::CRTHit const& CRThit); /// This function evaluates the Track Crossing point onto the CRT plane considered. - /// dir1, dir2, dir3 are the three cosine directors of a track. - /// p1, p2 and p3 are the coordinates of the CRT hit position. - static ProjectionPoint TranslatePointTo(double dir1, double dir2, double dir3, double p1, double p2, double p3, double position); - //static ProjectionPoint CalculateProjection(double dir1, double dir2, double dir3, double p1, double p2, double p3, double position); + /// dir is the track direction in the CRTWall reference system. + /// mean is the mean value of the track in the CRTWall reference system. + static CrossingPoint TranslatePointTo(geo::Vector_t dir, geo::Point_t mean, CRTPlane CRTWall); - /// This function runs the CalculateProjection function, after deciding the director cosine order expected from - /// the CalculateProjection function, assuming the evaluated CRTPlane (fixed coordinate and value of the coordinate). - CrossPoint CalculateForPlane(const Direction& dir, int plane, double position); + /// This function rotate the translation vector (direction and mean position) from the TPC reference system, to the CRTWall one. + TranslationVector RotateToLocalCRTPlane(const TranslationVector& transl, CRTPlane CRTWall); + + /// This function rotate the CrossingPoint from the CRTWall reference system, to the TPC one. + CrossingPoint RotateFromLocalCRTPlane(CrossingPoint crossPointCRT, CRTPlane CRTWall); /// This function returns the "correct" predicted crossing point given the cosine directors of the track fitted with PCA /// and a CRTPlane (fixed coordinate and value of the coordinate). - CrossPoint DetermineProjection(const Direction& dir, CRTPlane plane); - + CrossingPoint DetermineProjection(const TranslationVector& dir, CRTPlane CRTWall); /// This function evaluates the TrackBarycenter with weighted mean. hx, hy, hz and hw are vectors with the x, y z coordinates /// and w is the weight (e.g. one could use integral or peak amplitude or more...). /// The entries in the i-th index of hx, hy, hz and hw vectors must correspond to the same point. @@ -175,7 +173,6 @@ class CRTMatchingAlg { double fTickPeriod; double fTickAtAnode; double fAllowedOffsetCM; - }; } diff --git a/icaruscode/CRT/CRTUtils/RecoUtils.cc b/icaruscode/CRT/CRTUtils/RecoUtils.cc index 770e85ae7..979d05b0a 100644 --- a/icaruscode/CRT/CRTUtils/RecoUtils.cc +++ b/icaruscode/CRT/CRTUtils/RecoUtils.cc @@ -44,10 +44,10 @@ std::map>> RecoUtils::P return ret; } -std::map>> RecoUtils::PrepTrueHits(const std::vector> &allHits, +std::map>> RecoUtils::buildTrackIDtoHitsMap(const std::vector> &allHits, const detinfo::DetectorClocksData &clockData, const cheat::BackTrackerService &backtracker) { std::map>> ret; - for (const art::Ptr h: allHits) { + for (const art::Ptr& h: allHits) { for (int ID: backtracker.HitToTrackIds(clockData, *h)) { ret[abs(ID)].push_back(h); } diff --git a/icaruscode/CRT/CRTUtils/RecoUtils.h b/icaruscode/CRT/CRTUtils/RecoUtils.h index de6d11026..21ec3f254 100644 --- a/icaruscode/CRT/CRTUtils/RecoUtils.h +++ b/icaruscode/CRT/CRTUtils/RecoUtils.h @@ -78,8 +78,7 @@ namespace RecoUtils{ std::map>> PrepSimChannels(const std::vector> &simchannels, const geo::GeometryCore &geo); - std::map>> PrepTrueHits(const std::vector> &allHits, const detinfo::DetectorClocksData &clockData, const cheat::BackTrackerService &backtracker); - + std::map>> buildTrackIDtoHitsMap(const std::vector> &allHits, const detinfo::DetectorClocksData &clockData, const cheat::BackTrackerService &backtracker); } #endif diff --git a/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl b/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl index 2994dcc92..d2b8d2ce3 100644 --- a/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl +++ b/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl @@ -16,12 +16,13 @@ standard_crtmatchingalg: # of 10 us * 0.157 cm/us = 1.57 cm. # As this is phrased, one could think of this as the two variables are related, that is not necessarily # the case, but is still a good guess. - isData: true # IsData - + isData: true # IsData + CrtHitModuleLabel: "crthit" TriggerLabel: "daqTrigger" TriggerConfiguration: "triggerconfig" TPCTrackLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # Track producer module label + TRKHMLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # TrackHit Metadata producer module label PFParticleLabel: ["pandoraGausCryoE", "pandoraGausCryoW"] # PFParticle producer module label HitLabel: ["cluster3DCryoE" , "cluster3DCryoW"] @@ -35,6 +36,7 @@ icarus_crtt0tagging: TriggerLabel: "daqTrigger" TriggerConfiguration: "triggerconfig" TPCTrackLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # Track producer module label + TRKHMLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # TrackHit Metadata producer module label PFParticleLabel: ["pandoraGausCryoE", "pandoraGausCryoW"] # PFParticle producer module label HitLabel: ["cluster3DCryoE" , "cluster3DCryoW"] MatchingAlg: @local::standard_crtmatchingalg diff --git a/icaruscode/CRT/crtt0tagging.fcl b/icaruscode/CRT/crtt0tagging.fcl index c847895f9..b12646905 100644 --- a/icaruscode/CRT/crtt0tagging.fcl +++ b/icaruscode/CRT/crtt0tagging.fcl @@ -10,8 +10,8 @@ standard_crtt0tagging: MaximalCRTDistance: 300. # Maximal distance between CRT Hit Candidate and Track Projection GoodCandidateDistance: 100. # 96 cm maximizes EfficiencyXPurity (both > 92%) MaximumDeltaT: 10000. # Maximal Time difference between a T0 tagged track and CRT Hit time for the combination to be considered acceptable. [ns] - isData: true # Data + skipTruth: false # skipTruth module_type: "CRTT0Tagging" CrtHitModuleLabel: "crthit" @@ -19,6 +19,7 @@ standard_crtt0tagging: TriggerConfiguration: "triggerconfig" TPCTrackLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # Track producer module label PFParticleLabel: ["pandoraGausCryoE", "pandoraGausCryoW"] # PFParticle producer module label + TRKHMLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # TrackHit Metadata producer module label HitLabel: ["cluster3DCryoE" , "cluster3DCryoW"] MatchingAlg: @local::standard_crtmatchingalg } @@ -30,9 +31,9 @@ standard_crtt0taggingmc: MinimumGoodHits: 5 # Minimum number of good hits to perform the fit MaximalCRTDistance: 300. # Maximal distance between CRT Hit Candidate and Track Projection GoodCandidateDistance: 100. # 96 cm maximizes EfficiencyXPurity (both > 92%) - MaximumDeltaT: 10000. # Maximal Time difference between a T0 tagged track and CRT Hit time for the combination to be considered acceptable. [ns] - - isData: false #MC + MaximumDeltaT: 10000. # Maximal Time difference between a T0 tagged track and CRT Hit time for the combination to be considered acceptable. [ns] + isData: false # MC + skipTruth: false # skipTruth module_type: "CRTT0Tagging" CrtHitModuleLabel: "crthit" @@ -40,6 +41,7 @@ standard_crtt0taggingmc: TriggerConfiguration: "triggerconfig" TPCTrackLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # Track producer module label PFParticleLabel: ["pandoraGausCryoE", "pandoraGausCryoW"] # PFParticle producer module label + TRKHMLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # TrackHit Metadata producer module label HitLabel: ["cluster3DCryoE" , "cluster3DCryoW"] MatchingAlg: @local::standard_crtmatchingalg SimulationLabel: "largeant" From 2ff70c5fb1dbc23f3b2ef96c52b4e3da423735c1 Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Wed, 15 Jan 2025 15:56:42 +0100 Subject: [PATCH 19/28] This commits includes other changes and improvements requested by Gianluca. In particular, software related to CRT Hit transformation has beend moved from the namespace dedicated to the matching, to a new one dedicated to data related tools --- icaruscode/CRT/CRTT0Tagging_module.cc | 43 ++- icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx | 293 ++----------------- icaruscode/CRT/CRTUtils/CRTMatchingUtils.h | 68 +---- icaruscode/CRT/CRTUtils/RecoUtils.cc | 240 ++++++++++++++- icaruscode/CRT/CRTUtils/RecoUtils.h | 94 ++++-- 5 files changed, 378 insertions(+), 360 deletions(-) diff --git a/icaruscode/CRT/CRTT0Tagging_module.cc b/icaruscode/CRT/CRTT0Tagging_module.cc index 47dec920d..4420c10e9 100644 --- a/icaruscode/CRT/CRTT0Tagging_module.cc +++ b/icaruscode/CRT/CRTT0Tagging_module.cc @@ -133,8 +133,8 @@ class icarus::crt::CRTT0Tagging : public art::EDProducer { bool fData; bool fSkipTruth; - icarus::crt::TopCRTCentersMap fTopCRTCenterMap; - icarus::crt::TopCRTTransformations fTopCRTTransformations; + icarus::crt::dataTools::TopCRTCentersMap fTopCRTCenterMap; + icarus::crt::dataTools::TopCRTTransformations fTopCRTTransformations; TTree* fTree; int fEvent; ///< number of the event being processed @@ -144,6 +144,9 @@ class icarus::crt::CRTT0Tagging : public art::EDProducer { int fCrtSys; int fCryo; double fTrackLength; + double fFirstEigenValue; + double fSecondEigenValue; + double fThirdEigenValue; double fTrackCrtDistance; double fTrackCrtDeltaX; double fTrackCrtDeltaY; @@ -223,8 +226,8 @@ bool icarus::crt::CRTT0Tagging::hasModID(std::uint32_t modID, sbn::crt::CRTHit c //void icarus::crt::CRTT0Tagging::beginRun(art::Run& r) void icarus::crt::CRTT0Tagging::beginJob() { - fTopCRTCenterMap=icarus::crt::LoadTopCRTCenters(); - fTopCRTTransformations=icarus::crt::LoadTopCRTTransformations(); + fTopCRTCenterMap=icarus::crt::dataTools::LoadTopCRTCenters(); + fTopCRTTransformations=icarus::crt::dataTools::LoadTopCRTTransformations(); fTree = tfs->make("matchTree","CRTHit - TPC track matching analysis"); @@ -235,6 +238,9 @@ void icarus::crt::CRTT0Tagging::beginJob() fTree->Branch("CrtSys", &fCrtSys, "CrtSys/I"); fTree->Branch("CrtRegion", &fCrtRegion, "CrtRegion/I"); fTree->Branch("TrackLength", &fTrackLength ); + fTree->Branch("FirstEigenValue", &fFirstEigenValue ); + fTree->Branch("SecondEigenValue", &fSecondEigenValue ); + fTree->Branch("ThirdEigenValue", &fThirdEigenValue ); fTree->Branch("TrackCrtDistance", &fTrackCrtDistance ); fTree->Branch("TrackCrtDeltaX", &fTrackCrtDeltaX ); fTree->Branch("TrackCrtDeltaY", &fTrackCrtDeltaY ); @@ -410,13 +416,14 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) // These counters are used to determine if track is CC-E, EE, EW, CC-W, WE, WW // depending on the track type, the Top CRT uses the appropriate position corrections - std::vector hx, hy, hz, ht; + std::vector ht; + std::vector positionVector; for(auto const& [trkHit, trkHitMeta]: util::zip(trkHits, trkHitMetas)){ bool badhit = (trkHitMeta->Index() == std::numeric_limits::max()) || (!track.HasValidPoint(trkHitMeta->Index())); if(badhit) continue; geo::Point_t loc = track.LocationAtPoint(trkHitMeta->Index()); - hx.push_back(loc.X()); hy.push_back(loc.Y()); hz.push_back(loc.Z()); + positionVector.push_back(loc); ht.push_back(trkHit->PeakTime()); goodHits++; if(trkHit->WireID().TPC==0 || trkHit->WireID().TPC==1) countE++; @@ -434,7 +441,7 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) else if(countW!=0 && countE!=0 && cryo==1) trackType=3; //CCWest else if(countW!=0 && countE==0 && cryo==1) trackType=5; //West-West else if(countW==0 && countE!=0 && cryo==1) trackType=4; //West-East - icarus::crt::TopCRTCorrectionMap TopCRTCorrection; + icarus::crt::dataTools::TopCRTCorrectionMap TopCRTCorrection; if(trackType==0) TopCRTCorrection=fTopCRTTransformations.EastCC; else if(trackType==1) TopCRTCorrection=fTopCRTTransformations.EE; else if(trackType==2) TopCRTCorrection=fTopCRTTransformations.EW; @@ -443,15 +450,16 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) else if(trackType==5) TopCRTCorrection=fTopCRTTransformations.WW; std::vector crtCands; - for(art::Ptr p_crthit: CRTHitList){ + for(art::Ptr const& p_crthit: CRTHitList){ const CRTHit &crtHit = *p_crthit; double crtTime=crtHit.ts1_ns/1e3; + // If the Track has a Pandora T0, this is also used to look for compatible CRT Hits if(!isnan(t0)){ if(fabs(t0-crtHit.ts1_ns)>fMaximumDeltaT) continue; } icarus::crt::DriftedTrack thisDriftedTrack = fMatchingAlg.DriftTrack(trkHits, trkHitMetas, fGeometryService, detProp, crtTime, track); if(thisDriftedTrack.outbound>0) continue; - icarus::crt::PCAResults driftedPCAResults=fMatchingAlg.PCAfit(thisDriftedTrack.spx, thisDriftedTrack.spy, thisDriftedTrack.spz); + icarus::crt::PCAResults driftedPCAResults=fMatchingAlg.PCAfit(thisDriftedTrack.sp); icarus::crt::TranslationVector translVector = {driftedPCAResults.eigenVector1, driftedPCAResults.mean}; int crtSys=-1; if(crtHit.plane<=34) crtSys=0; @@ -477,18 +485,18 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) centerDX=crtX-fTopCRTCenterMap[(int)crtHit.feb_id[0]].X; centerDY=crtY-fTopCRTCenterMap[(int)crtHit.feb_id[0]].Y; centerDZ=crtZ-fTopCRTCenterMap[(int)crtHit.feb_id[0]].Z; - icarus::crt::AffineTrans thisAffine=TopCRTCorrection[(int)crtHit.feb_id[0]]; + icarus::crt::dataTools::AffineTrans thisAffine=TopCRTCorrection[(int)crtHit.feb_id[0]]; std::pair transCrt; if(crtHit.plane==30) { - transCrt=icarus::crt::AffineTransformation(centerDX, centerDZ, thisAffine); + transCrt=icarus::crt::dataTools::AffineTransformation(centerDX, centerDZ, thisAffine); crtX=transCrt.first; crtZ=transCrt.second; } else if(crtHit.plane==31 ||crtHit.plane==32) { - transCrt=icarus::crt::AffineTransformation(centerDY, centerDZ, thisAffine); + transCrt=icarus::crt::dataTools::AffineTransformation(centerDY, centerDZ, thisAffine); crtY=transCrt.first; crtZ=transCrt.second; } else if(crtHit.plane==33 ||crtHit.plane==34){ - transCrt=icarus::crt::AffineTransformation(centerDX, centerDY, thisAffine); + transCrt=icarus::crt::dataTools::AffineTransformation(centerDX, centerDY, thisAffine); crtX=transCrt.first; crtY=transCrt.second; } @@ -542,13 +550,20 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) } } - fEvent=e.id().event(); + icarus::crt::DriftedTrack thisMatchedDriftedTrack = fMatchingAlg.DriftTrack(trkHits, trkHitMetas, fGeometryService, detProp, bestCrtCand.CRThit.ts1_ns/1e3, track); + icarus::crt::PCAResults driftedMatchedPCAResults=fMatchingAlg.PCAfit(thisMatchedDriftedTrack.sp); + + fEvent=e.event(); fRun=e.run(); fRun=e.subRun(); fCrtRegion=bestCrtCand.CRThit.plane; fCrtSys=matchedSys; fCryo=cryo; fTrackLength=track.Length(); + fFirstEigenValue=driftedMatchedPCAResults.eigenValue1; + fSecondEigenValue=driftedMatchedPCAResults.eigenValue2; + fThirdEigenValue=driftedMatchedPCAResults.eigenValue3; + std::cout< Type0Corr; - std::map Type1Corr; - std::map Type2Corr; - std::map Type3Corr; - std::map Type4Corr; - std::map Type5Corr; - - if (!corrFile.is_open()) { - mf::LogError("CRTMatchingUtils_LoadTopCRTTransformation") - << "Failed to open Top CRT Correction transformation file: " << fullFileName; - } - std::string line; - while (std::getline(corrFile, line)) { - std::istringstream iss(line); - std::vector variables; - double var; - while (iss >> var) { - variables.push_back(var); - } - - int pos=0; - - AffineTrans Type0 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; - pos=pos+8; - AffineTrans Type1 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; - pos=pos+8; - AffineTrans Type2 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; - pos=pos+8; - AffineTrans Type3 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; - pos=pos+8; - AffineTrans Type4 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; - pos=pos+8; - AffineTrans Type5 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; - Type0Corr.insert({variables.at(0), Type0}); - Type1Corr.insert({variables.at(0), Type1}); - Type2Corr.insert({variables.at(0), Type2}); - Type3Corr.insert({variables.at(0), Type3}); - Type4Corr.insert({variables.at(0), Type4}); - Type5Corr.insert({variables.at(0), Type5}); - } - TopCRTTransformations LoadedTransformations={Type2Corr, Type1Corr, Type0Corr, Type4Corr, Type5Corr, Type3Corr}; - return LoadedTransformations; - } - + CRTMatchingAlg::CRTMatchingAlg(const fhicl::ParameterSet& pset) { this->reconfigure(pset); @@ -268,28 +30,29 @@ namespace icarus::crt{ CRTMatchingAlg::CRTMatchingAlg() = default; - void CRTMatchingAlg::reconfigure(const fhicl::ParameterSet& pset){ + void CRTMatchingAlg::reconfigure(const fhicl::ParameterSet& pset) + { fTickPeriod = pset.get("TickPeriod", 0.4); fTickAtAnode = pset.get("TickAtAnode", 850.); fAllowedOffsetCM = pset.get("AllowedOffsetCM", 1.57); return; } - PCAResults CRTMatchingAlg::PCAfit (std::vector const& x, std::vector const& y, std::vector const& z) + PCAResults CRTMatchingAlg::PCAfit (std::vector const& sp) { int min=0; - int max=x.size(); + int max=sp.size(); int size=max-min; double xavg=0, yavg=0, zavg=0; for(int k=min; k hx, std::vector hy, std::vector hz, std::vector hw) + TrackBarycenter CRTMatchingAlg::GetTrackBarycenter (std::vector sp, std::vector hw) { double average_x_charge=0, average_y_charge=0, average_z_charge=0, total_charge=0; bool isGood; - for (unsigned i = 0; i < hz.size(); i++) { - if(isnan(hz[i])) continue; + for (unsigned i = 0; i < sp.size(); i++) { + if(isnan(sp[i].Z())) continue; - if(hz[i]>-1000 && hz[i]<1000){ - average_z_charge+=hz[i]*hw[i]; - average_y_charge+=hy[i]*hw[i]; - average_x_charge+=hx[i]*hw[i]; + if(sp[i].Z()>-1000 && sp[i].Z()<1000){ + average_z_charge+=sp[i].Z()*hw[i]; + average_y_charge+=sp[i].Y()*hw[i]; + average_x_charge+=sp[i].X()*hw[i]; total_charge+=hw[i]; } } @@ -410,13 +177,13 @@ namespace icarus::crt{ int outBound=0; int outBound1=0; int count=0; - std::vector recX, recY, recZ, recI; + std::vector recI; + std::vector driftedPositionVector; for(size_t i=0; iIndex() == std::numeric_limits::max()) || (!tpcTrack.HasValidPoint(trkHitMetas[i]->Index())); if(badhit) continue; geo::Point_t loc = tpcTrack.LocationAtPoint(trkHitMetas[i]->Index()); - //if(loc.X()==-999) continue; const geo::TPCGeo& tpcGeo = GeometryService->TPC(trkHits[i]->WireID()); int const cryo = trkHits[i]->WireID().Cryostat; int tpc=trkHits[i]->WireID().TPC; @@ -443,13 +210,11 @@ namespace icarus::crt{ //std::cout<<"OutBound "<WireID().Plane<<" X "<Integral()); } - DriftedTrack thisDriftedTrack = {recX, recY, recZ, recI, outBound}; - //std::cout<<"--> Outbound cm "< spx; // Drifted Track Hit Points X coordinate - std::vector spy; // Drifted Track Hit Points Y coordinate - std::vector spz; // Drifted Track Hit Points Z coordinate + std::vector sp; // Drifted space points std::vector spi; // Drifted Track Hit Points integral int outbound; // Number of hit points out of the logical volume of the TPC - //double drifted_startx; // + //double drifted_startx; //double drifted_endx; }; @@ -73,60 +71,11 @@ struct CandCRT{ CrossingPoint crossPoint; }; -struct ModuleCenter -{ - double X; - double Y; - double Z; -}; - -struct AffineTrans -{ - double A11; - double A12; - double A21; - double A22; - double B1; - double B2; - double Accuracy; - double N; -}; - -using FebIndex_t = int; - -using TopCRTCorrectionMap = std::map; - -struct TopCRTTransformations -{ - TopCRTCorrectionMap EE; - TopCRTCorrectionMap EW; - TopCRTCorrectionMap EastCC; - TopCRTCorrectionMap WE; - TopCRTCorrectionMap WW; - TopCRTCorrectionMap WestCC; -}; - -using TopCRTCentersMap = std::map; - /// CRTPlane corresponds to a pair of: /// 1st CRT fixed coordinate plane (e.g. 0 is X coordinate) /// 2nd value of the CRT fixed coordinate plane (e.g. for Top CRT Horizontal this value is ~618 cm. using CRTPlane = std::pair; -/// The transformed CRT Hits are in cm -using TransformedCRTHit = std::pair; - -/// This function loads the Top CRT modules centers. -TopCRTCentersMap LoadTopCRTCenters(); - -/// This function performs the affine transformation of the CRT hit points. -/// The AffineTransformation requires input variables in cm. -TransformedCRTHit AffineTransformation(double DX, double DZ, AffineTrans affine); - -/// This functions loads the Affine Transformation TXT files. -TopCRTTransformations LoadTopCRTTransformations(); - - class CRTMatchingAlg { public: @@ -135,10 +84,8 @@ class CRTMatchingAlg { void reconfigure(const fhicl::ParameterSet& pset); - /// This function runs the PCA analysis on three vectors of spatial coordinates x,y,z and return the principal eigenvector. - /// The entries in the i-th index of X, Y and Z vectors must correspond to the same point. - //static Direction PCAfit (std::vector const& x, std::vector const& y, std::vector const& z); - static PCAResults PCAfit (std::vector const& x, std::vector const& y, std::vector const& z); + /// This function runs the PCA analysis on the spatial coordinates vector and return the PCAResults. + static PCAResults PCAfit (std::vector const& sp); /// This function determines the coordinate in which the CRT module is constant. /// 0 for fixed Y, 1 for fixed X, 2 for fixed Z, @@ -159,10 +106,11 @@ class CRTMatchingAlg { /// This function returns the "correct" predicted crossing point given the cosine directors of the track fitted with PCA /// and a CRTPlane (fixed coordinate and value of the coordinate). CrossingPoint DetermineProjection(const TranslationVector& dir, CRTPlane CRTWall); - /// This function evaluates the TrackBarycenter with weighted mean. hx, hy, hz and hw are vectors with the x, y z coordinates + + /// This function evaluates the TrackBarycenter with weighted mean. posVector is a vector of track spacepoints /// and w is the weight (e.g. one could use integral or peak amplitude or more...). - /// The entries in the i-th index of hx, hy, hz and hw vectors must correspond to the same point. - TrackBarycenter GetTrackBarycenter(std::vector hx, std::vector hy, std::vector hz, std::vector hw); + /// The entries in the i-th index of posVector and hw vectors must correspond to the same point. + TrackBarycenter GetTrackBarycenter(std::vector posVector, std::vector hw); /// Function which drifts the track x coordinates assuming a time (in the trigger reference system). /// The function also returns the number of hit points which would be outside of the physical boundaries of the TPCs at the considered time. diff --git a/icaruscode/CRT/CRTUtils/RecoUtils.cc b/icaruscode/CRT/CRTUtils/RecoUtils.cc index 979d05b0a..8b10eb34f 100644 --- a/icaruscode/CRT/CRTUtils/RecoUtils.cc +++ b/icaruscode/CRT/CRTUtils/RecoUtils.cc @@ -1,6 +1,244 @@ +#include +#include #include "RecoUtils.h" +namespace icarus::crt::dataTools{ + +TopCRTCentersMap LoadTopCRTCenters() +{ + TopCRTCentersMap TopCRTCenters; + // The follwing numbers have been extracted from the Top CRT modules geometry. + // The numbers are respectively moduleID and X,Y,Z coordinates of the + // module center (X markes the spot in the sketch below). + // The CRT modules are perfect square with 8 bars per side. + // The fixed coordinate (e.g. Y for Top CRT Horizontal) is returned from geometry. + // The transverce coordinate is returned from the average position of P1 and P2 + // the average position of P1 and P3. + // The transformed CRT Hits are in cm. + // + // --------------------------------------------------------- + // | | | | | | | | | + // | | | | | | | | | + // | | | | | | | | | + // --------------------------------------------------------- + // | | | | | | | | | + // | | | | | | | | | + // | | | | | | | | | + // --------------------------------------------------------- + // | | | | | | | | | + // | | | | | | | | | + // | | | | | | | | | + // --------------------------------------------------------- + // | | | | | | | | | + // | | | | P1 | P2 | | | | + // | | | | | | | | | + // --------------------------- X --------------------------- + // | | | | | | | | | + // | | | | P3 | | | | | + // | | | | | | | | | + // --------------------------------------------------------- + // | | | | | | | | | + // | | | | | | | | | + // | | | | | | | | | + // --------------------------------------------------------- + // | | | | | | | | | + // | | | | | | | | | + // | | | | | | | | | + // --------------------------------------------------------- + // | | | | | | | | | + // | | | | | | | | | + // | | | | | | | | | + // --------------------------------------------------------- + // + TopCRTCenters = {{108, { -460.975, 617.388,-1050.61}}, + {109, { -460.975,617.388,-866.215}}, + {110, { -460.975,617.388,-681.825}}, + {111, { -460.975,617.388,-497.435}}, + {112, { -460.975,617.388,-313.045}}, + {113, { -460.975,617.388,-128.655}}, + {114, { -460.975,617.388,55.735}}, + {115, { -460.975,617.388,240.125}}, + {116, { -460.975,617.388,424.515}}, + {117, { -460.975,617.388,608.905}}, + {118, { -460.975,617.388,793.295}}, + {119, { -460.975,617.388,977.685}}, + {120, { -460.975,617.388,1162.07}}, + {121, { -460.975,617.388,1346.46}}, + {122, { -276.585,617.388,-1050.61}}, + {123, { -276.585,617.388,-866.215}}, + {124, { -276.585,617.388,-681.825}}, + {125, { -276.585,617.388,-497.435}}, + {126, { -276.585,617.388,-313.045}}, + {127, { -276.585,617.388,-128.655}}, + {128, { -276.585,617.388, 55.735}}, + {129, { -276.585,617.388, 240.125}}, + {130, { -276.585,617.388, 424.515}}, + {131, { -276.585,617.388, 608.905}}, + {132, { -276.585,617.388, 793.295}}, + {133, { -276.585,617.388, 977.685}}, + {134, { -276.585,617.388, 1162.07}}, + {135, { -276.585,617.388, 1346.46}}, + {136, { -92.195 ,617.388,-1050.61}}, + {137, { -92.195 ,617.388,-866.215}}, + {138, { -92.195 ,617.388,-681.825}}, + {139, { -92.195 ,617.388,-497.435}}, + {140, { -92.195 ,617.388,-313.045}}, + {141, { -92.195 ,617.388,-128.655}}, + {142, { -92.195 ,617.388, 55.735}}, + {143, { -92.195 ,617.388, 240.125}}, + {144, { -92.195 ,617.388, 424.515}}, + {145, { -92.195 ,617.388, 608.905}}, + {146, { -92.195 ,617.388, 793.295}}, + {147, { -92.195 ,617.388, 977.685}}, + {148, { -92.195 ,617.388, 1162.07}}, + {149, { -92.195 ,617.388, 1346.46}}, + {150, { 92.195 , 617.388, -1050.61}}, + {151, { 92.195 , 617.388, -866.215}}, + {152, { 92.195 , 617.388, -681.825}}, + {153, { 92.195 , 617.388, -497.435}}, + {154, { 92.195 , 617.388, -313.045}}, + {155, { 92.195 , 617.388, -128.655}}, + {156, { 92.195 ,617.388, 55.735}}, + {157, { 92.195 ,617.388, 240.125}}, + {158, { 92.195 ,617.388, 424.515}}, + {159, { 92.195 ,617.388, 608.905}}, + {160, { 92.195 ,617.388, 793.295}}, + {161, { 92.195 ,617.388, 977.685}}, + {162, { 92.195 ,617.388, 1162.07}}, + {163, { 92.195 ,617.388, 1346.46}}, + {164, { 276.585,617.388, -1050.61}}, + {165, { 276.585,617.388, -866.215}}, + {166, { 276.585,617.388, -681.825}}, + {167, { 276.585,617.388, -497.435}}, + {168, { 276.585,617.388, -313.045}}, + {169, { 276.585,617.388, -128.655}}, + {170, { 276.585,617.388, 55.735}}, + {171, { 276.585,617.388, 240.125}}, + {172, { 276.585,617.388, 424.515}}, + {173, { 276.585,617.388, 608.905}}, + {174, { 276.585,617.388, 793.295}}, + {175, { 276.585,617.388, 977.685}}, + {176, { 276.585,617.388, 1162.07}}, + {177, { 276.585,617.388, 1346.46}}, + {178, { 460.975,617.388, -1050.61}}, + {179, { 460.975,617.388, -866.215}}, + {180, { 460.975,617.388, -681.825}}, + {181, { 460.975,617.388, -497.435}}, + {182, { 460.975,617.388, -313.045}}, + {183, { 460.975,617.388, -128.655}}, + {184, { 460.975,617.388, 55.735}}, + {185, { 460.975,617.388, 240.125}}, + {186, { 460.975,617.388, 424.515}}, + {187, { 460.975,617.388, 608.905}}, + {188, { 460.975,617.388, 793.295}}, + {189, { 460.975,617.388, 977.685}}, + {190, { 460.975,617.388, 1162.07}}, + {191, { 460.975,617.388, 1346.46}}, + {192, { 555.265, 496.038, -1050.61}}, + {193, { 555.265, 496.038, -866.215}}, + {194, { 555.265, 496.038, -681.825}}, + {195, { 555.265, 496.038, -497.435}}, + {196, { 555.265, 496.038, -313.045}}, + {197, { 555.265, 496.038, -128.655}}, + {198, { 555.265, 496.038, 55.735}}, + {199, { 555.265, 496.038, 240.125}}, + {200, { 555.265, 496.038, 424.515}}, + {201, { 555.265, 496.038, 608.905}}, + {202, { 555.265, 496.038, 793.295}}, + {203, { 555.265, 496.038, 977.685}}, + {204, { 555.265, 496.038, 1162.07}}, + {205, { 555.265, 496.038, 1346.46}}, + {206, { -555.265, 496.038, -1050.61}}, + {207, { -555.265, 496.038, -866.215}}, + {208, { -555.265, 496.038, -681.825}}, + {209, { -555.265, 496.038, -497.435}}, + {210, { -555.265, 496.038, -313.045}}, + {211, { -555.265, 496.038, -128.655}}, + {212, { -555.265, 496.038, 55.735}}, + {213, { -555.265, 496.038, 240.125}}, + {214, { -555.265, 496.038, 424.515}}, + {215, { -555.265, 496.038, 608.905}}, + {216, { -555.265, 496.038, 793.295}}, + {217, { -555.265, 496.038, 977.685}}, + {218, { -555.265, 496.038, 1162.07}}, + {219, { -555.265, 496.038, 1346.46}}, + {220, { -460.975, 496.038, -1143.4}}, + {221, { -276.585, 496.038, -1143.4}}, + {222, { -92.195, 496.038, -1143.4}}, + {223, { 92.195, 496.038, -1143.4}}, + {224, { 276.585, 496.038, -1143.4}}, + // This module does not exist in reality, but exists in simulation + {225, { 0, 0, 0}}, + {226, { -460.975, 525.038, 1533.608}}, + {227, { -276.585, 525.038, 1533.608}}, + {228, { -92.195, 525.038, 1533.608}}, + {229, { 92.195, 525.038, 1533.608}}, + {230, { 276.585, 525.038, 1533.608}}, + {231, { 460.975, 525.038, 1533.608}}}; + return TopCRTCenters; +} + +TransformedCRTHit AffineTransformation(double DX, double DZ,AffineTrans affine) +{ + double CRTX=affine.B1+DZ*affine.A12+DX*affine.A11; + double CRTZ=affine.B2+DZ*affine.A22+DX*affine.A21; + return std::make_pair(CRTX, CRTZ); +} + +TopCRTTransformations LoadTopCRTTransformations() +{ + std::string fullFileName; + cet::search_path searchPath("FW_SEARCH_PATH"); + searchPath.find_file("TopCrtCorrectionByTPC.txt", fullFileName); + /*if (!searchPath.find_file("TopCrtCorrectionByTPC.txt", fullFileName)) { + mf::LogError("CRTMatchingUtils_LoadTopCrtTransformation") + << "Top CRT Correction transformation file not found in FW_SEARCH_PATH."; + }*/ + std::ifstream corrFile(fullFileName, std::ios::in); + std::map Type0Corr; + std::map Type1Corr; + std::map Type2Corr; + std::map Type3Corr; + std::map Type4Corr; + std::map Type5Corr; + if (!corrFile.is_open()) { + mf::LogError("CRTRecoUtils_LoadTopCRTTransformation") + << "Failed to open Top CRT Correction transformation file: " << fullFileName; + } + std::string line; + while (std::getline(corrFile, line)) { + std::istringstream iss(line); + std::vector variables; + double var; + while (iss >> var) { + variables.push_back(var); + } + int pos=0; + AffineTrans Type0 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; + pos=pos+8; + AffineTrans Type1 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; + pos=pos+8; + AffineTrans Type2 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; + pos=pos+8; + AffineTrans Type3 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; + pos=pos+8; + AffineTrans Type4 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; + pos=pos+8; + AffineTrans Type5 = {variables.at(1+pos),variables.at(2+pos),variables.at(3+pos),variables.at(4+pos),variables.at(5+pos),variables.at(6+pos), variables.at(7+pos),variables.at(8+pos)}; + Type0Corr.insert({variables.at(0), Type0}); + Type1Corr.insert({variables.at(0), Type1}); + Type2Corr.insert({variables.at(0), Type2}); + Type3Corr.insert({variables.at(0), Type3}); + Type4Corr.insert({variables.at(0), Type4}); + Type5Corr.insert({variables.at(0), Type5}); + } + TopCRTTransformations LoadedTransformations={Type2Corr, Type1Corr, Type0Corr, Type4Corr, Type5Corr, Type3Corr}; + return LoadedTransformations; +} + +} + int RecoUtils::TrueParticleID(detinfo::DetectorClocksData const& clockData, const art::Ptr hit, bool rollup_unsaved_ids) { std::map id_to_energy_map; @@ -203,4 +441,4 @@ double RecoUtils::CalculateTrackLength(const art::Ptr track){ length+=(next_point-this_point).Mag(); } return length; -} +} \ No newline at end of file diff --git a/icaruscode/CRT/CRTUtils/RecoUtils.h b/icaruscode/CRT/CRTUtils/RecoUtils.h index 21ec3f254..e575f0fd9 100644 --- a/icaruscode/CRT/CRTUtils/RecoUtils.h +++ b/icaruscode/CRT/CRTUtils/RecoUtils.h @@ -43,42 +43,94 @@ namespace detinfo { class DetectorClocksData; } #include "TTree.h" +namespace icarus::crt::dataTools{ + +struct ModuleCenter +{ + double X; + double Y; + double Z; +}; + +struct AffineTrans +{ + double A11; + double A12; + double A21; + double A22; + double B1; + double B2; + double Accuracy; + double N; +}; + +using FebIndex_t = int; + +using TopCRTCorrectionMap = std::map; + +struct TopCRTTransformations +{ + TopCRTCorrectionMap EE; + TopCRTCorrectionMap EW; + TopCRTCorrectionMap EastCC; + TopCRTCorrectionMap WE; + TopCRTCorrectionMap WW; + TopCRTCorrectionMap WestCC; +}; + +using TopCRTCentersMap = std::map; + +/// The transformed CRT Hits are in cm +using TransformedCRTHit = std::pair; + +/// This function loads the Top CRT modules centers. +TopCRTCentersMap LoadTopCRTCenters(); + +/// This function performs the affine transformation of the CRT hit points. +/// The AffineTransformation requires input variables in cm. +TransformedCRTHit AffineTransformation(double DX, double DZ, AffineTrans affine); + +/// This functions loads the Affine Transformation TXT files. +TopCRTTransformations LoadTopCRTTransformations(); + +} + namespace RecoUtils{ - // Returns the geant4 ID which contributes the most to a single reco hit. - // The matching method looks for true particle which deposits the most true energy in the reco hit. - // If rollup_unsaved_ids is set to true, any unsaved daughter than - // contributed energy to the hit has its energy included in its closest ancestor that was saved. +// Returns the geant4 ID which contributes the most to a single reco hit. +// The matching method looks for true particle which deposits the most true energy in the reco hit. +// If rollup_unsaved_ids is set to true, any unsaved daughter than +// contributed energy to the hit has its energy included in its closest ancestor that was saved. - int TrueParticleID(detinfo::DetectorClocksData const& clockData, const art::Ptr hit, bool rollup_unsaved_ids=1); +int TrueParticleID(detinfo::DetectorClocksData const& clockData, const art::Ptr hit, bool rollup_unsaved_ids=1); - // Returns the geant4 ID which contributes the most to the vector of hits. - // The matching method looks for which true particle deposits the most true energy in the reco hits +// Returns the geant4 ID which contributes the most to the vector of hits. +// The matching method looks for which true particle deposits the most true energy in the reco hits - int TrueParticleIDFromTotalTrueEnergy(detinfo::DetectorClocksData const& clockData, const std::vector >& hits, bool rollup_unsaved_ids=1); +int TrueParticleIDFromTotalTrueEnergy(detinfo::DetectorClocksData const& clockData, const std::vector >& hits, bool rollup_unsaved_ids=1); - // Returns the geant4 ID which contributes the most to the vector of hits. - // The matching method looks for which true particle contributes the most reconstructed charge to the hit selection - // (the reco charge of each hit is correlated with each maximally contributing true particle and summed) +// Returns the geant4 ID which contributes the most to the vector of hits. +// The matching method looks for which true particle contributes the most reconstructed charge to the hit selection +// (the reco charge of each hit is correlated with each maximally contributing true particle and summed) - int TrueParticleIDFromTotalRecoCharge(detinfo::DetectorClocksData const& clockData, const std::vector >& hits, bool rollup_unsaved_ids=1); +int TrueParticleIDFromTotalRecoCharge(detinfo::DetectorClocksData const& clockData, const std::vector >& hits, bool rollup_unsaved_ids=1); - // Returns the geant4 ID which contributes the most to the vector of hits. - // The matching method looks for which true particle maximally contributes to the most reco hits +// Returns the geant4 ID which contributes the most to the vector of hits. +// The matching method looks for which true particle maximally contributes to the most reco hits - int TrueParticleIDFromTotalRecoHits(detinfo::DetectorClocksData const& clockData, const std::vector >& hits, bool rollup_unsaved_ids=1); +int TrueParticleIDFromTotalRecoHits(detinfo::DetectorClocksData const& clockData, const std::vector >& hits, bool rollup_unsaved_ids=1); - // Checks if a position is within any of the TPCs in the geometry (user can define some distance buffer from the TPC walls) +// Checks if a position is within any of the TPCs in the geometry (user can define some distance buffer from the TPC walls) - bool IsInsideTPC(TVector3 position, double distance_buffer); +bool IsInsideTPC(TVector3 position, double distance_buffer); - // Calculates the total length of a recob::track by summing up the distances between adjacent traj. points +// Calculates the total length of a recob::track by summing up the distances between adjacent traj. points - double CalculateTrackLength(const art::Ptr track); +double CalculateTrackLength(const art::Ptr track); - std::map>> PrepSimChannels(const std::vector> &simchannels, const geo::GeometryCore &geo); +std::map>> PrepSimChannels(const std::vector> &simchannels, const geo::GeometryCore &geo); - std::map>> buildTrackIDtoHitsMap(const std::vector> &allHits, const detinfo::DetectorClocksData &clockData, const cheat::BackTrackerService &backtracker); +std::map>> buildTrackIDtoHitsMap(const std::vector> &allHits, const detinfo::DetectorClocksData &clockData, const cheat::BackTrackerService &backtracker); } #endif From 8d16d4fa2cc1878dfd2e7d88f9588648bf9f64ab Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Thu, 16 Jan 2025 14:03:33 +0100 Subject: [PATCH 20/28] This Commit includes the final changes requested from Gianluca. Only few things are left to deal with: icarus_data and addressing legacy code. --- icaruscode/CRT/CMakeLists.txt | 46 +- icaruscode/CRT/CRTT0MatchingAna_module.cc | 500 ------------------ icaruscode/CRT/CRTT0Matching_module.cc | 404 -------------- icaruscode/CRT/CRTT0Tagging_module.cc | 161 ++---- icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx | 31 +- icaruscode/CRT/CRTUtils/CRTMatchingUtils.h | 15 +- icaruscode/CRT/CRTUtils/RecoUtils.cc | 30 ++ icaruscode/CRT/CRTUtils/RecoUtils.h | 11 +- .../CRT/CRTUtils/crtmatchingalg_icarus.fcl | 33 +- icaruscode/CRT/crtt0matching_icarus.fcl | 90 ---- icaruscode/CRT/crtt0producer_icarus.fcl | 33 -- icaruscode/CRT/crtt0tagging.fcl | 26 +- icaruscode/CRT/crtt0tagging_icarus.fcl | 46 +- icaruscode/CRT/crtt0taggingmc_icarus.fcl | 40 +- 14 files changed, 141 insertions(+), 1325 deletions(-) delete mode 100644 icaruscode/CRT/CRTT0MatchingAna_module.cc delete mode 100644 icaruscode/CRT/CRTT0Matching_module.cc delete mode 100644 icaruscode/CRT/crtt0matching_icarus.fcl delete mode 100644 icaruscode/CRT/crtt0producer_icarus.fcl diff --git a/icaruscode/CRT/CMakeLists.txt b/icaruscode/CRT/CMakeLists.txt index b543402e2..5f20fd7aa 100644 --- a/icaruscode/CRT/CMakeLists.txt +++ b/icaruscode/CRT/CMakeLists.txt @@ -67,15 +67,17 @@ art_make_library( SOURCE CRTUtils/CRTMatchingUtils.cxx LIBRARIES - fhiclcpp::fhiclcpp - canvas::canvas - lardataobj::RecoBase - larcorealg::Geometry - lardataalg::DetectorInfo - sbnobj::Common_CRT - cetlib::cetlib - messagefacility::MF_MessageLogger - ROOT::Matrix + fhiclcpp::fhiclcpp + canvas::canvas + lardataobj::RecoBase + lardata::Utilities + lardata::ArtDataHelper + larcorealg::Geometry + lardataalg::DetectorInfo + sbnobj::Common_CRT + cetlib::cetlib + messagefacility::MF_MessageLogger + ROOT::Matrix ) cet_build_plugin(CRTGeometryHelper art::service @@ -537,34 +539,22 @@ cet_build_plugin(CRTT0Tagging art::module LIBRARIES icaruscode::IcarusObj icaruscode_CRTMatchingUtils - sbnobj::ICARUS_CRT - sbnobj::Common_CRT icaruscode_CRTUtils + sbnobj::Common_CRT larcorealg::Geometry + lardataalg::DetectorInfo larcore::Geometry_Geometry_service larsim::Simulation lardataobj::Simulation larsim::MCCheater_BackTrackerService_service larsim::MCCheater_ParticleInventoryService_service - lardata::Utilities - larevt::Filters - lardataobj::RawData + lardata::headers lardataobj::RecoBase lardataobj::AnalysisBase - lardata::RecoObjects - larpandora::LArPandoraInterface - larcorealg::Geometry nusimdata::SimulationBase - art::Persistency_Common canvas::canvas - art::Persistency_Provenance - art::Utilities - ROOT::Core - ROOT::Geom - ROOT::XMLIO - ROOT::Gdml - ROOT::Spectrum - ROOT::RooFit - ROOT::RooFitCore - ) + art_root_io::TFileService_service + art_root_io::tfile_support + ROOT::Tree +) install_headers() install_fhicl() diff --git a/icaruscode/CRT/CRTT0MatchingAna_module.cc b/icaruscode/CRT/CRTT0MatchingAna_module.cc deleted file mode 100644 index 24fc11497..000000000 --- a/icaruscode/CRT/CRTT0MatchingAna_module.cc +++ /dev/null @@ -1,500 +0,0 @@ -//////////////////////////////////////////////////////////////////////// -// Class: CRTT0MatchingAna -// Module Type: analyzer -// File: CRTT0MatchingAna_module.cc -// -// Tom Brooks (tbrooks@fnal.gov) -//////////////////////////////////////////////////////////////////////// - -// icaruscode includes -#include "icaruscode/CRT/CRTUtils/RecoUtils.h" -#include "sbnobj/Common/CRT/CRTHit.hh" -#include "icaruscode/CRT/CRTUtils/CRTT0MatchAlg.h" -#include "icaruscode/CRT/CRTUtils/CRTBackTracker.h" -#include "icaruscode/CRT/CRTUtils/CRTCommonUtils.h" -//#include "sbndcode/Geometry/GeometryWrappers/CRTGeoAlg.h" -//#include "sbndcode/Geometry/GeometryWrappers/TPCGeoAlg.h" - -// LArSoft includes -#include "lardataobj/Simulation/SimChannel.h" -#include "lardataobj/RecoBase/Hit.h" -#include "lardataobj/RecoBase/Track.h" -#include "larcore/CoreUtils/ServiceUtil.h" // lar::providerFrom() -#include "lardata/DetectorInfoServices/DetectorClocksService.h" -#include "lardata/DetectorInfoServices/DetectorPropertiesService.h" -#include "larcoreobj/SimpleTypesAndConstants/geo_types.h" -#include "nusimdata/SimulationBase/MCParticle.h" -#include "larcorealg/CoreUtils/NumericUtils.h" // util::absDiff() - -// Framework includes -#include "art/Framework/Core/EDAnalyzer.h" -#include "art/Framework/Principal/Event.h" -#include "art/Framework/Principal/Handle.h" -#include "art/Framework/Services/Registry/ServiceHandle.h" -#include "art_root_io/TFileService.h" -#include "art/Framework/Core/ModuleMacros.h" -#include "canvas/Persistency/Common/FindManyP.h" -#include "canvas/Utilities/Exception.h" -#include "larsim/MCCheater/BackTrackerService.h" -#include "larsim/MCCheater/ParticleInventoryService.h" -#include "sbnobj/Common/Trigger/ExtraTriggerInfo.h" - -// Utility libraries -#include "messagefacility/MessageLogger/MessageLogger.h" -#include "fhiclcpp/ParameterSet.h" -#include "fhiclcpp/types/Table.h" -#include "fhiclcpp/types/Atom.h" -#include "cetlib/pow.h" // cet::sum_of_squares() - -// ROOT includes. Note: To look up the properties of the ROOT classes, -// use the ROOT web site; e.g., -// -#include "TH1.h" -#include "TH2.h" -#include "TVector3.h" - -// C++ includes -#include -#include -#include - -namespace icarus { - - class CRTT0MatchingAna : public art::EDAnalyzer { - public: - - explicit CRTT0MatchingAna(fhicl::ParameterSet const& p); - - // Called once, at start of the job - virtual void beginJob() override; - - // Called once per event - virtual void analyze(const art::Event& event) override; - - // Called once, at end of the job - virtual void endJob() override; - - // Calculate the distance from the track crossing point to CRT overlap coordinates - double DistToCrtHit(TVector3 trackPos, sbn::crt::CRTHit crtHit); - - void reconfigure(fhicl::ParameterSet const & p); - - private: - - // fcl file parameters - art::InputTag fSimModuleLabel;///< name of detsim producer - art::InputTag fCRTHitLabel; ///< name of CRT producer - std::vector fTPCTrackLabel; ///< name of CRT producer - art::InputTag fTriggerLabel; ///< labels for trigger - bool fVerbose; ///< print information about what's going on - - CRTT0MatchAlg t0Alg; - - // CRTGeoAlg fCrtGeo; - //TPCGeoAlg fTpcGeo; - - geo::GeometryCore const* fGeometryService; ///< pointer to Geometry provider - icarus::crt::CRTCommonUtils* fCrtutils; - //CRTBackTracker fCrtBackTrack; - icarus::crt::CRTBackTracker bt; - // Histograms - std::map hDCA; - std::map hMatchDCA; - std::map hNoMatchDCA; - - std::map hDoL; - std::map hMatchDoL; - std::map hNoMatchDoL; - - std::map hT0; - std::map hMatchT0; - std::map hNoMatchT0; - - std::map hEffDCATotal; - std::map hEffDCAReco; - std::map hEffDoLTotal; - std::map hEffDoLReco; - std::map hEffLengthTotal; - std::map hEffLengthReco; - - std::map hPurityDCATotal; - std::map hPurityDCAReco; - std::map hPurityDoLTotal; - std::map hPurityDoLReco; - std::map hPurityLengthTotal; - std::map hPurityLengthReco; - - //add trigger data product vars - unsigned int m_gate_type; - std::string m_gate_name; - uint64_t m_trigger_timestamp; - uint64_t m_gate_start_timestamp; - uint64_t m_trigger_gate_diff; - uint64_t m_gate_crt_diff; - }; // class CRTT0MatchingAna - - - CRTT0MatchingAna::CRTT0MatchingAna(fhicl::ParameterSet const& p) - : EDAnalyzer{p} // , - , t0Alg(p.get("t0Alg")) - , fCrtutils(new icarus::crt::CRTCommonUtils()) - , bt(p.get("CRTBackTrack")) - // More initializers here. - { - // Call appropriate consumes<>() for any products to be retrieved by this module. - fGeometryService = lar::providerFrom(); - reconfigure(p); - } - - - // Constructor - void CRTT0MatchingAna::reconfigure(fhicl::ParameterSet const& p) - { - - fSimModuleLabel = p.get ("SimModuleLabel", "largeant"); - fCRTHitLabel = p.get ("CRTHitLabel", "crthit"); - fTPCTrackLabel = p.get< std::vector >("TPCTrackLabel", {""}); - fTriggerLabel = p.get("TriggerLabel","daqTrigger"); - fVerbose = p.get("Verbose"); - } //CRTT0MatchingAna() - - - void CRTT0MatchingAna::beginJob() - { - - // Access tfileservice to handle creating and writing histograms - art::ServiceHandle tfs; - for(int i = 30; i < 50 + 1; i++){ - std::string tagger = "All"; - if (i > 34 && i < 40) continue; - if (i==48 || i==49) continue; - // if(i < ){ - tagger = fCrtutils->GetRegionNameFromNum(i);//fCrtGeo.GetTagger(i).name; - std::cout << "tagger: " << tagger.c_str() << std::endl; - hDCA[tagger] = tfs->make(Form("DCA_%s", tagger.c_str()), "", 50, 0, 100); - hMatchDCA[tagger] = tfs->make(Form("MatchDCA_%s", tagger.c_str()), "", 50, 0, 100); - hNoMatchDCA[tagger] = tfs->make(Form("NoMatchDCA_%s", tagger.c_str()), "", 50, 0, 100); - - hDoL[tagger] = tfs->make(Form("DoL_%s", tagger.c_str()), "", 100, 0, 0.25); - hMatchDoL[tagger] = tfs->make(Form("MatchDoL_%s", tagger.c_str()), "", 100, 0, 0.25); - hNoMatchDoL[tagger] = tfs->make(Form("NoMatchDoL_%s", tagger.c_str()), "", 100, 0, 0.25); - - hT0[tagger] = tfs->make(Form("T0_%s", tagger.c_str()), "", 600, -3000, 3000); - hMatchT0[tagger] = tfs->make(Form("MatchT0_%s", tagger.c_str()), "", 600, -3000, 3000); - hNoMatchT0[tagger] = tfs->make(Form("NoMatchT0_%s", tagger.c_str()), "", 600, -3000, 3000); - - hEffDCATotal[tagger] = tfs->make(Form("EffDCATotal_%s", tagger.c_str()), "", 50, 0, 100); - hEffDCAReco[tagger] = tfs->make(Form("EffDCAReco_%s", tagger.c_str()), "", 50, 0, 100); - hEffDoLTotal[tagger] = tfs->make(Form("EffDoLTotal_%s", tagger.c_str()), "", 100, 0, 0.25); - hEffDoLReco[tagger] = tfs->make(Form("EffDoLReco_%s", tagger.c_str()), "", 100, 0, 0.25); - hEffLengthTotal[tagger] = tfs->make(Form("EffLengthTotal_%s", tagger.c_str()), "", 20, 0, 600); - hEffLengthReco[tagger] = tfs->make(Form("EffLengthReco_%s", tagger.c_str()), "", 20, 0, 600); - - hPurityDCATotal[tagger] = tfs->make(Form("PurityDCATotal_%s", tagger.c_str()), "", 50, 0, 100); - hPurityDCAReco[tagger] = tfs->make(Form("PurityDCAReco_%s", tagger.c_str()), "", 50, 0, 100); - hPurityDoLTotal[tagger] = tfs->make(Form("PurityDoLTotal_%s", tagger.c_str()), "", 100, 0, 0.25); - hPurityDoLReco[tagger] = tfs->make(Form("PurityDoLReco_%s", tagger.c_str()), "", 100, 0, 0.25); - hPurityLengthTotal[tagger] = tfs->make(Form("PurityLengthTotal_%s", tagger.c_str()), "", 20, 0, 600); - hPurityLengthReco[tagger] = tfs->make(Form("PurityLengthReco_%s", tagger.c_str()), "", 20, 0, 600); - } - - // Initial output - if(fVerbose) std::cout<<"----------------- CRT T0 Matching Ana Module -------------------"< trigger_handle; - event.getByLabel( fTriggerLabel, trigger_handle ); - if( trigger_handle.isValid() ) { - sbn::triggerSource bit = trigger_handle->sourceType; - m_gate_type = (unsigned int)bit; - m_gate_name = bitName(bit); - m_trigger_timestamp = trigger_handle->triggerTimestamp; - m_gate_start_timestamp = trigger_handle->beamGateTimestamp; - m_trigger_gate_diff = trigger_handle->triggerTimestamp - trigger_handle->beamGateTimestamp; - - } - else{ - mf::LogError("CRTT0MatchingAna:") << "No raw::Trigger associated to label: " << fTriggerLabel.label() << "\n" ; - } - } - else { - mf::LogError("CRTT0MatchingAna:") << "Trigger Data product " << fTriggerLabel.label() << " not found!\n" ; - } - - // Get g4 particles - art::ServiceHandle pi_serv; - auto particleHandle = event.getValidHandle>(fSimModuleLabel); - - // Get CRT hits from the event - art::Handle< std::vector> crtHitHandle; - std::vector > crtHitList; - if (event.getByLabel(fCRTHitLabel, crtHitHandle)) - art::fill_ptr_vector(crtHitList, crtHitHandle); - - // Get reconstructed tracks from the event - //auto tpcTrackHandle = event.getValidHandle>(fTPCTrackLabel); - // art::FindManyP findManyHits(tpcTrackHandle, event, fTPCTrackLabel); - - // fCrtBackTrack.Initialize(event); - - //---------------------------------------------------------------------------------------------------------- - // TRUTH MATCHING - //---------------------------------------------------------------------------------------------------------- - - std::map particles; - // Loop over the true particles - for (auto const& particle: (*particleHandle)){ - - // Make map with ID - int partID = particle.TrackId(); - particles[partID] = particle; - - } - - if(fVerbose) std::cout<<"----------------- truth matching -------------------"<> crtTaggerMap; - std::vector crtHits; - int hit_i = 0; - double minHitTime = 99999; - double maxHitTime = -99999; - - for(auto const& hit : (*crtHitHandle)){ - double hitTime = double(hit.ts0_ns - (m_gate_start_timestamp%1'000'000'000))/1e3; - if(hitTime<-0.5e6) hitTime+=1e6; - else if(hitTime>0.5e6) hitTime-=1e6; - - // double hitTime = (double)(int)hit.ts1_ns * 1e-3; - if(hitTime < minHitTime) minHitTime = hitTime; - if(hitTime > maxHitTime) maxHitTime = hitTime; - - crtHits.push_back(hit); - int trueId = bt.TrueIdFromHitId(event, hit_i); - hit_i++; - if(trueId == -99999) continue; - if(crtTaggerMap.find(trueId) == crtTaggerMap.end()){ - crtTaggerMap[trueId].push_back(hit.tagger); - } - else if(std::find(crtTaggerMap[trueId].begin(), crtTaggerMap[trueId].end(), hit.tagger) == crtTaggerMap[trueId].end()){ - crtTaggerMap[trueId].push_back(hit.tagger); - } - } - - // std::cout << " New event" << std::endl; - //---------------------------------------------------------------------------------------------------------- - // DISTANCE OF CLOSEST APPROACH ANALYSIS - //---------------------------------------------------------------------------------------------------------- - - auto const clockData = art::ServiceHandle()->DataFor(event); - auto const detProp = art::ServiceHandle()->DataFor(event, clockData); - - // if(fVerbose) std::cout<<"----------------- DCA Analysis -------------------"<>(trackLabel); - if (!tpcTrackHandle.isValid()) continue; - - art::FindManyP findManyHits(tpcTrackHandle, event, trackLabel); - - // Loop over reconstructed tracks - for (auto const& tpcTrack : (*tpcTrackHandle)){ - // std::cout<<"----------------- why only 4 times -------------------" <> hits = findManyHits.at(tpcTrack.ID()); - int trackTrueID = RecoUtils::TrueParticleIDFromTotalRecoHits(clockData, hits, false); - if(particles.find(trackTrueID) == particles.end()) continue; - // Only consider primary muons - if(!(std::abs(particles[trackTrueID].PdgCode()) == 13 && particles[trackTrueID].Mother() == 0)) continue; - - // Only consider particles inside the reco hit time window - double trueTime = particles[trackTrueID].T() * 1e-3; - if(trueTime < minHitTime || trueTime > maxHitTime) continue; - //if(fVerbose) std::cout<<"----------------- line 315 -------------------"< closestvec = t0Alg.GetClosestCRTHit(detProp, tpcTrack, crtHits, event); - //matchCand closest = closestvec.back(); - //std::cout << "closest match " << closest.t0 << std::endl; - //std::cout << "closest dca " << closest.dca << " ,tagger: "<< closest.thishit.tagger << " , sin angele: \t" << closest.dca/closest.extrapLen << std::endl; - double sin_angle = -99999; - if(closest.dca != DBL_MIN){ - hDCA[closest.thishit.tagger]->Fill(closest.dca); - //hDCA["All"]->Fill(closest.dca); - sin_angle = closest.dca/closest.extrapLen; - hDoL[closest.thishit.tagger]->Fill(sin_angle); - // hDoL["All"]->Fill(sin_angle); - hT0[closest.thishit.tagger]->Fill(closest.t0); - //hT0["All"]->Fill(closest.t0); - //std::cout<< "tagger: "<< closest.thishit.tagger << " , sin angele: \t" << sin_angle << std::endl; - - // Is hit matched to that track - int hitTrueID = bt.TrueIdFromTotalEnergy(event, closest.thishit); - if(hitTrueID == trackTrueID && hitTrueID != -99999){ - hMatchDCA[closest.thishit.tagger]->Fill(closest.dca); - //hMatchDCA["All"]->Fill(closest.dca); - hMatchDoL[closest.thishit.tagger]->Fill(sin_angle); - //hMatchDoL["All"]->Fill(sin_angle); - hMatchT0[closest.thishit.tagger]->Fill(closest.t0); - //hMatchT0["All"]->Fill(closest.t0); - } - else{ - hNoMatchDCA[closest.thishit.tagger]->Fill(closest.dca); - //hNoMatchDCA["All"]->Fill(closest.dca); - hNoMatchDoL[closest.thishit.tagger]->Fill(sin_angle); - // hNoMatchDoL["All"]->Fill(sin_angle); - hNoMatchT0[closest.thishit.tagger]->Fill(closest.t0); - // hNoMatchT0["All"]->Fill(closest.t0); - } - //std::cout<< "---------> 2nd line tagger: "<< closest.thishit.tagger << " , sin angele: \t" << sin_angle << std::endl; - }else continue; - //if(fVerbose) std::cout<<"----------------- line 350 -------------------"<second->GetNbinsX(); - for(int i = 0; i < nbins; i++){ - double DCAcut = hEffDCATotal.begin()->second->GetBinCenter(i); - - // Fill total efficiency histogram with each cut if track matches any hits - if(crtTaggerMap.find(trackTrueID) != crtTaggerMap.end()){ - for(auto const& tagger : crtTaggerMap[trackTrueID]){ - hEffDCATotal[tagger]->Fill(DCAcut); - - // If closest hit is below limit and track matches any hits then fill efficiency - if(closest.dca < DCAcut && closest.dca != DBL_MIN){ - hEffDCAReco[tagger]->Fill(DCAcut); - } - } - // Fill total efficiency histograms - // hEffDCATotal["All"]->Fill(DCAcut); - if(closest.dca < DCAcut && closest.dca != DBL_MIN){ - // hEffDCAReco["All"]->Fill(DCAcut); - } - } - - // Fill total purity histogram with each cut if closest hit is below limit - if(closest.dca < DCAcut && closest.dca != DBL_MIN){ - hPurityDCATotal[closest.thishit.tagger]->Fill(DCAcut); - // hPurityDCATotal["All"]->Fill(DCAcut); - - // If closest hit is below limit and matched time is correct then fill purity - double hitTime = closest.thishit.ts1_ns * 1e-3; - if(particles.find(trackTrueID) != particles.end()){ - if(std::abs(hitTime - trueTime) < 2.){ - hPurityDCAReco[closest.thishit.tagger]->Fill(DCAcut); - // hPurityDCAReco["All"]->Fill(DCAcut); - } - } - - } - } - - nbins = hEffDoLTotal.begin()->second->GetNbinsX(); - //if(fVerbose) std::cout<<"----------------- line 390 -------------------"<second->GetBinCenter(i); - - // Fill total efficiency histogram with each cut if track matches any hits - if(crtTaggerMap.find(trackTrueID) != crtTaggerMap.end()){ - for(auto const& tagger : crtTaggerMap[trackTrueID]){ - hEffDoLTotal[tagger]->Fill(DCAcut); - - // If closest hit is below limit and track matches any hits then fill efficiency - if(sin_angle < DCAcut && closest.dca != DBL_MIN){ - hEffDoLReco[tagger]->Fill(DCAcut); - } - } - // Fill total efficiency histograms - // hEffDoLTotal["All"]->Fill(DCAcut); - if(sin_angle < DCAcut && closest.dca != DBL_MIN){ - // hEffDoLReco["All"]->Fill(DCAcut); - } - } - - // Fill total purity histogram with each cut if closest hit is below limit - if(sin_angle < DCAcut && closest.dca != DBL_MIN){ - hPurityDoLTotal[closest.thishit.tagger]->Fill(DCAcut); - // hPurityDoLTotal["All"]->Fill(DCAcut); - - // If closest hit is below limit and matched time is correct then fill purity - double hitTime = closest.thishit.ts1_ns * 1e-3; - if(particles.find(trackTrueID) != particles.end()){ - if(std::abs(hitTime - trueTime) < 2.){ - hPurityDoLReco[closest.thishit.tagger]->Fill(DCAcut); - // hPurityDoLReco["All"]->Fill(DCAcut); - } - } - - } - } - - double fixedCut = 30.; - - // Fill total efficiency histogram with each cut if track matches any hits - if(crtTaggerMap.find(trackTrueID) != crtTaggerMap.end()){ - for(auto const& tagger : crtTaggerMap[trackTrueID]){ - hEffLengthTotal[tagger]->Fill(tpcTrack.Length()); - - // If closest hit is below limit and track matches any hits then fill efficiency - if(closest.dca < fixedCut && closest.dca >=0 ){ - hEffLengthReco[tagger]->Fill(tpcTrack.Length()); - } - } - // Fill total efficiency histograms - // hEffLengthTotal["All"]->Fill(tpcTrack.Length()); - if(closest.dca < fixedCut && closest.dca >=0){ - //hEffLengthReco["All"]->Fill(tpcTrack.Length()); - } - } - - // Fill total purity histogram with each cut if closest hit is below limit - if(closest.dca < fixedCut && closest.dca >= 0){ - hPurityLengthTotal[closest.thishit.tagger]->Fill(tpcTrack.Length()); - // hPurityLengthTotal["All"]->Fill(tpcTrack.Length()); - - // If closest hit is below limit and matched time is correct then fill purity - double hitTime = closest.thishit.ts1_ns * 1e-3; - if(particles.find(trackTrueID) != particles.end()){ - double trueTime = particles[trackTrueID].T() * 1e-3; - if(std::abs(hitTime - trueTime) < 2.){ - hPurityLengthReco[closest.thishit.tagger]->Fill(tpcTrack.Length()); - // hPurityLengthReco["All"]->Fill(tpcTrack.Length()); - } - } - - } - // if(fVerbose) std::cout<<"----------------- line 463 -------------------"< -#include -#include -#include -#include - -// LArSoft -#include "larcore/Geometry/Geometry.h" -#include "larcorealg/Geometry/GeometryCore.h" -#include "larcorealg/Geometry/PlaneGeo.h" -#include "larcorealg/Geometry/WireGeo.h" -#include "lardataobj/AnalysisBase/T0.h" -#include "lardataobj/RecoBase/Hit.h" -#include "lardataobj/RecoBase/Track.h" -#include "larcore/CoreUtils/ServiceUtil.h" // lar::providerFrom() -#include "lardata/Utilities/AssociationUtil.h" -#include "lardata/DetectorInfoServices/LArPropertiesService.h" -#include "lardata/DetectorInfoServices/DetectorPropertiesService.h" -#include "lardataobj/RawData/ExternalTrigger.h" -#include "larcoreobj/SimpleTypesAndConstants/PhysicalConstants.h" -#include "lardataobj/AnalysisBase/ParticleID.h" -#include "larsim/MCCheater/BackTrackerService.h" -#include "sbnobj/Common/Trigger/ExtraTriggerInfo.h" -#include "lardataobj/RecoBase/PFParticle.h" -#include "lardataobj/AnalysisBase/T0.h" -#include "lardataobj/RecoBase/PFParticleMetadata.h" -// ROOT -#include "TVector3.h" -#include "TH1.h" -#include "TH2.h" -#include "TVector3.h" -#include "TTree.h" - -namespace icarus { - - class CRTT0Matching : public art::EDProducer { - public: - - explicit CRTT0Matching(fhicl::ParameterSet const & p); - - // The destructor generated by the compiler is fine for classes - // without bare pointers or other resource use. - - // Plugins should not be copied or assigned. - CRTT0Matching(CRTT0Matching const &) = delete; - CRTT0Matching(CRTT0Matching &&) = delete; - CRTT0Matching & operator = (CRTT0Matching const &) = delete; - CRTT0Matching & operator = (CRTT0Matching &&) = delete; - - // Required functions. - void produce(art::Event & e) override; - - // Selected optional functions. - void beginJob() override; - - void endJob() override; - - void reconfigure(fhicl::ParameterSet const & p); - - private: - - // Params got from fcl file....... - // art::InputTag fTpcTrackModuleLabel; ///< name of track producer - std::vector fTpcTrackModuleLabel; ///< name of track producer - std::vector fPFParticleLabel; ///< labels for source of PFParticle - art::InputTag fCrtHitModuleLabel; ///< name of crt producer - art::InputTag fTriggerLabel; ///< labels for trigger - CRTT0MatchAlg t0Alg; - - - geo::GeometryCore const* fGeometryService; ///< pointer to Geometry provider - icarus::crt::CRTCommonUtils* fCrtutils; - // CRTCommonUtils* fCrtutils; - - TTree* fTree; - int fEvent; ///< number of the event being processed - int fRun; ///< number of the run being processed - int fSubRun; ///< number of the sub-run being processed - vector fCrtRegion; //CRT hit region code - vector fDCA; //CRT hit region code - vector fDOL; //CRT hit region code - vector fT0; //CRT hit region code - vector ftpcx; // x-position from tpc - vector ftpcy; // y-position from tpc - vector ftpcz; // z-position from tpc - vector fcrtx; // x-position from crt - vector fcrty; // y-position from crt - vector fcrtz; // z-position from crt - vector fpandorat0; ///< Track T0 based on Pandora (Cathode Crossing Track) - vector fcryo; ///< cryo number - vector fntracks; ///< total number of tracks - - //add trigger data product vars - unsigned int m_gate_type; - std::string m_gate_name; - uint64_t m_trigger_timestamp; - uint64_t m_gate_start_timestamp; - uint64_t m_trigger_gate_diff; - uint64_t m_gate_crt_diff; - - - // Histograms - std::map hDCA; - std::map hMatchDCA; - std::map hNoMatchDCA; - - std::map hDoL; - std::map hMatchDoL; - std::map hNoMatchDoL; - - std::map hT0; - std::map hMatchT0; - std::map hNoMatchT0; - }; // class CRTT0Matching - - - CRTT0Matching::CRTT0Matching(fhicl::ParameterSet const & p) - : EDProducer(p), t0Alg(p.get("T0Alg")) - , fCrtutils(new icarus::crt::CRTCommonUtils()) - // Initialize member data here, if know don't want to reconfigure on the fly - { - - // Call appropriate produces<>() functions here. - produces< std::vector >(); - produces< art::Assns >(); - produces< art::Assns >(); - - fGeometryService = lar::providerFrom(); - reconfigure(p); - - } // CRTT0Matching() - - - void CRTT0Matching::reconfigure(fhicl::ParameterSet const & p) - { - fTpcTrackModuleLabel = p.get< std::vector>("TpcTrackModuleLabel", {"pandoraTrackGausCryoE"}); - fCrtHitModuleLabel = p.get ("CrtHitModuleLabel", "crthit"); - fPFParticleLabel = p.get< std::vector >("PFParticleLabel", {""}); - fTriggerLabel = p.get("TriggerLabel","daqTrigger"); - } // CRTT0Matching::reconfigure() - - - void CRTT0Matching::beginJob() - { - // Access tfileservice to handle creating and writing histograms - art::ServiceHandle tfs; - - fTree = tfs->make("matchTree","CRTHit - TPC track matching analysis"); - - fTree->Branch("Event", &fEvent, "Event/I"); - fTree->Branch("SubRun", &fSubRun, "SubRun/I"); - fTree->Branch("Run", &fRun, "Run/I"); - fTree->Branch("crtRegion", "std::vector", &fCrtRegion); - fTree->Branch("DCA", "std::vector", &fDCA); - fTree->Branch("DOL", "std::vector", &fDOL); - fTree->Branch("t0", "std::vector", &fT0); - fTree->Branch("tpcx", "std::vector", &ftpcx); - fTree->Branch("tpcy", "std::vector", &ftpcy); - fTree->Branch("tpcz", "std::vector", &ftpcz); - fTree->Branch("crtx", "std::vector", &fcrtx); - fTree->Branch("crty", "std::vector", &fcrty); - fTree->Branch("crtz", "std::vector", &fcrtz); - fTree->Branch("cryo", "std::vector", &fcryo); - fTree->Branch("ntracks", "std::vector", &fntracks); - fTree->Branch("pandorat0", "std::vector", &fpandorat0); - fTree->Branch("gate_type", &m_gate_type, "gate_type/b"); - fTree->Branch("gate_name", &m_gate_name); - fTree->Branch("trigger_timestamp", &m_trigger_timestamp, "trigger_timestamp/l"); - fTree->Branch("gate_start_timestamp", &m_gate_start_timestamp, "gate_start_timestamp/l"); - fTree->Branch("trigger_gate_diff", &m_trigger_gate_diff, "trigger_gate_diff/l"); - fTree->Branch("gate_crt_diff",&m_gate_crt_diff, "gate_crt_diff/l"); - - for(int i = 30; i < 50 + 1; i++){ - std::string tagger = "All"; - if (i >= 35 && i < 40) continue; - if (i==48 || i==49) continue; - // if(i < ){ - tagger = fCrtutils->GetRegionNameFromNum(i);//fCrtGeo.GetTagger(i).name; - // std::cout << "tagger: " << tagger.c_str() << std::endl; - hDCA[tagger] = tfs->make(Form("DCA_%s", tagger.c_str()), "", 50, 0, 100); - hDoL[tagger] = tfs->make(Form("DoL_%s", tagger.c_str()), "", 100, 0, 0.25); - hT0[tagger] = tfs->make(Form("T0_%s", tagger.c_str()), "", 600, -3000, 3000); - } - - } // CRTT0Matching::beginJob() - - void CRTT0Matching::produce(art::Event & event) - { - fDCA.clear(); - fDOL.clear(); - fT0.clear(); - fcrtx.clear(); - fcrty.clear(); - fcrtz.clear(); - ftpcx.clear(); - ftpcy.clear(); - ftpcz.clear(); - fCrtRegion.clear(); - fpandorat0.clear(); - fcryo.clear(); - fntracks.clear(); - fEvent = event.id().event(); - fRun = event.run(); - fSubRun = event.subRun(); - - // Create anab::T0 objects and make association with recob::Track - std::unique_ptr< std::vector > T0col( new std::vector); - std::unique_ptr< art::Assns > Trackassn( new art::Assns); - std::unique_ptr< art::Assns > t0_crthit_assn( new art::Assns ); - - //add trigger info - if( !fTriggerLabel.empty() ) { - - art::Handle trigger_handle; - event.getByLabel( fTriggerLabel, trigger_handle ); - if( trigger_handle.isValid() ) { - sbn::triggerSource bit = trigger_handle->sourceType; - m_gate_type = (unsigned int)bit; - m_gate_name = bitName(bit); - m_trigger_timestamp = trigger_handle->triggerTimestamp; - m_gate_start_timestamp = trigger_handle->beamGateTimestamp; - m_trigger_gate_diff = trigger_handle->triggerTimestamp - trigger_handle->beamGateTimestamp; - - } - else{ - mf::LogError("CRTT0Matching:") << "No raw::Trigger associated to label: " << fTriggerLabel.label() << "\n" ; - } - } - else { - mf::LogError("CRTT0Matching:") << "Trigger Data product " << fTriggerLabel.label() << " not found!\n" ; - } - - // Retrieve CRT hit list - art::Handle> crtListHandle; - std::vector> crtList; - if(event.getByLabel(fCrtHitModuleLabel, crtListHandle)) - art::fill_ptr_vector(crtList, crtListHandle); - - std::vector crtHits; - for (auto const& crtHit : crtList){ - crtHits.push_back(*crtHit); - } - - // Retrieve track list - for(const auto& trackLabel : fTpcTrackModuleLabel){ - - auto it = &trackLabel - fTpcTrackModuleLabel.data(); - - art::Handle< std::vector > trackListHandle; - std::vector > trackList; - if (event.getByLabel(trackLabel,trackListHandle)) - art::fill_ptr_vector(trackList, trackListHandle); - - // if (event.getByLabel(fTpcTrackModuleLabel,trackListHandle)) - // std::cout << "crtlabel: " << fCrtHitModuleLabel << " , Tpctrklabel: " << fTpcTrackModuleLabel << std::endl; - - mf::LogInfo("CRTT0Matching") - <<"Number of reconstructed tracks = "<ID()<<" with DCA = "<push_back(anab::T0(closest.t0*1e3, trackList[track_i]->ID(), closest.thishit.plane, (int)closest.extrapLen, closest.dca)); - util::CreateAssn(*this, event, *T0col, trackList[track_i], *Trackassn); - - //std::cout << "---------------------- line #156 " << std::endl; - double sin_angle = -99999; -// if(closest.dca != -99999){ - auto start = trackList[track_i]->Vertex(); - //auto end = trackList[track_i]->End(); - hDCA[closest.thishit.tagger]->Fill(closest.dca); - //hDCA["All"]->Fill(closest.dca); - sin_angle = closest.dca/closest.extrapLen; - hDoL[closest.thishit.tagger]->Fill(sin_angle); - // hDoL["All"]->Fill(sin_angle); - hT0[closest.thishit.tagger]->Fill(closest.t0); - fDCA.push_back(closest.dca); - fDOL.push_back(sin_angle); - fT0.push_back(closest.t0); - fcryo.push_back(cryoNumber); - fpandorat0.push_back(t0); - ftpcx.push_back(start.X()); - ftpcy.push_back(start.Y()); - ftpcz.push_back(start.Z()); - fcrtx.push_back(closest.thishit.x_pos); - fcrty.push_back(closest.thishit.y_pos); - fcrtz.push_back(closest.thishit.z_pos); - // fCrtRegion.push_back(closest.thishit.tagger); - fCrtRegion.push_back(fCrtutils->AuxDetRegionNameToNum(closest.thishit.tagger)); -// } - //find this CRThit in the collection - // note this does not work (both the loop and the assoc !!) - unsigned CRThitIndex = std::numeric_limits::max(); - for (int ic=0; ic<(int)crtList.size(); ++ic){ - if (crtList[ic]->ts0_ns==closest.thishit.ts0_ns && crtList[ic]->z_pos==closest.thishit.z_pos && crtList[ic]->peshit==closest.thishit.peshit) - CRThitIndex=ic; - // std::cout << "CRThitIndex: \t" << CRThitIndex << std::endl; - } - if (CRThitIndex != std::numeric_limits::max()){ - // std::cout <<"CRThitIndex: " << CRThitIndex << " passed......: \t" << std::endl; - util::CreateAssn(*this, event, *T0col, crtList[CRThitIndex], *t0_crthit_assn); - } - } // DCA check - - } // Loop over tracks - - } // Validity check - - } // all track labels in a vector - event.put(std::move(T0col)); - event.put(std::move(Trackassn)); - event.put(std::move(t0_crthit_assn)); - fTree->Fill(); - } // CRTT0Matching::produce() - - - void CRTT0Matching::endJob() - { - - } // CRTT0Matching::endJob() - - - DEFINE_ART_MODULE(CRTT0Matching) - -} // sbnd namespace - -namespace { - -} diff --git a/icaruscode/CRT/CRTT0Tagging_module.cc b/icaruscode/CRT/CRTT0Tagging_module.cc index 4420c10e9..f894b7d2b 100644 --- a/icaruscode/CRT/CRTT0Tagging_module.cc +++ b/icaruscode/CRT/CRTT0Tagging_module.cc @@ -5,66 +5,46 @@ */ #include "sbnobj/Common/CRT/CRTHit.hh" -//#include "icaruscode/CRT/CRTUtils/CRTT0MatchAlg.h" #include "icaruscode/CRT/CRTUtils/CRTMatchingUtils.h" #include "icaruscode/IcarusObj/CRTTPCMatchingInfo.h" #include "icaruscode/CRT/CRTUtils/RecoUtils.h" #include "icaruscode/CRT/CRTUtils/CRTCommonUtils.h" - // Framework includes #include "art/Framework/Core/EDProducer.h" #include "art/Framework/Core/ModuleMacros.h" -#include "canvas/Persistency/Common/FindManyP.h" -#include "canvas/Persistency/Common/FindOne.h" #include "art/Framework/Principal/Handle.h" #include "art/Framework/Principal/Event.h" +#include "art/Framework/Principal/Run.h" +#include "canvas/Utilities/Exception.h" #include "canvas/Persistency/Common/Ptr.h" #include "canvas/Persistency/Common/PtrVector.h" -#include "art/Framework/Principal/Run.h" -#include "art/Framework/Principal/SubRun.h" +#include "art/Persistency/Common/PtrMaker.h" +#include "canvas/Persistency/Common/FindManyP.h" +#include "canvas/Persistency/Common/FindOne.h" #include "art_root_io/TFileService.h" -#include "art_root_io/TFileDirectory.h" - #include "canvas/Utilities/InputTag.h" #include "fhiclcpp/ParameterSet.h" #include "messagefacility/MessageLogger/MessageLogger.h" - #include -#include +#include #include -#include #include - +#include // std::abs(), std::hypot() // LArSoft -#include "larsim/MCCheater/BackTrackerService.h" -#include "larsim/MCCheater/BackTracker.h" -#include "larsim/MCCheater/ParticleInventoryService.h" -#include "larcore/Geometry/Geometry.h" #include "larcorealg/Geometry/GeometryCore.h" -#include "larcorealg/Geometry/PlaneGeo.h" -#include "larcorealg/Geometry/WireGeo.h" #include "larcorealg/CoreUtils/zip.h" #include "lardataobj/AnalysisBase/T0.h" #include "lardataobj/RecoBase/Hit.h" #include "lardataobj/RecoBase/Track.h" +#include "lardataobj/RecoBase/PFParticleMetadata.h" +#include "lardataobj/RecoBase/PFParticle.h" #include "larcore/CoreUtils/ServiceUtil.h" // lar::providerFrom() -#include "lardata/Utilities/AssociationUtil.h" +#include "larcore/Geometry/Geometry.h" #include "lardata/DetectorInfoServices/LArPropertiesService.h" #include "lardata/DetectorInfoServices/DetectorPropertiesService.h" -#include "lardataobj/RawData/ExternalTrigger.h" -#include "larcoreobj/SimpleTypesAndConstants/PhysicalConstants.h" -#include "lardataobj/AnalysisBase/ParticleID.h" #include "larsim/MCCheater/BackTrackerService.h" -#include "sbnobj/Common/Trigger/ExtraTriggerInfo.h" -#include "lardataobj/RecoBase/PFParticle.h" -#include "lardataobj/AnalysisBase/T0.h" -#include "lardataobj/RecoBase/PFParticleMetadata.h" - +#include "larsim/MCCheater/ParticleInventoryService.h" // ROOT -#include "TVector3.h" -#include "TH1.h" -#include "TH2.h" -#include "TVector3.h" #include "TTree.h" namespace icarus::crt { @@ -97,7 +77,6 @@ class icarus::crt::CRTT0Tagging : public art::EDProducer { //void beginRun(art::Run& r) override; void beginJob() override; void produce(art::Event& e) override; - void endJob() override; private: @@ -269,6 +248,8 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) //auto trackMatchInfoAssn = std::make_unique< art::Assns >(); //auto matchInfoCrtHitAssn = std::make_unique< art::Assns >(); + art::PtrMaker makeT0ptr{ e }; // create art pointers to the new T0 + std::map< int, const simb::MCParticle*> particleMap; std::map,std::vector> crtParticleMap; std::map isNuMap; @@ -457,68 +438,31 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) if(!isnan(t0)){ if(fabs(t0-crtHit.ts1_ns)>fMaximumDeltaT) continue; } - icarus::crt::DriftedTrack thisDriftedTrack = fMatchingAlg.DriftTrack(trkHits, trkHitMetas, fGeometryService, detProp, crtTime, track); + icarus::crt::DriftedTrack thisDriftedTrack = fMatchingAlg.DriftTrack(trkHits, trkHitMetas, fGeometryService, detProp, clockData, crtTime, track, 0); if(thisDriftedTrack.outbound>0) continue; icarus::crt::PCAResults driftedPCAResults=fMatchingAlg.PCAfit(thisDriftedTrack.sp); icarus::crt::TranslationVector translVector = {driftedPCAResults.eigenVector1, driftedPCAResults.mean}; - int crtSys=-1; - if(crtHit.plane<=34) crtSys=0; - else if (crtHit.plane==50) crtSys=2; - else crtSys=1; + int crtSys=fCrtUtils.MacToTypeCode(crtHit.feb_id[0]); if(crtSys==2) continue; // lets discard Bottom CRT Hits for the moment - double deltaX=std::numeric_limits::signaling_NaN(); - double deltaY=std::numeric_limits::signaling_NaN(); - double deltaZ=std::numeric_limits::signaling_NaN(); + geo::Point_t delta = {std::numeric_limits::signaling_NaN(), std::numeric_limits::signaling_NaN(), std::numeric_limits::signaling_NaN()}; + double crtDistance=std::numeric_limits::signaling_NaN(); icarus::crt::CRTPlane thisCRTPlane = fMatchingAlg.DeterminePlane(crtHit); icarus::crt::CrossingPoint crossPoint = fMatchingAlg.DetermineProjection(translVector, thisCRTPlane); - double crtX=crtHit.x_pos; - double crtY=crtHit.y_pos; - double crtZ=crtHit.z_pos; + geo::Point_t CRTHitCoordinate = {crtHit.x_pos, crtHit.y_pos, crtHit.z_pos}; if(fData){ // Realignment only applies to Data, not MC if(crtSys==0){ - double centerDX, centerDY, centerDZ; - centerDX=crtX-fTopCRTCenterMap[(int)crtHit.feb_id[0]].X; - centerDY=crtY-fTopCRTCenterMap[(int)crtHit.feb_id[0]].Y; - centerDZ=crtZ-fTopCRTCenterMap[(int)crtHit.feb_id[0]].Z; - icarus::crt::dataTools::AffineTrans thisAffine=TopCRTCorrection[(int)crtHit.feb_id[0]]; - std::pair transCrt; - if(crtHit.plane==30) { - transCrt=icarus::crt::dataTools::AffineTransformation(centerDX, centerDZ, thisAffine); - crtX=transCrt.first; - crtZ=transCrt.second; - } else if(crtHit.plane==31 ||crtHit.plane==32) { - transCrt=icarus::crt::dataTools::AffineTransformation(centerDY, centerDZ, thisAffine); - crtY=transCrt.first; - crtZ=transCrt.second; - } else if(crtHit.plane==33 ||crtHit.plane==34){ - transCrt=icarus::crt::dataTools::AffineTransformation(centerDX, centerDY, thisAffine); - crtX=transCrt.first; - crtY=transCrt.second; - } + CRTHitCoordinate = icarus::crt::dataTools::ApplyTransformation(crtHit, TopCRTCorrection, fTopCRTCenterMap); } } - - if(thisCRTPlane.first==0){ - deltaX=crtX-crossPoint.X(); - deltaY=0; - deltaZ=crtZ-crossPoint.Z(); - } else if(thisCRTPlane.first==1){ - deltaX=0; - deltaY=crtY-crossPoint.Y(); - deltaZ=crtZ-crossPoint.Z(); - } else if(thisCRTPlane.first==2){ - deltaX=crtX-crossPoint.X(); - deltaY=crtY-crossPoint.Y(); - deltaZ=0; - } - crtDistance=sqrt(pow(deltaX,2)+pow(deltaZ,2)+pow(deltaY,2)); + delta=CRTHitCoordinate-crossPoint; + crtDistance=std::hypot(delta.X(), delta.Y(), delta.Z()); if(crtDistance>fMaximalCRTDistance) continue; - icarus::crt::CandCRT thisCrtCand={crtHit,p_crthit, thisCRTPlane.first, crtDistance, deltaX, deltaY, deltaZ, crossPoint}; + icarus::crt::CandCRT thisCrtCand={crtHit,p_crthit, thisCRTPlane.first, crtDistance, delta, crossPoint}; crtCands.push_back(thisCrtCand); } // End of CRT Hit loop if(crtCands.empty()) { @@ -530,32 +474,30 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) }); icarus::crt::CandCRT& bestCrtCand=*minElementIt; if(bestCrtCand.distance<=fGoodCandidateDistance){ - int matchedSys=-1; - if(bestCrtCand.CRThit.plane<=34) matchedSys=0; - else if (bestCrtCand.CRThit.plane==50) matchedSys=2; - else matchedSys=1; + int matchedSys=fCrtUtils.MacToTypeCode(bestCrtCand.CRThit.feb_id[0]); if(matchedSys==2) continue; // lets discard Bottom CRT Hits for the moment bool trueMatch=false; if(!fData && !fSkipTruth){ std::vector crtTracks, crtPdgs; std::pair thisMatch=std::make_pair((int)bestCrtCand.CRThit.feb_id[0], bestCrtCand.CRThit.ts1_ns); - if(crtParticleMap.find(thisMatch) != crtParticleMap.end()){ - for(size_t j=0; jPdgCode()); - } + auto const itMatch = crtParticleMap.find(thisMatch); + if(itMatch != crtParticleMap.end()){ + for(int trackID: itMatch->second){ + crtTracks.push_back(trackID); + crtPdgs.push_back(particleMap.at(trackID)->PdgCode()); + } } - for(size_t thisID=0; thisIDFill(); mf::LogInfo("CRTT0Tagging") - <<"Matched CRT time = "<push_back(anab::T0(bestCrtCand.CRThit.ts1_ns, track.ID(), matchedSys, bestCrtCand.CRThit.plane,bestCrtCand.distance)); - util::CreateAssn(*this, e, *t0col, trkPtr, *trackAssn); - util::CreateAssn(*this, e, *t0col, bestCrtCand.ptrCRThit, *t0CrtHitAssn); - icarus::CRTTPCMatchingInfo matchInfo = {bestCrtCand.distance, matchedSys, bestCrtCand.CRThit.plane, bestCrtCand.CRThit.ts1_ns, bestCrtCand.deltaX, bestCrtCand.deltaY, bestCrtCand.deltaZ, bestCrtCand.crossPoint.X(), bestCrtCand.crossPoint.Y(), bestCrtCand.crossPoint.Z(), bestCrtCand.plane}; + + art::Ptr const newT0ptr = makeT0ptr(t0col->size()-1); // index of the last T0 + trackAssn->addSingle(trkPtr, newT0ptr); + t0CrtHitAssn->addSingle(bestCrtCand.ptrCRThit, newT0ptr); + + icarus::CRTTPCMatchingInfo matchInfo {bestCrtCand.distance, matchedSys, bestCrtCand.CRThit.plane, bestCrtCand.CRThit.ts1_ns, bestCrtCand.delta.X(), bestCrtCand.delta.Y(), bestCrtCand.delta.Z(), bestCrtCand.crossPoint.X(), bestCrtCand.crossPoint.Y(), bestCrtCand.crossPoint.Z(), bestCrtCand.plane}; matchInfoCol->push_back(matchInfo); - //util::CreateAssn(*this, e, *t0col, *matchInfoCol, *t0matchInfoAssn); - // util::CreateAssn(*this, e, *matchInfoCol, trkPtr, *trackMatchInfoAssn); - // util::CreateAssn(*this, e, *matchInfoCol, bestCrtCand.ptrCRThit, *matchInfoCrtHitAssn); } } // End of Track Loop - } // End of Cryo Loop e.put(std::move(t0col)); e.put(std::move(trackAssn)); e.put(std::move(t0CrtHitAssn)); e.put(std::move(matchInfoCol)); - //e.put(std::move(t0matchInfoAssn)); - //e.put(std::move(trackMatchInfoAssn)); - //e.put(std::move(matchInfoCrtHitAssn)); } -void CRTT0Tagging::endJob() -{ - -} // CRTT0Tagging::endJob() - - DEFINE_ART_MODULE(CRTT0Tagging) diff --git a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx index d81ab6d7f..aa9dc4a30 100644 --- a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx +++ b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.cxx @@ -19,7 +19,6 @@ #include "TMatrixDSymEigen.h" #include "larcorealg/Geometry/TPCGeo.h" #include "larcorealg/Geometry/PlaneGeo.h" - namespace icarus::crt{ CRTMatchingAlg::CRTMatchingAlg(const fhicl::ParameterSet& pset) @@ -32,8 +31,6 @@ namespace icarus::crt{ void CRTMatchingAlg::reconfigure(const fhicl::ParameterSet& pset) { - fTickPeriod = pset.get("TickPeriod", 0.4); - fTickAtAnode = pset.get("TickAtAnode", 850.); fAllowedOffsetCM = pset.get("AllowedOffsetCM", 1.57); return; } @@ -172,11 +169,9 @@ namespace icarus::crt{ return ThisTrackBary; } - DriftedTrack CRTMatchingAlg::DriftTrack(const std::vector>& trkHits, const std::vector& trkHitMetas, const geo::GeometryCore *GeometryService, detinfo::DetectorPropertiesData const& detProp, double time, const recob::Track& tpcTrack) const + DriftedTrack CRTMatchingAlg::DriftTrack(const std::vector>& trkHits, const std::vector& trkHitMetas, const geo::GeometryCore *GeometryService, detinfo::DetectorPropertiesData const& detProp, detinfo::DetectorClocksData const& detClock, double time, const recob::Track& tpcTrack, int maxOutBoundPoints) const { int outBound=0; - int outBound1=0; - int count=0; std::vector recI; std::vector driftedPositionVector; for(size_t i=0; iIndex()); const geo::TPCGeo& tpcGeo = GeometryService->TPC(trkHits[i]->WireID()); - int const cryo = trkHits[i]->WireID().Cryostat; - int tpc=trkHits[i]->WireID().TPC; double vDrift=detProp.DriftVelocity(); + // recoX: distance of the hit charge from the plane // * `trkHits[i]->PeakTime()-fTickAtAnode`: TPC ticks from the trigger to when charge gets to plane // * `time`: t0 [CRT or Flash] (with respect to trigger) in TPC ticks // * difference is how many ticks passed from the track to when charge gets to plane: drift ticks - double recoX=(trkHits[i]->PeakTime()-fTickAtAnode-time/fTickPeriod)*fTickPeriod*vDrift; - + double recoX=(trkHits[i]->PeakTime()-detClock.Time2Tick(detClock.TriggerTime())-time/detClock.TPCClock().TickPeriod())*detClock.TPCClock().TickPeriod()*vDrift; double plane=tpcGeo.PlanePtr(trkHits[i]->WireID().Plane)->GetCenter().X(); - double cathode=tpcGeo.GetCathodeCenter().X(); double X=plane-tpcGeo.DriftDir().X()*recoX; - if(cryo==0 && (tpc==0 || tpc==1) && (X>(cathode+fAllowedOffsetCM)||X<(plane-fAllowedOffsetCM))) outBound++; - else if(cryo==0 && (tpc==2 || tpc==3)&& (X<(cathode-fAllowedOffsetCM)||X>(plane+fAllowedOffsetCM))) outBound++; - else if(cryo==1 && (tpc==0 || tpc==1)&& (X>(cathode+fAllowedOffsetCM)||X<(plane-fAllowedOffsetCM))) outBound++; - else if(cryo==1 && (tpc==2 || tpc==3)&& (X<(cathode-fAllowedOffsetCM)||X>(plane+fAllowedOffsetCM))) outBound++; - - double fAllowedRel = 1+fAllowedOffsetCM / tpcGeo.DriftDistance(); - if(!tpcGeo.ActiveBoundingBox().ContainsX(X, fAllowedRel)) outBound1++; - - if(outBound!=outBound1 && count<=10){ - //std::cout<<"Active Bounding Box MinX "<WireID().Plane<<" X "<WireID().Plane)->GetCenter().X()); + if(!tpcGeo.ActiveBoundingBox().ContainsX((X), AllowedRel)) outBound++; + if(outBound>maxOutBoundPoints) { + return {{},{},maxOutBoundPoints+1}; } - //geo::Point_t driftedPosition={X, loc.Y(), loc.Z()}; driftedPositionVector.push_back({X, loc.Y(), loc.Z()}); recI.push_back(trkHits[i]->Integral()); } diff --git a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h index 9e0a01e08..fdb607d08 100644 --- a/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h +++ b/icaruscode/CRT/CRTUtils/CRTMatchingUtils.h @@ -18,12 +18,18 @@ #include "lardataobj/RecoBase/Track.h" #include "lardataobj/RecoBase/TrackHitMeta.h" #include "larcorealg/Geometry/GeometryCore.h" +#include "lardata/DetectorInfoServices/DetectorPropertiesService.h" +#include "lardata/DetectorInfoServices/DetectorClocksService.h" #include "lardataalg/DetectorInfo/DetectorPropertiesData.h" +#include "lardataalg/DetectorInfo/DetectorClocksData.h" +#include "lardataalg/DetectorInfo/DetectorClocks.h" // Data product headers #include "sbnobj/Common/CRT/CRTHit.hh" #include "sbnobj/Common/Trigger/ExtraTriggerInfo.h" #include "sbnobj/Common/CRT/CRTPMTMatching.hh" + + namespace icarus::crt{ struct TrackBarycenter @@ -65,9 +71,7 @@ struct CandCRT{ art::Ptr ptrCRThit; int plane; double distance; - double deltaX; - double deltaY; - double deltaZ; + geo::Point_t delta; CrossingPoint crossPoint; }; @@ -114,12 +118,9 @@ class CRTMatchingAlg { /// Function which drifts the track x coordinates assuming a time (in the trigger reference system). /// The function also returns the number of hit points which would be outside of the physical boundaries of the TPCs at the considered time. - DriftedTrack DriftTrack(const std::vector>& trkHits, const std::vector& trkHitMetas, const geo::GeometryCore *GeometryService, detinfo::DetectorPropertiesData const& detProp, double time, const recob::Track& tpcTrack) const; + DriftedTrack DriftTrack(const std::vector>& trkHits, const std::vector& trkHitMetas, const geo::GeometryCore *GeometryService, detinfo::DetectorPropertiesData const& detProp, detinfo::DetectorClocksData const& detClock, double time, const recob::Track& tpcTrack, int maxOutBoundPoints) const; private: - - double fTickPeriod; - double fTickAtAnode; double fAllowedOffsetCM; }; diff --git a/icaruscode/CRT/CRTUtils/RecoUtils.cc b/icaruscode/CRT/CRTUtils/RecoUtils.cc index 8b10eb34f..7c4c8cfcf 100644 --- a/icaruscode/CRT/CRTUtils/RecoUtils.cc +++ b/icaruscode/CRT/CRTUtils/RecoUtils.cc @@ -237,6 +237,36 @@ TopCRTTransformations LoadTopCRTTransformations() return LoadedTransformations; } +geo::Point_t ApplyTransformation(const sbn::crt::CRTHit& crthit, const TopCRTCorrectionMap& TopCRTCorrections, const TopCRTCentersMap& TopCRTCenters){ + double centerDX=crthit.x_pos - TopCRTCenters.at((int)crthit.feb_id[0]).X(); + double centerDY=crthit.y_pos - TopCRTCenters.at((int)crthit.feb_id[0]).Y(); + double centerDZ=crthit.z_pos - TopCRTCenters.at((int)crthit.feb_id[0]).Z(); + AffineTrans thisAffine=TopCRTCorrections.at((int)crthit.feb_id[0]); + std::pair transCrt; + double crtX=crthit.x_pos, crtY=crthit.y_pos, crtZ=crthit.z_pos; + switch (crthit.plane){ + case 30: + transCrt=icarus::crt::dataTools::AffineTransformation(centerDX, centerDZ, thisAffine); + crtX=transCrt.first; + crtZ=transCrt.second; + break; + case 31: case 32: + transCrt=icarus::crt::dataTools::AffineTransformation(centerDY, centerDZ, thisAffine); + crtY=transCrt.first; + crtZ=transCrt.second; + break; + case 33: case 34: + transCrt=icarus::crt::dataTools::AffineTransformation(centerDX, centerDY, thisAffine); + crtX=transCrt.first; + crtY=transCrt.second; + break; + default: + throw std::logic_error("TopCRTAffineTransformationError: CRT plane/region not valid!"); + break; + } + return {crtX, crtY, crtZ}; +} + } int RecoUtils::TrueParticleID(detinfo::DetectorClocksData const& clockData, diff --git a/icaruscode/CRT/CRTUtils/RecoUtils.h b/icaruscode/CRT/CRTUtils/RecoUtils.h index e575f0fd9..8453f56b7 100644 --- a/icaruscode/CRT/CRTUtils/RecoUtils.h +++ b/icaruscode/CRT/CRTUtils/RecoUtils.h @@ -32,6 +32,7 @@ //#include "lardataobj/AnalysisBase/ParticleID.h" #include "larsim/MCCheater/BackTrackerService.h" #include "larcore/Geometry/Geometry.h" +#include "sbnobj/Common/CRT/CRTHit.hh" namespace detinfo { class DetectorClocksData; } @@ -45,12 +46,7 @@ namespace detinfo { class DetectorClocksData; } namespace icarus::crt::dataTools{ -struct ModuleCenter -{ - double X; - double Y; - double Z; -}; +using ModuleCenter = geo::Point_t; struct AffineTrans { @@ -93,6 +89,9 @@ TransformedCRTHit AffineTransformation(double DX, double DZ, AffineTrans affine) /// This functions loads the Affine Transformation TXT files. TopCRTTransformations LoadTopCRTTransformations(); +/// This function transforms a CRTHit with AffineTransformationFunctions. +geo::Point_t ApplyTransformation(const sbn::crt::CRTHit& crthit, const TopCRTCorrectionMap& TopCRTCorrections, const TopCRTCentersMap& TopCRTCenters); + } namespace RecoUtils{ diff --git a/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl b/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl index d2b8d2ce3..94e207321 100644 --- a/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl +++ b/icaruscode/CRT/CRTUtils/crtmatchingalg_icarus.fcl @@ -1,14 +1,7 @@ BEGIN_PROLOG -standard_crtmatchingalg: +icarus_crtmatchingalg: { - MinimalTrackLength: 40. # Minimal TrackLength to match with a CRT - MinimumGoodHits: 5 # Minimum number of good hits to perform the fit - MaximalCRTDistance: 300. # Maximal distance between CRT Hit Candidate and Track Projection - GoodCandidateDistance: 100. # 96 cm maximizes EfficiencyXPurity (both > 92%) - MaximumDeltaT: 10000. # Maximal Time difference between a T0 tagged track and CRT Hit time for the combination to be considered acceptable. [ns] - TickPeriod: 0.4 # 0.4 us tick period - TickAtAnode: 850 # Tick at the Anode, de facto Offset Ticks AllowedOffsetCM: 1.57 # When trying to determine if a track and a time are compatible, you reconstructruct the track at that time # you then check if the reconstructed track is out of the boundaries of the cathode and of the anode, # this variable gives you the maximum excess of the track wrt cathode or anode to consider the track/time pair. @@ -16,30 +9,24 @@ standard_crtmatchingalg: # of 10 us * 0.157 cm/us = 1.57 cm. # As this is phrased, one could think of this as the two variables are related, that is not necessarily # the case, but is still a good guess. - isData: true # IsData - - CrtHitModuleLabel: "crthit" - TriggerLabel: "daqTrigger" - TriggerConfiguration: "triggerconfig" - TPCTrackLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # Track producer module label - TRKHMLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # TrackHit Metadata producer module label - PFParticleLabel: ["pandoraGausCryoE", "pandoraGausCryoW"] # PFParticle producer module label - HitLabel: ["cluster3DCryoE" , "cluster3DCryoW"] - } -icarus_crtt0tagging: +icarus_crtt0tagging_base: { - module_type: "icaruscode/CRT/CRTMatchingAlg" + module_type: "icaruscode/CRT/CRTT0Tagging" CrtHitModuleLabel: "crthit" - TriggerLabel: "daqTrigger" - TriggerConfiguration: "triggerconfig" TPCTrackLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # Track producer module label TRKHMLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # TrackHit Metadata producer module label PFParticleLabel: ["pandoraGausCryoE", "pandoraGausCryoW"] # PFParticle producer module label HitLabel: ["cluster3DCryoE" , "cluster3DCryoW"] - MatchingAlg: @local::standard_crtmatchingalg + MatchingAlg: @local::icarus_crtmatchingalg + MinimalTrackLength: 40. # Minimal TrackLength to match with a CRT + MinimumGoodHits: 5 # Minimum number of good hits to perform the fit + MaximalCRTDistance: 300. # Maximal distance between CRT Hit Candidate and Track Projection + GoodCandidateDistance: 100. # 96 cm maximizes EfficiencyXPurity (both > 92%) + MaximumDeltaT: 10000. # Maximal Time difference between a T0 tagged track and CRT Hit time for the combination to be considered acceptable. [ns] + } diff --git a/icaruscode/CRT/crtt0matching_icarus.fcl b/icaruscode/CRT/crtt0matching_icarus.fcl deleted file mode 100644 index a5f1152ea..000000000 --- a/icaruscode/CRT/crtt0matching_icarus.fcl +++ /dev/null @@ -1,90 +0,0 @@ -# A script to run the producer module: CRTT0Matching - -#include "services_icarus_simulation.fcl" -#include "services_common_icarus.fcl" -#include "crtbacktracker_icarus.fcl" -#include "crtt0matchingalg_icarus.fcl" -#include "simulationservices_icarus.fcl" - - - -##include "messages_icarus.fcl" -##include "services_icarus.fcl" -##include "signalservices_icarus.fcl" -##include "sam_icarus.fcl" -##include "backtrackerservice.fcl" -##include "particleinventoryservice.fcl" - -#include "crtt0producer_icarus.fcl" - -##include "rootoutput_icarus.fcl" - -process_name: CRTT0Matching - -services: -{ - # Load the service that manages root files for histograms. - TFileService: { fileName: "crtt0_hist.root" } - # ParticleInventoryService: @local::standard_particleinventoryservice - #BackTrackerService: @local::standard_backtrackerservice -# CRTBackTrack: @local::standard_crtbacktracker - # This parameter controls the level of descriptive output from various LArSoft modules. - message: @local::icarus_message_services_prod_debug - @table::icarus_common_services - - #FileCatalogMetadata: @local::icarus_file_catalog_mc # from sam_icarus.fcl - # @table::icarus_services - # @table::icarus_random_services # from services_icarus.fcl - - # This following line defines many default LArSoft resources for this job. - # SignalShapingServiceICARUS: @local::icarus_signalshapingservice # from signalservices_icarus.fcl - -} # services - -services.SpaceChargeService: @local::icarus_spacecharge - -# The 'source' section tells the script to expect an input file with art::Event records. -source: -{ - module_type: RootInput - - # Number of events to analyze; "-1" means all of the events in the input - # file. You can override this value with the "-n" option on the command line. - maxEvents: -1 - -} - -# This is empty, because we're not writing an output file with art::Event objects. -outputs: -{ - out1: - { - module_type: RootOutput - fileName: "%ifb_%tc_reco.root" - dataTier: "reconstructed" - saveMemoryObjectThreshold: 0 - compressionLevel: 1 - fastCloning: false - } -} - -# The 'physics' section defines and configures some modules to do work on each event. -physics: -{ - producers: - { - CRTT0Matching: @local::standard_crtt0producer - } - - # Schedule job step(s) for execution by defining the analysis module for this job. - reco: [ CRTT0Matching ] - - stream1: [ out1 ] - - trigger_paths: [reco] - - # "end_paths" is a keyword and contains the modules that do not modify the art::Event; - # i.e., analyzers and output streams. - end_paths: [ stream1 ] - -} diff --git a/icaruscode/CRT/crtt0producer_icarus.fcl b/icaruscode/CRT/crtt0producer_icarus.fcl deleted file mode 100644 index 0593b053d..000000000 --- a/icaruscode/CRT/crtt0producer_icarus.fcl +++ /dev/null @@ -1,33 +0,0 @@ -#include "crtbacktracker_icarus.fcl" -#include "crtt0matchingalg_icarus.fcl" - -BEGIN_PROLOG - -standard_crtt0producer: -{ - module_type: "icaruscode/CRT/CRTT0Matching" - CrtHitModuleLabel: "crthit" # name of crt hit producer - TpcTrackModuleLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # name of tpc track producer - PFParticleLabel: ["pandoraGausCryoE", "pandoraGausCryoW"] # PFParticle producer module label - TriggerLabel: "daqTrigger" - T0Alg: @local::standard_crtt0matchingalg - CRTBackTrack: @local::standard_crtbacktracker -} - -standard_crtt0producerW: -{ - @table::standard_crtt0producer - TpcTrackModuleLabel: ["pandoraTrackGausCryoW"] # name of tpc track producer - PFParticleLabel: ["pandoraGausCryoW"] # PFParticle producer module label - T0Alg: @local::standard_crtt0matchingalgW -} - -standard_crtt0producerE: -{ - @table::standard_crtt0producer - TpcTrackModuleLabel: ["pandoraTrackGausCryoE"] # name of tpc track producer - PFParticleLabel: ["pandoraGausCryoE"] # PFParticle producer module label - T0Alg: @local::standard_crtt0matchingalgE -} - -END_PROLOG diff --git a/icaruscode/CRT/crtt0tagging.fcl b/icaruscode/CRT/crtt0tagging.fcl index b12646905..c3dfd551a 100644 --- a/icaruscode/CRT/crtt0tagging.fcl +++ b/icaruscode/CRT/crtt0tagging.fcl @@ -2,48 +2,34 @@ BEGIN_PROLOG -standard_crtt0tagging: +icarus_crtt0tagging_data: { - - MinimalTrackLength: 40. # Minimal TrackLength to match with a CRT - MinimumGoodHits: 5 # Minimum number of good hits to perform the fit - MaximalCRTDistance: 300. # Maximal distance between CRT Hit Candidate and Track Projection - GoodCandidateDistance: 100. # 96 cm maximizes EfficiencyXPurity (both > 92%) - MaximumDeltaT: 10000. # Maximal Time difference between a T0 tagged track and CRT Hit time for the combination to be considered acceptable. [ns] + @table::icarus_crtt0tagging_base isData: true # Data skipTruth: false # skipTruth module_type: "CRTT0Tagging" CrtHitModuleLabel: "crthit" - TriggerLabel: "daqTrigger" - TriggerConfiguration: "triggerconfig" TPCTrackLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # Track producer module label PFParticleLabel: ["pandoraGausCryoE", "pandoraGausCryoW"] # PFParticle producer module label TRKHMLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # TrackHit Metadata producer module label HitLabel: ["cluster3DCryoE" , "cluster3DCryoW"] - MatchingAlg: @local::standard_crtmatchingalg + MatchingAlg: @local::icarus_crtmatchingalg } -standard_crtt0taggingmc: +icarus_crtt0taggingmc: { - - MinimalTrackLength: 40. # Minimal TrackLength to match with a CRT - MinimumGoodHits: 5 # Minimum number of good hits to perform the fit - MaximalCRTDistance: 300. # Maximal distance between CRT Hit Candidate and Track Projection - GoodCandidateDistance: 100. # 96 cm maximizes EfficiencyXPurity (both > 92%) - MaximumDeltaT: 10000. # Maximal Time difference between a T0 tagged track and CRT Hit time for the combination to be considered acceptable. [ns] + @table::icarus_crtt0tagging_base isData: false # MC skipTruth: false # skipTruth module_type: "CRTT0Tagging" CrtHitModuleLabel: "crthit" - TriggerLabel: "daqTrigger" - TriggerConfiguration: "triggerconfig" TPCTrackLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # Track producer module label PFParticleLabel: ["pandoraGausCryoE", "pandoraGausCryoW"] # PFParticle producer module label TRKHMLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # TrackHit Metadata producer module label HitLabel: ["cluster3DCryoE" , "cluster3DCryoW"] - MatchingAlg: @local::standard_crtmatchingalg + MatchingAlg: @local::icarus_crtmatchingalg SimulationLabel: "largeant" AuxDetSimProducerLabel: "genericcrt" SimChannelProducer: "daq:simpleSC" diff --git a/icaruscode/CRT/crtt0tagging_icarus.fcl b/icaruscode/CRT/crtt0tagging_icarus.fcl index 57e3e6112..8b5399698 100644 --- a/icaruscode/CRT/crtt0tagging_icarus.fcl +++ b/icaruscode/CRT/crtt0tagging_icarus.fcl @@ -1,64 +1,28 @@ #include "services_common_icarus.fcl" -#include "crtt0matchingalg_icarus.fcl" - -##include "messages_icarus.fcl" -##include "services_icarus.fcl" - #include "crtt0tagging.fcl" - +#include "rootoutput_icarus.fcl" process_name: CRTT0Tagging services: -{ - # Load the service that manages root files for histograms. - TFileService: { fileName: "crtt0tagging_hist.root" } - +{ message: @local::icarus_message_services_prod_debug @table::icarus_common_services - + TFileService: { fileName: "crtt0tagging_hist.root" } } # services -source: -{ - module_type: RootInput - - # Number of events to analyze; "-1" means all of the events in the input - # file. You can override this value with the "-n" option on the command line. - maxEvents: -1 - -} - -outputs: -{ - out1: - { - module_type: RootOutput - fileName: "%ifb_%tc_reco.root" - dataTier: "reconstructed" - saveMemoryObjectThreshold: 0 - compressionLevel: 1 - fastCloning: false - } -} +outputs.out1: @local::icarus_rootoutput # The 'physics' section defines and configures some modules to do work on each event. physics: { producers: { - CRTT0Tagging: @local::standard_crtt0tagging + CRTT0Tagging: @local::icarus_crtt0tagging_data } # Schedule job step(s) for execution by defining the analysis module for this job. reco: [ CRTT0Tagging ] stream1: [ out1 ] - - trigger_paths: [reco] - - # "end_paths" is a keyword and contains the modules that do not modify the art::Event; - # i.e., analyzers and output streams. - end_paths: [ stream1 ] - } diff --git a/icaruscode/CRT/crtt0taggingmc_icarus.fcl b/icaruscode/CRT/crtt0taggingmc_icarus.fcl index 7ad1b6e9b..19954ecbc 100644 --- a/icaruscode/CRT/crtt0taggingmc_icarus.fcl +++ b/icaruscode/CRT/crtt0taggingmc_icarus.fcl @@ -1,66 +1,36 @@ #include "services_common_icarus.fcl" -#include "crtt0matchingalg_icarus.fcl" #include "services_icarus_simulation.fcl" #include "simulationservices.fcl" #include "backtrackerservice.fcl" #include "crtt0tagging.fcl" - - +#include "rootoutput_icarus.fcl" process_name: CRTT0Tagging services: { - # Load the service that manages root files for histograms. - TFileService: { fileName: "crtt0tagging_hist.root" } ParticleInventoryService: @local::standard_particleinventoryservice BackTrackerService: @local::standard_backtrackerservice # from `backtrackerservice.fcl` (`larsim`) message: @local::icarus_message_services_prod_debug @table::icarus_common_services + # Load the service that manages root files for histograms. + TFileService: { fileName: "crtt0tagging_hist.root" } } # services services.BackTrackerService.BackTracker.SimChannelModuleLabel: "daq:simpleSC" -source: -{ - module_type: RootInput - - # Number of events to analyze; "-1" means all of the events in the input - # file. You can override this value with the "-n" option on the command line. - maxEvents: -1 - -} - -outputs: -{ - out1: - { - module_type: RootOutput - fileName: "%ifb_%tc_reco.root" - dataTier: "reconstructed" - saveMemoryObjectThreshold: 0 - compressionLevel: 1 - fastCloning: false - } -} +outputs.out1: @local::icarus_rootoutput # The 'physics' section defines and configures some modules to do work on each event. physics: { producers: { - CRTT0Tagging: @local::standard_crtt0taggingmc + CRTT0Tagging: @local::icarus_crtt0taggingmc } # Schedule job step(s) for execution by defining the analysis module for this job. reco: [ CRTT0Tagging ] stream1: [ out1 ] - - trigger_paths: [reco] - - # "end_paths" is a keyword and contains the modules that do not modify the art::Event; - # i.e., analyzers and output streams. - end_paths: [ stream1 ] - } From 8fe71dcb647d2b15528401bda8bb5a579af9ffe1 Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Fri, 17 Jan 2025 18:42:21 +0100 Subject: [PATCH 21/28] restore deleted files --- icaruscode/CRT/CRTT0MatchingAna_module.cc | 500 ++++++++++++++++++++++ icaruscode/CRT/CRTT0Matching_module.cc | 404 +++++++++++++++++ icaruscode/CRT/crtt0matching_icarus.fcl | 90 ++++ icaruscode/CRT/crtt0producer_icarus.fcl | 33 ++ 4 files changed, 1027 insertions(+) create mode 100644 icaruscode/CRT/CRTT0MatchingAna_module.cc create mode 100644 icaruscode/CRT/CRTT0Matching_module.cc create mode 100644 icaruscode/CRT/crtt0matching_icarus.fcl create mode 100644 icaruscode/CRT/crtt0producer_icarus.fcl diff --git a/icaruscode/CRT/CRTT0MatchingAna_module.cc b/icaruscode/CRT/CRTT0MatchingAna_module.cc new file mode 100644 index 000000000..24fc11497 --- /dev/null +++ b/icaruscode/CRT/CRTT0MatchingAna_module.cc @@ -0,0 +1,500 @@ +//////////////////////////////////////////////////////////////////////// +// Class: CRTT0MatchingAna +// Module Type: analyzer +// File: CRTT0MatchingAna_module.cc +// +// Tom Brooks (tbrooks@fnal.gov) +//////////////////////////////////////////////////////////////////////// + +// icaruscode includes +#include "icaruscode/CRT/CRTUtils/RecoUtils.h" +#include "sbnobj/Common/CRT/CRTHit.hh" +#include "icaruscode/CRT/CRTUtils/CRTT0MatchAlg.h" +#include "icaruscode/CRT/CRTUtils/CRTBackTracker.h" +#include "icaruscode/CRT/CRTUtils/CRTCommonUtils.h" +//#include "sbndcode/Geometry/GeometryWrappers/CRTGeoAlg.h" +//#include "sbndcode/Geometry/GeometryWrappers/TPCGeoAlg.h" + +// LArSoft includes +#include "lardataobj/Simulation/SimChannel.h" +#include "lardataobj/RecoBase/Hit.h" +#include "lardataobj/RecoBase/Track.h" +#include "larcore/CoreUtils/ServiceUtil.h" // lar::providerFrom() +#include "lardata/DetectorInfoServices/DetectorClocksService.h" +#include "lardata/DetectorInfoServices/DetectorPropertiesService.h" +#include "larcoreobj/SimpleTypesAndConstants/geo_types.h" +#include "nusimdata/SimulationBase/MCParticle.h" +#include "larcorealg/CoreUtils/NumericUtils.h" // util::absDiff() + +// Framework includes +#include "art/Framework/Core/EDAnalyzer.h" +#include "art/Framework/Principal/Event.h" +#include "art/Framework/Principal/Handle.h" +#include "art/Framework/Services/Registry/ServiceHandle.h" +#include "art_root_io/TFileService.h" +#include "art/Framework/Core/ModuleMacros.h" +#include "canvas/Persistency/Common/FindManyP.h" +#include "canvas/Utilities/Exception.h" +#include "larsim/MCCheater/BackTrackerService.h" +#include "larsim/MCCheater/ParticleInventoryService.h" +#include "sbnobj/Common/Trigger/ExtraTriggerInfo.h" + +// Utility libraries +#include "messagefacility/MessageLogger/MessageLogger.h" +#include "fhiclcpp/ParameterSet.h" +#include "fhiclcpp/types/Table.h" +#include "fhiclcpp/types/Atom.h" +#include "cetlib/pow.h" // cet::sum_of_squares() + +// ROOT includes. Note: To look up the properties of the ROOT classes, +// use the ROOT web site; e.g., +// +#include "TH1.h" +#include "TH2.h" +#include "TVector3.h" + +// C++ includes +#include +#include +#include + +namespace icarus { + + class CRTT0MatchingAna : public art::EDAnalyzer { + public: + + explicit CRTT0MatchingAna(fhicl::ParameterSet const& p); + + // Called once, at start of the job + virtual void beginJob() override; + + // Called once per event + virtual void analyze(const art::Event& event) override; + + // Called once, at end of the job + virtual void endJob() override; + + // Calculate the distance from the track crossing point to CRT overlap coordinates + double DistToCrtHit(TVector3 trackPos, sbn::crt::CRTHit crtHit); + + void reconfigure(fhicl::ParameterSet const & p); + + private: + + // fcl file parameters + art::InputTag fSimModuleLabel;///< name of detsim producer + art::InputTag fCRTHitLabel; ///< name of CRT producer + std::vector fTPCTrackLabel; ///< name of CRT producer + art::InputTag fTriggerLabel; ///< labels for trigger + bool fVerbose; ///< print information about what's going on + + CRTT0MatchAlg t0Alg; + + // CRTGeoAlg fCrtGeo; + //TPCGeoAlg fTpcGeo; + + geo::GeometryCore const* fGeometryService; ///< pointer to Geometry provider + icarus::crt::CRTCommonUtils* fCrtutils; + //CRTBackTracker fCrtBackTrack; + icarus::crt::CRTBackTracker bt; + // Histograms + std::map hDCA; + std::map hMatchDCA; + std::map hNoMatchDCA; + + std::map hDoL; + std::map hMatchDoL; + std::map hNoMatchDoL; + + std::map hT0; + std::map hMatchT0; + std::map hNoMatchT0; + + std::map hEffDCATotal; + std::map hEffDCAReco; + std::map hEffDoLTotal; + std::map hEffDoLReco; + std::map hEffLengthTotal; + std::map hEffLengthReco; + + std::map hPurityDCATotal; + std::map hPurityDCAReco; + std::map hPurityDoLTotal; + std::map hPurityDoLReco; + std::map hPurityLengthTotal; + std::map hPurityLengthReco; + + //add trigger data product vars + unsigned int m_gate_type; + std::string m_gate_name; + uint64_t m_trigger_timestamp; + uint64_t m_gate_start_timestamp; + uint64_t m_trigger_gate_diff; + uint64_t m_gate_crt_diff; + }; // class CRTT0MatchingAna + + + CRTT0MatchingAna::CRTT0MatchingAna(fhicl::ParameterSet const& p) + : EDAnalyzer{p} // , + , t0Alg(p.get("t0Alg")) + , fCrtutils(new icarus::crt::CRTCommonUtils()) + , bt(p.get("CRTBackTrack")) + // More initializers here. + { + // Call appropriate consumes<>() for any products to be retrieved by this module. + fGeometryService = lar::providerFrom(); + reconfigure(p); + } + + + // Constructor + void CRTT0MatchingAna::reconfigure(fhicl::ParameterSet const& p) + { + + fSimModuleLabel = p.get ("SimModuleLabel", "largeant"); + fCRTHitLabel = p.get ("CRTHitLabel", "crthit"); + fTPCTrackLabel = p.get< std::vector >("TPCTrackLabel", {""}); + fTriggerLabel = p.get("TriggerLabel","daqTrigger"); + fVerbose = p.get("Verbose"); + } //CRTT0MatchingAna() + + + void CRTT0MatchingAna::beginJob() + { + + // Access tfileservice to handle creating and writing histograms + art::ServiceHandle tfs; + for(int i = 30; i < 50 + 1; i++){ + std::string tagger = "All"; + if (i > 34 && i < 40) continue; + if (i==48 || i==49) continue; + // if(i < ){ + tagger = fCrtutils->GetRegionNameFromNum(i);//fCrtGeo.GetTagger(i).name; + std::cout << "tagger: " << tagger.c_str() << std::endl; + hDCA[tagger] = tfs->make(Form("DCA_%s", tagger.c_str()), "", 50, 0, 100); + hMatchDCA[tagger] = tfs->make(Form("MatchDCA_%s", tagger.c_str()), "", 50, 0, 100); + hNoMatchDCA[tagger] = tfs->make(Form("NoMatchDCA_%s", tagger.c_str()), "", 50, 0, 100); + + hDoL[tagger] = tfs->make(Form("DoL_%s", tagger.c_str()), "", 100, 0, 0.25); + hMatchDoL[tagger] = tfs->make(Form("MatchDoL_%s", tagger.c_str()), "", 100, 0, 0.25); + hNoMatchDoL[tagger] = tfs->make(Form("NoMatchDoL_%s", tagger.c_str()), "", 100, 0, 0.25); + + hT0[tagger] = tfs->make(Form("T0_%s", tagger.c_str()), "", 600, -3000, 3000); + hMatchT0[tagger] = tfs->make(Form("MatchT0_%s", tagger.c_str()), "", 600, -3000, 3000); + hNoMatchT0[tagger] = tfs->make(Form("NoMatchT0_%s", tagger.c_str()), "", 600, -3000, 3000); + + hEffDCATotal[tagger] = tfs->make(Form("EffDCATotal_%s", tagger.c_str()), "", 50, 0, 100); + hEffDCAReco[tagger] = tfs->make(Form("EffDCAReco_%s", tagger.c_str()), "", 50, 0, 100); + hEffDoLTotal[tagger] = tfs->make(Form("EffDoLTotal_%s", tagger.c_str()), "", 100, 0, 0.25); + hEffDoLReco[tagger] = tfs->make(Form("EffDoLReco_%s", tagger.c_str()), "", 100, 0, 0.25); + hEffLengthTotal[tagger] = tfs->make(Form("EffLengthTotal_%s", tagger.c_str()), "", 20, 0, 600); + hEffLengthReco[tagger] = tfs->make(Form("EffLengthReco_%s", tagger.c_str()), "", 20, 0, 600); + + hPurityDCATotal[tagger] = tfs->make(Form("PurityDCATotal_%s", tagger.c_str()), "", 50, 0, 100); + hPurityDCAReco[tagger] = tfs->make(Form("PurityDCAReco_%s", tagger.c_str()), "", 50, 0, 100); + hPurityDoLTotal[tagger] = tfs->make(Form("PurityDoLTotal_%s", tagger.c_str()), "", 100, 0, 0.25); + hPurityDoLReco[tagger] = tfs->make(Form("PurityDoLReco_%s", tagger.c_str()), "", 100, 0, 0.25); + hPurityLengthTotal[tagger] = tfs->make(Form("PurityLengthTotal_%s", tagger.c_str()), "", 20, 0, 600); + hPurityLengthReco[tagger] = tfs->make(Form("PurityLengthReco_%s", tagger.c_str()), "", 20, 0, 600); + } + + // Initial output + if(fVerbose) std::cout<<"----------------- CRT T0 Matching Ana Module -------------------"< trigger_handle; + event.getByLabel( fTriggerLabel, trigger_handle ); + if( trigger_handle.isValid() ) { + sbn::triggerSource bit = trigger_handle->sourceType; + m_gate_type = (unsigned int)bit; + m_gate_name = bitName(bit); + m_trigger_timestamp = trigger_handle->triggerTimestamp; + m_gate_start_timestamp = trigger_handle->beamGateTimestamp; + m_trigger_gate_diff = trigger_handle->triggerTimestamp - trigger_handle->beamGateTimestamp; + + } + else{ + mf::LogError("CRTT0MatchingAna:") << "No raw::Trigger associated to label: " << fTriggerLabel.label() << "\n" ; + } + } + else { + mf::LogError("CRTT0MatchingAna:") << "Trigger Data product " << fTriggerLabel.label() << " not found!\n" ; + } + + // Get g4 particles + art::ServiceHandle pi_serv; + auto particleHandle = event.getValidHandle>(fSimModuleLabel); + + // Get CRT hits from the event + art::Handle< std::vector> crtHitHandle; + std::vector > crtHitList; + if (event.getByLabel(fCRTHitLabel, crtHitHandle)) + art::fill_ptr_vector(crtHitList, crtHitHandle); + + // Get reconstructed tracks from the event + //auto tpcTrackHandle = event.getValidHandle>(fTPCTrackLabel); + // art::FindManyP findManyHits(tpcTrackHandle, event, fTPCTrackLabel); + + // fCrtBackTrack.Initialize(event); + + //---------------------------------------------------------------------------------------------------------- + // TRUTH MATCHING + //---------------------------------------------------------------------------------------------------------- + + std::map particles; + // Loop over the true particles + for (auto const& particle: (*particleHandle)){ + + // Make map with ID + int partID = particle.TrackId(); + particles[partID] = particle; + + } + + if(fVerbose) std::cout<<"----------------- truth matching -------------------"<> crtTaggerMap; + std::vector crtHits; + int hit_i = 0; + double minHitTime = 99999; + double maxHitTime = -99999; + + for(auto const& hit : (*crtHitHandle)){ + double hitTime = double(hit.ts0_ns - (m_gate_start_timestamp%1'000'000'000))/1e3; + if(hitTime<-0.5e6) hitTime+=1e6; + else if(hitTime>0.5e6) hitTime-=1e6; + + // double hitTime = (double)(int)hit.ts1_ns * 1e-3; + if(hitTime < minHitTime) minHitTime = hitTime; + if(hitTime > maxHitTime) maxHitTime = hitTime; + + crtHits.push_back(hit); + int trueId = bt.TrueIdFromHitId(event, hit_i); + hit_i++; + if(trueId == -99999) continue; + if(crtTaggerMap.find(trueId) == crtTaggerMap.end()){ + crtTaggerMap[trueId].push_back(hit.tagger); + } + else if(std::find(crtTaggerMap[trueId].begin(), crtTaggerMap[trueId].end(), hit.tagger) == crtTaggerMap[trueId].end()){ + crtTaggerMap[trueId].push_back(hit.tagger); + } + } + + // std::cout << " New event" << std::endl; + //---------------------------------------------------------------------------------------------------------- + // DISTANCE OF CLOSEST APPROACH ANALYSIS + //---------------------------------------------------------------------------------------------------------- + + auto const clockData = art::ServiceHandle()->DataFor(event); + auto const detProp = art::ServiceHandle()->DataFor(event, clockData); + + // if(fVerbose) std::cout<<"----------------- DCA Analysis -------------------"<>(trackLabel); + if (!tpcTrackHandle.isValid()) continue; + + art::FindManyP findManyHits(tpcTrackHandle, event, trackLabel); + + // Loop over reconstructed tracks + for (auto const& tpcTrack : (*tpcTrackHandle)){ + // std::cout<<"----------------- why only 4 times -------------------" <> hits = findManyHits.at(tpcTrack.ID()); + int trackTrueID = RecoUtils::TrueParticleIDFromTotalRecoHits(clockData, hits, false); + if(particles.find(trackTrueID) == particles.end()) continue; + // Only consider primary muons + if(!(std::abs(particles[trackTrueID].PdgCode()) == 13 && particles[trackTrueID].Mother() == 0)) continue; + + // Only consider particles inside the reco hit time window + double trueTime = particles[trackTrueID].T() * 1e-3; + if(trueTime < minHitTime || trueTime > maxHitTime) continue; + //if(fVerbose) std::cout<<"----------------- line 315 -------------------"< closestvec = t0Alg.GetClosestCRTHit(detProp, tpcTrack, crtHits, event); + //matchCand closest = closestvec.back(); + //std::cout << "closest match " << closest.t0 << std::endl; + //std::cout << "closest dca " << closest.dca << " ,tagger: "<< closest.thishit.tagger << " , sin angele: \t" << closest.dca/closest.extrapLen << std::endl; + double sin_angle = -99999; + if(closest.dca != DBL_MIN){ + hDCA[closest.thishit.tagger]->Fill(closest.dca); + //hDCA["All"]->Fill(closest.dca); + sin_angle = closest.dca/closest.extrapLen; + hDoL[closest.thishit.tagger]->Fill(sin_angle); + // hDoL["All"]->Fill(sin_angle); + hT0[closest.thishit.tagger]->Fill(closest.t0); + //hT0["All"]->Fill(closest.t0); + //std::cout<< "tagger: "<< closest.thishit.tagger << " , sin angele: \t" << sin_angle << std::endl; + + // Is hit matched to that track + int hitTrueID = bt.TrueIdFromTotalEnergy(event, closest.thishit); + if(hitTrueID == trackTrueID && hitTrueID != -99999){ + hMatchDCA[closest.thishit.tagger]->Fill(closest.dca); + //hMatchDCA["All"]->Fill(closest.dca); + hMatchDoL[closest.thishit.tagger]->Fill(sin_angle); + //hMatchDoL["All"]->Fill(sin_angle); + hMatchT0[closest.thishit.tagger]->Fill(closest.t0); + //hMatchT0["All"]->Fill(closest.t0); + } + else{ + hNoMatchDCA[closest.thishit.tagger]->Fill(closest.dca); + //hNoMatchDCA["All"]->Fill(closest.dca); + hNoMatchDoL[closest.thishit.tagger]->Fill(sin_angle); + // hNoMatchDoL["All"]->Fill(sin_angle); + hNoMatchT0[closest.thishit.tagger]->Fill(closest.t0); + // hNoMatchT0["All"]->Fill(closest.t0); + } + //std::cout<< "---------> 2nd line tagger: "<< closest.thishit.tagger << " , sin angele: \t" << sin_angle << std::endl; + }else continue; + //if(fVerbose) std::cout<<"----------------- line 350 -------------------"<second->GetNbinsX(); + for(int i = 0; i < nbins; i++){ + double DCAcut = hEffDCATotal.begin()->second->GetBinCenter(i); + + // Fill total efficiency histogram with each cut if track matches any hits + if(crtTaggerMap.find(trackTrueID) != crtTaggerMap.end()){ + for(auto const& tagger : crtTaggerMap[trackTrueID]){ + hEffDCATotal[tagger]->Fill(DCAcut); + + // If closest hit is below limit and track matches any hits then fill efficiency + if(closest.dca < DCAcut && closest.dca != DBL_MIN){ + hEffDCAReco[tagger]->Fill(DCAcut); + } + } + // Fill total efficiency histograms + // hEffDCATotal["All"]->Fill(DCAcut); + if(closest.dca < DCAcut && closest.dca != DBL_MIN){ + // hEffDCAReco["All"]->Fill(DCAcut); + } + } + + // Fill total purity histogram with each cut if closest hit is below limit + if(closest.dca < DCAcut && closest.dca != DBL_MIN){ + hPurityDCATotal[closest.thishit.tagger]->Fill(DCAcut); + // hPurityDCATotal["All"]->Fill(DCAcut); + + // If closest hit is below limit and matched time is correct then fill purity + double hitTime = closest.thishit.ts1_ns * 1e-3; + if(particles.find(trackTrueID) != particles.end()){ + if(std::abs(hitTime - trueTime) < 2.){ + hPurityDCAReco[closest.thishit.tagger]->Fill(DCAcut); + // hPurityDCAReco["All"]->Fill(DCAcut); + } + } + + } + } + + nbins = hEffDoLTotal.begin()->second->GetNbinsX(); + //if(fVerbose) std::cout<<"----------------- line 390 -------------------"<second->GetBinCenter(i); + + // Fill total efficiency histogram with each cut if track matches any hits + if(crtTaggerMap.find(trackTrueID) != crtTaggerMap.end()){ + for(auto const& tagger : crtTaggerMap[trackTrueID]){ + hEffDoLTotal[tagger]->Fill(DCAcut); + + // If closest hit is below limit and track matches any hits then fill efficiency + if(sin_angle < DCAcut && closest.dca != DBL_MIN){ + hEffDoLReco[tagger]->Fill(DCAcut); + } + } + // Fill total efficiency histograms + // hEffDoLTotal["All"]->Fill(DCAcut); + if(sin_angle < DCAcut && closest.dca != DBL_MIN){ + // hEffDoLReco["All"]->Fill(DCAcut); + } + } + + // Fill total purity histogram with each cut if closest hit is below limit + if(sin_angle < DCAcut && closest.dca != DBL_MIN){ + hPurityDoLTotal[closest.thishit.tagger]->Fill(DCAcut); + // hPurityDoLTotal["All"]->Fill(DCAcut); + + // If closest hit is below limit and matched time is correct then fill purity + double hitTime = closest.thishit.ts1_ns * 1e-3; + if(particles.find(trackTrueID) != particles.end()){ + if(std::abs(hitTime - trueTime) < 2.){ + hPurityDoLReco[closest.thishit.tagger]->Fill(DCAcut); + // hPurityDoLReco["All"]->Fill(DCAcut); + } + } + + } + } + + double fixedCut = 30.; + + // Fill total efficiency histogram with each cut if track matches any hits + if(crtTaggerMap.find(trackTrueID) != crtTaggerMap.end()){ + for(auto const& tagger : crtTaggerMap[trackTrueID]){ + hEffLengthTotal[tagger]->Fill(tpcTrack.Length()); + + // If closest hit is below limit and track matches any hits then fill efficiency + if(closest.dca < fixedCut && closest.dca >=0 ){ + hEffLengthReco[tagger]->Fill(tpcTrack.Length()); + } + } + // Fill total efficiency histograms + // hEffLengthTotal["All"]->Fill(tpcTrack.Length()); + if(closest.dca < fixedCut && closest.dca >=0){ + //hEffLengthReco["All"]->Fill(tpcTrack.Length()); + } + } + + // Fill total purity histogram with each cut if closest hit is below limit + if(closest.dca < fixedCut && closest.dca >= 0){ + hPurityLengthTotal[closest.thishit.tagger]->Fill(tpcTrack.Length()); + // hPurityLengthTotal["All"]->Fill(tpcTrack.Length()); + + // If closest hit is below limit and matched time is correct then fill purity + double hitTime = closest.thishit.ts1_ns * 1e-3; + if(particles.find(trackTrueID) != particles.end()){ + double trueTime = particles[trackTrueID].T() * 1e-3; + if(std::abs(hitTime - trueTime) < 2.){ + hPurityLengthReco[closest.thishit.tagger]->Fill(tpcTrack.Length()); + // hPurityLengthReco["All"]->Fill(tpcTrack.Length()); + } + } + + } + // if(fVerbose) std::cout<<"----------------- line 463 -------------------"< +#include +#include +#include +#include + +// LArSoft +#include "larcore/Geometry/Geometry.h" +#include "larcorealg/Geometry/GeometryCore.h" +#include "larcorealg/Geometry/PlaneGeo.h" +#include "larcorealg/Geometry/WireGeo.h" +#include "lardataobj/AnalysisBase/T0.h" +#include "lardataobj/RecoBase/Hit.h" +#include "lardataobj/RecoBase/Track.h" +#include "larcore/CoreUtils/ServiceUtil.h" // lar::providerFrom() +#include "lardata/Utilities/AssociationUtil.h" +#include "lardata/DetectorInfoServices/LArPropertiesService.h" +#include "lardata/DetectorInfoServices/DetectorPropertiesService.h" +#include "lardataobj/RawData/ExternalTrigger.h" +#include "larcoreobj/SimpleTypesAndConstants/PhysicalConstants.h" +#include "lardataobj/AnalysisBase/ParticleID.h" +#include "larsim/MCCheater/BackTrackerService.h" +#include "sbnobj/Common/Trigger/ExtraTriggerInfo.h" +#include "lardataobj/RecoBase/PFParticle.h" +#include "lardataobj/AnalysisBase/T0.h" +#include "lardataobj/RecoBase/PFParticleMetadata.h" +// ROOT +#include "TVector3.h" +#include "TH1.h" +#include "TH2.h" +#include "TVector3.h" +#include "TTree.h" + +namespace icarus { + + class CRTT0Matching : public art::EDProducer { + public: + + explicit CRTT0Matching(fhicl::ParameterSet const & p); + + // The destructor generated by the compiler is fine for classes + // without bare pointers or other resource use. + + // Plugins should not be copied or assigned. + CRTT0Matching(CRTT0Matching const &) = delete; + CRTT0Matching(CRTT0Matching &&) = delete; + CRTT0Matching & operator = (CRTT0Matching const &) = delete; + CRTT0Matching & operator = (CRTT0Matching &&) = delete; + + // Required functions. + void produce(art::Event & e) override; + + // Selected optional functions. + void beginJob() override; + + void endJob() override; + + void reconfigure(fhicl::ParameterSet const & p); + + private: + + // Params got from fcl file....... + // art::InputTag fTpcTrackModuleLabel; ///< name of track producer + std::vector fTpcTrackModuleLabel; ///< name of track producer + std::vector fPFParticleLabel; ///< labels for source of PFParticle + art::InputTag fCrtHitModuleLabel; ///< name of crt producer + art::InputTag fTriggerLabel; ///< labels for trigger + CRTT0MatchAlg t0Alg; + + + geo::GeometryCore const* fGeometryService; ///< pointer to Geometry provider + icarus::crt::CRTCommonUtils* fCrtutils; + // CRTCommonUtils* fCrtutils; + + TTree* fTree; + int fEvent; ///< number of the event being processed + int fRun; ///< number of the run being processed + int fSubRun; ///< number of the sub-run being processed + vector fCrtRegion; //CRT hit region code + vector fDCA; //CRT hit region code + vector fDOL; //CRT hit region code + vector fT0; //CRT hit region code + vector ftpcx; // x-position from tpc + vector ftpcy; // y-position from tpc + vector ftpcz; // z-position from tpc + vector fcrtx; // x-position from crt + vector fcrty; // y-position from crt + vector fcrtz; // z-position from crt + vector fpandorat0; ///< Track T0 based on Pandora (Cathode Crossing Track) + vector fcryo; ///< cryo number + vector fntracks; ///< total number of tracks + + //add trigger data product vars + unsigned int m_gate_type; + std::string m_gate_name; + uint64_t m_trigger_timestamp; + uint64_t m_gate_start_timestamp; + uint64_t m_trigger_gate_diff; + uint64_t m_gate_crt_diff; + + + // Histograms + std::map hDCA; + std::map hMatchDCA; + std::map hNoMatchDCA; + + std::map hDoL; + std::map hMatchDoL; + std::map hNoMatchDoL; + + std::map hT0; + std::map hMatchT0; + std::map hNoMatchT0; + }; // class CRTT0Matching + + + CRTT0Matching::CRTT0Matching(fhicl::ParameterSet const & p) + : EDProducer(p), t0Alg(p.get("T0Alg")) + , fCrtutils(new icarus::crt::CRTCommonUtils()) + // Initialize member data here, if know don't want to reconfigure on the fly + { + + // Call appropriate produces<>() functions here. + produces< std::vector >(); + produces< art::Assns >(); + produces< art::Assns >(); + + fGeometryService = lar::providerFrom(); + reconfigure(p); + + } // CRTT0Matching() + + + void CRTT0Matching::reconfigure(fhicl::ParameterSet const & p) + { + fTpcTrackModuleLabel = p.get< std::vector>("TpcTrackModuleLabel", {"pandoraTrackGausCryoE"}); + fCrtHitModuleLabel = p.get ("CrtHitModuleLabel", "crthit"); + fPFParticleLabel = p.get< std::vector >("PFParticleLabel", {""}); + fTriggerLabel = p.get("TriggerLabel","daqTrigger"); + } // CRTT0Matching::reconfigure() + + + void CRTT0Matching::beginJob() + { + // Access tfileservice to handle creating and writing histograms + art::ServiceHandle tfs; + + fTree = tfs->make("matchTree","CRTHit - TPC track matching analysis"); + + fTree->Branch("Event", &fEvent, "Event/I"); + fTree->Branch("SubRun", &fSubRun, "SubRun/I"); + fTree->Branch("Run", &fRun, "Run/I"); + fTree->Branch("crtRegion", "std::vector", &fCrtRegion); + fTree->Branch("DCA", "std::vector", &fDCA); + fTree->Branch("DOL", "std::vector", &fDOL); + fTree->Branch("t0", "std::vector", &fT0); + fTree->Branch("tpcx", "std::vector", &ftpcx); + fTree->Branch("tpcy", "std::vector", &ftpcy); + fTree->Branch("tpcz", "std::vector", &ftpcz); + fTree->Branch("crtx", "std::vector", &fcrtx); + fTree->Branch("crty", "std::vector", &fcrty); + fTree->Branch("crtz", "std::vector", &fcrtz); + fTree->Branch("cryo", "std::vector", &fcryo); + fTree->Branch("ntracks", "std::vector", &fntracks); + fTree->Branch("pandorat0", "std::vector", &fpandorat0); + fTree->Branch("gate_type", &m_gate_type, "gate_type/b"); + fTree->Branch("gate_name", &m_gate_name); + fTree->Branch("trigger_timestamp", &m_trigger_timestamp, "trigger_timestamp/l"); + fTree->Branch("gate_start_timestamp", &m_gate_start_timestamp, "gate_start_timestamp/l"); + fTree->Branch("trigger_gate_diff", &m_trigger_gate_diff, "trigger_gate_diff/l"); + fTree->Branch("gate_crt_diff",&m_gate_crt_diff, "gate_crt_diff/l"); + + for(int i = 30; i < 50 + 1; i++){ + std::string tagger = "All"; + if (i >= 35 && i < 40) continue; + if (i==48 || i==49) continue; + // if(i < ){ + tagger = fCrtutils->GetRegionNameFromNum(i);//fCrtGeo.GetTagger(i).name; + // std::cout << "tagger: " << tagger.c_str() << std::endl; + hDCA[tagger] = tfs->make(Form("DCA_%s", tagger.c_str()), "", 50, 0, 100); + hDoL[tagger] = tfs->make(Form("DoL_%s", tagger.c_str()), "", 100, 0, 0.25); + hT0[tagger] = tfs->make(Form("T0_%s", tagger.c_str()), "", 600, -3000, 3000); + } + + } // CRTT0Matching::beginJob() + + void CRTT0Matching::produce(art::Event & event) + { + fDCA.clear(); + fDOL.clear(); + fT0.clear(); + fcrtx.clear(); + fcrty.clear(); + fcrtz.clear(); + ftpcx.clear(); + ftpcy.clear(); + ftpcz.clear(); + fCrtRegion.clear(); + fpandorat0.clear(); + fcryo.clear(); + fntracks.clear(); + fEvent = event.id().event(); + fRun = event.run(); + fSubRun = event.subRun(); + + // Create anab::T0 objects and make association with recob::Track + std::unique_ptr< std::vector > T0col( new std::vector); + std::unique_ptr< art::Assns > Trackassn( new art::Assns); + std::unique_ptr< art::Assns > t0_crthit_assn( new art::Assns ); + + //add trigger info + if( !fTriggerLabel.empty() ) { + + art::Handle trigger_handle; + event.getByLabel( fTriggerLabel, trigger_handle ); + if( trigger_handle.isValid() ) { + sbn::triggerSource bit = trigger_handle->sourceType; + m_gate_type = (unsigned int)bit; + m_gate_name = bitName(bit); + m_trigger_timestamp = trigger_handle->triggerTimestamp; + m_gate_start_timestamp = trigger_handle->beamGateTimestamp; + m_trigger_gate_diff = trigger_handle->triggerTimestamp - trigger_handle->beamGateTimestamp; + + } + else{ + mf::LogError("CRTT0Matching:") << "No raw::Trigger associated to label: " << fTriggerLabel.label() << "\n" ; + } + } + else { + mf::LogError("CRTT0Matching:") << "Trigger Data product " << fTriggerLabel.label() << " not found!\n" ; + } + + // Retrieve CRT hit list + art::Handle> crtListHandle; + std::vector> crtList; + if(event.getByLabel(fCrtHitModuleLabel, crtListHandle)) + art::fill_ptr_vector(crtList, crtListHandle); + + std::vector crtHits; + for (auto const& crtHit : crtList){ + crtHits.push_back(*crtHit); + } + + // Retrieve track list + for(const auto& trackLabel : fTpcTrackModuleLabel){ + + auto it = &trackLabel - fTpcTrackModuleLabel.data(); + + art::Handle< std::vector > trackListHandle; + std::vector > trackList; + if (event.getByLabel(trackLabel,trackListHandle)) + art::fill_ptr_vector(trackList, trackListHandle); + + // if (event.getByLabel(fTpcTrackModuleLabel,trackListHandle)) + // std::cout << "crtlabel: " << fCrtHitModuleLabel << " , Tpctrklabel: " << fTpcTrackModuleLabel << std::endl; + + mf::LogInfo("CRTT0Matching") + <<"Number of reconstructed tracks = "<ID()<<" with DCA = "<push_back(anab::T0(closest.t0*1e3, trackList[track_i]->ID(), closest.thishit.plane, (int)closest.extrapLen, closest.dca)); + util::CreateAssn(*this, event, *T0col, trackList[track_i], *Trackassn); + + //std::cout << "---------------------- line #156 " << std::endl; + double sin_angle = -99999; +// if(closest.dca != -99999){ + auto start = trackList[track_i]->Vertex(); + //auto end = trackList[track_i]->End(); + hDCA[closest.thishit.tagger]->Fill(closest.dca); + //hDCA["All"]->Fill(closest.dca); + sin_angle = closest.dca/closest.extrapLen; + hDoL[closest.thishit.tagger]->Fill(sin_angle); + // hDoL["All"]->Fill(sin_angle); + hT0[closest.thishit.tagger]->Fill(closest.t0); + fDCA.push_back(closest.dca); + fDOL.push_back(sin_angle); + fT0.push_back(closest.t0); + fcryo.push_back(cryoNumber); + fpandorat0.push_back(t0); + ftpcx.push_back(start.X()); + ftpcy.push_back(start.Y()); + ftpcz.push_back(start.Z()); + fcrtx.push_back(closest.thishit.x_pos); + fcrty.push_back(closest.thishit.y_pos); + fcrtz.push_back(closest.thishit.z_pos); + // fCrtRegion.push_back(closest.thishit.tagger); + fCrtRegion.push_back(fCrtutils->AuxDetRegionNameToNum(closest.thishit.tagger)); +// } + //find this CRThit in the collection + // note this does not work (both the loop and the assoc !!) + unsigned CRThitIndex = std::numeric_limits::max(); + for (int ic=0; ic<(int)crtList.size(); ++ic){ + if (crtList[ic]->ts0_ns==closest.thishit.ts0_ns && crtList[ic]->z_pos==closest.thishit.z_pos && crtList[ic]->peshit==closest.thishit.peshit) + CRThitIndex=ic; + // std::cout << "CRThitIndex: \t" << CRThitIndex << std::endl; + } + if (CRThitIndex != std::numeric_limits::max()){ + // std::cout <<"CRThitIndex: " << CRThitIndex << " passed......: \t" << std::endl; + util::CreateAssn(*this, event, *T0col, crtList[CRThitIndex], *t0_crthit_assn); + } + } // DCA check + + } // Loop over tracks + + } // Validity check + + } // all track labels in a vector + event.put(std::move(T0col)); + event.put(std::move(Trackassn)); + event.put(std::move(t0_crthit_assn)); + fTree->Fill(); + } // CRTT0Matching::produce() + + + void CRTT0Matching::endJob() + { + + } // CRTT0Matching::endJob() + + + DEFINE_ART_MODULE(CRTT0Matching) + +} // sbnd namespace + +namespace { + +} diff --git a/icaruscode/CRT/crtt0matching_icarus.fcl b/icaruscode/CRT/crtt0matching_icarus.fcl new file mode 100644 index 000000000..a5f1152ea --- /dev/null +++ b/icaruscode/CRT/crtt0matching_icarus.fcl @@ -0,0 +1,90 @@ +# A script to run the producer module: CRTT0Matching + +#include "services_icarus_simulation.fcl" +#include "services_common_icarus.fcl" +#include "crtbacktracker_icarus.fcl" +#include "crtt0matchingalg_icarus.fcl" +#include "simulationservices_icarus.fcl" + + + +##include "messages_icarus.fcl" +##include "services_icarus.fcl" +##include "signalservices_icarus.fcl" +##include "sam_icarus.fcl" +##include "backtrackerservice.fcl" +##include "particleinventoryservice.fcl" + +#include "crtt0producer_icarus.fcl" + +##include "rootoutput_icarus.fcl" + +process_name: CRTT0Matching + +services: +{ + # Load the service that manages root files for histograms. + TFileService: { fileName: "crtt0_hist.root" } + # ParticleInventoryService: @local::standard_particleinventoryservice + #BackTrackerService: @local::standard_backtrackerservice +# CRTBackTrack: @local::standard_crtbacktracker + # This parameter controls the level of descriptive output from various LArSoft modules. + message: @local::icarus_message_services_prod_debug + @table::icarus_common_services + + #FileCatalogMetadata: @local::icarus_file_catalog_mc # from sam_icarus.fcl + # @table::icarus_services + # @table::icarus_random_services # from services_icarus.fcl + + # This following line defines many default LArSoft resources for this job. + # SignalShapingServiceICARUS: @local::icarus_signalshapingservice # from signalservices_icarus.fcl + +} # services + +services.SpaceChargeService: @local::icarus_spacecharge + +# The 'source' section tells the script to expect an input file with art::Event records. +source: +{ + module_type: RootInput + + # Number of events to analyze; "-1" means all of the events in the input + # file. You can override this value with the "-n" option on the command line. + maxEvents: -1 + +} + +# This is empty, because we're not writing an output file with art::Event objects. +outputs: +{ + out1: + { + module_type: RootOutput + fileName: "%ifb_%tc_reco.root" + dataTier: "reconstructed" + saveMemoryObjectThreshold: 0 + compressionLevel: 1 + fastCloning: false + } +} + +# The 'physics' section defines and configures some modules to do work on each event. +physics: +{ + producers: + { + CRTT0Matching: @local::standard_crtt0producer + } + + # Schedule job step(s) for execution by defining the analysis module for this job. + reco: [ CRTT0Matching ] + + stream1: [ out1 ] + + trigger_paths: [reco] + + # "end_paths" is a keyword and contains the modules that do not modify the art::Event; + # i.e., analyzers and output streams. + end_paths: [ stream1 ] + +} diff --git a/icaruscode/CRT/crtt0producer_icarus.fcl b/icaruscode/CRT/crtt0producer_icarus.fcl new file mode 100644 index 000000000..0593b053d --- /dev/null +++ b/icaruscode/CRT/crtt0producer_icarus.fcl @@ -0,0 +1,33 @@ +#include "crtbacktracker_icarus.fcl" +#include "crtt0matchingalg_icarus.fcl" + +BEGIN_PROLOG + +standard_crtt0producer: +{ + module_type: "icaruscode/CRT/CRTT0Matching" + CrtHitModuleLabel: "crthit" # name of crt hit producer + TpcTrackModuleLabel: ["pandoraTrackGausCryoE", "pandoraTrackGausCryoW"] # name of tpc track producer + PFParticleLabel: ["pandoraGausCryoE", "pandoraGausCryoW"] # PFParticle producer module label + TriggerLabel: "daqTrigger" + T0Alg: @local::standard_crtt0matchingalg + CRTBackTrack: @local::standard_crtbacktracker +} + +standard_crtt0producerW: +{ + @table::standard_crtt0producer + TpcTrackModuleLabel: ["pandoraTrackGausCryoW"] # name of tpc track producer + PFParticleLabel: ["pandoraGausCryoW"] # PFParticle producer module label + T0Alg: @local::standard_crtt0matchingalgW +} + +standard_crtt0producerE: +{ + @table::standard_crtt0producer + TpcTrackModuleLabel: ["pandoraTrackGausCryoE"] # name of tpc track producer + PFParticleLabel: ["pandoraGausCryoE"] # PFParticle producer module label + T0Alg: @local::standard_crtt0matchingalgE +} + +END_PROLOG From 37eaf3ecd1350579214fd676d51b5bb82e22518e Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Mon, 20 Jan 2025 16:57:12 +0100 Subject: [PATCH 22/28] This commit include a reverse on the CRTTPCMatchingInfo IcarusObj. The information which were need have been added to an SBNObj (CRTT0TaggingInfo). In this way this object is not changed wrt legacy CRTTagging code. Additionally in this commit In the CRTT0TaggingInfo also the way the track was fitted is stored. --- icaruscode/CRT/CRTT0Tagging_module.cc | 12 +++--- icaruscode/IcarusObj/CRTTPCMatchingInfo.h | 45 +++++------------------ icaruscode/IcarusObj/classes_def.xml | 22 ++--------- 3 files changed, 19 insertions(+), 60 deletions(-) diff --git a/icaruscode/CRT/CRTT0Tagging_module.cc b/icaruscode/CRT/CRTT0Tagging_module.cc index f894b7d2b..8ecf03981 100644 --- a/icaruscode/CRT/CRTT0Tagging_module.cc +++ b/icaruscode/CRT/CRTT0Tagging_module.cc @@ -6,7 +6,7 @@ #include "sbnobj/Common/CRT/CRTHit.hh" #include "icaruscode/CRT/CRTUtils/CRTMatchingUtils.h" -#include "icaruscode/IcarusObj/CRTTPCMatchingInfo.h" +#include "sbnobj/Common/CRT/CRTT0TaggingInfo.hh" #include "icaruscode/CRT/CRTUtils/RecoUtils.h" #include "icaruscode/CRT/CRTUtils/CRTCommonUtils.h" // Framework includes @@ -164,7 +164,7 @@ icarus::crt::CRTT0Tagging::CRTT0Tagging(fhicl::ParameterSet const& p) produces< std::vector >(); produces< art::Assns >(); produces< art::Assns >(); - produces< std::vector >(); + produces< std::vector >(); //produces< art::Assns >(); //produces< art::Assns >(); //produces< art::Assns >(); @@ -243,7 +243,7 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) auto t0col = std::make_unique< std::vector > (); auto trackAssn = std::make_unique< art::Assns >(); auto t0CrtHitAssn = std::make_unique< art::Assns >(); - auto matchInfoCol = std::make_unique< std::vector >(); + auto matchInfoCol = std::make_unique< std::vector >(); //auto t0matchInfoAssn = std::make_unique< art::Assns >(); //auto trackMatchInfoAssn = std::make_unique< art::Assns >(); //auto matchInfoCrtHitAssn = std::make_unique< art::Assns >(); @@ -505,7 +505,6 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) fFirstEigenValue=driftedMatchedPCAResults.eigenValue1; fSecondEigenValue=driftedMatchedPCAResults.eigenValue2; fThirdEigenValue=driftedMatchedPCAResults.eigenValue3; - std::cout<Fill(); + + sbn::crt::CRTTaggingTrackFit trackFit = sbn::crt::CRTTaggingTrackFit::pca; + mf::LogInfo("CRTT0Tagging") <<"Matched CRT time = "<addSingle(trkPtr, newT0ptr); t0CrtHitAssn->addSingle(bestCrtCand.ptrCRThit, newT0ptr); - icarus::CRTTPCMatchingInfo matchInfo {bestCrtCand.distance, matchedSys, bestCrtCand.CRThit.plane, bestCrtCand.CRThit.ts1_ns, bestCrtCand.delta.X(), bestCrtCand.delta.Y(), bestCrtCand.delta.Z(), bestCrtCand.crossPoint.X(), bestCrtCand.crossPoint.Y(), bestCrtCand.crossPoint.Z(), bestCrtCand.plane}; + sbn::crt::CRTT0TaggingInfo matchInfo {bestCrtCand.distance, matchedSys, bestCrtCand.CRThit.plane, bestCrtCand.CRThit.ts1_ns, bestCrtCand.delta.X(), bestCrtCand.delta.Y(), bestCrtCand.delta.Z(), bestCrtCand.crossPoint.X(), bestCrtCand.crossPoint.Y(), bestCrtCand.crossPoint.Z(), trackFit, bestCrtCand.plane, trueMatch}; matchInfoCol->push_back(matchInfo); } } // End of Track Loop diff --git a/icaruscode/IcarusObj/CRTTPCMatchingInfo.h b/icaruscode/IcarusObj/CRTTPCMatchingInfo.h index 8e420104a..a4522a7ee 100644 --- a/icaruscode/IcarusObj/CRTTPCMatchingInfo.h +++ b/icaruscode/IcarusObj/CRTTPCMatchingInfo.h @@ -24,47 +24,20 @@ struct icarus::CRTTPCMatchingInfo { /// Magic value denoting the absence of DCA information. static constexpr double NoDistance = std::numeric_limits::lowest(); - static constexpr double NoTime = std::numeric_limits::lowest(); - - /// Magic value denoting the absence of CRTs. - static constexpr int NoCRT = std::numeric_limits::lowest(); - - /// Magic value denoting the absence of CRT Plane. - static constexpr int NoPlane = std::numeric_limits::lowest(); - + // --- BEGIN -- Data members ------------------------------------------------- /// Distance of closest approach between track extension and CRT hit [cm] - double trackCrtHitDistance = NoDistance; - - /// Matched CRT Hit sub detector: 0 Top, 1 Side, 2 Bottom - int crtSys = NoCRT; - - /// Matched CRT Hit region: 30-34 Top CRT, 40-48 Side CRT, 50 Bottom CRT - int crtRegion = NoCRT; - - /// Matched CRT Hit time w.r.t. trigger [ns] - double crtTime = NoTime; - - /// Distance distinguished into its components DX, DY, DZ [cm] - double deltaX = NoDistance; - double deltaY = NoDistance; - double deltaZ = NoDistance; - - /// Extrapolated Track Projection Crossing Point onto the CRT Plane - double crossX = NoDistance; - double crossY = NoDistance; - double crossZ = NoDistance; - - /// Fix Coordinate for the CRT Plane: - /// For Top CRT region 30 Y coordinate is constant: plane=0 - /// For Top CRT region 31/32 and Side CRT 40/41/42/43/44/45 X coordinate is constant: plane=1 - /// For Top CRT region 33/34 and Side CRT 46/47 Z coordinate is constant: plane=2 - int plane=NoPlane; - + double DCA = NoDistance; + + /// How far the track extension meets the relevant CRT plane [cm] + double extrapLength = NoDistance; + // --- END ---- Data members ------------------------------------------------- - + + + }; // icarus::CRTTPCMatchingInfo diff --git a/icaruscode/IcarusObj/classes_def.xml b/icaruscode/IcarusObj/classes_def.xml index 3b2752bd4..5c32eb98c 100644 --- a/icaruscode/IcarusObj/classes_def.xml +++ b/icaruscode/IcarusObj/classes_def.xml @@ -66,22 +66,11 @@ - - - + - - - - + - - From 1edc609b6de6187185c7c00eb916571552f82077 Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Mon, 20 Jan 2025 17:36:28 +0100 Subject: [PATCH 23/28] added the matching method, single crt hits (icarus like) or with crttracks (SBND like) --- icaruscode/CRT/CRTT0Tagging_module.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/icaruscode/CRT/CRTT0Tagging_module.cc b/icaruscode/CRT/CRTT0Tagging_module.cc index 8ecf03981..054ab3a2e 100644 --- a/icaruscode/CRT/CRTT0Tagging_module.cc +++ b/icaruscode/CRT/CRTT0Tagging_module.cc @@ -518,7 +518,8 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) fTrueMatch=trueMatch; fTree->Fill(); - sbn::crt::CRTTaggingTrackFit trackFit = sbn::crt::CRTTaggingTrackFit::pca; + sbn::crt::CRTTaggingTrackFit trackFit = sbn::crt::CRTTaggingTrackFit::pca; + sbn::crt::CRTTaggingMethod matchMethod = sbn::crt::CRTTaggingMethod::crtHits; mf::LogInfo("CRTT0Tagging") <<"Matched CRT time = "<addSingle(trkPtr, newT0ptr); t0CrtHitAssn->addSingle(bestCrtCand.ptrCRThit, newT0ptr); - sbn::crt::CRTT0TaggingInfo matchInfo {bestCrtCand.distance, matchedSys, bestCrtCand.CRThit.plane, bestCrtCand.CRThit.ts1_ns, bestCrtCand.delta.X(), bestCrtCand.delta.Y(), bestCrtCand.delta.Z(), bestCrtCand.crossPoint.X(), bestCrtCand.crossPoint.Y(), bestCrtCand.crossPoint.Z(), trackFit, bestCrtCand.plane, trueMatch}; + sbn::crt::CRTT0TaggingInfo matchInfo {bestCrtCand.distance, matchedSys, bestCrtCand.CRThit.plane, bestCrtCand.CRThit.ts1_ns, bestCrtCand.delta.X(), bestCrtCand.delta.Y(), bestCrtCand.delta.Z(), bestCrtCand.crossPoint.X(), bestCrtCand.crossPoint.Y(), bestCrtCand.crossPoint.Z(), bestCrtCand.plane, trackFit, matchMethod, trueMatch}; matchInfoCol->push_back(matchInfo); } } // End of Track Loop From 6c6752700524997402cb920845304386699b7cf1 Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Mon, 20 Jan 2025 19:36:58 +0100 Subject: [PATCH 24/28] I (quote) think (quote) that I removed the CRTT0Matching module frome the Stage1 definitions and included the new CRTT0Tagging one --- fcl/reco/Definitions/stage1_icarus_defs.fcl | 13 ++- .../Run1/stage1_multiTPC_icarus_gauss.fcl | 2 +- ..._multiTPC_nofilter_icarus_gauss_crtpmt.fcl | 2 +- fcl/reco/Stage1/Run2/stage1_run2_icarus.fcl | 2 +- icaruscode/CRT/CMakeLists.txt | 92 +----------------- icaruscode/CRT/CRTLegacyCode/CMakeLists.txt | 93 +++++++++++++++++++ .../CRTT0MatchingAna_module.cc | 0 .../CRTT0Matching_module.cc | 0 .../CRTTzeroProducer_module.cc | 0 .../crtt0matching_icarus.fcl | 0 .../crtt0matchingana_icarus.fcl | 0 .../crtt0producer_icarus.fcl | 0 .../crttzeroproducer_icarus.fcl | 0 13 files changed, 107 insertions(+), 97 deletions(-) create mode 100644 icaruscode/CRT/CRTLegacyCode/CMakeLists.txt rename icaruscode/CRT/{ => CRTLegacyCode}/CRTT0MatchingAna_module.cc (100%) rename icaruscode/CRT/{ => CRTLegacyCode}/CRTT0Matching_module.cc (100%) rename icaruscode/CRT/{ => CRTLegacyCode}/CRTTzeroProducer_module.cc (100%) rename icaruscode/CRT/{ => CRTLegacyCode}/crtt0matching_icarus.fcl (100%) rename icaruscode/CRT/{ => CRTLegacyCode}/crtt0matchingana_icarus.fcl (100%) rename icaruscode/CRT/{ => CRTLegacyCode}/crtt0producer_icarus.fcl (100%) rename icaruscode/CRT/{ => CRTLegacyCode}/crttzeroproducer_icarus.fcl (100%) diff --git a/fcl/reco/Definitions/stage1_icarus_defs.fcl b/fcl/reco/Definitions/stage1_icarus_defs.fcl index dd82375cc..af83cde3d 100644 --- a/fcl/reco/Definitions/stage1_icarus_defs.fcl +++ b/fcl/reco/Definitions/stage1_icarus_defs.fcl @@ -16,8 +16,11 @@ #include "flashmatch_simple_icarus.fcl" #include "crttrackproducer_icarus.fcl" #include "crtbacktracker_icarus.fcl" +### FPoppi : The following CRT matching algorithms are deprecated. #include "crtt0matchingalg_icarus.fcl" #include "crtt0producer_icarus.fcl" +### FPoppi : The following one is mantained. +#include "crtt0tagging.fcl" ## The below can be found from the softlink to Supera in sbncode #include "supera_modules.fcl" #include "crtpmtmatching_parameters.fcl" @@ -65,9 +68,11 @@ icarus_stage1_producers: ## crt producer crttrack: @local::standard_crttrackproducer - CRTT0Matching: @local::standard_crtt0producer - CRTT0MatchingW: @local::standard_crtt0producerW - CRTT0MatchingE: @local::standard_crtt0producerE + ### FPoppi: the following are deprecated (and the one above not mantained) + ## CRTT0Matching: @local::standard_crtt0producer + ## CRTT0MatchingW: @local::standard_crtt0producerW + ## CRTT0MatchingE: @local::standard_crtt0producerE + CRTT0Tagging: @local::icarus_crtt0tagging_data tpcpmtbarycentermatchCryoE: @local::data_tpcpmtbarycentermatchproducer_east tpcpmtbarycentermatchCryoW: @local::data_tpcpmtbarycentermatchproducer_west @@ -223,6 +228,8 @@ icarus_crtt0match: [CRTT0Matching] icarus_crtt0match_eff: [CRTT0MatchingE, CRTT0MatchingW] +icarus_crtt0tagging: [CRTT0Tagging] + ### Below we include overrides for the modules above ## Overrides for filtering of cluster3D hits diff --git a/fcl/reco/Stage1/Run1/stage1_multiTPC_icarus_gauss.fcl b/fcl/reco/Stage1/Run1/stage1_multiTPC_icarus_gauss.fcl index d9ad45958..f8518077f 100644 --- a/fcl/reco/Stage1/Run1/stage1_multiTPC_icarus_gauss.fcl +++ b/fcl/reco/Stage1/Run1/stage1_multiTPC_icarus_gauss.fcl @@ -6,7 +6,7 @@ physics.reco: [ @sequence::icarus_filter_cluster3D, @sequence::icarus_pandora_Gauss, @sequence::icarus_reco_fm, @sequence::icarus_crttrack, - @sequence::icarus_crtt0match, + @sequence::icarus_crtt0tagging, caloskimCalorimetryCryoE, caloskimCalorimetryCryoW] physics.outana: [ caloskimE, caloskimW, simpleLightAna, CRTDataAnalysis] diff --git a/fcl/reco/Stage1/Run1/stage1_multiTPC_nofilter_icarus_gauss_crtpmt.fcl b/fcl/reco/Stage1/Run1/stage1_multiTPC_nofilter_icarus_gauss_crtpmt.fcl index 39d2a83e2..2ac9bd5fb 100644 --- a/fcl/reco/Stage1/Run1/stage1_multiTPC_nofilter_icarus_gauss_crtpmt.fcl +++ b/fcl/reco/Stage1/Run1/stage1_multiTPC_nofilter_icarus_gauss_crtpmt.fcl @@ -6,7 +6,7 @@ physics.reco: [ @sequence::icarus_filter_cluster3D, @sequence::icarus_pandora_Gauss, @sequence::icarus_reco_fm, @sequence::icarus_crttrack, - @sequence::icarus_crtt0match, + @sequence::icarus_crtt0tagging, caloskimCalorimetryCryoE, caloskimCalorimetryCryoW] physics.outana: [ caloskimE, caloskimW, simpleLightAna, CRTDataAnalysis, CRTAnalysis] diff --git a/fcl/reco/Stage1/Run2/stage1_run2_icarus.fcl b/fcl/reco/Stage1/Run2/stage1_run2_icarus.fcl index 40ea40c2a..fdd161499 100644 --- a/fcl/reco/Stage1/Run2/stage1_run2_icarus.fcl +++ b/fcl/reco/Stage1/Run2/stage1_run2_icarus.fcl @@ -7,7 +7,7 @@ physics.reco: [ @sequence::icarus_filter_cluster3D, @sequence::icarus_reco_fm, @sequence::icarus_tpcpmtbarycentermatch, @sequence::icarus_crttrack, - @sequence::icarus_crtt0match, + @sequence::icarus_crtt0tagging, caloskimCalorimetryCryoE, caloskimCalorimetryCryoW] physics.outana: [ @sequence::icarus_analysis_modules ] diff --git a/icaruscode/CRT/CMakeLists.txt b/icaruscode/CRT/CMakeLists.txt index 5f20fd7aa..5c6e34abf 100644 --- a/icaruscode/CRT/CMakeLists.txt +++ b/icaruscode/CRT/CMakeLists.txt @@ -1,6 +1,7 @@ add_subdirectory(CRTUtils) add_subdirectory(CRTDecoder) +add_subdirectory(CRTLegacyCode) art_make( NO_PLUGINS @@ -10,7 +11,6 @@ art_make( CRTDetSim_module.cc CRTSimHitProducer_module.cc CRTTrueHitProducer_module.cc - CRTTzeroProducer_module.cc CRTTrackProducer_module.cc CRTSimAnalysis_module.cc CRTDataAnalysis_module.cc @@ -19,7 +19,6 @@ art_make( CRTAutoVeto_module.cc FlashResAna_module.cc PhotBackground_module.cc - CRTT0Matching_module.cc CRTTPCMatchingAna_module.cc CRTPMTMatchingAna_module.cc CRTTPCTruthEff_module.cc @@ -147,23 +146,6 @@ cet_build_plugin( CRTTrueHitProducer art::module cetlib::cetlib ) -cet_build_plugin(CRTTzeroProducer art::module - LIBRARIES - larcorealg::Geometry - icaruscode_CRT - sbnobj::ICARUS_CRT - sbnobj::Common_CRT - art_root_io::TFileService_service - lardataalg::DetectorInfo - nurandom::RandomUtils_NuRandomService_service - art::Framework_Services_Registry - art::Framework_Services_Optional_RandomNumberGenerator_service - messagefacility::MF_MessageLogger - messagefacility::headers - CLHEP::CLHEP - lardata::Utilities - ) - cet_build_plugin(CRTTrackProducer art::module LIBRARIES larcorealg::Geometry @@ -400,78 +382,6 @@ cet_build_plugin( PhotBackground art::module ROOT::Tree ) -cet_build_plugin(CRTT0Matching art::module - LIBRARIES - icaruscode_CRTData - icaruscode_CRT - sbnobj::Common_CRT - icaruscode_CRTUtils - larcore::Geometry_Geometry_service - larsim::Simulation lardataobj::Simulation - larsim::MCCheater_BackTrackerService_service - larsim::MCCheater_ParticleInventoryService_service - lardata::Utilities - larevt::Filters - lardataobj::RawData - lardataobj::RecoBase - lardataobj::AnalysisBase - lardata::RecoObjects - larpandora::LArPandoraInterface - larcorealg::Geometry - nusimdata::SimulationBase - art::Framework_Core - art::Framework_Principal - art::Framework_Services_Registry - art_root_io::tfile_support - art_root_io::TFileService_service - art::Persistency_Common canvas::canvas - art::Persistency_Provenance - art::Utilities - messagefacility::MF_MessageLogger - ROOT::Core - ROOT::Geom - ROOT::XMLIO - ROOT::Gdml - ROOT::Tree - ROOT::Spectrum - ROOT::RooFit - ROOT::RooFitCore -) - - -cet_build_plugin(CRTT0MatchingAna art::module - LIBRARIES - sbnobj::ICARUS_CRT - icaruscode_CRT - sbnobj::Common_CRT - icaruscode_CRTUtils - larcorealg::Geometry - larcore::Geometry_Geometry_service - larsim::Simulation lardataobj::Simulation - larsim::MCCheater_BackTrackerService_service - larsim::MCCheater_ParticleInventoryService_service - lardata::Utilities - larevt::Filters - lardataobj::RawData - lardataobj::RecoBase - lardataobj::AnalysisBase - lardata::RecoObjects - larpandora::LArPandoraInterface - larcorealg::Geometry - nusimdata::SimulationBase - art::Persistency_Common canvas::canvas - art::Persistency_Provenance - art::Utilities - ROOT::Core - ROOT::Tree - ROOT::Geom - ROOT::XMLIO - ROOT::Gdml - ROOT::Spectrum - ROOT::RooFit - ROOT::RooFitCore -) - cet_build_plugin(CRTTPCMatchingAna art::module LIBRARIES sbnobj::ICARUS_CRT diff --git a/icaruscode/CRT/CRTLegacyCode/CMakeLists.txt b/icaruscode/CRT/CRTLegacyCode/CMakeLists.txt new file mode 100644 index 000000000..3d6fda488 --- /dev/null +++ b/icaruscode/CRT/CRTLegacyCode/CMakeLists.txt @@ -0,0 +1,93 @@ +cet_build_plugin(CRTTzeroProducer art::module + LIBRARIES + larcorealg::Geometry + icaruscode_CRT + sbnobj::ICARUS_CRT + sbnobj::Common_CRT + art_root_io::TFileService_service + lardataalg::DetectorInfo + nurandom::RandomUtils_NuRandomService_service + art::Framework_Services_Registry + art::Framework_Services_Optional_RandomNumberGenerator_service + messagefacility::MF_MessageLogger + messagefacility::headers + CLHEP::CLHEP + lardata::Utilities + ) + +cet_build_plugin(CRTT0Matching art::module + LIBRARIES + icaruscode_CRTData + icaruscode_CRT + sbnobj::Common_CRT + icaruscode_CRTUtils + larcore::Geometry_Geometry_service + larsim::Simulation lardataobj::Simulation + larsim::MCCheater_BackTrackerService_service + larsim::MCCheater_ParticleInventoryService_service + lardata::Utilities + larevt::Filters + lardataobj::RawData + lardataobj::RecoBase + lardataobj::AnalysisBase + lardata::RecoObjects + larpandora::LArPandoraInterface + larcorealg::Geometry + nusimdata::SimulationBase + art::Framework_Core + art::Framework_Principal + art::Framework_Services_Registry + art_root_io::tfile_support + art_root_io::TFileService_service + art::Persistency_Common canvas::canvas + art::Persistency_Provenance + art::Utilities + messagefacility::MF_MessageLogger + ROOT::Core + ROOT::Geom + ROOT::XMLIO + ROOT::Gdml + ROOT::Tree + ROOT::Spectrum + ROOT::RooFit + ROOT::RooFitCore +) + + +cet_build_plugin(CRTT0MatchingAna art::module + LIBRARIES + sbnobj::ICARUS_CRT + icaruscode_CRT + sbnobj::Common_CRT + icaruscode_CRTUtils + larcorealg::Geometry + larcore::Geometry_Geometry_service + larsim::Simulation lardataobj::Simulation + larsim::MCCheater_BackTrackerService_service + larsim::MCCheater_ParticleInventoryService_service + lardata::Utilities + larevt::Filters + lardataobj::RawData + lardataobj::RecoBase + lardataobj::AnalysisBase + lardata::RecoObjects + larpandora::LArPandoraInterface + larcorealg::Geometry + nusimdata::SimulationBase + art::Persistency_Common canvas::canvas + art::Persistency_Provenance + art::Utilities + ROOT::Core + ROOT::Tree + ROOT::Geom + ROOT::XMLIO + ROOT::Gdml + ROOT::Spectrum + ROOT::RooFit + ROOT::RooFitCore +) + + +install_headers() +install_fhicl() +install_source() diff --git a/icaruscode/CRT/CRTT0MatchingAna_module.cc b/icaruscode/CRT/CRTLegacyCode/CRTT0MatchingAna_module.cc similarity index 100% rename from icaruscode/CRT/CRTT0MatchingAna_module.cc rename to icaruscode/CRT/CRTLegacyCode/CRTT0MatchingAna_module.cc diff --git a/icaruscode/CRT/CRTT0Matching_module.cc b/icaruscode/CRT/CRTLegacyCode/CRTT0Matching_module.cc similarity index 100% rename from icaruscode/CRT/CRTT0Matching_module.cc rename to icaruscode/CRT/CRTLegacyCode/CRTT0Matching_module.cc diff --git a/icaruscode/CRT/CRTTzeroProducer_module.cc b/icaruscode/CRT/CRTLegacyCode/CRTTzeroProducer_module.cc similarity index 100% rename from icaruscode/CRT/CRTTzeroProducer_module.cc rename to icaruscode/CRT/CRTLegacyCode/CRTTzeroProducer_module.cc diff --git a/icaruscode/CRT/crtt0matching_icarus.fcl b/icaruscode/CRT/CRTLegacyCode/crtt0matching_icarus.fcl similarity index 100% rename from icaruscode/CRT/crtt0matching_icarus.fcl rename to icaruscode/CRT/CRTLegacyCode/crtt0matching_icarus.fcl diff --git a/icaruscode/CRT/crtt0matchingana_icarus.fcl b/icaruscode/CRT/CRTLegacyCode/crtt0matchingana_icarus.fcl similarity index 100% rename from icaruscode/CRT/crtt0matchingana_icarus.fcl rename to icaruscode/CRT/CRTLegacyCode/crtt0matchingana_icarus.fcl diff --git a/icaruscode/CRT/crtt0producer_icarus.fcl b/icaruscode/CRT/CRTLegacyCode/crtt0producer_icarus.fcl similarity index 100% rename from icaruscode/CRT/crtt0producer_icarus.fcl rename to icaruscode/CRT/CRTLegacyCode/crtt0producer_icarus.fcl diff --git a/icaruscode/CRT/crttzeroproducer_icarus.fcl b/icaruscode/CRT/CRTLegacyCode/crttzeroproducer_icarus.fcl similarity index 100% rename from icaruscode/CRT/crttzeroproducer_icarus.fcl rename to icaruscode/CRT/CRTLegacyCode/crttzeroproducer_icarus.fcl From a52ab0701f3e76b39c3212d43725cefa283c9145 Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Tue, 21 Jan 2025 14:38:24 +0100 Subject: [PATCH 25/28] removal of Top CRT Correction By TPC from icaruscode, will go in icarus_data --- icaruscode/CRT/CRTUtils/CMakeLists.txt | 2 - .../CRT/CRTUtils/CRTScripts/CMakeLists.txt | 6 - .../CRTScripts/TopCrtCorrectionByTPC.txt | 124 ------------------ icaruscode/CRT/CRTUtils/RecoUtils.cc | 4 +- 4 files changed, 2 insertions(+), 134 deletions(-) delete mode 100644 icaruscode/CRT/CRTUtils/CRTScripts/CMakeLists.txt delete mode 100644 icaruscode/CRT/CRTUtils/CRTScripts/TopCrtCorrectionByTPC.txt diff --git a/icaruscode/CRT/CRTUtils/CMakeLists.txt b/icaruscode/CRT/CRTUtils/CMakeLists.txt index 2c36bdafa..e726513b2 100644 --- a/icaruscode/CRT/CRTUtils/CMakeLists.txt +++ b/icaruscode/CRT/CRTUtils/CMakeLists.txt @@ -1,5 +1,3 @@ -add_subdirectory(CRTScripts) - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") cet_add_compiler_flags(CXX -Wno-maybe-uninitialized) endif() diff --git a/icaruscode/CRT/CRTUtils/CRTScripts/CMakeLists.txt b/icaruscode/CRT/CRTUtils/CRTScripts/CMakeLists.txt deleted file mode 100644 index d4518735d..000000000 --- a/icaruscode/CRT/CRTUtils/CRTScripts/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# The txt files here are used to load Top CRT corrections -# They need to be found via FW_SEARCH_PATH - -# install txt files -file(GLOB txt_file *.txt) -install_fw(LIST ${txt_file}) \ No newline at end of file diff --git a/icaruscode/CRT/CRTUtils/CRTScripts/TopCrtCorrectionByTPC.txt b/icaruscode/CRT/CRTUtils/CRTScripts/TopCrtCorrectionByTPC.txt deleted file mode 100644 index 658d93d8d..000000000 --- a/icaruscode/CRT/CRTUtils/CRTScripts/TopCrtCorrectionByTPC.txt +++ /dev/null @@ -1,124 +0,0 @@ -108 0.990014 0.000730912 -0.0014043 1.00462 -456.38 -1044.45 15.6498 7501 0.996656 0.0022811 -0.00120142 1.00549 -462.081 -1045.78 14.7886 9522 1.00028 0.00328549 -0.0108595 1.00281 -460.295 -1043.45 16.1172 11698 0.996 0.00531438 0.00673602 1.01298 -454.049 -1046.78 15.5615 4524 1.0025 0.00713468 7.92409e-05 1.01303 -459.746 -1047.04 15.4166 3832 1.00297 0.0101686 -0.00398481 0.999977 -460.8 -1046.48 15.5258 1685 -109 0.983009 -0.00319798 -0.00193381 0.995038 -456.318 -859.836 15.0985 11833 0.999105 -0.00486906 0.000791451 0.9977 -462.484 -861.065 14.4911 13291 1.00122 -0.00282917 -0.00659032 0.996823 -460.591 -858.552 15.5447 17803 0.992526 -0.00105885 0.00104855 1.00503 -454.277 -861.205 15.4543 6535 0.996221 -0.00214472 0.00328342 0.998416 -459.977 -861.351 15.3887 5082 1.00592 -0.00472139 0.00277481 0.995553 -461.055 -860.994 15.4057 2176 -110 0.98664 -0.00419974 0.00187765 0.995419 -456.675 -675.397 15.1396 16147 1.00356 -0.0060217 0.0023732 0.999963 -463.415 -676.055 14.4197 18729 1.00157 -0.00351885 -0.00170026 0.992458 -460.971 -673.963 15.5062 26175 0.993209 0.00824833 0.000319891 1.00067 -454.414 -676.251 15.4443 8610 0.995668 -0.00178936 -0.00127458 1.00052 -460.518 -676.469 15.3617 6913 0.998333 0.00200041 -0.00419819 1.00278 -461.011 -675.643 15.3284 2645 -111 0.986478 -0.00297429 0.00196846 1.00202 -457.066 -490.441 15.3321 18764 1.00365 -0.00289387 0.000384214 1.00327 -464.265 -490.555 14.4962 22224 1.002 -0.00384269 -0.000809648 0.999536 -461.17 -489.584 15.6602 31610 0.998012 0.000402588 0.00538996 1.00159 -454.295 -490.33 15.5589 10116 1.00628 0.00138257 0.00153961 1.0042 -460.397 -490.337 15.4328 8293 1.00526 -0.000514298 0.00389664 1.00116 -461.505 -489.957 15.7465 3271 -112 0.984232 0.000464379 0.00113379 1.00224 -457.456 -304.999 15.4523 18924 1.00159 -0.00274187 0.00122707 1.00494 -464.707 -305.036 14.5347 22754 0.999822 -0.00367219 -0.00114618 1.00389 -461.639 -304.725 15.6957 32936 0.997188 -0.00314382 0.0064255 1.00863 -454.39 -304.743 15.4314 10532 0.999875 -0.003114 0.0027403 1.00528 -460.99 -305.011 15.1778 8550 1.00221 -0.0057823 -0.000452245 1.00975 -462.001 -304.356 15.1263 3231 -113 0.984793 -0.000117883 -0.000316148 1.0038 -457.99 -119.235 15.4192 19500 1.00337 -0.000950401 0.000862706 1.00597 -465.125 -119.123 14.5422 23521 0.998655 -0.00386865 0.00184487 1.00345 -462.157 -119.4 15.6549 33809 0.993667 -0.00622609 0.00304501 1.00706 -454.925 -118.964 15.4916 11016 1.00295 -0.00190276 0.0034775 1.005 -461.093 -118.999 15.3224 9077 1.00469 -0.000235791 0.00333375 1.00694 -462.305 -118.762 15.3972 3598 -114 0.982728 -0.00186376 0.000535842 1.00776 -458.288 66.5338 15.3622 20405 1.00109 0.000278976 0.00275216 1.00793 -465.219 66.7934 14.4959 24037 1.00104 -0.00210875 0.00287075 1.00369 -462.394 66.3651 15.7899 35371 0.995277 -0.0034344 0.00262087 1.00576 -454.975 66.8368 15.4787 11491 1.00303 -0.000387297 0.00598651 1.00247 -461.354 66.7369 15.335 9114 0.998823 0.00447964 0.00630797 1.00866 -462.225 67.1826 15.4175 3402 -115 0.98468 -0.00318468 0.00339054 1.0022 -458.448 252.22 15.2618 20030 1.00266 1.50043e-06 0.00324502 1.00352 -465.064 252.487 14.5019 23412 1.00459 -0.00199938 0.00401192 1.00343 -462.724 251.787 15.6469 33831 0.997116 0.00111924 0.00272299 1.00716 -455.537 252.513 15.6033 11155 1.00453 0.00174855 0.00230951 1.00405 -461.674 252.86 15.3222 8927 1.00314 0.00154085 0.00395838 1.00501 -463.041 252.679 15.6882 3311 -116 0.979413 -0.00343409 0.00264193 0.999535 -458.735 437.697 15.1775 18820 0.998835 -0.00200936 0.00355982 0.999896 -465.302 438.015 14.4869 21244 0.998627 -0.00173821 0.00252074 0.997824 -463.036 436.828 15.6149 30168 0.995074 -0.00620076 0.000334623 1.00477 -456.06 438.706 15.4307 10156 0.997062 -0.00784742 0.000121464 1.00354 -462.185 438.644 15.3397 7947 1.00149 -0.00212078 0.005705 1.00343 -463.725 438.393 15.7736 3008 -117 0.983625 -0.0022997 0.00538786 0.998778 -459.206 622.779 15.0392 19056 1.00185 0.000478103 0.00578851 1.00145 -465.495 623.418 14.5159 20230 1.00082 -0.00433543 0.00634911 0.995983 -463.383 621.571 15.5847 29845 0.991674 -0.00493849 0.00706322 1.00753 -456.735 624.412 15.5064 9648 1.00421 -0.00253822 0.00198978 1.0071 -462.832 624.303 15.2896 7676 0.995973 -0.0110582 0.00760223 1.00311 -463.82 624.18 15.7025 2861 -118 0.986208 -0.0036094 0.00760776 0.999872 -459.693 807.642 14.9833 14564 1.00066 0.000155828 0.00631594 0.995183 -465.668 808.537 14.5598 15460 1.00009 -0.00301822 0.00585876 1.00049 -463.899 806.248 15.5426 22328 0.996385 5.64608e-06 -0.000613018 1.00142 -456.895 809.841 15.4165 7696 1.0045 -0.00629354 -0.00157716 0.998194 -462.601 809.427 15.3724 6180 1.00428 -0.004484 0.00402954 0.998513 -463.921 809.316 15.8027 2269 -119 0.986233 -0.00340759 0.00312498 1.00221 -460.309 992.858 15.3524 8559 1.00141 -0.00186755 0.00157508 0.997625 -465.807 993.391 14.7066 9838 1.00207 -0.00479362 0.0105424 1.00449 -464.088 991.313 15.7651 12937 0.993052 0.00151572 -0.000198592 1.0009 -456.907 995.242 15.7176 5092 1.00342 -0.0034969 -0.00264682 1.00653 -462.882 994.698 15.47 4059 1.01163 0.000210577 -0.00196825 1.00809 -463.723 994.211 15.6097 1728 -120 0.985162 -0.00158986 0.00796496 1.00102 -460.987 1177.99 15.9966 3844 0.996857 -0.00580752 0.0115647 0.99625 -465.978 1177.65 15.045 5348 1.00021 -0.00453033 0.0196475 0.999507 -464.288 1176.17 16.409 6273 0.992312 -0.00312561 0.00279121 1.00468 -457.383 1180.29 15.8765 3111 1.00802 -0.00673674 0.00530174 1.00976 -463.267 1179.96 15.4844 2442 1.00129 0.000366142 0.0107656 0.996346 -463.739 1179.24 15.7856 1137 -121 0.985386 -0.01291 0.00658073 1.00855 -461.489 1362.23 16.2563 1606 0.993015 -0.00434321 0.0135935 1.00571 -466.094 1362.13 15.1294 2868 0.999825 -0.000273186 0.0349601 1.0108 -464.558 1360.89 16.8788 2878 1.00144 -0.00592024 -0.000224544 0.999512 -458.139 1365.63 16.0131 1684 1.01141 -0.00305484 -0.0057714 1.00802 -463.717 1364.77 15.8319 1346 1.01424 -0.0156981 -0.00703466 1.01486 -463.086 1364.49 15.5921 743 -122 0.975679 -0.00601526 -0.0041326 1.0037 -275.321 -1044.66 15.4742 3015 0.997972 -0.00378345 0.00274135 0.999661 -277.143 -1045.19 14.8303 16469 0.991639 -0.00529727 0.00734774 1.00693 -275.86 -1042.51 16.1259 15189 0.998494 -0.00189074 0.00451502 1.00598 -269.997 -1046.38 15.2249 6845 1.00578 -0.00415132 0.00426865 1.00156 -274.336 -1046.45 15.1842 6946 1.01216 -0.00142921 0.00455804 1.00791 -275.363 -1046.34 15.1026 3397 -123 0.976006 -0.00252076 0.00191148 0.993106 -275.652 -859.583 14.8384 5177 0.99678 -0.00258883 0.0052933 0.997577 -277.735 -860.611 14.526 25405 0.99066 -0.000990363 0.00721225 0.997929 -276.227 -857.812 15.412 25216 0.996601 -0.00692769 0.002854 0.99404 -270.253 -860.798 14.8799 9814 1.00839 -0.00477057 0.00744943 1.00015 -274.73 -860.986 14.9063 9704 1.00925 -0.00646063 0.00493347 1.00001 -275.404 -860.813 14.8239 4420 -124 0.969493 -0.00445316 0.00346963 0.997435 -276.101 -675.326 14.771 7088 0.999465 -0.00459417 0.00143423 0.999929 -278.289 -675.74 14.4432 35704 0.993226 -0.00171109 0.0031185 0.994261 -276.716 -673.691 15.1892 36554 0.996354 -0.000232261 0.00161858 1.00509 -270.403 -675.682 15.0247 12809 1.00329 -0.00318743 0.00250766 1.00346 -274.607 -675.908 14.8743 13054 1.00468 0.000602346 -0.000474069 1.00686 -276.028 -675.346 14.6195 5456 -125 0.970331 -0.0025715 0.003178 1.00332 -276.734 -490.292 14.9541 8404 1.00129 -0.00194114 0.00275098 1.00136 -279.009 -490.303 14.4169 42858 0.991702 -0.00209361 0.00171119 0.995556 -277.093 -489.319 15.3875 45302 0.999395 -0.000800086 -0.00103779 1.00496 -270.979 -489.897 15.0225 15949 1.00376 -0.00442708 0.00267003 1.00364 -275.428 -489.96 14.8136 15936 1.00246 -0.00320477 -5.32704e-05 1.00644 -276.672 -489.461 14.8893 6772 -126 0.96805 -0.0043442 0.00345692 1.00201 -277.003 -304.675 14.9032 7633 1.00102 -0.00390842 0.00380591 1.00254 -279.495 -304.54 14.4938 37848 0.990739 -0.000861207 0.00543834 0.999481 -277.45 -304.343 15.5048 40248 0.993121 -0.00157855 0.00161787 1.0043 -270.854 -304.106 15.0728 14442 1.00214 -0.00316091 0.00078263 1.00524 -275.637 -304.335 14.8635 14231 1.00503 -0.00587045 0.000297452 1.00961 -276.654 -303.674 14.8743 6029 -127 0.972971 0.00044896 -0.00015151 1.00692 -277.458 -118.719 15.0229 8807 1.00138 -0.000304122 0.00144475 1.00539 -279.944 -118.552 14.5006 45324 0.992699 -0.00196772 0.00117152 1.00544 -277.811 -118.718 15.5021 47983 0.993985 0.00079596 0.00185207 1.00292 -271.338 -118.173 14.9422 17461 1.00363 -0.000140558 0.000985879 1.00105 -276.012 -118.394 14.8852 17315 1.00499 0.0011978 0.001834 0.999701 -277.332 -118.053 14.8653 7473 -128 0.968975 -0.00591851 0.00320895 1.00638 -277.635 67.2063 14.9181 8428 1.00493 0.000544958 0.00215173 1.00531 -279.762 67.1964 14.4859 42864 0.993741 -0.00110948 0.00376383 1.00501 -277.936 67.0908 15.5634 44185 1.00289 0.000240032 0.000997435 1.00458 -271.299 67.6753 15.0245 16231 1.00861 -0.00124061 0.00205368 1.00619 -275.945 67.565 14.9872 16357 1.01098 0.00184527 0.00192841 1.00859 -277.193 67.636 14.9869 6995 -129 0.972918 -0.00324406 0.00502318 1.00015 -277.768 253.245 14.8006 8111 1.001 -0.00122717 0.00268162 1.0023 -279.984 253.14 14.5287 40838 0.991869 -0.00330223 0.00458311 1.0006 -278.143 252.739 15.4231 42070 0.99528 -0.000517841 -7.72316e-06 1.00257 -271.695 253.576 14.975 15923 1.00602 -0.000733471 0.00359942 1.00419 -276.408 253.563 14.8877 15498 1.00553 -0.00172064 0.000487773 1.00155 -277.777 253.428 15.0942 6661 -130 0.969208 -0.000898885 0.00299316 1.00194 -278.1 438.722 14.6467 8986 1.00099 -0.00206231 0.0010188 1.0027 -280.323 438.821 14.4858 43171 0.994002 -0.0022627 0.00181627 1.00014 -278.562 437.856 15.3745 43839 0.995515 -0.00869098 0.00256239 1.00631 -272.445 439.518 14.9542 15934 1.00369 -0.00414035 0.00356228 1.0047 -276.965 439.291 14.8421 15925 1.00731 -0.00906376 0.00340564 1.0064 -278.509 439.231 15.0285 6514 -131 0.970512 0.000123771 0.00959196 0.998142 -278.983 624.01 14.7883 7839 1.00452 0.00147965 0.005636 1.00143 -280.878 624.244 14.4574 36836 0.998748 -0.00171581 0.0057531 0.994764 -279.251 622.78 15.1689 37051 0.996961 0.00320484 0.00268335 1.00332 -272.962 625.122 15.012 13883 1.00684 -0.000173216 0.00131646 1.00779 -277.461 625.194 14.8881 13878 1.00681 0.00592129 0.00431751 1.00066 -279.035 624.979 14.8915 5719 -132 0.967692 -0.00245917 0.00487426 0.996356 -279.059 808.586 14.8222 6013 1.00063 -1.98938e-05 0.00199549 0.998369 -280.756 809.449 14.5054 26520 0.993202 0.000366138 0.000274074 0.996285 -279.131 806.991 15.2446 26422 0.997354 0.00200884 -0.00196619 1.00347 -272.769 810.571 14.9869 10232 1.00374 0.00180336 -0.00166599 1.0008 -277.391 810.503 14.9848 9587 1.00742 0.0110028 0.000986733 1.00072 -278.063 810.35 14.8784 4056 -133 0.981026 -0.00182312 0.00435249 0.998992 -279.277 994.086 15.1721 2894 1.00258 0.00348198 0.000557398 0.998649 -280.816 994.096 14.7578 14918 0.996717 0.00349191 0.000958932 0.997576 -279.26 991.698 15.6916 13977 1.00127 0.000647415 -0.00248975 1.00452 -273.196 995.782 14.8995 6358 1.00379 0.000784155 0.00251406 1.00066 -277.648 995.527 14.8775 5924 1.00913 0.00373422 0.00162772 1.00016 -278.004 995.415 15.0871 2800 -134 0.978286 -0.00816234 0.00530528 0.994992 -279.664 1179.34 16.0779 1359 1.00466 -0.00399302 -0.00131884 0.997089 -281.102 1178.49 14.8916 8027 1.0001 -0.00671173 -0.00559172 0.993065 -279.77 1176.8 16.5414 6704 0.998835 0.000421924 0.00578343 1.00949 -272.963 1180.96 15.3926 3590 1.00515 -0.00173609 0.00436062 1.0041 -277.853 1180.85 15.132 3594 1.01043 -0.000628466 -0.00276905 1.01084 -278.283 1179.97 15.3634 2001 -135 0.982617 -0.0219761 0.00685706 1.00046 -280.469 1364.22 15.9051 634 1.00431 -0.0064981 0.00412436 0.994233 -281.569 1363.98 15.2711 4292 0.996185 -0.00413283 -0.0103906 1.00133 -280.244 1363.57 17.011 3248 1.00089 -0.0056123 -0.000795654 0.999805 -273.644 1366.72 15.3286 2052 1.00704 -0.00115775 -0.00303695 0.991502 -277.902 1365.99 15.3729 2207 0.998259 -0.00434233 0.00487334 1.00976 -278.647 1365.53 15.6004 1336 -136 0.979708 -0.000947891 0.00037709 1.00044 -95.0563 -1042.8 15.0595 4561 1.00172 -0.00134831 -0.00399869 1.00144 -92.8273 -1044.88 15.3044 14610 0.985795 -0.00447594 0.00174015 1.00835 -93.5063 -1041.48 15.9899 11742 0.992681 -0.000982229 0.00257315 1.00346 -85.2058 -1046.1 14.8452 7689 1.00116 0.000564076 -0.00137125 0.998976 -88.1968 -1046.12 15.1767 11037 1.00799 -0.00347965 0.00414862 0.998575 -88.6767 -1045.63 14.7813 6869 -137 0.974499 -0.0046934 0.00530431 0.997446 -95.4419 -859.021 14.6633 7892 0.99973 -0.00513053 0.00268588 0.998897 -93.214 -860.418 14.9077 24294 0.979721 -0.00505594 0.0078337 0.999633 -94.2461 -857.338 15.1571 20860 0.996734 -0.00374549 0.000732245 1.00044 -86.0721 -861.043 14.5257 12913 1.00633 -0.00594329 -0.00118645 0.998919 -88.9406 -860.865 14.674 16931 1.00543 -0.00177528 0.000568235 1.00217 -89.684 -860.577 14.5242 10336 -138 0.972823 -0.00377733 0.0053396 1.00043 -95.5392 -674.055 14.6422 10910 0.995166 -0.00283807 0.0022052 0.99987 -93.4975 -675.3 14.7677 34629 0.974957 -0.00449145 0.00442439 0.99478 -94.5804 -673.025 15.0736 29739 0.993353 0.00116668 0.000839842 1.00318 -86.2559 -675.276 14.6204 18099 1.00209 -0.00306747 0.000168182 1.00119 -89.0083 -675.524 14.7746 24714 1.00418 -0.00273551 -0.00186688 1.00127 -89.9793 -675.248 14.4519 14606 -139 0.974764 -0.00257338 0.00620316 1.00192 -96.0226 -489.162 14.6636 12098 1.00235 -0.00216705 0.00490178 1.00428 -94.2163 -489.849 14.8706 41190 0.980985 -0.00363978 0.00674071 0.99993 -95.3375 -488.877 15.2234 36156 0.997769 -0.00343361 0.000128577 1.00404 -86.6215 -489.538 14.5622 21329 1.00373 -0.00379227 0.00160566 1.00342 -89.5757 -489.797 14.7514 29142 1.00952 -0.00830103 -0.00038761 1.00477 -90.5297 -489.356 14.6062 16416 -140 0.973958 -0.00326981 0.00551275 1.00606 -96.4426 -303.73 14.7012 12262 1.0042 -0.0011154 0.00332354 1.00154 -94.4901 -304.028 14.8789 42589 0.981189 -0.000234873 0.00222721 1.00016 -95.7307 -303.754 15.3264 37415 0.997293 0.0008827 0.00236471 1.0016 -87.0087 -303.624 14.5543 22412 1.00708 -0.000981796 0.000527758 1.00317 -90.0618 -303.888 14.7584 30015 1.00823 -0.00404466 -0.00034207 1.00289 -91.1154 -303.45 14.4092 17360 -141 0.979274 -0.00419814 0.00219157 1.00093 -96.6145 -118.131 14.6747 12844 1.00495 -0.00368042 0.00262182 1.00362 -94.7517 -118.168 14.9365 45350 0.98103 -0.00219999 0.00258169 1.00504 -95.8427 -118.185 15.4428 39147 0.994292 -0.00045657 0.00272033 1.00434 -87.3382 -117.692 14.6963 23449 1.00765 8.37708e-05 0.000547659 1.00497 -90.3352 -117.833 14.7809 30806 1.00865 -0.00245382 -0.000410549 1.00368 -91.504 -117.452 14.5023 18122 -142 0.974646 -0.00417852 -0.00130941 1.00294 -97.273 67.7991 14.7491 12416 1 -0.00048757 0.00273927 1.00263 -95.1873 67.5648 14.9085 44277 0.978398 -0.00277481 0.000642677 1.00104 -96.4357 67.3589 15.4404 37821 0.995521 -0.00204156 0.00413671 1.00243 -87.3849 67.9561 14.6287 23057 1.00391 -0.000304163 0.00384468 1.00493 -90.5233 67.9231 14.9039 30897 1.00368 -0.00349074 0.00175067 1.00346 -91.5266 68.095 14.6543 17609 -143 0.975515 -0.00433311 0.00216011 1.00046 -97.2036 253.619 14.56 12758 1.0034 -0.00267504 0.00340575 1.00505 -95.0973 253.674 14.8364 42879 0.981185 -0.00281797 -0.000688359 1.00376 -96.2416 253.119 15.3526 36478 0.996777 9.28749e-05 0.00111122 1.0034 -87.7084 254.203 14.625 22190 1.00717 0.000384793 0.00323778 1.00605 -90.8152 253.876 14.7803 29275 1.00813 -0.00228792 0.00200171 1.00438 -91.9711 254.107 14.7198 17218 -144 0.974033 0.000962279 0.00101885 1.00174 -97.7814 438.693 14.8003 12927 1.00031 -0.00128154 0.00424783 1.00418 -95.4578 439.303 14.9263 43213 0.981246 -0.000774299 0.00276416 1.00059 -96.6338 438.219 15.2619 35880 0.995273 -0.00275269 0.00240657 1.00497 -88.1493 439.954 14.5643 21618 1.00495 -0.00313749 0.00111745 1.0041 -91.1401 439.734 14.7834 28460 1.00854 0.000234259 0.000303246 1.00451 -92.2896 439.845 14.5829 16030 -145 0.973326 -0.00272212 0.000682319 0.998384 -98.0764 623.725 14.6039 12044 1.00191 0.000788453 0.00518253 1.00233 -95.6318 625.025 14.8492 38029 0.981449 -0.00189448 0.00151326 0.997511 -96.8565 622.839 15.0883 32174 0.997422 -0.000438084 0.00515657 1.0056 -88.5037 625.785 14.6181 19557 1.00549 -0.00203687 0.00308805 1.00584 -91.3659 625.648 14.6881 25315 1.00583 0.000926123 0.00367362 1.00552 -92.5891 625.548 14.6369 14693 -146 0.976902 -0.00478518 0.000435933 1.00013 -98.526 808.565 14.6747 9179 1.00259 -0.000283623 0.00498058 0.998854 -96.0331 810.463 14.8571 28885 0.985247 0.00114059 0.000240374 0.994977 -96.9597 807.416 15.0766 23870 0.998151 0.00155633 0.0020451 1.00323 -88.6106 811.286 14.5689 15036 1.00717 -0.000490052 0.00224307 1.00193 -91.6819 811.063 14.7133 18954 1.00944 0.00237337 0.0025238 0.998945 -92.5375 811.026 14.4878 11205 -147 0.974362 0.00148061 -0.000412809 0.995515 -98.618 993.416 14.7327 5200 1.00242 -0.0027872 0.0134048 0.996323 -96.0314 995.34 15.1881 16211 0.986696 0.000356065 -0.00227956 0.992875 -96.7017 991.877 15.6383 13076 1.00282 -0.00152806 -0.000600735 0.998146 -89.1795 996.355 14.7026 8906 1.00896 -0.00294386 0.00274981 1.00099 -92.0396 996.129 14.8134 11150 1.00863 0.00155703 0.00185354 0.998254 -92.5489 995.88 14.765 7171 -148 0.974041 -0.00320536 0.00162321 0.997139 -99.303 1177.53 15.1749 2354 0.998495 -0.00443722 0.0133021 0.990066 -96.4124 1179.65 15.6402 7988 0.988302 0.00232014 -0.0104053 0.994171 -96.8327 1176.53 16.6505 6363 1.00092 -0.00314591 -0.00103027 1.00257 -89.2533 1181.96 14.9695 4459 1.00539 -0.00399665 0.00667084 1.00441 -92.29 1181.49 15.1826 5946 1.00803 -0.00166505 0.000961611 1.00882 -92.6366 1181.02 15.0614 4106 -149 0.974757 0.00533844 -0.00831337 0.992255 -99.0769 1361.38 15.6795 1095 0.998769 -0.00178028 0.013598 1.00248 -96.3758 1365.14 15.7948 3797 0.982212 -0.00528492 0.00120767 1.00298 -97.046 1362.66 17.3507 3285 0.997823 0.00298446 0.0136408 1.00156 -89.4451 1367.43 15.3696 2290 1.00583 -0.00219516 -0.000217293 1.00639 -92.3871 1366.95 15.5801 3091 0.996837 0.00636603 0.00232999 1.00185 -92.6314 1365.73 15.4691 2463 -150 0.991701 -0.00378722 0.000863465 0.994548 86.9579 -1043.13 15.2003 7674 0.999875 -0.00264631 0.00262008 1.00166 91.8262 -1044.63 15.1455 11180 0.97933 -0.0126548 0.0029519 1.0105 87.5512 -1040.4 16.7049 5995 0.98616 -0.000941652 0.00239123 1.00547 97.9953 -1046.08 14.8514 4832 1.00162 -0.00447491 0.0106982 1.00072 97.1323 -1045.7 15.5474 17577 0.999826 -0.000374038 0.00335734 0.998738 96.5077 -1044.9 14.7586 14602 -151 0.992687 -0.00277453 0.00520706 0.996175 86.9649 -858.49 14.8805 11000 1.00248 -0.00336252 0.00495675 0.997647 91.8818 -859.917 14.7435 15190 0.971971 -0.0100815 0.00345377 0.988272 86.2748 -856.058 15.8991 8406 0.98912 -0.00528853 -0.00351442 0.999093 97.4768 -861.045 14.4553 7534 1.00468 -0.00531188 0.00797542 1.00182 96.8534 -860.818 14.9015 23008 1.00223 -0.00368826 0.00195016 0.99961 95.9802 -860.141 14.4379 20453 -152 0.991956 -0.00585658 0.00294319 0.998561 86.7792 -673.884 14.9345 14850 1.00276 -0.00267698 0.00520377 1.00015 91.7125 -674.876 14.6715 22404 0.971816 -0.00927086 0.00295738 0.992521 85.8433 -672.621 15.8421 12285 0.990243 0.00125106 0.000469614 1.0012 97.2975 -675.317 14.534 11340 1.00492 -0.000364372 0.00391332 1.00236 96.5754 -675.443 14.9012 34965 1.00692 0.000102926 -0.000488444 1.00304 95.7356 -674.949 14.3695 29430 -153 0.992939 0.0005265 0.00226264 1.00325 86.0668 -488.992 14.9849 13925 0.998088 -0.000975835 0.000582817 1.00429 90.8993 -489.609 14.6157 21660 0.974274 -0.00404513 0.00155275 1.00354 85.3816 -488.68 15.9998 12540 0.986555 -0.00241038 0.000165106 1.00583 96.6761 -489.562 14.518 10841 1.00662 -0.00270293 0.00246763 1.00413 96.0409 -489.689 14.9554 34502 1.00687 -0.00198302 0.0012454 1.00421 95.3707 -489.263 14.4589 29078 -154 0.99204 -0.00248769 0.00205398 1.00528 85.8278 -303.385 14.8832 16063 1.00091 -0.00182442 0.00139931 1.00651 90.7769 -303.703 14.7864 25604 0.975825 -0.0031787 0.00293838 1.00212 84.8629 -303.607 15.9534 14910 0.98496 0.000379333 -0.00294234 1.00387 96.4106 -303.802 14.3842 13199 1.00433 -0.000393802 0.000377186 1.00458 95.6934 -303.847 14.991 39794 1.00467 -0.00260221 -0.000185908 1.00521 94.7532 -303.483 14.3744 34289 -155 0.992862 -0.00285426 0.00183314 1.00493 85.7836 -117.629 14.915 18479 1.00355 -0.00301614 0.00309601 1.0045 90.7449 -117.868 14.7636 28817 0.978233 -0.00034723 0.00322277 1.00305 84.9977 -118.07 15.9998 17252 0.987259 -3.45141e-05 0.00398923 1.00367 96.2055 -117.451 14.4731 14704 1.00327 -0.00350317 0.0041472 1.00677 95.4213 -117.793 14.9112 44984 1.0048 -0.00144443 0.00174534 1.00596 94.555 -117.385 14.4981 39515 -156 0.992543 -0.00141451 0.00276645 1.00451 85.1571 67.8876 14.9329 18189 1.00342 -0.00123476 0.000870293 1.00184 90.245 67.8153 14.8922 28429 0.975484 -0.00332477 -0.000878443 1.00276 84.5175 67.4033 16.1001 16693 0.987558 -0.000947856 0.000826074 1.00433 96.1345 68.2911 14.4271 14711 1.00502 -0.00122868 0.00177431 1.00362 95.169 68.0549 14.9607 44201 1.0047 -0.00193671 -0.000485919 1.00268 94.3588 68.3886 14.5409 38633 -157 0.992178 -0.00402366 -0.000280829 1.0019 84.9893 253.646 14.8573 19225 1.00218 -0.00280906 -0.000317645 1.00377 90.2141 253.769 14.7631 29190 0.971342 -0.00347876 0.00200026 1.0035 84.4227 253.187 16.0075 16798 0.98525 -0.00103524 -0.00312762 1.00199 95.8245 254.139 14.4235 15065 1.00438 -0.00267276 0.000574519 1.00292 94.8858 253.983 14.842 44984 1.00604 -0.00260596 0.000296003 1.00417 93.8303 254.298 14.5368 39918 -158 0.992619 -0.00414296 0.00359175 1.00279 84.5046 438.91 14.8515 17824 1.00391 -0.00309028 0.00232144 1.00406 89.8675 439.517 14.7439 26563 0.97512 0.00253255 0.00104229 1.00033 83.9648 438.477 15.9269 15017 0.987244 0.000127988 -0.000679753 1.00378 95.2145 440.231 14.4818 14004 1.00559 -0.0024585 0.000903954 1.0046 94.5133 439.823 14.8328 40286 1.00642 -0.00227897 0.00241607 1.0028 93.635 439.884 14.5927 35843 -159 0.99159 -0.0039259 0.00385679 0.998866 83.836 623.825 14.8998 16404 1.00311 -0.00494737 7.7374e-05 1.00126 89.5197 625.082 14.6736 24101 0.975812 -0.00156791 -0.00123219 0.997607 83.7661 622.756 15.9044 13076 0.983785 1.23902e-05 0.00540886 1.00334 94.872 626.141 14.3388 12424 1.00464 -0.00131285 -0.00133378 1.00465 94.1122 625.882 14.7331 35672 1.00454 0.000383832 0.000673132 1.00473 93.4152 625.736 14.5016 31760 -160 0.991803 -0.00410433 0.00408452 0.999668 83.2921 808.582 14.7729 12711 1.00214 -0.00321481 0.00148373 1.00123 88.9632 810.282 14.7068 17985 0.972733 -0.00397288 0.000577513 0.994867 83.236 806.89 15.7181 9854 0.988178 -0.000430674 0.00245607 1.00032 94.8274 811.558 14.3041 9329 1.00551 0.000522921 -0.000437402 0.997037 94.0126 811.193 14.6925 26708 1.00628 0.000829426 0.00187823 0.998197 93.2424 811.031 14.5449 24436 -161 0.987567 -0.00672299 -0.00120389 0.99016 83.0634 992.825 14.9728 8161 0.999712 -0.00212204 -0.010096 0.996767 88.8545 995.141 14.8737 11358 0.974441 0.00684849 -0.00565714 0.998721 83.9401 991.023 16.2402 5999 0.988625 -0.00193626 0.000817174 0.9955 94.7725 996.637 14.6463 5670 1.00326 -0.00162457 -0.00130081 0.997464 93.7534 996.174 15.0927 16281 1.00752 0.00145934 -0.00394073 0.996938 93.4491 995.894 14.6124 15176 -162 0.987881 0.00268618 -0.00406276 0.998981 82.4362 1177 15.4876 3909 0.997322 6.36504e-05 -0.00343022 1.00401 88.5808 1179.75 15.0745 5727 0.976431 0.00424631 -0.00433728 1.00216 84.7783 1175.66 17.4504 3075 0.986083 0.00552203 0.00583671 0.999051 94.2912 1182.29 14.9526 2442 1.00558 -0.00246427 -0.00494202 0.997788 93.304 1181.07 15.3826 7829 1.00135 -0.00190114 0.000840981 0.998625 93.1919 1180.63 14.9896 7583 -163 0.99369 -0.00332186 -0.00587483 0.997583 82.4635 1361.42 15.9773 1951 0.995039 -0.00616928 -0.00532043 1.0039 88.5579 1365.38 15.7066 3030 0.984887 -0.00274645 -0.00602343 1.03423 85.4154 1363.22 18.1179 1689 0.985371 -0.00647205 0.0123091 1.01238 94.1496 1368.4 15.5065 1212 1.00627 0.0028957 -0.00895885 1.01172 92.6536 1366.64 15.6692 3765 1.00858 0.00232094 -0.0016492 1.00791 92.5533 1366.17 15.3274 4120 -164 0.99611 0.00343419 0.0053285 0.999321 270.221 -1042.56 15.6263 6020 0.99817 0.000150421 0.0070082 1.00197 276.761 -1043.91 15.3158 6665 1.00795 -0.0068848 -0.00478994 1.00619 270.708 -1040.29 17.6873 2230 0.977814 -0.00319894 0.00635936 0.999045 281.367 -1045.97 14.7675 3489 1.00066 -0.00364877 -1.49901e-05 1.00023 282.009 -1044.81 15.1577 17949 0.999598 -0.00167567 -0.00555632 0.996782 281.337 -1044.51 15.3067 17631 -165 0.987522 -0.00134237 0.00189376 0.997022 270.022 -858.411 15.3878 8204 0.998695 -0.00271966 0.00156688 1.00163 276.561 -859.34 14.9176 8915 1.00173 0.00116605 -0.00708094 0.990311 269.25 -856.298 17.178 2979 0.968543 0.000844244 0.00590078 0.996173 281.327 -860.945 14.4347 5117 0.998068 0.00214078 0.00209611 0.998487 281.691 -859.975 14.5101 23581 0.998335 -0.000207659 -0.00190316 1.00016 280.899 -859.865 14.7964 25250 -166 0.991219 -0.00792338 0.000858851 1.00231 270.196 -673.288 15.3038 11492 0.99875 -0.00450642 0.00453825 1.00487 276.905 -674.134 14.7917 12761 1.0038 -0.00193092 0.00634687 0.99907 268.954 -672.414 17.0381 4389 0.986475 -0.00636569 0.00420795 1.00509 280.678 -675.533 14.5726 7831 1.00191 -0.00173427 0.00280405 1.00458 281.654 -674.579 14.5064 35618 1.00346 -0.00359336 0.000816668 1.00228 280.94 -674.517 14.7126 37794 -167 0.990617 -0.0046496 -0.000120943 1.00034 269.459 -488.321 15.4717 13517 0.999256 -0.00421104 0.00363506 1.00288 276.158 -488.879 14.8356 15869 1.00765 -0.00743196 0.00118861 0.997288 268.115 -487.877 17.0368 5649 0.985502 -0.00194626 0.00191783 1.00567 280.203 -489.174 14.5946 9681 0.998449 -0.0022674 0.00461575 1.00175 281.189 -488.942 14.5397 44606 1.00345 -0.00342139 0.00161512 1.00261 280.47 -488.961 14.7474 46610 -168 0.995653 -0.00227504 0.0051954 1.00691 269.719 -302.515 15.386 13865 1.00249 0.00070448 0.00228192 1.00246 276.117 -303.148 14.878 15930 1.00416 -0.00114805 0.000550627 1.00252 268.135 -302.835 17.116 6294 0.984858 -0.00126113 0.000204505 1.00632 280.134 -303.07 14.4092 10107 1.0022 -0.00293457 0.000479524 1.00443 280.875 -302.96 14.5191 44658 1.00509 -0.00213094 0.00131864 1.00376 280.237 -302.856 14.8695 47276 -169 0.994774 -0.00338171 0.00338784 1.00696 269.205 -117.383 15.3656 14156 1.00393 -0.00233277 0.00234259 1.00299 276.166 -117.581 14.9057 15997 1.00675 -0.00783407 0.00390587 1.00314 268.285 -118.078 17.061 6335 0.985097 -0.00169817 0.00171538 1.00222 279.873 -117.113 14.5064 9954 1.0011 -0.00489458 0.00325984 1.00449 280.66 -117.318 14.6173 44811 1.00548 -0.00274586 0.0048784 1.00278 280.033 -117.133 14.8069 47724 -170 0.995582 0.00114868 -0.000787843 1.0027 268.61 68.3507 15.4545 14502 1.00372 -0.00125352 0.00215931 1.0084 275.632 68.3909 14.9221 16826 1.01128 -0.00728606 0.00174957 1.00864 268.116 67.7095 17.1178 6341 0.988616 -0.00103431 0.00279513 1.00301 279.258 68.6932 14.5465 10424 0.999348 -0.00121888 0.00257363 1.00495 280.099 68.648 14.5274 46018 1.00305 -0.00130152 0.00192717 1.00351 279.586 68.7629 14.9099 49041 -171 0.991978 -0.00439327 0.000265855 0.999701 268.469 253.907 15.3238 14423 1.00204 -0.005502 -0.00116942 1.00461 275.492 254.013 14.8305 16519 1.0038 -0.00336838 0.00638265 1.00115 267.968 253.466 17.1825 6028 0.985177 -0.00167691 0.00613559 1.00425 279.187 254.42 14.5831 10483 1.00123 -0.00235866 0.00161109 1.00408 279.989 254.344 14.5349 45327 1.00486 -0.00335143 0.00100208 1.00459 279.188 254.565 14.9407 49492 -172 0.99609 -0.00605048 0.00324038 1.00157 268.043 439.277 15.4034 13510 1.00285 -0.00324073 0.000300897 1.0033 275.401 439.404 14.9042 15324 1.01351 -9.29791e-05 -0.000565067 1.00353 267.693 438.27 17.189 5399 0.987611 0.000949254 0.00612043 1.00475 278.684 440.294 14.54 10016 0.999605 -0.0030675 0.00446506 1.00393 279.735 440.174 14.4496 42044 1.0046 -0.00209284 0.00439327 1.00341 279.01 440.288 14.9375 47537 -173 0.992725 -0.0103446 -0.00154711 0.997522 267.041 624.037 15.2067 11921 1.00504 -0.00655679 0.00251371 1.00194 274.604 625.219 14.8297 13526 1.01303 0.000243524 0.00524285 0.997171 266.759 623.128 17.3403 4685 0.988877 -0.00399593 -0.00425706 0.996849 278.436 626.67 14.4448 8693 1.00059 -0.00187132 0.00152651 1.00306 279.249 625.97 14.4284 37496 1.00339 -0.00342307 0.00424293 1.00246 278.73 626.281 14.8548 41115 -174 0.991928 -0.000421685 0.00261026 0.998017 266.361 808.8 15.363 8890 0.99935 0.00151547 0.00189312 0.99883 274.275 810.181 14.8278 9482 1.01003 0.00432354 0.0121613 0.996995 266.476 807.652 17.2723 3342 0.982637 0.00411357 -0.00838533 0.99648 278.506 812.187 14.4702 5960 0.9976 -0.00239006 0.000536644 0.9982 279.024 811.167 14.3103 25566 1.00151 -0.0024124 0.00514768 0.995635 278.541 811.54 14.9374 28383 -175 0.987146 -0.0051638 0.00172959 0.997559 265.9 993.188 15.4516 6202 0.999152 -0.00386263 0.00377919 0.993438 273.618 994.95 15.1997 6494 1.00196 0.000730951 0.0161351 0.998993 266.406 991.45 17.5802 2250 0.987706 -0.00440173 0.00674163 0.995587 278.031 996.281 14.6879 3794 0.995976 -0.00466757 0.00212935 0.997114 278.518 995.793 14.6625 17025 1.00074 -0.000687974 0.00856657 0.995425 278.641 995.915 15.2782 18546 -176 0.989488 0.00534947 0.00110972 1.00299 265.693 1177.66 15.9351 3206 1.00675 -0.00142532 0.0118535 1.00733 273.624 1180.29 15.3429 3418 1.00712 0.00544885 0.01438 1.00389 267.99 1176.62 18.0668 1241 0.993009 0.00372653 0.00559225 1.00866 277.092 1182.56 15.0809 1491 0.998737 0.00137119 0.0041662 0.9981 278.111 1180.4 14.9968 7767 1.00338 0.00047737 0.00986051 0.998677 278.06 1180.58 15.5425 8197 -177 0.997639 -0.00608658 -3.91784e-05 0.98547 265.308 1361.46 16.2677 1822 0.996025 0.000484972 0.00231534 1.00251 273.665 1364.47 15.6508 2107 1.00719 0.0170973 0.00878718 1.02217 268.862 1362.72 18.9549 774 1.0059 -0.00856846 0.0088281 1.00325 277.372 1366.3 15.0456 731 0.999296 -0.00765599 -0.000126065 1.00475 278.175 1365.91 15.1709 4126 1.00167 -0.0111117 0.0145278 0.99805 278.131 1365.94 15.6282 4073 -178 0.98548 -0.00307998 0.00659283 1.00695 453.749 -1042.22 16.3497 3910 0.999352 -0.00622839 0.0052462 1.00359 461.918 -1043.44 15.5374 3545 1.00851 0.00233529 -0.00339028 1.00328 456.862 -1040.49 17.7712 872 0.991245 -0.000673719 0.00636095 1.00065 464.16 -1044.39 15.0617 8226 1.00109 -0.00382349 0.00487042 0.996022 467.354 -1043.85 14.906 9141 1.00087 -0.00244168 0.00659311 0.998276 466.765 -1044.04 15.123 12340 -179 0.992471 0.000293845 0.00546942 0.994648 453.644 -857.395 16.0793 5133 0.992021 0.00704671 0.00216401 0.998411 461.5 -858.702 15.2754 4563 1.00052 -0.000194135 -0.00663683 1.00139 455.961 -856.627 17.363 1277 0.989894 0.000481558 0.00491897 1.00043 463.773 -859.607 14.6357 11261 1.00056 0.000626383 0.00585709 0.999502 467.224 -858.961 14.5371 12053 1.00099 0.00116659 0.0021534 1.00008 466.461 -859.077 14.7249 16514 -180 0.989005 -0.00956456 0.00563675 1.003 453.392 -672.57 15.9708 7506 0.992295 -0.00771934 0.000262179 0.997286 461.554 -673.941 15.2948 6822 1.00509 -0.0185121 -0.00157988 1.00216 456.051 -672.333 17.4579 1895 0.992907 -0.00237779 0.00328793 1.00527 463.721 -674.48 14.6659 19066 1.0016 -0.00323533 0.00554721 1.00398 466.895 -673.92 14.6081 18858 1.00153 -0.00196626 0.00505426 1.00338 466.244 -674.095 14.7859 28079 -181 0.993866 -0.00702881 0.00222575 1.00289 453.216 -487.546 16.068 8724 0.997573 -0.000783918 0.000444587 1.00417 461.076 -488.354 15.4901 8409 1.01393 -0.00292493 0.000249996 1.00601 455.105 -487.042 17.323 2463 0.993407 -0.00418492 0.00373031 1.00293 463.341 -488.608 14.6415 23188 1.00141 -0.00109211 0.00160348 1.00231 466.373 -488.058 14.5569 23106 1.00305 -0.00324098 0.00144012 1.003 465.864 -488.325 14.8562 33588 -182 0.994327 0.000945898 0.00244455 1.00005 453.016 -302.651 15.9852 9082 0.997012 -0.00248228 -0.000468512 1.0012 461.155 -302.977 15.2096 8644 1.01585 -0.00411315 0.00663643 0.999666 454.965 -303.201 17.0605 2679 0.994692 -0.00103699 0.00312631 1.00392 463.124 -302.587 14.6367 23388 1.00183 -0.0022969 0.0028709 1.00563 466.025 -302.599 14.6136 23354 1.00253 -0.00397916 0.00125513 1.00423 465.689 -302.55 14.7503 33171 -183 0.991712 -0.00343954 0.00173884 1.00343 452.646 -116.667 16.1381 9673 0.99938 -0.000178981 0.00341442 1.00395 460.967 -116.974 15.2768 9207 1.00452 0.00389493 0.00391948 0.996047 454.805 -117.497 17.149 2858 0.992485 -0.00313207 0.00110111 1.0047 462.825 -116.743 14.7594 25535 1.00356 -0.00185166 0.00233501 1.00468 465.884 -116.773 14.532 24994 1.00475 -0.00215378 0.00163597 1.00488 465.513 -116.663 14.8649 36421 -184 0.996754 -0.00585887 0.00248674 1.00217 452.252 68.3174 16.0401 9390 1.00111 -0.00631417 -0.004717 1.00015 460.777 68.4273 15.3797 8993 1.01733 0.00530772 0.00187229 0.997603 455.184 67.284 17.1671 2701 0.992569 -0.000578273 0.00126476 1.00422 462.347 68.9822 14.6401 24190 1.00158 -0.00324812 -0.000416641 1.00298 465.496 68.9422 14.5417 23910 1.00274 -0.00288024 -0.000531122 1.00282 465.055 69.1059 14.8918 34091 -185 0.995334 -0.00269549 0.00266115 0.999232 451.882 254.041 16.1264 9107 1.00234 -0.000522948 -0.000581644 1.0024 460.702 254.174 15.261 8617 1.00933 -0.00529043 -0.00493725 1.00885 455.188 253.145 17.2501 2508 0.99477 -0.00156245 0.00304152 1.00339 462.375 254.905 14.6823 23616 1.00377 -0.00351033 0.00313977 1.00402 465.303 254.81 14.5156 23315 1.00519 -0.00200362 0.00460168 1.00509 465.017 255.095 14.8145 34221 -186 0.994824 -0.00122843 0.000358538 0.999034 451.205 439.233 16.0834 9024 0.998979 -0.0063405 0.00184733 1.00112 460.189 439.921 15.3041 8409 1.00391 -0.0044671 0.0104984 1.00785 454.492 438.568 17.4681 2326 0.995206 -0.00447511 0.00365765 1.00395 461.658 440.65 14.7274 23895 1.00398 -0.00223121 0.00224529 1.00351 464.672 440.499 14.4667 23465 1.00467 -0.00194781 0.000152122 1.00307 464.497 440.805 14.9201 34517 -187 0.993275 -0.00784374 -0.000243411 0.997359 450.231 624.175 16.1012 7812 1.00341 -0.00761999 -0.00152011 0.999518 459.792 625.159 15.348 7271 1.01432 0.00035144 0.00316026 1.00718 454.256 623.919 17.4492 1881 0.993837 -0.0044443 0.00059657 0.999515 461.289 626.59 14.7006 21279 0.999149 -0.0074809 -0.000237478 1.00144 464.277 625.996 14.5745 20572 1.00329 -0.0041236 -0.00217799 1.00226 464.243 626.517 14.9146 30874 -188 0.996196 -0.00323528 -0.00254546 0.997839 448.927 808.889 15.9926 6212 0.998966 0.00233507 -0.00208685 0.995191 458.771 810.21 15.3554 5648 1.01548 0.000585661 0.00294865 0.998738 452.913 809.04 17.4502 1492 0.996024 -0.000812176 -0.000799318 0.99871 460.876 811.648 14.7128 15553 1.00125 -0.00459018 0.000239622 0.997991 463.699 810.97 14.4808 15064 1.00376 -0.00258039 -0.00169302 0.993246 463.753 811.587 14.9396 21785 -189 0.996489 -0.000226034 0.00423688 1.00608 448.447 993.155 16.2237 4095 1.00234 -0.00150231 0.00431755 0.997335 457.822 994.753 15.6697 3676 1.01769 -0.0029949 0.0129639 0.988771 453.395 992.471 17.7161 1012 0.995122 -0.00138977 -0.00148772 0.993437 460.563 996.151 14.7704 9188 1.00166 -0.00134886 0.00110012 0.995983 463.225 995.572 14.6166 9604 1.00111 -0.000674909 -0.00174231 0.998089 463.635 996.314 15.0131 12796 -190 0.980755 0.00138386 -0.0023434 1.00114 448.294 1177.66 16.441 2527 0.997575 -0.00402063 -0.00344924 0.994509 458.051 1179.89 15.6137 2353 1.00366 0.0020583 -0.000600025 0.993895 454.267 1178.47 18.327 657 0.991278 0.00103183 0.00090762 1.00208 459.941 1181.33 14.8606 4672 0.99367 -0.00430711 -0.00202699 0.997259 463.053 1180.72 14.7962 5622 0.999831 -0.000602656 0.000309565 1.00089 463.713 1181.23 15.2243 6972 -191 1.00702 0.00408707 0.00204789 0.997061 449.154 1362.35 16.6548 1435 1.01003 -0.00102957 -0.00522083 0.992076 458.684 1364.97 16.012 1482 1.02139 -0.0126679 0.00885551 0.980829 454.757 1363.22 18.0471 444 0.996158 -0.0038866 -0.00374096 1.00051 460.041 1366.39 15.1959 2164 0.99802 0.00483544 -0.00493169 1.00521 463.121 1365.27 15.2085 3127 0.997791 0.00326904 -0.0105413 1.00604 463.374 1366.4 15.6324 3411 -192 0.996953 -0.0102682 0.0111724 1.01088 495.799 -1048.71 15.7765 3848 0.987849 -0.0106141 -0.000450444 0.993054 488.255 -1044.42 15.078 2431 0.99461 0.00203856 0.0181232 1.00146 493.131 -1045.11 17.1942 913 0.983826 0.00410509 0.00803011 0.992143 483.671 -1043.02 15.1748 5562 0.983001 0.00374488 0.00228539 0.977394 480.866 -1039.79 14.7467 4104 0.987694 0.00204263 0.00178393 0.980929 477.175 -1039.57 15.541 3291 -193 0.999009 -0.0104097 0.00899529 0.99966 495.517 -862.744 15.4828 4274 0.996016 -0.00751168 0.00483723 1.00148 487.633 -860.723 15.1276 2662 1.00732 -0.0113705 0.0136099 1.01419 493.292 -860.707 16.5499 1078 0.972501 -0.0018379 0.00686573 0.992926 483.467 -860.272 14.7921 9153 0.972656 -0.00623714 0.00903029 0.986981 480.559 -858.238 14.7043 5325 0.966553 -0.00648023 0.00836041 0.979953 476.291 -858.256 15.5284 5665 -194 0.998903 -0.00125205 0.00206848 1.00509 494.163 -676.774 15.4624 5811 0.992639 -0.00794654 0.00351425 0.99203 486.707 -675.259 15.2364 3936 1.01293 -0.00425762 0.0131243 1.00733 492.532 -674.998 16.7712 1631 0.971346 -0.00922503 0.00570729 0.999895 482.388 -675.978 14.8807 13663 0.972206 -0.00225686 0.00599534 0.992932 479.308 -674.746 14.6684 8039 0.971106 -0.00807145 0.00195478 0.996041 475.072 -675.598 15.6832 8577 -195 0.997493 0.00395477 -0.000184963 0.999227 494.278 -491.699 15.4667 6935 0.995354 -0.000382178 -0.00405576 0.996527 486.696 -490.572 14.9922 4690 1.0068 -0.000428994 -0.00136361 1.0024 492.777 -490.88 16.3582 2025 0.971061 0.00419879 0.00409465 1.00355 482.08 -491.148 14.8179 17504 0.968835 0.00628731 0.000631172 0.995223 479.43 -490.6 15.0271 9588 0.970358 0.00137821 0.0018088 1.00023 475.118 -491.28 16.1479 10693 -196 0.993089 0.00727153 0.00143503 1.0042 494.782 -306.13 15.5871 7495 0.987565 -0.00226413 0.00439834 1.00655 486.926 -305.805 15.2096 5234 0.986993 -0.00343534 -0.00562955 1.00001 492.955 -305.458 16.4256 2371 0.97202 0.0085577 0.00297971 1.00365 483.213 -305.727 14.9262 17824 0.970214 0.00666771 0.00226497 1.0025 480.382 -305.577 14.9613 10258 0.968559 0.0111472 0.000167518 1.0077 476.495 -305.755 16.2497 10626 -197 0.99561 0.000583182 0.0025803 0.999184 495.376 -120.9 15.5029 8892 0.987963 0.000732478 0.00397195 1.00181 487.387 -119.898 15.1252 5941 0.999703 0.00759235 -0.000397216 1.00056 493.025 -120.694 16.3164 2715 0.971911 0.00674193 0.000151979 1.00482 484.224 -120.214 14.7539 20040 0.972787 0.00743419 0.00278202 1.00332 481.734 -120.272 14.966 11488 0.970201 0.00743649 0.00255527 1.01268 478.079 -120.381 16.0009 11822 -198 1.00001 0.0058565 0.00100987 0.999926 495.984 65.2808 15.5201 8613 0.992477 -0.00125877 -0.000686396 1.00135 488.022 65.0787 15.1082 5943 1.00181 0.00542969 -0.00265703 0.999197 494.034 64.8078 16.3853 2651 0.976725 0.00474664 -0.00165159 1.00463 485.385 65.7086 14.8363 19639 0.974036 9.70022e-05 -0.0014509 1.00487 482.732 65.5319 14.8864 11528 0.969182 0.00109293 -0.00167827 1.00327 478.888 65.7236 15.8049 11722 -199 0.995476 0.00193355 -0.000322541 1.00439 496.783 250.9 15.5639 8277 0.992174 -0.00192101 -0.00283408 1.00325 488.384 250.741 15.18 5459 1.00245 0.000847782 -0.00813098 1.00756 493.237 250.009 16.4825 2321 0.9712 0.00101051 0.00233797 1.00501 486.187 251.586 14.7458 19245 0.972567 0.00222507 -4.57315e-05 1.00266 483.078 250.978 14.7463 11093 0.965198 0.00211208 -0.000392968 1.00367 479.757 251.464 15.878 11793 -200 0.995967 0.010098 -0.00142705 1.0084 497.299 437.001 15.5857 5798 0.983102 0.00810019 -0.00464094 1.00834 488.782 436.366 14.8076 3967 0.99678 0.0114733 -0.00510829 1.00594 494.581 435.058 16.5275 1613 0.972507 0.00203969 -0.00259123 1.00778 486.745 437.402 14.5977 15131 0.973306 -2.26992e-05 -0.0030099 1.00207 483.839 436.393 14.398 8200 0.966875 0.0107645 -0.000856691 1.00338 480.58 437.384 15.4365 9349 -201 0.993149 0.000479662 -0.00548042 0.999214 498.027 623.088 15.5288 6849 0.979308 0.0104864 -0.00210257 0.99816 489.467 621.964 14.7537 4591 0.99426 -0.00150908 0.00130103 1.00781 494.526 621.881 16.7536 1845 0.972404 0.0055325 -0.00768507 1.00456 487.631 623.143 14.723 17008 0.970147 0.00845106 -0.00767291 0.997231 484.663 621.663 14.3916 9688 0.959251 0.00675437 -0.00525507 0.999993 481.407 622.773 15.3269 10629 -202 1.00866 0.0002268 -0.00764333 1.00295 498.655 809.201 15.7973 5351 0.99274 -0.0045845 -0.00603324 0.999431 489.653 807.28 15.0012 3553 1.01343 0.00162908 2.31332e-05 1.01121 494.351 807.083 16.6599 1438 0.977306 -0.00105726 -0.00914959 0.999386 488.298 808.543 14.6782 12117 0.977771 -0.00190224 -0.0157122 0.993964 485.595 806.285 14.3337 7261 0.970551 -0.00227734 -0.0120126 0.990853 482.101 806.879 15.097 7502 -203 1.01074 -0.00830368 -0.00572718 1.00933 498.993 995.653 15.9567 4120 1.00275 -0.00287552 -0.00784957 0.997645 490.187 992.472 14.7404 2570 1.0042 -0.00679541 -0.00491965 0.994726 494.307 992.017 17.0598 1097 0.97999 -0.000612752 -0.00992155 0.994569 488.42 992.889 14.7557 7067 0.979698 0.00208011 -0.0158108 0.99014 485.331 990.131 14.5499 4792 0.96904 -0.0024484 -0.0113983 0.994616 481.888 990.014 15.225 4087 -204 0.986277 0.000959546 -0.0108711 1.01108 498.6 1181.83 15.6649 1218 0.990959 0.00802544 -0.00562045 1.00602 489.907 1176.94 15.0246 858 1.02849 0.00184599 -0.00424814 1.01089 494.164 1177.26 17.5222 360 0.963228 0.00517734 -0.0264563 1.00712 488.205 1177.05 15.143 1510 0.977923 0.00305308 -0.0099929 0.990713 485.618 1172.84 14.666 1440 0.961353 0.00853302 -0.0163733 0.994209 481.823 1172.46 15.7876 914 -205 1.00558 0.00336818 -0.0185832 1.01008 499.104 1368.98 16.0541 1393 0.993154 -0.0172267 -0.0165105 0.999707 490.87 1363.05 15.2186 951 0.999947 -0.0154678 -0.0215095 1.0119 494.379 1365.13 17.9138 407 0.990523 0.00281522 -0.00407685 1.00285 488.741 1361.68 15.4973 1096 0.986692 -0.00335694 -0.0170271 0.993793 485.939 1357.26 15.0137 1407 0.972448 0.0107866 -0.0221457 1.01357 481.706 1356.81 16.5618 654 -206 0.982707 0.00544087 0.0300123 1.00864 496.463 -1052.29 15.8507 3800 0.971863 -0.0131335 0.0195674 1.00106 488.546 -1046.85 14.6562 3326 0.962552 -0.00255917 0.026637 1.00731 491.763 -1047.39 17.2525 2189 0.985375 -0.00476217 0.0147274 1.00774 494.752 -1052.76 15.3587 3215 0.986668 -0.00886651 0.0124989 1.00494 489.701 -1049.04 15.3322 1878 0.980459 -0.007788 0.00827661 0.99716 489.642 -1047.33 15.0407 1172 -207 0.978086 -0.00265882 0.0107079 1.0125 496.202 -865.448 15.237 9468 0.975403 -0.0109391 0.0101452 0.997703 486.863 -862.215 14.4457 6769 0.965094 -0.00731288 0.0107054 1.00645 489.648 -861.526 16.3608 5976 0.991487 -0.00058335 0.00979895 1.00823 494.149 -866.37 15.0221 6008 0.987454 -0.00148701 0.0119561 1.0054 488.743 -863.56 14.9663 3402 0.989251 -0.00181283 0.0083896 1.01174 488.259 -862.221 14.8447 1914 -208 0.977706 0.00308761 0.00503266 1.00685 496.24 -678.595 15.1726 11534 0.971793 -0.0046552 0.00579696 0.998337 486.249 -676.867 14.3096 7895 0.966101 -0.00158959 0.00925611 0.996636 489.388 -676.4 16.2236 8077 0.994001 0.00197863 0.0064875 1.00163 494.667 -679.902 15.113 6680 0.987162 -0.000759079 0.00798213 1.00122 489.035 -678.165 14.9548 3920 0.989437 -0.00275129 -4.67405e-05 0.99659 488.105 -676.773 14.5033 2018 -209 0.972605 -0.00550936 0.00293999 1.00595 495.38 -492.868 15.3067 14186 0.971433 -0.0045764 0.00451704 1.00246 485.021 -492.022 14.5852 10242 0.970049 -0.00727685 0.00705368 0.999893 488.726 -491.951 16.3882 10584 0.989045 -0.00504455 0.00426561 1.00762 494.514 -493.798 14.9336 8811 0.983439 0.0013914 0.00344323 1.0012 488.731 -492.504 15.0486 5193 0.98266 -0.00548939 0.00677957 0.992452 487.778 -491.654 14.7437 2539 -210 0.975345 -0.00305848 -0.0026432 1.00639 494.334 -307.173 15.284 14926 0.973963 -0.000797406 0.00348499 1.0049 483.948 -306.7 14.5001 11129 0.972889 0.000334933 0.00105834 1.00686 487.773 -306.875 16.5685 11094 0.991665 0.000931533 0.000531702 1.00788 494.056 -307.377 15.0842 9977 0.985223 -0.0036378 0.00103013 1.00992 487.951 -306.995 15.0613 5853 0.981056 -0.00268797 -0.00131494 1.00653 487.259 -306.407 14.7885 3046 -211 0.975416 -0.00414177 3.96762e-05 1.00965 493.952 -121.6 15.28 12800 0.970922 -0.00335462 0.00181518 1.00777 483.671 -121.328 14.8151 9587 0.97405 -0.00676854 -0.0001607 1.00715 487.236 -121.606 16.6033 9504 0.987555 -0.00133165 0.00155995 1.00843 494.232 -121.21 15.0235 8894 0.982674 -0.00281473 -0.00269393 1.00819 487.856 -121.088 15.0868 5139 0.986615 -0.0030364 0.000876282 1.01223 487.385 -120.674 14.809 2636 -212 0.969135 -0.000727648 -0.00454047 1.0044 493.299 64.1546 15.2497 15322 0.969523 0.00122075 -0.00193676 1.00287 483.415 64.1639 14.7395 11471 0.962718 -0.000575689 -0.00496455 1.00939 486.583 64.2328 16.7284 11040 0.985168 -0.00676577 -0.0063891 1.00699 493.716 64.8389 14.9912 10737 0.981948 0.00484132 -0.00918951 1.00066 487.507 64.3832 14.9435 6172 0.985974 -0.00232616 -0.00503568 0.994531 487.016 64.8611 14.977 3045 -213 0.964937 -0.00824605 -0.000484055 1.00466 492.713 250.351 15.3136 15549 0.965961 0.00117367 0.00076869 1.00397 483.474 249.916 14.8983 10884 0.972881 -0.00239921 0.000686004 1.00461 485.813 250.095 16.808 10852 0.981732 -0.00335783 -0.00040349 1.00412 493.408 251.173 15.0481 9902 0.978836 -0.00119353 0.00246842 1.0069 487.435 250.503 15.0552 5674 0.979321 -0.0069558 -0.00165429 1.00018 486.815 250.607 15.1963 2837 -214 0.971728 -0.00645457 0.000785514 1.00527 491.53 435.949 15.2747 15429 0.967483 -0.00126789 -0.00350441 1.00367 483.029 435.34 14.7241 10631 0.971722 -0.011811 -0.0031063 1.0008 484.441 435.305 16.7519 10378 0.992269 -0.00648454 -0.00450704 1.00645 492.712 437.245 14.848 9655 0.98507 -0.00373478 -0.00894252 0.997699 486.837 435.787 15.01 5487 0.987816 -0.00601038 -0.00129778 0.991714 486.362 435.508 14.7968 2682 -215 0.972517 -0.00015264 -0.00296177 1.00246 490.137 621.044 15.2324 14250 0.968162 -0.00125145 -0.00264868 1.00052 482.347 620.013 14.6007 9402 0.973768 -0.000576893 -0.00343099 0.999791 483.093 619.646 16.7536 9471 0.983171 -0.00162561 -0.00433408 1.00921 492.066 623.404 14.9008 8535 0.979418 -0.00663386 -0.00857805 1.00488 485.888 621.23 15.0369 4873 0.979237 0.00389223 -0.0036998 1.00644 485.515 620.397 14.7005 2464 -216 0.977049 -0.0037096 -0.00715515 1.00449 489.526 806.271 15.2968 11283 0.968865 0.00115479 -0.00746729 0.989722 482.206 803.796 14.5614 7222 0.98474 -0.00536518 -0.0120735 0.992819 482.516 802.694 16.5044 7001 0.988557 -0.000526925 -0.0109712 0.999878 491.685 808.825 14.9493 6648 0.98834 -0.00290094 -0.00138415 0.996077 485.901 805.749 15.085 3830 0.981554 -0.00409184 -0.00691535 0.994737 485.601 804.979 14.7976 1859 -217 0.982925 -0.0109047 -0.0160694 0.997495 488.17 990.996 15.696 6345 0.974544 0.000937198 -0.00737005 0.991653 482.052 986.969 14.6091 4586 0.986815 -0.00691806 -0.00414143 0.990905 481.958 986.369 16.7064 3800 0.989753 -0.00597115 -0.00421966 0.999103 491.142 994.411 15.0136 4803 0.987922 -0.00502063 0.00185122 0.995848 485.601 990.451 15.2193 2645 0.994727 0.00637758 0.00563481 1.00097 485.915 989.255 15.1446 1418 -218 0.984088 -0.00843856 -0.022323 0.990263 487.016 1174.99 16.3432 2549 0.978865 0.00499547 -0.00750338 0.98365 482.147 1169.51 14.8826 2698 0.976252 0.00183127 -0.00753455 0.990245 482.338 1169.74 17.7718 1474 0.996922 -0.00588553 -0.011556 0.993533 490.075 1179.9 15.1331 2939 0.985141 -0.000733548 -0.0134961 0.99021 485.134 1174.51 14.9794 1766 0.987895 5.58871e-05 0.000873246 0.994674 485.196 1173.69 14.9021 1039 -219 0.982468 -0.0208053 -0.0182035 0.973038 484.932 1356.35 16.7745 863 0.980344 -0.00372555 -0.0211956 0.973156 480.758 1350.44 14.9031 1303 0.956091 -0.00971368 -0.0181817 0.965599 482.203 1350.26 17.7782 436 0.999022 -0.00865727 -0.0145297 0.990428 490.102 1364.97 15.1288 1641 0.986916 -0.00890747 -0.0109883 0.984882 484.862 1358.43 15.5575 939 0.984534 -0.000882773 -0.00657948 0.975154 485.666 1357.13 15.2038 723 -220 0.982293 -0.00176362 -0.00431919 0.99696 -461.174 487.908 15.8835 4321 0.996625 -0.00141302 -0.00510011 0.987434 -465.076 485.672 14.6429 5028 1.00216 0.000808676 -0.0166554 0.994115 -466.049 488.587 16.065 5949 0.995019 0.00289869 -0.00835173 0.985869 -453.791 485.516 15.4456 2735 0.999725 0.000963278 -0.000237189 0.989363 -460.497 484.502 15.5057 2117 1.00584 0.000360141 0.00554122 0.999308 -461.587 485.347 15.4239 1056 -221 0.965791 0.00228957 0.0118067 1.0008 -279.72 487.252 15.2299 2006 0.985961 0.000123034 0.00767907 0.989745 -281.129 486.219 14.4526 9086 0.987641 0.00162263 0.0128789 1.01035 -280.532 490.211 16.3929 7756 0.99708 0.000997695 -0.00204265 0.985265 -271.034 485.04 15.1336 4219 0.997606 0.00333386 -0.00106164 0.985368 -276 484.948 15.3343 3819 1.00201 -0.000855577 -0.00575273 0.989894 -276.479 485.624 15.0042 1998 -222 0.968937 0.00139467 -0.00452255 0.990426 -100.297 488.013 14.9454 3112 0.991723 -0.000570983 -0.0121866 0.991045 -98.2942 485.913 15.1773 8679 0.989201 0.000605183 0.00643554 1.00478 -97.891 492.13 16.397 6642 0.991065 0.00331629 -0.00849021 0.975549 -87.8448 484.504 14.887 5301 0.997232 0.00527702 -0.0134774 0.982103 -91.9189 484.848 15.1689 6583 1.00711 0.00952454 -0.0142044 0.977851 -91.7425 486.074 14.6048 4101 -223 0.986971 -0.00174319 0.00759761 0.989083 81.9765 488.385 15.0556 4428 0.997492 0.00348515 0.0053028 0.982559 86.2506 485.998 14.8777 5547 0.990261 0.0102009 0.00663905 1.00863 85.6436 493.677 16.8403 2674 0.971413 0.00755796 -0.00283851 0.975364 94.0137 484.019 14.5816 3008 0.991562 0.00149107 0.00329027 0.985007 92.4634 484.354 15.3484 8464 0.994428 0.00740919 -0.00580346 0.98339 93.0587 485.43 14.6054 7499 -224 1.00442 -0.00328019 0.0239222 0.985718 265.171 489.55 15.8195 3824 1.00996 -0.00557442 0.0132886 0.985174 270.871 486.874 15.1708 3840 1.01349 -0.00758982 0.0135231 1.01022 270.697 492.961 16.7927 1215 0.97307 -0.000313847 0.0267117 0.980107 276.491 483.598 14.3793 2048 0.996061 -0.000585259 0.008064 0.983028 276.296 485.876 14.8265 9616 0.992688 0.00334766 -0.00447104 0.98558 276.707 485.673 15.0998 9213 -225 1 0 0 1 0 0 -1 0 1 0 0 1 0 0 -1 0 1 0 0 1 0 0 -1 0 1 0 0 1 0 0 -1 0 1 0 0 1 0 0 -1 0 1 0 0 1 0 0 -1 0 -226 0.973206 0.00242448 -0.0183804 0.97785 -464.321 506.164 16.0601 1154 0.973133 -0.00181658 -0.010302 0.977345 -467.06 505.946 14.9401 2257 0.992024 -0.00443582 -0.0372496 0.978852 -468.971 507.726 16.5482 2192 0.974117 0.00428125 0.00146148 0.973041 -451 505.423 15.7543 1570 0.98116 0.00703982 0.00847623 0.974151 -458.512 503.42 16.0963 1251 1.00259 0.0031202 -0.00335943 0.977489 -457.276 505.016 15.6571 812 -227 0.943476 -0.0234379 0.0151033 0.998615 -284.263 505.32 15.5908 440 0.974268 -0.00547684 0.00500938 0.993435 -282.87 505.772 15.4053 2998 0.979604 0.00538023 0.0184976 0.986777 -284.723 506.809 16.8004 2253 0.970542 0.0017637 -0.00125605 0.964145 -267.391 504.991 15.4087 1803 0.981473 -0.00110414 0.000905759 0.983988 -273.722 503.685 15.285 1691 0.996716 0.0041969 -0.00424218 0.979709 -271.4 504.899 15.1078 1294 -228 0.950465 0.0121111 -0.00241124 0.985749 -102.892 509.582 15.3113 679 0.973858 -0.00433784 -0.0103024 0.983322 -99.6449 504.95 15.8437 2489 0.971838 0.00340854 -0.00607845 0.991044 -102.118 507.348 16.8454 2324 0.97814 0.00515578 -0.00155061 0.966802 -83.6012 504.053 15.3955 1562 0.984133 -0.00241645 -0.00726368 0.971491 -89.2491 502.86 15.1394 2172 0.984892 0.000475877 -0.0109994 0.971476 -86.421 504.9 15.0365 1977 -229 0.967331 0.00812282 0.00074923 0.983923 78.4881 509.74 15.3921 1343 0.984551 0.00112075 0.00690411 0.994745 84.4353 504.2 15.5056 1955 0.985949 0.0197209 0.0106753 1.02152 79.5642 506.76 17.7953 1288 0.963679 -0.00139368 -0.0226036 0.978652 97.4808 501.914 14.9779 721 0.978432 0.00299532 0.00356103 0.974703 94.538 502.401 15.6245 2280 0.979728 -0.00134909 -0.00410109 0.979955 97.6709 503.38 14.9913 2708 -230 0.974033 -0.0117638 0.0092515 0.97522 262.172 509.835 15.4784 1376 0.985898 -0.0119297 0.00660684 0.971156 269.42 505.718 15.5299 1499 1.00379 -0.00213605 0.013694 1.00631 264.191 508.756 17.9241 632 0.950069 0.000212448 0.0173454 0.96918 278.934 502.398 14.8418 556 0.965359 0.00272747 -0.00397204 0.973373 278.53 504.366 15.2722 2783 0.97252 -0.0059961 -0.00629525 0.976544 281.481 503.446 15.9409 2524 -231 0.973039 -0.016299 -0.00424167 0.973329 445.278 511.213 15.9642 1288 0.979699 -0.0141966 -0.00655447 0.975566 453.822 506.917 15.6733 1225 0.974587 -0.0455613 -0.0210376 0.980656 450.459 510.34 18.0467 461 0.9684 -0.009314 0.00884711 0.963792 459.895 505.013 14.9392 1496 0.973162 -0.0111986 -0.00494824 0.970142 461.656 504.843 15.0546 2252 0.975176 -0.0111494 -0.00383869 0.971198 464.851 503.587 15.9097 2377 diff --git a/icaruscode/CRT/CRTUtils/RecoUtils.cc b/icaruscode/CRT/CRTUtils/RecoUtils.cc index 7c4c8cfcf..74166ee0f 100644 --- a/icaruscode/CRT/CRTUtils/RecoUtils.cc +++ b/icaruscode/CRT/CRTUtils/RecoUtils.cc @@ -191,10 +191,10 @@ TopCRTTransformations LoadTopCRTTransformations() std::string fullFileName; cet::search_path searchPath("FW_SEARCH_PATH"); searchPath.find_file("TopCrtCorrectionByTPC.txt", fullFileName); - /*if (!searchPath.find_file("TopCrtCorrectionByTPC.txt", fullFileName)) { + if (!searchPath.find_file("TopCrtCorrectionByTPC.txt", fullFileName)) { mf::LogError("CRTMatchingUtils_LoadTopCrtTransformation") << "Top CRT Correction transformation file not found in FW_SEARCH_PATH."; - }*/ + } std::ifstream corrFile(fullFileName, std::ios::in); std::map Type0Corr; std::map Type1Corr; From b26a5a09d9187bc0f252adaf2083fcdbc1e81f4e Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Tue, 21 Jan 2025 15:45:00 +0100 Subject: [PATCH 26/28] Introduced a function that checks if the Top CRT corrections were really imported --- icaruscode/CRT/CRTT0Tagging_module.cc | 2 +- icaruscode/CRT/CRTUtils/RecoUtils.cc | 4 +++- icaruscode/CRT/CRTUtils/RecoUtils.h | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/icaruscode/CRT/CRTT0Tagging_module.cc b/icaruscode/CRT/CRTT0Tagging_module.cc index 054ab3a2e..3ea053186 100644 --- a/icaruscode/CRT/CRTT0Tagging_module.cc +++ b/icaruscode/CRT/CRTT0Tagging_module.cc @@ -454,7 +454,7 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) geo::Point_t CRTHitCoordinate = {crtHit.x_pos, crtHit.y_pos, crtHit.z_pos}; - if(fData){ // Realignment only applies to Data, not MC + if(fData && fTopCRTTransformations.imported){ // Realignment only applies to Data, not MC if(crtSys==0){ CRTHitCoordinate = icarus::crt::dataTools::ApplyTransformation(crtHit, TopCRTCorrection, fTopCRTCenterMap); } diff --git a/icaruscode/CRT/CRTUtils/RecoUtils.cc b/icaruscode/CRT/CRTUtils/RecoUtils.cc index 74166ee0f..5b4e4e7b8 100644 --- a/icaruscode/CRT/CRTUtils/RecoUtils.cc +++ b/icaruscode/CRT/CRTUtils/RecoUtils.cc @@ -190,6 +190,7 @@ TopCRTTransformations LoadTopCRTTransformations() { std::string fullFileName; cet::search_path searchPath("FW_SEARCH_PATH"); + bool imported = false; searchPath.find_file("TopCrtCorrectionByTPC.txt", fullFileName); if (!searchPath.find_file("TopCrtCorrectionByTPC.txt", fullFileName)) { mf::LogError("CRTMatchingUtils_LoadTopCrtTransformation") @@ -232,8 +233,9 @@ TopCRTTransformations LoadTopCRTTransformations() Type3Corr.insert({variables.at(0), Type3}); Type4Corr.insert({variables.at(0), Type4}); Type5Corr.insert({variables.at(0), Type5}); + imported = true; } - TopCRTTransformations LoadedTransformations={Type2Corr, Type1Corr, Type0Corr, Type4Corr, Type5Corr, Type3Corr}; + TopCRTTransformations LoadedTransformations={Type2Corr, Type1Corr, Type0Corr, Type4Corr, Type5Corr, Type3Corr, imported}; return LoadedTransformations; } diff --git a/icaruscode/CRT/CRTUtils/RecoUtils.h b/icaruscode/CRT/CRTUtils/RecoUtils.h index 8453f56b7..8d71e665c 100644 --- a/icaruscode/CRT/CRTUtils/RecoUtils.h +++ b/icaruscode/CRT/CRTUtils/RecoUtils.h @@ -72,6 +72,7 @@ struct TopCRTTransformations TopCRTCorrectionMap WE; TopCRTCorrectionMap WW; TopCRTCorrectionMap WestCC; + bool imported; }; using TopCRTCentersMap = std::map; From 7792a319078d12c583417c33e1d194025d2e4c97 Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Wed, 22 Jan 2025 19:24:32 +0100 Subject: [PATCH 27/28] Introduction of additional products, namely association of T0 with PFPs, association of Tracks/PFP with CRTT0TaggingInfo --- icaruscode/CRT/CRTT0Tagging_module.cc | 23 +++++++++++++++++++---- icaruscode/IcarusObj/classes.h | 3 ++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/icaruscode/CRT/CRTT0Tagging_module.cc b/icaruscode/CRT/CRTT0Tagging_module.cc index 3ea053186..7e716959c 100644 --- a/icaruscode/CRT/CRTT0Tagging_module.cc +++ b/icaruscode/CRT/CRTT0Tagging_module.cc @@ -165,6 +165,10 @@ icarus::crt::CRTT0Tagging::CRTT0Tagging(fhicl::ParameterSet const& p) produces< art::Assns >(); produces< art::Assns >(); produces< std::vector >(); + produces< art::Assns >(); + produces< art::Assns >(); + produces< art::Assns >(); + //produces< art::Assns >(); //produces< art::Assns >(); //produces< art::Assns >(); @@ -244,11 +248,13 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) auto trackAssn = std::make_unique< art::Assns >(); auto t0CrtHitAssn = std::make_unique< art::Assns >(); auto matchInfoCol = std::make_unique< std::vector >(); - //auto t0matchInfoAssn = std::make_unique< art::Assns >(); - //auto trackMatchInfoAssn = std::make_unique< art::Assns >(); - //auto matchInfoCrtHitAssn = std::make_unique< art::Assns >(); + + auto pfpAssn = std::make_unique< art::Assns >(); + auto trackMatchInfoAssn = std::make_unique< art::Assns >(); + auto pfpMatchInfoAssn = std::make_unique< art::Assns >(); art::PtrMaker makeT0ptr{ e }; // create art pointers to the new T0 + art::PtrMaker makeMatchInfoPtr{ e }; // create art pointers to the CRTT0TaggingInfo std::map< int, const simb::MCParticle*> particleMap; std::map,std::vector> crtParticleMap; @@ -525,14 +531,20 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) <<"Matched CRT time = "<push_back(anab::T0(bestCrtCand.CRThit.ts1_ns, track.ID(), matchedSys, bestCrtCand.CRThit.plane,bestCrtCand.distance)); + t0col->push_back(anab::T0(bestCrtCand.CRThit.ts1_ns, track.ID(), matchedSys, bestCrtCand.CRThit.plane,bestCrtCand.distance)); art::Ptr const newT0ptr = makeT0ptr(t0col->size()-1); // index of the last T0 trackAssn->addSingle(trkPtr, newT0ptr); t0CrtHitAssn->addSingle(bestCrtCand.ptrCRThit, newT0ptr); + pfpAssn->addSingle(p_pfp, newT0ptr); sbn::crt::CRTT0TaggingInfo matchInfo {bestCrtCand.distance, matchedSys, bestCrtCand.CRThit.plane, bestCrtCand.CRThit.ts1_ns, bestCrtCand.delta.X(), bestCrtCand.delta.Y(), bestCrtCand.delta.Z(), bestCrtCand.crossPoint.X(), bestCrtCand.crossPoint.Y(), bestCrtCand.crossPoint.Z(), bestCrtCand.plane, trackFit, matchMethod, trueMatch}; matchInfoCol->push_back(matchInfo); + + art::Ptr const newMatchInfoPtr = makeMatchInfoPtr(matchInfoCol->size()-1); // index of the last CRTT0TaggingInfo + trackMatchInfoAssn->addSingle(trkPtr, newMatchInfoPtr); + pfpMatchInfoAssn->addSingle(p_pfp, newMatchInfoPtr); + } } // End of Track Loop } // End of Cryo Loop @@ -540,6 +552,9 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) e.put(std::move(trackAssn)); e.put(std::move(t0CrtHitAssn)); e.put(std::move(matchInfoCol)); + e.put(std::move(pfpAssn)); + e.put(std::move(trackMatchInfoAssn)); + e.put(std::move(pfpMatchInfoAssn)); } DEFINE_ART_MODULE(CRTT0Tagging) diff --git a/icaruscode/IcarusObj/classes.h b/icaruscode/IcarusObj/classes.h index 7e3b391ce..1aec69c2b 100644 --- a/icaruscode/IcarusObj/classes.h +++ b/icaruscode/IcarusObj/classes.h @@ -7,7 +7,6 @@ #include "icaruscode/IcarusObj/OpDetWaveformMeta.h" #include "icaruscode/IcarusObj/PMTWaveformTimeCorrection.h" #include "icaruscode/IcarusObj/Hit.h" -//#include "icaruscode/IcarusObj/CRTPMTMatching.h" #include "sbnobj/ICARUS/PMT/Trigger/Data/OpticalTriggerGate.h" #include "sbnobj/ICARUS/PMT/Trigger/Data/TriggerGateData.h" @@ -16,8 +15,10 @@ #include "lardataobj/AnalysisBase/T0.h" #include "lardataobj/RecoBase/OpFlash.h" #include "lardataobj/RecoBase/PFParticle.h" +#include "lardataobj/RecoBase/Track.h" #include "lardataobj/Simulation/BeamGateInfo.h" #include "sbnobj/Common/CRT/CRTHit.hh" +#include "sbnobj/Common/CRT/CRTT0TaggingInfo.hh" #include "lardataobj/RawData/OpDetWaveform.h" #include From bb3ad645566dd3c08f221b9e63a3fc230a0e135f Mon Sep 17 00:00:00 2001 From: Francesco Poppi Date: Mon, 3 Feb 2025 16:20:25 +0100 Subject: [PATCH 28/28] This change reflect the changes into SBNObj, where a new data product specifically for the MC truth has been created. --- icaruscode/CRT/CRTT0Tagging_module.cc | 53 +++++++++++++++++++++------ icaruscode/IcarusObj/classes.h | 1 - 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/icaruscode/CRT/CRTT0Tagging_module.cc b/icaruscode/CRT/CRTT0Tagging_module.cc index 7e716959c..166dc4407 100644 --- a/icaruscode/CRT/CRTT0Tagging_module.cc +++ b/icaruscode/CRT/CRTT0Tagging_module.cc @@ -6,7 +6,8 @@ #include "sbnobj/Common/CRT/CRTHit.hh" #include "icaruscode/CRT/CRTUtils/CRTMatchingUtils.h" -#include "sbnobj/Common/CRT/CRTT0TaggingInfo.hh" +#include "sbnobj/Common/CRT/CRTHitT0TaggingInfo.hh" +#include "sbnobj/Common/CRT/CRTHitT0TaggingTruthInfo.hh" #include "icaruscode/CRT/CRTUtils/RecoUtils.h" #include "icaruscode/CRT/CRTUtils/CRTCommonUtils.h" // Framework includes @@ -164,10 +165,12 @@ icarus::crt::CRTT0Tagging::CRTT0Tagging(fhicl::ParameterSet const& p) produces< std::vector >(); produces< art::Assns >(); produces< art::Assns >(); - produces< std::vector >(); - produces< art::Assns >(); - produces< art::Assns >(); - produces< art::Assns >(); + produces< std::vector >(); + produces< art::Assns >(); + produces< art::Assns >(); + produces< art::Assns >(); + produces< std::vector >(); + produces< art::Assns >(); //produces< art::Assns >(); //produces< art::Assns >(); @@ -247,14 +250,18 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) auto t0col = std::make_unique< std::vector > (); auto trackAssn = std::make_unique< art::Assns >(); auto t0CrtHitAssn = std::make_unique< art::Assns >(); - auto matchInfoCol = std::make_unique< std::vector >(); + auto matchInfoCol = std::make_unique< std::vector >(); + auto matchInfoTruthCol = std::make_unique< std::vector >(); auto pfpAssn = std::make_unique< art::Assns >(); - auto trackMatchInfoAssn = std::make_unique< art::Assns >(); - auto pfpMatchInfoAssn = std::make_unique< art::Assns >(); + auto trackMatchInfoAssn = std::make_unique< art::Assns >(); + auto pfpMatchInfoAssn = std::make_unique< art::Assns >(); + + auto truthAssn = std::make_unique< art::Assns >(); art::PtrMaker makeT0ptr{ e }; // create art pointers to the new T0 - art::PtrMaker makeMatchInfoPtr{ e }; // create art pointers to the CRTT0TaggingInfo + art::PtrMaker makeMatchInfoPtr{ e }; // create art pointers to the CRTHitT0TaggingInfo + art::PtrMaker makeMatchTruthInfoPtr{ e }; // create art pointers to the CRTHitT0TaggingTruthInfo std::map< int, const simb::MCParticle*> particleMap; std::map,std::vector> crtParticleMap; @@ -482,7 +489,12 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) if(bestCrtCand.distance<=fGoodCandidateDistance){ int matchedSys=fCrtUtils.MacToTypeCode(bestCrtCand.CRThit.feb_id[0]); if(matchedSys==2) continue; // lets discard Bottom CRT Hits for the moment + bool truthFound=false; bool trueMatch=false; + bool truthIsNu=false; + int trueG4TrackId=std::numeric_limits::lowest(); + int truePdg=std::numeric_limits::lowest(); + if(!fData && !fSkipTruth){ std::vector crtTracks, crtPdgs; std::pair thisMatch=std::make_pair((int)bestCrtCand.CRThit.feb_id[0], bestCrtCand.CRThit.ts1_ns); @@ -499,6 +511,14 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) break; } } + trueG4TrackId=abs(RecoUtils::TrueParticleIDFromTotalRecoHits(clockData, trkHits, false)); + if(trueG4TrackId==0){ + trueG4TrackId=std::numeric_limits::lowest(); + } else { + truthFound=true; + truthIsNu=isNuMap.at(trueG4TrackId); + truePdg=particleMap.at(trueG4TrackId)->PdgCode(); + } } icarus::crt::DriftedTrack thisMatchedDriftedTrack = fMatchingAlg.DriftTrack(trkHits, trkHitMetas, fGeometryService, detProp, clockData, bestCrtCand.CRThit.ts1_ns/1e3, track, 0); icarus::crt::PCAResults driftedMatchedPCAResults=fMatchingAlg.PCAfit(thisMatchedDriftedTrack.sp); @@ -538,13 +558,20 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) t0CrtHitAssn->addSingle(bestCrtCand.ptrCRThit, newT0ptr); pfpAssn->addSingle(p_pfp, newT0ptr); - sbn::crt::CRTT0TaggingInfo matchInfo {bestCrtCand.distance, matchedSys, bestCrtCand.CRThit.plane, bestCrtCand.CRThit.ts1_ns, bestCrtCand.delta.X(), bestCrtCand.delta.Y(), bestCrtCand.delta.Z(), bestCrtCand.crossPoint.X(), bestCrtCand.crossPoint.Y(), bestCrtCand.crossPoint.Z(), bestCrtCand.plane, trackFit, matchMethod, trueMatch}; + sbn::crt::CRTHitT0TaggingInfo matchInfo {bestCrtCand.distance, matchedSys, bestCrtCand.CRThit.plane, bestCrtCand.CRThit.ts1_ns, bestCrtCand.delta.X(), bestCrtCand.delta.Y(), bestCrtCand.delta.Z(), bestCrtCand.crossPoint.X(), bestCrtCand.crossPoint.Y(), bestCrtCand.crossPoint.Z(), bestCrtCand.plane, trackFit, matchMethod}; matchInfoCol->push_back(matchInfo); - - art::Ptr const newMatchInfoPtr = makeMatchInfoPtr(matchInfoCol->size()-1); // index of the last CRTT0TaggingInfo + + art::Ptr const newMatchInfoPtr = makeMatchInfoPtr(matchInfoCol->size()-1); // index of the last CRTHitT0TaggingInfo trackMatchInfoAssn->addSingle(trkPtr, newMatchInfoPtr); pfpMatchInfoAssn->addSingle(p_pfp, newMatchInfoPtr); + if(!fData && !fSkipTruth){ + sbn::crt::CRTHitT0TaggingTruthInfo truthInfo {truthFound, trueMatch, trueG4TrackId, truePdg, truthIsNu}; + matchInfoTruthCol->push_back(truthInfo); + art::Ptr const newMatchTruthInfoPtr = makeMatchTruthInfoPtr(matchInfoTruthCol->size()-1); // index of the last CRTHitT0TaggingTruthInfo + truthAssn->addSingle(newMatchInfoPtr, newMatchTruthInfoPtr); + } + } } // End of Track Loop } // End of Cryo Loop @@ -555,6 +582,8 @@ void icarus::crt::CRTT0Tagging::produce(art::Event& e) e.put(std::move(pfpAssn)); e.put(std::move(trackMatchInfoAssn)); e.put(std::move(pfpMatchInfoAssn)); + e.put(std::move(matchInfoTruthCol)); + e.put(std::move(truthAssn)); } DEFINE_ART_MODULE(CRTT0Tagging) diff --git a/icaruscode/IcarusObj/classes.h b/icaruscode/IcarusObj/classes.h index 1aec69c2b..7430e079a 100644 --- a/icaruscode/IcarusObj/classes.h +++ b/icaruscode/IcarusObj/classes.h @@ -18,7 +18,6 @@ #include "lardataobj/RecoBase/Track.h" #include "lardataobj/Simulation/BeamGateInfo.h" #include "sbnobj/Common/CRT/CRTHit.hh" -#include "sbnobj/Common/CRT/CRTT0TaggingInfo.hh" #include "lardataobj/RawData/OpDetWaveform.h" #include