#include <FillBasic.h>
Public Member Functions | |
| FillBasic () | |
| ~FillBasic () | |
| void | Config (const Registry ®) |
| bool | Fill (const NtpStRecord &ntprec, const NtpSREvent &record) |
| bool | Fill (const NtpStRecord &ntprec, const NtpSRShower &record) |
| bool | Fill (const NtpStRecord &ntprec, const NtpSRTrack &record) |
| const Basic | GetBasic () const |
| const Vertex | GetBegVtx () const |
| const Vertex | GetEndVtx () const |
Private Member Functions | |
| const Vertex | Get (const NtpSRVertex &vtx, bool isfid_) const |
| bool | Check (const Basic &basic, const NtpSRPlane &plane) const |
| bool | Fill (Basic &basic, const NtpSRStripPulseHeight &ph) const |
| const Basic | Get (const NtpStRecord &record, const int *index_array, int nstrip) const |
Private Attributes | |
| bool | fCheck |
| double | fTrackZOffset |
| Basic | fBasic |
| Vertex | fBegVtx |
| Vertex | fEndVtx |
|
|
Definition at line 32 of file FillBasic.cxx. 00033 :fCheck(true), 00034 fTrackZOffset(0.0392) 00035 { 00036 }
|
|
|
Definition at line 39 of file FillBasic.cxx. 00040 {
00041 }
|
|
||||||||||||
|
Definition at line 219 of file FillBasic.cxx. References NtpSRPlane::beg, Anp::Basic::beg_uplane, Anp::Basic::beg_vplane, NtpSRPlane::begu, NtpSRPlane::begv, NtpSRPlane::end, Anp::Basic::end_uplane, Anp::Basic::end_vplane, NtpSRPlane::endu, NtpSRPlane::endv, MSG, NtpSRPlane::n, NtpSRPlane::nu, Anp::Basic::nuplane, NtpSRPlane::nv, and Anp::Basic::nvplane. Referenced by Fill(). 00220 {
00221 //
00222 // Check consistency of Basic object, this is useful bug check.
00223 //
00224
00225 bool result = true;
00226
00227 if(plane.nu + plane.nv != plane.n)
00228 {
00229 MSG("FillAlg", Msg::kWarning) << "Number of planes does not match" << endl;
00230 result = false;
00231 }
00232 if(basic.nuplane != short(plane.nu))
00233 {
00234 MSG("FillAlg", Msg::kWarning) << "Mismatched number of U planes" << endl;
00235 result = false;
00236 }
00237 if(basic.nvplane != short(plane.nv))
00238 {
00239 MSG("FillAlg", Msg::kWarning) << "Mismatched number of V planes" << endl;
00240 result = false;
00241 }
00242
00243 if(plane.beg < plane.end)
00244 {
00245 if(basic.beg_uplane != short(plane.begu))
00246 {
00247 MSG("FillAlg", Msg::kWarning) << "Mismatched beg U plane" << endl;
00248 result = false;
00249 }
00250 if(basic.beg_vplane != short(plane.begv))
00251 {
00252 MSG("FillAlg", Msg::kWarning) << "Mismatched beg V plane" << endl;
00253 result = false;
00254 }
00255 if(basic.end_uplane != short(plane.endu))
00256 {
00257 MSG("FillAlg", Msg::kWarning) << "Mismatched end U plane" << endl;
00258 result = false;
00259 }
00260 if(basic.end_vplane != short(plane.endv))
00261 {
00262 MSG("FillAlg", Msg::kWarning) << "Mismatched end V plane" << endl;
00263 result = false;
00264 }
00265 }
00266 else if(plane.beg > plane.end)
00267 {
00268 if(basic.beg_uplane != short(plane.endu))
00269 {
00270 MSG("FillAlg", Msg::kWarning) << "Mismatched beg U plane" << endl;
00271 result = false;
00272 }
00273 if(basic.beg_vplane != short(plane.endv))
00274 {
00275 MSG("FillAlg", Msg::kWarning) << "Mismatched beg V plane" << endl;
00276 result = false;
00277 }
00278 if(basic.end_uplane != short(plane.begu))
00279 {
00280 MSG("FillAlg", Msg::kWarning) << "Mismatched end U plane" << endl;
00281 result = false;
00282 }
00283 if(basic.end_vplane != short(plane.begv))
00284 {
00285 MSG("FillAlg", Msg::kWarning) << "Mismatched end V plane" << endl;
00286 result = false;
00287 }
00288 }
00289 else
00290 {
00291 MSG("FillAlg", Msg::kWarning) << "beg and end plane are equal" << endl;
00292 result = false;
00293 }
00294
00295 return result;
00296 }
|
|
|
Definition at line 44 of file FillBasic.cxx. References fCheck, fTrackZOffset, Registry::Get(), Registry::KeyExists(), Anp::Read(), and reg. Referenced by Anp::FillTrack::Config(), Anp::FillShower::Config(), and Anp::FillEvent::Config(). 00045 {
00046 //
00047 // Configure self
00048 //
00049 Anp::Read(reg, "FillBasicCheck", fCheck);
00050
00051 reg.Get("TrackZOffset", fTrackZOffset);
00052
00053 if(reg.KeyExists("PrintConfigBasic"))
00054 {
00055 cout << "FillBasic::Config" << endl
00056 << " Check = " << fCheck << endl
00057 << " TrackZOffset = " << fTrackZOffset << endl;
00058 }
00059 }
|
|
||||||||||||
|
Definition at line 185 of file FillBasic.cxx. References Anp::Basic::adcu, Anp::Basic::adcv, count, NtpSRStripPulseHeight::mip, Anp::Basic::mip, MSG, NtpSRPulseHeight::pe, Anp::Basic::pe, NtpSRPulseHeight::raw, NtpSRPulseHeight::sigcor, Anp::Basic::sigcoru, Anp::Basic::sigcorv, NtpSRPulseHeight::siglin, Anp::Basic::siglin, NtpSRStripPulseHeight::sigmap, and Anp::Basic::sigmap. 00186 {
00187 //
00188 // Fill Basic with pulse height information and check consistency between standard
00189 // pulse height class NtpSRStripPulseHeight and pulse height computed by iterating over
00190 // NtpSRStrip objects that belong to reconstructed object.
00191 //
00192
00193 basic.siglin = ph.siglin;
00194 basic.pe = ph.pe;
00195 basic.sigmap = ph.sigmap;
00196 basic.mip = ph.mip;
00197
00198 if(std::fabs(basic.adcu + basic.adcv - ph.raw) > 1.001)
00199 {
00200 static unsigned int count = 0;
00201 MSG("FillAlg", Msg::kWarning) << "Error " << ++count << " in NtpSRStripPulseHeight adc "
00202 << basic.adcu + basic.adcv << " - " << ph.raw << " = "
00203 << basic.adcu + basic.adcv - ph.raw << std::endl;
00204 return false;
00205 }
00206 if(std::fabs(basic.sigcoru + basic.sigcorv - ph.sigcor) > 1.001)
00207 {
00208 static unsigned int count = 0;
00209 MSG("FillAlg", Msg::kWarning) << "Error " << ++count << " in NtpSRStripPulseHeight sigcor "
00210 << basic.sigcoru + basic.sigcorv << " - " << ph.sigcor << " = "
00211 << basic.sigcoru + basic.sigcorv - ph.sigcor << std::endl;
00212 return false;
00213 }
00214
00215 return true;
00216 }
|
|
||||||||||||
|
Definition at line 132 of file FillBasic.cxx. References Check(), Anp::Vertex::Clear(), Anp::Basic::Clear(), NtpSRTrack::end, fBasic, fBegVtx, fCheck, fEndVtx, Fill(), VldContext::GetDetector(), RecRecordImp< T >::GetHeader(), VldContext::GetSimFlag(), RecHeader::GetVldContext(), infid(), MSG, NtpSRTrack::nstrip, NtpSRTrack::ph, NtpSRTrack::plane, NtpSRTrack::stp, NtpSRTrack::vtx, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z. 00133 {
00134 //
00135 // Fill Anp::Basic and Anp::Vertex data
00136 //
00137
00138 fBasic.Clear();
00139 fBegVtx.Clear();
00140 fEndVtx.Clear();
00141
00142 const bool isfid = infid(ntprec.GetHeader().GetVldContext().GetDetector(),
00143 ntprec.GetHeader().GetVldContext().GetSimFlag(),
00144 record.vtx.x,
00145 record.vtx.y,
00146 record.vtx.z - fTrackZOffset);
00147
00148
00149 fBasic = FillBasic::Get(ntprec, record.stp, record.nstrip);
00150 fBegVtx = FillBasic::Get(record.vtx, isfid);
00151 fEndVtx = FillBasic::Get(record.end, false);
00152
00153 if(!Fill(fBasic, record.ph))
00154 {
00155 MSG("FillAlg", Msg::kWarning) << "Fill failed for NtpSREvent \n" << record;
00156 return false;
00157 }
00158
00159 if(fCheck && !Check(fBasic, record.plane))
00160 {
00161 MSG("FillAlg", Msg::kWarning) << "NtpSRTrack plane check failed \n" << record.plane;
00162 return false;
00163 }
00164
00165 return true;
00166 }
|
|
||||||||||||
|
Definition at line 97 of file FillBasic.cxx. References Check(), Anp::Vertex::Clear(), Anp::Basic::Clear(), fBasic, fBegVtx, fCheck, fEndVtx, Fill(), VldContext::GetDetector(), RecRecordImp< T >::GetHeader(), VldContext::GetSimFlag(), RecHeader::GetVldContext(), infid(), MSG, NtpSRShower::nstrip, NtpSRShower::ph, NtpSRShower::plane, NtpSRShower::stp, NtpSRShower::vtx, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z. 00098 {
00099 //
00100 // Fill Anp::Basic and Anp::Vertex data
00101 //
00102
00103 fBasic.Clear();
00104 fBegVtx.Clear();
00105 fEndVtx.Clear();
00106
00107 const bool isfid = infid(ntprec.GetHeader().GetVldContext().GetDetector(),
00108 ntprec.GetHeader().GetVldContext().GetSimFlag(),
00109 record.vtx.x,
00110 record.vtx.y,
00111 record.vtx.z);
00112
00113 fBasic = FillBasic::Get(ntprec, record.stp, record.nstrip);
00114 fBegVtx = FillBasic::Get(record.vtx, isfid);
00115
00116 if(!Fill(fBasic, record.ph))
00117 {
00118 MSG("FillAlg", Msg::kWarning) << "Fill failed for NtpSRShower \n" << record;
00119 return false;
00120 }
00121
00122 if(fCheck && !Check(fBasic, record.plane))
00123 {
00124 MSG("FillAlg", Msg::kWarning) << "NtpSRShower plane check failed \n" << record.plane;
00125 return false;
00126 }
00127
00128 return true;
00129 }
|
|
||||||||||||
|
Definition at line 62 of file FillBasic.cxx. References Check(), Anp::Vertex::Clear(), Anp::Basic::Clear(), fBasic, fBegVtx, fCheck, fEndVtx, VldContext::GetDetector(), RecRecordImp< T >::GetHeader(), VldContext::GetSimFlag(), RecHeader::GetVldContext(), infid(), MSG, NtpSREvent::nstrip, NtpSREvent::ph, NtpSREvent::plane, NtpSREvent::stp, NtpSREvent::vtx, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z. Referenced by Fill(), Anp::FillTrack::Run(), Anp::FillShower::Run(), and Anp::FillEvent::Run(). 00063 {
00064 //
00065 // Fill Anp::Basic and Anp::Vertex data
00066 //
00067
00068 fBasic.Clear();
00069 fBegVtx.Clear();
00070 fEndVtx.Clear();
00071
00072 const bool isfid = infid(ntprec.GetHeader().GetVldContext().GetDetector(),
00073 ntprec.GetHeader().GetVldContext().GetSimFlag(),
00074 record.vtx.x,
00075 record.vtx.y,
00076 record.vtx.z);
00077
00078 fBasic = FillBasic::Get(ntprec, record.stp, record.nstrip);
00079 fBegVtx = FillBasic::Get(record.vtx, isfid);
00080
00081 if(!Fill(fBasic, record.ph))
00082 {
00083 MSG("FillAlg", Msg::kWarning) << "Fill failed for NtpSREvent \n" << record;
00084 return false;
00085 }
00086
00087 if(fCheck && !Check(fBasic, record.plane))
00088 {
00089 MSG("FillAlg", Msg::kWarning) << "NtpSREvent plane check failed \n" << record.plane;
00090 return false;
00091 }
00092
00093 return true;
00094 }
|
|
||||||||||||||||
|
Definition at line 299 of file FillBasic.cxx. References Anp::Basic::active_frac, Anp::Basic::adcu, Anp::Basic::adcv, Anp::Basic::beg_uplane, Anp::Basic::beg_vplane, count, Anp::Basic::end_uplane, Anp::Basic::end_vplane, find(), VldContext::GetDetector(), RecRecordImp< T >::GetHeader(), Anp::GetSRStrip(), RecHeader::GetVldContext(), max, Anp::Basic::max_time, min, Anp::Basic::min_time, MSG, Anp::Basic::nuplane, Anp::Basic::nustrip, Anp::Basic::nvplane, Anp::Basic::nvstrip, Anp::Basic::sigcoru, Anp::Basic::sigcorv, and NtpStRecord::stp. 00301 {
00302 //
00303 // Iterate over strips with indexes stored in index_array and
00304 // compute pulse height and time and plane spans.
00305 //
00306
00307 Basic data;
00308
00309 if(nstrip < 1 || !index_array)
00310 {
00311 return data;
00312 }
00313
00314 //
00315 // Initialize variables that use += operator
00316 //
00317 data.nustrip = 0;
00318 data.nvstrip = 0;
00319 data.adcu = 0.0;
00320 data.adcv = 0.0;
00321 data.sigcoru = 0.0;
00322 data.sigcorv = 0.0;
00323
00324 const TClonesArray *strip_array = record.stp;
00325 if(!strip_array)
00326 {
00327 MSG("FillAlg", Msg::kWarning) << "NtpStRecord does not have valid strip array." << endl;
00328 return data;
00329 }
00330
00331 vector<short> uplane_vec, vplane_vec;
00332
00333 const int entries = strip_array -> GetEntries();
00334
00335 const Detector::Detector_t detector = record.GetHeader().GetVldContext().GetDetector();
00336
00337 bool init_time = false;
00338 for(int i = 0; i < nstrip; ++i)
00339 {
00340 const short index = index_array[i];
00341 if(index < 0 || index >= entries)
00342 {
00343 MSG("FillAlg", Msg::kWarning) << "NtpSRStrip index is out of range: " << index << endl;
00344 continue;
00345 }
00346
00347 NtpSRStrip *ntpstp = Anp::GetSRStrip(record, index);
00348 if(!ntpstp)
00349 {
00350 continue;
00351 }
00352
00353 if(index != ntpstp -> index)
00354 {
00355 MSG("FillAlg", Msg::kWarning) << "Mismatched strip and TClonesArray index" << endl;
00356 continue;
00357 }
00358
00359 const short plane = ntpstp -> plane;
00360
00361 if(ntpstp -> planeview == PlaneView::kU)
00362 {
00363 if(std::find(uplane_vec.begin(), uplane_vec.end(), plane) == uplane_vec.end())
00364 {
00365 uplane_vec.push_back(plane);
00366 }
00367 }
00368 else if(ntpstp -> planeview == PlaneView::kV)
00369 {
00370 if(std::find(vplane_vec.begin(), vplane_vec.end(), plane) == vplane_vec.end())
00371 {
00372 vplane_vec.push_back(plane);
00373 }
00374 }
00375 else
00376 {
00377 MSG("FillAlg", Msg::kWarning) << "Unknown planeview " << int(ntpstp -> planeview) << endl;
00378 continue;
00379 }
00380
00381 if(detector == Detector::kNear)
00382 {
00383 if(ntpstp -> pmtindex0 > 0)
00384 {
00385 MSG("FillAlg", Msg::kWarning) << "In ND East PMT index is positive" << std::endl;
00386 continue;
00387 }
00388
00389 if(ntpstp -> planeview == PlaneView::kU)
00390 {
00391 ++data.nustrip;
00392 data.adcu += ntpstp -> ph1.raw;
00393 data.sigcoru += ntpstp -> ph1.sigcor;
00394 }
00395 else if(ntpstp -> planeview == PlaneView::kV)
00396 {
00397 ++data.nvstrip;
00398 data.adcv += ntpstp -> ph1.raw;
00399 data.sigcorv += ntpstp -> ph1.sigcor;
00400 }
00401
00402 if(!init_time)
00403 {
00404 data.max_time = ntpstp -> time1;
00405 data.min_time = ntpstp -> time1;
00406 init_time = true;
00407 }
00408 else
00409 {
00410 data.max_time = std::max(ntpstp -> time1, data.max_time);
00411 data.min_time = std::min(ntpstp -> time1, data.min_time);
00412 }
00413 }
00414 else if(detector == Detector::kFar)
00415 {
00416 if(ntpstp -> planeview == PlaneView::kU)
00417 {
00418 ++data.nustrip;
00419
00420 if(ntpstp -> pmtindex0 > 0 ||
00421 (ntpstp -> pmtindex0 == 0 && ntpstp -> ph0.raw > 0.0))
00422 {
00423 data.adcu += ntpstp -> ph0.raw;
00424 data.sigcoru += ntpstp -> ph0.sigcor;
00425 }
00426
00427 if(ntpstp -> pmtindex1 > 0 ||
00428 (ntpstp -> pmtindex1 == 0 && ntpstp -> ph1.raw > 0.0))
00429 {
00430 data.adcu += ntpstp -> ph1.raw;
00431 data.sigcoru += ntpstp -> ph1.sigcor;
00432 }
00433 }
00434 else if(ntpstp -> planeview == PlaneView::kV)
00435 {
00436 ++data.nvstrip;
00437
00438 if(ntpstp -> pmtindex0 > 0 ||
00439 (ntpstp -> pmtindex0 == 0 && ntpstp -> ph0.raw > 0.0))
00440 {
00441 data.adcv += ntpstp -> ph0.raw;
00442 data.sigcorv += ntpstp -> ph0.sigcor;
00443 }
00444
00445 if(ntpstp -> pmtindex1 > 0 ||
00446 (ntpstp -> pmtindex1 == 0 && ntpstp -> ph1.raw > 0.0))
00447 {
00448 data.adcv += ntpstp -> ph1.raw;
00449 data.sigcorv += ntpstp -> ph1.sigcor;
00450 }
00451 }
00452
00453
00454 if(ntpstp -> pmtindex0 > 0 ||
00455 (ntpstp -> pmtindex0 == 0 && ntpstp -> ph0.raw > 0.0))
00456 {
00457 if(!init_time)
00458 {
00459 data.max_time = ntpstp -> time0;
00460 data.min_time = ntpstp -> time0;
00461 init_time = true;
00462 }
00463 else
00464 {
00465 data.max_time = std::max(data.max_time, ntpstp -> time0);
00466 data.min_time = std::min(data.min_time, ntpstp -> time0);
00467 }
00468 }
00469
00470 if(ntpstp -> pmtindex1 > 0 ||
00471 (ntpstp -> pmtindex1 == 0 && ntpstp -> ph1.raw > 0.0))
00472 {
00473 if(!init_time)
00474 {
00475 data.max_time = ntpstp -> time1;
00476 data.min_time = ntpstp -> time1;
00477 init_time = true;
00478 }
00479 else
00480 {
00481 data.max_time = std::max(data.max_time, ntpstp -> time1);
00482 data.min_time = std::min(data.min_time, ntpstp -> time1);
00483 }
00484 }
00485
00486 if(!init_time)
00487 {
00488 MSG("FillAlg", Msg::kWarning) << "Failed to find initial time" << endl;
00489 continue;
00490 }
00491 }
00492 else
00493 {
00494 MSG("FillAlg", Msg::kWarning) << "Unknown detector type" << std::endl;
00495 }
00496 }
00497
00498 data.nuplane = uplane_vec.size();
00499 data.nvplane = vplane_vec.size();
00500
00501 if(!uplane_vec.empty())
00502 {
00503 data.beg_uplane = *std::min_element(uplane_vec.begin(), uplane_vec.end());
00504 data.end_uplane = *std::max_element(uplane_vec.begin(), uplane_vec.end());
00505 }
00506
00507 if(!vplane_vec.empty())
00508 {
00509 data.beg_vplane = *std::min_element(vplane_vec.begin(), vplane_vec.end());
00510 data.end_vplane = *std::max_element(vplane_vec.begin(), vplane_vec.end());
00511 }
00512
00513 if(detector == Detector::kNear)
00514 {
00515 short min_plane = -1, max_plane = -1, count = 0;
00516
00517 for(vector<short>::const_iterator it = uplane_vec.begin(); it != uplane_vec.end(); ++it)
00518 {
00519 const short plane = *it;
00520 if(plane > 120)
00521 {
00522 break;
00523 }
00524
00525 ++count;
00526
00527 if(min_plane < 0 || min_plane > plane)
00528 {
00529 min_plane = plane;
00530 }
00531 if(max_plane < 0 || max_plane < plane)
00532 {
00533 max_plane = plane;
00534 }
00535 }
00536
00537 for(vector<short>::const_iterator it = vplane_vec.begin(); it != vplane_vec.end(); ++it)
00538 {
00539 const short plane = *it;
00540 if(plane > 120)
00541 {
00542 break;
00543 }
00544
00545 ++count;
00546
00547 if(min_plane < 0 || min_plane > plane)
00548 {
00549 min_plane = plane;
00550 }
00551 if(max_plane < 0 || max_plane < plane)
00552 {
00553 max_plane = plane;
00554 }
00555 }
00556
00557 if(max_plane - min_plane > 0)
00558 {
00559 data.active_frac = double(count)/double(1 + max_plane - min_plane);
00560 }
00561 }
00562 else
00563 {
00564 short min_plane = data.beg_uplane;
00565 short max_plane = data.end_uplane;
00566
00567 if(min_plane > data.beg_vplane)
00568 {
00569 min_plane = data.beg_vplane;
00570 }
00571 if(max_plane < data.end_vplane)
00572 {
00573 max_plane = data.end_vplane;
00574 }
00575
00576 const double nactive = uplane_vec.size() + vplane_vec.size();
00577 if(max_plane - min_plane > 0)
00578 {
00579 data.active_frac = nactive/double(max_plane - min_plane);
00580 }
00581 }
00582
00583 return data;
00584 }
|
|
||||||||||||
|
Definition at line 169 of file FillBasic.cxx. References NtpSRVertex::dcosu, NtpSRVertex::dcosv, NtpSRVertex::dcosz, NtpSRVertex::u, NtpSRVertex::v, and NtpSRVertex::z. 00170 {
00171 //
00172 // This is really just a Vertex constructor, put it here to avoid NtpSRVertex dependency
00173 //
00174
00175 return Vertex(vtx.u,
00176 vtx.v,
00177 vtx.z,
00178 vtx.dcosu,
00179 vtx.dcosv,
00180 vtx.dcosz,
00181 isfid_);
00182 }
|
|
|
Definition at line 72 of file FillBasic.h. Referenced by Anp::FillTrack::Run(), Anp::FillShower::Run(), and Anp::FillEvent::Run(). 00072 { return fBasic; }
|
|
|
Definition at line 73 of file FillBasic.h. Referenced by Anp::FillTrack::Run(), Anp::FillShower::Run(), and Anp::FillEvent::Run(). 00073 { return fBegVtx; }
|
|
|
Definition at line 74 of file FillBasic.h. Referenced by Anp::FillTrack::Run(). 00074 { return fEndVtx; }
|
|
|
Definition at line 60 of file FillBasic.h. Referenced by Fill(). |
|
|
Definition at line 61 of file FillBasic.h. Referenced by Fill(). |
|
|
Definition at line 57 of file FillBasic.h. |
|
|
Definition at line 62 of file FillBasic.h. Referenced by Fill(). |
|
|
Definition at line 58 of file FillBasic.h. Referenced by Config(). |
1.3.9.1