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 hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () 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, CLHEP::HepRandomEngine *rndEngine, 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_
 
std::unique_ptr< TF2 > empiricalAperture45_
 
std::unique_ptr< TF2 > empiricalAperture56_
 
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...
 
std::unique_ptr< TF1 > timeResolutionDiamonds45_
 
std::unique_ptr< TF1 > timeResolutionDiamonds56_
 x-dependent time resolution of diamonds (per rec hit) in ns 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 57 of file CTPPSDirectProtonSimulation.cc.

Constructor & Destructor Documentation

◆ CTPPSDirectProtonSimulation()

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

Definition at line 128 of file CTPPSDirectProtonSimulation.cc.

130  : lhcInfoLabel_(iConfig.getParameter<std::string>("lhcInfoLabel")),
131  opticsLabel_(iConfig.getParameter<std::string>("opticsLabel")),
132  hepMCToken_(consumes<edm::HepMCProduct>(iConfig.getParameter<edm::InputTag>("hepMCTag"))),
133 
134  produceScoringPlaneHits_(iConfig.getParameter<bool>("produceScoringPlaneHits")),
135  produceRecHits_(iConfig.getParameter<bool>("produceRecHits")),
136 
137  useEmpiricalApertures_(iConfig.getParameter<bool>("useEmpiricalApertures")),
139  new TF2("empiricalAperture45", iConfig.getParameter<std::string>("empiricalAperture45").c_str())),
141  new TF2("empiricalAperture56", iConfig.getParameter<std::string>("empiricalAperture56").c_str())),
142 
143  produceHitsRelativeToBeam_(iConfig.getParameter<bool>("produceHitsRelativeToBeam")),
144  roundToPitch_(iConfig.getParameter<bool>("roundToPitch")),
145  checkIsHit_(iConfig.getParameter<bool>("checkIsHit")),
146 
147  pitchStrips_(iConfig.getParameter<double>("pitchStrips")),
148  insensitiveMarginStrips_(iConfig.getParameter<double>("insensitiveMarginStrips")),
149 
150  pitchPixelsHor_(iConfig.getParameter<double>("pitchPixelsHor")),
151  pitchPixelsVer_(iConfig.getParameter<double>("pitchPixelsVer")),
152 
154  new TF1("timeResolutionDiamonds45", iConfig.getParameter<std::string>("timeResolutionDiamonds45").c_str())),
156  new TF1("timeResolutionDiamonds56", iConfig.getParameter<std::string>("timeResolutionDiamonds56").c_str())),
157 
158  verbosity_(iConfig.getUntrackedParameter<unsigned int>("verbosity", 0)) {
160  produces<std::vector<CTPPSLocalTrackLite>>();
161 
162  if (produceRecHits_) {
163  produces<edm::DetSetVector<TotemRPRecHit>>();
164  produces<edm::DetSetVector<CTPPSDiamondRecHit>>();
165  produces<edm::DetSetVector<CTPPSPixelRecHit>>();
166 
167  produces<std::map<int, edm::DetSetVector<TotemRPRecHit>>>();
168  produces<std::map<int, edm::DetSetVector<CTPPSDiamondRecHit>>>();
169  produces<std::map<int, edm::DetSetVector<CTPPSPixelRecHit>>>();
170  }
171 
172  // 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 63 of file CTPPSDirectProtonSimulation.cc.

65 :
66  void produce(edm::Event &, const edm::EventSetup &) override;

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 178 of file CTPPSDirectProtonSimulation.cc.

179  {
181  desc.addUntracked<unsigned int>("verbosity", 0);
182 
183  desc.add<std::string>("lhcInfoLabel", "")->setComment("label of the LHCInfo record");
184  desc.add<std::string>("opticsLabel", "")->setComment("label of the optics records");
185  desc.add<edm::InputTag>("hepMCTag", edm::InputTag("generator", "unsmeared"));
186 
187  desc.add<bool>("produceScoringPlaneHits", true);
188  desc.add<bool>("produceRecHits", true);
189 
190  desc.add<bool>("useEmpiricalApertures", false);
191  desc.add<std::string>("empiricalAperture45", "0")->setComment("2D function of xi and xangle for cutoff on sec 45");
192  desc.add<std::string>("empiricalAperture56", "0")->setComment("2D function of xi and xangle for cutoff on sec 56");
193 
194  desc.add<bool>("produceHitsRelativeToBeam", false);
195  desc.add<bool>("roundToPitch", true);
196  desc.add<bool>("checkIsHit", true);
197  desc.add<double>("pitchStrips", 66.e-3); // in mm
198  desc.add<double>("insensitiveMarginStrips", 34.e-3); // in mm
199 
200  desc.add<double>("pitchPixelsHor", 100.e-3);
201  desc.add<double>("pitchPixelsVer", 150.e-3);
202 
203  desc.add<std::string>("timeResolutionDiamonds45", "0.200")
204  ->setComment("time resolution of single diamond sensor in sector 45, in ns");
205  desc.add<std::string>("timeResolutionDiamonds56", "0.200")
206  ->setComment("time resolution of single diamond sensor in sector 56, in ns");
207 
208  descriptions.add("ctppsDirectProtonSimulation", desc);

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, HLT_FULL_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,
CLHEP::HepRandomEngine *  rndEngine,
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 294 of file CTPPSDirectProtonSimulation.cc.

309  {
312 
313  std::stringstream ssLog;
314 
315  // vectors in CMS convention
316  const HepMC::FourVector &vtx_cms = in_vtx->position(); // in mm
317  const HepMC::FourVector &mom_cms = in_trk->momentum();
318 
319  // transformation to LHC/TOTEM convention
320  HepMC::FourVector vtx_lhc(-vtx_cms.x(), vtx_cms.y(), -vtx_cms.z(), vtx_cms.t());
321  HepMC::FourVector mom_lhc(-mom_cms.x(), mom_cms.y(), -mom_cms.z(), mom_cms.t());
322 
323  // determine the LHC arm and related parameters
324  unsigned int arm = 3;
325  double z_sign;
326  double beamMomentum = 0.;
327  double xangle = 0.;
328  const std::unique_ptr<TF2> *empiricalAperture;
329  if (mom_lhc.z() < 0) // sector 45
330  {
331  arm = 0;
332  z_sign = -1;
333  beamMomentum = beamParameters.getBeamMom45();
334  xangle = beamParameters.getHalfXangleX45();
335  empiricalAperture = &empiricalAperture45_;
336  } else { // sector 56
337  arm = 1;
338  z_sign = +1;
339  beamMomentum = beamParameters.getBeamMom56();
340  xangle = beamParameters.getHalfXangleX56();
341  empiricalAperture = &empiricalAperture56_;
342  }
343 
344  // calculate effective RP arrival time
345  // effective time mimics the timing calibration -> effective times are distributed about 0
346  // units:
347  // vertex: all components in mm
348  // c_light: in mm/ns
349  // time_eff: in ns
350  const double time_eff = (vtx_lhc.t() - z_sign * vtx_lhc.z()) / CLHEP::c_light;
351 
352  // calculate kinematics for optics parametrisation
353  const double p = mom_lhc.rho();
354  const double xi = 1. - p / beamMomentum;
355  const double th_x_phys = mom_lhc.x() / p;
356  const double th_y_phys = mom_lhc.y() / p;
357  const double vtx_lhc_eff_x = vtx_lhc.x() - vtx_lhc.z() * (mom_lhc.x() / mom_lhc.z() + xangle);
358  const double vtx_lhc_eff_y = vtx_lhc.y() - vtx_lhc.z() * (mom_lhc.y() / mom_lhc.z());
359 
360  if (verbosity_) {
361  ssLog << "simu: xi = " << xi << ", th_x_phys = " << th_x_phys << ", th_y_phys = " << th_y_phys
362  << ", vtx_lhc_eff_x = " << vtx_lhc_eff_x << ", vtx_lhc_eff_y = " << vtx_lhc_eff_y << std::endl;
363  }
364 
365  // check empirical aperture
367  const auto &xangle = lhcInfo.crossingAngle();
368  (*empiricalAperture)->SetParameter("xi", xi);
369  (*empiricalAperture)->SetParameter("xangle", xangle);
370  const double th_x_th = (*empiricalAperture)->EvalPar(nullptr);
371 
372  if (th_x_th > th_x_phys) {
373  if (verbosity_) {
374  ssLog << "stop because of empirical appertures";
375  edm::LogInfo("CTPPSDirectProtonSimulation") << ssLog.str();
376  }
377 
378  return;
379  }
380  }
381 
382  // transport the proton into each pot/scoring plane
383  for (const auto &ofp : opticalFunctions) {
384  CTPPSDetId rpId(ofp.first);
385  const unsigned int rpDecId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();
386 
387  // first check the arm
388  if (rpId.arm() != arm)
389  continue;
390 
391  if (verbosity_)
392  ssLog << " RP " << rpDecId << std::endl;
393 
394  // transport proton
396  vtx_lhc_eff_x * 1E-1, th_x_phys, vtx_lhc_eff_y * 1E-1, th_y_phys, xi}; // conversions: mm -> cm
398  ofp.second.transport(k_in, k_out, true);
399 
400  double b_x = k_out.x * 1E1, b_y = k_out.y * 1E1; // conversions: cm -> mm
401  double a_x = k_out.th_x, a_y = k_out.th_y;
402 
403  // if needed, subtract beam position and angle
405  // determine beam position
406  LHCInterpolatedOpticalFunctionsSet::Kinematics k_be_in = {0., 0., 0., 0., 0.};
408  ofp.second.transport(k_be_in, k_be_out, true);
409 
410  a_x -= k_be_out.th_x;
411  a_y -= k_be_out.th_y;
412  b_x -= k_be_out.x * 1E1;
413  b_y -= k_be_out.y * 1E1; // conversions: cm -> mm
414  }
415 
416  const double z_scoringPlane = ofp.second.getScoringPlaneZ() * 1E1; // conversion: cm --> mm
417 
418  if (verbosity_) {
419  ssLog << " proton transported: a_x = " << a_x << " rad, a_y = " << a_y << " rad, b_x = " << b_x
420  << " mm, b_y = " << b_y << " mm, z = " << z_scoringPlane << " mm" << std::endl;
421  }
422 
423  // save scoring plane hit
425  out_tracks.emplace_back(
426  rpId.rawId(), b_x, 0., b_y, 0., 0., 0., 0., 0., 0., CTPPSpixelLocalTrackReconstructionInfo::invalid, 0, 0., 0.);
427 
428  // stop if rec hits are not to be produced
429  if (!produceRecHits_)
430  continue;
431 
432  // loop over all sensors in the RP
433  for (const auto &detIdInt : geometry.sensorsInRP(rpId)) {
434  CTPPSDetId detId(detIdInt);
435 
436  // determine the track impact point (in global coordinates)
437  // !! this assumes that local axes (1, 0, 0) and (0, 1, 0) describe the sensor surface
438  const auto &gl_o = geometry.localToGlobal(detId, CTPPSGeometry::Vector(0, 0, 0));
439  const auto &gl_a1 = geometry.localToGlobal(detId, CTPPSGeometry::Vector(1, 0, 0)) - gl_o;
440  const auto &gl_a2 = geometry.localToGlobal(detId, CTPPSGeometry::Vector(0, 1, 0)) - gl_o;
441 
442  double gl_o_z = gl_o.z();
443  if (detId.subdetId() == CTPPSDetId::sdTimingDiamond)
444  gl_o_z = -gl_o_z; // fix bug in diamond geometry
445 
446  TMatrixD A(3, 3);
447  TVectorD B(3);
448  A(0, 0) = a_x;
449  A(0, 1) = -gl_a1.x();
450  A(0, 2) = -gl_a2.x();
451  B(0) = gl_o.x() - b_x;
452  A(1, 0) = a_y;
453  A(1, 1) = -gl_a1.y();
454  A(1, 2) = -gl_a2.y();
455  B(1) = gl_o.y() - b_y;
456  A(2, 0) = z_sign;
457  A(2, 1) = -gl_a1.z();
458  A(2, 2) = -gl_a2.z();
459  B(2) = gl_o_z - z_scoringPlane;
460  TMatrixD Ai(3, 3);
461  Ai = A.Invert();
462  TVectorD P(3);
463  P = Ai * B;
464 
465  double ze = P(0);
466  const CTPPSGeometry::Vector h_glo(a_x * ze + b_x, a_y * ze + b_y, z_sign * ze + z_scoringPlane);
467 
468  // hit in local coordinates
469  auto h_loc = geometry.globalToLocal(detId, h_glo);
470 
471  if (verbosity_) {
472  ssLog << std::endl
473  << " de z = " << P(0) << " mm, p1 = " << P(1) << " mm, p2 = " << P(2) << " mm" << std::endl
474  << " h_glo: x = " << h_glo.x() << " mm, y = " << h_glo.y() << " mm, z = " << h_glo.z() << " mm"
475  << std::endl
476  << " h_loc: c1 = " << h_loc.x() << " mm, c2 = " << h_loc.y() << " mm, c3 = " << h_loc.z() << " mm"
477  << std::endl;
478  }
479 
480  // strips
481  if (detId.subdetId() == CTPPSDetId::sdTrackingStrip) {
482  double u = h_loc.x();
483  double v = h_loc.y();
484 
485  if (verbosity_ > 5)
486  ssLog << " u=" << u << ", v=" << v;
487 
488  // is it within detector?
490  if (verbosity_ > 5)
491  ssLog << " | no hit" << std::endl;
492  continue;
493  }
494 
495  // round the measurement
496  if (roundToPitch_) {
497  double m = stripZeroPosition_ - v;
498  signed int strip = (int)floor(m / pitchStrips_ + 0.5);
499 
501 
502  if (verbosity_ > 5)
503  ssLog << " | strip=" << strip;
504  }
505 
506  double sigma = pitchStrips_ / sqrt(12.);
507 
508  if (verbosity_ > 5)
509  ssLog << " | m=" << v << ", sigma=" << sigma << std::endl;
510 
511  edm::DetSet<TotemRPRecHit> &hits = out_strip_hits.find_or_insert(detId);
512  hits.push_back(TotemRPRecHit(v, sigma));
513 
514  edm::DetSet<TotemRPRecHit> &hits_per_particle =
515  out_strip_hits_per_particle[in_trk->barcode()].find_or_insert(detId);
516  hits_per_particle.push_back(TotemRPRecHit(v, sigma));
517  }
518 
519  // diamonds
520  if (detId.subdetId() == CTPPSDetId::sdTimingDiamond) {
521  CTPPSDiamondDetId diamondDetId(detIdInt);
522 
523  const auto *dg = geometry.sensor(detIdInt);
524 
525  const auto &diamondDimensions = dg->getDiamondDimensions();
526  const auto x_half_width = diamondDimensions.xHalfWidth;
527  const auto y_half_width = diamondDimensions.yHalfWidth;
528  const auto z_half_width = diamondDimensions.zHalfWidth;
529 
530  const double time_resolution = (diamondDetId.arm() == 0) ? timeResolutionDiamonds45_->Eval(h_glo.x())
531  : timeResolutionDiamonds56_->Eval(h_glo.x());
532 
533  // check acceptance
534  if (h_loc.x() < -x_half_width || h_loc.x() > +x_half_width || h_loc.y() < -y_half_width ||
535  h_loc.y() > +y_half_width)
536  continue;
537 
538  // timing information
539  const double t0 = time_eff + CLHEP::RandGauss::shoot(rndEngine, 0., time_resolution);
540  const double tot = 1.23456;
541  const double ch_t_precis = time_resolution;
542  const int time_slice = 0;
543 
544  // build rec hit
545  const bool multiHit = false;
546 
547  CTPPSDiamondRecHit rc(gl_o.x(),
548  2. * x_half_width,
549  gl_o.y(),
550  2. * y_half_width,
551  gl_o_z,
552  2. * z_half_width,
553  t0,
554  tot,
555  ch_t_precis,
556  time_slice,
557  HPTDCErrorFlags(),
558  multiHit);
559 
560  edm::DetSet<CTPPSDiamondRecHit> &hits = out_diamond_hits.find_or_insert(detId);
561  hits.push_back(rc);
562 
563  edm::DetSet<CTPPSDiamondRecHit> &hits_per_particle =
564  out_diamond_hits_per_particle[in_trk->barcode()].find_or_insert(detId);
565  hits_per_particle.push_back(rc);
566  }
567 
568  // pixels
569  if (detId.subdetId() == CTPPSDetId::sdTrackingPixel) {
570  if (verbosity_) {
571  CTPPSPixelDetId pixelDetId(detIdInt);
572  ssLog << " pixel plane " << pixelDetId.plane() << ": local hit x = " << h_loc.x()
573  << " mm, y = " << h_loc.y() << " mm, z = " << h_loc.z() << " mm" << std::endl;
574  }
575 
576  bool module3By2 = (geometry.sensor(detIdInt)->sensorType() != DDD_CTPPS_PIXELS_SENSOR_TYPE_2x2);
577  if (checkIsHit_ && !CTPPSPixelTopology::isPixelHit(h_loc.x(), h_loc.y(), module3By2))
578  continue;
579 
580  if (roundToPitch_) {
581  h_loc.SetX(pitchPixelsHor_ * floor(h_loc.x() / pitchPixelsHor_ + 0.5));
582  h_loc.SetY(pitchPixelsVer_ * floor(h_loc.y() / pitchPixelsVer_ + 0.5));
583  }
584 
585  if (verbosity_ > 5)
586  ssLog << " hit accepted: m1 = " << h_loc.x() << " mm, m2 = " << h_loc.y() << " mm" << std::endl;
587 
588  const double sigmaHor = pitchPixelsHor_ / sqrt(12.);
589  const double sigmaVer = pitchPixelsVer_ / sqrt(12.);
590 
591  const LocalPoint lp(h_loc.x(), h_loc.y(), h_loc.z());
592  const LocalError le(sigmaHor, 0., sigmaVer);
593 
594  edm::DetSet<CTPPSPixelRecHit> &hits = out_pixel_hits.find_or_insert(detId);
595  hits.push_back(CTPPSPixelRecHit(lp, le));
596 
597  edm::DetSet<CTPPSPixelRecHit> &hits_per_particle =
598  out_pixel_hits_per_particle[in_trk->barcode()].find_or_insert(detId);
599  hits_per_particle.push_back(CTPPSPixelRecHit(lp, le));
600  }
601  }
602  }
603 
604  if (verbosity_)
605  edm::LogInfo("CTPPSDirectProtonSimulation") << ssLog.str();

References MaterialEffects_cfi::A, CTPPSDetId::arm(), TtFullHadDaughter::B, checkIsHit_, LHCInfo::crossingAngle(), DDD_CTPPS_PIXELS_SENSOR_TYPE_2x2, empiricalAperture45_, empiricalAperture56_, 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(), FrontierCondition_GT_autoExpress_cfi::t0, LHCInterpolatedOpticalFunctionsSet::Kinematics::th_x, LHCInterpolatedOpticalFunctionsSet::Kinematics::th_y, timeResolutionDiamonds45_, timeResolutionDiamonds56_, 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 212 of file CTPPSDirectProtonSimulation.cc.

213  {
214  // get input
216  iEvent.getByToken(hepMCToken_, hepmc_prod);
217 
218  // get conditions
219  edm::ESHandle<LHCInfo> hLHCInfo;
220  iSetup.get<LHCInfoRcd>().get(lhcInfoLabel_, hLHCInfo);
221 
222  edm::ESHandle<CTPPSBeamParameters> hBeamParameters;
223  iSetup.get<CTPPSBeamParametersRcd>().get(hBeamParameters);
224 
226  iSetup.get<CTPPSInterpolatedOpticsRcd>().get(opticsLabel_, hOpticalFunctions);
227 
230 
231  // prepare outputs
232  std::unique_ptr<edm::DetSetVector<TotemRPRecHit>> pStripRecHits(new edm::DetSetVector<TotemRPRecHit>());
233  std::unique_ptr<edm::DetSetVector<CTPPSDiamondRecHit>> pDiamondRecHits(new edm::DetSetVector<CTPPSDiamondRecHit>());
234  std::unique_ptr<edm::DetSetVector<CTPPSPixelRecHit>> pPixelRecHits(new edm::DetSetVector<CTPPSPixelRecHit>());
235 
236  auto pStripRecHitsPerParticle = std::make_unique<std::map<int, edm::DetSetVector<TotemRPRecHit>>>();
237  auto pDiamondRecHitsPerParticle = std::make_unique<std::map<int, edm::DetSetVector<CTPPSDiamondRecHit>>>();
238  auto pPixelRecHitsPerParticle = std::make_unique<std::map<int, edm::DetSetVector<CTPPSPixelRecHit>>>();
239 
240  std::unique_ptr<std::vector<CTPPSLocalTrackLite>> pTracks(new std::vector<CTPPSLocalTrackLite>());
241 
242  // get random engine
244  CLHEP::HepRandomEngine *engine = &rng->getEngine(iEvent.streamID());
245 
246  // loop over event vertices
247  auto evt = hepmc_prod->GetEvent();
248  for (auto it_vtx = evt->vertices_begin(); it_vtx != evt->vertices_end(); ++it_vtx) {
249  auto vtx = *(it_vtx);
250 
251  // loop over outgoing particles
252  for (auto it_part = vtx->particles_out_const_begin(); it_part != vtx->particles_out_const_end(); ++it_part) {
253  auto part = *(it_part);
254 
255  // accept only stable protons
256  if (part->pdg_id() != 2212)
257  continue;
258 
259  if (part->status() != 1 && part->status() < 83)
260  continue;
261 
263  part,
264  *geometry,
265  *hLHCInfo,
266  *hBeamParameters,
267  *hOpticalFunctions,
268  engine,
269  *pTracks,
270  *pStripRecHits,
271  *pPixelRecHits,
272  *pDiamondRecHits,
273  *pStripRecHitsPerParticle,
274  *pPixelRecHitsPerParticle,
275  *pDiamondRecHitsPerParticle);
276  }
277  }
278 
280  iEvent.put(std::move(pTracks));
281 
282  if (produceRecHits_) {
283  iEvent.put(std::move(pStripRecHits));
284  iEvent.put(std::move(pPixelRecHits));
285  iEvent.put(std::move(pDiamondRecHits));
286 
287  iEvent.put(std::move(pStripRecHitsPerParticle));
288  iEvent.put(std::move(pPixelRecHitsPerParticle));
289  iEvent.put(std::move(pDiamondRecHitsPerParticle));
290  }

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

Member Data Documentation

◆ checkApertures_

bool CTPPSDirectProtonSimulation::checkApertures_
private

simulation parameters

Definition at line 101 of file CTPPSDirectProtonSimulation.cc.

◆ checkIsHit_

bool CTPPSDirectProtonSimulation::checkIsHit_
private

Definition at line 110 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ empiricalAperture45_

std::unique_ptr<TF2> CTPPSDirectProtonSimulation::empiricalAperture45_
private

Definition at line 105 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ empiricalAperture56_

std::unique_ptr<TF2> CTPPSDirectProtonSimulation::empiricalAperture56_
private

Definition at line 106 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ hepMCToken_

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

Definition at line 94 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 113 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ lhcInfoLabel_

std::string CTPPSDirectProtonSimulation::lhcInfoLabel_
private

input

Definition at line 91 of file CTPPSDirectProtonSimulation.cc.

Referenced by produce().

◆ opticsLabel_

std::string CTPPSDirectProtonSimulation::opticsLabel_
private

Definition at line 92 of file CTPPSDirectProtonSimulation.cc.

Referenced by produce().

◆ pitchPixelsHor_

double CTPPSDirectProtonSimulation::pitchPixelsHor_
private

Definition at line 115 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ pitchPixelsVer_

double CTPPSDirectProtonSimulation::pitchPixelsVer_
private

Definition at line 116 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ pitchStrips_

double CTPPSDirectProtonSimulation::pitchStrips_
private

strip pitch in mm

Definition at line 112 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ produceHitsRelativeToBeam_

bool CTPPSDirectProtonSimulation::produceHitsRelativeToBeam_
private

Definition at line 108 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 97 of file CTPPSDirectProtonSimulation.cc.

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

◆ roundToPitch_

bool CTPPSDirectProtonSimulation::roundToPitch_
private

Definition at line 109 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ stripZeroPosition_

double CTPPSDirectProtonSimulation::stripZeroPosition_
private

internal variable: v position of strip 0, in mm

Definition at line 126 of file CTPPSDirectProtonSimulation.cc.

Referenced by CTPPSDirectProtonSimulation(), and processProton().

◆ timeResolutionDiamonds45_

std::unique_ptr<TF1> CTPPSDirectProtonSimulation::timeResolutionDiamonds45_
private

Definition at line 118 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ timeResolutionDiamonds56_

std::unique_ptr<TF1> CTPPSDirectProtonSimulation::timeResolutionDiamonds56_
private

x-dependent time resolution of diamonds (per rec hit) in ns

Definition at line 118 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ useEmpiricalApertures_

bool CTPPSDirectProtonSimulation::useEmpiricalApertures_
private

Definition at line 103 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

◆ verbosity_

unsigned int CTPPSDirectProtonSimulation::verbosity_
private

Definition at line 121 of file CTPPSDirectProtonSimulation.cc.

Referenced by processProton().

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
edm::RandomNumberGenerator::getEngine
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
geometry
ESHandle< TrackerGeometry > geometry
Definition: TkLasBeamFitter.cc:200
CTPPSPixelRecHit
Definition: CTPPSPixelRecHit.h:17
LHCInterpolatedOpticalFunctionsSet::Kinematics
proton kinematics description
Definition: LHCInterpolatedOpticalFunctionsSet.h:28
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, CLHEP::HepRandomEngine *rndEngine, 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:294
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
edm::DetSet
Definition: DetSet.h:23
CTPPSDirectProtonSimulation::timeResolutionDiamonds56_
std::unique_ptr< TF1 > timeResolutionDiamonds56_
x-dependent time resolution of diamonds (per rec hit) in ns
Definition: CTPPSDirectProtonSimulation.cc:118
CTPPSDirectProtonSimulation::insensitiveMarginStrips_
double insensitiveMarginStrips_
size of insensitive margin at sensor's edge facing the beam, in mm
Definition: CTPPSDirectProtonSimulation.cc:113
CTPPSDiamondRecHit
Reconstructed hit in diamond detectors.
Definition: CTPPSDiamondRecHit.h:16
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:70
geometry
Definition: geometry.py:1
hybridSuperClusters_cfi.xi
xi
Definition: hybridSuperClusters_cfi.py:10
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
CTPPSBeamParameters::getBeamMom56
double getBeamMom56() const
Definition: CTPPSBeamParameters.cc:56
CTPPSBeamParameters::getHalfXangleX45
double getHalfXangleX45() const
Definition: CTPPSBeamParameters.cc:68
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
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
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:16
year_2016_postTS2_cff.rpId
rpId
Definition: year_2016_postTS2_cff.py:23
tools.TF1
TF1
Definition: tools.py:23
edm::Handle< edm::HepMCProduct >
CTPPSDetId::sdTrackingStrip
Definition: CTPPSDetId.h:44
HPTDCErrorFlags
Definition: HPTDCErrorFlags.h:15
CTPPSDirectProtonSimulation::roundToPitch_
bool roundToPitch_
Definition: CTPPSDirectProtonSimulation.cc:109
part
part
Definition: HCALResponse.h:20
CTPPSDirectProtonSimulation::stripZeroPosition_
double stripZeroPosition_
internal variable: v position of strip 0, in mm
Definition: CTPPSDirectProtonSimulation.cc:126
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
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
FrontierCondition_GT_autoExpress_cfi.t0
t0
Definition: FrontierCondition_GT_autoExpress_cfi.py:148
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
CTPPSDirectProtonSimulation::hepMCToken_
edm::EDGetTokenT< edm::HepMCProduct > hepMCToken_
Definition: CTPPSDirectProtonSimulation.cc:94
CTPPSDirectProtonSimulation::produceRecHits_
bool produceRecHits_
Definition: CTPPSDirectProtonSimulation.cc:98
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
CTPPSDirectProtonSimulation::pitchStrips_
double pitchStrips_
strip pitch in mm
Definition: CTPPSDirectProtonSimulation.cc:112
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
tools.TF2
TF2
Definition: tools.py:24
CTPPSDirectProtonSimulation::lhcInfoLabel_
std::string lhcInfoLabel_
input
Definition: CTPPSDirectProtonSimulation.cc:91
CTPPSDirectProtonSimulation::pitchPixelsHor_
double pitchPixelsHor_
Definition: CTPPSDirectProtonSimulation.cc:115
CTPPSDirectProtonSimulation::verbosity_
unsigned int verbosity_
Definition: CTPPSDirectProtonSimulation.cc:121
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:110
CTPPSDirectProtonSimulation::produceHitsRelativeToBeam_
bool produceHitsRelativeToBeam_
Definition: CTPPSDirectProtonSimulation.cc:108
LHCInterpolatedOpticalFunctionsSet::Kinematics::th_y
double th_y
Definition: LHCInterpolatedOpticalFunctionsSet.h:32
CTPPSDiamondDetId
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
Definition: CTPPSDiamondDetId.h:24
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:97
A
CTPPSDetId
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:31
edm::Service< edm::RandomNumberGenerator >
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
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:55
CTPPSPixelDetId
Definition: CTPPSPixelDetId.h:16
get
#define get
CTPPSDirectProtonSimulation::empiricalAperture56_
std::unique_ptr< TF2 > empiricalAperture56_
Definition: CTPPSDirectProtonSimulation.cc:106
CTPPSDirectProtonSimulation::pitchPixelsVer_
double pitchPixelsVer_
Definition: CTPPSDirectProtonSimulation.cc:116
CTPPSBeamParametersRcd
Definition: CTPPSBeamParametersRcd.h:14
CTPPSDirectProtonSimulation::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: CTPPSDirectProtonSimulation.cc:212
VeryForwardMisalignedGeometryRecord
Event setup record containing the misaligned geometry information. It is used for alignment studies o...
Definition: VeryForwardMisalignedGeometryRecord.h:23
TtFullHadDaughter::B
static const std::string B
Definition: TtFullHadronicEvent.h:9
MaterialEffects_cfi.A
A
Definition: MaterialEffects_cfi.py:11
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:18
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::DetSetVector::find_or_insert
reference find_or_insert(det_id_type id)
Definition: DetSetVector.h:234
LHCInterpolatedOpticalFunctionsSet::Kinematics::th_x
double th_x
Definition: LHCInterpolatedOpticalFunctionsSet.h:30
P
std::pair< OmniClusterRef, TrackingParticleRef > P
Definition: BDHadronTrackMonitoringAnalyzer.cc:202
edm::Event
Definition: Event.h:73
CTPPSDirectProtonSimulation::empiricalAperture45_
std::unique_ptr< TF2 > empiricalAperture45_
Definition: CTPPSDirectProtonSimulation.cc:105
CTPPSDirectProtonSimulation::opticsLabel_
std::string opticsLabel_
Definition: CTPPSDirectProtonSimulation.cc:92
edm::InputTag
Definition: InputTag.h:15
OpticalFunctionsConfig_cfi.opticalFunctions
opticalFunctions
Definition: OpticalFunctionsConfig_cfi.py:16
CTPPSDirectProtonSimulation::useEmpiricalApertures_
bool useEmpiricalApertures_
Definition: CTPPSDirectProtonSimulation.cc:103
CTPPSDirectProtonSimulation::timeResolutionDiamonds45_
std::unique_ptr< TF1 > timeResolutionDiamonds45_
Definition: CTPPSDirectProtonSimulation.cc:118
CTPPSInterpolatedOpticsRcd
Definition: CTPPSInterpolatedOpticsRcd.h:13
CTPPSGeometry::Vector
DetGeomDesc::Translation Vector
Definition: CTPPSGeometry.h:39