25 static uint64_t
MAXHITS = 4*1024*1024*1024ULL/
sizeof(
hit);
97 for(
unsigned int c = 0;
c < 12 * 32;
c++){
98 for(
unsigned int p = 0;
p < 32 * 28;
p++){
102 thehit.
adc = (
c*
p)%124;
103 thehit.
tdc = ((
c*
p)%432)*4;
118 for(
unsigned int c = 0;
c < 3 * 32;
c++){
119 for(
unsigned int p = 0;
p < 2 * (8 * 12 + 11);
p++){
120 if(
p >= 2 * 8 * 12 &&
c >= 2 * 32 &&
p%2 == 0)
continue;
124 thehit.
adc = (
c*
p)%1234;
125 thehit.
tdc = ((
c*
p)% 234)*4;
150 const vector<float>::iterator
pi 151 = std::upper_bound(tplane_z.begin(), tplane_z.end(),
z);
155 if(pi == tplane_z.end()){
157 ans.
plane = (tplane_z.size()-1) * 2 + add;
159 else if(pi == tplane_z.begin()){
166 const float thisone =
fabs( *pi - z);
167 const float previous =
fabs( *(pi - 1) - z);
168 if(thisone < previous) ans.
plane = (pi - tplane_z.begin())*2 + add;
169 else ans.
plane = (pi - tplane_z.begin())*2 + add - 2;
177 const float t = (view ==
geo::kX? x: y);
178 const vector<float>::iterator ci
179 = std::upper_bound(cells.begin(), cells.end(),
t);
181 if(ci == cells.end()){
183 ans.
cell = cells.size()-1;
185 else if(ci == cells.begin()){
191 const float thisone =
fabs( *ci -
t);
192 const float previous =
fabs( *(ci - 1) -
t);
193 if(thisone < previous) ans.
cell = (ci - cells.begin());
194 else ans.
cell = (ci - cells.begin()) - 1;
206 vector<float> cell_z,
cell_t;
207 for(
unsigned int ce = 0; ce < plane->
Ncells(); ce++){
208 double cellcenter[3], dum[3];
209 geo->
CellInfo(
pl, ce, &view, cellcenter, dum);
210 cell_z.push_back(cellcenter[2]);
211 cell_t.push_back(
geo::kX?cellcenter[0]:cellcenter[1]);
218 pz.push_back(cell_z[cell_z.size()/2]);
232 static int first =
true;
245 const double meanplanesep = 6.6681604;
246 const double meancellsep = 3.9674375;
248 std::pair<cppoint, cppoint> answer;
251 double cellcenter[3], dum[3];
254 geo->
CellInfo(answer.first.plane, answer.first.cell, &dumv, cellcenter, dum);
255 answer.first.fcell = (tp.X() - cellcenter[0])/meancellsep;
256 answer.first.fplane = (tp.Z() - cellcenter[2])/meanplanesep;
263 geo->
CellInfo(answer.second.plane, answer.second.cell, &dumv, cellcenter, dum);
264 answer.second.fcell = (tp.Y() - cellcenter[1])/meancellsep;
265 answer.second.fplane = (tp.Z() - cellcenter[2])/meanplanesep;
272 signal(SIGINT, SIG_DFL);
279 fprintf(
stderr,
"NOE needs CellHits with label \"%s\" as configured in your " 280 "FCL, but event %d doesn't have those.\n", fCellHitLabel.c_str(), evt.
event());
285 if(fTrackLabel !=
"" && !evt.
getByLabel(fTrackLabel, tracks)){
287 "Warning: No tracks found with label \"%s\"\n", fTrackLabel.c_str());
292 if(fVertexLabel !=
"" && !evt.
getByLabel(fVertexLabel, vertices)){
294 "Warning: No vertices found with label \"%s\"\n", fVertexLabel.c_str());
301 fVertexLabel ==
"" && fTrackLabel ==
""? NULL:
305 if(
theevents.empty()) add_test_nd_event();
318 static uint64_t TOTHITS = 0;
319 for(
unsigned int i = 0;
i < cellhits->size();
i++){
332 for(
unsigned int i = 0; tracks.
isValid() &&
i < tracks->size();
i++){
334 thetrack.
startx = 10*(*tracks)[
i].Start().X();
335 thetrack.
starty = 10*(*tracks)[
i].Start().Y();
336 thetrack.
startz = 10*(*tracks)[
i].Start().Z();
337 thetrack.
stopx = 10*(*tracks)[
i].Stop ().X();
338 thetrack.
stopy = 10*(*tracks)[
i].Stop ().Y();
339 thetrack.
stopz = 10*(*tracks)[
i].Stop ().Z();
340 thetrack.
tns = (*tracks)[
i].MeanTNS();
341 thetrack.
time = (*tracks)[
i].MeanTNS()/1000*64.;
342 for(
unsigned int c = 0;
c < (*tracks)[
i].NCell();
c++){
344 thehit.
cell = (*tracks)[
i].Cell(
c)->Cell();
345 thehit.
plane = (*tracks)[
i].Cell(
c)->Plane();
346 thetrack.
hits.push_back(thehit);
348 for(
unsigned int p = 0;
p < (*tracks)[
i].NTrajectoryPoints();
p++){
349 const TVector3 & tp = (*tracks)[
i].TrajectoryPoint(
p);
350 const std::pair<cppoint, cppoint> tps =
cart_to_cp(*geo, tp);
357 for(
unsigned int i = 0; vertices.
isValid() &&
i < vertices->size();
i++){
359 const std::pair<cppoint, cppoint> cp =
cart_to_cp(*geo, (*vertices)[
i].GetXYZ());
360 thevertex.
pos[0] = cp.first;
361 thevertex.
pos[1] = cp.second;
362 thevertex.
posx = 10*(*vertices)[
i].GetX();
363 thevertex.
posy = 10*(*vertices)[
i].GetY();
364 thevertex.
posz = 10*(*vertices)[
i].GetZ();
365 thevertex.
tns = (*vertices)[
i].GetT();
366 thevertex.
time = (*vertices)[
i].GetT()/1000*64;
371 fprintf(
stderr,
"Read over %lu hits. Will load no more events!\n",
MAXHITS);
static vector< vector< float > > xcell_z
static std::pair< cppoint, cppoint > cart_to_cp(art::ServiceHandle< geo::Geometry > &geo, const TVector3 &tp)
SubRunNumber_t subRun() const
vector< noeevent > theevents
int32_t TDC() const
The time of the last baseline sample.
fvar< T > fabs(const fvar< T > &x)
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
unsigned short Plane() const
static vector< vector< float > > ycell_y
void addhit(const hit &h)
Vertical planes which measure X.
unsigned int Ncells() const
Number of cells in this plane.
const PlaneGeo * Plane(unsigned int i) const
DEFINE_ART_MODULE(TestTMapFile)
std::vector< cppoint > traj[2]
Horizontal planes which measure Y.
void CellInfo(unsigned int ip, unsigned int ic, View_t *view=0, double *pos=0, double *dpos=0) const
static vector< vector< float > > xcell_x
void addvertex(const vertex &v)
unsigned short Cell() const
__attribute__((unused)) static void add_test_fd_event()
T get(std::string const &key) const
Geometry information for a single readout plane.
base_types push_back(int_type())
static void build_cell_lookup_table(art::ServiceHandle< geo::Geometry > &geo)
static vector< float > xplane_z
static vector< float > yplane_z
EventNumber_t event() const
Vertex location in position and time.
std::string fCellHitLabel
static vector< vector< float > > ycell_z
A rawdata::RawDigit with channel information decoded.
int16_t ADC(uint32_t i) const
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
void realmain(const bool have_read_all)
static cppoint get_int_plane_and_cell(const double x, const double y, const double z, const geo::View_t view)
unsigned int NPlanes() const
add("abs", expr_type(int_type()), expr_type(int_type()))
void addtrack(const track &t)
Encapsulate the geometry of one entire detector (near, far, ndos)
bool theevents_memory_limited