Skip to content

Commit bb0765c

Browse files
committed
changing the seed of the TRandom
1 parent 8a12a98 commit bb0765c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

RecoBTag/SoftLepton/src/ElectronTagger.cc

+5-3
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ float ElectronTagger::discriminator(const TagInfoHelper & tagInfo) const {
1717
for (unsigned int i = 0; i < info.leptons(); i++) {
1818
const reco::SoftLeptonProperties & properties = info.properties(i);
1919
if (m_selector(properties)) {
20-
TRandom3 *r = new TRandom3(0);
20+
int theSeed=1+round(10000.0*fabs(properties.deltaR));
21+
TRandom3 *r = new TRandom3(theSeed);
2122
float rndm = r->Uniform(0,1);
2223
//for negative tagger, flip 50% of the negative signs to positive value
2324
float sip3d = (m_selector.isNegative() && rndm<0.5) ? -properties.sip3d : properties.sip3d;
2425
float tag = theNet.Value(0, properties.ptRel, sip3d,properties.deltaR ,properties.ratioRel);
25-
if (tag > bestTag)
26-
bestTag = tag;
26+
if (tag > bestTag)
27+
bestTag = tag;
28+
delete r;
2729
}
2830
}
2931
return bestTag;

RecoBTag/SoftLepton/src/MuonTagger.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ float MuonTagger::discriminator(const TagInfoHelper & tagInfo) const {
1616
for (unsigned int i = 0; i < info.leptons(); i++) {
1717
const reco::SoftLeptonProperties & properties = info.properties(i);
1818
if (m_selector(properties)) {
19-
TRandom3 *r = new TRandom3(0);
19+
int theSeed=1+round(10000.0*fabs(properties.deltaR));
20+
TRandom3 *r = new TRandom3(theSeed);
2021
float rndm = r->Uniform(0,1);
2122
//for negative tagger, flip 50% of the negative signs to positive value
2223
float sip3d = (m_selector.isNegative() && rndm<0.5) ? -properties.sip3d : properties.sip3d;
2324
float tag = theNet.Value(0, properties.ptRel, sip3d, properties.deltaR, properties.ratioRel);
2425
if (tag > bestTag) bestTag = tag;
26+
delete r;
2527
}
2628
}
2729
return bestTag;

0 commit comments

Comments
 (0)