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 ( TkNoiseCalculator noise_calc,
TkApvMask mask_calc,
float  sig_cut 
)

Definition at line 5 of file TT6CommonModeCalculator.cc.

References gather_cfg::cout, and cutToAvoidSignal.

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

Definition at line 16 of file TT6CommonModeCalculator.cc.

References gather_cfg::cout, and doIt().

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

Member Function Documentation

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

Definition at line 85 of file TT6CommonModeCalculator.cc.

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

Referenced by calculateCommonMode(), and getCMSlope().

85  {
86  if (indat.size() != 128) {
87  slope = -100.0;
88  return;
89  }
91  diffVec.clear();
92  for(int s=0;s<64;s++) diffVec.push_back(indat[s+64]-indat[s]);
93  std::sort(diffVec.begin(),diffVec.end());
94  slope = (diffVec[31]+diffVec[32])/2./64.;
95 }
std::vector< float > PedestalType
Definition: ApvAnalysis.h:48
void TT6CommonModeCalculator::calculateCommonMode ( ApvAnalysis::PedestalType indat)
protected

Definition at line 42 of file TT6CommonModeCalculator.cc.

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

Referenced by doIt(), and getCMSlope().

43 {
44  if (alreadyUsedEvent == false) {
45  alreadyUsedEvent = true;
46  // cout<< "I am inside the calculateCommonMode"<<endl;
47  TkApvMask::MaskType strip_mask = theApvMask->mask();
49  theCommonModeValues.clear();
50 
51  if(!strip_noise.empty()) {
52  int nSet = theTkCommonMode->topology().numberOfSets();
53  for (int i=0; i<nSet; i++){
54  int initial = theTkCommonMode->topology().initialStrips()[i];
55  int final = theTkCommonMode->topology().finalStrips()[i];
56  double sumVal = 0.0;
57  double sumWt = 0.0;
58  for (int j = initial; j <= final; j++) {
59  if (strip_mask[j] == TkApvMask::ok ) {
60  if(fabs(indat[j]) < cutToAvoidSignal*strip_noise[j]) {
61  double nWeight = 1/(strip_noise[j]*strip_noise[j]);
62  sumVal += (indat[j]*nWeight);
63  sumWt += nWeight;
64  }
65  }
66  }
67  double avVal = (sumWt) ? sumVal/sumWt :0.0;
68  theCommonModeValues.push_back(static_cast<float>(avVal));
69  //cout <<"Setting CM values"<<endl;
70  }
71  }
72  }
74  calculateCMSlope(indat);
75 }
std::vector< StripMaskType > MaskType
Definition: TkApvMask.h:17
std::vector< float > PedestalType
Definition: ApvAnalysis.h:48
virtual ApvAnalysis::PedestalType noise() const =0
std::vector< int > & initialStrips()
void setCM(TkCommonMode *in) override
std::vector< int > & finalStrips()
TkNoiseCalculator * theNoiseCalculator
virtual TkCommonModeTopology & topology()
Definition: TkCommonMode.h:17
void calculateCMSlope(ApvAnalysis::PedestalType &)
std::vector< float > theCommonModeValues
virtual MaskType mask()=0
TkCommonMode* TT6CommonModeCalculator::commonMode ( )
inlineoverridevirtual

Get CM value

Implements TkCommonModeCalculator.

Definition at line 23 of file TT6CommonModeCalculator.h.

References newEvent(), and theTkCommonMode.

23 {return theTkCommonMode;}
ApvAnalysis::PedestalType TT6CommonModeCalculator::doIt ( const ApvAnalysis::PedestalType )
overridevirtual

Return CM-subtracted data in APV

Implements TkCommonModeCalculator.

Definition at line 23 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(), ConfigBuilder.ConfigBuilder.MassSearchReplaceProcessNameVisitor::enter(), and ~TT6CommonModeCalculator().

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

Get Slope

Implements TkCommonModeCalculator.

Definition at line 26 of file TT6CommonModeCalculator.h.

References calculateCMSlope(), calculateCommonMode(), and slope.

void TT6CommonModeCalculator::newEvent ( )
overridevirtual

Tell CM calculator that a new event is available

Reimplemented from TkCommonModeCalculator.

Definition at line 79 of file TT6CommonModeCalculator.cc.

References alreadyUsedEvent.

Referenced by commonMode().

79  {
80  alreadyUsedEvent = false;
81 }
void TT6CommonModeCalculator::setCM ( TkCommonMode in)
inlineoverridevirtual

Implements TkCommonModeCalculator.

Definition at line 21 of file TT6CommonModeCalculator.h.

References recoMuon::in, and theTkCommonMode.

Referenced by calculateCommonMode().

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

Implements TkCommonModeCalculator.

Definition at line 22 of file TT6CommonModeCalculator.h.

References TkCommonMode::setCommonMode(), and theTkCommonMode.

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

Member Data Documentation

bool TT6CommonModeCalculator::alreadyUsedEvent
protected

Definition at line 37 of file TT6CommonModeCalculator.h.

Referenced by calculateCommonMode(), and newEvent().

float TT6CommonModeCalculator::cutToAvoidSignal
protected

Definition at line 41 of file TT6CommonModeCalculator.h.

Referenced by calculateCommonMode(), and TT6CommonModeCalculator().

float TT6CommonModeCalculator::slope
protected
TkApvMask* TT6CommonModeCalculator::theApvMask
protected

Definition at line 36 of file TT6CommonModeCalculator.h.

Referenced by calculateCommonMode().

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

Definition at line 34 of file TT6CommonModeCalculator.h.

Referenced by calculateCommonMode(), and doIt().

TkNoiseCalculator* TT6CommonModeCalculator::theNoiseCalculator
protected

Definition at line 35 of file TT6CommonModeCalculator.h.

Referenced by calculateCommonMode().

TkCommonMode* TT6CommonModeCalculator::theTkCommonMode
protected

Definition at line 33 of file TT6CommonModeCalculator.h.

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