BLCMDprofile::Entry Struct Reference

Inheritance diagram for BLCMDprofile::Entry:

BLManager::ZSteppingAction

List of all members.

Public Member Functions

 Entry (G4double zpos, G4String &req, G4ParticleDefinition *pd, BLCoordinateType _coordinateType)
void UserZSteppingAction (const G4Track *track)

Public Attributes

G4double z
G4String require
G4double sumX
G4double sumY
G4double sumPx
G4double sumPy
G4double sumPz
G4double sumPtot
G4double sumW
G4int n
BLEvaluator eval
G4double ** M
G4double * Mrow [4]
G4ParticleDefinition * particle
BLCoordinateType coordinateType


Constructor & Destructor Documentation

BLCMDprofile::Entry::Entry ( G4double  zpos,
G4String &  req,
G4ParticleDefinition *  pd,
BLCoordinateType  _coordinateType 
) [inline]

References coordinateType, M, Mrow, n, particle, sumPtot, sumPx, sumPy, sumPz, sumW, sumX, sumY, and z.

00047                                                                   :
00048                                                         require(req), eval()
00049                         { z=zpos; sumX=sumY=sumPx=sumPy=sumPz=sumPtot=sumW=0.0; n=0;
00050                           M=new double*[4]; Mrow[0]=new double[4]; Mrow[1]=new double[4];
00051                           Mrow[2]=new double[4]; Mrow[3]=new double[4];
00052                           M[0]=Mrow[0]; M[1]=Mrow[1]; M[2]=Mrow[2]; M[3]=Mrow[3];
00053                           for(int i=0; i<4; ++i) for(int j=0; j<4; ++j) M[i][j]=0.0;
00054                           particle = pd;
00055                           coordinateType = _coordinateType;
00056                         }
                void UserZSteppingAction(const G4Track *track);


Member Function Documentation

void BLCMDprofile::Entry::UserZSteppingAction ( const G4Track *  track  )  [virtual]

Implements BLManager::ZSteppingAction.

References BEAM, BLCOORD_REFERENCE, coordinateType, eval, BLEvaluator::evaluate(), BLCoordinates::getCoords(), BLManager::getObject(), BLCoordinates::getRotation(), BLManager::getState(), BLEvaluator::isOK(), BLCoordinates::isValid(), M, n, particle, BLCommand::printError(), require, BLEvaluator::setTrackVariables(), sumPtot, sumPx, sumPy, sumPz, sumW, sumX, and sumY.

00202 {
00203         // only use reference coordinates when they are valid
00204         BLManagerState state = BLManager::getObject()->getState();
00205         if(coordinateType == BLCOORD_REFERENCE && state != BEAM) return;
00206 
00207         if(track->GetDefinition() != particle) {
00208                 return;
00209         }
00210 
00211         if(require.size() != 0) {
00212                 eval.setTrackVariables(track,coordinateType); 
00213                 double v = eval.evaluate(require);
00214                 if(!eval.isOK()) {
00215                     BLCommand::printError("profile: invalid expression '%s'\n",
00216                                         require.c_str());
00217                     require = "0";
00218                     return;
00219                 }
00220                 if(v == 0.0)
00221                         return;
00222         }
00223 
00224         G4double pos[4];
00225         G4ThreeVector momentum;
00226         G4double w=track->GetWeight();
00227         BLCoordinates *coord = (BLCoordinates*)track->GetUserInformation();
00228         if(!coord || !coord->isValid()) return;
00229         momentum = track->GetMomentum();
00230         coord->getCoords(coordinateType,pos);
00231         momentum = coord->getRotation() * momentum;
00232         sumW += w;
00233         sumX += w*pos[0];
00234         sumY += w*pos[1];
00235         sumPx += w*momentum[0];
00236         sumPy += w*momentum[1];
00237         sumPz += w*momentum[2];
00238         sumPtot += w*momentum.mag();
00239         M[0][0] += w*pos[0]*pos[0];
00240         M[0][1] += w*pos[0]*momentum[0];
00241         M[0][2] += w*pos[0]*pos[1];
00242         M[0][3] += w*pos[0]*momentum[1];
00243         M[1][0] += w*momentum[0]*pos[0];
00244         M[1][1] += w*momentum[0]*momentum[0];
00245         M[1][2] += w*momentum[0]*pos[1];
00246         M[1][3] += w*momentum[0]*momentum[1];
00247         M[2][0] += w*pos[1]*pos[0];
00248         M[2][1] += w*pos[1]*momentum[0];
00249         M[2][2] += w*pos[1]*pos[1];
00250         M[2][3] += w*pos[1]*momentum[1];
00251         M[3][0] += w*momentum[1]*pos[0];
00252         M[3][1] += w*momentum[1]*momentum[0];
00253         M[3][2] += w*momentum[1]*pos[1];
00254         M[3][3] += w*momentum[1]*momentum[1];
00255         ++n;
00256 }


Member Data Documentation

Referenced by Entry().

Referenced by UserZSteppingAction().

Referenced by Entry(), and UserZSteppingAction().

Referenced by Entry(), and UserZSteppingAction().

Referenced by Entry(), and UserZSteppingAction().

Referenced by Entry(), and UserZSteppingAction().

Referenced by Entry(), and UserZSteppingAction().

Referenced by Entry(), and UserZSteppingAction().

Referenced by Entry(), and UserZSteppingAction().

Referenced by Entry(), and UserZSteppingAction().

Referenced by UserZSteppingAction().

Referenced by Entry(), and UserZSteppingAction().

Referenced by Entry().

G4ParticleDefinition* BLCMDprofile::Entry::particle

Referenced by Entry(), and UserZSteppingAction().

Referenced by Entry(), and UserZSteppingAction().


The documentation for this struct was generated from the following file:
g4beamline