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 (TkCommonMode *in) override
 
void setCM (const std::vector< float > &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.

References gather_cfg::cout, and cutToAvoidSignal.

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

◆ ~TT6CommonModeCalculator()

TT6CommonModeCalculator::~TT6CommonModeCalculator ( )
override

Definition at line 14 of file TT6CommonModeCalculator.cc.

References gather_cfg::cout.

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

Member Function Documentation

◆ calculateCMSlope()

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

Definition at line 79 of file TT6CommonModeCalculator.cc.

References alignCSCRings::s, slope, and jetUpdater_cfi::sort.

Referenced by calculateCommonMode().

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 }
std::vector< float > PedestalType
Definition: ApvAnalysis.h:44

◆ calculateCommonMode()

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

Definition at line 39 of file TT6CommonModeCalculator.cc.

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().

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 }
std::vector< StripMaskType > MaskType
Definition: TkApvMask.h:15
std::vector< float > PedestalType
Definition: ApvAnalysis.h:44
std::vector< int > & initialStrips()
void setCM(TkCommonMode *in) override
std::vector< int > & finalStrips()
virtual ApvAnalysis::PedestalType noise() const =0
TkNoiseCalculator * theNoiseCalculator
virtual TkCommonModeTopology & topology()
Definition: TkCommonMode.h:17
void calculateCMSlope(ApvAnalysis::PedestalType &)
std::vector< float > theCommonModeValues
virtual MaskType mask()=0

◆ commonMode()

TkCommonMode* TT6CommonModeCalculator::commonMode ( )
inlineoverridevirtual

Get CM value

Implements TkCommonModeCalculator.

Definition at line 21 of file TT6CommonModeCalculator.h.

References theTkCommonMode.

21 { return theTkCommonMode; }

◆ doIt()

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

Return CM-subtracted data in APV

Implements TkCommonModeCalculator.

Definition at line 21 of file TT6CommonModeCalculator.cc.

References calculateCommonMode(), mps_fire::i, MillePedeFileConverter_cfg::out, TkCommonModeTopology::setOfStrip(), theCommonModeValues, theTkCommonMode, and TkCommonMode::topology().

Referenced by MassReplace.MassSearchReplaceAnyInputTagVisitor::doIt(), ConfigBuilder.ConfigBuilder.MassSearchReplaceProcessNameVisitor::doIt(), MassReplace.MassSearchReplaceAnyInputTagVisitor::enter(), MassReplace.MassSearchReplaceParamVisitor::enter(), and ConfigBuilder.ConfigBuilder.MassSearchReplaceProcessNameVisitor::enter().

21  {
22  ApvAnalysis::PedestalType indat = _indat;
24  calculateCommonMode(indat);
25  int setNumber;
26  if (!theCommonModeValues.empty()) {
27  for (unsigned int i = 0; i < indat.size(); i++) {
28  setNumber = theTkCommonMode->topology().setOfStrip(i);
29  out.push_back(indat[i] - theCommonModeValues[setNumber]);
30  }
31  } else {
32  out = indat;
33  }
34  return out;
35 }
std::vector< float > PedestalType
Definition: ApvAnalysis.h:44
void calculateCommonMode(ApvAnalysis::PedestalType &)
virtual TkCommonModeTopology & topology()
Definition: TkCommonMode.h:17
std::vector< float > theCommonModeValues

◆ getCMSlope()

float TT6CommonModeCalculator::getCMSlope ( )
inlineoverridevirtual

Get Slope

Implements TkCommonModeCalculator.

Definition at line 24 of file TT6CommonModeCalculator.h.

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.

References alreadyUsedEvent.

◆ setCM() [1/2]

void TT6CommonModeCalculator::setCM ( TkCommonMode in)
inlineoverridevirtual

Implements TkCommonModeCalculator.

Definition at line 19 of file TT6CommonModeCalculator.h.

References recoMuon::in, and theTkCommonMode.

Referenced by calculateCommonMode().

◆ setCM() [2/2]

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

Implements TkCommonModeCalculator.

Definition at line 20 of file TT6CommonModeCalculator.h.

References recoMuon::in, TkCommonMode::setCommonMode(), and theTkCommonMode.

void setCommonMode(const std::vector< float > &in)
Definition: TkCommonMode.h:21

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().