26 if (fVerbose > 1) cout <<
"=========================== Vertex finder init started ====================" << endl;
31 FairRootManager* ioman = FairRootManager::Instance();
32 if (NULL == ioman) Fatal(
"Init",
"FairRootManager is not instantiated");
34 fGlobalTracksArray = (TClonesArray*)ioman->GetObject(fGlobalTracksBranchName);
35 if (!fGlobalTracksArray) {
36 cout <<
"BmnVertexFinder::Init(): branch " << fGlobalTracksBranchName <<
" not found! Task will be deactivated" << endl;
41 fVertexArray =
new TClonesArray(
"BmnVertex", 1);
42 ioman->Register(fVertexBranchName,
"GEM", fVertexArray, kTRUE);
44 if (fVerbose > 1) cout <<
"=========================== Vertex finder init finished ===================" << endl;
72 const Double_t kRange = (fPeriodId == 8) ? 200.0 : 50.0;
73 const Double_t xVertMin = (fPeriodId == 8) ? -10.0 : -0.5;
74 const Double_t xVertMax = (fPeriodId == 8) ? +10.0 : +2.0;
75 const Double_t yVertMin = (fPeriodId == 8) ? -10.0 : -5.0;
76 const Double_t yVertMax = (fPeriodId == 8) ? +10.0 : -2.5;
77 Double_t roughVertexZ = (fPeriodId == 8) ? 0.0 : -1.0;
80 for (Int_t iTr = 0; iTr < tracks->GetEntriesFast(); ++iTr) {
87 if (par0.GetX() > xVertMin && par0.GetX() < xVertMax && par0.GetY() > yVertMin && par0.GetY() < yVertMax) {
100 if (Abs(vz - roughVertexZ) > kRange) {
101 for (Int_t iTr = 0; iTr < tracks->GetEntriesFast(); ++iTr) {
108 vector<Double_t> xHits;
109 vector<Double_t> yHits;
110 vector<Int_t> indexes;
111 for (Int_t iTr = 0; iTr < tracks->GetEntriesFast(); ++iTr) {
113 if (track->
GetFlag() != 0)
continue;
118 xHits.push_back(par0.GetX());
119 yHits.push_back(par0.GetY());
120 indexes.push_back(iTr);
123 Double_t vx = Mean(xHits.begin(), xHits.end());
124 Double_t vy = Mean(yHits.begin(), yHits.end());
126 Double_t rRMS = CalcRms2D(xHits, yHits);
128 return BmnVertex(vx, vy, vz, rRMS, 0, xHits.size(), TMatrixFSym(3), -1, vector<Int_t>());
133 Double_t roughVertexZ = (fPeriodId == 8) ? 0.0 : (fPeriodId == 7) ? -1.0 : (fPeriodId == 6) ? -21.9 : 0.0;
134 const Double_t kRange = 300.0;
138 for (Int_t iTr = 0; iTr < tracks->GetEntriesFast(); ++iTr) {
140 if (track->
GetFlag() == 1) nSec++;
149 vector<Double_t> xHits;
150 vector<Double_t> yHits;
151 vector<Int_t> indexes;
152 for (Int_t iTr = 0; iTr < tracks->GetEntriesFast(); ++iTr) {
154 if (track->
GetFlag() != 1)
continue;
159 xHits.push_back(par0.GetX());
160 yHits.push_back(par0.GetY());
161 indexes.push_back(iTr);
164 Double_t vx = Mean(xHits.begin(), xHits.end());
165 Double_t vy = Mean(yHits.begin(), yHits.end());
167 Double_t rRMS = CalcRms2D(xHits, yHits);
169 return BmnVertex(vx, vy, vz, rRMS, 0, xHits.size(), TMatrixFSym(3), -1, vector<Int_t>());
173 const Int_t nPlanes = 3;
176 while (range >= 0.01) {
177 Float_t zMax = minZ + range;
178 Float_t zMin = minZ - range;
179 Float_t zStep = (zMax - zMin) / (nPlanes - 1);
181 vector<Double_t> xHits[nPlanes];
182 vector<Double_t> yHits[nPlanes];
183 Float_t zPlane[nPlanes];
184 Float_t rRMS[nPlanes] = {0};
186 for (Int_t iPlane = 0; iPlane < nPlanes; ++iPlane)
187 zPlane[iPlane] = zMax - iPlane * zStep;
191 for (Int_t iTr = 0; iTr < tracks->GetEntriesFast(); ++iTr) {
193 if (track->
GetFlag() != flag)
continue;
196 Double_t xTr[nPlanes];
197 Double_t yTr[nPlanes];
199 for (Int_t iPlane = 0; iPlane < nPlanes; ++iPlane) {
207 xTr[iPlane] = par0.GetX();
208 yTr[iPlane] = par0.GetY();
215 for (Int_t iPlane = 0; iPlane < nPlanes; ++iPlane) {
216 xHits[iPlane].push_back(xTr[iPlane]);
217 yHits[iPlane].push_back(yTr[iPlane]);
222 if (nOkTr < 2)
return -1000.0;
236 for (Int_t iPlane = 0; iPlane < nPlanes; ++iPlane) {
237 rRMS[iPlane] = CalcMeanDist(xHits[iPlane], yHits[iPlane]);
239 TGraph* vertex =
new TGraph(nPlanes, zPlane, rRMS);
240 TFitResultPtr ptr = vertex->Fit(
"pol2",
"QFS");
241 Float_t b = ptr->Parameter(1);
242 Float_t a = ptr->Parameter(2);