34 #include "canvas/Persistency/Common/FindManyP.h" 68 std::vector<art::Ptr<recob::Track> > tracklist;
73 std::vector<art::FindManyP<anab::Calorimetry>> calos;
75 calos.emplace_back(tracklist, evt,
l);
80 for (
unsigned trk_i = 0; trk_i < tracklist.size(); trk_i++) {
81 std::vector<art::Ptr<anab::Calorimetry>>
base = calos[0].at(trk_i);
83 std::cout <<
"New Track!\n";
84 std::cout <<
"Base calo (" << fCaloLabels[0] <<
") n calo: " << base.size() <<
std::endl;
85 for (
unsigned plane = 0; plane < base.size(); plane++) {
86 std::cout <<
"N points on plane (" << plane <<
") ID (" << base[plane]->PlaneID() <<
") n points: " << base[plane]->dEdx().size() <<
std::endl;
89 for (
unsigned i = 1; i < fCaloLabels.size(); i++) {
91 std::vector<art::Ptr<anab::Calorimetry>> othr = calos[i].at(trk_i);
92 if (base.size() != othr.size()) {
94 std::cout <<
"Track: " << trk_i <<
" calo (" << fCaloLabels[0] <<
") has (" << base.size() <<
"). Calo (" << fCaloLabels[i] <<
") has size (" << othr.size() <<
") mismatch." <<
std::endl;
97 for (
unsigned plane = 0; plane < base.size(); plane++) {
99 if (base[plane]->
PlaneID() != othr[plane]->PlaneID()) {
101 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i] <<
") plane " << plane <<
": ";
102 std::cout <<
"Plane ID mismatch (" << base[plane]->PlaneID() <<
") (" << othr[plane]->PlaneID() <<
")" <<
std::endl;
106 if (
abs(base[plane]->
Range() - othr[plane]->
Range()) > EPS) {
108 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i] <<
") plane " << plane <<
": ";
109 std::cout <<
"Range mismatch (" << base[plane]->Range() <<
") (" << othr[plane]->Range() <<
")" <<
std::endl;
113 if (
abs(base[plane]->KineticEnergy() - othr[plane]->KineticEnergy()) > EPS) {
115 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i] <<
") plane " << plane <<
": ";
116 std::cout <<
"KineticEnergy mismatch (" << base[plane]->KineticEnergy() <<
") (" << othr[plane]->KineticEnergy() <<
")" <<
std::endl;
120 const std::vector<float> &base_dedx = base[plane]->dEdx();
121 const std::vector<float> &othr_dedx = othr[plane]->dEdx();
123 if (base_dedx.size() == othr_dedx.size()) {
124 for (
unsigned i_dedx = 0; i_dedx < base_dedx.size(); i_dedx++) {
125 if (
abs(base_dedx[i_dedx] - othr_dedx[i_dedx]) > EPS) {
127 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i] <<
") plane " << plane <<
": ";
128 std::cout <<
"dEdx mismatch at index: " << i_dedx <<
" (" << base_dedx[i_dedx] <<
") (" << othr_dedx[i_dedx] <<
")" <<
std::endl;
134 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i] <<
") plane " << plane <<
": " <<
"dEdx size mismatch (" << base_dedx.size() <<
") (" << othr_dedx.size() <<
")" <<
std::endl;
138 const std::vector<float> &base_dqdx = base[plane]->dQdx();
139 const std::vector<float> &othr_dqdx = othr[plane]->dQdx();
141 if (base_dqdx.size() == othr_dqdx.size()) {
142 for (
unsigned i_dqdx = 0; i_dqdx < base_dqdx.size(); i_dqdx++) {
143 if (
abs(base_dqdx[i_dqdx] - othr_dqdx[i_dqdx]) > EPS) {
145 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i] <<
") plane " << plane <<
": ";
146 std::cout <<
"dQdx mismatch at index: " << i_dqdx <<
" (" << base_dqdx[i_dqdx] <<
") (" << othr_dqdx[i_dqdx] <<
")" <<
std::endl;
152 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i] <<
") plane " << plane <<
": " <<
"dQdx size mismatch (" << base_dqdx.size() <<
") (" << othr_dqdx.size() <<
")" <<
std::endl;
156 const std::vector<float> &base_rr = base[plane]->ResidualRange();
157 const std::vector<float> &othr_rr = othr[plane]->ResidualRange();
159 if (base_rr.size() == othr_rr.size()) {
160 for (
unsigned i_rr = 0; i_rr < base_rr.size(); i_rr++) {
161 if (
abs(base_rr[i_rr] - othr_rr[i_rr]) > EPS) {
163 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i] <<
") plane " << plane <<
": ";
164 std::cout <<
"ResidualRange mismatch at index: " << i_rr <<
" (" << base_rr[i_rr] <<
") (" << othr_rr[i_rr] <<
")" <<
std::endl;
170 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i] <<
") plane " << plane <<
": " <<
"ResidualRange size mismatch (" << base_rr.size() <<
") (" << othr_rr.size() <<
")" <<
std::endl;
174 const std::vector<float> &base_dwrr = base[plane]->DeadWireResRC();
175 const std::vector<float> &othr_dwrr = othr[plane]->DeadWireResRC();
177 if (base_dwrr.size() == othr_dwrr.size()) {
178 for (
unsigned i_dwrr = 0; i_dwrr < base_dwrr.size(); i_dwrr++) {
179 if (
abs(base_dwrr[i_dwrr] - othr_dwrr[i_dwrr]) > EPS) {
181 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i] <<
") plane " << plane <<
": ";
182 std::cout <<
"DeadWireResRC mismatch at index: " << i_dwrr <<
" (" << base_dwrr[i_dwrr] <<
") (" << othr_dwrr[i_dwrr] <<
")" <<
std::endl;
188 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i] <<
") plane " << plane <<
": " <<
"DeadWireResRC size mismatch (" << base_dwrr.size() <<
") (" << othr_dwrr.size() <<
")" <<
std::endl;
192 const std::vector<float> &base_tpv = base[plane]->TrkPitchVec();
193 const std::vector<float> &othr_tpv = othr[plane]->TrkPitchVec();
195 if (base_tpv.size() == othr_tpv.size()) {
196 for (
unsigned i_tpv = 0; i_tpv < base_tpv.size(); i_tpv++) {
197 if (
abs(base_tpv[i_tpv] - othr_tpv[i_tpv]) > EPS) {
199 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i] <<
") plane " << plane <<
": ";
200 std::cout <<
"TrkPitchVec mismatch at index: " << i_tpv <<
" (" << base_tpv[i_tpv] <<
") (" << othr_tpv[i_tpv] <<
")" <<
std::endl;
206 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i] <<
") plane " << plane <<
": " <<
"TrkPitchVec size mismatch (" << base_tpv.size() <<
") (" << othr_tpv.size() <<
")" <<
std::endl;
210 const std::vector<size_t> &base_tpi = base[plane]->TpIndices();
211 const std::vector<size_t> &othr_tpi = othr[plane]->TpIndices();
213 if (base_tpi.size() == othr_tpi.size()) {
214 for (
unsigned i_tpi = 0; i_tpi < base_tpi.size(); i_tpi++) {
215 if (base_tpi[i_tpi] != othr_tpi[i_tpi]) {
217 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i] <<
") plane " << plane <<
": ";
218 std::cout <<
"TpIndices mismatch at index: " << i_tpi <<
" (" << base_tpi[i_tpi] <<
") (" << othr_tpi[i_tpi] <<
")" <<
std::endl;
224 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i] <<
") plane " << plane <<
": " <<
"TpIndices size mismatch (" << base_tpi.size() <<
") (" << othr_tpi.size() <<
")" <<
std::endl;
228 const std::vector<geo::Point_t> &base_xyz = base[plane]->XYZ();
229 const std::vector<geo::Point_t> &othr_xyz = othr[plane]->XYZ();
231 if (base_xyz.size() == othr_xyz.size()) {
232 for (
unsigned i_xyz = 0; i_xyz < base_xyz.size(); i_xyz++) {
233 if (
abs(base_xyz[i_xyz].
X() - othr_xyz[i_xyz].
X()) > EPS ||
234 abs(base_xyz[i_xyz].
Y() - othr_xyz[i_xyz].
Y()) > EPS ||
235 abs(base_xyz[i_xyz].
Z() - othr_xyz[i_xyz].
Z()) > EPS) {
237 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i] <<
") plane " << plane <<
": ";
238 std::cout <<
"XYZ mismatch at index: " << i_xyz;
239 std::cout <<
"X (" << base_xyz[i_xyz].X() <<
") (" << othr_xyz[i_xyz].X() <<
") ";
240 std::cout <<
"Y (" << base_xyz[i_xyz].Y() <<
") (" << othr_xyz[i_xyz].Y() <<
") ";
241 std::cout <<
"Z (" << base_xyz[i_xyz].Z() <<
") (" << othr_xyz[i_xyz].Z() <<
") " <<
std::endl;
247 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i] <<
") plane " << plane <<
": " <<
"XYZ size mismatch (" << base_xyz.size() <<
") (" << othr_xyz.size() <<
")" <<
std::endl;
253 std::cout <<
"Track: " << trk_i <<
" calo (" << fCaloLabels[0] <<
") is equal to calo (" << fCaloLabels[i] <<
")" <<
std::endl;
Functions to help with numbers.
CaloChecker(fhicl::ParameterSet const &config)
EDAnalyzer(fhicl::ParameterSet const &pset)
void analyze(const art::Event &evt) override
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
std::vector< std::string > fCaloLabels
#define DEFINE_ART_MODULE(klass)
Encapsulate the geometry of a wire.
Declaration of signal hit object.
Encapsulate the construction of a single detector plane.
Provides recob::Track data product.
Interface for experiment-specific channel quality info provider.
detail::Node< FrameID, bool > PlaneID
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Interface for experiment-specific service for channel quality info.
Collection of Physical constants used in LArSoft.
Utility functions to extract information from recob::Track
QTextStream & endl(QTextStream &s)