CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
CTPPSFastTrackingProducer Class Reference

#include <FastSimulation/CTPPSFastTrackingProducer/plugins/CTPPSFastTrackingProducer.cc>

Inheritance diagram for CTPPSFastTrackingProducer:
edm::stream::EDProducer<>

Public Member Functions

 CTPPSFastTrackingProducer (const edm::ParameterSet &)
 
 ~CTPPSFastTrackingProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Types

typedef std::vector< CTPPSFastRecHitCTPPSFastRecHitContainer
 

Private Member Functions

virtual void beginEvent (edm::Event &event, const edm::EventSetup &eventSetup)
 
void beginStream (edm::StreamID) override
 
virtual void endEvent (edm::Event &event, const edm::EventSetup &eventSetup)
 
void endStream () override
 
void FastReco (int Direction, H_RecRPObject *station)
 
void MatchCellId (int cellId, std::vector< int > vrecCellId, std::vector< double > vrecTof, bool &match, double &recTof)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
void ProjectToToF (const double x1, const double y1, const double x2, const double y2, double &xt, double &yt)
 
void ReadRecHits (edm::Handle< CTPPSFastRecHitContainer > &)
 
void ReconstructArm (H_RecRPObject *pps_station, double x1, double y1, double x2, double y2, double &tx, double &ty, double &eloss)
 
void Reconstruction ()
 
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)
 
bool SetBeamLine ()
 
void TrackerStationClear ()
 
void TrackerStationStarting ()
 

Private Attributes

edm::EDGetTokenT< CTPPSFastRecHitContainer_recHitToken
 
std::string beam1filename
 
std::string beam2filename
 
std::unique_ptr< CTPPSTrkDetectordet1B
 
std::unique_ptr< CTPPSTrkDetectordet1F
 
std::unique_ptr< CTPPSTrkDetectordet2B
 
std::unique_ptr< CTPPSTrkDetectordet2F
 
std::unique_ptr< CTPPSToFDetectordetToF_B
 
std::unique_ptr< CTPPSToFDetectordetToF_F
 
double fBeamEnergy
 
double fBeamMomentum
 
double fBeamXRMS_ToF
 
double fBeamXRMS_Trk1
 
double fBeamXRMS_Trk2
 
bool fCrossAngleCorr
 
double fCrossingAngleBeam1
 
double fCrossingAngleBeam2
 
double fImpParcut
 
double fTimeSigma
 
double fToFCellHeight
 
std::vector< double > fToFCellWidth
 
double fToFInsertion
 
int fToFNCellX
 
int fToFNCellY
 
double fToFPitchX
 
double fToFPitchY
 
double fToFXOffset
 
double fTrackerHeight
 
double fTrackerInsertion
 
double fTrackerWidth
 
double fTrk1XOffset
 
double fTrk2XOffset
 
double fz_timing
 
double fz_tracker1
 
double fz_tracker2
 
double lengthctpps
 
std::unique_ptr< H_BeamLine > m_beamlineCTPPS1
 
std::unique_ptr< H_BeamLine > m_beamlineCTPPS2
 
std::map< unsigned int, H_BeamParticle * > m_beamPart
 
bool m_verbosity
 
std::unique_ptr< H_RecRPObject > pps_stationB
 
std::unique_ptr< H_RecRPObject > pps_stationF
 
std::vector< int > recCellId_B
 
std::vector< int > recCellId_F
 
std::vector< double > recTof_B
 
std::vector< double > recTof_F
 
std::vector< CTPPSFastTracktheCTPPSFastTrack
 
CTPPSFastTrack track
 
std::unique_ptr< CTPPSTrkStationTrkStation_B
 
std::unique_ptr< CTPPSTrkStationTrkStation_F
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 55 of file CTPPSFastTrackingProducer.h.

Member Typedef Documentation

Definition at line 70 of file CTPPSFastTrackingProducer.h.

Constructor & Destructor Documentation

CTPPSFastTrackingProducer::CTPPSFastTrackingProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 35 of file CTPPSFastTrackingProducer.cc.

References _recHitToken, beam1filename, beam2filename, det1B, det1F, det2B, det2F, detToF_B, detToF_F, fBeamEnergy, fBeamMomentum, fBeamXRMS_ToF, fBeamXRMS_Trk1, fBeamXRMS_Trk2, fCrossAngleCorr, fCrossingAngleBeam1, fCrossingAngleBeam2, fImpParcut, fTimeSigma, fToFCellHeight, fToFCellWidth, fToFInsertion, fToFNCellX, fToFNCellY, fToFPitchX, fToFPitchY, fToFXOffset, fTrackerHeight, fTrackerInsertion, fTrackerWidth, fTrk1XOffset, fTrk2XOffset, fz_timing, fz_tracker1, fz_tracker2, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), mps_fire::i, lengthctpps, LogDebug, m_verbosity, PPSTools::ProtonMassSQ, SetBeamLine(), and mathSSE::sqrt().

35  :
37 {
38  //register your products
39  produces<edm::CTPPSFastTrackContainer>("CTPPSFastTrack");
40  using namespace edm;
41  _recHitToken = consumes<CTPPSFastRecHitContainer>(iConfig.getParameter<edm::InputTag>("recHitTag"));
42  m_verbosity = iConfig.getParameter<bool>("Verbosity");
43  // User definitons
44 
45  // Read beam parameters needed for Hector reconstruction
46  lengthctpps = iConfig.getParameter<double>("BeamLineLengthCTPPS" );
47  beam1filename = iConfig.getParameter<string>("Beam1");
48  beam2filename = iConfig.getParameter<string>("Beam2");
49  fBeamEnergy = iConfig.getParameter<double>("BeamEnergy"); // beam energy in GeV
51  fCrossingAngleBeam1 = iConfig.getParameter<double>("CrossingAngleBeam1");
52  fCrossingAngleBeam2 = iConfig.getParameter<double>("CrossingAngleBeam2");
53 
55  //Read detectors positions and parameters
56 
57  fz_tracker1 = iConfig.getParameter<double>("Z_Tracker1");
58  fz_tracker2 = iConfig.getParameter<double>("Z_Tracker2");
59  fz_timing = iConfig.getParameter<double>("Z_Timing");
60  //
61  fTrackerWidth = iConfig.getParameter<double>("TrackerWidth");
62  fTrackerHeight = iConfig.getParameter<double>("TrackerHeight");
63  fTrackerInsertion = iConfig.getParameter<double>("TrackerInsertion");
64  fBeamXRMS_Trk1 = iConfig.getParameter<double>("BeamXRMS_Trk1");
65  fBeamXRMS_Trk2 = iConfig.getParameter<double>("BeamXRMS_Trk2");
66  fTrk1XOffset = iConfig.getParameter<double>("Trk1XOffset");
67  fTrk2XOffset = iConfig.getParameter<double>("Trk2XOffset");
68  fToFCellWidth = iConfig.getUntrackedParameter<std::vector<double> >("ToFCellWidth");
69  fToFCellHeight = iConfig.getParameter<double>("ToFCellHeight");
70  fToFPitchX = iConfig.getParameter<double>("ToFPitchX");
71  fToFPitchY = iConfig.getParameter<double>("ToFPitchY");
72  fToFNCellX = iConfig.getParameter<int>("ToFNCellX");
73  fToFNCellY = iConfig.getParameter<int>("ToFNCellY");
74  fToFInsertion = iConfig.getParameter<double>("ToFInsertion");
75  fBeamXRMS_ToF = iConfig.getParameter<double>("BeamXRMS_ToF");
76  fToFXOffset = iConfig.getParameter<double>("ToFXOffset");
77  fTimeSigma = iConfig.getParameter<double>("TimeSigma");
78  fImpParcut = iConfig.getParameter<double>("ImpParcut");
79 
80 
81  if(!SetBeamLine() ) {
82  if ( m_verbosity ) LogDebug("CTPPSFastTrackingProducer") << "CTPPSFastTrackingProducer: WARNING: lengthctpps= " << lengthctpps;
83  return;
84  }
85 
86  // Create a particle to get the beam energy from the beam file
87  // Take care: the z inside the station is in meters
88  //
89  //Tracker Detector Description
90  det1F =std::unique_ptr<CTPPSTrkDetector>(new CTPPSTrkDetector(fTrackerWidth,fTrackerHeight,fTrackerInsertion*fBeamXRMS_Trk1+fTrk1XOffset));
91  det2F =std::unique_ptr<CTPPSTrkDetector>(new CTPPSTrkDetector(fTrackerWidth,fTrackerHeight,fTrackerInsertion*fBeamXRMS_Trk2+fTrk2XOffset));
92  det1B =std::unique_ptr<CTPPSTrkDetector>(new CTPPSTrkDetector(fTrackerWidth,fTrackerHeight,fTrackerInsertion*fBeamXRMS_Trk1+fTrk1XOffset));
93  det2B =std::unique_ptr<CTPPSTrkDetector>(new CTPPSTrkDetector(fTrackerWidth,fTrackerHeight,fTrackerInsertion*fBeamXRMS_Trk2+fTrk2XOffset));
94 
95  //Timing Detector Description
96  std::vector<double> vToFCellWidth;
97  for (int i = 0 ; i < 8 ; i++){
98  vToFCellWidth.push_back(fToFCellWidth[i]);
99  }
100  double pos_tof = fToFInsertion*fBeamXRMS_ToF+fToFXOffset;
101  detToF_F =std::unique_ptr<CTPPSToFDetector>(new CTPPSToFDetector(fToFNCellX,fToFNCellY,vToFCellWidth,fToFCellHeight,fToFPitchX,fToFPitchY,pos_tof,fTimeSigma));
102  detToF_B =std::unique_ptr<CTPPSToFDetector>(new CTPPSToFDetector(fToFNCellX,fToFNCellY,vToFCellWidth,fToFCellHeight,fToFPitchX,fToFPitchY,pos_tof,fTimeSigma));
103 //
104 }
#define LogDebug(id)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< CTPPSTrkDetector > det2B
std::unique_ptr< CTPPSToFDetector > detToF_F
std::unique_ptr< CTPPSTrkDetector > det2F
std::unique_ptr< CTPPSTrkDetector > det1B
T sqrt(T t)
Definition: SSEVec.h:18
const double ProtonMassSQ
Definition: PPSUtilities.h:33
std::unique_ptr< CTPPSToFDetector > detToF_B
edm::EDGetTokenT< CTPPSFastRecHitContainer > _recHitToken
std::unique_ptr< CTPPSTrkDetector > det1F
HLT enums.
CTPPSFastTrackingProducer::~CTPPSFastTrackingProducer ( )
override

Definition at line 105 of file CTPPSFastTrackingProducer.cc.

References m_beamPart.

106 {
107  for (std::map<unsigned int,H_BeamParticle*>::iterator it = m_beamPart.begin(); it != m_beamPart.end(); ++it ) {
108  delete (*it).second;
109  }
110 }
std::map< unsigned int, H_BeamParticle * > m_beamPart

Member Function Documentation

void CTPPSFastTrackingProducer::beginEvent ( edm::Event event,
const edm::EventSetup eventSetup 
)
privatevirtual

Definition at line 135 of file CTPPSFastTrackingProducer.cc.

References TrackerStationStarting().

136 {
138 
139 }
void CTPPSFastTrackingProducer::beginStream ( edm::StreamID  )
overrideprivate

Definition at line 373 of file CTPPSFastTrackingProducer.cc.

374 {
375 }
void CTPPSFastTrackingProducer::endEvent ( edm::Event event,
const edm::EventSetup eventSetup 
)
privatevirtual

Definition at line 141 of file CTPPSFastTrackingProducer.cc.

References TrackerStationClear().

void CTPPSFastTrackingProducer::endStream ( )
overrideprivate

Definition at line 379 of file CTPPSFastTrackingProducer.cc.

380 {
381 }
void CTPPSFastTrackingProducer::FastReco ( int  Direction,
H_RecRPObject *  station 
)
private

Definition at line 296 of file CTPPSFastTrackingProducer.cc.

References funct::cos(), MillePedeFileConverter_cfg::e, fBeamEnergy, fBeamMomentum, fBeamXRMS_ToF, fCrossAngleCorr, fCrossingAngleBeam1, fCrossingAngleBeam2, CTPPSToFDetector::findCellId(), fTimeSigma, fToFCellHeight, fToFCellWidth, fToFInsertion, fToFNCellX, fToFNCellY, fToFPitchX, fToFPitchY, fToFXOffset, PPSTools::Get_t_and_xi(), mps_fire::i, createfilelist::int, PPSTools::LorentzBoost(), MatchCellId(), AlCaHLTBitMon_ParallelJobs::p, phi, Pi, CTPPSTrkDetector::ppsNHits_, PPSTools::ProtonMassSQ, EnergyCorrector::pt, recCellId_B, recCellId_F, recTof_B, recTof_F, SearchTrack(), CTPPSFastTrack::setcellid(), CTPPSFastTrack::setp(), CTPPSFastTrack::sett(), CTPPSFastTrack::settof(), CTPPSFastTrack::setvertex(), CTPPSFastTrack::setx1(), CTPPSFastTrack::setx2(), CTPPSFastTrack::setxi(), CTPPSFastTrack::sety1(), CTPPSFastTrack::sety2(), funct::sin(), mathSSE::sqrt(), protons_cff::t, theCTPPSFastTrack, theta(), track, TrkStation_B, TrkStation_F, urad, and protons_cff::xi.

Referenced by Reconstruction().

297 {
298  double theta = 0.;
299  double xi,t,partP,pt,phi,x0,y0,thx,thy,xt,yt,X1d,Y1d,X2d,Y2d;
300  CTPPSTrkDetector* Trk1 = nullptr;
301  CTPPSTrkDetector* Trk2 = nullptr;
302  double pos_tof = fToFInsertion*fBeamXRMS_ToF+fToFXOffset;
303  int cellId = 0;
304  std::vector<double> vToFCellWidth;
305  for (int i = 0 ; i < 8 ; i++){
306  vToFCellWidth.push_back(fToFCellWidth[i]);
307  }
309  if (Direction>0) {
310  Trk1=&(TrkStation_F->first);Trk2=&(TrkStation_F->second);
311  } else {
312  Trk1=&(TrkStation_B->first);Trk2=&(TrkStation_B->second);
313  }
314  // Make a track from EVERY pair of hits combining Tracker1 and Tracker2.
315  // The tracks may not be independent as 1 hit may belong to more than 1 track.
316  for(int i=0;i<(int)Trk1->ppsNHits_;i++) {
317  for(int j=0;j<(int)Trk2->ppsNHits_;j++){
318  if (SearchTrack(i,j,Direction,xi,t,partP,pt,thx,thy,x0,y0,xt,yt,X1d,Y1d,X2d,Y2d)) {
319  // Check if the hitted timing cell matches the reconstructed track
320  cellId = ToF->findCellId(xt,yt);
321  double recTof = 0.;
322  bool matchCellId = false;
323  if (Direction > 0 ) {
324  theta = sqrt(thx*thx+thy*thy)*urad;
325  MatchCellId(cellId, recCellId_F, recTof_F, matchCellId, recTof);
326  }
327  else if (Direction<0) {
328  theta = TMath::Pi() - sqrt(thx*thx+thy*thy)*urad;
329  MatchCellId(cellId, recCellId_B, recTof_B, matchCellId, recTof);
330  }
331  phi = atan2(thy,thx); // at this point, thx is already in the cms ref. frame
332 
333  double px = partP*sin(theta)*cos(phi);
334  double py = partP*sin(theta)*sin(phi);
335  double pz = partP*cos(theta);
336  double e = sqrt(partP*partP+PPSTools::ProtonMassSQ);
337  TLorentzVector p(px,py,pz,e);
338  // Invert the Lorentz boost made to take into account the crossing angle during simulation
339  if (fCrossAngleCorr) {
342  }
343  //Getting the Xi and t (squared four momentum transferred) of the reconstructed track
344  PPSTools::Get_t_and_xi(const_cast<TLorentzVector*>(&p),t,xi, {fBeamMomentum,fBeamEnergy});
345  double pxx = p.Px(); double pyy = p.Py(); double pzz = p.Pz();
346  math::XYZVector momentum (pxx,pyy,pzz);
347  math::XYZPoint vertex (x0,y0,0);
348 
349  track.setp(momentum);
350  track.setvertex(vertex);
351  track.sett(t);
352  track.setxi(xi);
353  track.setx1(X1d);
354  track.sety1(Y1d);
355  track.setx2(X2d);
356  track.sety2(Y2d);
357  if (matchCellId) {
358  track.setcellid(cellId);
359  track.settof(recTof);
360  }
361  else {
362  track.setcellid(0);
363  track.settof(0.);
364  }
365  theCTPPSFastTrack.push_back(track);
366  }
367  }
368  }
369 }//end FastReco
void LorentzBoost(H_BeamParticle &h_p, int dir, const std::string &frame, FullBeamInfo const &bi)
void sett(float t)
const double Pi
int findCellId(double x, double y)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
void setvertex(const Point &vertex)
static const double urad
void sety1(float y1)
void setx2(float x2)
void setp(const Vector &momentum)
void setx1(float x1)
T sqrt(T t)
Definition: SSEVec.h:18
std::unique_ptr< CTPPSTrkStation > TrkStation_B
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
void setxi(float xi)
const double ProtonMassSQ
Definition: PPSUtilities.h:33
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
Definition: Vector3D.h:30
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
void settof(float tof)
void sety2(float y2)
void Get_t_and_xi(const TLorentzVector *proton, double &t, double &xi, LimitedBeamInfo const &bi)
Definition: PPSUtilities.cc:65
void setcellid(unsigned int cellid)
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)
void CTPPSFastTrackingProducer::MatchCellId ( int  cellId,
std::vector< int >  vrecCellId,
std::vector< double >  vrecTof,
bool &  match,
double &  recTof 
)
private

Definition at line 286 of file CTPPSFastTrackingProducer.cc.

References mps_fire::i.

Referenced by FastReco().

286  {
287  for (unsigned int i = 0 ; i < vrecCellId.size(); i++){
288  if(cellId == vrecCellId.at(i)) {
289  match = true;
290  recTof = vrecTof.at(i);
291  continue;
292  }
293  }
294 }
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
void CTPPSFastTrackingProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 113 of file CTPPSFastTrackingProducer.cc.

References _recHitToken, edm::Event::getByToken(), mps_fire::i, eostools::move(), gen::n, edm::Event::put(), ReadRecHits(), recCellId_B, recCellId_F, Reconstruction(), recTof_B, recTof_F, theCTPPSFastTrack, TrackerStationClear(), and TrackerStationStarting().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

114 {
115  using namespace edm;
118  iEvent.getByToken( _recHitToken,recHits);
119  recCellId_F.clear(); recCellId_B.clear();
120  recTof_F.clear(); recTof_B.clear();
121  ReadRecHits(recHits);
122  Reconstruction();
124 
125  std::unique_ptr<CTPPSFastTrackContainer> output_tracks(new CTPPSFastTrackContainer);
126  int n = 0;
127  for ( std::vector<CTPPSFastTrack>::const_iterator i = theCTPPSFastTrack.begin();
128  i != theCTPPSFastTrack.end(); i++ ) {
129  output_tracks->push_back(*i);
130  n += 1;
131  }
132 
133  iEvent.put(std::move(output_tracks),"CTPPSFastTrack");
134 }//end
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::vector< CTPPSFastTrack > theCTPPSFastTrack
edm::EDGetTokenT< CTPPSFastRecHitContainer > _recHitToken
HLT enums.
std::vector< CTPPSFastTrack > CTPPSFastTrackContainer
void ReadRecHits(edm::Handle< CTPPSFastRecHitContainer > &)
def move(src, dest)
Definition: eostools.py:511
void CTPPSFastTrackingProducer::ProjectToToF ( const double  x1,
const double  y1,
const double  x2,
const double  y2,
double &  xt,
double &  yt 
)
inlineprivate
void CTPPSFastTrackingProducer::ReadRecHits ( edm::Handle< CTPPSFastRecHitContainer > &  recHits)
private

Definition at line 166 of file CTPPSFastTrackingProducer.cc.

References det1B, det1F, det2B, det2F, detToF_B, detToF_F, CTPPSFastRecHit::detUnitId(), CTPPSFastRecHit::entryPoint(), recCellId_B, recCellId_F, recHitDet(), recTof_B, recTof_F, CTPPSFastRecHit::tof(), TrkStation_B, TrkStation_F, x, PV3DBase< T, PVType, FrameType >::x(), y, PV3DBase< T, PVType, FrameType >::y(), z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by produce().

167 {
168  // DetId codification for PSimHit taken from CTPPSPixel- It will be replaced by CTPPSDetId
169  // 2014314496 -> Tracker1 zPositive
170  // 2014838784 -> Tracker2 zPositive
171  // 2046820352 -> Timing zPositive
172  // 2031091712 -> Tracker1 zNegative
173  // 2031616000 -> Tracker2 zNegative
174  // 2063597568 -> Timing zNegative
175 
176  for (unsigned int irecHits = 0; irecHits < recHits->size(); ++irecHits)
177  {
178  const CTPPSFastRecHit* recHitDet = &(*recHits)[irecHits];
179  unsigned int detlayerId = recHitDet->detUnitId();
180  double x = recHitDet->entryPoint().x();
181  double y = recHitDet->entryPoint().y();
182  double z = recHitDet->entryPoint().z();
183  float tof = recHitDet->tof();
184  if(detlayerId == 2014314496) det1F->AddHit(detlayerId,x,y,z);
185  else if(detlayerId == 2014838784) det2F->AddHit(detlayerId,x,y,z);
186  else if(detlayerId == 2031091712) det1B->AddHit(detlayerId,x,y,z);
187  else if(detlayerId == 2031616000) det2B->AddHit(detlayerId,x,y,z);
188  else if(detlayerId == 2046820352) { detToF_F->AddHit(x,y,tof); recCellId_F.push_back(detToF_F->findCellId(x,y)); recTof_F.push_back(tof); }
189  else if(detlayerId == 2063597568) { detToF_B->AddHit(x,y,tof); recCellId_B.push_back(detToF_B->findCellId(x,y)); recTof_B.push_back(tof); }
190 
191  }//LOOP TRK
192  //creating Stations
193  TrkStation_F = std::unique_ptr<CTPPSTrkStation>(new std::pair<CTPPSTrkDetector,CTPPSTrkDetector>(*det1F,*det2F));
194  TrkStation_B = std::unique_ptr<CTPPSTrkStation>(new std::pair<CTPPSTrkDetector,CTPPSTrkDetector>(*det1B,*det2B));
195 } // end function
std::unique_ptr< CTPPSTrkDetector > det2B
T y() const
Definition: PV3DBase.h:63
std::unique_ptr< CTPPSToFDetector > detToF_F
float tof() const
deprecated name for timeOfFlight()
std::unique_ptr< CTPPSTrkDetector > det2F
std::unique_ptr< CTPPSTrkDetector > det1B
unsigned int detUnitId() const
T z() const
Definition: PV3DBase.h:64
std::unique_ptr< CTPPSTrkStation > TrkStation_B
std::unique_ptr< CTPPSToFDetector > detToF_B
std::unique_ptr< CTPPSTrkStation > TrkStation_F
const GeomDet * recHitDet(const TrackingRecHit &hit, const TrackingGeometry *geom)
Local3DPoint entryPoint() const
Entry point in the local Det frame.
std::unique_ptr< CTPPSTrkDetector > det1F
T x() const
Definition: PV3DBase.h:62
void CTPPSFastTrackingProducer::ReconstructArm ( H_RecRPObject *  pps_station,
double  x1,
double  y1,
double  x2,
double  y2,
double &  tx,
double &  ty,
double &  eloss 
)
private

Definition at line 268 of file CTPPSFastTrackingProducer.cc.

References edm::detail::isnan(), and mm_to_um.

Referenced by SearchTrack().

269 {
270  tx=0.;
271  ty=0.;
272  eloss=0.;
273  if (!pps_station) return;
274  x1*=mm_to_um;
275  x2*=mm_to_um;
276  y1*=mm_to_um;
277  y2*=mm_to_um;
278  pps_station->setPositions(x1,y1,x2,y2);
279  double energy = pps_station->getE(AM); // dummy call needed to calculate some Hector internal parameter
280  if (std::isnan(energy)||std::isinf(energy)) return;
281  tx = pps_station->getTXIP(); // change orientation to CMS
282  ty = pps_station->getTYIP();
283  eloss = pps_station->getE();
284 }
bool isnan(float x)
Definition: math.h:13
static const double mm_to_um
void CTPPSFastTrackingProducer::Reconstruction ( )
private

Definition at line 197 of file CTPPSFastTrackingProducer.cc.

References FastReco(), pps_stationB, pps_stationF, and theCTPPSFastTrack.

Referenced by produce().

198 {
199  theCTPPSFastTrack.clear();
200  int Direction;
201  Direction=1; //cms positive Z / forward
202  FastReco(Direction,&*pps_stationF);
203  Direction=-1; //cms negative Z / backward
204  FastReco(Direction,&*pps_stationB);
205 }//end Reconstruction
void FastReco(int Direction, H_RecRPObject *station)
std::unique_ptr< H_RecRPObject > pps_stationB
std::unique_ptr< H_RecRPObject > pps_stationF
std::vector< CTPPSFastTrack > theCTPPSFastTrack
bool CTPPSFastTrackingProducer::SearchTrack ( int  i,
int  j,
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 
)
private

Definition at line 207 of file CTPPSFastTrackingProducer.cc.

References funct::cos(), fBeamEnergy, fBeamMomentum, fImpParcut, edm::detail::isnan(), LogDebug, m_verbosity, funct::pow(), pps_stationB, pps_stationF, CTPPSTrkDetector::ppsNHits_, CTPPSTrkDetector::ppsX_, CTPPSTrkDetector::ppsY_, ProjectToToF(), PPSTools::ProtonMassSQ, ReconstructArm(), mathSSE::sqrt(), relativeConstraints::station, theta(), TrkStation_B, TrkStation_F, um_to_cm, urad, globals_cff::x1, globals_cff::x2, and protons_cff::xi.

Referenced by FastReco().

208 {
209  // Given 1 hit in Tracker1 and 1 hit in Tracker2 try to make a track with Hector
210  double theta=0.;
211  xi = 0; t=0; partP=0; pt=0; x0=0.;y0=0.;xt =0.;yt =0.;X1d=0.;Y1d=0.;X2d=0.;Y2d=0.;
212  CTPPSTrkDetector* det1 = nullptr;
213  CTPPSTrkDetector* det2 = nullptr;
214  H_RecRPObject* station = nullptr;
215  // Separate in forward and backward stations according to direction
216  if (Direction>0) {
217  det1=&(TrkStation_F->first);det2=&(TrkStation_F->second);
218  station = &*pps_stationF;
219  } else {
220  det1=&(TrkStation_B->first);det2=&(TrkStation_B->second);
221  station = &*pps_stationB;
222  }
223  if (det1->ppsNHits_<=i||det2->ppsNHits_<=j) return false;
224 //
225  double x1 = det1->ppsX_.at(i); double y1 = det1->ppsY_.at(i);
226  double x2 = det2->ppsX_.at(j); double y2 = det2->ppsY_.at(j);
227  double eloss;
228 
229  //thx and thy are returned in microrad
230  ReconstructArm(station,Direction*x1,y1,Direction*x2,y2,thx,thy,eloss); // Pass the hits in the LHC ref. frame
231  thx*=-Direction;// invert to the CMS ref frame
232 
233  // Protect for unphysical results
234  if (std::isnan(eloss)||std::isinf(eloss)||
235  std::isnan(thx) || std::isinf(thx) ||
236  std::isnan(thy) || std::isinf(thy)) return false;
237  //
238 
239  if ( m_verbosity ) LogDebug("CTPPSFastTrackingProducer::SearchTrack:") << "thx " << thx << " thy " << thy << " eloss " << eloss;
240 
241  // Get the start point of the reconstructed track near the origin made by Hector in the CMS ref. frame
242  x0 = -Direction*station->getX0()*um_to_cm;
243  y0 = station->getY0()*um_to_cm;
244  double ImpPar=sqrt(x0*x0+y0*y0);
245  if (ImpPar>fImpParcut) return false;
246  if (eloss<0.||eloss>fBeamEnergy) return false;
247 //
248  // Calculate the reconstructed track parameters
249  theta = sqrt(thx*thx+thy*thy)*urad;
250  xi = eloss/fBeamEnergy;
251  double energy= fBeamEnergy*(1.-xi);
252  partP = sqrt(energy*energy-PPSTools::ProtonMassSQ);
253  t = -2.*(PPSTools::ProtonMassSQ- fBeamEnergy*energy + fBeamMomentum*partP*cos(theta));
254  pt = sqrt(pow(partP*thx*urad,2)+pow(partP*thy*urad,2));
255  if (xi<0.||xi>1.||t<0.||t>10.||pt<=0.) {
256  xi = 0.; t=0.; partP=0.; pt=0.; theta=0.; x0=0.;y0=0.;
257  return false; // unphysical values
258  }
259  //Try to include the timing detector in the track
260  ProjectToToF(x1, y1, x2, y2, xt, yt); // the projections is done in the CMS ref frame
261  X1d = x1;
262  Y1d = y1;
263  X2d = x2;
264  Y2d = y2;
265  return true;
266 }//end SearchTrack
#define LogDebug(id)
std::vector< double > ppsX_
Geom::Theta< T > theta() const
static const double urad
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< H_RecRPObject > pps_stationF
bool isnan(float x)
Definition: math.h:13
T sqrt(T t)
Definition: SSEVec.h:18
std::unique_ptr< CTPPSTrkStation > TrkStation_B
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
const double ProtonMassSQ
Definition: PPSUtilities.h:33
void ProjectToToF(const double x1, const double y1, const double x2, const double y2, double &xt, double &yt)
std::vector< double > ppsY_
std::unique_ptr< CTPPSTrkStation > TrkStation_F
static const double um_to_cm
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
bool CTPPSFastTrackingProducer::SetBeamLine ( )
private

Definition at line 382 of file CTPPSFastTrackingProducer.cc.

References beam1filename, beam2filename, DEFINE_FWK_MODULE, fz_tracker1, fz_tracker2, lengthctpps, m_beamlineCTPPS1, m_beamlineCTPPS2, pps_stationB, and pps_stationF.

Referenced by CTPPSFastTrackingProducer(), and ProjectToToF().

383 {
384  edm::FileInPath b1(beam1filename.c_str());
385  edm::FileInPath b2(beam2filename.c_str());
386  if (lengthctpps<=0) return false;
387  m_beamlineCTPPS1 = std::unique_ptr<H_BeamLine>(new H_BeamLine( -1, lengthctpps + 0.1)); // (direction, length)
388  m_beamlineCTPPS1->fill( b2.fullPath(), 1, "IP5");
389  m_beamlineCTPPS2 = std::unique_ptr<H_BeamLine>(new H_BeamLine( 1, lengthctpps + 0.1 )); //
390  m_beamlineCTPPS2->fill( b1.fullPath(), 1, "IP5");
391  m_beamlineCTPPS1->offsetElements( 120, 0.097 );
392  m_beamlineCTPPS2->offsetElements( 120,-0.097 );
393  pps_stationF = std::unique_ptr<H_RecRPObject>(new H_RecRPObject(fz_tracker1,fz_tracker2,*m_beamlineCTPPS1));
394  pps_stationB = std::unique_ptr<H_RecRPObject>(new H_RecRPObject(fz_tracker1,fz_tracker2,*m_beamlineCTPPS2));
395  return true;
396 }
std::unique_ptr< H_BeamLine > m_beamlineCTPPS1
std::unique_ptr< H_RecRPObject > pps_stationB
std::unique_ptr< H_RecRPObject > pps_stationF
std::unique_ptr< H_BeamLine > m_beamlineCTPPS2
void CTPPSFastTrackingProducer::TrackerStationClear ( )
private

Definition at line 147 of file CTPPSFastTrackingProducer.cc.

References TrkStation_B, and TrkStation_F.

Referenced by endEvent(), and produce().

147  {
148 
149  TrkStation_F->first.clear(); TrkStation_F->second.clear();
150  TrkStation_B->first.clear(); TrkStation_B->second.clear();
151 }
std::unique_ptr< CTPPSTrkStation > TrkStation_B
std::unique_ptr< CTPPSTrkStation > TrkStation_F
void CTPPSFastTrackingProducer::TrackerStationStarting ( )
private

Definition at line 153 of file CTPPSFastTrackingProducer.cc.

References det1B, det1F, det2B, det2F, detToF_B, and detToF_F.

Referenced by beginEvent(), and produce().

153  {
154  det1F->clear();
155  det1B->clear();
156  det2F->clear();
157  det2B->clear();
158  detToF_F->clear();
159  detToF_B->clear();
160 
161 }
std::unique_ptr< CTPPSTrkDetector > det2B
std::unique_ptr< CTPPSToFDetector > detToF_F
std::unique_ptr< CTPPSTrkDetector > det2F
std::unique_ptr< CTPPSTrkDetector > det1B
std::unique_ptr< CTPPSToFDetector > detToF_B
std::unique_ptr< CTPPSTrkDetector > det1F

Member Data Documentation

edm::EDGetTokenT< CTPPSFastRecHitContainer > CTPPSFastTrackingProducer::_recHitToken
private

Definition at line 71 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer(), and produce().

std::string CTPPSFastTrackingProducer::beam1filename
private

Definition at line 94 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer(), and SetBeamLine().

std::string CTPPSFastTrackingProducer::beam2filename
private

Definition at line 95 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer(), and SetBeamLine().

std::unique_ptr<CTPPSTrkDetector> CTPPSFastTrackingProducer::det1B
private
std::unique_ptr<CTPPSTrkDetector> CTPPSFastTrackingProducer::det1F
private
std::unique_ptr<CTPPSTrkDetector> CTPPSFastTrackingProducer::det2B
private
std::unique_ptr<CTPPSTrkDetector> CTPPSFastTrackingProducer::det2F
private
std::unique_ptr<CTPPSToFDetector> CTPPSFastTrackingProducer::detToF_B
private
std::unique_ptr<CTPPSToFDetector> CTPPSFastTrackingProducer::detToF_F
private
double CTPPSFastTrackingProducer::fBeamEnergy
private

Definition at line 100 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer(), FastReco(), and SearchTrack().

double CTPPSFastTrackingProducer::fBeamMomentum
private

Definition at line 101 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer(), FastReco(), and SearchTrack().

double CTPPSFastTrackingProducer::fBeamXRMS_ToF
private

Definition at line 127 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer(), and FastReco().

double CTPPSFastTrackingProducer::fBeamXRMS_Trk1
private

Definition at line 123 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer().

double CTPPSFastTrackingProducer::fBeamXRMS_Trk2
private

Definition at line 123 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer().

bool CTPPSFastTrackingProducer::fCrossAngleCorr
private

Definition at line 102 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer(), and FastReco().

double CTPPSFastTrackingProducer::fCrossingAngleBeam1
private

Definition at line 103 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer(), and FastReco().

double CTPPSFastTrackingProducer::fCrossingAngleBeam2
private

Definition at line 104 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer(), and FastReco().

double CTPPSFastTrackingProducer::fImpParcut
private

Definition at line 127 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer(), and SearchTrack().

double CTPPSFastTrackingProducer::fTimeSigma
private

Definition at line 127 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer(), and FastReco().

double CTPPSFastTrackingProducer::fToFCellHeight
private

Definition at line 125 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer(), and FastReco().

std::vector<double> CTPPSFastTrackingProducer::fToFCellWidth
private

Definition at line 124 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer(), and FastReco().

double CTPPSFastTrackingProducer::fToFInsertion
private

Definition at line 127 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer(), and FastReco().

int CTPPSFastTrackingProducer::fToFNCellX
private

Definition at line 126 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer(), and FastReco().

int CTPPSFastTrackingProducer::fToFNCellY
private

Definition at line 126 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer(), and FastReco().

double CTPPSFastTrackingProducer::fToFPitchX
private

Definition at line 125 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer(), and FastReco().

double CTPPSFastTrackingProducer::fToFPitchY
private

Definition at line 125 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer(), and FastReco().

double CTPPSFastTrackingProducer::fToFXOffset
private

Definition at line 127 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer(), and FastReco().

double CTPPSFastTrackingProducer::fTrackerHeight
private

Definition at line 123 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer().

double CTPPSFastTrackingProducer::fTrackerInsertion
private

Definition at line 123 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer().

double CTPPSFastTrackingProducer::fTrackerWidth
private

Definition at line 123 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer().

double CTPPSFastTrackingProducer::fTrk1XOffset
private

Definition at line 123 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer().

double CTPPSFastTrackingProducer::fTrk2XOffset
private

Definition at line 123 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer().

double CTPPSFastTrackingProducer::fz_timing
private

Definition at line 122 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer(), and ProjectToToF().

double CTPPSFastTrackingProducer::fz_tracker1
private
double CTPPSFastTrackingProducer::fz_tracker2
private
double CTPPSFastTrackingProducer::lengthctpps
private

Definition at line 98 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer(), and SetBeamLine().

std::unique_ptr<H_BeamLine> CTPPSFastTrackingProducer::m_beamlineCTPPS1
private

Definition at line 89 of file CTPPSFastTrackingProducer.h.

Referenced by SetBeamLine().

std::unique_ptr<H_BeamLine> CTPPSFastTrackingProducer::m_beamlineCTPPS2
private

Definition at line 90 of file CTPPSFastTrackingProducer.h.

Referenced by SetBeamLine().

std::map<unsigned int, H_BeamParticle*> CTPPSFastTrackingProducer::m_beamPart
private

Definition at line 88 of file CTPPSFastTrackingProducer.h.

Referenced by ~CTPPSFastTrackingProducer().

bool CTPPSFastTrackingProducer::m_verbosity
private

Definition at line 99 of file CTPPSFastTrackingProducer.h.

Referenced by CTPPSFastTrackingProducer(), and SearchTrack().

std::unique_ptr<H_RecRPObject> CTPPSFastTrackingProducer::pps_stationB
private

Definition at line 92 of file CTPPSFastTrackingProducer.h.

Referenced by Reconstruction(), SearchTrack(), and SetBeamLine().

std::unique_ptr<H_RecRPObject> CTPPSFastTrackingProducer::pps_stationF
private

Definition at line 91 of file CTPPSFastTrackingProducer.h.

Referenced by Reconstruction(), SearchTrack(), and SetBeamLine().

std::vector<int> CTPPSFastTrackingProducer::recCellId_B
private

Definition at line 119 of file CTPPSFastTrackingProducer.h.

Referenced by FastReco(), produce(), and ReadRecHits().

std::vector<int> CTPPSFastTrackingProducer::recCellId_F
private

Definition at line 119 of file CTPPSFastTrackingProducer.h.

Referenced by FastReco(), produce(), and ReadRecHits().

std::vector<double> CTPPSFastTrackingProducer::recTof_B
private

Definition at line 120 of file CTPPSFastTrackingProducer.h.

Referenced by FastReco(), produce(), and ReadRecHits().

std::vector<double> CTPPSFastTrackingProducer::recTof_F
private

Definition at line 120 of file CTPPSFastTrackingProducer.h.

Referenced by FastReco(), produce(), and ReadRecHits().

std::vector<CTPPSFastTrack> CTPPSFastTrackingProducer::theCTPPSFastTrack
private

Definition at line 115 of file CTPPSFastTrackingProducer.h.

Referenced by FastReco(), produce(), and Reconstruction().

CTPPSFastTrack CTPPSFastTrackingProducer::track
private

Definition at line 117 of file CTPPSFastTrackingProducer.h.

Referenced by FastReco().

std::unique_ptr<CTPPSTrkStation> CTPPSFastTrackingProducer::TrkStation_B
private
std::unique_ptr<CTPPSTrkStation> CTPPSFastTrackingProducer::TrkStation_F
private