CMS 3D CMS Logo

APVShotFinder.cc
Go to the documentation of this file.
1 #include <vector>
9 
10 APVShotFinder::APVShotFinder(const bool zs) : _zs(zs), _shots() {}
11 
12 APVShotFinder::APVShotFinder(const edm::DetSet<SiStripDigi>& digis, const bool zs) : _zs(zs), _shots() {
13  computeShots(digis);
14 }
15 
16 APVShotFinder::APVShotFinder(const edm::DetSetVector<SiStripDigi>& digicoll, const bool zs) : _zs(zs), _shots() {
17  computeShots(digicoll);
18 }
19 
21  _shots.clear();
22  addShots(digis);
23 }
24 
26  _shots.clear();
27 
28  for (edm::DetSetVector<SiStripDigi>::const_iterator it = digicoll.begin(); it != digicoll.end(); ++it) {
29  addShots(*it);
30  }
31 }
32 
34  DetId detid(digis.detId());
35 
36  int laststrip = -1;
37  int apv = -1;
38  std::vector<SiStripDigi> temp;
39 
40  for (edm::DetSet<SiStripDigi>::const_iterator digi = digis.begin(); digi != digis.end(); digi++) {
41  if (!_zs || digi->adc() > 0) {
42  if (laststrip >= digi->strip())
43  edm::LogWarning("StripNotInOrder") << "Strips not in order in DetSet<SiStripDigi>";
44  laststrip = digi->strip();
45 
46  int newapv = digi->strip() / 128;
47  if (newapv != apv) {
48  if (apv >= 0) {
49  if (temp.size() > 64) {
50  APVShot shot(temp, detid, _zs);
51  _shots.push_back(shot);
52  }
53  temp.clear();
54  }
55  apv = newapv;
56  }
57 
58  temp.push_back(*digi);
59  }
60  }
61  // last strip
62  if (temp.size() > 64) {
63  APVShot shot(temp, detid, _zs);
64  _shots.push_back(shot);
65  }
66  temp.clear();
67 }
68 
69 const std::vector<APVShot>& APVShotFinder::getShots() const { return _shots; }
iterator end()
Definition: DetSet.h:58
void computeShots(const edm::DetSet< SiStripDigi > &digis)
APVShotFinder(const bool zs=true)
void addShots(const edm::DetSet< SiStripDigi > &digis)
det_id_type detId() const
Definition: DetSet.h:74
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
iterator begin()
Definition: DetSet.h:57
std::vector< APVShot > _shots
Definition: APVShotFinder.h:31
Definition: DetId.h:17
Definition: APVShot.h:9
const std::vector< APVShot > & getShots() const
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:314
collection_type::const_iterator const_iterator
Definition: DetSet.h:31
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102