330 art::TFileDirectory topdir = tfs->mkdir(
"trkgaps",
"Gap histograms");
331 art::TFileDirectory gap1 = topdir.mkdir(
"Gap 1");
332 art::TFileDirectory gap2 = topdir.mkdir(
"Gap 2");
333 art::TFileDirectory gap3 = topdir.mkdir(
"Gap 3");
334 art::TFileDirectory gap4 = topdir.mkdir(
"Gap 4");
335 art::TFileDirectory gap5 = topdir.mkdir(
"Gap 5");
361 efield[0] = detProp.Efield(0);
362 efield[1] = detProp.Efield(1);
363 efield[2] = detProp.Efield(2);
368 std::vector<art::Ptr<recob::Track> > tracklist;
373 std::vector<art::Ptr<recob::Hit> > hitlist;
378 std::vector<art::Ptr<recob::Cluster> > clusterlist;
394 if (trackvh.
isValid()) cti = trackvh->begin();
404 double boundaries[6];
405 double TempBounds[6];
407 for (
int b=0;
b<6;
b++) boundaries[
b] = 0;
408 for (
int c1 = 0;
c1 < NCryo;
c1++ ) {
410 if ( boundaries[0] > TempBounds [0] ) boundaries[0] = TempBounds [0];
411 if ( boundaries[1] < TempBounds [1] ) boundaries[1] = TempBounds [1];
412 if ( boundaries[2] > TempBounds [2] ) boundaries[2] = TempBounds [2];
413 if ( boundaries[3] < TempBounds [3] ) boundaries[3] = TempBounds [3];
414 if ( boundaries[4] > TempBounds [4] ) boundaries[4] = TempBounds [4];
415 if ( boundaries[5] < TempBounds [5] ) boundaries[5] = TempBounds [5];
423 if ( trackListHandle.
isValid() ) {
436 if ( fmt0.isValid() ) {
437 std::vector<const anab::T0*> T0s = fmt0.at(i);
438 for (
size_t t0size =0; t0size < T0s.size(); t0size++) {
451 std::vector< art::Ptr<recob::Hit> > allHits = fmht.at(i);
452 double Hit_Size = allHits.size();
459 std::tie(trackStart, trackEnd) = tracklist[i]->Extent();
460 larStart = tracklist[i]->VertexDirection();
461 larEnd = tracklist[i]->EndDirection();
463 trkstartx[i] = trackStart.X() - detProp.ConvertTicksToX( TickT0, allHits[Hit_Size-1]->
WireID().
Plane, allHits[Hit_Size-1]->
WireID().TPC, allHits[Hit_Size-1]->
WireID().Cryostat );
466 trkendx[i] = trackEnd.X() - detProp.ConvertTicksToX( TickT0, allHits[0]->
WireID().
Plane, allHits[0]->
WireID().TPC, allHits[0]->
WireID().Cryostat );
475 TLorentzVector v1(trackStart.X(),trackStart.Y(),trackStart.Z(),0);
476 TLorentzVector v2(trackEnd.X(),trackEnd.Y(),trackEnd.Z(),0);
495 double distance_squared=0;
496 TVector3 V1(trackStart.X(),trackStart.Y(),trackStart.Z());
497 TVector3 V2(trackEnd.X(),trackEnd.Y(),trackEnd.Z());
498 TVector3 vOrth=(V2-V1).Orthogonal();
499 TVector3 pointVector=V1;
510 std::vector<art::Ptr<recob::SpacePoint> > spts = fmsp.at(i);
511 for (
size_t j = 0; j<spts.size(); ++j){
512 TVector3 sptVector(spts[j]->XYZ()[0],spts[j]->XYZ()[1],spts[j]->XYZ()[2]);
513 TVector3 vToPoint=sptVector-pointVector;
514 distance=(vOrth.Dot(vToPoint))/vOrth.Mag();
515 distance_squared+=distance *
distance;
517 if (spts[j]->XYZ()[0] < -1000)
continue;
518 else trkx[i][j] = spts[j]->XYZ()[0];
519 if (spts[j]->XYZ()[1] < -1000)
continue;
520 else trky[i][j] = spts[j]->XYZ()[1];
521 if (spts[j]->XYZ()[2] < -1000)
continue;
522 else trky[i][j] = spts[j]->XYZ()[2];
524 std::cout <<
"X, Y, Z: " << spts[j]->XYZ()[0] <<
", " << spts[j]->XYZ()[1] <<
", " << spts[j]->XYZ()[2] <<
std::endl;
527 distance_squared=distance_squared/spts.size();
528 trkd2[i]=distance_squared;
538 if (fmcal.isValid()){
539 std::vector<const anab::Calorimetry*> calos = fmcal.at(i);
541 for (
size_t jj = 0; jj<calos.size(); ++jj){
542 trkrange[i][jj] = calos[jj]->Range();
543 trkkinE[i][jj] = (calos[jj] -> KineticEnergy());
545 int tt= calos[jj] ->
dEdx().size();
546 for(
int k = 0;
k < tt; ++
k) {
548 trkdqdx[i][jj][
k] = (calos[jj] -> dQdx())[
k];
550 trkresrg[i][jj][
k] = (calos[jj] -> ResidualRange())[
k];
551 trkTPC[i][jj][
k] = (calos[jj]->PlaneID()).TPC;
554 trkPosx[i][jj][
k] = (calos[jj]->XYZ())[
k].
x();
555 trkPosy[i][jj][
k] = (calos[jj]->XYZ())[
k].
y();
556 trkPosz[i][jj][
k] = (calos[jj]->XYZ())[
k].
z();
570 for (
int j = 0; j<3; ++j){
580 mf::LogWarning(
"GapWidth")<<
"caught exception "<<e<<
"\n setting pitch to 0";
590 if ( hitListHandle.
isValid() ) {
592 nhits = hitlist.size();
594 nclust = clusterlist.size();
595 for (
int i = 0; i <
nhits2; ++i){
596 unsigned int channel = hitlist[i]->Channel();
604 hit_ph[i] = hitlist[i]->PeakAmplitude();
605 if (fmtk.at(i).size()!=0 && fmtk.at(i)[0]->ID() <= 7){
606 std::cout <<
"Hit TrackID: " << fmtk.at(i)[0]->ID() <<
std::endl;
613 gapit1[
event] = gap1.make<TH1D>(Form(
"gapit1, from event %d",
event),Form(
"Gap Width Against Translation, Event %d",
event), 101, -5.05, 5.05);
614 gapdif1[
event] = gap1.make<TH1D>(Form(
"gapdif1 from event %d",
event),Form(
"Gap Difference from Nominal, Event %d",
event), 101, -5.05, 5.05);
616 gapit2[
event] = gap2.make<TH1D>(Form(
"gapit2, from event %d",
event),Form(
"Gap Width Against Translation, Event %d",
event), 101, -5.05, 5.05);
617 gapdif2[
event] = gap2.make<TH1D>(Form(
"gapdif2 from event %d",
event),Form(
"Gap Difference from Nominal, Event %d",
event), 101, -5.05, 5.05);
619 gapit3[
event] = gap3.make<TH1D>(Form(
"gapit3, from event %d",
event),Form(
"Gap Width Against Translation, Event %d",
event), 101, -5.05, 5.05);
620 gapdif3[
event] = gap3.make<TH1D>(Form(
"gapdif3 from event %d",
event),Form(
"Gap Difference from Nominal, Event %d",
event), 101, -5.05, 5.05);
622 gapit4[
event] = gap4.make<TH1D>(Form(
"gapit4, from event %d",
event),Form(
"Gap Width Against Translation, Event %d",
event), 101, -5.05, 5.05);
623 gapdif4[
event] = gap4.make<TH1D>(Form(
"gapdif4 from event %d",
event),Form(
"Gap Difference from Nominal, Event %d",
event), 101, -5.05, 5.05);
625 gapit5[
event] = gap5.make<TH1D>(Form(
"gapit5, from event %d",
event),Form(
"Gap Width Against Translation, Event %d",
event), 101, -5.05, 5.05);
626 gapdif5[
event] = gap5.make<TH1D>(Form(
"gapdif5 from event %d",
event),Form(
"Gap Difference from Nominal, Event %d",
event), 101, -5.05, 5.05);
706 for (
int translationsteps = 0; translationsteps < 101; translationsteps ++){
870 TMinuit* mingen =
new TMinuit(1);
872 mingen->SetPrintLevel(-1);
873 mingen->DefineParameter(0,
"gap extension", -20, 0.001, -100, 100);
875 mingen->GetParameter(0,
z, error);
982 TMinuit* mingen =
new TMinuit(1);
984 mingen->SetPrintLevel(-1);
985 mingen->DefineParameter(0,
"gap extension", -20, 0.001, -100, 100);
987 mingen->GetParameter(0,
z, error);
1093 double error = 0.01;
1094 TMinuit* mingen =
new TMinuit(1);
1096 mingen->SetPrintLevel(-1);
1097 mingen->DefineParameter(0,
"gap extension", -20, 0.001, -100, 100);
1099 mingen->GetParameter(0,
z, error);
1205 double error = 0.01;
1206 TMinuit* mingen =
new TMinuit(1);
1208 mingen->SetPrintLevel(-1);
1209 mingen->DefineParameter(0,
"gap extension", -20, 0.001, -100, 100);
1211 mingen->GetParameter(0,
z, error);
1325 double error = 0.01;
1326 TMinuit* min5 =
new TMinuit(1);
1328 min5->SetPrintLevel(-1);
1329 min5->DefineParameter(0,
"gap extension", -20, 0.001, -100, 100);
1331 min5->GetParameter(0,
y, error);
1350 gapdif1[
event]->SetBinContent(translationsteps+1, fabs(
output[event][0][4] - 2.0789));
1352 gapit2[
event]->SetBinContent(translationsteps+1,
output[event][1][4]);
1353 gapdif2[
event]->SetBinContent(translationsteps+1, fabs(
output[event][1][4] - 2.079));
1355 gapit3[
event]->SetBinContent(translationsteps+1,
output[event][2][4]);
1356 gapdif3[
event]->SetBinContent(translationsteps+1, fabs(
output[event][2][4] - 2.5279));
1358 gapit4[
event]->SetBinContent(translationsteps+1,
output[event][3][4]);
1359 gapdif4[
event]->SetBinContent(translationsteps+1, fabs(
output[event][3][4] - 1.629));
1361 gapit5[
event]->SetBinContent(translationsteps+1,
output[event][4][4]);
1362 gapdif5[
event]->SetBinContent(translationsteps+1, fabs(
output[event][4][4] - 2.9091));
code to link reconstructed objects back to the MC truth information
double trky[kMaxTrack][kMaxTrackHits]
double tracklengthXZ[kMaxTrack]
constexpr std::uint32_t timeLow() const
double trklen_L[kMaxTrack]
std::string fCalorimetryModuleLabel
double trkdQdxSum[kMaxTrack]
double trketa_zy[kMaxTrack]
double trkPosy[kMaxTrack][3][1000]
double trkenddcosy[kMaxTrack]
double trackmidy[kMaxTrack]
double trkendx[kMaxTrack]
double trkPosz[kMaxTrack][3][1000]
double trackmidz[kMaxTrack]
constexpr std::uint32_t timeHigh() const
double trkdEdxAverage[kMaxTrack]
std::string fClusterModuleLabel
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
std::string fSimulationProducerLabel
std::string fTrackModuleLabel
Vector_t VertexDirection() const
std::vector< double > possiblez
Planes which measure Z direction.
WireID_t Wire
Index of the wire within its plane.
double hit_charge[kMaxHits]
double trkTPC[kMaxTrack][3][1000]
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
double trktheta_yz[kMaxTrack]
double tracklengthYZ[kMaxTrack]
void CryostatBoundaries(double *boundaries, geo::CryostatID const &cid) const
Returns the boundaries of the specified cryostat.
std::vector< double > possibley
double trkstartx[kMaxTrack]
double trkdedx2[kMaxTrack][3][1000]
double trkdqdx[kMaxTrack][3][1000]
double trackmidx[kMaxTrack]
double dEdx(float dqdx, float Efield)
double trkkinE[kMaxTrack][3]
double Length(size_t p=0) const
Access to various track properties.
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
void minuitFunctionz(int &nDim, double *gout, double &result, double par[], int flg)
double trkenddcosx[kMaxTrack]
int hit_channel[kMaxHits]
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
double trkMCTruthT0[kMaxTrack]
PlaneID_t Plane
Index of the plane within its TPC.
double trackgradientXZ[kMaxTrack]
double trketa_xy[kMaxTrack]
double trkendy[kMaxTrack]
double output[kMaxEvent][5][5]
double trkstarty[kMaxTrack]
double trkPosx[kMaxTrack][3][1000]
std::string fMCTruthT0ModuleLabel
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
double trkstartdcosy[kMaxTrack]
void minuitFunctionx(int &nDim, double *gout, double &result, double par[], int flg)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
double trkendz[kMaxTrack]
tracking::Point_t Point_t
double TrackPitchInView(recob::Track const &track, geo::View_t view, size_t trajectory_point=0U)
Returns the projected length of track on a wire pitch step [cm].
double trkpitch[kMaxTrack][3]
double trkstartz[kMaxTrack]
int trigger_offset(DetectorClocksData const &data)
double trktheta[kMaxTrack]
double hit_peakT[kMaxHits]
double trktheta_xz[kMaxTrack]
double trkdQdxAverage[kMaxTrack]
double trkdEdxSum[kMaxTrack]
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
TPCID_t TPC
Index of the TPC within its cryostat.
double trkenddcosz[kMaxTrack]
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
recob::tracking::Plane Plane
std::string fHitsModuleLabel
double trackgradientYZ[kMaxTrack]
double trkstartdcosz[kMaxTrack]
double trkresrg[kMaxTrack][3][1000]
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
double trkx[kMaxTrack][kMaxTrackHits]
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
Event finding and building.
std::vector< double > possiblex
double trkstartdcosx[kMaxTrack]
double trkrange[kMaxTrack][3]
double trkplaneid[kMaxTrack][3][1000]
double trkpitchHit[kMaxTrack][3][1000]