CMS 3D CMS Logo

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

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

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

Public Member Functions

 CTPPSRecHitProducer (const edm::ParameterSet &)
 
 ~CTPPSRecHitProducer () 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
 

Private Types

typedef std::vector< PSimHitPSimHitContainer
 

Private Member Functions

void beginStream (edm::StreamID) override
 
void endStream () override
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
 
double fBeamXRMS_ToF
 
double fBeamXRMS_Trk1
 
double fBeamXRMS_Trk2
 
double fHitSigmaX
 
double fHitSigmaY
 
double fHitSigmaZ
 
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
 

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 67 of file CTPPSRecHitProducer.cc.

Member Typedef Documentation

◆ PSimHitContainer

typedef std::vector<PSimHit> CTPPSRecHitProducer::PSimHitContainer
private

Definition at line 78 of file CTPPSRecHitProducer.cc.

Constructor & Destructor Documentation

◆ CTPPSRecHitProducer()

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

Definition at line 93 of file CTPPSRecHitProducer.cc.

93  {
94  produces<edm::CTPPSFastRecHitContainer>("CTPPSFastRecHits");
95 
96  //Name of Collection use for create the XF
97  std::string mix_ = iConfig.getParameter<std::string>("mixLabel");
98  std::string collection_for_XF = iConfig.getParameter<std::string>("InputCollection");
99  cf_token = consumes<CrossingFrame<PSimHit> >(edm::InputTag(mix_, collection_for_XF));
100 
101  // Read the detector parameters
102  fTrackerWidth = iConfig.getParameter<double>("TrackerWidth");
103  fTrackerHeight = iConfig.getParameter<double>("TrackerHeight");
104  fTrackerInsertion = iConfig.getParameter<double>("TrackerInsertion");
105  fBeamXRMS_Trk1 = iConfig.getParameter<double>("BeamXRMS_Trk1");
106  fBeamXRMS_Trk2 = iConfig.getParameter<double>("BeamXRMS_Trk2");
107  fTrk1XOffset = iConfig.getParameter<double>("Trk1XOffset");
108  fTrk2XOffset = iConfig.getParameter<double>("Trk2XOffset");
109  fHitSigmaX = iConfig.getParameter<double>("HitSigmaX");
110  fHitSigmaY = iConfig.getParameter<double>("HitSigmaY");
111  fHitSigmaZ = iConfig.getParameter<double>("HitSigmaZ");
112  fToFCellWidth = iConfig.getUntrackedParameter<std::vector<double> >("ToFCellWidth");
113  fToFCellHeight = iConfig.getParameter<double>("ToFCellHeight");
114  fToFPitchX = iConfig.getParameter<double>("ToFPitchX");
115  fToFPitchY = iConfig.getParameter<double>("ToFPitchY");
116  fToFNCellX = iConfig.getParameter<int>("ToFNCellX");
117  fToFNCellY = iConfig.getParameter<int>("ToFNCellY");
118  fToFInsertion = iConfig.getParameter<double>("ToFInsertion");
119  fBeamXRMS_ToF = iConfig.getParameter<double>("BeamXRMS_ToF");
120  fToFXOffset = iConfig.getParameter<double>("ToFXOffset");
121  fTimeSigma = iConfig.getParameter<double>("TimeSigma");
122 
124  if (!rng.isAvailable()) {
125  throw cms::Exception("Configuration")
126  << "CTPPSRecHitProducer requires the RandomNumberGeneratorService\n"
127  "which is not present in the configuration file. You must add the service\n"
128  "in the configuration file or remove the modules that require it.";
129  }
130 }

References cf_token, Exception, fBeamXRMS_ToF, fBeamXRMS_Trk1, fBeamXRMS_Trk2, fHitSigmaX, fHitSigmaY, fHitSigmaZ, fTimeSigma, fToFCellHeight, fToFCellWidth, fToFInsertion, fToFNCellX, fToFNCellY, fToFPitchX, fToFPitchY, fToFXOffset, fTrackerHeight, fTrackerInsertion, fTrackerWidth, fTrk1XOffset, fTrk2XOffset, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), HLT_2018_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~CTPPSRecHitProducer()

CTPPSRecHitProducer::~CTPPSRecHitProducer ( )
override

Definition at line 132 of file CTPPSRecHitProducer.cc.

132 {}

Member Function Documentation

◆ beginStream()

void CTPPSRecHitProducer::beginStream ( edm::StreamID  )
overrideprivate

Definition at line 258 of file CTPPSRecHitProducer.cc.

258 {}

◆ endStream()

void CTPPSRecHitProducer::endStream ( )
overrideprivate

Definition at line 261 of file CTPPSRecHitProducer.cc.

261 {}

◆ produce()

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

Definition at line 134 of file CTPPSRecHitProducer.cc.

134  {
135  using namespace edm;
136 
138  CLHEP::HepRandomEngine* engine = &rng->getEngine(iEvent.streamID());
139  if (engine->name() != "TRandom3") {
140  throw cms::Exception("Configuration") << "The TRandom3 engine type must be used with CTPPSRecHitProducer, Random "
141  "Number Generator Service not correctly configured!";
142  }
143 
144  //Mix the PSimHits for pileup
146  iEvent.getByToken(cf_token, xFrame);
147 
148  std::unique_ptr<MixCollection<PSimHit> > simHits(new MixCollection<PSimHit>(xFrame.product()));
149 
150  std::vector<CTPPSFastRecHit> theCTPPSFastRecHit;
151 
152  for (MixCollection<PSimHit>::MixItr ihit = simHits->begin(); ihit != simHits->end(); ihit++)
153 
154  {
155  const PSimHit* simHit = &(*ihit);
156  unsigned int detlayerId = simHit->detUnitId();
157  // DetId layer codification for PSimHit
158  // 2014314496 -> Tracker1 zPositive
159  // 2014838784 -> Tracker2 zPositive
160  // 2046820352 -> Timing zPositive
161  // 2031091712 -> Tracker1 zNegative
162  // 2031616000 -> Tracker2 zNegative
163  // 2063597568 -> Timing zNegative
164  bool outside = false;
165 
166  //Make Tracker RecHits by smearing the SimHits positions and applying fiducial cuts
167  CTPPSFastRecHit rechit; // (const Local3DPoint& entry, unsigned int detId, float tof, unsigned int cellId)
168  if (detlayerId == 2014314496 || detlayerId == 2031091712) {
169  // Apply position smearing
170  float x_trk1 = simHit->entryPoint().x() + CLHEP::RandGauss::shoot(engine, 0, fHitSigmaX * um_to_mm);
171  float y_trk1 = simHit->entryPoint().y() + CLHEP::RandGauss::shoot(engine, 0, fHitSigmaY * um_to_mm);
172  float z_trk1 = simHit->entryPoint().z();
173 
174  // Apply fiducial cuts
175  double pos_trk1 = fTrackerInsertion * fBeamXRMS_Trk1 + fTrk1XOffset;
176  if (x_trk1 > 0 || fabs(x_trk1) < pos_trk1 || fabs(x_trk1) > (fTrackerWidth + pos_trk1) ||
177  fabs(y_trk1) > fTrackerHeight / 2.)
178  outside = true;
179 
180  float tof = 0.0;
181  unsigned int cellId = 1;
182  Local3DPoint xyzzy = Local3DPoint(x_trk1, y_trk1, z_trk1);
183  if (!outside) {
184  rechit.setLocal3DPoint(xyzzy);
185  rechit.setTof(tof);
186  rechit.setDetUnitId(detlayerId);
187  rechit.setCellId(cellId);
188  theCTPPSFastRecHit.push_back(rechit);
189  }
190  }
191  if (detlayerId == 2014838784 || detlayerId == 2031616000) {
192  // Apply position smearing
193  double x_trk2 = simHit->entryPoint().x() + CLHEP::RandGauss::shoot(engine, 0, fHitSigmaX * um_to_mm);
194  double y_trk2 = simHit->entryPoint().y() + CLHEP::RandGauss::shoot(engine, 0, fHitSigmaY * um_to_mm);
195  double z_trk2 = simHit->entryPoint().z();
196  // Apply fiducial cuts
197  double pos_trk2 = fTrackerInsertion * fBeamXRMS_Trk2 + fTrk2XOffset;
198  if (x_trk2 > 0 || fabs(x_trk2) < pos_trk2 || fabs(x_trk2) > (fTrackerWidth + pos_trk2) ||
199  fabs(y_trk2) > fTrackerHeight / 2.)
200  outside = true;
201 
202  float tof = 0.0;
203  unsigned int cellId = 2;
204  Local3DPoint xyzzy = Local3DPoint(x_trk2, y_trk2, z_trk2);
205  if (!outside) {
206  rechit.setLocal3DPoint(xyzzy);
207  rechit.setTof(tof);
208  rechit.setDetUnitId(detlayerId);
209  rechit.setCellId(cellId);
210  theCTPPSFastRecHit.push_back(rechit);
211  }
212  }
213  //Make Timing RecHits by smearing the SimHits time of flight and checking the cell of the hit
214  //The RecHit position is the centre of the cell
215  if (detlayerId == 2046820352 || detlayerId == 2063597568) {
216  float t = simHit->tof();
217  unsigned int cellId = 0;
218  float tof = CLHEP::RandGauss::shoot(engine, t, fTimeSigma);
219  double x_tof = simHit->entryPoint().x();
220  double y_tof = simHit->entryPoint().y();
221 
222  double pos_tof = fToFInsertion * fBeamXRMS_ToF + fToFXOffset;
223 
224  std::vector<double> vToFCellWidth;
225  for (int i = 0; i < 8; i++) {
226  vToFCellWidth.push_back(fToFCellWidth[i]);
227  }
228  CTPPSToFDetector* ToFDet = new CTPPSToFDetector(
229  fToFNCellX, fToFNCellY, vToFCellWidth, fToFCellHeight, fToFPitchX, fToFPitchY, pos_tof, fTimeSigma);
230  cellId = ToFDet->findCellId(x_tof, y_tof);
231  if (cellId > 0) {
232  double xc_tof = 0., yc_tof = 0.;
233  ToFDet->get_CellCenter(cellId, xc_tof, yc_tof);
234  Local3DPoint xyzzy = Local3DPoint(xc_tof, yc_tof, simHit->entryPoint().z());
235  rechit.setLocal3DPoint(xyzzy);
236  rechit.setTof(tof);
237  rechit.setDetUnitId(detlayerId);
238  rechit.setCellId(cellId);
239  theCTPPSFastRecHit.push_back(rechit);
240  }
241  }
242  }
243 
244  std::unique_ptr<CTPPSFastRecHitContainer> output_recHits(new edm::CTPPSFastRecHitContainer);
245  output_recHits->reserve(simHits->size());
246 
247  int n = 0;
248  for (std::vector<CTPPSFastRecHit>::const_iterator i = theCTPPSFastRecHit.begin(); i != theCTPPSFastRecHit.end();
249  i++) {
250  output_recHits->push_back(*i);
251  n += 1;
252  }
253 
254  iEvent.put(std::move(output_recHits), "CTPPSFastRecHits");
255 }

References cf_token, Exception, fBeamXRMS_ToF, fBeamXRMS_Trk1, fBeamXRMS_Trk2, fHitSigmaX, fHitSigmaY, CTPPSToFDetector::findCellId(), fTimeSigma, fToFCellHeight, fToFCellWidth, fToFInsertion, fToFNCellX, fToFNCellY, fToFPitchX, fToFPitchY, fToFXOffset, fTrackerHeight, fTrackerInsertion, fTrackerWidth, fTrk1XOffset, fTrk2XOffset, CTPPSToFDetector::get_CellCenter(), edm::RandomNumberGenerator::getEngine(), mps_fire::i, iEvent, eostools::move(), dqmiodumpmetadata::n, edm::Handle< T >::product(), CTPPSFastRecHit::setCellId(), CTPPSFastRecHit::setDetUnitId(), CTPPSFastRecHit::setLocal3DPoint(), CTPPSFastRecHit::setTof(), rpcPointValidation_cfi::simHit, FastTrackerRecHitCombiner_cfi::simHits, OrderedSet::t, and um_to_mm.

Member Data Documentation

◆ cf_token

edm::EDGetTokenT<CrossingFrame<PSimHit> > CTPPSRecHitProducer::cf_token
private

Definition at line 83 of file CTPPSRecHitProducer.cc.

Referenced by CTPPSRecHitProducer(), and produce().

◆ fBeamXRMS_ToF

double CTPPSRecHitProducer::fBeamXRMS_ToF
private

Definition at line 90 of file CTPPSRecHitProducer.cc.

Referenced by CTPPSRecHitProducer(), and produce().

◆ fBeamXRMS_Trk1

double CTPPSRecHitProducer::fBeamXRMS_Trk1
private

Definition at line 85 of file CTPPSRecHitProducer.cc.

Referenced by CTPPSRecHitProducer(), and produce().

◆ fBeamXRMS_Trk2

double CTPPSRecHitProducer::fBeamXRMS_Trk2
private

Definition at line 85 of file CTPPSRecHitProducer.cc.

Referenced by CTPPSRecHitProducer(), and produce().

◆ fHitSigmaX

double CTPPSRecHitProducer::fHitSigmaX
private

Definition at line 86 of file CTPPSRecHitProducer.cc.

Referenced by CTPPSRecHitProducer(), and produce().

◆ fHitSigmaY

double CTPPSRecHitProducer::fHitSigmaY
private

Definition at line 86 of file CTPPSRecHitProducer.cc.

Referenced by CTPPSRecHitProducer(), and produce().

◆ fHitSigmaZ

double CTPPSRecHitProducer::fHitSigmaZ
private

Definition at line 86 of file CTPPSRecHitProducer.cc.

Referenced by CTPPSRecHitProducer().

◆ fTimeSigma

double CTPPSRecHitProducer::fTimeSigma
private

Definition at line 90 of file CTPPSRecHitProducer.cc.

Referenced by CTPPSRecHitProducer(), and produce().

◆ fToFCellHeight

double CTPPSRecHitProducer::fToFCellHeight
private

Definition at line 88 of file CTPPSRecHitProducer.cc.

Referenced by CTPPSRecHitProducer(), and produce().

◆ fToFCellWidth

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

Definition at line 87 of file CTPPSRecHitProducer.cc.

Referenced by CTPPSRecHitProducer(), and produce().

◆ fToFInsertion

double CTPPSRecHitProducer::fToFInsertion
private

Definition at line 90 of file CTPPSRecHitProducer.cc.

Referenced by CTPPSRecHitProducer(), and produce().

◆ fToFNCellX

int CTPPSRecHitProducer::fToFNCellX
private

Definition at line 89 of file CTPPSRecHitProducer.cc.

Referenced by CTPPSRecHitProducer(), and produce().

◆ fToFNCellY

int CTPPSRecHitProducer::fToFNCellY
private

Definition at line 89 of file CTPPSRecHitProducer.cc.

Referenced by CTPPSRecHitProducer(), and produce().

◆ fToFPitchX

double CTPPSRecHitProducer::fToFPitchX
private

Definition at line 88 of file CTPPSRecHitProducer.cc.

Referenced by CTPPSRecHitProducer(), and produce().

◆ fToFPitchY

double CTPPSRecHitProducer::fToFPitchY
private

Definition at line 88 of file CTPPSRecHitProducer.cc.

Referenced by CTPPSRecHitProducer(), and produce().

◆ fToFXOffset

double CTPPSRecHitProducer::fToFXOffset
private

Definition at line 90 of file CTPPSRecHitProducer.cc.

Referenced by CTPPSRecHitProducer(), and produce().

◆ fTrackerHeight

double CTPPSRecHitProducer::fTrackerHeight
private

Definition at line 85 of file CTPPSRecHitProducer.cc.

Referenced by CTPPSRecHitProducer(), and produce().

◆ fTrackerInsertion

double CTPPSRecHitProducer::fTrackerInsertion
private

Definition at line 85 of file CTPPSRecHitProducer.cc.

Referenced by CTPPSRecHitProducer(), and produce().

◆ fTrackerWidth

double CTPPSRecHitProducer::fTrackerWidth
private

Definition at line 85 of file CTPPSRecHitProducer.cc.

Referenced by CTPPSRecHitProducer(), and produce().

◆ fTrk1XOffset

double CTPPSRecHitProducer::fTrk1XOffset
private

Definition at line 85 of file CTPPSRecHitProducer.cc.

Referenced by CTPPSRecHitProducer(), and produce().

◆ fTrk2XOffset

double CTPPSRecHitProducer::fTrk2XOffset
private

Definition at line 85 of file CTPPSRecHitProducer.cc.

Referenced by CTPPSRecHitProducer(), and produce().

edm::RandomNumberGenerator::getEngine
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
mps_fire.i
i
Definition: mps_fire.py:355
CTPPSRecHitProducer::fTrk2XOffset
double fTrk2XOffset
Definition: CTPPSRecHitProducer.cc:85
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
CTPPSRecHitProducer::fTrackerInsertion
double fTrackerInsertion
Definition: CTPPSRecHitProducer.cc:85
edm::Handle::product
T const * product() const
Definition: Handle.h:70
edm
HLT enums.
Definition: AlignableModifier.h:19
CTPPSRecHitProducer::fToFPitchX
double fToFPitchX
Definition: CTPPSRecHitProducer.cc:88
CTPPSRecHitProducer::fTrackerWidth
double fTrackerWidth
Definition: CTPPSRecHitProducer.cc:85
FastTrackerRecHitCombiner_cfi.simHits
simHits
Definition: FastTrackerRecHitCombiner_cfi.py:5
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
CTPPSRecHitProducer::fBeamXRMS_Trk1
double fBeamXRMS_Trk1
Definition: CTPPSRecHitProducer.cc:85
um_to_mm
static const double um_to_mm
Definition: PPSUnitConversion.h:11
edm::Handle
Definition: AssociativeIterator.h:50
CTPPSRecHitProducer::fToFCellWidth
std::vector< double > fToFCellWidth
Definition: CTPPSRecHitProducer.cc:87
CTPPSToFDetector
Definition: CTPPSToFDetector.h:8
MixCollection::MixItr
Definition: MixCollection.h:62
CTPPSRecHitProducer::fTimeSigma
double fTimeSigma
Definition: CTPPSRecHitProducer.cc:90
CTPPSRecHitProducer::fHitSigmaZ
double fHitSigmaZ
Definition: CTPPSRecHitProducer.cc:86
CTPPSRecHitProducer::fTrackerHeight
double fTrackerHeight
Definition: CTPPSRecHitProducer.cc:85
CTPPSRecHitProducer::fTrk1XOffset
double fTrk1XOffset
Definition: CTPPSRecHitProducer.cc:85
CTPPSFastRecHit::setTof
void setTof(float tof)
Definition: CTPPSFastRecHit.h:42
MixCollection
Definition: MixCollection.h:11
rpcPointValidation_cfi.simHit
simHit
Definition: rpcPointValidation_cfi.py:24
CTPPSRecHitProducer::fHitSigmaX
double fHitSigmaX
Definition: CTPPSRecHitProducer.cc:86
CTPPSRecHitProducer::fToFCellHeight
double fToFCellHeight
Definition: CTPPSRecHitProducer.cc:88
Point3DBase< float, LocalTag >
OrderedSet.t
t
Definition: OrderedSet.py:90
CTPPSRecHitProducer::fHitSigmaY
double fHitSigmaY
Definition: CTPPSRecHitProducer.cc:86
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CTPPSFastRecHit::setLocal3DPoint
void setLocal3DPoint(const Local3DPoint &entry)
Definition: CTPPSFastRecHit.h:44
CTPPSFastRecHit::setCellId
void setCellId(unsigned int cellId)
Definition: CTPPSFastRecHit.h:48
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
CTPPSRecHitProducer::fBeamXRMS_Trk2
double fBeamXRMS_Trk2
Definition: CTPPSRecHitProducer.cc:85
CTPPSToFDetector::get_CellCenter
bool get_CellCenter(int cell_id, double &x, double &y)
Definition: CTPPSToFDetector.cc:107
CTPPSRecHitProducer::cf_token
edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
Definition: CTPPSRecHitProducer.cc:83
CTPPSRecHitProducer::fBeamXRMS_ToF
double fBeamXRMS_ToF
Definition: CTPPSRecHitProducer.cc:90
edm::Service< edm::RandomNumberGenerator >
iEvent
int iEvent
Definition: GenABIO.cc:224
CTPPSFastRecHit::setDetUnitId
void setDetUnitId(unsigned int detId)
Definition: CTPPSFastRecHit.h:46
CTPPSRecHitProducer::fToFPitchY
double fToFPitchY
Definition: CTPPSRecHitProducer.cc:88
CTPPSToFDetector::findCellId
int findCellId(double x, double y)
Definition: CTPPSToFDetector.cc:83
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
CTPPSRecHitProducer::fToFXOffset
double fToFXOffset
Definition: CTPPSRecHitProducer.cc:90
CTPPSRecHitProducer::fToFInsertion
double fToFInsertion
Definition: CTPPSRecHitProducer.cc:90
Exception
Definition: hltDiff.cc:246
CTPPSRecHitProducer::fToFNCellY
int fToFNCellY
Definition: CTPPSRecHitProducer.cc:89
PSimHit
Definition: PSimHit.h:15
CTPPSFastRecHit
Definition: CTPPSFastRecHit.h:9
CTPPSRecHitProducer::fToFNCellX
int fToFNCellX
Definition: CTPPSRecHitProducer.cc:89
edm::CTPPSFastRecHitContainer
std::vector< CTPPSFastRecHit > CTPPSFastRecHitContainer
Definition: CTPPSFastRecHitContainer.h:13
Local3DPoint
Point3DBase< float, LocalTag > Local3DPoint
Definition: LocalPoint.h:9