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; }
edm::DetSetVector< SiStripDigi >
APVShot.h
MessageLogger.h
edm::DetSetVector::end
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
edm::DetSet< SiStripDigi >
APVShotFinder.h
APVShot
Definition: APVShot.h:9
APVShotFinder::APVShotFinder
APVShotFinder(const bool zs=true)
Definition: APVShotFinder.cc:10
edm::DetSet::begin
iterator begin()
Definition: DetSet.h:57
edm::DetSetVector::begin
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:314
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
DetId
Definition: DetId.h:17
SiStripDigi.h
APVShotFinder::_zs
bool _zs
Definition: APVShotFinder.h:30
edm::LogWarning
Definition: MessageLogger.h:141
edm::DetSetVector::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
APVShotFinder::addShots
void addShots(const edm::DetSet< SiStripDigi > &digis)
Definition: APVShotFinder.cc:33
edm::DetSet::detId
det_id_type detId() const
Definition: DetSet.h:74
DetSetVector.h
APVShotFinder::_shots
std::vector< APVShot > _shots
Definition: APVShotFinder.h:31
DetId.h
DetSet.h
edm::DetSet::end
iterator end()
Definition: DetSet.h:58
APVShotFinder::getShots
const std::vector< APVShot > & getShots() const
Definition: APVShotFinder.cc:69
APVShotFinder::computeShots
void computeShots(const edm::DetSet< SiStripDigi > &digis)
Definition: APVShotFinder.cc:20
edm::DetSet::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSet.h:31