CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
TT6CommonModeCalculator Class Reference

#include <TT6CommonModeCalculator.h>

Inheritance diagram for TT6CommonModeCalculator:
TkCommonModeCalculator

Public Member Functions

TkCommonModecommonMode () override
 
ApvAnalysis::PedestalType doIt (const ApvAnalysis::PedestalType &) override
 
float getCMSlope () override
 
void newEvent () override
 
void setCM (const std::vector< float > &in) override
 
void setCM (TkCommonMode *in) override
 
 TT6CommonModeCalculator (TkNoiseCalculator *noise_calc, TkApvMask *mask_calc, float sig_cut)
 
 ~TT6CommonModeCalculator () override
 
- Public Member Functions inherited from TkCommonModeCalculator
virtual ~TkCommonModeCalculator ()
 

Protected Member Functions

void calculateCMSlope (ApvAnalysis::PedestalType &)
 
void calculateCommonMode (ApvAnalysis::PedestalType &)
 

Protected Attributes

bool alreadyUsedEvent
 
float cutToAvoidSignal
 
float slope
 
TkApvMasktheApvMask
 
std::vector< float > theCommonModeValues
 
TkNoiseCalculatortheNoiseCalculator
 
TkCommonModetheTkCommonMode
 

Detailed Description

Concrete implementation of TkCommonModeCalculator for TT6.

Definition at line 11 of file TT6CommonModeCalculator.h.

Constructor & Destructor Documentation

◆ TT6CommonModeCalculator()

TT6CommonModeCalculator::TT6CommonModeCalculator ( TkNoiseCalculator noise_calc,
TkApvMask mask_calc,
float  sig_cut 
)

Definition at line 5 of file TT6CommonModeCalculator.cc.

6  : theNoiseCalculator(noise_calc), theApvMask(mask_calc), alreadyUsedEvent(false) {
7  if (false)
8  cout << "Constructing TT6CommonMode Calculator ..." << endl;
9  cutToAvoidSignal = sig_cut;
10 }

References gather_cfg::cout, and cutToAvoidSignal.

◆ ~TT6CommonModeCalculator()

TT6CommonModeCalculator::~TT6CommonModeCalculator ( )
override

Definition at line 14 of file TT6CommonModeCalculator.cc.

14  {
15  if (false)
16  cout << "Destructing TT6CommonModeCalculator " << endl;
17 }

References gather_cfg::cout.

Member Function Documentation

◆ calculateCMSlope()

void TT6CommonModeCalculator::calculateCMSlope ( ApvAnalysis::PedestalType indat)
protected

Definition at line 79 of file TT6CommonModeCalculator.cc.

79  {
80  if (indat.size() != 128) {
81  slope = -100.0;
82  return;
83  }
85  diffVec.clear();
86  for (int s = 0; s < 64; s++)
87  diffVec.push_back(indat[s + 64] - indat[s]);
88  std::sort(diffVec.begin(), diffVec.end());
89  slope = (diffVec[31] + diffVec[32]) / 2. / 64.;
90 }

References alignCSCRings::s, and slope.

Referenced by calculateCommonMode().

◆ calculateCommonMode()

void TT6CommonModeCalculator::calculateCommonMode ( ApvAnalysis::PedestalType indat)
protected

Definition at line 39 of file TT6CommonModeCalculator.cc.

39  {
40  if (alreadyUsedEvent == false) {
41  alreadyUsedEvent = true;
42  // cout<< "I am inside the calculateCommonMode"<<endl;
43  TkApvMask::MaskType strip_mask = theApvMask->mask();
45  theCommonModeValues.clear();
46 
47  if (!strip_noise.empty()) {
48  int nSet = theTkCommonMode->topology().numberOfSets();
49  for (int i = 0; i < nSet; i++) {
50  int initial = theTkCommonMode->topology().initialStrips()[i];
51  int final = theTkCommonMode->topology().finalStrips()[i];
52  double sumVal = 0.0;
53  double sumWt = 0.0;
54  for (int j = initial; j <= final; j++) {
55  if (strip_mask[j] == TkApvMask::ok) {
56  if (fabs(indat[j]) < cutToAvoidSignal * strip_noise[j]) {
57  double nWeight = 1 / (strip_noise[j] * strip_noise[j]);
58  sumVal += (indat[j] * nWeight);
59  sumWt += nWeight;
60  }
61  }
62  }
63  double avVal = (sumWt) ? sumVal / sumWt : 0.0;
64  theCommonModeValues.push_back(static_cast<float>(avVal));
65  //cout <<"Setting CM values"<<endl;
66  }
67  }
68  }
70  calculateCMSlope(indat);
71 }

References alreadyUsedEvent, calculateCMSlope(), cutToAvoidSignal, TkCommonModeTopology::finalStrips(), mps_fire::i, TkCommonModeTopology::initialStrips(), dqmiolumiharvest::j, TkApvMask::mask(), TkNoiseCalculator::noise(), TkCommonModeTopology::numberOfSets(), TkApvMask::ok, setCM(), theApvMask, theCommonModeValues, theNoiseCalculator, theTkCommonMode, and TkCommonMode::topology().

Referenced by doIt().

◆ commonMode()

TkCommonMode* TT6CommonModeCalculator::commonMode ( )
inlineoverridevirtual

Get CM value

Implements TkCommonModeCalculator.

Definition at line 21 of file TT6CommonModeCalculator.h.

21 { return theTkCommonMode; }

References theTkCommonMode.

◆ doIt()

ApvAnalysis::PedestalType TT6CommonModeCalculator::doIt ( const ApvAnalysis::PedestalType )
overridevirtual

◆ getCMSlope()

float TT6CommonModeCalculator::getCMSlope ( )
inlineoverridevirtual

Get Slope

Implements TkCommonModeCalculator.

Definition at line 24 of file TT6CommonModeCalculator.h.

24 { return slope; }

References slope.

◆ newEvent()

void TT6CommonModeCalculator::newEvent ( )
overridevirtual

Tell CM calculator that a new event is available

Reimplemented from TkCommonModeCalculator.

Definition at line 75 of file TT6CommonModeCalculator.cc.

75 { alreadyUsedEvent = false; }

References alreadyUsedEvent.

◆ setCM() [1/2]

void TT6CommonModeCalculator::setCM ( const std::vector< float > &  in)
inlineoverridevirtual

◆ setCM() [2/2]

void TT6CommonModeCalculator::setCM ( TkCommonMode in)
inlineoverridevirtual

Implements TkCommonModeCalculator.

Definition at line 19 of file TT6CommonModeCalculator.h.

19 { theTkCommonMode = in; }

References recoMuon::in, and theTkCommonMode.

Referenced by calculateCommonMode().

Member Data Documentation

◆ alreadyUsedEvent

bool TT6CommonModeCalculator::alreadyUsedEvent
protected

Definition at line 34 of file TT6CommonModeCalculator.h.

Referenced by calculateCommonMode(), and newEvent().

◆ cutToAvoidSignal

float TT6CommonModeCalculator::cutToAvoidSignal
protected

Definition at line 37 of file TT6CommonModeCalculator.h.

Referenced by calculateCommonMode(), and TT6CommonModeCalculator().

◆ slope

float TT6CommonModeCalculator::slope
protected

Definition at line 35 of file TT6CommonModeCalculator.h.

Referenced by calculateCMSlope(), and getCMSlope().

◆ theApvMask

TkApvMask* TT6CommonModeCalculator::theApvMask
protected

Definition at line 33 of file TT6CommonModeCalculator.h.

Referenced by calculateCommonMode().

◆ theCommonModeValues

std::vector<float> TT6CommonModeCalculator::theCommonModeValues
protected

Definition at line 31 of file TT6CommonModeCalculator.h.

Referenced by calculateCommonMode(), and doIt().

◆ theNoiseCalculator

TkNoiseCalculator* TT6CommonModeCalculator::theNoiseCalculator
protected

Definition at line 32 of file TT6CommonModeCalculator.h.

Referenced by calculateCommonMode().

◆ theTkCommonMode

TkCommonMode* TT6CommonModeCalculator::theTkCommonMode
protected

Definition at line 30 of file TT6CommonModeCalculator.h.

Referenced by calculateCommonMode(), commonMode(), doIt(), and setCM().

TkCommonModeTopology::initialStrips
std::vector< int > & initialStrips()
Definition: TkCommonModeTopology.h:26
mps_fire.i
i
Definition: mps_fire.py:355
TkApvMask::MaskType
std::vector< StripMaskType > MaskType
Definition: TkApvMask.h:15
TT6CommonModeCalculator::setCM
void setCM(TkCommonMode *in) override
Definition: TT6CommonModeCalculator.h:19
TkCommonModeTopology::setOfStrip
int setOfStrip(int)
Definition: TkCommonModeTopology.cc:3
gather_cfg.cout
cout
Definition: gather_cfg.py:144
TkCommonModeTopology::finalStrips
std::vector< int > & finalStrips()
Definition: TkCommonModeTopology.h:27
TT6CommonModeCalculator::slope
float slope
Definition: TT6CommonModeCalculator.h:35
TT6CommonModeCalculator::calculateCommonMode
void calculateCommonMode(ApvAnalysis::PedestalType &)
Definition: TT6CommonModeCalculator.cc:39
TkApvMask::mask
virtual MaskType mask()=0
TT6CommonModeCalculator::theTkCommonMode
TkCommonMode * theTkCommonMode
Definition: TT6CommonModeCalculator.h:30
alignCSCRings.s
s
Definition: alignCSCRings.py:92
TT6CommonModeCalculator::calculateCMSlope
void calculateCMSlope(ApvAnalysis::PedestalType &)
Definition: TT6CommonModeCalculator.cc:79
TkCommonModeTopology::numberOfSets
int numberOfSets() const
Definition: TkCommonModeTopology.h:22
TkNoiseCalculator::noise
virtual ApvAnalysis::PedestalType noise() const =0
TkCommonMode::setCommonMode
void setCommonMode(const std::vector< float > &in)
Definition: TkCommonMode.h:21
recoMuon::in
Definition: RecoMuonEnumerators.h:6
TkApvMask::ok
Definition: TkApvMask.h:13
TT6CommonModeCalculator::alreadyUsedEvent
bool alreadyUsedEvent
Definition: TT6CommonModeCalculator.h:34
TT6CommonModeCalculator::theApvMask
TkApvMask * theApvMask
Definition: TT6CommonModeCalculator.h:33
TT6CommonModeCalculator::theNoiseCalculator
TkNoiseCalculator * theNoiseCalculator
Definition: TT6CommonModeCalculator.h:32
TT6CommonModeCalculator::cutToAvoidSignal
float cutToAvoidSignal
Definition: TT6CommonModeCalculator.h:37
TT6CommonModeCalculator::theCommonModeValues
std::vector< float > theCommonModeValues
Definition: TT6CommonModeCalculator.h:31
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
ApvAnalysis::PedestalType
std::vector< float > PedestalType
Definition: ApvAnalysis.h:44
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
TkCommonMode::topology
virtual TkCommonModeTopology & topology()
Definition: TkCommonMode.h:17