Skip to content
Merged
68 changes: 68 additions & 0 deletions RecoLocalCalo/HGCalRecProducers/python/HGCalRecHit_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,60 @@
from SimCalorimetry.HGCalSimProducers.hgcalDigitizer_cfi import *
from RecoLocalCalo.HGCalRecProducers.HGCalUncalibRecHit_cfi import *

from Configuration.Eras.Modifier_phase2_hgcalV12_cff import phase2_hgcalV12

def calcWeights(weightsPerLayer): res = [sum(wei)/2. for wei in zip(weightsPerLayer[:], weightsPerLayer[1:] + [weightsPerLayer[0]])]; res[0] = 0.0; res[-1] = res[-2]; return res;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to call the first weight as dummy_weight, to make it clear that it is associated with a non-existing layer?
That would also make the formula a little more explicit by using that value instead of weightsPerLayer[0], to make it clear that you are also adding at the end a dummy value, not the first weight, that would make no sense.
The same would be true for res[0] = dummy_weight as well.
Actually, you could directly add [weightsPerLayer[-1]] as the last element and remove the res[-1] = res[-2], to make it explicit that the last layer has no mean.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm still convinced that extending the second array with the last element, and not with the first, dummy one, would make the code easier and remove the necessity of setting res[-1] manually, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I removed it.


weightsPerLayer_V16 = cms.vdouble(0.0, # there is no layer zero
5.55, # MeV
12.86,
9.4,
12.86,
9.4,
12.86,
9.4,
12.86,
9.4,
12.86,
9.4,
12.86,
9.4,
12.86,
9.4,
12.86,
9.4,
12.86,
13.54,
12.86,
13.54,
12.86,
13.54,
12.86,
13.54,
12.86,
58.63,
60.7,
60.7,
60.7,
60.7,
60.7,
60.7,
60.7,
60.7,
60.7,
60.7,
83.08,
83.08,
83.43,
83.61,
83.61,
83.61,
83.61,
83.61,
83.61,
83.61)


dEdX = cms.PSet(
# for v10 geometry
weights = cms.vdouble(0.0, # there is no layer zero
Expand Down Expand Up @@ -67,6 +121,14 @@
92.283895)
)


# for v16 geometry
dEdX_v16 = cms.PSet(
weights = cms.vdouble(calcWeights(weightsPerLayer_V16))
)



# HGCAL rechit producer
HGCalRecHit = cms.EDProducer(
"HGCalRecHitProducer",
Expand Down Expand Up @@ -133,3 +195,9 @@
phase2_hgcalV10.toModify( HGCalRecHit , thicknessCorrection = [0.77, 0.77, 0.77, 0.84, 0.84, 0.84] , sciThicknessCorrection = 0.90 )

phase2_hfnose.toModify( HGCalRecHit , thicknessNoseCorrection = [0.58,0.58,0.58])

phase2_hgcalV12.toModify(HGCalRecHit,
thicknessCorrection = [0.75, 0.76, 0.75, 0.85, 0.85, 0.84] ,
sciThicknessCorrection = 0.69,
layerWeights = dEdX_v16.weights)

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

fCPerMIP_v10 = cms.vdouble(2.06,3.43,5.15) #120um, 200um, 300um

fCPerMIP_v16 = fCPerMIP_v10
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not think there's a need to version the fCPerMIP. Would it make sense to just reuse fCPerMIP_v10?
Or, even better, remove the versioning from the variable's name completely?
I believe that could also imply removing the last four lines you have added, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rovere The default values are with the MPV, while the ones with the version are with the mean. Isn't it better to remove the versioning and introduce two variables (fCPerMIP_mean, fCPerMIP_mpv) and in each modifier use the appropriate one?

Copy link
Contributor

Choose a reason for hiding this comment

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

@apsallid absolutely yes, that would be the optimal choice indeed!


# HGCAL producer of rechits starting from digis
HGCalUncalibRecHit = cms.EDProducer(
"HGCalUncalibRecHitProducer",
Expand Down Expand Up @@ -75,6 +77,10 @@
phase2_hgcalV10.toModify( HGCalUncalibRecHit.HGCEEConfig , fCPerMIP = fCPerMIP_v10 )
phase2_hgcalV10.toModify( HGCalUncalibRecHit.HGCHEFConfig , fCPerMIP = fCPerMIP_v10 )

from Configuration.Eras.Modifier_phase2_hgcalV12_cff import phase2_hgcalV12
phase2_hgcalV12.toModify( HGCalUncalibRecHit.HGCEEConfig , fCPerMIP = fCPerMIP_v16 )
phase2_hgcalV12.toModify( HGCalUncalibRecHit.HGCHEFConfig , fCPerMIP = fCPerMIP_v16 )

from Configuration.Eras.Modifier_phase2_hfnose_cff import phase2_hfnose
phase2_hfnose.toModify( HGCalUncalibRecHit.HGCHFNoseConfig ,
isSiFE = True ,
Expand Down