~m-a-uchida/maus/RKdEdxDevel

« back to all changes in this revision

Viewing changes to src/common_cpp/Simulation/VirtualPlanes.cc

  • Committer: Durga Rajaram
  • Date: 2014-05-22 01:14:01 UTC
  • mfrom: (659.1.89 rcand)
  • Revision ID: durga@fnal.gov-20140522011401-a9r46hl3kcq7eloj
Tags: MAUS-v0.8.4
MAUS-v0.8.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
124
124
 
125
125
void VirtualPlane::FillKinematics
126
126
                               (VirtualHit * aHit, const G4Step * aStep) const {
127
 
  double  x[8];
 
127
  double  x[12];
128
128
  double* x_from_beginning = NULL;
129
129
  double* x_from_end = NULL;
130
130
  switch (_stepping) {
142
142
  }
143
143
  double indep_beg     = GetIndependentVariable(aStep->GetPreStepPoint());
144
144
  double indep_end     = GetIndependentVariable(aStep->GetPostStepPoint());
145
 
  for (int i = 0; i < 8; i++)
 
145
  for (int i = 0; i < 12; i++)
146
146
    x[i] = (x_from_end[i]-x_from_beginning[i])/(indep_end-indep_beg)
147
147
          *(_independentVariable-indep_beg)+x_from_beginning[i];
148
148
 
149
149
  aHit->SetPos(CLHEP::Hep3Vector(x[1], x[2], x[3]));
150
150
  aHit->SetMomentum(CLHEP::Hep3Vector(x[5], x[6], x[7]));
151
 
 
 
151
  aHit->SetSpin(CLHEP::Hep3Vector(x[8], x[9], x[10]));
152
152
  double mass = aStep->GetPostStepPoint()->GetMass();
153
153
  // FORCE mass shell condition
154
154
  x[4] = ::sqrt(x[5]*x[5]+x[6]*x[6]+x[7]*x[7]+mass*mass);
182
182
}
183
183
 
184
184
double * VirtualPlane::ExtractPointData(G4StepPoint *aPoint) const {
185
 
  double* x_in = new double[8];
 
185
  double* x_in = new double[12];
186
186
  for (int i = 0; i < 3; i++) {
187
187
    x_in[i+1] = aPoint->GetPosition()[i];
188
188
    x_in[i+5] = aPoint->GetMomentum()[i];
 
189
    x_in[i+8] = aPoint->GetPolarization()[i];
189
190
  }
190
191
  x_in[0] = aPoint->GetGlobalTime();
191
192
  x_in[4] = aPoint->GetTotalEnergy();
406
407
    hit_v["momentum"]["x"] = hit.GetMomentum().x();
407
408
    hit_v["momentum"]["y"] = hit.GetMomentum().y();
408
409
    hit_v["momentum"]["z"] = hit.GetMomentum().z();
 
410
    hit_v["spin"] = Json::Value(Json::objectValue);
 
411
    hit_v["spin"]["x"] = hit.GetSpin().x();
 
412
    hit_v["spin"]["y"] = hit.GetSpin().y();
 
413
    hit_v["spin"]["z"] = hit.GetSpin().z();
409
414
    hit_v["proper_time"] = hit.GetProperTime();
410
415
    hit_v["path_length"] = hit.GetPathLength();
411
416
    hit_v["b_field"] = Json::Value(Json::objectValue);
441
446
         JsonWrapper::GetProperty(v_hit, "position", JsonWrapper::objectValue);
442
447
    Json::Value mom_v =
443
448
         JsonWrapper::GetProperty(v_hit, "momentum", JsonWrapper::objectValue);
 
449
    Json::Value spin_v =
 
450
         JsonWrapper::GetProperty(v_hit, "spin", JsonWrapper::objectValue);
444
451
    Json::Value b_v =
445
452
         JsonWrapper::GetProperty(v_hit, "b_field", JsonWrapper::objectValue);
446
453
    Json::Value e_v =
459
466
 
460
467
    hit.SetPos(JsonWrapper::JsonToThreeVector(pos_v));
461
468
    hit.SetMomentum(JsonWrapper::JsonToThreeVector(mom_v));
 
469
    hit.SetSpin(JsonWrapper::JsonToThreeVector(spin_v));
462
470
    hit.SetBField(JsonWrapper::JsonToThreeVector(b_v));
463
471
    hit.SetEField(JsonWrapper::JsonToThreeVector(e_v));
464
472
    hit.SetEnergy(::sqrt(hit.GetMomentum().mag2()+hit.GetMass()*hit.GetMass()));