CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes | Static Private Attributes
APVShot Class Reference

#include <APVShot.h>

Public Member Functions

const int apvNumber () const
 
 APVShot ()
 
 APVShot (const bool zs=true)
 
 APVShot (const std::vector< SiStripDigi > &digis, const DetId &detid, const bool zs=true)
 
void computeShot (const std::vector< SiStripDigi > &digis, const DetId &detid, const bool zs=true)
 
const unsigned int detId () const
 
const bool isGenuine () const
 
const float median () const
 
const int nStrips () const
 
const int subDet () const
 

Private Attributes

int _apv
 
DetId _detid
 
float _median
 
int _nstrips
 
bool _zs
 

Static Private Attributes

static const int _threshold = 64
 

Detailed Description

Definition at line 9 of file APVShot.h.

Constructor & Destructor Documentation

◆ APVShot() [1/3]

APVShot::APVShot ( )

Definition at line 7 of file APVShot.cc.

7 : _zs(true), _apv(-1), _nstrips(0), _median(-1), _detid() {}
DetId _detid
Definition: APVShot.h:29
float _median
Definition: APVShot.h:28
bool _zs
Definition: APVShot.h:25
int _apv
Definition: APVShot.h:26
int _nstrips
Definition: APVShot.h:27

◆ APVShot() [2/3]

APVShot::APVShot ( const bool  zs = true)

Definition at line 9 of file APVShot.cc.

9 : _zs(zs), _apv(-1), _nstrips(0), _median(-1), _detid() {}
DetId _detid
Definition: APVShot.h:29
float _median
Definition: APVShot.h:28
bool _zs
Definition: APVShot.h:25
int _apv
Definition: APVShot.h:26
int _nstrips
Definition: APVShot.h:27

◆ APVShot() [3/3]

APVShot::APVShot ( const std::vector< SiStripDigi > &  digis,
const DetId detid,
const bool  zs = true 
)

Definition at line 11 of file APVShot.cc.

References computeShot(), and ALCARECOPPSCalTrackBasedSel_cff::detid.

12  : _zs(zs), _apv(-1), _nstrips(0), _median(-1), _detid() {
13  computeShot(digis, detid, zs);
14 }
DetId _detid
Definition: APVShot.h:29
float _median
Definition: APVShot.h:28
bool _zs
Definition: APVShot.h:25
void computeShot(const std::vector< SiStripDigi > &digis, const DetId &detid, const bool zs=true)
Definition: APVShot.cc:16
int _apv
Definition: APVShot.h:26
int _nstrips
Definition: APVShot.h:27

Member Function Documentation

◆ apvNumber()

const int APVShot::apvNumber ( ) const

Definition at line 49 of file APVShot.cc.

References _apv.

49 { return _apv; }
int _apv
Definition: APVShot.h:26

◆ computeShot()

void APVShot::computeShot ( const std::vector< SiStripDigi > &  digis,
const DetId detid,
const bool  zs = true 
)

Definition at line 16 of file APVShot.cc.

References _apv, _detid, _median, _nstrips, _zs, ALCARECOTkAlJpsiMuMu_cff::charge, ALCARECOPPSCalTrackBasedSel_cff::detid, Exception, ALCARECOEcalPhiSym_cff::float, groupFilesInBlocks::reverse, and jetUpdater_cfi::sort.

Referenced by APVShot().

16  {
17  _zs = zs;
18  _detid = detid;
19 
20  _nstrips = 0;
21  _apv = -1;
22  _median = -1;
23 
24  std::vector<unsigned int> charge;
25  for (std::vector<SiStripDigi>::const_iterator digi = digis.begin(); digi != digis.end(); ++digi) {
26  if (!_zs || digi->adc() > 0) {
27  int oldapv = _apv;
28  _apv = digi->strip() / 128;
29  if (oldapv >= 0 && oldapv != _apv)
30  throw cms::Exception("WrongDigiVector") << "Digis from Different APVs";
31 
32  charge.push_back(digi->adc());
33  ++_nstrips;
34  }
35  }
36 
37  // charge to be sorted in descending order
38 
39  std::sort(charge.begin(), charge.end());
40  std::reverse(charge.begin(), charge.end());
41 
42  if (charge.size() > 64) {
43  _median = float(charge[64]);
44  }
45 }
DetId _detid
Definition: APVShot.h:29
float _median
Definition: APVShot.h:28
bool _zs
Definition: APVShot.h:25
int _apv
Definition: APVShot.h:26
int _nstrips
Definition: APVShot.h:27

◆ detId()

const unsigned int APVShot::detId ( ) const

Definition at line 57 of file APVShot.cc.

References _detid, and DetId::rawId().

57 { return _detid.rawId(); }
DetId _detid
Definition: APVShot.h:29
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57

◆ isGenuine()

const bool APVShot::isGenuine ( ) const

Definition at line 47 of file APVShot.cc.

References _nstrips, and _threshold.

47 { return (_nstrips > _threshold); }
static const int _threshold
Definition: APVShot.h:31
int _nstrips
Definition: APVShot.h:27

◆ median()

const float APVShot::median ( ) const

Definition at line 53 of file APVShot.cc.

References _median.

53 { return _median; }
float _median
Definition: APVShot.h:28

◆ nStrips()

const int APVShot::nStrips ( ) const

Definition at line 51 of file APVShot.cc.

References _nstrips.

51 { return _nstrips; }
int _nstrips
Definition: APVShot.h:27

◆ subDet()

const int APVShot::subDet ( ) const

Definition at line 55 of file APVShot.cc.

References _detid, and DetId::subdetId().

55 { return _detid.subdetId(); }
DetId _detid
Definition: APVShot.h:29
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48

Member Data Documentation

◆ _apv

int APVShot::_apv
private

Definition at line 26 of file APVShot.h.

Referenced by apvNumber(), and computeShot().

◆ _detid

DetId APVShot::_detid
private

Definition at line 29 of file APVShot.h.

Referenced by computeShot(), detId(), and subDet().

◆ _median

float APVShot::_median
private

Definition at line 28 of file APVShot.h.

Referenced by computeShot(), and median().

◆ _nstrips

int APVShot::_nstrips
private

Definition at line 27 of file APVShot.h.

Referenced by computeShot(), isGenuine(), and nStrips().

◆ _threshold

const int APVShot::_threshold = 64
staticprivate

Definition at line 31 of file APVShot.h.

Referenced by isGenuine().

◆ _zs

bool APVShot::_zs
private

Definition at line 25 of file APVShot.h.

Referenced by computeShot().