Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add HCAL laser monitoring charge #21152

Merged
merged 12 commits into from
Dec 4, 2017
2 changes: 2 additions & 0 deletions DataFormats/METReco/interface/HcalNoiseSummary.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ class HcalNoiseSummary
double GetRecHitEnergy15(void) const;

double GetTotalCalibCharge(void) const;
double GetLaserMonitorCharge(void) const;

bool HasBadRBXTS4TS5(void) const;
bool HasBadRBXRechitR45Loose(void) const;
Expand Down Expand Up @@ -194,6 +195,7 @@ class HcalNoiseSummary
double rechitEnergy_;
double rechitEnergy15_;
double calibCharge_;
double lasmonCharge_;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this variable is not initialized.
Since I've added the MET filter path monitoring a few days ago, now we find that this leads to random differences when reading AOD produced by a release before 100X.
E.g. #25320 (comment)

@perrotta


bool hasBadRBXTS4TS5_;
bool hasBadRBXRechitR45Loose_;
Expand Down
5 changes: 5 additions & 0 deletions DataFormats/METReco/src/HcalNoiseSummary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@ double HcalNoiseSummary::GetTotalCalibCharge(void) const
return calibCharge_;
}

double HcalNoiseSummary::GetLaserMonitorCharge(void) const
{
return lasmonCharge_;
}

bool HcalNoiseSummary::HasBadRBXTS4TS5(void) const
{
return hasBadRBXTS4TS5_;
Expand Down
3 changes: 2 additions & 1 deletion DataFormats/METReco/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,13 @@
<class name="reco::HcalNoiseRBXCollection"/>
<class name="edm::Wrapper<reco::HcalNoiseRBXCollection>"/>

<class name="HcalNoiseSummary" ClassVersion="15">
<class name="HcalNoiseSummary" ClassVersion="16">
<version ClassVersion="11" checksum="664452001"/>
<version ClassVersion="12" checksum="4280559065"/>
<version ClassVersion="13" checksum="382065414"/>
<version ClassVersion="14" checksum="651605939"/>
<version ClassVersion="15" checksum="2415916091"/>
<version ClassVersion="16" checksum="1886001321"/>
</class>
<class name="edm::Wrapper<HcalNoiseSummary>"/>

Expand Down
27 changes: 27 additions & 0 deletions RecoMET/METFilters/plugins/HcalLaserEventFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ class HcalLaserEventFilter : public edm::global::EDFilter<> {
const bool vetoByHBHEOccupancy_;
const unsigned int minOccupiedHBHE_;

const bool vetoByLaserMonitor_;
const double minLaserMonitorCharge_;

// Allow for debugging information to be printed
const bool debug_;
// Reverse the filter decision (so instead of selecting only good events, it
Expand Down Expand Up @@ -109,6 +112,8 @@ HcalLaserEventFilter::HcalLaserEventFilter(const edm::ParameterSet& iConfig)
: vetoByRunEventNumber_ (iConfig.getUntrackedParameter<bool>("vetoByRunEventNumber",true))
, vetoByHBHEOccupancy_ (iConfig.getUntrackedParameter<bool>("vetoByHBHEOccupancy",false))
, minOccupiedHBHE_ (iConfig.getUntrackedParameter<unsigned int>("minOccupiedHBHE",5000))
, vetoByLaserMonitor_ (iConfig.getUntrackedParameter<bool>("vetoByLaserMonitor",false))
, minLaserMonitorCharge_ (iConfig.getUntrackedParameter<double>("minLaserMonitorCharge_",1000.))
, debug_ (iConfig.getUntrackedParameter<bool>("debug",false))
, reverseFilter_ (iConfig.getUntrackedParameter<bool>("reverseFilter",false))
, hbheInputLabel_ (iConfig.getUntrackedParameter<edm::InputTag>("hbheInputLabel",edm::InputTag("hbhereco")))
Expand Down Expand Up @@ -243,6 +248,28 @@ HcalLaserEventFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::Event
}
}
}// if (vetoByHBHEOccupancy_)
if( vetoByLaserMonitor_ )
{
//////////////////////////////////////////////////////////
//
// Apply Filtering based on laser monitor information in HcalNoiseSummary object
//
////////////////////////////////////////////////////////////
Handle<HcalNoiseSummary> hSummary;
if (iEvent.getByToken(hcalNoiseSummaryToken_,hSummary)) // get by label, usually with label 'hcalnoise'
{
if (debug_) edm::LogInfo("HcalLaserEventFilter") << " LASERMON CHARGE (from HcalNoiseSummary) = "<<hSummary->GetLaserMonitorCharge()<<" threshold = "<<minLaserMonitorCharge_;
if( hSummary->GetLaserMonitorCharge() > minLaserMonitorCharge_ )
{
if (debug_) edm::LogInfo("HcalLaserEventFilter") <<"<HcalLaserEventFilter> Filtering because of large Laser monitor charge in HcalNoiseSummary; "<<hSummary->GetLaserMonitorCharge()<<" charge is greater than or equal to the allowed maximum of "<<minLaserMonitorCharge_;
filterDecision=false;
}
}
else
{
if (debug_) edm::LogInfo("HcalLaserEventFilter") <<"<HcalLaserEventFilter::Error> No valid HcalNoiseSummary with label '"<<hcalNoiseSummaryLabel_<<"' found";
}
}

// Reverse decision, if specified by user
if (reverseFilter_)
Expand Down
16 changes: 14 additions & 2 deletions RecoMET/METProducers/interface/HcalNoiseInfoProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ namespace reco {
public:
explicit HcalNoiseInfoProducer(const edm::ParameterSet&);
~HcalNoiseInfoProducer() override;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:

Expand Down Expand Up @@ -83,6 +85,7 @@ namespace reco {
bool fillRecHits_; // fill rechit information into HcalNoiseRBXs and HcalNoiseSummary
bool fillCaloTowers_; // fill calotower information into HcalNoiseRBXs and HcalNoiseSummary
bool fillTracks_; // fill track information into HcalNoiseSummary
bool fillLaserMonitor_; // fill laser monitor information into HcalNoiseSummary

// These provide the requirements for writing an RBX to the event
int maxProblemRBXs_; // maximum number of problematic RBXs to be written to the event record
Expand All @@ -109,7 +112,8 @@ namespace reco {
edm::EDGetTokenT<reco::TrackCollection> track_token_;
edm::EDGetTokenT<reco::PFJetCollection> jet_token_;

double TotalCalibCharge; // placeholder to calculate total charge in calibration channels
double totalCalibCharge; // placeholder to calculate total charge in calibration channels
double totalLasmonCharge; // placeholder to calculate total charge in laser monitor channels

double minRecHitE_, minLowHitE_, minHighHitE_, minR45HitE_; // parameters used to determine noise status
HcalNoiseAlgo algo_; // algorithms to determine if an RBX is noisy
Expand All @@ -130,8 +134,16 @@ namespace reco {

uint32_t HcalAcceptSeverityLevel_;
std::vector<int> HcalRecHitFlagsToBeExcluded_;

std::vector<int> laserMonCBoxList_;
std::vector<int> laserMonIPhiList_;
std::vector<int> laserMonIEtaList_;

int laserMonitorTSStart_;
int laserMonitorTSEnd_;

float adc2fC[128];
std::vector<float> adc2fC;
std::vector<float> adc2fCHF;
};

} // end of namespace
Expand Down
126 changes: 1 addition & 125 deletions RecoMET/METProducers/python/hcalnoiseinfoproducer_cfi.py
Original file line number Diff line number Diff line change
@@ -1,125 +1 @@
import FWCore.ParameterSet.Config as cms

HcalNoiseParameterSet = cms.PSet(
# define hit energy thesholds
minRecHitE = cms.double(1.5),
minLowHitE = cms.double(10.0),
minHighHitE = cms.double(25.0),
minR45HitE = cms.double(5.0),

# define energy threshold for "problematic" cuts
pMinERatio = cms.double(25.0),
pMinEZeros = cms.double(5.0),
pMinEEMF = cms.double(10.0),

# define energy threshold for loose/tight/high level cuts
minERatio = cms.double(50.0),
minEZeros = cms.double(10.0),
minEEMF = cms.double(50.0),

# define problematic RBX
pMinE = cms.double(40.0),
pMinRatio = cms.double(0.75),
pMaxRatio = cms.double(0.85),
pMinHPDHits = cms.int32(10),
pMinRBXHits = cms.int32(20),
pMinHPDNoOtherHits = cms.int32(7),
pMinZeros = cms.int32(4),
pMinLowEHitTime = cms.double(-6.0),
pMaxLowEHitTime = cms.double(6.0),
pMinHighEHitTime = cms.double(-4.0),
pMaxHighEHitTime = cms.double(5.0),
pMaxHPDEMF = cms.double(-0.02),
pMaxRBXEMF = cms.double(0.02),
pMinRBXRechitR45Count = cms.int32(1),
pMinRBXRechitR45Fraction = cms.double(0.1),
pMinRBXRechitR45EnergyFraction = cms.double(0.1),

# define loose noise cuts
lMinRatio = cms.double(-999.),
lMaxRatio = cms.double(999.),
lMinHPDHits = cms.int32(17),
lMinRBXHits = cms.int32(999),
lMinHPDNoOtherHits = cms.int32(10),
lMinZeros = cms.int32(10),
lMinLowEHitTime = cms.double(-9999.0),
lMaxLowEHitTime = cms.double(9999.0),
lMinHighEHitTime = cms.double(-9999.0),
lMaxHighEHitTime = cms.double(9999.0),

# define tight noise cuts
tMinRatio = cms.double(-999.),
tMaxRatio = cms.double(999.),
tMinHPDHits = cms.int32(16),
tMinRBXHits = cms.int32(50),
tMinHPDNoOtherHits = cms.int32(9),
tMinZeros = cms.int32(8),
tMinLowEHitTime = cms.double(-9999.0),
tMaxLowEHitTime = cms.double(9999.0),
tMinHighEHitTime = cms.double(-7.0),
tMaxHighEHitTime = cms.double(6.0),

# define high level noise cuts
hlMaxHPDEMF = cms.double(-9999.0),
hlMaxRBXEMF = cms.double(0.01),

# Calibration digi noise variables (used for finding laser noise events)
calibdigiHBHEthreshold = cms.double(15), # minimum threshold in fC of any HBHE calib digi to be counted in summary
calibdigiHBHEtimeslices=cms.vint32(3,4,5,6), # time slices to use when determining charge of HBHE calib digis
calibdigiHFthreshold = cms.double(-999), # minimum threshold in fC of any HF calib digi to be counted in summary
calibdigiHFtimeslices=cms.vint32(0,1,2,3,4,5,6,7,8,9), # time slices to use when determining charge of HF calib digis

# RBX-wide TS4TS5 variable
TS4TS5EnergyThreshold = cms.double(50),
TS4TS5UpperThreshold = cms.vdouble(70, 90, 100, 400, 4000),
TS4TS5UpperCut = cms.vdouble(1, 0.8, 0.75, 0.72, 0.72),
TS4TS5LowerThreshold = cms.vdouble(100, 120, 150, 200, 300, 400, 500),
TS4TS5LowerCut = cms.vdouble(-1, -0.7, -0.4, -0.2, -0.08, 0, 0.1),

# rechit R45 population filter variables
# this comes in groups of four: (a_Count, a_Fraction, a_EnergyFraction, const)
# flag as noise if (count * a_count + fraction * a_fraction + energyfraction * a_energyfraction + const) > 0
lRBXRecHitR45Cuts = cms.vdouble(0.0, 1.0, 0.0, -0.5, # equivalent to "fraction > 0.5"
0.0, 0.0, 1.0, -0.5), # equivalent to "energy fraction > 0.5"
tRBXRecHitR45Cuts = cms.vdouble(0.0, 1.0, 0.0, -0.2, # equivalent to "fraction > 0.2"
0.0, 0.0, 1.0, -0.2) # equivalent to "energy fraction > 0.2"
)


hcalnoise = cms.EDProducer(
'HcalNoiseInfoProducer',

# general noise parameters
HcalNoiseParameterSet,

# what to fill
fillDigis = cms.bool(True),
fillRecHits = cms.bool(True),
fillCaloTowers = cms.bool(True),
fillTracks = cms.bool(True),

# maximum number of RBXs to fill
# if you want to record all RBXs above some energy threshold,
# change maxProblemRBXs to 999 and pMinE (above) to the threshold you want
maxProblemRBXs = cms.int32(72),

# parameters for calculating summary variables
maxCaloTowerIEta = cms.int32(20),
maxTrackEta = cms.double(2.0),
minTrackPt = cms.double(1.0),
maxNHF = cms.double(0.9),
maxjetindex = cms.int32(0),

# collection names
digiCollName = cms.string('hcalDigis'),
recHitCollName = cms.string('hbhereco'),
caloTowerCollName = cms.string('towerMaker'),
trackCollName = cms.string('generalTracks'),
jetCollName = cms.string('ak4PFJets'),

# severity level
HcalAcceptSeverityLevel = cms.uint32(9),

# which hcal calo flags to mask (HBHEIsolatedNoise=11, HBHEFlatNoise=12, HBHESpikeNoise=13, HBHETriangleNoise=14, HBHETS4TS5Noise=15, HBHENegativeNoise=27)
HcalRecHitFlagsToBeExcluded = cms.vint32(11, 12, 13, 14, 15, 27)
)
from RecoMET.METProducers.hcalnoise_cfi import * # from fillDescriptions
Loading