Skip to content
This repository has been archived by the owner on Jun 12, 2019. It is now read-only.

Commit

Permalink
[rechits] add enum for common mode noise method
Browse files Browse the repository at this point in the history
  • Loading branch information
ThorbenQuast committed Nov 18, 2018
1 parent ae8d055 commit 8652687
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 32 deletions.
69 changes: 37 additions & 32 deletions Reco/plugins/HGCalTBRecHitProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,13 @@ void HGCalTBRecHitProducer::beginJob()
else _preselectionMethod = NONE;
// std::cout << essource_.adccalibmap_ << std::endl;

edm::Service<TFileService> fs;
if ( m_subtractCommonModeOption == "chip" ) _commonModeSubtractionMethod = CM_PERCHIP;
else if ( m_subtractCommonModeOption == "board" ) _commonModeSubtractionMethod = CM_PERBOARD;
else if ( m_subtractCommonModeOption == "board_thr" ) _commonModeSubtractionMethod = CM_PERBOARDWITHTHRESHOLD;
else _commonModeSubtractionMethod = CM_PERCHIP;


edm::Service<TFileService> fs;

std::ostringstream os( std::ostringstream::ate );
for (int ib = 0; ib < HGCAL_TB_GEOMETRY::NUMBER_OF_HEXABOARD; ib++) {
Expand Down Expand Up @@ -93,11 +98,11 @@ void HGCalTBRecHitProducer::produce(edm::Event& event, const edm::EventSetup& iS
event.getByToken(m_HGCalTBRawHitCollection, rawhits);

CommonMode cm(essource_.emap_);//default is common mode per chip using the median
if( m_subtractCommonModeOption=="chip" ){}
else if( m_subtractCommonModeOption=="board" )
cm=CommonMode(essource_.emap_, true, false);
else if( m_subtractCommonModeOption=="board_thr" )
cm=CommonMode(essource_.emap_, false, false, m_commonModeThreshold, m_expectedMaxTimeSample);
if ( _commonModeSubtractionMethod == CM_PERCHIP ) {}
else if ( _commonModeSubtractionMethod == CM_PERBOARD )
cm = CommonMode(essource_.emap_, true, false);
else if ( _commonModeSubtractionMethod == CM_PERBOARDWITHTHRESHOLD )
cm = CommonMode(essource_.emap_, false, false, m_commonModeThreshold, m_expectedMaxTimeSample);

if (m_subtractCommonMode) cm.Evaluate( rawhits );
std::map<int, commonModeNoise> cmMap = cm.CommonModeNoiseMap();
Expand Down Expand Up @@ -129,39 +134,39 @@ void HGCalTBRecHitProducer::produce(edm::Event& event, const edm::EventSetup& iS
subHG[it] = 0;
subLG[it] = 0;
}
if( m_subtractCommonMode ){
int cmKey = m_subtractCommonModeOption=="chip" ? iski : iboard;
if ( m_subtractCommonMode ) {
int cmKey = _commonModeSubtractionMethod == CM_PERCHIP ? iski : iboard;
switch ( rawhit.detid().cellType() ) {
default :
break;
break;
case 0:
for ( int it = 0; it < NUMBER_OF_TIME_SAMPLES; it++ ) {
subHG[it] = cmMap[cmKey].fullHG[(m_TSForCommonModeNoiseSubtraction == -1) ? it : m_TSForCommonModeNoiseSubtraction] ;
subLG[it] = cmMap[cmKey].fullLG[(m_TSForCommonModeNoiseSubtraction == -1) ? it : m_TSForCommonModeNoiseSubtraction] ;
}
break;
for ( int it = 0; it < NUMBER_OF_TIME_SAMPLES; it++ ) {
subHG[it] = cmMap[cmKey].fullHG[(m_TSForCommonModeNoiseSubtraction == -1) ? it : m_TSForCommonModeNoiseSubtraction] ;
subLG[it] = cmMap[cmKey].fullLG[(m_TSForCommonModeNoiseSubtraction == -1) ? it : m_TSForCommonModeNoiseSubtraction] ;
}
break;
case 2 :
for ( int it = 0; it < NUMBER_OF_TIME_SAMPLES; it++ ) {
subHG[it] = cmMap[cmKey].halfHG[(m_TSForCommonModeNoiseSubtraction == -1) ? it : m_TSForCommonModeNoiseSubtraction] ;
subLG[it] = cmMap[cmKey].halfLG[(m_TSForCommonModeNoiseSubtraction == -1) ? it : m_TSForCommonModeNoiseSubtraction] ;
}
break;
for ( int it = 0; it < NUMBER_OF_TIME_SAMPLES; it++ ) {
subHG[it] = cmMap[cmKey].halfHG[(m_TSForCommonModeNoiseSubtraction == -1) ? it : m_TSForCommonModeNoiseSubtraction] ;
subLG[it] = cmMap[cmKey].halfLG[(m_TSForCommonModeNoiseSubtraction == -1) ? it : m_TSForCommonModeNoiseSubtraction] ;
}
break;
case 3 :
for ( int it = 0; it < NUMBER_OF_TIME_SAMPLES; it++ ) {
subHG[it] = cmMap[cmKey].mouseBiteHG[(m_TSForCommonModeNoiseSubtraction == -1) ? it : m_TSForCommonModeNoiseSubtraction] ;
subLG[it] = cmMap[cmKey].mouseBiteLG[(m_TSForCommonModeNoiseSubtraction == -1) ? it : m_TSForCommonModeNoiseSubtraction] ;
}
break;
for ( int it = 0; it < NUMBER_OF_TIME_SAMPLES; it++ ) {
subHG[it] = cmMap[cmKey].mouseBiteHG[(m_TSForCommonModeNoiseSubtraction == -1) ? it : m_TSForCommonModeNoiseSubtraction] ;
subLG[it] = cmMap[cmKey].mouseBiteLG[(m_TSForCommonModeNoiseSubtraction == -1) ? it : m_TSForCommonModeNoiseSubtraction] ;
}
break;
case 4 : for ( int it = 0; it < NUMBER_OF_TIME_SAMPLES; it++ ) {
subHG[it] = cmMap[cmKey].outerHG[(m_TSForCommonModeNoiseSubtraction == -1) ? it : m_TSForCommonModeNoiseSubtraction] ;
subLG[it] = cmMap[cmKey].outerLG[(m_TSForCommonModeNoiseSubtraction == -1) ? it : m_TSForCommonModeNoiseSubtraction] ;
}
break;
subHG[it] = cmMap[cmKey].outerHG[(m_TSForCommonModeNoiseSubtraction == -1) ? it : m_TSForCommonModeNoiseSubtraction] ;
subLG[it] = cmMap[cmKey].outerLG[(m_TSForCommonModeNoiseSubtraction == -1) ? it : m_TSForCommonModeNoiseSubtraction] ;
}
break;
case 5 : for ( int it = 0; it < NUMBER_OF_TIME_SAMPLES; it++ ) {
subHG[it] = cmMap[cmKey].mergedHG[(m_TSForCommonModeNoiseSubtraction == -1) ? it : m_TSForCommonModeNoiseSubtraction] ;
subLG[it] = cmMap[cmKey].mergedLG[(m_TSForCommonModeNoiseSubtraction == -1) ? it : m_TSForCommonModeNoiseSubtraction] ;
}
break;
subHG[it] = cmMap[cmKey].mergedHG[(m_TSForCommonModeNoiseSubtraction == -1) ? it : m_TSForCommonModeNoiseSubtraction] ;
subLG[it] = cmMap[cmKey].mergedLG[(m_TSForCommonModeNoiseSubtraction == -1) ? it : m_TSForCommonModeNoiseSubtraction] ;
}
break;
}
}
for ( int it = 0; it < NUMBER_OF_TIME_SAMPLES; it++ ) {
Expand Down
8 changes: 8 additions & 0 deletions Reco/plugins/HGCalTBRecHitProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ enum PreselectionMethod {
NONE
};

enum CommonModeSubtractionMethod {
CM_PERBOARD = 0,
CM_PERCHIP,
CM_PERBOARDWITHTHRESHOLD
};

class HGCalTBRecHitProducer : public edm::EDProducer
{
public:
Expand Down Expand Up @@ -64,6 +70,8 @@ class HGCalTBRecHitProducer : public edm::EDProducer
std::string m_preselectionMethod;
PreselectionMethod _preselectionMethod;

CommonModeSubtractionMethod _commonModeSubtractionMethod;

struct {
HGCalElectronicsMap emap_;
HGCalTBDetectorLayout layout_;
Expand Down

0 comments on commit 8652687

Please sign in to comment.