CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
CTPPSDirectProtonSimulation Class Reference
Inheritance diagram for CTPPSDirectProtonSimulation:
edm::stream::EDProducer<>

Public Member Functions

 CTPPSDirectProtonSimulation (const edm::ParameterSet &)
 
 ~CTPPSDirectProtonSimulation () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void processProton (const HepMC::GenVertex *in_vtx, const HepMC::GenParticle *in_trk, const CTPPSGeometry &geometry, const LHCInfo &lhcInfo, const CTPPSBeamParameters &beamParameters, const LHCInterpolatedOpticalFunctionsSetCollection &opticalFunctions, std::vector< CTPPSLocalTrackLite > &out_tracks, edm::DetSetVector< TotemRPRecHit > &out_strip_hits, edm::DetSetVector< CTPPSPixelRecHit > &out_pixel_hits, edm::DetSetVector< CTPPSDiamondRecHit > &out_diamond_hits, std::map< int, edm::DetSetVector< TotemRPRecHit >> &out_strip_hits_per_particle, std::map< int, edm::DetSetVector< CTPPSPixelRecHit >> &out_pixel_hits_per_particle, std::map< int, edm::DetSetVector< CTPPSDiamondRecHit >> &out_diamond_hits_per_particle) const
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

bool checkApertures_
 simulation parameters More...
 
bool checkIsHit_
 
double empiricalAperture45_a_int_
 
double empiricalAperture45_a_slp_
 
double empiricalAperture45_xi0_int_
 
double empiricalAperture45_xi0_slp_
 
double empiricalAperture56_a_int_
 
double empiricalAperture56_a_slp_
 
double empiricalAperture56_xi0_int_
 
double empiricalAperture56_xi0_slp_
 
edm::EDGetTokenT< edm::HepMCProducthepMCToken_
 
double insensitiveMarginStrips_
 size of insensitive margin at sensor's edge facing the beam, in mm More...
 
std::string lhcInfoLabel_
 input More...
 
std::string opticsLabel_
 
double pitchPixelsHor_
 
double pitchPixelsVer_
 
double pitchStrips_
 strip pitch in mm More...
 
bool produceHitsRelativeToBeam_
 
bool produceRecHits_
 
bool produceScoringPlaneHits_
 flags what output to be produced More...
 
bool roundToPitch_
 
double stripZeroPosition_
 internal variable: v position of strip 0, in mm More...
 
bool useEmpiricalApertures_
 
unsigned int verbosity_
 

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

Definition at line 48 of file CTPPSDirectProtonSimulation.cc.

Constructor & Destructor Documentation

◆ CTPPSDirectProtonSimulation()

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

Definition at line 115 of file CTPPSDirectProtonSimulation.cc.

117  : lhcInfoLabel_(iConfig.getParameter<std::string>("lhcInfoLabel")),
118  opticsLabel_(iConfig.getParameter<std::string>("opticsLabel")),
119  hepMCToken_(consumes<edm::HepMCProduct>(iConfig.getParameter<edm::InputTag>("hepMCTag"))),
120 
121  produceScoringPlaneHits_(iConfig.getParameter<bool>("produceScoringPlaneHits")),
122  produceRecHits_(iConfig.getParameter<bool>("produceRecHits")),
123 
124  useEmpiricalApertures_(iConfig.getParameter<bool>("useEmpiricalApertures")),
125  empiricalAperture45_xi0_int_(iConfig.getParameter<double>("empiricalAperture45_xi0_int")),
126  empiricalAperture45_xi0_slp_(iConfig.getParameter<double>("empiricalAperture45_xi0_slp")),
127  empiricalAperture45_a_int_(iConfig.getParameter<double>("empiricalAperture45_a_int")),
128  empiricalAperture45_a_slp_(iConfig.getParameter<double>("empiricalAperture45_a_slp")),
129  empiricalAperture56_xi0_int_(iConfig.getParameter<double>("empiricalAperture56_xi0_int")),
130  empiricalAperture56_xi0_slp_(iConfig.getParameter<double>("empiricalAperture56_xi0_slp")),
131  empiricalAperture56_a_int_(iConfig.getParameter<double>("empiricalAperture56_a_int")),
132  empiricalAperture56_a_slp_(iConfig.getParameter<double>("empiricalAperture56_a_slp")),
133 
134  produceHitsRelativeToBeam_(iConfig.getParameter<bool>("produceHitsRelativeToBeam")),
135  roundToPitch_(iConfig.getParameter<bool>("roundToPitch")),
136  checkIsHit_(iConfig.getParameter<bool>("checkIsHit")),
137 
138  pitchStrips_(iConfig.getParameter<double>("pitchStrips")),
139  insensitiveMarginStrips_(iConfig.getParameter<double>("insensitiveMarginStrips")),
140 
141  pitchPixelsHor_(iConfig.getParameter<double>("pitchPixelsHor")),
142  pitchPixelsVer_(iConfig.getParameter<double>("pitchPixelsVer")),
143 
144  verbosity_(iConfig.getUntrackedParameter<unsigned int>("verbosity", 0)) {
146  produces<std::vector<CTPPSLocalTrackLite>>();
147 
148  if (produceRecHits_) {
149  produces<edm::DetSetVector<TotemRPRecHit>>();
150  produces<edm::DetSetVector<CTPPSDiamondRecHit>>();
151  produces<edm::DetSetVector<CTPPSPixelRecHit>>();
152 
153  produces<std::map<int, edm::DetSetVector<TotemRPRecHit>>>();
154  produces<std::map<int, edm::DetSetVector<CTPPSDiamondRecHit>>>();
155  produces<std::map<int, edm::DetSetVector<CTPPSPixelRecHit>>>();
156  }
157 
158  // v position of strip 0

References RPTopology::last_strip_to_border_dist_, RPTopology::no_of_strips_, RPTopology::pitch_, produceRecHits_, produceScoringPlaneHits_, stripZeroPosition_, and RPTopology::y_width_.

◆ ~CTPPSDirectProtonSimulation()

CTPPSDirectProtonSimulation::~CTPPSDirectProtonSimulation ( )
inlineoverride

Definition at line 54 of file CTPPSDirectProtonSimulation.cc.

56 :
57  void produce(edm::Event &, const edm::EventSetup &) override;

Member Function Documentation

◆ fillDescriptions()

void CTPPSDirectProtonSimulation::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 506 of file CTPPSDirectProtonSimulation.cc.

507  {
509  desc.addUntracked<unsigned int>("verbosity", 0);
510 
511  desc.add<std::string>("lhcInfoLabel", "")->setComment("label of the LHCInfo record");
512  desc.add<std::string>("opticsLabel", "")->setComment("label of the optics records");
513  desc.add<edm::InputTag>("hepMCTag", edm::InputTag("generator", "unsmeared"));
514 
515  desc.add<bool>("produceScoringPlaneHits", true);
516  desc.add<bool>("produceRecHits", true);
517 
518  desc.add<bool>("useEmpiricalApertures", false);
519  desc.add<double>("empiricalAperture45_xi0_int", 0.);
520  desc.add<double>("empiricalAperture45_xi0_slp", 0.);
521  desc.add<double>("empiricalAperture45_a_int", 0.);
522  desc.add<double>("empiricalAperture45_a_slp", 0.);
523  desc.add<double>("empiricalAperture56_xi0_int", 0.);
524  desc.add<double>("empiricalAperture56_xi0_slp", 0.);
525  desc.add<double>("empiricalAperture56_a_int", 0.);
526  desc.add<double>("empiricalAperture56_a_slp", 0.);
527 
528  desc.add<bool>("produceHitsRelativeToBeam", false);
529  desc.add<bool>("roundToPitch", true);
530  desc.add<bool>("checkIsHit", true);
531  desc.add<double>("pitchStrips", 66.e-3); // in mm
532  desc.add<double>("insensitiveMarginStrips", 34.e-3); // in mm
533 
534  desc.add<double>("pitchPixelsHor", 100.e-3)->setComment("x in local coordinates, in mm");
535  desc.add<double>("pitchPixelsVer", 150.e-3)->setComment("y in local coordinates, in mm");
536 
537  descriptions.add("ctppsDirectProtonSimulation", desc);

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), HLT_2018_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ processProton()

void CTPPSDirectProtonSimulation::processProton ( const HepMC::GenVertex *  in_vtx,
const HepMC::GenParticle *  in_trk,
const CTPPSGeometry geometry,
const LHCInfo lhcInfo,
const CTPPSBeamParameters beamParameters,
const LHCInterpolatedOpticalFunctionsSetCollection opticalFunctions,
std::vector< CTPPSLocalTrackLite > &  out_tracks,
edm::DetSetVector< TotemRPRecHit > &  out_strip_hits,
edm::DetSetVector< CTPPSPixelRecHit > &  out_pixel_hits,
edm::DetSetVector< CTPPSDiamondRecHit > &  out_diamond_hits,
std::map< int, edm::DetSetVector< TotemRPRecHit >> &  out_strip_hits_per_particle,
std::map< int, edm::DetSetVector< CTPPSPixelRecHit >> &  out_pixel_hits_per_particle,
std::map< int, edm::DetSetVector< CTPPSDiamondRecHit >> &  out_diamond_hits_per_particle 
) const
private

xi is positive for diffractive protons, thus proton momentum p = (1-xi) * p_nom horizontal component of proton momentum: p_x = th_x * (1-xi) * p_nom

Definition at line 241 of file CTPPSDirectProtonSimulation.cc.

255  {
258 
259  std::stringstream ssLog;
260 
261  // vectors in CMS convention
262  const HepMC::FourVector &vtx_cms = in_vtx->position(); // in mm
263  const HepMC::FourVector &mom_cms = in_trk->momentum();
264 
265  // transformation to LHC/TOTEM convention
266  HepMC::FourVector vtx_lhc(-vtx_cms.x(), vtx_cms.y(), -vtx_cms.z(), vtx_cms.t());
267  HepMC::FourVector mom_lhc(-mom_cms.x(), mom_cms.y(), -mom_cms.z(), mom_cms.t());
268 
269  // determine the LHC arm and related parameters
270  unsigned int arm = 3;
271  double z_sign;
272  double beamMomentum = 0.;
273  double xangle = 0.;
274  double empiricalAperture_xi0_int, empiricalAperture_xi0_slp;
275  double empiricalAperture_a_int, empiricalAperture_a_slp;
276 
277  if (mom_lhc.z() < 0) // sector 45
278  {
279  arm = 0;
280  z_sign = -1;
281  beamMomentum = beamParameters.getBeamMom45();
282  xangle = beamParameters.getHalfXangleX45();
283  empiricalAperture_xi0_int = empiricalAperture45_xi0_int_;
284  empiricalAperture_xi0_slp = empiricalAperture45_xi0_slp_;
285  empiricalAperture_a_int = empiricalAperture45_a_int_;
286  empiricalAperture_a_slp = empiricalAperture45_a_slp_;
287  } else { // sector 56
288  arm = 1;
289  z_sign = +1;
290  beamMomentum = beamParameters.getBeamMom56();
291  xangle = beamParameters.getHalfXangleX56();
292  empiricalAperture_xi0_int = empiricalAperture56_xi0_int_;
293  empiricalAperture_xi0_slp = empiricalAperture56_xi0_slp_;
294  empiricalAperture_a_int = empiricalAperture56_a_int_;
295  empiricalAperture_a_slp = empiricalAperture56_a_slp_;
296  }
297 
298  // calculate kinematics for optics parametrisation
299  const double p = mom_lhc.rho();
300  const double xi = 1. - p / beamMomentum;
301  const double th_x_phys = mom_lhc.x() / p;
302  const double th_y_phys = mom_lhc.y() / p;
303  const double vtx_lhc_eff_x = vtx_lhc.x() - vtx_lhc.z() * (mom_lhc.x() / mom_lhc.z() + xangle);
304  const double vtx_lhc_eff_y = vtx_lhc.y() - vtx_lhc.z() * (mom_lhc.y() / mom_lhc.z());
305 
306  if (verbosity_) {
307  ssLog << "simu: xi = " << xi << ", th_x_phys = " << th_x_phys << ", th_y_phys = " << th_y_phys
308  << ", vtx_lhc_eff_x = " << vtx_lhc_eff_x << ", vtx_lhc_eff_y = " << vtx_lhc_eff_y << std::endl;
309  }
310 
311  // check empirical aperture
313  const auto &xangle = lhcInfo.crossingAngle();
314  const double xi_th = (empiricalAperture_xi0_int + xangle * empiricalAperture_xi0_slp) +
315  (empiricalAperture_a_int + xangle * empiricalAperture_a_slp) * th_x_phys;
316 
317  if (xi > xi_th) {
318  if (verbosity_) {
319  ssLog << "stop because of empirical appertures";
320  edm::LogInfo("CTPPSDirectProtonSimulation") << ssLog.str();
321  }
322 
323  return;
324  }
325  }
326 
327  // transport the proton into each pot/scoring plane
328  for (const auto &ofp : opticalFunctions) {
329  CTPPSDetId rpId(ofp.first);
330  const unsigned int rpDecId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();
331 
332  // first check the arm
333  if (rpId.arm() != arm)
334  continue;
335 
336  if (verbosity_)
337  ssLog << " RP " << rpDecId << std::endl;
338 
339  // transport proton
341  vtx_lhc_eff_x * 1E-1, th_x_phys, vtx_lhc_eff_y * 1E-1, th_y_phys, xi}; // conversions: mm -> cm
343  ofp.second.transport(k_in, k_out, true);
344 
345  double b_x = k_out.x * 1E1, b_y = k_out.y * 1E1; // conversions: cm -> mm
346  double a_x = k_out.th_x, a_y = k_out.th_y;
347 
348  // if needed, subtract beam position and angle
350  // determine beam position
351  LHCInterpolatedOpticalFunctionsSet::Kinematics k_be_in = {0., 0., 0., 0., 0.};
353  ofp.second.transport(k_be_in, k_be_out, true);
354 
355  a_x -= k_be_out.th_x;
356  a_y -= k_be_out.th_y;
357  b_x -= k_be_out.x * 1E1;
358  b_y -= k_be_out.y * 1E1; // conversions: cm -> mm
359  }
360 
361  const double z_scoringPlane = ofp.second.getScoringPlaneZ() * 1E1; // conversion: cm --> mm
362 
363  if (verbosity_) {
364  ssLog << " proton transported: a_x = " << a_x << " rad, a_y = " << a_y << " rad, b_x = " << b_x
365  << " mm, b_y = " << b_y << " mm, z = " << z_scoringPlane << " mm" << std::endl;
366  }
367 
368  // save scoring plane hit
370  out_tracks.emplace_back(
371  rpId.rawId(), b_x, 0., b_y, 0., 0., 0., 0., 0., 0., CTPPSpixelLocalTrackReconstructionInfo::invalid, 0, 0., 0.);
372 
373  // stop if rec hits are not to be produced
374  if (!produceRecHits_)
375  continue;
376 
377  // loop over all sensors in the RP
378  for (const auto &detIdInt : geometry.sensorsInRP(rpId)) {
379  CTPPSDetId detId(detIdInt);
380 
381  // determine the track impact point (in global coordinates)
382  // !! this assumes that local axes (1, 0, 0) and (0, 1, 0) describe the sensor surface
383  const auto &gl_o = geometry.localToGlobal(detId, CTPPSGeometry::Vector(0, 0, 0));
384  const auto &gl_a1 = geometry.localToGlobal(detId, CTPPSGeometry::Vector(1, 0, 0)) - gl_o;
385  const auto &gl_a2 = geometry.localToGlobal(detId, CTPPSGeometry::Vector(0, 1, 0)) - gl_o;
386 
387  TMatrixD A(3, 3);
388  TVectorD B(3);
389  A(0, 0) = a_x;
390  A(0, 1) = -gl_a1.x();
391  A(0, 2) = -gl_a2.x();
392  B(0) = gl_o.x() - b_x;
393  A(1, 0) = a_y;
394  A(1, 1) = -gl_a1.y();
395  A(1, 2) = -gl_a2.y();
396  B(1) = gl_o.y() - b_y;
397  A(2, 0) = z_sign;
398  A(2, 1) = -gl_a1.z();
399  A(2, 2) = -gl_a2.z();
400  B(2) = gl_o.z() - z_scoringPlane;
401  TMatrixD Ai(3, 3);
402  Ai = A.Invert();
403  TVectorD P(3);
404  P = Ai * B;
405 
406  double ze = P(0);
407  const CTPPSGeometry::Vector h_glo(a_x * ze + b_x, a_y * ze + b_y, z_sign * ze + z_scoringPlane);
408 
409  // hit in local coordinates
410  auto h_loc = geometry.globalToLocal(detId, h_glo);
411 
412  if (verbosity_) {
413  ssLog << std::endl
414  << " de z = " << P(0) << " mm, p1 = " << P(1) << " mm, p2 = " << P(2) << " mm" << std::endl
415  << " h_glo: x = " << h_glo.x() << " mm, y = " << h_glo.y() << " mm, z = " << h_glo.z() << " mm"
416  << std::endl
417  << " h_loc: c1 = " << h_loc.x() << " mm, c2 = " << h_loc.y() << " mm, c3 = " << h_loc.z() << " mm"
418  << std::endl;
419  }
420 
421  // strips
422  if (detId.subdetId() == CTPPSDetId::sdTrackingStrip) {
423  double u = h_loc.x();
424  double v = h_loc.y();
425 
426  if (verbosity_ > 5)
427  ssLog << " u=" << u << ", v=" << v;
428 
429  // is it within detector?
431  if (verbosity_ > 5)
432  ssLog << " | no hit" << std::endl;
433  continue;
434  }
435 
436  // round the measurement
437  if (roundToPitch_) {
438  double m = stripZeroPosition_ - v;
439  signed int strip = (int)floor(m / pitchStrips_ + 0.5);
440 
442 
443  if (verbosity_ > 5)
444  ssLog << " | strip=" << strip;
445  }
446 
447  double sigma = pitchStrips_ / sqrt(12.);
448 
449  if (verbosity_ > 5)
450  ssLog << " | m=" << v << ", sigma=" << sigma << std::endl;
451 
452  edm::DetSet<TotemRPRecHit> &hits = out_strip_hits.find_or_insert(detId);
453  hits.push_back(TotemRPRecHit(v, sigma));
454 
455  edm::DetSet<TotemRPRecHit> &hits_per_particle =
456  out_strip_hits_per_particle[in_trk->barcode()].find_or_insert(detId);
457  hits_per_particle.push_back(TotemRPRecHit(v, sigma));
458  }
459 
460  // diamonds
461  if (detId.subdetId() == CTPPSDetId::sdTimingDiamond) {
462  throw cms::Exception("CTPPSDirectProtonSimulation") << "Diamonds are not yet supported.";
463  }
464 
465  // pixels
466  if (detId.subdetId() == CTPPSDetId::sdTrackingPixel) {
467  if (verbosity_) {
468  CTPPSPixelDetId pixelDetId(detIdInt);
469  ssLog << " pixel plane " << pixelDetId.plane() << ": local hit x = " << h_loc.x()
470  << " mm, y = " << h_loc.y() << " mm, z = " << h_loc.z() << " mm" << std::endl;
471  }
472 
473  bool module3By2 = (geometry.sensor(detIdInt)->sensorType() != DDD_CTPPS_PIXELS_SENSOR_TYPE_2x2);
474  if (checkIsHit_ && !CTPPSPixelTopology::isPixelHit(h_loc.x(), h_loc.y(), module3By2))
475  continue;
476 
477  if (roundToPitch_) {
478  h_loc.SetX(pitchPixelsHor_ * floor(h_loc.x() / pitchPixelsHor_ + 0.5));
479  h_loc.SetY(pitchPixelsVer_ * floor(h_loc.y() / pitchPixelsVer_ + 0.5));
480  }
481 
482  if (verbosity_ > 5)
483  ssLog << " hit accepted: m1 = " << h_loc.x() << " mm, m2 = " << h_loc.y() << " mm" << std::endl;
484 
485  const double sigmaHor = pitchPixelsHor_ / sqrt(12.);
486  const double sigmaVer = pitchPixelsVer_ / sqrt(12.);
487 
488  const LocalPoint lp(h_loc.x(), h_loc.y(), h_loc.z());
489  const LocalError le(sigmaHor, 0., sigmaVer);
490 
491  edm::DetSet<CTPPSPixelRecHit> &hits = out_pixel_hits.find_or_insert(detId);
492  hits.push_back(CTPPSPixelRecHit(lp, le));
493 
494  edm::DetSet<CTPPSPixelRecHit> &hits_per_particle =
495  out_pixel_hits_per_particle[in_trk->barcode()].find_or_insert(detId);
496  hits_per_particle.push_back(CTPPSPixelRecHit(lp, le));
497  }
498  }
499  }
500 
501  if (verbosity_)
502  edm::LogInfo("CTPPSDirectProtonSimulation") << ssLog.str();

References MaterialEffects_cfi::A, TtFullHadDaughter::B, checkIsHit_, LHCInfo::crossingAngle(), DDD_CTPPS_PIXELS_SENSOR_TYPE_2x2, empiricalAperture45_a_int_, empiricalAperture45_a_slp_, empiricalAperture45_xi0_int_, empiricalAperture45_xi0_slp_, empiricalAperture56_a_int_, empiricalAperture56_a_slp_, empiricalAperture56_xi0_int_, empiricalAperture56_xi0_slp_, Exception, edm::DetSetVector< T >::find_or_insert(), CTPPSBeamParameters::getBeamMom45(), CTPPSBeamParameters::getBeamMom56(), CTPPSBeamParameters::getHalfXangleX45(), CTPPSBeamParameters::getHalfXangleX56(), hfClusterShapes_cfi::hits, insensitiveMarginStrips_, createfilelist::int, invalid, RPTopology::IsHit(), CTPPSPixelTopology::isPixelHit(), visualization-live-secondInstance_cfg::m, OpticalFunctionsConfig_cfi::opticalFunctions, AlCaHLTBitMon_ParallelJobs::p, pitchPixelsHor_, pitchPixelsVer_, pitchStrips_, CTPPSPixelDetId::plane(), produceHitsRelativeToBeam_, produceRecHits_, produceScoringPlaneHits_, edm::DetSet< T >::push_back(), roundToPitch_, year_2016_postTS2_cff::rpId, CTPPSDetId::sdTimingDiamond, CTPPSDetId::sdTrackingPixel, CTPPSDetId::sdTrackingStrip, mathSSE::sqrt(), digitizers_cfi::strip, stripZeroPosition_, DetId::subdetId(), LHCInterpolatedOpticalFunctionsSet::Kinematics::th_x, LHCInterpolatedOpticalFunctionsSet::Kinematics::th_y, useEmpiricalApertures_, findQualityFiles::v, verbosity_, LHCInterpolatedOpticalFunctionsSet::Kinematics::x, OpticalFunctionsConfig_cfi::xangle, hybridSuperClusters_cfi::xi, and LHCInterpolatedOpticalFunctionsSet::Kinematics::y.

Referenced by produce().

◆ produce()

void CTPPSDirectProtonSimulation::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 164 of file CTPPSDirectProtonSimulation.cc.

165  {
166  // get input
168  iEvent.getByToken(hepMCToken_, hepmc_prod);
169 
170  // get conditions
171  edm::ESHandle<LHCInfo> hLHCInfo;
172  iSetup.get<LHCInfoRcd>().get(lhcInfoLabel_, hLHCInfo);
173 
174  edm::ESHandle<CTPPSBeamParameters> hBeamParameters;
175  iSetup.get<CTPPSBeamParametersRcd>().get(hBeamParameters);
176 
178  iSetup.get<CTPPSInterpolatedOpticsRcd>().get(opticsLabel_, hOpticalFunctions);
179 
182 
183  // prepare outputs
184  std::unique_ptr<edm::DetSetVector<TotemRPRecHit>> pStripRecHits(new edm::DetSetVector<TotemRPRecHit>());
185  std::unique_ptr<edm::DetSetVector<CTPPSDiamondRecHit>> pDiamondRecHits(new edm::DetSetVector<CTPPSDiamondRecHit>());
186  std::unique_ptr<edm::DetSetVector<CTPPSPixelRecHit>> pPixelRecHits(new edm::DetSetVector<CTPPSPixelRecHit>());
187 
188  auto pStripRecHitsPerParticle = std::make_unique<std::map<int, edm::DetSetVector<TotemRPRecHit>>>();
189  auto pDiamondRecHitsPerParticle = std::make_unique<std::map<int, edm::DetSetVector<CTPPSDiamondRecHit>>>();
190  auto pPixelRecHitsPerParticle = std::make_unique<std::map<int, edm::DetSetVector<CTPPSPixelRecHit>>>();
191 
192  std::unique_ptr<std::vector<CTPPSLocalTrackLite>> pTracks(new std::vector<CTPPSLocalTrackLite>());
193 
194  // loop over event vertices
195  auto evt = hepmc_prod->GetEvent();
196  for (auto it_vtx = evt->vertices_begin(); it_vtx != evt->vertices_end(); ++it_vtx) {
197  auto vtx = *(it_vtx);
198 
199  // loop over outgoing particles
200  for (auto it_part = vtx->particles_out_const_begin(); it_part != vtx->particles_out_const_end(); ++it_part) {
201  auto part = *(it_part);
202 
203  // accept only stable protons
204  if (part->pdg_id() != 2212)
205  continue;
206 
207  if (part->status() != 1 && part->status() < 83)
208  continue;
209 
211  part,
212  *geometry,
213  *hLHCInfo,
214  *hBeamParameters,
215  *hOpticalFunctions,
216  *pTracks,
217  *pStripRecHits,
218  *pPixelRecHits,
219  *pDiamondRecHits,
220  *pStripRecHitsPerParticle,
221  *pPixelRecHitsPerParticle,
222  *pDiamondRecHitsPerParticle);
223  }
224  }
225 
227  iEvent.put(std::move(pTracks));
228 
229  if (produceRecHits_) {
230  iEvent.put(std::move(pStripRecHits));
231  iEvent.put(std::move(pPixelRecHits));
232  iEvent.put(std::move(pDiamondRecHits));
233 
234  iEvent.put(std::move(pStripRecHitsPerParticle));
235  iEvent.put(std::move(pPixelRecHitsPerParticle));
236  iEvent.put(std::move(pDiamondRecHitsPerParticle));
237  }

References geometry, edm::EventSetup::get(), get, edm::HepMCProduct::GetEvent(), hepMCToken_, iEvent, lhcInfoLabel_, eostools::move(), opticsLabel_, processProton(), produceRecHits_, produceScoringPlaneHits_, and badGlobalMuonTaggersAOD_cff::vtx.

Member Data Documentation

◆ checkApertures_

bool CTPPSDirectProtonSimulation::checkApertures_
private

simulation parameters

Definition at line 90 of file CTPPSDirectProtonSimulation.cc.

◆ checkIsHit_

bool CTPPSDirectProtonSimulation::checkIsHit_
private

Definition at line 100 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ empiricalAperture45_a_int_

double CTPPSDirectProtonSimulation::empiricalAperture45_a_int_
private

Definition at line 93 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ empiricalAperture45_a_slp_

double CTPPSDirectProtonSimulation::empiricalAperture45_a_slp_
private

Definition at line 93 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ empiricalAperture45_xi0_int_

double CTPPSDirectProtonSimulation::empiricalAperture45_xi0_int_
private

Definition at line 93 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ empiricalAperture45_xi0_slp_

double CTPPSDirectProtonSimulation::empiricalAperture45_xi0_slp_
private

Definition at line 93 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ empiricalAperture56_a_int_

double CTPPSDirectProtonSimulation::empiricalAperture56_a_int_
private

Definition at line 95 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ empiricalAperture56_a_slp_

double CTPPSDirectProtonSimulation::empiricalAperture56_a_slp_
private

Definition at line 95 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ empiricalAperture56_xi0_int_

double CTPPSDirectProtonSimulation::empiricalAperture56_xi0_int_
private

Definition at line 95 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ empiricalAperture56_xi0_slp_

double CTPPSDirectProtonSimulation::empiricalAperture56_xi0_slp_
private

Definition at line 95 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ hepMCToken_

edm::EDGetTokenT<edm::HepMCProduct> CTPPSDirectProtonSimulation::hepMCToken_
private

Definition at line 83 of file CTPPSDirectProtonSimulation.cc.

Referenced by produce().

◆ insensitiveMarginStrips_

double CTPPSDirectProtonSimulation::insensitiveMarginStrips_
private

size of insensitive margin at sensor's edge facing the beam, in mm

Definition at line 103 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ lhcInfoLabel_

std::string CTPPSDirectProtonSimulation::lhcInfoLabel_
private

input

Definition at line 80 of file CTPPSDirectProtonSimulation.cc.

Referenced by produce().

◆ opticsLabel_

std::string CTPPSDirectProtonSimulation::opticsLabel_
private

Definition at line 81 of file CTPPSDirectProtonSimulation.cc.

Referenced by produce().

◆ pitchPixelsHor_

double CTPPSDirectProtonSimulation::pitchPixelsHor_
private

Definition at line 105 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ pitchPixelsVer_

double CTPPSDirectProtonSimulation::pitchPixelsVer_
private

Definition at line 106 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ pitchStrips_

double CTPPSDirectProtonSimulation::pitchStrips_
private

strip pitch in mm

Definition at line 102 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ produceHitsRelativeToBeam_

bool CTPPSDirectProtonSimulation::produceHitsRelativeToBeam_
private

Definition at line 98 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ produceRecHits_

bool CTPPSDirectProtonSimulation::produceRecHits_
private

◆ produceScoringPlaneHits_

bool CTPPSDirectProtonSimulation::produceScoringPlaneHits_
private

flags what output to be produced

Definition at line 86 of file CTPPSDirectProtonSimulation.cc.

Referenced by CTPPSDirectProtonSimulation(), processProton(), and produce().

◆ roundToPitch_

bool CTPPSDirectProtonSimulation::roundToPitch_
private

Definition at line 99 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ stripZeroPosition_

double CTPPSDirectProtonSimulation::stripZeroPosition_
private

internal variable: v position of strip 0, in mm

Definition at line 113 of file CTPPSDirectProtonSimulation.cc.

Referenced by CTPPSDirectProtonSimulation(), and processProton().

◆ useEmpiricalApertures_

bool CTPPSDirectProtonSimulation::useEmpiricalApertures_
private

Definition at line 92 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ verbosity_

unsigned int CTPPSDirectProtonSimulation::verbosity_
private

Definition at line 108 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

CTPPSDirectProtonSimulation::empiricalAperture56_a_slp_
double empiricalAperture56_a_slp_
Definition: CTPPSDirectProtonSimulation.cc:95
TotemRPRecHit
Reconstructed hit in TOTEM RP.
Definition: TotemRPRecHit.h:17
edm::DetSet::push_back
void push_back(const T &t)
Definition: DetSet.h:66
edm::DetSetVector< TotemRPRecHit >
RPTopology::y_width_
static const double y_width_
Definition: RPTopology.h:60
geometry
ESHandle< TrackerGeometry > geometry
Definition: TkLasBeamFitter.cc:200
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
CTPPSPixelRecHit
Definition: CTPPSPixelRecHit.h:17
LHCInterpolatedOpticalFunctionsSet::Kinematics
proton kinematics description
Definition: LHCInterpolatedOpticalFunctionsSet.h:28
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
edm::DetSet
Definition: DetSet.h:23
CTPPSDirectProtonSimulation::insensitiveMarginStrips_
double insensitiveMarginStrips_
size of insensitive margin at sensor's edge facing the beam, in mm
Definition: CTPPSDirectProtonSimulation.cc:103
CTPPSDirectProtonSimulation::empiricalAperture56_a_int_
double empiricalAperture56_a_int_
Definition: CTPPSDirectProtonSimulation.cc:95
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CTPPSBeamParameters::getHalfXangleX56
double getHalfXangleX56() const
Definition: CTPPSBeamParameters.cc:67
geometry
Definition: geometry.py:1
hybridSuperClusters_cfi.xi
xi
Definition: hybridSuperClusters_cfi.py:10
edm::LogInfo
Definition: MessageLogger.h:254
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
CTPPSBeamParameters::getBeamMom56
double getBeamMom56() const
Definition: CTPPSBeamParameters.cc:53
CTPPSBeamParameters::getHalfXangleX45
double getHalfXangleX45() const
Definition: CTPPSBeamParameters.cc:65
CTPPSPixelTopology::isPixelHit
static bool isPixelHit(float xLocalCoordinate, float yLocalCoordinate, bool is3x2=true)
Definition: CTPPSPixelTopology.h:39
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
findQualityFiles.v
v
Definition: findQualityFiles.py:179
CTPPSpixelLocalTrackReconstructionInfo::invalid
DDD_CTPPS_PIXELS_SENSOR_TYPE_2x2
const std::string DDD_CTPPS_PIXELS_SENSOR_TYPE_2x2
Definition: CTPPSDDDNames.h:15
year_2016_postTS2_cff.rpId
rpId
Definition: year_2016_postTS2_cff.py:23
edm::Handle< edm::HepMCProduct >
CTPPSDirectProtonSimulation::empiricalAperture45_xi0_int_
double empiricalAperture45_xi0_int_
Definition: CTPPSDirectProtonSimulation.cc:93
CTPPSDirectProtonSimulation::empiricalAperture45_a_slp_
double empiricalAperture45_a_slp_
Definition: CTPPSDirectProtonSimulation.cc:93
CTPPSDetId::sdTrackingStrip
Definition: CTPPSDetId.h:44
CTPPSDirectProtonSimulation::roundToPitch_
bool roundToPitch_
Definition: CTPPSDirectProtonSimulation.cc:99
part
part
Definition: HCALResponse.h:20
CTPPSDirectProtonSimulation::stripZeroPosition_
double stripZeroPosition_
internal variable: v position of strip 0, in mm
Definition: CTPPSDirectProtonSimulation.cc:113
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
CTPPSDirectProtonSimulation::empiricalAperture45_a_int_
double empiricalAperture45_a_int_
Definition: CTPPSDirectProtonSimulation.cc:93
LHCInfo::crossingAngle
const float crossingAngle() const
Definition: LHCInfo.cc:182
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
RPTopology::last_strip_to_border_dist_
static const double last_strip_to_border_dist_
Definition: RPTopology.h:62
LHCInterpolatedOpticalFunctionsSet::Kinematics::y
double y
Definition: LHCInterpolatedOpticalFunctionsSet.h:31
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
CTPPSDirectProtonSimulation::hepMCToken_
edm::EDGetTokenT< edm::HepMCProduct > hepMCToken_
Definition: CTPPSDirectProtonSimulation.cc:83
CTPPSDirectProtonSimulation::produceRecHits_
bool produceRecHits_
Definition: CTPPSDirectProtonSimulation.cc:87
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
CTPPSDirectProtonSimulation::pitchStrips_
double pitchStrips_
strip pitch in mm
Definition: CTPPSDirectProtonSimulation.cc:102
edm::ESHandle< LHCInfo >
CTPPSDetId::sdTimingDiamond
Definition: CTPPSDetId.h:44
LHCInterpolatedOpticalFunctionsSet::Kinematics::x
double x
Definition: LHCInterpolatedOpticalFunctionsSet.h:29
LHCInfoRcd
Definition: LHCInfoRcd.h:24
Point3DBase< float, LocalTag >
CTPPSDetId::sdTrackingPixel
Definition: CTPPSDetId.h:44
CTPPSDirectProtonSimulation::lhcInfoLabel_
std::string lhcInfoLabel_
input
Definition: CTPPSDirectProtonSimulation.cc:80
CTPPSDirectProtonSimulation::pitchPixelsHor_
double pitchPixelsHor_
Definition: CTPPSDirectProtonSimulation.cc:105
badGlobalMuonTaggersAOD_cff.vtx
vtx
Definition: badGlobalMuonTaggersAOD_cff.py:5
CTPPSDirectProtonSimulation::verbosity_
unsigned int verbosity_
Definition: CTPPSDirectProtonSimulation.cc:108
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
OpticalFunctionsConfig_cfi.xangle
xangle
Definition: OpticalFunctionsConfig_cfi.py:17
CTPPSDirectProtonSimulation::checkIsHit_
bool checkIsHit_
Definition: CTPPSDirectProtonSimulation.cc:100
CTPPSDirectProtonSimulation::produceHitsRelativeToBeam_
bool produceHitsRelativeToBeam_
Definition: CTPPSDirectProtonSimulation.cc:98
LHCInterpolatedOpticalFunctionsSet::Kinematics::th_y
double th_y
Definition: LHCInterpolatedOpticalFunctionsSet.h:32
edm::ParameterSetDescription::addUntracked
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:100
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
CTPPSDirectProtonSimulation::empiricalAperture56_xi0_int_
double empiricalAperture56_xi0_int_
Definition: CTPPSDirectProtonSimulation.cc:95
RPTopology::pitch_
static const double pitch_
Definition: RPTopology.h:56
LocalError
Definition: LocalError.h:12
CTPPSDirectProtonSimulation::produceScoringPlaneHits_
bool produceScoringPlaneHits_
flags what output to be produced
Definition: CTPPSDirectProtonSimulation.cc:86
A
CTPPSDetId
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:31
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
CTPPSDirectProtonSimulation::empiricalAperture45_xi0_slp_
double empiricalAperture45_xi0_slp_
Definition: CTPPSDirectProtonSimulation.cc:93
RPTopology::IsHit
static bool IsHit(double u, double v, double insensitiveMargin=0)
Definition: RPTopology.cc:28
RPTopology::no_of_strips_
static const unsigned short no_of_strips_
Definition: RPTopology.h:58
edm::EventSetup
Definition: EventSetup.h:57
edm::HepMCProduct::GetEvent
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:34
CTPPSBeamParameters::getBeamMom45
double getBeamMom45() const
Definition: CTPPSBeamParameters.cc:52
CTPPSPixelDetId
Definition: CTPPSPixelDetId.h:16
get
#define get
CTPPSDirectProtonSimulation::pitchPixelsVer_
double pitchPixelsVer_
Definition: CTPPSDirectProtonSimulation.cc:106
CTPPSBeamParametersRcd
Definition: CTPPSBeamParametersRcd.h:14
CTPPSDirectProtonSimulation::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: CTPPSDirectProtonSimulation.cc:164
VeryForwardMisalignedGeometryRecord
Event setup record containing the misaligned geometry information. It is used for alignment studies o...
Definition: VeryForwardMisalignedGeometryRecord.h:23
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
TtFullHadDaughter::B
static const std::string B
Definition: TtFullHadronicEvent.h:9
MaterialEffects_cfi.A
A
Definition: MaterialEffects_cfi.py:11
eostools.move
def move(src, dest)
Definition: eostools.py:511
Exception
Definition: hltDiff.cc:246
edm::DetSetVector::find_or_insert
reference find_or_insert(det_id_type id)
Definition: DetSetVector.h:234
CTPPSDirectProtonSimulation::processProton
void processProton(const HepMC::GenVertex *in_vtx, const HepMC::GenParticle *in_trk, const CTPPSGeometry &geometry, const LHCInfo &lhcInfo, const CTPPSBeamParameters &beamParameters, const LHCInterpolatedOpticalFunctionsSetCollection &opticalFunctions, std::vector< CTPPSLocalTrackLite > &out_tracks, edm::DetSetVector< TotemRPRecHit > &out_strip_hits, edm::DetSetVector< CTPPSPixelRecHit > &out_pixel_hits, edm::DetSetVector< CTPPSDiamondRecHit > &out_diamond_hits, std::map< int, edm::DetSetVector< TotemRPRecHit >> &out_strip_hits_per_particle, std::map< int, edm::DetSetVector< CTPPSPixelRecHit >> &out_pixel_hits_per_particle, std::map< int, edm::DetSetVector< CTPPSDiamondRecHit >> &out_diamond_hits_per_particle) const
Definition: CTPPSDirectProtonSimulation.cc:241
LHCInterpolatedOpticalFunctionsSet::Kinematics::th_x
double th_x
Definition: LHCInterpolatedOpticalFunctionsSet.h:30
CTPPSDirectProtonSimulation::empiricalAperture56_xi0_slp_
double empiricalAperture56_xi0_slp_
Definition: CTPPSDirectProtonSimulation.cc:95
P
std::pair< OmniClusterRef, TrackingParticleRef > P
Definition: BDHadronTrackMonitoringAnalyzer.cc:202
edm::Event
Definition: Event.h:73
CTPPSDirectProtonSimulation::opticsLabel_
std::string opticsLabel_
Definition: CTPPSDirectProtonSimulation.cc:81
edm::InputTag
Definition: InputTag.h:15
OpticalFunctionsConfig_cfi.opticalFunctions
opticalFunctions
Definition: OpticalFunctionsConfig_cfi.py:16
CTPPSDirectProtonSimulation::useEmpiricalApertures_
bool useEmpiricalApertures_
Definition: CTPPSDirectProtonSimulation.cc:92
CTPPSInterpolatedOpticsRcd
Definition: CTPPSInterpolatedOpticsRcd.h:13
CTPPSGeometry::Vector
DetGeomDesc::Translation Vector
Definition: CTPPSGeometry.h:39