Skip to content

Commit

Permalink
setMomentum gets LCIO::getMomentum in input
Browse files Browse the repository at this point in the history
  • Loading branch information
pbutti committed Apr 22, 2024
1 parent a75e58e commit d67e8d4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 22 deletions.
13 changes: 6 additions & 7 deletions event/include/MCTrackerHit.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ class MCTrackerHit : public TObject {

/** @return The hit position. */
std::vector<double> getPosition() const { return {x_, y_, z_}; };


void setMomentum(const double* momentum, bool rotate = false);
std::vector<double> getMomentum() const { return {px_, py_, pz_}; };
void setMomentum(const float* momentum, bool rotate = false);
std::vector<float> getMomentum() const { return {px_, py_, pz_}; };

/** @return the global X coordinate of the hit */
double getGlobalX() const {return x_;}
Expand Down Expand Up @@ -106,10 +105,10 @@ class MCTrackerHit : public TObject {
/** The x position of the hit. */
double z_{-999};

/** The truth momentum of the hit. Only MC */
double px_{-999};
double py_{-999};
double pz_{-999};
/** The truth momentum of the hit. Only MC */
float px_{-999};
float py_{-999};
float pz_{-999};

/** The hit time. */
double time_{-999};
Expand Down
2 changes: 1 addition & 1 deletion event/src/MCTrackerHit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void MCTrackerHit::Clear(Option_t* /* options */) {
TObject::Clear();
}

void MCTrackerHit::setMomentum(const double* momentum, bool rotate) {
void MCTrackerHit::setMomentum(const float* momentum, bool rotate) {

//svt angle: it's already with minus sign.
float svtAngle = 30.5e-3;
Expand Down
18 changes: 4 additions & 14 deletions processors/src/MCTrackerHitProcessor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,12 @@ bool MCTrackerHitProcessor::process(IEvent* ievent) {
mc_tracker_hit->setLayer(decoder["layer"]);
mc_tracker_hit->setModule(decoder["module"]);

// Set the position of the hit
double hitPos[3];
hitPos[0] = lcio_mcTracker_hit->getPosition()[0];
hitPos[1] = lcio_mcTracker_hit->getPosition()[1];
hitPos[2] = lcio_mcTracker_hit->getPosition()[2];
mc_tracker_hit->setPosition(hitPos);

double hitMom[3];
hitMom[0] = lcio_mcTracker_hit->getMomentum()[0];
hitMom[1] = lcio_mcTracker_hit->getMomentum()[1];
hitMom[2] = lcio_mcTracker_hit->getMomentum()[2];
mc_tracker_hit->setMomentum(hitMom);

mc_tracker_hit->setPosition(lcio_mcTracker_hit->getPosition());
mc_tracker_hit->setMomentum(lcio_mcTracker_hit->getMomentum());

// Set the energy deposit of the hit
mc_tracker_hit->setEdep(lcio_mcTracker_hit->getEDep());

// Set the pdg of particle generating the hit
if(lcio_mcTracker_hit->getMCParticle())
mc_tracker_hit->setPDG(lcio_mcTracker_hit->getMCParticle()->getPDG());
Expand Down

0 comments on commit d67e8d4

Please sign in to comment.