39 return fire( defaultA, defaultB );
47 return fire( a, b, c );
55 displ = 0.5*gamma*std::tan(rval*CLHEP::halfpi);
62 double val, rval, displ;
64 if ( gamma == 0.0 )
return mean;
65 val = std::atan(2.0*cut/gamma);
67 displ = 0.5*gamma*std::tan(rval*val);
74 double val, rval, displ;
76 if ( gamma == 0.0 )
return mean;
77 val = std::atan(-mean/gamma);
79 displ = gamma*std::tan(rval);
81 return std::sqrt(mean*mean + mean*displ);
87 double lower, upper, tmp;
89 if ( gamma == 0.0 )
return mean;
90 tmp = std::max(0.0,(mean-cut));
91 lower = std::atan( (tmp*tmp-mean*mean)/(mean*gamma) );
92 upper = std::atan( ((mean+cut)*(mean+cut)-mean*mean)/(mean*gamma) );
94 displ = gamma*std::tan(rval);
96 return std::sqrt(std::max(0.0, mean*mean + mean*displ));
101 for(
double* v = vect; v != vect + size; ++v )
102 *v =
shoot( 1.0, 0.2 );
108 for(
double* v = vect; v != vect + size; ++v )
116 for(
double* v = vect; v != vect + size; ++v )
117 *v =
shoot( a, b, c );
123 double mean,
double gamma)
127 rval = 2.0*anEngine->
flat()-1.0;
128 displ = 0.5*gamma*std::tan(rval*CLHEP::halfpi);
134 double mean,
double gamma,
double cut )
136 double val, rval, displ;
138 if ( gamma == 0.0 )
return mean;
139 val = std::atan(2.0*cut/gamma);
140 rval = 2.0*anEngine->
flat()-1.0;
141 displ = 0.5*gamma*std::tan(rval*val);
147 double mean,
double gamma )
149 double val, rval, displ;
151 if ( gamma == 0.0 )
return mean;
152 val = std::atan(-mean/gamma);
154 displ = gamma*std::tan(rval);
156 return std::sqrt(mean*mean + mean*displ);
160 double mean,
double gamma,
double cut )
163 double lower, upper, tmp;
165 if ( gamma == 0.0 )
return mean;
166 tmp = std::max(0.0,(mean-cut));
167 lower = std::atan( (tmp*tmp-mean*mean)/(mean*gamma) );
168 upper = std::atan( ((mean+cut)*(mean+cut)-mean*mean)/(mean*gamma) );
170 displ = gamma*std::tan(rval);
172 return std::sqrt( std::max(0.0, mean*mean+mean*displ) );
176 const int size,
double* vect )
178 for(
double* v = vect; v != vect + size; ++v )
179 *v =
shoot( anEngine, 1.0, 0.2 );
183 const int size,
double* vect,
186 for(
double* v = vect; v != vect + size; ++v )
187 *v =
shoot( anEngine, a, b );
191 const int size,
double* vect,
192 double a,
double b,
double c )
194 for(
double* v = vect; v != vect + size; ++v )
195 *v =
shoot( anEngine, a, b, c );
202 return fire( defaultA, defaultB );
209 rval = 2.0*localEngine->flat()-1.0;
210 displ = 0.5*gamma*std::tan(rval*CLHEP::halfpi);
217 double val, rval, displ;
219 if ( gamma == 0.0 )
return mean;
220 val = std::atan(2.0*cut/gamma);
221 rval = 2.0*localEngine->flat()-1.0;
222 displ = 0.5*gamma*std::tan(rval*val);
229 return fireM2( defaultA, defaultB );
234 double val, rval, displ;
236 if ( gamma == 0.0 )
return mean;
237 val = std::atan(-mean/gamma);
239 displ = gamma*std::tan(rval);
241 return std::sqrt(mean*mean + mean*displ);
247 double lower, upper, tmp;
249 if ( gamma == 0.0 )
return mean;
250 tmp = std::max(0.0,(mean-cut));
251 lower = std::atan( (tmp*tmp-mean*mean)/(mean*gamma) );
252 upper = std::atan( ((mean+cut)*(mean+cut)-mean*mean)/(mean*gamma) );
254 displ = gamma*std::tan(rval);
256 return std::sqrt(std::max(0.0, mean*mean + mean*displ));
261 for(
double* v = vect; v != vect + size; ++v )
262 *v =
fire(defaultA, defaultB );
268 for(
double* v = vect; v != vect + size; ++v )
273 double a,
double b,
double c )
275 for(
double* v = vect; v != vect + size; ++v )
276 *v =
fire( a, b, c );
281 long pr=os.precision(20);
282 std::vector<unsigned long> t(2);
283 os <<
" " <<
name() <<
"\n";
284 os <<
"Uvec" <<
"\n";
286 os << defaultA <<
" " << t[0] <<
" " << t[1] <<
"\n";
288 os << defaultB <<
" " << t[0] <<
" " << t[1] <<
"\n";
296 if (inName !=
name()) {
297 is.clear(std::ios::badbit | is.rdstate());
298 std::cerr <<
"Mismatch when expecting to read state of a "
299 <<
name() <<
" distribution\n"
300 <<
"Name found was " << inName
301 <<
"\nistream is left in the badbit state\n";
305 std::vector<unsigned long> t(2);
static double longs2double(const std::vector< unsigned long > &v)
static std::vector< unsigned long > dto2longs(double d)
static HepRandomEngine * getTheEngine()
HepRandomEngine & engine()
static double shootM2(double a=1.0, double b=0.2)
static void shootArray(const int size, double *vect)
std::istream & get(std::istream &is)
virtual ~RandBreitWigner()
static double shoot(double a=1.0, double b=0.2)
std::ostream & put(std::ostream &os) const
void fireArray(const int size, double *vect)
bool possibleKeywordInput(IS &is, const std::string &key, T &t)