22 #include "hcategory.h"
25 #include "hiterator.h"
40 #define PR(x) std::cout << "++DEBUG: " << #x << " = |" << x << "| (" << __FILE__ << ", " << __LINE__ << ")\n";
41 #define PRh(x) std::cout << "++DEBUG: " << #x << " = hex |" << std::hex << x << std::dec << "| (" << __FILE__ << ", " << __LINE__ << ")\n";
61 memset(corrs, 0, 2*
sizeof(Double_t));
71 memset(
corrs, 0, 2*
sizeof(Double_t));
170 inputpos.open(
"trackdetpos-g05x-g05y.txt");
195 Float_t mom_offset = - corrs[1];
215 for (Int_t isol = 1; isol < 4; ++isol)
217 yyy1 = a_3 *sol * sol * sol + a_2 * sol *sol + a_1 * sol + a_0;
218 yyp1 = 3.* a_3 * sol * sol + 2. * a_2 * sol + a_1;
219 sol = sol - yyy1 / yyp1;
222 Double_t alfa = 0, beta = 0, gamma = 0, deter = 0, xdetc1 = 0, xdetc2 = 0,alfap = 0,betap = 0, gammap = 0, sol1 = 0,theta1 = 0, yci1 = 0,
phi1 = 0, x_0 = 0;
238 deter = alfa*betap-alfap*beta;
240 phi = (alfa*gammap-gamma*alfap)/deter;
253 a_0 = xdetc2 * T12[
idet1] - xdetc1 * T12[
idet2];
257 for (Int_t isol = 1; isol < 4; ++isol)
259 yyy1 = a_3 * sol1 * sol1 * sol1 + a_2 * sol1 * sol1 + a_1 * sol1 + a_0;
260 yyp1 = 3.* a_3 * sol1 * sol1 + 2. * a_2 * sol1 + a_1;
261 sol1 = sol1-yyy1/yyp1;
280 deter = alfa * betap -alfap * beta;
281 yci1 = (gamma * betap - beta * gammap)/deter;
282 phi1 = (alfa * gammap - gamma * alfap)/deter;
298 tr.
fTheta = Theta_hades/1000.;
299 tr.
fPhi = Phi_hades/1000.;
304 tr.
fP = momref * (1. + sol1/100. )+mom_offset;
311 Float_t RecMom = momref * (1. + sol1/100. )+mom_offset;
312 Float_t MaxMom = mom_maxt;
314 tr.
fDist = sqrt(yy_weight*pow((-yy_slope * y1 + y2 - yy_offset)/sqrt(pow(yy_slope,2) + 1.0),2) + mom_weight * pow((MaxMom - RecMom),2));
339 Error (
"init",
"No PionTracker found.");
348 Error (
"init",
"Could not retrieve HPionTrackerBeamPar!");
356 Error (
"init()",
"HPionTrackerhit category not available!");
365 Error (
"init",
"Could not retrieve HPionTrackerMomPar!");
371 Error (
"init",
"Could not retrieve HPionTrackerBeamRunPar!");
397 if(edet1&&edet2&&eoutQ9&&etarg){
475 Error (
"reinit",
"Could not retrieve beam elements from HPionTrackerBeamPar!");
479 }
else return kFALSE;
485 memset(
corrs, 0, 2*
sizeof(Double_t));
489 Error (
"reinit",
"Could not retrieve params from HPionTrackerMomRunPar!");
507 Float_t x1, x2, y1, y2, z1, z2;
513 std::vector<track> trackcan;
558 pHit1->getLabPos(x2,y2,z2);
564 scanpos >> x_l >> x_u >> y_l >> y_u ;
568 if(x1<x_l||x1>x_u||y1<y_l||y1>y_u)
continue;
576 if (
nev > 10000) success =
false;
577 cout <<
"Positions from file : " << endl;
578 cout << x1 <<
" " << x2 <<
" " <<
nev << endl;
580 if (!success)
return 0;
583 trackcan.push_back(tr);
594 trackcan[0].fP = trackcan[0].fP + eloss_corr;
596 for (UInt_t t = 0; t < trackcan.size(); ++t)
HPionTrackerMomRunPar * pTrackerMomRunpar
HRuntimeDb * getRuntimeDb(void)
HEvent *& getCurrentEvent(void)
void getLabPos(Float_t &, Float_t &, Float_t &) const
Bool_t momrec(Float_t x1, Float_t y1, Float_t x2, Float_t y2, Float_t momref, track &tr)
HPionTrackerBeamPar * pTrackBeampar
HRun * getCurrentRun(void)
Float_t getRefMom() const
static bool sortfunction(const track tr1, const track tr2)
Bool_t getRun(Int_t runID, HPionTrackerMomRunPars *data)
HBeamElement * getBeamElement(UInt_t id)
HSpectrometer * getSetup(void)
HDetector * getDetector(const Char_t *name)
Float_t getYYSlope() const
HPionTrackerTrackFPar * pTrackfpar
HPionTrackerMomRunPars correction
HPionTrackerMomPar * pTrackerMompar
Int_t getYYWeight() const
HParSet * getContainer(const Text_t *)
Int_t getMomWeight() const
Float_t getElossCorr() const
const Cat_t catPionTrackerHit
HCategory * buildCategory(Cat_t)
std::ifstream inputpos
EVENT COUNTER FOR FILE.
Float_t getYYOffset() const
ClassImp(HPionTrackerTrackF) HPionTrackerTrackF
Int_t getTrackingFlag() const
virtual HCategory * getCategory(Cat_t aCat)=0
const Cat_t catPionTrackerTrack
void setPosAll(Float_t, Float_t, Float_t, Float_t, Float_t, Float_t)
void setPThetaPhi(Float_t p, Float_t theta, Float_t phi, Float_t match)
void insertTrack(const track &tr)
void setProdAngles(Float_t, Float_t)
~HPionTrackerTrackF(void)