42 #include "TLorentzVector.h"
45 #include "H_Parameters.h"
46 #include "H_BeamLine.h"
47 #include "H_RecRPObject.h"
48 #include "H_BeamParticle.h"
65 H_RecRPObject* pps_station,
double x1,
double y1,
double x2,
double y2,
double& tx,
double& ty,
double& eloss);
66 void MatchCellId(
int cellId, std::vector<int> vrecCellId, std::vector<double> vrecTof,
bool&
match,
double& recTof);
86 void ProjectToToF(
const double x1,
const double y1,
const double x2,
const double y2,
double& xt,
double& yt) {
112 std::unique_ptr<CTPPSTrkDetector>
det1F;
113 std::unique_ptr<CTPPSTrkDetector>
det1B;
114 std::unique_ptr<CTPPSTrkDetector>
det2F;
115 std::unique_ptr<CTPPSTrkDetector>
det2B;
137 : m_verbosity(
false), fBeamMomentum(0.), fCrossAngleCorr(
false), fCrossingAngleBeam1(0.), fCrossingAngleBeam2(0.) {
139 produces<edm::CTPPSFastTrackContainer>(
"CTPPSFastTrack");
183 LogDebug(
"CTPPSFastTrackingProducer") <<
"CTPPSFastTrackingProducer: WARNING: lengthctpps= " <<
lengthctpps;
191 det1F = std::make_unique<CTPPSTrkDetector>(
193 det2F = std::make_unique<CTPPSTrkDetector>(
195 det1B = std::make_unique<CTPPSTrkDetector>(
197 det2B = std::make_unique<CTPPSTrkDetector>(
201 std::vector<double> vToFCellWidth;
202 vToFCellWidth.reserve(8);
203 for (
int i = 0;
i < 8;
i++) {
207 detToF_F = std::make_unique<CTPPSToFDetector>(
209 detToF_B = std::make_unique<CTPPSToFDetector>(
231 output_tracks->push_back(*
i);
265 for (
unsigned int irecHits = 0; irecHits < recHits->size(); ++irecHits) {
267 unsigned int detlayerId = recHitDet->
detUnitId();
271 float tof = recHitDet->
tof();
272 if (detlayerId == 2014314496)
273 det1F->AddHit(detlayerId, x, y, z);
274 else if (detlayerId == 2014838784)
275 det2F->AddHit(detlayerId, x, y, z);
276 else if (detlayerId == 2031091712)
277 det1B->AddHit(detlayerId, x, y, z);
278 else if (detlayerId == 2031616000)
279 det2B->AddHit(detlayerId, x, y, z);
280 else if (detlayerId == 2046820352) {
284 }
else if (detlayerId == 2063597568) {
337 H_RecRPObject*
station =
nullptr;
351 double x1 = det1->
ppsX_.at(i);
352 double y1 = det1->
ppsY_.at(i);
353 double x2 = det2->
ppsX_.at(j);
354 double y2 = det2->
ppsY_.at(j);
359 station, Direction * x1, y1, Direction * x2, y2, thx, thy, eloss);
368 LogDebug(
"CTPPSFastTrackingProducer::SearchTrack:") <<
"thx " << thx <<
" thy " << thy <<
" eloss " << eloss;
371 x0 = -Direction * station->getX0() *
um_to_cm;
373 double ImpPar =
sqrt(x0 * x0 + y0 * y0);
382 double energy = fBeamEnergy * (1. - xi);
386 if (xi < 0. || xi > 1. || t < 0. || t > 10. || pt <= 0.) {
405 H_RecRPObject* pps_station,
double x1,
double y1,
double x2,
double y2,
double& tx,
double& ty,
double& eloss) {
415 pps_station->setPositions(x1, y1, x2, y2);
416 double energy = pps_station->getE(AM);
419 tx = pps_station->getTXIP();
420 ty = pps_station->getTYIP();
421 eloss = pps_station->getE();
425 int cellId, std::vector<int> vrecCellId, std::vector<double> vrecTof,
bool&
match,
double& recTof) {
426 for (
unsigned int i = 0;
i < vrecCellId.size();
i++) {
427 if (cellId == vrecCellId.at(
i)) {
429 recTof = vrecTof.at(
i);
437 double xi,
t, partP,
pt,
phi, x0, y0, thx, thy, xt, yt, X1d, Y1d, X2d, Y2d;
442 std::vector<double> vToFCellWidth;
443 vToFCellWidth.reserve(8);
444 for (
int i = 0;
i < 8;
i++) {
460 if (
SearchTrack(
i,
j, Direction, xi, t, partP, pt, thx, thy, x0, y0, xt, yt, X1d, Y1d, X2d, Y2d)) {
464 bool matchCellId =
false;
466 theta =
sqrt(thx * thx + thy * thy) *
urad;
468 }
else if (Direction < 0) {
472 phi = atan2(thy, thx);
474 double px = partP *
sin(theta) *
cos(phi);
475 double py = partP *
sin(theta) *
sin(phi);
476 double pz = partP *
cos(theta);
478 TLorentzVector
p(px, py, pz, e);
T getUntrackedParameter(std::string const &, T const &) const
std::vector< double > ppsX_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::unique_ptr< CTPPSTrkDetector > det2B
int findCellId(double x, double y)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
constexpr bool isNotFinite(T x)
#define DEFINE_FWK_MODULE(type)
std::unique_ptr< H_BeamLine > m_beamlineCTPPS1
Sin< T >::type sin(const T &t)
void FastReco(int Direction, H_RecRPObject *station)
Geom::Theta< T > theta() const
void setvertex(const Point &vertex)
void ReconstructArm(H_RecRPObject *pps_station, double x1, double y1, double x2, double y2, double &tx, double &ty, double &eloss)
std::unique_ptr< H_RecRPObject > pps_stationB
std::unique_ptr< CTPPSToFDetector > detToF_F
double fCrossingAngleBeam2
void TrackerStationClear()
float tof() const
deprecated name for timeOfFlight()
std::unique_ptr< CTPPSTrkDetector > det2F
std::unique_ptr< H_RecRPObject > pps_stationF
std::vector< double > fToFCellWidth
void setp(const Vector &momentum)
std::vector< int > recCellId_F
CTPPSFastTrackingProducer(const edm::ParameterSet &)
std::unique_ptr< CTPPSTrkDetector > det1B
double fCrossingAngleBeam1
std::string beam1filename
std::vector< double > recTof_F
unsigned int detUnitId() const
std::unique_ptr< CTPPSTrkStation > TrkStation_B
Cos< T >::type cos(const T &t)
std::unique_ptr< CTPPSToFDetector > detToF_B
std::vector< double > recTof_B
std::vector< CTPPSFastRecHit > CTPPSFastRecHitContainer
void TrackerStationStarting()
std::unique_ptr< H_BeamLine > m_beamlineCTPPS2
std::string beam2filename
void ProjectToToF(const double x1, const double y1, const double x2, const double y2, double &xt, double &yt)
std::vector< int > recCellId_B
std::vector< double > ppsY_
void MatchCellId(int cellId, std::vector< int > vrecCellId, std::vector< double > vrecTof, bool &match, double &recTof)
std::unique_ptr< CTPPSTrkStation > TrkStation_F
std::vector< CTPPSFastTrack > theCTPPSFastTrack
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
static const double um_to_cm
T getParameter(std::string const &) const
Local3DPoint entryPoint() const
Entry point in the local Det frame.
std::unique_ptr< CTPPSTrkDetector > det1F
static const double mm_to_um
edm::EDGetTokenT< CTPPSFastRecHitContainer > _recHitToken
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
static constexpr float b2
const GeomDet * recHitDet(const TrackingRecHit &hit, const TrackingGeometry *geom)
void produce(edm::Event &, const edm::EventSetup &) override
std::vector< CTPPSFastTrack > CTPPSFastTrackContainer
void setcellid(unsigned int cellid)
void ReadRecHits(edm::Handle< CTPPSFastRecHitContainer > &)
static constexpr float b1
bool SearchTrack(int, int, int Direction, double &xi, double &t, double &partP, double &pt, double &thx, double &thy, double &x0, double &y0, double &xt, double &yt, double &X1d, double &Y1d, double &X2d, double &Y2d)