ATLAS Offline Software
Loading...
Searching...
No Matches
RegSelSiLUT.cxx File Reference
#include "RegSelLUT/RegSelSiLUT.h"
#include "RegSelLUT/RegSelModule.h"
#include "RegSelLUT/RegSelTimer.h"
#include "RegSelLUT/RegSelROB.h"
#include <iostream>
#include <fstream>
#include <set>
Include dependency graph for RegSelSiLUT.cxx:

Go to the source code of this file.

Functions

double phiprime (double x, double y, double phi, double r, bool &status)
bool philimits (double x, double y, double rmin, double rmax, double &phimin, double &phimax)

Function Documentation

◆ philimits()

bool philimits ( double x,
double y,
double rmin,
double rmax,
double & phimin,
double & phimax )

Definition at line 403 of file RegSelSiLUT.cxx.

403 {
404
405 double phi[4];
406
407 bool status = true;
408
409 // std::cout << "phimin=" << phimin << "\tphimax=" << phimax << "\tlimits" << std::endl;
410
411 phi[0] = phiprime(x, y, phimin, rmin, status);
412 phi[1] = phiprime(x, y, phimin, rmax, status);
413
414 phi[2] = phiprime(x, y, phimax, rmin, status);
415 phi[3] = phiprime(x, y, phimax, rmax, status);
416
417 // for ( int i=0 ; i<4 ; i++ ) std::cout << "phi[" << i << "]=" << phi[i] << std::endl;
418
419 if ( status ) {
420
421 // this is needed to take account of the phi=pi boundary, it's not rigorous, but it works
422
423 if ( phi[0]*phi[1]<0 && (phi[0]>0.5*M_PI||phi[1]>0.5*M_PI) ) phimin = ( phi[0]<phi[1] ? phi[1] : phi[0] );
424 else phimin = ( phi[0]<phi[1] ? phi[0] : phi[1] );
425
426 if ( phi[2]*phi[3]<0 && (phi[2]>0.5*M_PI||phi[3]>0.5*M_PI) ) phimax = ( phi[2]>phi[3] ? phi[3] : phi[2] );
427 else phimax = ( phi[2]>phi[3] ? phi[2] : phi[3] );
428
429 }
430
431 // std::cout << "phimin=" << phimin << "\tphimax=" << phimax << "\tlimits (out)" << std::endl;
432
433 return status;
434
435}
#define M_PI
Scalar phi() const
phi method
double phiprime(double x, double y, double phi, double r, bool &status)
#define y
#define x
status
Definition merge.py:16

◆ phiprime()

double phiprime ( double x,
double y,
double phi,
double r,
bool & status )

Definition at line 371 of file RegSelSiLUT.cxx.

371 {
372
373 if ( x*x+y*y>r*r ) {
374 // std::cerr << "duffer x=" << x << "\ty=" << y << "\tr=" << r << std::endl;
375 status = false;
376 return 0;
377 }
378
379 double a = (y*cos(phi)-x*sin(phi))/r;
380
381 // this is bad, getting the return value to issue an error code.
382 // ouch! should maybe define an exception and catch it?
383 // this should never happen
384 if ( fabs(a)>1 ) { status = false; return 0; }
385
386 status &= true;
387
388 double phip = asin(a)+phi;
389
390 // std::cout << "phiprime()\tx=" << x << "\ty=" << y << "\tphi=" << phi << "\tr=" << r << "\tphiprime=" << phip << " before" << std::endl;
391
392 // make sure wrapped between -pi to pi
393 if ( phip>M_PI ) phip = phip-2*M_PI;
394 if ( phip<-M_PI ) phip = phip+2*M_PI;
395
396 // std::cout << "phiprime()\tx=" << x << "\ty=" << y << "\tphi=" << phi << "\tr=" << r << "\tphiprime=" << phip << std::endl;
397
398 return phip;
399
400}
static Double_t a
int r
Definition globals.cxx:22