35 fThreshold(threshold),
57 std::vector<const sim::SimChannel*> newCluster;
59 newCluster.push_back(
hit.get());
65 const std::vector<const sim::SimChannel* >&
cluster)
72 const std::vector<const sim::SimChannel*>&
cluster,
78 for(
size_t iHit = 0; iHit < cluster.size(); ++iHit)
83 if(!(ROIs.size()))
continue;
87 if(!wireids.size())
continue;
94 unsigned int tempWire = wireid.
Wire;
95 unsigned int tempPlane = wireid.
Plane;
112 for(
auto iROI = ROIs.begin(); iROI != ROIs.end(); ++iROI){
114 auto tick = ROI.first;
115 double temptdc = (double)
tick;
116 double charge = 0.005*reco_wire->
Charge(
tick);
123 if (wireid.
TPC%6 == 0 or wireid.
TPC%6 == 5)
continue;
125 wireid.
Plane,wireid.
TPC,tempWire,tempPlane,temptdc);
129 wireid.
Plane,wireid.
TPC,tempWire,tempPlane,temptdc);
133 const double pe = charge;
134 const unsigned int wire = tempWire;
135 const unsigned int wirePlane = tempPlane;
136 const double tdc = temptdc;
137 pm.
Add(wire, tdc, wirePlane, pe);
147 os <<
"PixelMapSimProducer: " 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 sim::SimChannel*>&
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.size()))
continue;
215 if(!wireids.size())
continue;
222 unsigned int globalWire = wireid.
Wire;
223 unsigned int globalPlane = wireid.
Plane;
240 for(
auto iROI = ROIs.begin(); iROI != ROIs.end(); ++iROI){
242 auto tick = ROI.first;
246 double charge = 0.005*reco_wire->
Charge(
tick);
253 if (wireid.
TPC%6 == 0 or wireid.
TPC%6 == 5)
continue;
255 wireid.
Plane,wireid.
TPC,globalWire,globalPlane,globalTime);
259 wireid.
Plane,wireid.
TPC,globalWire,globalPlane,globalTime);
267 wire_0.push_back(globalWire);
268 twire_0.push_back((
double)
tick);
273 wire_1.push_back(globalWire);
274 twire_1.push_back((
double)
tick);
279 wire_2.push_back(globalWire);
280 twire_2.push_back((
double)
tick);
302 double tmean_0 = tsum_0/total_t0;
303 double tmean_1 = tsum_1/total_t1;
304 double tmean_2 = tsum_2/total_t2;
315 std::vector<int> bwire_0;
316 std::vector<int> bwire_1;
317 std::vector<int> bwire_2;
318 for(
int i = 0; i < (
int)wire_0.size(); i++){
319 double t = twire_0[i];
321 bwire_0.push_back(wire_0[i]);
323 for(
int i = 0; i < (
int)wire_1.size(); i++){
324 double t = twire_1[i];
326 bwire_1.push_back(wire_1[i]);
328 for(
int i = 0; i < (
int)wire_2.size(); i++){
329 double t = twire_2[i];
331 bwire_2.push_back(wire_2[i]);
334 std::cout <<
"Boundary wire vector sizes: " << bwire_0.size() <<
", " << bwire_1.size() <<
", " << bwire_2.size() <<
std::endl;
339 auto minwireelement_0 = std::min_element(bwire_0.begin(), bwire_0.end());
340 auto minwireelement_1 = std::min_element(bwire_1.begin(), bwire_1.end());
341 auto minwireelement_2 = std::min_element(bwire_2.begin(), bwire_2.end());
343 if(bwire_0.size() > 0) { minwire_0 = *minwireelement_0-1; std::cout<<
"minwire 0: "<<(*minwireelement_0) <<
std::endl;}
344 if(bwire_1.size() > 0) { minwire_1 = *minwireelement_1-1; std::cout<<
"minwire 1: "<<(*minwireelement_1) <<
std::endl;}
345 if(bwire_2.size() > 0) { minwire_2 = *minwireelement_2-1; std::cout<<
"minwire 2: "<<(*minwireelement_2) <<
std::endl;}
347 fTotHits = bwire_0.size() + bwire_1.size() + bwire_2.size();
356 unsigned int nWiresTPC = 400;
358 globalWire = localWire;
380 if(tpcMod4 == 0 || tpcMod4 == 3){
385 if(plane == 0) globalPlane = 1;
386 else globalPlane = 0;
390 if(globalPlane != 1){
391 globalWire += (tpc/4)*nWiresTPC;
394 globalWire += ((23-tpc)/4)*nWiresTPC;
401 unsigned int localWire,
double localTDC,
unsigned int plane,
unsigned int tpc,
402 unsigned int& globalWire,
unsigned int& globalPlane,
double& globalTDC)
const 405 unsigned int nWiresTPC = 400;
406 unsigned int wireGap = 4;
410 unsigned int drift_size = (driftLen / driftVel) * 2;
411 unsigned int apa_size = 4*(apaLen / driftVel) * 2;
424 bool includeZGap =
true;
425 if(includeZGap) nWiresTPC += wireGap;
436 if (plane < 2 and tpc%2 == 1) globalPlane = !plane;
437 else globalPlane = plane;
441 if (globalPlane != 1) globalWire += (tpc/4)*nWiresTPC;
442 else globalWire += ((23-tpc)/4)*nWiresTPC;
445 if (tpcMod4 > 1 and globalPlane < 2) globalWire +=
fGeometry->
Nwires(globalPlane, tpc, 0) + offset - localWire;
446 else globalWire += localWire;
448 if(tpcMod4 == 0 || tpcMod4 == 2){
449 globalTDC = drift_size - localTDC;
452 globalTDC = localTDC + drift_size + apa_size;
457 unsigned int localWire,
double localTDC,
unsigned int plane,
unsigned int tpc,
458 unsigned int& globalWire,
unsigned int& globalPlane,
double& globalTDC)
const 460 unsigned int nWiresTPC = 400;
461 unsigned int wireGap = 4;
465 unsigned int drift_size = (driftLen / driftVel) * 2;
466 unsigned int apa_size = 4*(apaLen / driftVel) * 2;
479 bool includeZGap =
true;
480 if(includeZGap) nWiresTPC += wireGap;
501 size_t tpc_x = (tpc%6) - 1;
502 size_t tpc_xy = (tpc%12) - 1;
503 if (tpc_xy > 3) tpc_xy -= 2;
506 if (plane < 2 and tpc%2 == 1) globalPlane = !plane;
507 else globalPlane = plane;
511 if (globalPlane != 1) globalWire += (tpc/12)*nWiresTPC;
512 else globalWire += ((300-tpc)/12)*nWiresTPC;
514 if (tpc_xy > 3 and globalPlane < 2) globalWire +=
fGeometry->
Nwires(globalPlane, tpc, 0) + offset - localWire;
515 else globalWire += localWire;
517 if (tpc_x % 2 == 0) globalTDC = localTDC;
518 else globalTDC = (2*drift_size) - localTDC;
519 if (tpc_x > 1) globalTDC += 2 * (drift_size + apa_size);
527 unsigned int nWiresTPC = 400;
529 globalWire = localWire;
557 if(plane == 0) globalPlane = 1;
558 else globalPlane = 0;
562 if(globalPlane != 1){
563 globalWire += (tpc/4)*nWiresTPC;
566 globalWire += ((12-tpc)/4)*nWiresTPC;
574 unsigned int& globalWire,
double& globalTDC,
unsigned int& globalPlane)
const 590 double spacing = 0.847;
599 double low_bound, upper_bound;
600 int start,
end, diag_tpc;
602 if(globalPlane == 0){
607 diag_tpc = (start/2);
614 diag_tpc = (nCRM_row-(end/2) - 1);
617 if((start % 2)^globalPlane){
619 int diag_idx = diag_tpc + !globalPlane;
620 globalWire = (wire_intercept > (low_bound+upper_bound)*0.5) ? (nWiresTPC-1)*diag_idx + !globalPlane : (nWiresTPC-1)*diag_idx + globalPlane;
624 int diag_idx = diag_tpc;
625 int offset = globalPlane ? std::round((upper_bound - wire_intercept)/spacing) : std::round((wire_intercept-low_bound)/spacing);
626 globalWire = (nWiresTPC-1)*diag_idx + offset + 1;
632 globalWire = localWire + tpc_z*nWiresTPC;
unsigned int fTotHits
How many ROIs above threshold?
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...
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
unsigned int NTdc() const
Energy deposited on a readout channel by simulated tracks.
std::vector< double > fVDPlane0
double fThreshold
charge threshold for each time tick, below which isn't added to pixel map
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
std::ostream & operator<<(std::ostream &os, const PixelMapProducer &p)
PixelMap CreateMapGivenBoundary(detinfo::DetectorPropertiesData const &detProp, const std::vector< const sim::SimChannel * > &cluster, const Boundary &bound)
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
WireID_t Wire
Index of the wire within its plane.
Cluster finding and building.
Utility class for truth labels.
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
PixelMapSimProducer for CVN.
void GetDUNEVertDrift3ViewGlobalWire(unsigned int localWire, unsigned int plane, unsigned int tpc, unsigned int &globalWire, unsigned int &globalPlane) 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.
double Charge(TDC_t tdc) const
Returns the total number of ionization electrons on this channel in the specified TDC...
void Add(const unsigned int &wire, const double &tdc, const unsigned int &view, const double &pe)
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
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
double fTRes
Timing resolution for pixel map.
double DriftVelocity(double efield=0., double temperature=0.) const
cm/us
PlaneID_t Plane
Index of the plane within its TPC.
PixelMap CreateMap(detinfo::DetectorPropertiesData const &detProp, const std::vector< art::Ptr< sim::SimChannel > > &slice)
double _getIntercept(geo::WireID wireid) const
Detector simulation of raw signals on wires.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
raw::ChannelID_t Channel() const
Returns the readout channel this object describes.
double DriftDistance() const
unsigned int fNWire
Number of wires, length for pixel maps.
Boundary DefineBoundary(detinfo::DetectorPropertiesData const &detProp, const std::vector< const sim::SimChannel * > &cluster)
Get boundaries for pixel map representation of cluster.
double ActiveWidth() const
Width (associated with x coordinate) of active TPC volume [cm].
PixelMap, basic input to CVN neural net.
Producer algorithm for PixelMap, input to CVN neural net.
bool fProtoDUNE
Do we want to use this for particle extraction from protoDUNE?
unsigned int fNTdc
Number of tdcs, width of pixel map.
unsigned short fUnwrapped
Use unwrapped pixel maps?
Access the description of detector geometry.
TDCIDEs_t const & TDCIDEMap() const
Returns all the deposited energy information as stored.
TPCGeo const & TPC(unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified TPC.
void GetProtoDUNEGlobalWire(unsigned int localWire, unsigned int plane, unsigned int tpc, unsigned int &globalWire, unsigned int &globalPlane) const
void GetCenter(double *xyz, double localz=0.0) const
Fills the world coordinate of a point on the wire.
TPCID_t TPC
Index of the TPC within its cryostat.
void GetProtoDUNEGlobalWireTDC(unsigned int localWire, double localTDC, unsigned int plane, unsigned int tpc, unsigned int &globalWire, double &globalTDC, unsigned int &globalPlane) const
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.
geo::GeometryCore const * fGeometry
QTextStream & endl(QTextStream &s)
std::vector< double > fVDPlane1
WireGeo const * WirePtr(geo::WireID const &wireid) const
Returns the specified wire.