37 return fire( defaultA, defaultB );
45 return fire( a, b, c );
53 displ = 0.5*gamma*std::tan(rval*CLHEP::halfpi);
60 double val, rval, displ;
62 if ( gamma == 0.0 )
return mean;
63 val = std::atan(2.0*cut/gamma);
65 displ = 0.5*gamma*std::tan(rval*val);
72 double val, rval, displ;
74 if ( gamma == 0.0 )
return mean;
75 val = std::atan(-mean/gamma);
77 displ = gamma*std::tan(rval);
79 return std::sqrt(mean*mean + mean*displ);
85 double lower, upper, tmp;
87 if ( gamma == 0.0 )
return mean;
88 tmp = std::max(0.0,(mean-cut));
89 lower = std::atan( (tmp*tmp-mean*mean)/(mean*gamma) );
90 upper = std::atan( ((mean+cut)*(mean+cut)-mean*mean)/(mean*gamma) );
92 displ = gamma*std::tan(rval);
94 return std::sqrt(std::max(0.0, mean*mean + mean*displ));
99 for(
double* v = vect; v != vect + size; ++v )
100 *v =
shoot( 1.0, 0.2 );
106 for(
double* v = vect; v != vect + size; ++v )
114 for(
double* v = vect; v != vect + size; ++v )
115 *v =
shoot( a, b, c );
121 double mean,
double gamma)
125 rval = 2.0*anEngine->
flat()-1.0;
126 displ = 0.5*gamma*std::tan(rval*CLHEP::halfpi);
132 double mean,
double gamma,
double cut )
134 double val, rval, displ;
136 if ( gamma == 0.0 )
return mean;
137 val = std::atan(2.0*cut/gamma);
138 rval = 2.0*anEngine->
flat()-1.0;
139 displ = 0.5*gamma*std::tan(rval*val);
145 double mean,
double gamma )
147 double val, rval, displ;
149 if ( gamma == 0.0 )
return mean;
150 val = std::atan(-mean/gamma);
152 displ = gamma*std::tan(rval);
154 return std::sqrt(mean*mean + mean*displ);
158 double mean,
double gamma,
double cut )
161 double lower, upper, tmp;
163 if ( gamma == 0.0 )
return mean;
164 tmp = std::max(0.0,(mean-cut));
165 lower = std::atan( (tmp*tmp-mean*mean)/(mean*gamma) );
166 upper = std::atan( ((mean+cut)*(mean+cut)-mean*mean)/(mean*gamma) );
168 displ = gamma*std::tan(rval);
170 return std::sqrt( std::max(0.0, mean*mean+mean*displ) );
174 const int size,
double* vect )
176 for(
double* v = vect; v != vect + size; ++v )
177 *v =
shoot( anEngine, 1.0, 0.2 );
181 const int size,
double* vect,
184 for(
double* v = vect; v != vect + size; ++v )
185 *v =
shoot( anEngine, a, b );
189 const int size,
double* vect,
190 double a,
double b,
double c )
192 for(
double* v = vect; v != vect + size; ++v )
193 *v =
shoot( anEngine, a, b, c );
200 return fire( defaultA, defaultB );
207 rval = 2.0*localEngine->flat()-1.0;
208 displ = 0.5*gamma*std::tan(rval*CLHEP::halfpi);
215 double val, rval, displ;
217 if ( gamma == 0.0 )
return mean;
218 val = std::atan(2.0*cut/gamma);
219 rval = 2.0*localEngine->flat()-1.0;
220 displ = 0.5*gamma*std::tan(rval*val);
227 return fireM2( defaultA, defaultB );
232 double val, rval, displ;
234 if ( gamma == 0.0 )
return mean;
235 val = std::atan(-mean/gamma);
237 displ = gamma*std::tan(rval);
239 return std::sqrt(mean*mean + mean*displ);
245 double lower, upper, tmp;
247 if ( gamma == 0.0 )
return mean;
248 tmp = std::max(0.0,(mean-cut));
249 lower = std::atan( (tmp*tmp-mean*mean)/(mean*gamma) );
250 upper = std::atan( ((mean+cut)*(mean+cut)-mean*mean)/(mean*gamma) );
252 displ = gamma*std::tan(rval);
254 return std::sqrt(std::max(0.0, mean*mean + mean*displ));
259 for(
double* v = vect; v != vect + size; ++v )
260 *v =
fire(defaultA, defaultB );
266 for(
double* v = vect; v != vect + size; ++v )
271 double a,
double b,
double c )
273 for(
double* v = vect; v != vect + size; ++v )
274 *v =
fire( a, b, c );
279 int pr=os.precision(20);
280 std::vector<unsigned long> t(2);
281 os <<
" " <<
name() <<
"\n";
282 os <<
"Uvec" <<
"\n";
284 os << defaultA <<
" " << t[0] <<
" " << t[1] <<
"\n";
286 os << defaultB <<
" " << t[0] <<
" " << t[1] <<
"\n";
294 if (inName !=
name()) {
295 is.clear(std::ios::badbit | is.rdstate());
296 std::cerr <<
"Mismatch when expecting to read state of a "
297 <<
name() <<
" distribution\n"
298 <<
"Name found was " << inName
299 <<
"\nistream is left in the badbit state\n";
303 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)