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(int bunchSpace, int bcr, std::vector<SimTrack>& simtracks, unsigned int evtNr, int vertexOffset, bool wrap) {
8 
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 
18 void doTheOffset(int bunchSpace, int bcr, std::vector<SimVertex>& simvertices, unsigned int evtNr, int vertexOffset, bool wrap) {
19 
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 
28 void doTheOffset(int bunchSpace, int bcr, std::vector<PSimHit>& simhits, unsigned int evtNr, int vertexOffset, bool wrap) {
29 
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  }
42  else {
43  for (auto& item : simhits) {
44  item.setEventId(id);
45  item.setTof(item.timeOfFlight() + timeOffset);
46  }
47  }
48 }
49 
50 void doTheOffset(int bunchSpace, int bcr, std::vector<PCaloHit>& calohits, unsigned int evtNr, int vertexOffset, bool wrap) {
51 
52  int timeOffset = bcr * bunchSpace;
53  EncodedEventId id(bcr,evtNr);
54  for (auto& item : calohits) {
55  item.setEventId(id);
56  item.setTime(item.time() + timeOffset);
57  }
58 }
59 
60 void doTheOffset(int bunchSpace, int bcr, TrackingRecHitCollection & trackingrechits, unsigned int evtNr, int vertexOffset, bool wrap) {
61 
62  EncodedEventId id(bcr,evtNr);
63  for (auto it = trackingrechits.begin();it!=trackingrechits.end();++it) {
64  if(trackerHitRTTI::isFast(*it)){
65  FastTrackerRecHit * rechit = static_cast<FastTrackerRecHit*>(&(*it));
66  rechit->setEventId(id.rawId());
67  }
68  }
69 }
70 
71 } // end namespace detail
72 } // end namespace edm
virtual void setEventId(int32_t eventId)
iterator begin()
Definition: OwnVector.h:244
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:249
HLT enums.
auto wrap(F iFunc) -> decltype(iFunc())