Skip to content

Commit

Permalink
lets not forget the format check
Browse files Browse the repository at this point in the history
  • Loading branch information
sihyunjeon committed Dec 1, 2024
1 parent 62c2393 commit 2679706
Show file tree
Hide file tree
Showing 9 changed files with 472 additions and 511 deletions.
24 changes: 12 additions & 12 deletions DataFormats/Phase2TrackerDigi/interface/Hit.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
#define HIT_H

class Hit {
private:
int row_;
int col_;
int adc_;
private:
int row_;
int col_;
int adc_;

public:
Hit(int row_num, int col_num, int adc_num);
public:
Hit(int row_num, int col_num, int adc_num);

void set_row(int row) { row_ = row; }
void set_col(int col) { col_ = col; }
void set_row(int row) { row_ = row; }
void set_col(int col) { col_ = col; }

int row() const { return row_; }
int col() const { return col_; }
int adc() const { return adc_; }
int row() const { return row_; }
int col() const { return col_; }
int adc() const { return adc_; }
};

#endif // HIT_H
#endif // HIT_H
108 changes: 54 additions & 54 deletions DataFormats/Phase2TrackerDigi/interface/QCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,59 @@
#define QCORE_H
#include <vector>

class QCore{

private:
std::vector<int> adcs;
std::vector<int> hits;
bool islast_;
bool isneighbour_;
int rocid_;
int ccol;
int qcrow;

public:
QCore(
int rocid,
int ccol_in,
int qcrow_in,
bool isneighbour_in,
bool islast_in,
std::vector<int> adcs_in,
std::vector<int> hits_in
);

QCore() {
rocid_ = -1;
islast_ = false;
isneighbour_ = false;
ccol = -1;
qcrow = -1;
}

void setIsLast(bool islast) { islast_ = islast; }
bool islast() const { return islast_; }

void setIsNeighbour(bool isneighbour) { isneighbour_ = isneighbour; }

int rocid() const { return rocid_; }
int get_col() const { return ccol; }
int get_row() const { return qcrow; }

std::vector<bool> getHitmap();
std::vector<int> getADCs();
std::vector<bool> encodeQCore(bool is_new_col);

const bool operator<(const QCore& other) {
if (ccol==other.ccol) { return (ccol < other.ccol); }
else { return (qcrow < other.qcrow); }
}

private:
std::vector<bool> toRocCoordinates(std::vector<bool>& hitmap);
std::vector<bool> intToBinary(int num, int length);
bool containsHit(std::vector<bool>& hitmap);
std::vector<bool> getHitmapCode(std::vector<bool> hitmap);
class QCore {
private:
std::vector<int> adcs;
std::vector<int> hits;
bool islast_;
bool isneighbour_;
int rocid_;
int ccol;
int qcrow;

public:
QCore(int rocid,
int ccol_in,
int qcrow_in,
bool isneighbour_in,
bool islast_in,
std::vector<int> adcs_in,
std::vector<int> hits_in);

QCore() {
rocid_ = -1;
islast_ = false;
isneighbour_ = false;
ccol = -1;
qcrow = -1;
}

void setIsLast(bool islast) { islast_ = islast; }
bool islast() const { return islast_; }

void setIsNeighbour(bool isneighbour) { isneighbour_ = isneighbour; }

int rocid() const { return rocid_; }
int get_col() const { return ccol; }
int get_row() const { return qcrow; }

std::vector<bool> getHitmap();
std::vector<int> getADCs();
std::vector<bool> encodeQCore(bool is_new_col);

const bool operator<(const QCore& other) {
if (ccol == other.ccol) {
return (ccol < other.ccol);
} else {
return (qcrow < other.qcrow);
}
}

private:
std::vector<bool> toRocCoordinates(std::vector<bool>& hitmap);
std::vector<bool> intToBinary(int num, int length);
bool containsHit(std::vector<bool>& hitmap);
std::vector<bool> getHitmapCode(std::vector<bool> hitmap);
};

#endif // QCORE_H
#endif // QCORE_H
43 changes: 15 additions & 28 deletions DataFormats/Phase2TrackerDigi/interface/ROCBitStream.h
Original file line number Diff line number Diff line change
@@ -1,37 +1,24 @@
#ifndef ROCBITSTREAM_H
#define ROCBITSTREAM_H
#include<vector>
#include <vector>

class ROCBitStream{
class ROCBitStream {
public:
ROCBitStream(int rocid, const std::vector<bool>& bitstream) {
rocid_ = rocid;
bitstream_ = bitstream;
}

public:
ROCBitStream(
int rocid,
const std::vector<bool>& bitstream
) {
rocid_ = rocid;
bitstream_ = bitstream;
}
ROCBitStream() { rocid_ = -1; }

ROCBitStream() {
rocid_ = -1;
}
int get_rocid() const { return rocid_; }

int get_rocid() const {
return rocid_;
}
const std::vector<bool>& get_bitstream() const { return bitstream_; }

const std::vector<bool>& get_bitstream() const {
return bitstream_;
}

const bool operator<(const ROCBitStream& other) {
return rocid_ < other.rocid_;
}

private:
int rocid_;
std::vector<bool> bitstream_;
const bool operator<(const ROCBitStream& other) { return rocid_ < other.rocid_; }

private:
int rocid_;
std::vector<bool> bitstream_;
};
#endif // ROCBITSTREAM_H
#endif // ROCBITSTREAM_H
28 changes: 14 additions & 14 deletions DataFormats/Phase2TrackerDigi/interface/ReadoutChip.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@
#include "DataFormats/Phase2TrackerDigi/interface/Hit.h"

class ReadoutChip {
std::vector<Hit> hitList;
int rocnum_;
std::vector<Hit> hitList;
int rocnum_;

public:
ReadoutChip(int rocnum, std::vector<Hit> hl);
public:
ReadoutChip(int rocnum, std::vector<Hit> hl);

unsigned int size();
int rocnum() const { return rocnum_; }
unsigned int size();
int rocnum() const { return rocnum_; }

std::vector<QCore> get_organized_QCores();
std::vector<bool> get_chip_code();
std::vector<QCore> get_organized_QCores();
std::vector<bool> get_chip_code();

private:
std::pair<int,int> get_QCore_pos(Hit hit);
private:
std::pair<int, int> get_QCore_pos(Hit hit);

QCore get_QCore_from_hit(Hit pixel);
std::vector<QCore> rem_duplicates(std::vector<QCore> qcores);
std::vector<QCore> organize_QCores(std::vector<QCore> qcores);
QCore get_QCore_from_hit(Hit pixel);
std::vector<QCore> rem_duplicates(std::vector<QCore> qcores);
std::vector<QCore> organize_QCores(std::vector<QCore> qcores);
};

#endif // READOUTCHIP_H
#endif // READOUTCHIP_H
8 changes: 3 additions & 5 deletions DataFormats/Phase2TrackerDigi/src/Hit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

// Describes the 4x4=16 bit hitmap with its row and column numbers and the ADC values
Hit::Hit(int row_num, int col_num, int adc_num) {

row_ = row_num;
col_ = col_num;
adc_ = adc_num;

row_ = row_num;
col_ = col_num;
adc_ = adc_num;
}
Loading

0 comments on commit 2679706

Please sign in to comment.