1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#include <vector>
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "DQM/SiStripCommon/interface/APVShot.h"
#include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
#include "DataFormats/Common/interface/DetSet.h"
#include "DataFormats/Common/interface/DetSetVector.h"
#include "DataFormats/DetId/interface/DetId.h"
#include "DQM/SiStripCommon/interface/APVShotFinder.h"
APVShotFinder::APVShotFinder(const bool zs) : _zs(zs), _shots() {}
APVShotFinder::APVShotFinder(const edm::DetSet<SiStripDigi>& digis, const bool zs) : _zs(zs), _shots() {
computeShots(digis);
}
APVShotFinder::APVShotFinder(const edm::DetSetVector<SiStripDigi>& digicoll, const bool zs) : _zs(zs), _shots() {
computeShots(digicoll);
}
void APVShotFinder::computeShots(const edm::DetSet<SiStripDigi>& digis) {
_shots.clear();
addShots(digis);
}
void APVShotFinder::computeShots(const edm::DetSetVector<SiStripDigi>& digicoll) {
_shots.clear();
for (edm::DetSetVector<SiStripDigi>::const_iterator it = digicoll.begin(); it != digicoll.end(); ++it) {
addShots(*it);
}
}
void APVShotFinder::addShots(const edm::DetSet<SiStripDigi>& digis) {
DetId detid(digis.detId());
int laststrip = -1;
int apv = -1;
std::vector<SiStripDigi> temp;
for (edm::DetSet<SiStripDigi>::const_iterator digi = digis.begin(); digi != digis.end(); digi++) {
if (!_zs || digi->adc() > 0) {
if (laststrip >= digi->strip())
edm::LogWarning("StripNotInOrder") << "Strips not in order in DetSet<SiStripDigi>";
laststrip = digi->strip();
int newapv = digi->strip() / 128;
if (newapv != apv) {
if (apv >= 0) {
if (temp.size() > 64) {
APVShot shot(temp, detid, _zs);
_shots.push_back(shot);
}
temp.clear();
}
apv = newapv;
}
temp.push_back(*digi);
}
}
// last strip
if (temp.size() > 64) {
APVShot shot(temp, detid, _zs);
_shots.push_back(shot);
}
temp.clear();
}
const std::vector<APVShot>& APVShotFinder::getShots() const { return _shots; }
|