22 #include "Utilities/func/MathUtil.h" 31 #include "NovaDAQConventions/DAQConventions.h" 92 double RMS(std::vector<double> &
v,
double &
mean);
94 void NumberOfCellsPerLength(
rb::Cluster const &slice,
double tracklength_of_xview,
double tracklength_of_yview,
double &number_of_cells_per_length_xview,
double &number_of_cells_per_length_yview)
const;
102 produces< std::vector<rb::Cluster> >();
122 double TX_max, TY_max, TX_min, TY_min;
127 std::unique_ptr< std::vector<rb::Cluster> > clustercol(
new std::vector<rb::Cluster>);
133 for (
unsigned sliceIdx = 0; sliceIdx != slices->size(); ++sliceIdx) {
136 std::vector<art::Ptr<rb::CellHit> > Xhitlist, Yhitlist;
177 bool Intrusion =
false;
179 std::vector<double> adcList;
183 for (
unsigned i = 0;
i != slice.
NCell(); ++
i) {
186 double tns = chit->
TNS();
187 int c = chit->
Cell();
189 adcList.emplace_back(chit->
ADC());
197 Xhitlist.emplace_back(chit);
209 if (TX_max < tns) TX_max = tns;
210 if (TX_min > tns) TX_min = tns;
229 Yhitlist.emplace_back(chit);
241 if (TY_max < tns) TY_max = tns;
242 if (TY_min > tns) TY_min = tns;
321 if(_diagonal_length<79)
continue;
346 clustercol->push_back(slice);
349 evt.
put(std::move(clustercol));
357 for (
unsigned i = 0;
i!= v.size(); ++
i) {
360 mean /= double(v.size());
361 for (
unsigned i = 0;
i!= v.size(); ++
i) {
362 rms += (v[
i]-
mean)*(v[
i]-mean);
364 rms /= double(v.size());
370 if (plane<
_zdelt)
return true;
372 if (cell<
_xdelt)
return true;
379 std::vector<std::vector<int>> x_hits_plane(
PX_max-
PX_min+1,std::vector<int>(0));
380 std::vector<std::vector<int>> y_hits_plane(
PY_max-
PY_min+1,std::vector<int>(0));
381 for (
unsigned i = 0;
i != slice.
NCell(); ++
i) {
383 int c = chit->
Cell();
386 x_hits_plane[p-
PX_min].push_back(c);
389 y_hits_plane[p-
PY_min].push_back(c);
395 for (
size_t i=0;
i!=x_hits_plane.size();
i++){
396 std::sort(x_hits_plane[
i].begin(),x_hits_plane[
i].
end());
397 std::vector<int>::iterator
it;
398 it = std::unique (x_hits_plane[
i].begin(),x_hits_plane[
i].
end());
400 x_cells_plane[
i]=x_hits_plane[
i].size();
402 for (
size_t i=0;
i!=y_hits_plane.size();
i++){
403 std::sort(y_hits_plane[
i].begin(),y_hits_plane[
i].
end());
404 std::vector<int>::iterator
it;
405 it = std::unique (y_hits_plane[
i].begin(),y_hits_plane[
i].
end());
407 y_cells_plane[
i]=y_hits_plane[
i].size();
411 for (
size_t i=0;
i!=x_cells_plane.size();
i++){
412 sum_of_cells+=x_cells_plane[
i];
414 number_of_cells_per_length_xview=sum_of_cells/tracklength_of_xview;
416 for (
size_t i=0;
i!=y_cells_plane.size();
i++){
417 sum_of_cells+=y_cells_plane[
i];
419 number_of_cells_per_length_yview=sum_of_cells/tracklength_of_yview;
424 std::vector<std::vector<int>> x_hits_plane(
PX_max-
PX_min+1,std::vector<int>(0));
425 std::vector<std::vector<int>> y_hits_plane(
PY_max-
PY_min+1,std::vector<int>(0));
426 for (
unsigned i = 0;
i != slice.
NCell(); ++
i) {
428 int c = chit->
Cell();
431 x_hits_plane[p-
PX_min].push_back(c);
434 y_hits_plane[p-
PY_min].push_back(c);
444 for (
size_t i=0;
i!=x_hits_plane.size();
i++){
445 std::sort(x_hits_plane[
i].begin(),x_hits_plane[
i].
end());
446 std::vector<int>::iterator
it;
447 it = std::unique (x_hits_plane[
i].begin(),x_hits_plane[
i].
end());
449 x_cells_plane[
i]=x_hits_plane[
i].size();
451 for (
size_t i=0;
i!=y_hits_plane.size();
i++){
452 std::sort(y_hits_plane[
i].begin(),y_hits_plane[
i].
end());
453 std::vector<int>::iterator
it;
454 it = std::unique (y_hits_plane[
i].begin(),y_hits_plane[
i].
end());
456 y_cells_plane[
i]=y_hits_plane[
i].size();
458 sum = std::accumulate(x_cells_plane.begin(),x_cells_plane.end(),0.0);
459 mean = sum / x_cells_plane.size();
460 sq_sum = std::inner_product(x_cells_plane.begin(),x_cells_plane.end(),x_cells_plane.begin(),0.0);
461 stdev =
std::sqrt(sq_sum / x_cells_plane.size()-mean *
mean);
462 stdev_cells_per_plane_xview=stdev/
mean;
463 sum = std::accumulate(y_cells_plane.begin(),y_cells_plane.end(),0.0);
464 mean = sum / y_cells_plane.size();
465 sq_sum = std::inner_product(y_cells_plane.begin(),y_cells_plane.end(),y_cells_plane.begin(),0.0);
466 stdev =
std::sqrt(sq_sum / y_cells_plane.size()-mean *
mean);
467 stdev_cells_per_plane_yview=stdev/
mean;
472 double number_hits_in_overlap_planes=0;
473 for (
unsigned i = 0;
i != slice.
NCell(); ++
i) {
475 if(chit->
Plane()<=max && chit->
Plane()>=
min) number_hits_in_overlap_planes++;
477 return number_hits_in_overlap_planes/slice.
NCell();
T max(const caf::Proxy< T > &a, T b)
double NumberOfHitsInOverlapPlanesCut(rb::Cluster const &slice, float PX_min, float PX_max, float PY_min, float PY_max) const
SubRunNumber_t subRun() const
back track the reconstruction to the simulation
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
double _stdev_cells_per_plane_xview
unsigned short Plane() const
double _number_of_surface_hits
Vertical planes which measure X.
A collection of associated CellHits.
double _weighted_off_center_xz
DEFINE_ART_MODULE(TestTMapFile)
unsigned distance(const T &t1, const T &t2)
double _weighted_off_center_xx
ProductID put(std::unique_ptr< PROD > &&product)
double _weighted_off_center_yz
unsigned short Cell() const
double _weighted_off_center_yy
void StdevCellsPerPlane(rb::Cluster const &slice, double &stdev_cells_per_plane_xview, double &stdev_cells_per_plane_yview) const
double _stdev_cells_per_plane_yview
void produce(art::Event &evt)
Collect Geo headers and supply basic geometry functions.
void NumberOfCellsPerLength(rb::Cluster const &slice, double tracklength_of_xview, double tracklength_of_yview, double &number_of_cells_per_length_xview, double &number_of_cells_per_length_yview) const
double RMS(std::vector< double > &v, double &mean)
bool IsSurfaceHit(int plane, int cell) const
static float min(const float a, const float b, const float c)
EventNumber_t event() const
art::Ptr< rb::CellHit > Cell(geo::View_t view, unsigned int viewIdx) const
Get the ith cell from view view.
double _percent_of_hits_in_overlap_planes
int16_t ADC(uint32_t i) const
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
T min(const caf::Proxy< T > &a, T b)
double _number_of_hits_per_length
std::string fClusterInput
Input folder from cluster reco.
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
double _number_of_cells_per_length_xview
Encapsulate the geometry of one entire detector (near, far, ndos)
FmmTriggerEvd(fhicl::ParameterSet const &pset)
double _number_of_cells_per_length_yview