Classes | Functions
detvar Namespace Reference

Classes

class  RandomChannelStatusProvider
 
class  RandomChannelStatusService
 
class  RandomTPC
 
class  SortChansByZ
 

Functions

void ChipAndChannelToSpot (int chip, int chan, geo::View_t &view, int &wire)
 
template<class T , class It_t >
std::vector< T > VectorViaSet (It_t begin, It_t end)
 
std::vector< std::vector< raw::ChannelID_t > > ChannelsForTPC (const geo::GeometryCore *geom, geo::TPCID tpc)
 

Function Documentation

std::vector<std::vector<raw::ChannelID_t> > detvar::ChannelsForTPC ( const geo::GeometryCore geom,
geo::TPCID  tpc 
)

Definition at line 147 of file RandomChannelStatusService_service.cc.

148  {
149  // No good way of enumerating all the unique channels, or selecting them by
150  // index. Have to figure them out from the wires.
151  std::set<raw::ChannelID_t> chanset[3];
152  for(geo::WireID wire: geom->IterateWireIDs(tpc)){
153  const raw::ChannelID_t chan = geom->PlaneWireToChannel(wire);
154  // But this also gives us wires that are actually attached to the other
155  // face and just wrapped onto this face. So long as the order of the
156  // vector returned from this function is meaningful, this should work
157  // to keep just the ones we need.
158  if(geom->ChannelToWire(chan)[0] == wire)
159  chanset[geom->View(chan)].insert(chan);
160  }
161  // We'll want to index by channel number within the APAs. Sort spatially as
162  // our best guess as to that mapping.
163  std::vector<std::vector<raw::ChannelID_t>> chans;
164  for(int i = 0; i < 3; ++i){
165  chans.emplace_back(chanset[i].begin(), chanset[i].end());
166  SortChansByZ scz;
167  std::sort(chans.back().begin(), chans.back().end(), scz);
168  }
169  return chans;
170  }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
IteratorBox< wire_id_iterator,&GeometryCore::begin_wire_id,&GeometryCore::end_wire_id > IterateWireIDs() const
Enables ranged-for loops on all wire IDs of the detector.
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
raw::ChannelID_t PlaneWireToChannel(WireID const &wireid) const
Returns the ID of the TPC channel connected to the specified wire.
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
void detvar::ChipAndChannelToSpot ( int  chip,
int  chan,
geo::View_t view,
int &  wire 
)

Definition at line 15 of file RandomChannelStatusService_service.cc.

16  {
17  // Ultimately this logic should be contained in some ChannelMap service
18 
19  assert(chip >= 1 && chip <= 8);
20  assert(chan >= 0 && chan <= 15);
21 
22  int wireMin = -1; // smallest value in block
23  int chipMin = -1, chanMin = -1; // position of smallest value
24  int height = -1; // height of block
25  int chipSign = 0, chanSign = 0; // which way the numbers count
26 
27  if(chip == 1 || chip == 2){
28  wireMin = 1; chipMin = 2; chipSign = -1; chanSign = -1;
29  /**/ if(chan <= 4){view = geo::kU; chanMin = 4; height = 5;}
30  else if(chan <= 9){view = geo::kV; chanMin = 9; height = 5;}
31  else/* */{view = geo::kW; chanMin = 15; height = 6;}
32  }
33 
34  if(chip == 3 || chip == 4){
35  wireMin = 2; chipMin = 4; chipSign = -1; chanSign = +1;
36  /**/ if(chan <= 5){view = geo::kW; chanMin = 0; height = 6;}
37  else if(chan <= 10){view = geo::kV; chanMin = 6; height = 5;}
38  else/* */{view = geo::kU; chanMin = 11; height = 5;}
39  }
40 
41  if(chip == 5 || chip == 6){
42  chipMin = 5; chipSign = +1; chanSign = -1;
43  /**/ if(chan <= 4){view = geo::kU; wireMin = 21; chanMin = 4; height = 5;}
44  else if(chan <= 9){view = geo::kV; wireMin = 21; chanMin = 9; height = 5;}
45  else/* */{view = geo::kW; wireMin = 25; chanMin = 15; height = 6;}
46  }
47 
48  if(chip == 7 || chip == 8){
49  chipMin = 7; chipSign = +1; chanSign = +1;
50  /**/ if(chan <= 5){view = geo::kW; wireMin = 26; chanMin = 0; height = 6;}
51  else if(chan <= 10){view = geo::kV; wireMin = 22; chanMin = 6; height = 5;}
52  else/* */{view = geo::kU; wireMin = 22; chanMin = 11; height = 5;}
53  }
54 
55  assert(wireMin >= 0 && chipMin >= 0 && chanMin >= 0 && height >= 0 && chipSign != 0 && chanSign != 0);
56 
57  // Compute the wire number inside the block
58  wire = wireMin+2*((chan-chanMin)*chanSign + (chip-chipMin)*height*chipSign);
59 
60  assert(wire >= 1 && wire <= 48);
61  }
Planes which measure V.
Definition: geo_types.h:130
Planes which measure U.
Definition: geo_types.h:129
Planes which measure W (third view for Bo, MicroBooNE, etc).
Definition: geo_types.h:131
template<class T , class It_t >
std::vector<T> detvar::VectorViaSet ( It_t  begin,
It_t  end 
)

For whatever reason the iterators in Geometry can't be used to initialize a vector directly

Definition at line 65 of file RandomChannelStatusService_service.cc.

67  {
68  const std::set<T> s(begin, end);
69  return std::vector<T>(s.begin(), s.end());
70  }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
static QCString * s
Definition: config.cpp:1042