TimeImpl Class Reference

List of all members.

Public Member Functions

 TimeImpl (int n, G4double t[], G4double b[], G4double e[]=0)
void setPeriod (G4double v)
G4double factorB (G4double t)
G4double factorE (G4double t)

Static Public Member Functions

static TimeImplreadTime (InputFile &in, MyBLArgumentVector argv, MyBLArgumentMap namedArgs)

Private Attributes

BTSpline1D B
BTSpline1D E
G4double tMin
G4double tMax
G4double period

Detailed Description

class TimeImpl -- class implementation of a time dependence.

Definition at line 177 of file MyBLFieldMap.cc.


Constructor & Destructor Documentation

TimeImpl::TimeImpl ( int  n,
G4double  t[],
G4double  b[],
G4double  e[] = 0 
) [inline]

Constructor. n is # points in the arrays, t[] is the list of time values (ns), b[] and e[] are the factors for B field and E field. t[], b[], and e[] are copied so the caller can delete them after calling this routine.

Definition at line 189 of file MyBLFieldMap.cc.

References period, tMax, and tMin.

Referenced by readTime().

00189                                                                     :
00190         B(n,t,b), E(n,t,(e?e:b)) {
00191             tMin = t[0];
00192             tMax = t[n-1];
00193             period = -1.0;
00194         }
        void setPeriod(G4double v) { period = v; }


Member Function Documentation

G4double TimeImpl::factorB ( G4double  t  )  [inline]

Definition at line 196 of file MyBLFieldMap.cc.

References B, period, tMax, and tMin.

Referenced by MyBLFieldMap::getFieldValue(), and MyBLFieldMap::getTimeFactor().

00196                                      {
00197             if(period > 0.0) {
00198                 t -= floor(t/period)*period;
00199             }
00200             else {
00201                 if(t < tMin) t = tMin;
00202                 if(t > tMax) t = tMax;
00203             }
00204             return B(t);
00205         }

G4double TimeImpl::factorE ( G4double  t  )  [inline]

Definition at line 206 of file MyBLFieldMap.cc.

References E, period, tMax, and tMin.

Referenced by MyBLFieldMap::getFieldValue(), and MyBLFieldMap::getTimeFactor().

00206                                      {
00207             if(period > 0.0) {
00208                 t -= floor(t/period)*period;
00209             }
00210             else {
00211                 if(t < tMin) t = tMin;
00212                 if(t > tMax) t = tMax;
00213             }
00214             return E(t);
00215         }

TimeImpl * TimeImpl::readTime ( InputFile in,
MyBLArgumentVector  argv,
MyBLArgumentMap  namedArgs 
) [static]

Definition at line 379 of file MyBLFieldMap.cc.

References argDouble(), B, E, InputFile::getline(), period, InputFile::repeatLine(), setPeriod(), and TimeImpl().

Referenced by MyBLFieldMap::readFile().

00380                            {
00381     G4double period=-1.0;
00382     argDouble(period,"period",namedArgs);
00383 
00384     std::vector<G4double> T;
00385     std::vector<G4double> B;
00386     std::vector<G4double> E;
00387 
00388     char *line;
00389     while((line=in.getline()) != 0) {
00390         if(isalpha(line[0])) {
00391             in.repeatLine();
00392             break;
00393         }
00394         G4double t,b,e;
00395         int j = sscanf(line,"%lf%lf%lf",&t,&b,&e);
00396         if(j < 2 || j > 3) return 0;
00397         if(j == 2) e = b;
00398         T.push_back(t);
00399         B.push_back(b);
00400         E.push_back(e);
00401     }
00402 
00403     if(T.size() > 0) {
00404         TimeImpl *impl =
00405             new TimeImpl(T.size(),&T[0],&B[0],&E[0]);
00406         impl->setPeriod(period);
00407         return impl;
00408     }
00409 
00410     return 0;
00411 }

void TimeImpl::setPeriod ( G4double  v  )  [inline]

Definition at line 195 of file MyBLFieldMap.cc.

References period.

Referenced by MyBLFieldMap::createTimeDependence(), and readTime().

00195 { period = v; }


Member Data Documentation

Definition at line 178 of file MyBLFieldMap.cc.

Referenced by factorB(), and readTime().

Definition at line 179 of file MyBLFieldMap.cc.

Referenced by factorE(), and readTime().

G4double TimeImpl::period [private]

Definition at line 182 of file MyBLFieldMap.cc.

Referenced by factorB(), factorE(), readTime(), setPeriod(), and TimeImpl().

G4double TimeImpl::tMax [private]

Definition at line 181 of file MyBLFieldMap.cc.

Referenced by factorB(), factorE(), and TimeImpl().

G4double TimeImpl::tMin [private]

Definition at line 180 of file MyBLFieldMap.cc.

Referenced by factorB(), factorE(), and TimeImpl().


The documentation for this class was generated from the following file:

Generated on 15 Jun 2016 for g4sim by  doxygen 1.6.1