Skip to content

Commit 6118c11

Browse files
authored
Merge/cmssw 14 1 x qcore producer backup (#6)
* code check * address floor comment
1 parent cfa1103 commit 6118c11

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

DataFormats/Phase2TrackerDigi/src/Phase2ITChip.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ std::vector<Phase2ITQCore> Phase2ITChip::rem_duplicates(std::vector<Phase2ITQCor
6060
//Returns a list of the qcores with hits arranged by increasing column and then row numbers
6161
std::vector<Phase2ITQCore> Phase2ITChip::organize_QCores(std::vector<Phase2ITQCore> qcores) {
6262
std::vector<Phase2ITQCore> organized_list = {};
63-
while (qcores.size() > 0) {
63+
while (!qcores.empty()) {
6464
int min = 0;
6565

6666
for (size_t i = 1; i < qcores.size(); i++) {
@@ -87,7 +87,7 @@ std::vector<Phase2ITQCore> link_QCores(std::vector<Phase2ITQCore> qcores) {
8787
}
8888

8989
//.size() is unsigned. If size is zero size()-1 is a huge number hence this needs to be protected
90-
if (qcores.size() > 0) {
90+
if (!qcores.empty()) {
9191
for (size_t i = 0; i < qcores.size() - 1; i++) {
9292
if (qcores[i].get_col() != qcores[i + 1].get_col()) {
9393
qcores[i].setIsLast(true);
@@ -103,6 +103,7 @@ std::vector<Phase2ITQCore> link_QCores(std::vector<Phase2ITQCore> qcores) {
103103
std::vector<Phase2ITQCore> Phase2ITChip::get_organized_QCores() {
104104
std::vector<Phase2ITQCore> qcores = {};
105105

106+
qcores.reserve(hitList_.size());
106107
for (const auto& hit : hitList_) {
107108
qcores.push_back(get_QCore_from_hit(hit));
108109
}
@@ -114,7 +115,7 @@ std::vector<Phase2ITQCore> Phase2ITChip::get_organized_QCores() {
114115
std::vector<bool> Phase2ITChip::get_chip_code() {
115116
std::vector<bool> code = {};
116117

117-
if (hitList_.size() > 0) {
118+
if (!hitList_.empty()) {
118119
std::vector<Phase2ITQCore> qcores = get_organized_QCores();
119120
bool is_new_col = true;
120121

DataFormats/Phase2TrackerDigi/src/Phase2ITQCore.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ std::vector<bool> Phase2ITQCore::toRocCoordinates(std::vector<bool>& hitmap) {
2525
std::vector<bool> ROC_hitmap(16, false);
2626

2727
for (size_t i = 0; i < hitmap.size(); i++) {
28-
int row = std::floor(i / 4);
28+
int row = i / 4;
2929
int col = i % 4;
3030
int new_row;
3131
int new_col;
@@ -34,7 +34,7 @@ std::vector<bool> Phase2ITQCore::toRocCoordinates(std::vector<bool>& hitmap) {
3434
new_row = row / 2;
3535
new_col = 2 * col;
3636
} else {
37-
new_row = std::floor(row / 2);
37+
new_row = row / 2;
3838
new_col = 2 * col + 1;
3939
}
4040

@@ -49,6 +49,7 @@ std::vector<bool> Phase2ITQCore::toRocCoordinates(std::vector<bool>& hitmap) {
4949
std::vector<bool> Phase2ITQCore::getHitmap() {
5050
std::vector<bool> hitmap = {};
5151

52+
hitmap.reserve(hits_.size());
5253
for (auto hit : hits_) {
5354
hitmap.push_back(hit > 0);
5455
}
@@ -59,6 +60,7 @@ std::vector<bool> Phase2ITQCore::getHitmap() {
5960
std::vector<int> Phase2ITQCore::getADCs() {
6061
std::vector<int> adcmap = {};
6162

63+
adcmap.reserve(adcs_.size());
6264
for (auto adc : adcs_) {
6365
adcmap.push_back(adc);
6466
}

EventFilter/Phase2PixelRawToDigi/plugins/Phase2ITQCoreProducer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Phase2ITQCoreProducer : public edm::stream::EDProducer<> {
3838
~Phase2ITQCoreProducer() override = default;
3939

4040
private:
41-
virtual void produce(edm::Event&, const edm::EventSetup&);
41+
void produce(edm::Event&, const edm::EventSetup&) override;
4242

4343
const edm::InputTag src_;
4444
const edm::EDGetTokenT<edm::DetSetVector<PixelDigi>> pixelDigi_token_;

0 commit comments

Comments
 (0)