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.

00046                                                                   :
00047                                                         require(req), eval()
00048                         { z=zpos; sumX=sumY=sumPx=sumPy=sumPz=sumPtot=sumW=0.0; n=0;
00049                           M=new double*[4]; Mrow[0]=new double[4]; Mrow[1]=new double[4];
00050                           Mrow[2]=new double[4]; Mrow[3]=new double[4];
00051                           M[0]=Mrow[0]; M[1]=Mrow[1]; M[2]=Mrow[2]; M[3]=Mrow[3];
00052                           for(int i=0; i<4; ++i) for(int j=0; j<4; ++j) M[i][j]=0.0;
00053                           particle = pd;
00054                           coordinateType = _coordinateType;
00055                         }
                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.

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


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