22 bool parameters_pass =
false;
25 double HadronMass = 0.4937;
33 TLorentzVector HadronVec;
34 double HadronPx = flux.ftpx;
35 double HadronPy = flux.ftpy;
36 double HadronPz = flux.ftpz;
37 double HadronE = sqrt(HadronPx*HadronPx +
40 HadronMass*HadronMass);
41 HadronVec.SetPxPyPzE(HadronPx,HadronPy,HadronPz,HadronE);
46 TLorentzVector ProtonVec;
47 double ProtonMass = 0.9382720;
50 double ProtonPz = 8.89;
51 double ProtonE = sqrt(ProtonPx*ProtonPx +
54 ProtonMass*ProtonMass);
55 ProtonVec.SetPxPyPzE(ProtonPx,ProtonPy,ProtonPz,ProtonE);
62 double E_cm = sqrt(2*ProtonMass*ProtonMass + 2*ProtonMass*ProtonVec.E());
64 double gamma = (ProtonE + ProtonMass) / E_cm;
65 double gammaBeta = ProtonVec.P()/E_cm;
67 double MaxThreshold = 2.053;
76 double E_cm_max = (E_cm*E_cm
77 +HadronMass*HadronMass
78 -MaxThreshold*MaxThreshold)/(2*E_cm);
79 double p_cm_max = sqrt(E_cm_max*E_cm_max-HadronMass*HadronMass);
81 double HadronPT = HadronVec.Pt();
82 double HadronPparallel = HadronVec.P()*cos(HadronVec.Theta());
83 double ParallelCMp = gamma*HadronPparallel - gammaBeta*HadronE;
87 xF = ParallelCMp / p_cm_max;
100 double CV = c1*(HadronVec.P()*HadronVec.P()/HadronE)*
exp(-1.*c3*pow(fabs(xF),c4)
101 - c7*pow(fabs(HadronPT*xF),c6)
103 - c5*HadronPT*HadronPT);
106 if(fabs(xF) > 1) CV = 0;
114 double smeared_c1 = FSKPlusFitSmeared.at(0);
115 double smeared_c2 = FSKPlusFitSmeared.at(1);
116 double smeared_c3 = FSKPlusFitSmeared.at(2);
117 double smeared_c4 = FSKPlusFitSmeared.at(3);
118 double smeared_c5 = FSKPlusFitSmeared.at(4);
119 double smeared_c6 = FSKPlusFitSmeared.at(5);
120 double smeared_c7 = FSKPlusFitSmeared.at(6);
127 parameters_pass =
true;
130 double RW = smeared_c1*(HadronVec.P()*HadronVec.P()/HadronE)*
exp(-1.*smeared_c3*pow(fabs(xF),smeared_c4)
131 - smeared_c7*pow(fabs(HadronPT*xF),smeared_c6)
132 - smeared_c2*HadronPT
133 - smeared_c5*HadronPT*HadronPT);
136 if(fabs(xF) > 1) RW = 0;
140 if(RW < 0 || CV < 0){
143 else if(CV < 1.
e-12){
150 if(weight < 0) weight = 0;
151 if(weight > 30) weight = 30;
153 std::cout <<
"FS : Failed to get a finite weight" << std::endl;
156 std::pair<bool, double>
output(parameters_pass, weight);
std::vector< double > FitVal
bool isfinite(Vector const &v)
Returns whether all components of the vector are finite.
BEGIN_PROLOG sequence::SlidingWindowTriggerPatternsOppositeWindows END_PROLOG simSlidingORM6O6 effSlidingORW output
std::vector< std::vector< double > > MultiGaussianSmearing(std::vector< double > const ¢ralValue, std::vector< std::vector< double > > const &inputCovarianceMatrix, int n_multisims, CLHEP::RandGaussQ &GaussRandom)
std::pair< bool, double > PHFSWeightCalc(simb::MCFlux flux, std::vector< float > rand)
BEGIN_PROLOG could also be cout