9 #include <trackbase/TrkrDefUtil.h>
13 #include <mvtxprototype1/MvtxStandaloneTracking.h>
27 #include <TLorentzVector.h>
32 #include <TDecompSVD.h>
42 #define LogDebug(exp) std::cout<<"DEBUG: " <<__FILE__<<": "<<__LINE__<<": "<< exp <<"\n"
43 #define LogError(exp) std::cout<<"ERROR: " <<__FILE__<<": "<<__LINE__<<": "<< exp <<"\n"
44 #define LogWarning(exp) std::cout<<"WARNING: " <<__FILE__<<": "<<__LINE__<<": "<< exp <<"\n"
57 for (
int il = 0; il < 4; il++)
80 hlayer =
new TH1D(
"hlayer",
";layer", 6, -0.5, 5.5);
82 for (
int il = 0; il < 4; il++)
84 hsize[il] =
new TH1D(Form(
"hsize_l%i", il),
85 ";cluster size total [pixels]",
88 hsize_phi[il] =
new TH1D(Form(
"hsize_phi_l%i", il),
89 ";cluster size #phi [pixels]",
92 hsize_z[il] =
new TH1D(Form(
"hsize_z_l%i", il),
93 ";cluster size z [pixels]",
96 hxz[il] =
new TH2D(Form(
"hxz_l%i", il),
101 hdx[il] =
new TH1D(Form(
"hdx_l%i", il),
105 hdz[il] =
new TH1D(Form(
"hdz_l%i", il),
111 htrk =
new TH1D(
"htrk",
";trks / event", 16, -0.5, 15.5);
112 htrk_cut =
new TH1D(
"htrk_cut",
";trks / event", 16, -0.5, 15.5);
114 for (
int il = 0; il < 4; il++)
116 htrk_dx[il] =
new TH1D(Form(
"htrk_dx_l%i", il),
117 ";track dx [pixels]",
120 htrk_dz[il] =
new TH1D(Form(
"htrk_dz_l%i", il),
121 ";track dz [pixels]",
124 htrk_cut_dx[il] =
new TH1D(Form(
"htrk_cut_dx_l%i", il),
125 ";track dx [pixels]",
128 htrk_cut_dz[il] =
new TH1D(Form(
"htrk_cut_dz_l%i", il),
129 ";track dz [pixels]",
134 ";track chi2/ndf in x vs y",
137 ";track chi2/ndf in z vs y",
141 ";track chi2/ndf in x vs y",
144 ";track chi2/ndf in z vs y",
166 std::cout <<
"AnaMvtxPrototype1::process_event()" << std::endl;
180 std::cout <<
"-- evnt:" <<
_ievent << std::endl;
194 std::cout <<
"-- Looping over clusters" << std::endl;
198 TrkrDefUtil trkrutil;
202 iter != clusrange.second;
210 int lyr = trkrutil.GetLayer(ckey);
214 if (lyr < 0 || lyr > 3)
216 hsize[lyr]->Fill(clus->GetAdc());
217 hsize_phi[lyr]->Fill(clus->GetPhiSize());
218 hsize_z[lyr]->Fill(clus->GetZSize());
219 hxz[lyr]->Fill(clus->GetZ(), clus->GetX());
222 _mmap_lyr_clus.insert(std::make_pair(lyr, clus));
226 std::cout <<
"-- _mmap_lyr_clus.size():" << _mmap_lyr_clus.size() << std::endl;
233 std::cout <<
"-- Performing simple tracking" << std::endl;
235 static bool check_range =
true;
241 std::cout <<
PHWHERE <<
" Mvtx key range: 0x" << std::hex << mvtxl <<
" - 0x" << mvtxh << std::dec << std::endl;
243 for (
int i = 0;
i < 4;
i++)
248 std::cout <<
PHWHERE <<
" Mvtx key range lyr " <<
i <<
": 0x" << std::hex << lyrl <<
" - 0x" << lyrh << std::dec << std::endl;
258 lyr0_itr != lyr0range.second;
265 std::cout <<
"WARNING: clus0 not found" << std::endl;
270 int lyr = trkrutil.GetLayer(clus0->GetClusKey());
273 std::cout <<
PHWHERE <<
"ERRORL: Expected clusters from layer 0 only. Found lyr=" << lyr << std::endl;
281 double x0 = misiter !=
_misalign.end() ? clus0->GetX() + (misiter->second).dx : clus0->GetX();
282 double y0 = misiter !=
_misalign.end() ? clus0->GetY() + (misiter->second).
dy : clus0->GetY();
283 double z0 = misiter !=
_misalign.end() ? clus0->GetZ() + (misiter->second).
dz : clus0->GetZ();
287 std::cout <<
"-- clus0:(" << x0 <<
", " << y0 <<
", " << z0 <<
")" << std::endl;
293 lyr3_itr != lyr3range.second;
300 std::cout <<
"WARNING: clus3 not found" << std::endl;
306 double x3 = misiter !=
_misalign.end() ? clus3->GetX() + (misiter->second).dx : clus3->GetX();
307 double y3 = misiter !=
_misalign.end() ? clus3->GetY() + (misiter->second).
dy : clus3->GetY();
308 double z3 = misiter !=
_misalign.end() ? clus3->GetZ() + (misiter->second).
dz : clus3->GetZ();
322 std::cout <<
"-- clus3:(" << x3 <<
", " << y3 <<
", " << z3 <<
")" << std::endl;
323 std::cout <<
"-- mpr:" << mpr <<
" bpr:" << bpr << std::endl;
324 std::cout <<
"-- mzr:" << mzr <<
" bzr:" << bzr << std::endl;
330 for (
int ilyr = 1; ilyr <= 2; ilyr++)
334 lyr_itr != lyrrange.second;
344 double x = misiter !=
_misalign.end() ? clus->GetX() + (misiter->second).dx : clus->GetX();
345 double y = misiter !=
_misalign.end() ? clus->GetY() + (misiter->second).
dy : clus->GetY();
346 double z = misiter !=
_misalign.end() ? clus->GetZ() + (misiter->second).
dz : clus->GetZ();
354 double dx = (x_proj -
x);
355 double dz = (z_proj -
z);
357 if ( !
hdx[ilyr] || !
hdz[ilyr] )
359 std::cout <<
"WARNING!! can't find hdphi or hdz for lyr:" << ilyr << std::endl;
369 std::cout <<
"------------------" << std::endl;
370 std::cout <<
"-- clus" << trkrutil.GetLayer(clus->GetClusKey()) <<
":(" << x3 <<
", " << y3 <<
", " << z3 <<
")" << std::endl;
371 std::cout <<
"-- proj:(" << x_proj <<
", " << z_proj <<
")" << std::endl;
372 std::cout <<
"-- dx [pixels]: " << dx << std::endl;
373 std::cout <<
"-- dz [pixels]: " << dz << std::endl;
374 std::cout <<
"------------------" << std::endl;
504 std::cout <<
"-- Done simple tracking" << std::endl;
530 std::vector<int> uselayers;
531 uselayers.push_back(0);
532 uselayers.push_back(1);
533 uselayers.push_back(2);
534 uselayers.push_back(3);
538 htrk->Fill(tracklist.size());
541 for (
unsigned int i = 0;
i < tracklist.size();
i++)
547 if ( tracklist.at(
i).chi2_xy < 5 && tracklist.at(
i).chi2_zy < 5)
554 for (
unsigned int j = 0;
j < tracklist.at(
i).ClusterList.size();
j++)
558 int lyr = trkrutil.GetLayer(ckey);
560 if ( lyr < 0 || lyr >= 4 )
562 std::cout <<
PHWHERE <<
" WARNING: bad layer from track cluster. lyr:" << lyr << std::endl;
566 htrk_dx[lyr]->Fill(tracklist.at(
i).dx.at(
j));
567 htrk_dz[lyr]->Fill(tracklist.at(
i).dz.at(
j));
569 if ( tracklist.at(
i).chi2_xy < 5 && tracklist.at(
i).chi2_zy < 5)
607 clusters_ = findNode::getClass<TrkrClusterContainer>(topNode,
"TrkrClusterContainer");
610 std::cout <<
PHWHERE <<
" TrkrClusterContainer node not found on node tree"
625 return (y1 - y0) / (x1 -
x0);
657 _misalign.insert( std::make_pair(lyr, align) );
672 iter != clusrange.second;
746 std::cout <<
"================================" << std::endl;
747 std::cout <<
"== " <<
PHWHERE << std::endl;
751 std::cout <<
"== Lyr: " << iter->first
752 <<
" dx[cm]:" << (iter->second).dx
753 <<
" dy[cm]:" << (iter->second).dy
754 <<
" dz[cm]:" << (iter->second).
dz
758 std::cout <<
"================================" << std::endl;