35 fThreshold(threshold),
57 std::vector<const recob::Wire*> newCluster;
59 newCluster.push_back(
hit.get());
65 const std::vector<const recob::Wire* >&
cluster)
72 const std::vector<const recob::Wire*>&
cluster,
78 for(
size_t iHit = 0; iHit < cluster.size(); ++iHit)
83 if(!(ROIs.get_ranges().size()))
continue;
86 if(!wireids.size())
continue;
89 if(wireids.size() > 1){
90 for(
auto iwire : wireids)
91 if(iwire.Plane == reco_wire->
View()) wireid = iwire;
93 unsigned int tempWire = wireid.
Wire;
94 unsigned int tempPlane = wireid.
Plane;
111 for(
auto iROI = ROIs.begin_range(); iROI != ROIs.end_range(); ++iROI){
113 for(
int tick = ROI.begin_index();
tick < (
int)ROI.end_index();
tick++){
115 double temptdc = (double)
tick;
122 if (wireid.
TPC%6 == 0 or wireid.
TPC%6 == 5)
continue;
124 wireid.
Plane,wireid.
TPC,tempWire,tempPlane,temptdc);
128 wireid.
Plane,wireid.
TPC,tempWire,tempPlane,temptdc);
132 const double pe = ROI[
tick];
133 const unsigned int wire = tempWire;
134 const unsigned int wirePlane = tempPlane;
135 const double tdc = temptdc;
136 pm.
Add(wire, tdc, wirePlane, pe);
147 os <<
"PixelMapWireProducer: " 148 << p.
NTdc() <<
" tdcs X " << p.
NWire() <<
" wires";
159 double intercept = center.Y() - slope*center.Z();
160 if(wireid.
Plane == 2) intercept = 0.;
168 for(
int plane = 0; plane < 2; plane++){
171 for(
int diag_tpc = 0; diag_tpc < nCRM_row; diag_tpc++){
174 int tpc_id = plane == 0 ? (nCRM_row+1)*diag_tpc : (nCRM_row-1)*(nCRM_row-diag_tpc);
194 const std::vector< const recob::Wire*>&
cluster)
197 std::vector<int> wire_0;
198 std::vector<int> wire_1;
199 std::vector<int> wire_2;
201 std::vector<double> twire_0;
202 std::vector<double> twire_1;
203 std::vector<double> twire_2;
205 double tsum_0 = 0., tsum_1 = 0., tsum_2 = 0.;
206 int total_t0 = 0, total_t1 = 0, total_t2 = 0;
208 for(
size_t iHit = 0; iHit < cluster.size(); ++iHit)
212 if(!(ROIs.get_ranges().size()))
continue;
215 if(!wireids.size())
continue;
218 if(wireids.size() > 1){
219 for(
auto iwire : wireids)
220 if(iwire.Plane == reco_wire->
View()) wireid = iwire;
222 unsigned int globalWire = wireid.
Wire;
223 unsigned int globalPlane = wireid.
Plane;
242 for(
auto iROI = ROIs.begin_range(); iROI != ROIs.end_range(); ++iROI){
244 bool none_threshold =
true;
245 int min_tick = 20000;
246 for(
int tick = ROI.begin_index();
tick < (
int)ROI.end_index();
tick++){
251 if(
tick < min_tick) min_tick =
tick;
257 if (wireid.
TPC%6 == 0 or wireid.
TPC%6 == 5)
continue;
259 wireid.
Plane,wireid.
TPC,globalWire,globalPlane,globalTime);
263 wireid.
Plane,wireid.
TPC,globalWire,globalPlane,globalTime);
283 wire_0.push_back(globalWire);
284 twire_0.push_back((
double)min_tick);
287 wire_1.push_back(globalWire);
288 twire_1.push_back((
double)min_tick);
291 wire_2.push_back(globalWire);
292 twire_2.push_back((
double)min_tick);
313 double tmean_0 = tsum_0/total_t0;
314 double tmean_1 = tsum_1/total_t1;
315 double tmean_2 = tsum_2/total_t2;
326 std::vector<int> bwire_0;
327 std::vector<int> bwire_1;
328 std::vector<int> bwire_2;
329 for(
int i = 0; i < (
int)wire_0.size(); i++){
330 double t = twire_0[i];
332 bwire_0.push_back(wire_0[i]);
334 for(
int i = 0; i < (
int)wire_1.size(); i++){
335 double t = twire_1[i];
337 bwire_1.push_back(wire_1[i]);
339 for(
int i = 0; i < (
int)wire_2.size(); i++){
340 double t = twire_2[i];
342 bwire_2.push_back(wire_2[i]);
345 std::cout <<
"Boundary wire vector sizes: " << bwire_0.size() <<
", " << bwire_1.size() <<
", " << bwire_2.size() <<
std::endl;
350 auto minwireelement_0 = std::min_element(bwire_0.begin(), bwire_0.end());
351 auto minwireelement_1 = std::min_element(bwire_1.begin(), bwire_1.end());
352 auto minwireelement_2 = std::min_element(bwire_2.begin(), bwire_2.end());
354 if(bwire_0.size() > 0) { minwire_0 = *minwireelement_0-1; std::cout<<
"minwire 0: "<<(*minwireelement_0) <<
std::endl;}
355 if(bwire_1.size() > 0) { minwire_1 = *minwireelement_1-1; std::cout<<
"minwire 1: "<<(*minwireelement_1) <<
std::endl;}
356 if(bwire_2.size() > 0) { minwire_2 = *minwireelement_2-1; std::cout<<
"minwire 2: "<<(*minwireelement_2) <<
std::endl;}
358 fTotHits = bwire_0.size() + bwire_1.size() + bwire_2.size();
367 unsigned int nWiresTPC = 400;
369 globalWire = localWire;
391 if(tpcMod4 == 0 || tpcMod4 == 3){
396 if(plane == 0) globalPlane = 1;
397 else globalPlane = 0;
401 if(globalPlane != 1){
402 globalWire += (tpc/4)*nWiresTPC;
405 globalWire += ((23-tpc)/4)*nWiresTPC;
412 unsigned int localWire,
double localTDC,
unsigned int plane,
unsigned int tpc,
413 unsigned int& globalWire,
unsigned int& globalPlane,
double& globalTDC)
const 416 unsigned int nWiresTPC = 400;
417 unsigned int wireGap = 4;
421 unsigned int drift_size = (driftLen / driftVel) * 2;
422 unsigned int apa_size = 4*(apaLen / driftVel) * 2;
435 bool includeZGap =
true;
436 if(includeZGap) nWiresTPC += wireGap;
447 if (plane < 2 and tpc%2 == 1) globalPlane = !plane;
448 else globalPlane = plane;
452 if (globalPlane != 1) globalWire += (tpc/4)*nWiresTPC;
453 else globalWire += ((23-tpc)/4)*nWiresTPC;
456 if (tpcMod4 > 1 and globalPlane < 2) globalWire +=
fGeometry->
Nwires(globalPlane, tpc, 0) + offset - localWire;
457 else globalWire += localWire;
459 if(tpcMod4 == 0 || tpcMod4 == 2){
460 globalTDC = drift_size - localTDC;
463 globalTDC = localTDC + drift_size + apa_size;
468 unsigned int localWire,
double localTDC,
unsigned int plane,
unsigned int tpc,
469 unsigned int& globalWire,
unsigned int& globalPlane,
double& globalTDC)
const 471 unsigned int nWiresTPC = 400;
472 unsigned int wireGap = 4;
476 unsigned int drift_size = (driftLen / driftVel) * 2;
477 unsigned int apa_size = 4*(apaLen / driftVel) * 2;
490 bool includeZGap =
true;
491 if(includeZGap) nWiresTPC += wireGap;
512 size_t tpc_x = (tpc%6) - 1;
513 size_t tpc_xy = (tpc%12) - 1;
514 if (tpc_xy > 3) tpc_xy -= 2;
517 if (plane < 2 and tpc%2 == 1) globalPlane = !plane;
518 else globalPlane = plane;
522 if (globalPlane != 1) globalWire += (tpc/12)*nWiresTPC;
523 else globalWire += ((300-tpc)/12)*nWiresTPC;
525 if (tpc_xy > 3 and globalPlane < 2) globalWire +=
fGeometry->
Nwires(globalPlane, tpc, 0) + offset - localWire;
526 else globalWire += localWire;
528 if (tpc_x % 2 == 0) globalTDC = localTDC;
529 else globalTDC = (2*drift_size) - localTDC;
530 if (tpc_x > 1) globalTDC += 2 * (drift_size + apa_size);
538 unsigned int nWiresTPC = 400;
540 globalWire = localWire;
568 if(plane == 0) globalPlane = 1;
569 else globalPlane = 0;
573 if(globalPlane != 1){
574 globalWire += (tpc/4)*nWiresTPC;
577 globalWire += ((12-tpc)/4)*nWiresTPC;
585 unsigned int& globalWire,
double& globalTDC,
unsigned int& globalPlane)
const 601 double spacing = 0.847;
610 double low_bound, upper_bound;
611 int start,
end, diag_tpc;
613 if(globalPlane == 0){
618 diag_tpc = (start/2);
625 diag_tpc = (nCRM_row-(end/2) - 1);
628 if((start % 2)^globalPlane){
630 int diag_idx = diag_tpc + !globalPlane;
631 globalWire = (wire_intercept > (low_bound+upper_bound)*0.5) ? (nWiresTPC-1)*diag_idx + !globalPlane : (nWiresTPC-1)*diag_idx + globalPlane;
635 int diag_idx = diag_tpc;
636 int offset = globalPlane ? std::round((upper_bound - wire_intercept)/spacing) : std::round((wire_intercept-low_bound)/spacing);
637 globalWire = (nWiresTPC-1)*diag_idx + offset + 1;
643 globalWire = localWire + tpc_z*nWiresTPC;
bool isVertical() const
Returns if this wire is vertical (theta_z ~ pi/2)
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
PixelMapWireProducer for CVN.
Boundary DefineBoundary(detinfo::DetectorPropertiesData const &detProp, const std::vector< const recob::Wire * > &cluster)
Get boundaries for pixel map representation of cluster.
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
std::vector< double > fVDPlane0
PixelMap CreateMap(detinfo::DetectorPropertiesData const &detProp, const std::vector< art::Ptr< recob::Wire > > &slice)
std::ostream & operator<<(std::ostream &os, const PixelMapProducer &p)
void GetDUNE10ktGlobalWireTDC(detinfo::DetectorPropertiesData const &detProp, unsigned int localWire, double localTDC, unsigned int plane, unsigned int tpc, unsigned int &globalWire, unsigned int &globalPlane, double &globalTDC) const
unsigned short fUnwrapped
Use unwrapped pixel maps?
void GetProtoDUNEGlobalWireTDC(unsigned int localWire, double localTDC, unsigned int plane, unsigned int tpc, unsigned int &globalWire, double &globalTDC, unsigned int &globalPlane) const
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
double fTRes
Timing resolution for pixel map.
Producer algorithm for PixelMap, input to CVN neural net.
WireID_t Wire
Index of the wire within its plane.
double fThreshold
charge threshold for each time tick, below which isn't added to pixel map
Cluster finding and building.
void GetDUNEVertDrift3ViewGlobalWire(unsigned int localWire, unsigned int plane, unsigned int tpc, unsigned int &globalWire, unsigned int &globalPlane) const
Utility class for truth labels.
std::vector< double > fVDPlane1
double Width() const
Width is associated with x coordinate [cm].
unsigned int Nwires(unsigned int p, unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wires in the specified plane.
void SetTotHits(unsigned int tothits)
art framework interface to geometry description
void GetProtoDUNEGlobalWire(unsigned int localWire, unsigned int plane, unsigned int tpc, unsigned int &globalWire, unsigned int &globalPlane) const
unsigned int fNTdc
Number of tdcs, width of pixel map.
geo::View_t View() const
Returns the view the channel belongs to.
double _getIntercept(geo::WireID wireid) const
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
void GetDUNEGlobalWire(unsigned int localWire, unsigned int plane, unsigned int tpc, unsigned int &globalWire, unsigned int &globalPlane) const
Function to convert to a global unwrapped wire number.
raw::ChannelID_t Channel() const
Returns the ID of the channel (or InvalidChannelID)
unsigned int fTotHits
How many ROIs above threshold?
void Add(const unsigned int &wire, const double &tdc, const unsigned int &view, const double &pe)
unsigned int fNWire
Number of wires, length for pixel maps.
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
bool fProtoDUNE
Do we want to use this for particle extraction from protoDUNE?
const RegionsOfInterest_t & SignalROI() const
Returns the list of regions of interest.
double DriftVelocity(double efield=0., double temperature=0.) const
cm/us
PlaneID_t Plane
Index of the plane within its TPC.
geo::GeometryCore const * fGeometry
Detector simulation of raw signals on wires.
unsigned int NTdc() const
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
double DriftDistance() const
double ActiveWidth() const
Width (associated with x coordinate) of active TPC volume [cm].
PixelMap, basic input to CVN neural net.
Class holding the regions of interest of signal from a channel.
void GetDUNEGlobalWireTDC(detinfo::DetectorPropertiesData const &detProp, unsigned int localWire, double localTDC, unsigned int plane, unsigned int tpc, unsigned int &globalWire, unsigned int &globalPlane, double &globalTDC) const
unsigned int NWire() const
Access the description of detector geometry.
TPCGeo const & TPC(unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified TPC.
void GetCenter(double *xyz, double localz=0.0) const
Fills the world coordinate of a point on the wire.
PixelMap CreateMapGivenBoundary(detinfo::DetectorPropertiesData const &detProp, const std::vector< const recob::Wire * > &cluster, const Boundary &bound)
TPCID_t TPC
Index of the TPC within its cryostat.
QTextStream & endl(QTextStream &s)
WireGeo const * WirePtr(geo::WireID const &wireid) const
Returns the specified wire.