CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
ApvAnalysis::PedestalType doIt (const ApvAnalysis::PedestalType &)
 
float getCMSlope ()
 
void newEvent ()
 
void setCM (TkCommonMode *in)
 
void setCM (const std::vector< float > &in)
 
 TT6CommonModeCalculator (TkNoiseCalculator *noise_calc, TkApvMask *mask_calc, float sig_cut)
 
virtual ~TT6CommonModeCalculator ()
 
- 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 (0) cout << "Constructing TT6CommonMode Calculator ..." << endl;
11  cutToAvoidSignal = sig_cut;
12 }
TkNoiseCalculator * theNoiseCalculator
tuple cout
Definition: gather_cfg.py:121
TT6CommonModeCalculator::~TT6CommonModeCalculator ( )
virtual

Definition at line 16 of file TT6CommonModeCalculator.cc.

References gather_cfg::cout.

16  {
17  if (0) cout << "Destructing TT6CommonModeCalculator " << endl;
18 }
tuple cout
Definition: gather_cfg.py:121

Member Function Documentation

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

Definition at line 85 of file TT6CommonModeCalculator.cc.

References alignCSCRings::s, slope, and python.multivaluedict::sort().

Referenced by calculateCommonMode().

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(), i, TkCommonModeTopology::initialStrips(), j, TkApvMask::mask(), TkNoiseCalculator::noise(), TkCommonModeTopology::numberOfSets(), TkApvMask::ok, setCM(), theApvMask, theCommonModeValues, theNoiseCalculator, theTkCommonMode, and TkCommonMode::topology().

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.size() > 0) {
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
int i
Definition: DBlmapReader.cc:9
std::vector< float > PedestalType
Definition: ApvAnalysis.h:48
std::vector< int > & initialStrips()
std::vector< int > & finalStrips()
virtual ApvAnalysis::PedestalType noise() const =0
int j
Definition: DBlmapReader.cc:9
TkNoiseCalculator * theNoiseCalculator
virtual TkCommonModeTopology & topology()
Definition: TkCommonMode.h:17
void calculateCMSlope(ApvAnalysis::PedestalType &)
std::vector< float > theCommonModeValues
virtual MaskType mask()=0
void setCM(TkCommonMode *in)
TkCommonMode* TT6CommonModeCalculator::commonMode ( )
inlinevirtual

Get CM value

Implements TkCommonModeCalculator.

Definition at line 23 of file TT6CommonModeCalculator.h.

References theTkCommonMode.

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

Return CM-subtracted data in APV

Implements TkCommonModeCalculator.

Definition at line 23 of file TT6CommonModeCalculator.cc.

References i, and dbtoconf::out.

Referenced by HiHelperTools.MassSearchReplaceAnyInputTagVisitor::doIt(), helpers.MassSearchReplaceAnyInputTagVisitor::doIt(), ConfigBuilder.ConfigBuilder.MassSearchReplaceProcessNameVisitor::doIt(), HiHelperTools.MassSearchReplaceAnyInputTagVisitor::enter(), helpers.MassSearchReplaceAnyInputTagVisitor::enter(), and ConfigBuilder.ConfigBuilder.MassSearchReplaceProcessNameVisitor::enter().

24 {
25  ApvAnalysis::PedestalType indat = _indat;
27  calculateCommonMode(indat);
28  int setNumber;
29  if(theCommonModeValues.size() >0) {
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 }
int i
Definition: DBlmapReader.cc:9
std::vector< float > PedestalType
Definition: ApvAnalysis.h:48
void calculateCommonMode(ApvAnalysis::PedestalType &)
tuple out
Definition: dbtoconf.py:99
virtual TkCommonModeTopology & topology()
Definition: TkCommonMode.h:17
std::vector< float > theCommonModeValues
float TT6CommonModeCalculator::getCMSlope ( )
inlinevirtual

Get Slope

Implements TkCommonModeCalculator.

Definition at line 26 of file TT6CommonModeCalculator.h.

References slope.

void TT6CommonModeCalculator::newEvent ( )
virtual

Tell CM calculator that a new event is available

Reimplemented from TkCommonModeCalculator.

Definition at line 79 of file TT6CommonModeCalculator.cc.

References alreadyUsedEvent.

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

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)
inlinevirtual

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

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(), and setCM().