CMS 3D CMS Logo

DTSegment4DT0Corrector.cc
Go to the documentation of this file.
1 
8 
14 
16 
18 
19 using namespace edm;
20 using namespace std;
21 
23  produces<DTRecSegment4DCollection>();
24 
25  // debug parameter
26  debug = pset.getUntrackedParameter<bool>("debug");
27 
28  if(debug)
29  cout << "[DTSegment4DT0Corrector] Constructor called" << endl;
30 
31  // the name of the 4D rec hits collection
32  recHits4DToken_ = consumes<DTRecSegment4DCollection>(pset.getParameter<InputTag>("recHits4DLabel"));
33 
34  // the updator
35  theUpdator = new DTSegmentUpdator(pset);
36 }
37 
40  if(debug)
41  cout << "[DTSegment4DT0Corrector] Destructor called" << endl;
42  delete theUpdator;
43 }
44 
46 
47  // Get the 4D Segment from the event
49  event.getByToken(recHits4DToken_, all4DSegments);
50 
51  // get the geometry
52  ESHandle<DTGeometry> theGeom;
53  setup.get<MuonGeometryRecord>().get(theGeom);
54 
55  // Percolate the setup
56  theUpdator->setES(setup);
57 
58 
59  // Create the pointer to the collection which will store the rechits
60  auto segments4DCollection = std::make_unique<DTRecSegment4DCollection>();
61 
62  // Iterate over the input DTSegment4D
64 
65  if(debug)
66  cout << "[DTSegment4DT0Corrector] Starting to loop over segments" << endl;
67 
68  for (chamberId = all4DSegments->id_begin(); chamberId != all4DSegments->id_end(); ++chamberId){
69 
71 
72  // Get the range for the corresponding ChamerId
73  DTRecSegment4DCollection::range range = all4DSegments->get(*chamberId);
74 
75  // Loop over the rechits of this ChamberId
76  for (DTRecSegment4DCollection::const_iterator segment4D = range.first;
77  segment4D!=range.second; ++segment4D) {
78 
79  DTRecSegment4D tmpseg = *segment4D;
80 
81  DTRecSegment4D *newSeg = tmpseg.clone();
82 
83  if(newSeg == nullptr) continue;
84 
85  theUpdator->update(newSeg,true,false);
86  result.push_back(*newSeg);
87 
88  }
89 
90  segments4DCollection->put(*chamberId, result.begin(), result.end());
91 
92  }
93 
94  if(debug)
95  cout << "[DTSegment4DT0Corrector] Saving modified segments into the event" << endl;
96 
97  // Load the output in the Event
98  event.put(std::move(segments4DCollection));
99 }
void produce(edm::Event &event, const edm::EventSetup &setup) override
The method which produces the 4D rec segments corrected for t0 offset.
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
identifier iterator
Definition: RangeMap.h:135
DTSegment4DT0Corrector(const edm::ParameterSet &)
Constructor.
iterator begin()
Definition: OwnVector.h:244
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
void push_back(D *&d)
Definition: OwnVector.h:290
iterator end()
Definition: OwnVector.h:249
#define debug
Definition: HDRShower.cc:19
~DTSegment4DT0Corrector() override
Destructor.
HLT enums.
T get() const
Definition: EventSetup.h:71
DTRecSegment4D * clone() const override
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1