21 #include "larevt/CalibrationDBI/Interface/ChannelStatusProvider.h" 22 #include "larevt/CalibrationDBI/Interface/ChannelStatusService.h" 39 #include "cetlib/pow.h" 59 ,
fCaloLabels(config.get<std::vector<std::string>>(
"CaloLabels"))
60 ,
fTrackLabel(config.get<std::string>(
"TrackLabel"))
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()
87 <<
") n points: " << base[plane]->dEdx().size() << std::endl;
90 for (
unsigned i = 1; i < fCaloLabels.size(); i++) {
92 std::vector<art::Ptr<anab::Calorimetry>> othr = calos[i].at(trk_i);
93 if (base.size() != othr.size()) {
95 std::cout <<
"Track: " << trk_i <<
" calo (" << fCaloLabels[0] <<
") has (" << base.size()
96 <<
"). Calo (" << fCaloLabels[i] <<
") has size (" << othr.size() <<
") mismatch." 100 for (
unsigned plane = 0; plane < base.size(); plane++) {
102 if (base[plane]->
PlaneID() != othr[plane]->PlaneID()) {
104 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i]
105 <<
") plane " << plane <<
": ";
106 std::cout <<
"Plane ID mismatch (" << base[plane]->PlaneID() <<
") (" 107 << othr[plane]->PlaneID() <<
")" << std::endl;
111 if (
abs(base[plane]->Range() - othr[plane]->Range()) > EPS) {
113 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i]
114 <<
") plane " << plane <<
": ";
115 std::cout <<
"Range mismatch (" << base[plane]->Range() <<
") (" << othr[plane]->Range()
120 if (
abs(base[plane]->KineticEnergy() - othr[plane]->KineticEnergy()) > EPS) {
122 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i]
123 <<
") plane " << plane <<
": ";
124 std::cout <<
"KineticEnergy mismatch (" << base[plane]->KineticEnergy() <<
") (" 125 << othr[plane]->KineticEnergy() <<
")" << std::endl;
129 const std::vector<float>& base_dedx = base[plane]->dEdx();
130 const std::vector<float>& othr_dedx = othr[plane]->dEdx();
132 if (base_dedx.size() == othr_dedx.size()) {
133 for (
unsigned i_dedx = 0; i_dedx < base_dedx.size(); i_dedx++) {
134 if (
abs(base_dedx[i_dedx] - othr_dedx[i_dedx]) > EPS) {
136 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" 137 << fCaloLabels[i] <<
") plane " << plane <<
": ";
138 std::cout <<
"dEdx mismatch at index: " << i_dedx <<
" (" << base_dedx[i_dedx]
139 <<
") (" << othr_dedx[i_dedx] <<
")" << std::endl;
145 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i]
146 <<
") plane " << plane <<
": " 147 <<
"dEdx size mismatch (" << base_dedx.size() <<
") (" << othr_dedx.size()
152 const std::vector<float>& base_dqdx = base[plane]->dQdx();
153 const std::vector<float>& othr_dqdx = othr[plane]->dQdx();
155 if (base_dqdx.size() == othr_dqdx.size()) {
156 for (
unsigned i_dqdx = 0; i_dqdx < base_dqdx.size(); i_dqdx++) {
157 if (
abs(base_dqdx[i_dqdx] - othr_dqdx[i_dqdx]) > EPS) {
159 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" 160 << fCaloLabels[i] <<
") plane " << plane <<
": ";
161 std::cout <<
"dQdx mismatch at index: " << i_dqdx <<
" (" << base_dqdx[i_dqdx]
162 <<
") (" << othr_dqdx[i_dqdx] <<
")" << std::endl;
168 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i]
169 <<
") plane " << plane <<
": " 170 <<
"dQdx size mismatch (" << base_dqdx.size() <<
") (" << othr_dqdx.size()
175 const std::vector<float>& base_rr = base[plane]->ResidualRange();
176 const std::vector<float>& othr_rr = othr[plane]->ResidualRange();
178 if (base_rr.size() == othr_rr.size()) {
179 for (
unsigned i_rr = 0; i_rr < base_rr.size(); i_rr++) {
180 if (
abs(base_rr[i_rr] - othr_rr[i_rr]) > EPS) {
182 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" 183 << fCaloLabels[i] <<
") plane " << plane <<
": ";
184 std::cout <<
"ResidualRange mismatch at index: " << i_rr <<
" (" << base_rr[i_rr]
185 <<
") (" << othr_rr[i_rr] <<
")" << std::endl;
191 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i]
192 <<
") plane " << plane <<
": " 193 <<
"ResidualRange size mismatch (" << base_rr.size() <<
") (" << othr_rr.size()
198 const std::vector<float>& base_dwrr = base[plane]->DeadWireResRC();
199 const std::vector<float>& othr_dwrr = othr[plane]->DeadWireResRC();
201 if (base_dwrr.size() == othr_dwrr.size()) {
202 for (
unsigned i_dwrr = 0; i_dwrr < base_dwrr.size(); i_dwrr++) {
203 if (
abs(base_dwrr[i_dwrr] - othr_dwrr[i_dwrr]) > EPS) {
205 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" 206 << fCaloLabels[i] <<
") plane " << plane <<
": ";
207 std::cout <<
"DeadWireResRC mismatch at index: " << i_dwrr <<
" (" 208 << base_dwrr[i_dwrr] <<
") (" << othr_dwrr[i_dwrr] <<
")" << std::endl;
214 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i]
215 <<
") plane " << plane <<
": " 216 <<
"DeadWireResRC size mismatch (" << base_dwrr.size() <<
") (" 217 << othr_dwrr.size() <<
")" << std::endl;
221 const std::vector<float>& base_tpv = base[plane]->TrkPitchVec();
222 const std::vector<float>& othr_tpv = othr[plane]->TrkPitchVec();
224 if (base_tpv.size() == othr_tpv.size()) {
225 for (
unsigned i_tpv = 0; i_tpv < base_tpv.size(); i_tpv++) {
226 if (
abs(base_tpv[i_tpv] - othr_tpv[i_tpv]) > EPS) {
228 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" 229 << fCaloLabels[i] <<
") plane " << plane <<
": ";
230 std::cout <<
"TrkPitchVec mismatch at index: " << i_tpv <<
" (" << base_tpv[i_tpv]
231 <<
") (" << othr_tpv[i_tpv] <<
")" << std::endl;
237 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i]
238 <<
") plane " << plane <<
": " 239 <<
"TrkPitchVec size mismatch (" << base_tpv.size() <<
") (" << othr_tpv.size()
244 const std::vector<size_t>& base_tpi = base[plane]->TpIndices();
245 const std::vector<size_t>& othr_tpi = othr[plane]->TpIndices();
247 if (base_tpi.size() == othr_tpi.size()) {
248 for (
unsigned i_tpi = 0; i_tpi < base_tpi.size(); i_tpi++) {
249 if (base_tpi[i_tpi] != othr_tpi[i_tpi]) {
251 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" 252 << fCaloLabels[i] <<
") plane " << plane <<
": ";
253 std::cout <<
"TpIndices mismatch at index: " << i_tpi <<
" (" << base_tpi[i_tpi]
254 <<
") (" << othr_tpi[i_tpi] <<
")" << std::endl;
260 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i]
261 <<
") plane " << plane <<
": " 262 <<
"TpIndices size mismatch (" << base_tpi.size() <<
") (" << othr_tpi.size()
267 const std::vector<geo::Point_t>& base_xyz = base[plane]->XYZ();
268 const std::vector<geo::Point_t>& othr_xyz = othr[plane]->XYZ();
270 if (base_xyz.size() == othr_xyz.size()) {
271 for (
unsigned i_xyz = 0; i_xyz < base_xyz.size(); i_xyz++) {
272 if (
abs(base_xyz[i_xyz].
X() - othr_xyz[i_xyz].
X()) > EPS ||
273 abs(base_xyz[i_xyz].
Y() - othr_xyz[i_xyz].
Y()) > EPS ||
274 abs(base_xyz[i_xyz].
Z() - othr_xyz[i_xyz].
Z()) > EPS) {
276 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" 277 << fCaloLabels[i] <<
") plane " << plane <<
": ";
278 std::cout <<
"XYZ mismatch at index: " << i_xyz;
279 std::cout <<
"X (" << base_xyz[i_xyz].X() <<
") (" << othr_xyz[i_xyz].X() <<
") ";
280 std::cout <<
"Y (" << base_xyz[i_xyz].Y() <<
") (" << othr_xyz[i_xyz].Y() <<
") ";
281 std::cout <<
"Z (" << base_xyz[i_xyz].Z() <<
") (" << othr_xyz[i_xyz].Z() <<
") " 288 std::cout <<
"Track: " << trk_i <<
" calos (" << fCaloLabels[0] <<
") (" << fCaloLabels[i]
289 <<
") plane " << plane <<
": " 290 <<
"XYZ size mismatch (" << base_xyz.size() <<
") (" << othr_xyz.size() <<
")" 296 std::cout <<
"Track: " << trk_i <<
" calo (" << fCaloLabels[0] <<
") is equal to calo (" 297 << fCaloLabels[i] <<
")" << std::endl;
Functions to help with numbers.
CaloChecker(fhicl::ParameterSet const &config)
Declaration of signal hit object.
constexpr auto abs(T v)
Returns the absolute value of the argument.
EDAnalyzer(fhicl::ParameterSet const &pset)
void analyze(const art::Event &evt) override
IDparameter< geo::PlaneID > PlaneID
Member type of validated geo::PlaneID parameter.
std::vector< std::string > fCaloLabels
#define DEFINE_ART_MODULE(klass)
Provides recob::Track data product.
Encapsulate the geometry of a wire.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Utility object to perform functions of association.
Encapsulate the construction of a single detector plane.
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Collection of Physical constants used in LArSoft.
Utility functions to extract information from recob::Track