CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
uint16_t *__restrict__ id
virtual void setEventId(int32_t eventId)
iterator begin()
Definition: OwnVector.h:280
void doTheOffset(int bunchSpace, int bcr, std::vector< SimTrack > &simtracks, unsigned int evtNr, int vertexOffset, bool wrap)
Definition: Adjuster.cc:7
bool isFast(TrackingRecHit const &hit)
iterator end()
Definition: OwnVector.h:285
auto wrap(F iFunc) -> decltype(iFunc())