-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is the first update to the reduced tracking code (4:01 pm, 11/08…
…/24). I added reducedSeeding, created the reducedTrack class, and modified the tracking.py to allow reducedSeeding to run.
- Loading branch information
Showing
5 changed files
with
599 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
#ifndef TRACKING_EVENT_TRACK_H_ | ||
#define TRACKING_EVENT_TRACK_H_ | ||
|
||
//----------------------// | ||
// C++ Standard Lib // | ||
//----------------------// | ||
#include <iostream> | ||
#include <optional> | ||
#include <vector> | ||
|
||
//----------// | ||
// ROOT // | ||
//----------// | ||
#include "TObject.h" | ||
|
||
// --- ACTS --- // | ||
//#include "Acts/Definitions/TrackParametrization.hpp" | ||
//#include "Acts/EventData/TrackParameters.hpp" | ||
|
||
namespace ldmx { | ||
|
||
/// This enum describes the type of TrackState | ||
/// RefPoint is wrt to a line parallel to the Z axis located at the refPoint | ||
/// stored in the TrackState AtTarget is wrt the target surface: i.e. a surface | ||
/// at the refPoint with orientation as the ACTS Tracking Frame | ||
/// AtFirstMeasurement: track state at the first measurment on track. | ||
/// For the recoil "first" means closest to the target, for the tagger it means | ||
/// farthest from the target | ||
|
||
/// AtLastMeasurement : track state at the last measurement on track. | ||
/// For the recoil it means closest to the ECAL, for the tagger closest to the | ||
/// target. | ||
|
||
/** | ||
* Implementation of a track object. | ||
* | ||
* This class encapsulates all the information of a particle trajectory in the | ||
* tracker | ||
* | ||
*/ | ||
|
||
class reducedTrack { | ||
public: | ||
|
||
Track(){}; | ||
|
||
/** | ||
* Destructor. | ||
* | ||
* Currently, the destructor does nothing. | ||
*/ | ||
virtual ~Track(){}; | ||
|
||
/** | ||
* Print the string representation of this object. | ||
* | ||
* This class is needed by ROOT when building the dictionary. | ||
*/ | ||
void Print() const; | ||
|
||
// To match the Framework Bus clear. It's doing nothing | ||
void Clear(){}; | ||
|
||
void setNhits(int nhits) { n_hits_ = nhits; } | ||
int getNhits() const { return n_hits_; } | ||
|
||
void setNdf(int ndf) { ndf_ = ndf; } | ||
int getNdf() const { return ndf_; }; | ||
|
||
void setNsharedHits(int nsh) { n_shared_hits_ = nsh; } | ||
int getNsharedHits() const { return n_shared_hits_; } | ||
|
||
void setChi2(double chi2) { chi2_ = chi2; } | ||
double getChi2() const { return chi2_; } | ||
|
||
// !! NEEDS TO BE CONFIGURED !! | ||
// void setTrackID(int trackid) { trackID_ = trackid; }; | ||
// int getTrackID() const { return trackID_; }; | ||
|
||
void setAX(double ax) { ax_ = ax; } | ||
double getAX() const { return ax_; } | ||
|
||
void setBX(double bx) { bx_ = bx; } | ||
double getBX() const { return bx_; } | ||
|
||
void setAY(double ay) { ay_ = ay; } | ||
double getAY() const { return ay_; } | ||
|
||
void setBY(double by) { by_ = by; } | ||
double getBY() const { return by_; } | ||
|
||
void setDistancetoEcalRecHit(double distance) {distance_to_Ecal_ = distance;} | ||
double getDistanceToRecHit() const { return distance_to_Ecal_; } | ||
|
||
void setFirstSensorPosition(const std::vector<double>& firstSensor) { | ||
firstSensor_ = firstSensor; | ||
} | ||
std::vector<double> getFirstSensorPosition() const { return firstSensor_; }; | ||
|
||
void setSecondSensorPosition(const std::vector<double>& secondSensor) { | ||
secondSensor_ = secondSensor; | ||
} | ||
std::vector<double> getSecondSensorPosition() const { return secondSensor_; }; | ||
|
||
void setFirstLayerEcalRecHit(const std::vector<double>& ecalRecHit) { | ||
ecalRecHit_ = ecalRecHit; | ||
} | ||
std::vector<double> getFirstLayerEcalRecHit() const { return ecalRecHit_; }; | ||
|
||
|
||
void setTargetLocation(const std::vector<double>& target_loc) { | ||
targetPos_ = target_loc; | ||
} | ||
void setEcalLayer1Location(const std::vector<double>& ecal_loc) { | ||
ecalLayer1Pos_ = ecal_loc; | ||
} | ||
|
||
void setTargetLocation(const double& z, const double& x, const double& y) { | ||
targetPos_[0] = z; | ||
targetPos_[1] = x; | ||
targetPos_[2] = y; | ||
} | ||
|
||
void setEcalLayer1Location(const double& z, const double& x, const double& y) { | ||
ecalLayer1Pos_[0] = z; | ||
ecalLayer1Pos_[1] = x; | ||
ecalLayer1Pos_[2] = y; | ||
} | ||
|
||
std::vector<double> getTargetLocation() const { return targetPos_; }; | ||
double getTargetZ() const { return targetPos_[0]; }; | ||
double getTargetX() const { return targetPos_[1]; }; | ||
double getTargetY() const { return targetPos_[2]; }; | ||
|
||
std::vector<double> getEcalLayer1Location() const { return ecalLayer1Pos_; }; | ||
double getEcalLayer1Z() const { return ecalLayer1Pos_[0]; }; | ||
double getEcalLayer1X() const { return ecalLayer1Pos_[1]; }; | ||
double getEcalLayer1Y() const { return ecalLayer1Pos_[2]; }; | ||
|
||
// getters -- TODO use an enum instead | ||
|
||
// double getPhi() const { return perigee_pars_[2]; }; | ||
// double getTheta() const { return perigee_pars_[3]; }; | ||
|
||
protected: | ||
//Actual Track Parameters | ||
double ax_{0}; | ||
double ay_{0}; | ||
double bx_{0}; | ||
double by_{0}; | ||
double distance_to_Ecal_{0}; | ||
|
||
std::vector<double> firstSensor_{0., 0., 0.}; | ||
std::vector<double> secondSensor_{0., 0., 0.}; | ||
std::vector<double> ecalRecHit_{0., 0., 0.}; | ||
|
||
int n_hits_{0}; | ||
int ndf_{0}; | ||
int n_shared_hits_{0}; | ||
double chi2_{0}; | ||
|
||
// The target location | ||
std::vector<double> targetPos_{0., 0., 0.}; | ||
// The ecal first layer position | ||
std::vector<double> ecalLayer1Pos_{0., 0., 0.}; | ||
|
||
// ID of the matched particle in the SimParticles map | ||
// int trackID_{-1}; COME BACK AND SETUP TRACK ID ONCE YOU CONFIGURE TRUTH STUFF | ||
|
||
/// Class declaration needed by the ROOT dictionary. | ||
ClassDef(reducedTrack, 2); | ||
|
||
}; // Track | ||
|
||
typedef std::vector<ldmx::reducedTrack> reducedTracks; | ||
|
||
} // namespace ldmx | ||
|
||
#endif // TRACKING_EVENT_TRACK_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
#pragma once | ||
|
||
//---< Framework >---// | ||
#include "Framework/Configure/Parameters.h" | ||
#include "Framework/Event.h" | ||
#include "Framework/EventProcessor.h" | ||
|
||
//---< Tracking >---// | ||
#include "Tracking/Sim/LdmxSpacePoint.h" | ||
#include "Tracking/Sim/SeedToTrackParamMaker.h" | ||
#include "Tracking/Sim/TrackingUtils.h" | ||
|
||
//---< SimCore >---// | ||
#include "SimCore/Event/SimTrackerHit.h" | ||
|
||
//---< STD C++ >---// | ||
|
||
#include <iostream> | ||
|
||
//---< ACTS >---// | ||
#include "Acts/Definitions/Algebra.hpp" | ||
#include "Acts/MagneticField/MagneticFieldContext.hpp" | ||
#include "Acts/Seeding/EstimateTrackParamsFromSeed.hpp" | ||
#include "Acts/Seeding/Seed.hpp" | ||
#include "Acts/Seeding/SeedFilter.hpp" | ||
#include "Acts/Seeding/SpacePointGrid.hpp" | ||
#include "Acts/Utilities/CalibrationContext.hpp" | ||
#include "Acts/Utilities/Intersection.hpp" | ||
|
||
//--- LDMX ---// | ||
#include "TFile.h" | ||
#include "TTree.h" | ||
#include "Tracking/Event/Measurement.h" | ||
#include "Tracking/Reco/TrackingGeometryUser.h" | ||
#include "Tracking/Reco/TruthMatchingTool.h" | ||
|
||
namespace tracking { | ||
namespace reco { | ||
|
||
class reducedSeedFinder : public TrackingGeometryUser { | ||
public: | ||
/** | ||
* Constructor. | ||
* | ||
* @param name The name of the instance of this object. | ||
* @param process The process running this producer. | ||
*/ | ||
reducedSeedFinder(const std::string& name, framework::Process& process); | ||
|
||
/// Destructor | ||
~reducedSeedFinder(); | ||
|
||
/** | ||
* | ||
*/ | ||
void onProcessStart() override; | ||
|
||
/** | ||
* | ||
*/ | ||
void onProcessEnd() override; | ||
|
||
/** | ||
* Configure the processor using the given user specified parameters. | ||
* | ||
* @param parameters Set of parameters used to configure this processor. | ||
*/ | ||
void configure(framework::config::Parameters& parameters) override; | ||
|
||
/** | ||
* Run the processor and create a collection of results which | ||
* indicate if a charge particle can be found by the recoil tracker. | ||
* | ||
* @param event The event to process. | ||
*/ | ||
void produce(framework::Event& event) override; | ||
|
||
private: | ||
ldmx::reducedTrack SeedTracker(const std::vector<double> recoilOne, const std::vector<double> recoilTwo, const std::vector<double> ecalOne); | ||
|
||
std::pair<std::vector<std::array<double, 4>>, std::vector<std::array<double, 4>>> combineMultiGlobalHits(const std::vector<std::array<double, 4>> &hitCollection); | ||
std::vector<std::array<double, 3>> weightedAverage(const std::vector<std::array<double, 4>> &layer1, const std::vector<std::array<double, 4>> &layer2); | ||
std::tuple<double, double, double, double> fit3DLine(const std::array<double, 3> &firstRecoil, const std::array<double, 3> &secondRecoil, const std::array<double, 3> &ECal); | ||
|
||
double calculateDistance(const std::array<double, 3> &point1, const std::array<double, 3> &point2); | ||
double globalChiSquare(const std::array<double, 3> &firstSensor, const std::array<double, 3> &secondSensor, const std::array<double, 3> &ecalHit, double ax, double ay, double bx, double by); | ||
int uniqueSensorsHit(const std::vector<std::array<double, 4>> &digiPoints); | ||
|
||
double processing_time_{0.}; | ||
long nevents_{0}; | ||
unsigned int ntracks_{0}; | ||
|
||
/// The name of the output collection of seeds to be stored. | ||
std::string out_seed_collection_{"ReducedSeedTracks"}; | ||
/// The name of the input hits collection to use in finding seeds.. | ||
std::string input_hits_collection_{"DigiRecoilSimHits"}; | ||
/// The name of the tagger Tracks (only for Recoil Seeding) | ||
std::string input_recHits_collection_{"EcalRecHits"}; | ||
/// Location of the perigee for the helix track parameters. | ||
std::vector<double> perigee_location_{0., 0., 0}; | ||
|
||
double piover2_{1.5708}; | ||
|
||
/// PhiRange | ||
double phicut_{0.1}; | ||
|
||
/// ThetaRange | ||
double thetacut_{0.2}; | ||
|
||
/// loc0 / loc1 cuts | ||
double loc0cut_{0.1}; | ||
double loc1cut_{0.3}; | ||
|
||
std::vector<double> zpos_digi_tot_; | ||
std::vector<double> xpos_digi_tot_; | ||
std::vector<double> ypos_digi_tot_; | ||
std::vector<double> edep_digi_; | ||
|
||
std::vector<double> ecal_end_x_; | ||
std::vector<double> ecal_end_y_; | ||
std::vector<double> ecal_end_z_; | ||
|
||
std::vector<std::array<double, 4>> digiPoints_; | ||
std::vector<std::array<double, 3>> firstLayerEcalRecHits_; | ||
|
||
// Check failures | ||
// long ndoubles_{0}; | ||
long nmissing_{0}; | ||
// long nfailphi_{0}; | ||
// long nfailtheta_{0}; | ||
|
||
}; // SeedFinderProcessor | ||
|
||
} // namespace reco | ||
} // namespace tracking |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include "Tracking/Event/reducedTrack.h" | ||
|
||
#include <iostream> | ||
|
||
ClassImp(ldmx::reducedTrack) | ||
|
||
namespace ldmx { | ||
void reducedTrack::Print() const { std::cout << "print track" << std::endl; } | ||
} |
Oops, something went wrong.