CMS 3D CMS Logo

Adjuster.cc
Go to the documentation of this file.
1 #include "Adjuster.h"
4 
5 namespace edm {
6  namespace detail {
7  void doTheOffset(
8  int bunchSpace, int bcr, std::vector<SimTrack>& simtracks, unsigned int evtNr, int vertexOffset, bool wrap) {
9  EncodedEventId id(bcr, evtNr);
10  for (auto& item : simtracks) {
11  item.setEventId(id);
12  if (!item.noVertex()) {
13  item.setVertexIndex(item.vertIndex() + vertexOffset);
14  }
15  }
16  }
17 
19  int bunchSpace, int bcr, std::vector<SimVertex>& simvertices, unsigned int evtNr, int vertexOffset, bool wrap) {
20  int timeOffset = bcr * bunchSpace;
21  EncodedEventId id(bcr, evtNr);
22  for (auto& item : simvertices) {
23  item.setEventId(id);
24  item.setTof(item.position().t() + timeOffset);
25  }
26  }
27 
29  int bunchSpace, int bcr, std::vector<PSimHit>& simhits, unsigned int evtNr, int vertexOffset, bool wrap) {
30  int timeOffset = bcr * bunchSpace;
31  EncodedEventId id(bcr, evtNr);
32  if (wrap) { // wrap time for long-lived hits into one beam crossing
33  for (auto& item : simhits) {
34  item.setEventId(id);
35 
36  float Tfloor = floor(item.timeOfFlight());
37  float digits = item.timeOfFlight() - Tfloor;
38  int remainder = int(Tfloor) % bunchSpace;
39  item.setTof(float(remainder) + digits + timeOffset);
40  }
41  } else {
42  for (auto& item : simhits) {
43  item.setEventId(id);
44  item.setTof(item.timeOfFlight() + timeOffset);
45  }
46  }
47  }
48 
50  int bunchSpace, int bcr, std::vector<PCaloHit>& calohits, unsigned int evtNr, int vertexOffset, bool wrap) {
51  int timeOffset = bcr * bunchSpace;
52  EncodedEventId id(bcr, evtNr);
53  for (auto& item : calohits) {
54  item.setEventId(id);
55  item.setTime(item.time() + timeOffset);
56  }
57  }
58 
59  void doTheOffset(int bunchSpace,
60  int bcr,
61  TrackingRecHitCollection& trackingrechits,
62  unsigned int evtNr,
63  int vertexOffset,
64  bool wrap) {
65  EncodedEventId id(bcr, evtNr);
66  for (auto it = trackingrechits.begin(); it != trackingrechits.end(); ++it) {
67  if (trackerHitRTTI::isFast(*it)) {
68  FastTrackerRecHit* rechit = static_cast<FastTrackerRecHit*>(&(*it));
69  rechit->setEventId(id.rawId());
70  }
71  }
72  }
73 
74  } // end namespace detail
75 } // end namespace edm
edm::OwnVector::end
iterator end()
Definition: OwnVector.h:285
edm
HLT enums.
Definition: AlignableModifier.h:19
FastTrackerRecHit
Definition: FastTrackerRecHit.h:40
detail
Definition: ConvertingESProducerWithDependenciesT.h:23
EncodedEventId
Definition: EncodedEventId.h:11
FastTrackerRecHit::setEventId
virtual void setEventId(int32_t eventId)
Definition: FastTrackerRecHit.h:108
edm::convertException::wrap
auto wrap(F iFunc) -> decltype(iFunc())
Definition: ConvertException.h:19
HLTBitAnalyser_cfi.simhits
simhits
SIM objects.
Definition: HLTBitAnalyser_cfi.py:21
edm::detail::doTheOffset
void doTheOffset(int bunchSpace, int bcr, std::vector< SimTrack > &simtracks, unsigned int evtNr, int vertexOffset, bool wrap)
Definition: Adjuster.cc:7
createfilelist.int
int
Definition: createfilelist.py:10
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
CalibratedDigis_cfi.timeOffset
timeOffset
Definition: CalibratedDigis_cfi.py:23
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
FastTrackerRecHit.h
edm::OwnVector::begin
iterator begin()
Definition: OwnVector.h:280
edm::OwnVector< TrackingRecHit >
trackerHitRTTI::isFast
bool isFast(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:37
EncodedEventId.h
Adjuster.h