CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Attributes
HcalHitReconstructor Class Reference

#include <HcalHitReconstructor.h>

Inheritance diagram for HcalHitReconstructor:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginRun (edm::Run const &r, edm::EventSetup const &es) override final
 
virtual void endRun (edm::Run const &r, edm::EventSetup const &es) override final
 
 HcalHitReconstructor (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c) override
 
virtual ~HcalHitReconstructor ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Types

typedef void(HcalSimpleRecAlgo::* SetCorrectionFcn) (boost::shared_ptr< AbsOOTPileupCorrection >)
 

Private Attributes

std::string cat_
 
int cntprtCorrMethod_
 
bool correctTiming_
 
std::string corrName_
 
std::string dataOOTCorrectionCategory_
 
std::string dataOOTCorrectionName_
 
DetId::Detector det_
 
bool digiTimeFromDB_
 
bool dropZSmarkedPassed_
 
bool first_
 
int firstAuxTS_
 
int firstSample_
 
HBHEStatusBitSetterhbheFlagSetter_
 
HBHETimeProfileStatusBitSetterhbheHSCPFlagSetter_
 
HBHENegativeFlagSetterhbheNegativeFlagSetter_
 
HBHEPulseShapeFlagSetterhbhePulseShapeFlagSetter_
 
HBHETimingShapedFlagSetterhbheTimingShapedFlagSetter_
 
HcalHFStatusBitFromDigishfdigibit_
 
std::unique_ptr< HcalFlagHFDigiTimeParamsHFDigiTimeParams
 
HcalHF_PETalgorithmhfPET_
 
HcalHF_S9S1algorithmhfS8S1_
 
HcalHF_S9S1algorithmhfS9S1_
 
HFTimingTrustFlagHFTimingTrustFlagSetter_
 
edm::InputTag inputLabel_
 
std::string mcOOTCorrectionCategory_
 
std::string mcOOTCorrectionName_
 
HcalRecoParamsparamTS
 
int puCorrMethod_
 
HcalSimpleRecAlgo reco_
 
bool recoParamsFromDB_
 
int samplesToAdd_
 
HcalADCSaturationFlagsaturationFlagSetter_
 
bool setHSCPFlags_
 
bool setNegativeFlags_
 
bool setNoiseFlags_
 
SetCorrectionFcn setPileupCorrection_
 
bool setPulseShapeFlags_
 
bool setSaturationFlags_
 
bool setTimingTrustFlags_
 
int subdet_
 
HcalOtherSubdetector subdetOther_
 
edm::EDGetTokenT< HcalCalibDigiCollectiontok_calib_
 
edm::EDGetTokenT< HBHEDigiCollectiontok_hbhe_
 
edm::EDGetTokenT< HFDigiCollectiontok_hf_
 
edm::EDGetTokenT< HODigiCollectiontok_ho_
 
bool tsFromDB_
 
bool useLeakCorrection_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Author
J. Temple & E. Yazgan Based on HcalSimpleReconstructor.h by J. Mans

Definition at line 46 of file HcalHitReconstructor.h.

Member Typedef Documentation

typedef void(HcalSimpleRecAlgo::* HcalHitReconstructor::SetCorrectionFcn) (boost::shared_ptr< AbsOOTPileupCorrection >)
private

Definition at line 57 of file HcalHitReconstructor.h.

Constructor & Destructor Documentation

HcalHitReconstructor::HcalHitReconstructor ( const edm::ParameterSet ps)
explicit

Definition at line 27 of file HcalHitReconstructor.cc.

References DetId::Calo, dataOOTCorrectionCategory_, dataOOTCorrectionName_, det_, digiTimeFromDB_, edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), hbheFlagSetter_, hbheHSCPFlagSetter_, hbheNegativeFlagSetter_, hbhePulseShapeFlagSetter_, hbheTimingShapedFlagSetter_, HcalBarrel, HcalCalibration, HcalForward, HcalOther, HcalOuter, hfdigibit_, hfPET_, hfS8S1_, hfS9S1_, HFTimingTrustFlagSetter_, inputLabel_, mcOOTCorrectionCategory_, mcOOTCorrectionName_, puCorrMethod_, reco_, recoParamsFromDB_, saturationFlagSetter_, HcalSimpleRecAlgo::setHBHEPileupCorrection(), setHSCPFlags_, HcalSimpleRecAlgo::setMeth3Params(), setNegativeFlags_, setNoiseFlags_, setPileupCorrection_, HcalSimpleRecAlgo::setpuCorrMethod(), HcalSimpleRecAlgo::setpuCorrParams(), setPulseShapeFlags_, setSaturationFlags_, setTimingTrustFlags_, AlCaHLTBitMon_QueryRunRegistry::string, subdet_, HcalZDCDetId::SubdetectorId, subdetOther_, tok_calib_, tok_hbhe_, tok_hf_, and tok_ho_.

27  :
28  reco_(conf.getParameter<bool>("correctForTimeslew"),
29  conf.getParameter<bool>("correctForPhaseContainment"),
30  conf.getParameter<double>("correctionPhaseNS")),
32  inputLabel_(conf.getParameter<edm::InputTag>("digiLabel")),
33  correctTiming_(conf.getParameter<bool>("correctTiming")),
34  setNoiseFlags_(conf.getParameter<bool>("setNoiseFlags")),
35  setHSCPFlags_(conf.getParameter<bool>("setHSCPFlags")),
36  setSaturationFlags_(conf.getParameter<bool>("setSaturationFlags")),
37  setTimingTrustFlags_(conf.getParameter<bool>("setTimingTrustFlags")),
38  setPulseShapeFlags_(conf.getParameter<bool>("setPulseShapeFlags")),
39  setNegativeFlags_(false),
40  dropZSmarkedPassed_(conf.getParameter<bool>("dropZSmarkedPassed")),
41  firstAuxTS_(conf.getParameter<int>("firstAuxTS")),
42  firstSample_(conf.getParameter<int>("firstSample")),
43  samplesToAdd_(conf.getParameter<int>("samplesToAdd")),
44  tsFromDB_(conf.getParameter<bool>("tsFromDB")),
45  useLeakCorrection_(conf.getParameter<bool>("useLeakCorrection")),
51  paramTS(0),
52  puCorrMethod_(conf.getParameter<int>("puCorrMethod")),
54  first_(true)
55 
56 {
57  // register for data access
58  tok_hbhe_ = consumes<HBHEDigiCollection>(inputLabel_);
59  tok_ho_ = consumes<HODigiCollection>(inputLabel_);
60  tok_hf_ = consumes<HFDigiCollection>(inputLabel_);
61  tok_calib_ = consumes<HcalCalibDigiCollection>(inputLabel_);
62 
63  std::string subd=conf.getParameter<std::string>("Subdetector");
64  //Set all FlagSetters to 0
65  /* Important to do this! Otherwise, if the setters are turned off,
66  the "if (XSetter_) delete XSetter_;" commands can crash
67  */
68 
69  recoParamsFromDB_ = conf.getParameter<bool>("recoParamsFromDB");
70  // recoParamsFromDB_ = false ; // trun off for now.
71 
72  // std::cout<<" HcalHitReconstructor recoParamsFromDB_ "<<recoParamsFromDB_<<std::endl;
73 
74  if (conf.existsAs<bool>("setNegativeFlags"))
75  setNegativeFlags_ = conf.getParameter<bool>("setNegativeFlags");
76 
77  hbheFlagSetter_ = 0;
82  hfdigibit_ = 0;
83 
84  hfS9S1_ = 0;
85  hfS8S1_ = 0;
86  hfPET_ = 0;
89  digiTimeFromDB_ = false; // only need for HF
90 
92  {
93  const edm::ParameterSet& pssat = conf.getParameter<edm::ParameterSet>("saturationParameters");
94  saturationFlagSetter_ = new HcalADCSaturationFlag(pssat.getParameter<int>("maxADCvalue"));
95  }
96 
97  if (!strcasecmp(subd.c_str(),"HBHE")) {
99 
102 
103  bool timingShapedCutsFlags = conf.getParameter<bool>("setTimingShapedCutsFlags");
104  if (timingShapedCutsFlags)
105  {
106  const edm::ParameterSet& psTshaped = conf.getParameter<edm::ParameterSet>("timingshapedcutsParameters");
107  hbheTimingShapedFlagSetter_ = new HBHETimingShapedFlagSetter(psTshaped.getParameter<std::vector<double> >("tfilterEnvelope"),
108  psTshaped.getParameter<bool>("ignorelowest"),
109  psTshaped.getParameter<bool>("ignorehighest"),
110  psTshaped.getParameter<double>("win_offset"),
111  psTshaped.getParameter<double>("win_gain"));
112  }
113 
114  if (setNoiseFlags_)
115  {
116  const edm::ParameterSet& psdigi =conf.getParameter<edm::ParameterSet>("flagParameters");
117  hbheFlagSetter_=new HBHEStatusBitSetter(psdigi.getParameter<double>("nominalPedestal"),
118  psdigi.getParameter<double>("hitEnergyMinimum"),
119  psdigi.getParameter<int>("hitMultiplicityThreshold"),
120  psdigi.getParameter<std::vector<edm::ParameterSet> >("pulseShapeParameterSets")
121  );
122  } // if (setNoiseFlags_)
123  if (setHSCPFlags_)
124  {
125  const edm::ParameterSet& psHSCP = conf.getParameter<edm::ParameterSet>("hscpParameters");
127  psHSCP.getParameter<double>("r1Max"),
128  psHSCP.getParameter<double>("r2Min"),
129  psHSCP.getParameter<double>("r2Max"),
130  psHSCP.getParameter<double>("fracLeaderMin"),
131  psHSCP.getParameter<double>("fracLeaderMax"),
132  psHSCP.getParameter<double>("slopeMin"),
133  psHSCP.getParameter<double>("slopeMax"),
134  psHSCP.getParameter<double>("outerMin"),
135  psHSCP.getParameter<double>("outerMax"),
136  psHSCP.getParameter<double>("TimingEnergyThreshold"));
137  } // if (setHSCPFlags_)
139  {
140  const edm::ParameterSet &psPulseShape = conf.getParameter<edm::ParameterSet>("pulseShapeParameters");
142  psPulseShape.getParameter<double>("MinimumChargeThreshold"),
143  psPulseShape.getParameter<double>("TS4TS5ChargeThreshold"),
144  psPulseShape.getParameter<double>("TS3TS4ChargeThreshold"),
145  psPulseShape.getParameter<double>("TS3TS4UpperChargeThreshold"),
146  psPulseShape.getParameter<double>("TS5TS6ChargeThreshold"),
147  psPulseShape.getParameter<double>("TS5TS6UpperChargeThreshold"),
148  psPulseShape.getParameter<double>("R45PlusOneRange"),
149  psPulseShape.getParameter<double>("R45MinusOneRange"),
150  psPulseShape.getParameter<unsigned int>("TrianglePeakTS"),
151  psPulseShape.getParameter<std::vector<double> >("LinearThreshold"),
152  psPulseShape.getParameter<std::vector<double> >("LinearCut"),
153  psPulseShape.getParameter<std::vector<double> >("RMS8MaxThreshold"),
154  psPulseShape.getParameter<std::vector<double> >("RMS8MaxCut"),
155  psPulseShape.getParameter<std::vector<double> >("LeftSlopeThreshold"),
156  psPulseShape.getParameter<std::vector<double> >("LeftSlopeCut"),
157  psPulseShape.getParameter<std::vector<double> >("RightSlopeThreshold"),
158  psPulseShape.getParameter<std::vector<double> >("RightSlopeCut"),
159  psPulseShape.getParameter<std::vector<double> >("RightSlopeSmallThreshold"),
160  psPulseShape.getParameter<std::vector<double> >("RightSlopeSmallCut"),
161  psPulseShape.getParameter<std::vector<double> >("TS4TS5LowerThreshold"),
162  psPulseShape.getParameter<std::vector<double> >("TS4TS5LowerCut"),
163  psPulseShape.getParameter<std::vector<double> >("TS4TS5UpperThreshold"),
164  psPulseShape.getParameter<std::vector<double> >("TS4TS5UpperCut"),
165  psPulseShape.getParameter<bool>("UseDualFit"),
166  psPulseShape.getParameter<bool>("TriangleIgnoreSlow"));
167  } // if (setPulseShapeFlags_)
168  if (setNegativeFlags_)
170 
171  produces<HBHERecHitCollection>();
172  } else if (!strcasecmp(subd.c_str(),"HO")) {
174  // setPileupCorrection_ = &HcalSimpleRecAlgo::setHOPileupCorrection;
176  produces<HORecHitCollection>();
177  } else if (!strcasecmp(subd.c_str(),"HF")) {
179  // setPileupCorrection_ = &HcalSimpleRecAlgo::setHFPileupCorrection;
181  digiTimeFromDB_=conf.getParameter<bool>("digiTimeFromDB");
182 
183  if (setTimingTrustFlags_) {
184 
185  const edm::ParameterSet& pstrust = conf.getParameter<edm::ParameterSet>("hfTimingTrustParameters");
186  HFTimingTrustFlagSetter_=new HFTimingTrustFlag(pstrust.getParameter<int>("hfTimingTrustLevel1"),
187  pstrust.getParameter<int>("hfTimingTrustLevel2"));
188  }
189 
190  if (setNoiseFlags_)
191  {
192  const edm::ParameterSet& psdigi =conf.getParameter<edm::ParameterSet>("digistat");
193  const edm::ParameterSet& psTimeWin =conf.getParameter<edm::ParameterSet>("HFInWindowStat");
194  hfdigibit_=new HcalHFStatusBitFromDigis(psdigi,psTimeWin);
195 
196  const edm::ParameterSet& psS9S1 = conf.getParameter<edm::ParameterSet>("S9S1stat");
197  hfS9S1_ = new HcalHF_S9S1algorithm(psS9S1.getParameter<std::vector<double> >("short_optimumSlope"),
198  psS9S1.getParameter<std::vector<double> >("shortEnergyParams"),
199  psS9S1.getParameter<std::vector<double> >("shortETParams"),
200  psS9S1.getParameter<std::vector<double> >("long_optimumSlope"),
201  psS9S1.getParameter<std::vector<double> >("longEnergyParams"),
202  psS9S1.getParameter<std::vector<double> >("longETParams"),
203  psS9S1.getParameter<int>("HcalAcceptSeverityLevel"),
204  psS9S1.getParameter<bool>("isS8S1")
205  );
206 
207  const edm::ParameterSet& psS8S1 = conf.getParameter<edm::ParameterSet>("S8S1stat");
208  hfS8S1_ = new HcalHF_S9S1algorithm(psS8S1.getParameter<std::vector<double> >("short_optimumSlope"),
209  psS8S1.getParameter<std::vector<double> >("shortEnergyParams"),
210  psS8S1.getParameter<std::vector<double> >("shortETParams"),
211  psS8S1.getParameter<std::vector<double> >("long_optimumSlope"),
212  psS8S1.getParameter<std::vector<double> >("longEnergyParams"),
213  psS8S1.getParameter<std::vector<double> >("longETParams"),
214  psS8S1.getParameter<int>("HcalAcceptSeverityLevel"),
215  psS8S1.getParameter<bool>("isS8S1")
216  );
217 
218  const edm::ParameterSet& psPET = conf.getParameter<edm::ParameterSet>("PETstat");
219  hfPET_ = new HcalHF_PETalgorithm(psPET.getParameter<std::vector<double> >("short_R"),
220  psPET.getParameter<std::vector<double> >("shortEnergyParams"),
221  psPET.getParameter<std::vector<double> >("shortETParams"),
222  psPET.getParameter<std::vector<double> >("long_R"),
223  psPET.getParameter<std::vector<double> >("longEnergyParams"),
224  psPET.getParameter<std::vector<double> >("longETParams"),
225  psPET.getParameter<int>("HcalAcceptSeverityLevel"),
226  psPET.getParameter<std::vector<double> >("short_R_29"),
227  psPET.getParameter<std::vector<double> >("long_R_29")
228  );
229  }
230  produces<HFRecHitCollection>();
231  } else if (!strcasecmp(subd.c_str(),"ZDC")) {
234  produces<ZDCRecHitCollection>();
235  } else if (!strcasecmp(subd.c_str(),"CALIB")) {
238  produces<HcalCalibRecHitCollection>();
239  } else {
240  edm::LogWarning("Configuration") << "HcalHitReconstructor is not associated with a specific subdetector!" << std::endl;
241  }
242 
243  // If no valid OOT pileup correction name specified,
244  // disable the correction
245  if (conf.existsAs<std::string>("dataOOTCorrectionName"))
246  dataOOTCorrectionName_ = conf.getParameter<std::string>("dataOOTCorrectionName");
247  if (conf.existsAs<std::string>("dataOOTCorrectionCategory"))
248  dataOOTCorrectionCategory_ = conf.getParameter<std::string>("dataOOTCorrectionCategory");
249  if (conf.existsAs<std::string>("mcOOTCorrectionName"))
250  mcOOTCorrectionName_ = conf.getParameter<std::string>("mcOOTCorrectionName");
251  if (conf.existsAs<std::string>("mcOOTCorrectionCategory"))
252  mcOOTCorrectionCategory_ = conf.getParameter<std::string>("mcOOTCorrectionCategory");
253  if (dataOOTCorrectionName_.empty() && mcOOTCorrectionName_.empty())
255 
257  if(puCorrMethod_ == 2) {
259  conf.getParameter<bool> ("applyPedConstraint"),
260  conf.getParameter<bool> ("applyTimeConstraint"),
261  conf.getParameter<bool> ("applyPulseJitter"),
262  conf.getParameter<bool> ("applyTimeSlew"),
263  conf.getParameter<double>("ts4Min"),
264  conf.getParameter<std::vector<double>>("ts4Max"),
265  conf.getParameter<double>("pulseJitter"),
266  conf.getParameter<double>("meanTime"),
267  conf.getParameter<double>("timeSigmaHPD"),
268  conf.getParameter<double>("timeSigmaSiPM"),
269  conf.getParameter<double>("meanPed"),
270  conf.getParameter<double>("pedSigmaHPD"),
271  conf.getParameter<double>("pedSigmaSiPM"),
272  conf.getParameter<double>("noiseHPD"),
273  conf.getParameter<double>("noiseSiPM"),
274  conf.getParameter<double>("timeMin"),
275  conf.getParameter<double>("timeMax"),
276  conf.getParameter<std::vector<double>>("ts4chi2"),
277  conf.getParameter<int> ("fitTimes")
278  );
279  }
281  conf.getParameter<bool> ("applyTimeSlewM3"),
282  conf.getParameter<double> ("pedestalUpperLimit"),
283  conf.getParameter<int> ("timeSlewParsType"),
284  conf.getParameter<std::vector<double> >("timeSlewPars"),
285  conf.getParameter<double> ("respCorrM3")
286  );
287 }
T getParameter(std::string const &) const
void setMeth3Params(bool iApplyTimeSlew, float iPedSubThreshold, int iTimeSlewParsType, std::vector< double > iTimeSlewPars, double irespCorrM3)
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
void setpuCorrParams(bool iPedestalConstraint, bool iTimeConstraint, bool iAddPulseJitter, bool iApplyTimeSlew, double iTS4Min, const std::vector< double > &iTS4Max, double iPulseJitter, double iTimeMean, double iTimeSig, double iTimeSigSiPM, double iPedMean, double iPedSig, double iPedSigSiPM, double iNoise, double iNoiseSiPM, double iTMin, double iTMax, const std::vector< double > &its4Chi2, int iFitTimes)
HcalADCSaturationFlag * saturationFlagSetter_
SetCorrectionFcn setPileupCorrection_
std::string dataOOTCorrectionCategory_
HBHENegativeFlagSetter * hbheNegativeFlagSetter_
edm::EDGetTokenT< HcalCalibDigiCollection > tok_calib_
HcalHFStatusBitFromDigis * hfdigibit_
edm::EDGetTokenT< HODigiCollection > tok_ho_
HcalHF_PETalgorithm * hfPET_
HcalHF_S9S1algorithm * hfS9S1_
HBHEPulseShapeFlagSetter * hbhePulseShapeFlagSetter_
static const int SubdetectorId
Definition: HcalZDCDetId.h:25
void setHBHEPileupCorrection(boost::shared_ptr< AbsOOTPileupCorrection > corr)
HBHEStatusBitSetter * hbheFlagSetter_
HBHETimeProfileStatusBitSetter * hbheHSCPFlagSetter_
HBHETimingShapedFlagSetter * hbheTimingShapedFlagSetter_
void setpuCorrMethod(int method)
HcalHF_S9S1algorithm * hfS8S1_
HcalOtherSubdetector subdetOther_
HFTimingTrustFlag * HFTimingTrustFlagSetter_
std::string mcOOTCorrectionCategory_
edm::EDGetTokenT< HFDigiCollection > tok_hf_
HcalSimpleRecAlgo reco_
HcalHitReconstructor::~HcalHitReconstructor ( )
virtual

Definition at line 302 of file HcalHitReconstructor.cc.

References hbheFlagSetter_, hbheHSCPFlagSetter_, hbheNegativeFlagSetter_, hbhePulseShapeFlagSetter_, hbheTimingShapedFlagSetter_, hfdigibit_, hfPET_, hfS8S1_, hfS9S1_, HFTimingTrustFlagSetter_, paramTS, and saturationFlagSetter_.

302  {
303  delete hbheFlagSetter_;
304  delete hbheHSCPFlagSetter_;
308  delete hfdigibit_;
309 
310  delete hfS9S1_;
311  delete hfS8S1_;
312  delete hfPET_;
313  delete saturationFlagSetter_;
315 
316  delete paramTS;
317 }
HcalADCSaturationFlag * saturationFlagSetter_
HBHENegativeFlagSetter * hbheNegativeFlagSetter_
HcalHFStatusBitFromDigis * hfdigibit_
HcalHF_PETalgorithm * hfPET_
HcalHF_S9S1algorithm * hfS9S1_
HBHEPulseShapeFlagSetter * hbhePulseShapeFlagSetter_
HBHEStatusBitSetter * hbheFlagSetter_
HBHETimeProfileStatusBitSetter * hbheHSCPFlagSetter_
HBHETimingShapedFlagSetter * hbheTimingShapedFlagSetter_
HcalHF_S9S1algorithm * hfS8S1_
HFTimingTrustFlag * HFTimingTrustFlagSetter_

Member Function Documentation

void HcalHitReconstructor::beginRun ( edm::Run const &  r,
edm::EventSetup const &  es 
)
finaloverridevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 319 of file HcalHitReconstructor.cc.

References HcalSimpleRecAlgo::beginRun(), digiTimeFromDB_, edm::EventSetup::get(), hbheFlagSetter_, HFDigiTimeParams, edm::ESHandleBase::isValid(), AlCaHLTBitMon_ParallelJobs::p, paramTS, edm::ESHandle< T >::product(), reco_, recoParamsFromDB_, HBHEStatusBitSetter::SetFrontEndMap(), HcalCondObjectContainerBase::setTopo(), and tsFromDB_.

319  {
320 
322  es.get<HcalRecNumberingRecord>().get(htopo);
323 
324  if ( tsFromDB_== true || recoParamsFromDB_ == true )
325  {
327  es.get<HcalRecoParamsRcd>().get(p);
328  paramTS = new HcalRecoParams(*p.product());
329  paramTS->setTopo(htopo.product());
330 
331 
332 
333 
334  // std::cout<<" skdump in HcalHitReconstructor::beginRun dupm RecoParams "<<std::endl;
335  // std::ofstream skfile("skdumpRecoParamsNewFormat.txt");
336  // HcalDbASCIIIO::dumpObject(skfile, (*paramTS) );
337  }
338 
339  if (digiTimeFromDB_==true)
340  {
342  es.get<HcalFlagHFDigiTimeParamsRcd>().get(p);
343  HFDigiTimeParams.reset( new HcalFlagHFDigiTimeParams( *p ) );
344  HFDigiTimeParams->setTopo(htopo.product());
345  }
346 
347  if (hbheFlagSetter_) {
349  es.get<HcalFrontEndMapRcd>().get(hfemap);
350  if (hfemap.isValid()) {
352  } else {
353  edm::LogWarning("Configuration") << "HcalHitReconstructor cannot get HcalFrontEndMap!" << std::endl;
354  }
355  }
356 
357  reco_.beginRun(es);
358 }
void beginRun(edm::EventSetup const &es)
void SetFrontEndMap(const HcalFrontEndMap *m)
std::unique_ptr< HcalFlagHFDigiTimeParams > HFDigiTimeParams
HBHEStatusBitSetter * hbheFlagSetter_
bool isValid() const
Definition: ESHandle.h:47
T const * product() const
Definition: ESHandle.h:86
void setTopo(const HcalTopology *topo)
HcalSimpleRecAlgo reco_
void HcalHitReconstructor::endRun ( edm::Run const &  r,
edm::EventSetup const &  es 
)
finaloverridevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 360 of file HcalHitReconstructor.cc.

References digiTimeFromDB_, HcalSimpleRecAlgo::endRun(), paramTS, reco_, and tsFromDB_.

360  {
361  if (tsFromDB_==true)
362  {
363  delete paramTS; paramTS=0;
364  }
365  if (digiTimeFromDB_==true)
366  {
367  //DL delete HFDigiTimeParams; HFDigiTimeParams = 0;
368  }
369  reco_.endRun();
370 }
HcalSimpleRecAlgo reco_
void HcalHitReconstructor::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 291 of file HcalHitReconstructor.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and edm::ParameterSetDescription::setAllowAnything().

291  {
293  desc.setAllowAnything();
294  desc.add<bool>("applyTimeSlewM3", true);
295  desc.add<double>("pedestalUpperLimit", 2.7);
296  desc.add<int>("timeSlewParsType",3);
297  desc.add<std::vector<double>>("timeSlewPars", { 12.2999, -2.19142, 0, 12.2999, -2.19142, 0, 12.2999, -2.19142, 0 });
298  desc.add<double>("respCorrM3", 1.0);
299  descriptions.add("hltHbhereco",desc);
300 }
void setAllowAnything()
allow any parameter label/value pairs
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void HcalHitReconstructor::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Definition at line 372 of file HcalHitReconstructor.cc.

References funct::abs(), edm::SortedCollection< T, SORT >::begin(), AlignmentProducer_cff::calibrations, cat_, HBHEStatusBitSetter::Clear(), cntprtCorrMethod_, HBHENegativeFlagSetter::configFilter(), HcalTimingCorrector::Correct(), CastorSimpleReconstructor_cfi::correctForPhaseContainment, HcalRecoParam::correctForPhaseContainment(), CastorSimpleReconstructor_cfi::correctForTimeslew, HcalRecoParam::correctForTimeslew(), HcalRecoParam::correctionPhaseNS(), HcalRecoParam::correctTiming(), correctTiming_, corrName_, dataOOTCorrectionCategory_, dataOOTCorrectionName_, particleFlowClusterECALTimeSelected_cfi::depth, det_, digiTimeFromDB_, HcalSeverityLevelComputer::dropChannel(), dropZSmarkedPassed_, edm::SortedCollection< T, SORT >::end(), HBHETimeProfileStatusBitSetter::EnergyThreshold(), edm::EventSetup::find(), plotBeamSpotDB::first, first_, HcalRecoParam::firstAuxTS(), firstAuxTS_, HcalRecoParam::firstSample(), firstSample_, OOTPileupCorrectionColl::get(), edm::EventSetup::get(), edm::eventsetup::EventSetupRecord::get(), edm::Event::getByToken(), HcalDbService::getHcalCalibrations(), HcalDbService::getHcalCoder(), HcalDbService::getHcalShape(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), hbheFlagSetter_, hbheHSCPFlagSetter_, hbheNegativeFlagSetter_, hbhePulseShapeFlagSetter_, HBHETimeProfileStatusBitSetter::hbheSetTimeFlagsFromDigi(), hbheTimingShapedFlagSetter_, DetId::Hcal, HcalBarrel, HcalCalibration, HcalEndcap, HcalForward, HcalOther, HcalOuter, hfdigibit_, HcalFlagHFDigiTimeParam::HFdigiflagCoefficients(), HcalFlagHFDigiTimeParam::HFdigiflagExpectedPeak(), HcalFlagHFDigiTimeParam::HFdigiflagFirstSample(), HcalFlagHFDigiTimeParam::HFdigiflagMinEThreshold(), HcalFlagHFDigiTimeParam::HFdigiflagSamplesToAdd(), HFDigiTimeParams, hfPET_, hfS8S1_, hfS9S1_, HcalHFStatusBitFromDigis::hfSetFlagFromDigi(), HcalHF_PETalgorithm::HFSetFlagFromPET(), HcalHF_S9S1algorithm::HFSetFlagFromS9S1(), HFTimingTrustFlagSetter_, mps_fire::i, edm::EventBase::isRealData(), gen::k, LogTrace, mcOOTCorrectionCategory_, mcOOTCorrectionName_, eostools::move(), AlCaHLTBitMon_ParallelJobs::p, paramTS, HcalRecoParam::pileupCleaningID(), HcalCaloFlagLabels::PresampleADC, edm::ESHandle< T >::product(), puCorrMethod_, edm::Event::put(), DetId::rawId(), reco_, HcalSimpleRecAlgo::reconstruct(), recoParamsFromDB_, HcalHFStatusBitFromDigis::resetParamsFromDB(), edm::Event::run(), HcalRecoParam::samplesToAdd(), samplesToAdd_, saturationFlagSetter_, HBHEStatusBitSetter::SetFlagsFromDigi(), HBHEStatusBitSetter::SetFlagsFromRecHits(), HcalSimpleRecAlgo::setForData(), HFTimingTrustFlag::setHFTimingTrustFlag(), setHSCPFlags_, HcalSimpleRecAlgo::setLeakCorrection(), setNegativeFlags_, setNoiseFlags_, setPileupCorrection_, HBHENegativeFlagSetter::setPulseShapeFlags(), HBHEPulseShapeFlagSetter::SetPulseShapeFlags(), setPulseShapeFlags_, HcalSimpleRecAlgo::setRecoParams(), HcalADCSaturationFlag::setSaturationFlag(), setSaturationFlags_, HBHETimingShapedFlagSetter::SetTimingShapedFlags(), setTimingTrustFlags_, edm::SortedCollection< T, SORT >::size(), subdet_, subdetOther_, tok_calib_, tok_hbhe_, tok_hf_, tok_ho_, tsFromDB_, HcalRecoParam::useLeakCorrection(), useLeakCorrection_, and geometryCSVtoXML::xx.

373 {
374 
375  // get conditions
377  eventSetup.get<HcalRecNumberingRecord>().get(topo);
378 
379  edm::ESHandle<HcalDbService> conditions;
380  eventSetup.get<HcalDbRecord>().get(conditions);
381 
382  // HACK related to HB- corrections
383  if ( first_ ) {
384  const bool isData = e.isRealData();
385  if (isData) reco_.setForData(e.run()); else reco_.setForData(0);
388  first_=false;
389  }
391 
393  eventSetup.get<HcalChannelQualityRcd>().get("withTopo",p);
394  const HcalChannelQuality* myqual = p.product();
395 
397  eventSetup.get<HcalSeverityLevelComputerRcd>().get(mycomputer);
398  const HcalSeverityLevelComputer* mySeverity = mycomputer.product();
399 
400  // Configure OOT pileup corrections
401  bool isMethod1Set = false;
402  if (!corrName_.empty())
403  {
404  edm::ESHandle<OOTPileupCorrectionColl> pileupCorrections;
405  if (eventSetup.find(edm::eventsetup::EventSetupRecordKey::makeKey<HcalOOTPileupCorrectionRcd>()))
406  eventSetup.get<HcalOOTPileupCorrectionRcd>().get(pileupCorrections);
407  else
408  eventSetup.get<HcalOOTPileupCompatibilityRcd>().get(pileupCorrections);
409 
410  if( setPileupCorrection_ ){
411  const OOTPileupCorrData * testMethod1Ptr = dynamic_cast<OOTPileupCorrData*>((pileupCorrections->get(corrName_, cat_)).get());
412  if( testMethod1Ptr ) isMethod1Set = true;
413  (reco_.*setPileupCorrection_)(pileupCorrections->get(corrName_, cat_));
414  }
415  }
416 
417  // Configure the negative energy filter
420  {
421  eventSetup.get<HBHENegativeEFilterRcd>().get(negEhandle);
423  }
424 
425  // Only for HBHE
426  if( subdet_ == HcalBarrel ) {
427  if( !cntprtCorrMethod_ ) {
429  if( puCorrMethod_ == 2 ) LogTrace("HcalPUcorrMethod") << "Using Hcal OOTPU method 2" << std::endl;
430  else if( puCorrMethod_ == 1 ){
431  if( isMethod1Set ) LogTrace("HcalPUcorrMethod") << "Using Hcal OOTPU method 1" << std::endl;
432  else edm::LogWarning("HcalPUcorrMethod") <<"puCorrMethod_ set to be 1 but method 1 is NOT activated (method 0 used instead)!\n"
433  <<"Please check GlobalTag usage or method 1 separately disabled by dataOOTCorrectionName & mcOOTCorrectionName?" << std::endl;
434  } else if (puCorrMethod_ == 3) {
435  LogTrace("HcalPUcorrMethod") << "Using Hcal Deterministic Fit Method!" << std::endl;
436  } else LogTrace("HcalPUcorrMethod") << "Using Hcal OOTPU method 0" << std::endl;
437  }
438  }
439 
440  // GET THE BEAM CROSSING INFO HERE, WHEN WE UNDERSTAND HOW THINGS WORK.
441  // Then, call "setBXInfo" method of the reco_ object.
442  // Also remember to call SetBXInfo in the negative energy flag setter.
443 
444  if (det_==DetId::Hcal) {
445 
446  // HBHE -------------------------------------------------------------------
449 
450  e.getByToken(tok_hbhe_,digi);
451 
452  // create empty output
453  auto rec = std::make_unique<HBHERecHitCollection>();
454  rec->reserve(digi->size());
455  // run the algorithm
458  std::vector<HBHEDataFrame> HBDigis;
459  std::vector<int> RecHitIndex;
460 
461  // Vote on majority TS0 CapId
462  int favorite_capid = 0;
463  if (correctTiming_) {
464  long capid_votes[4] = {0,0,0,0};
465  for (i=digi->begin(); i!=digi->end(); i++) {
466  capid_votes[(*i)[0].capid()]++;
467  }
468  for (int k = 0; k < 4; k++)
469  if (capid_votes[k] > capid_votes[favorite_capid])
470  favorite_capid = k;
471  }
472 
473  for (i=digi->begin(); i!=digi->end(); i++) {
474  HcalDetId cell = i->id();
475  DetId detcell=(DetId)cell;
476 
478  const HcalRecoParam* param_ts = paramTS->getValues(detcell.rawId());
479  if(tsFromDB_) {
480  firstSample_ = param_ts->firstSample();
481  samplesToAdd_ = param_ts->samplesToAdd();
482  }
483  if(recoParamsFromDB_) {
484  bool correctForTimeslew=param_ts->correctForTimeslew();
486  float phaseNS=param_ts->correctionPhaseNS();
488  correctTiming_ = param_ts->correctTiming();
489  firstAuxTS_ = param_ts->firstAuxTS();
490  int pileupCleaningID = param_ts->pileupCleaningID();
491 
492  /*
493  int sub = cell.subdet();
494  int depth = cell.depth();
495  int inteta = cell.ieta();
496  int intphi = cell.iphi();
497 
498  std::cout << "HcalHitReconstructor::produce cell:"
499  << " sub, ieta, iphi, depth = "
500  << sub << " " << inteta << " " << intphi
501  << " " << depth << std::endl
502  << " first, toadd = " << firstSample_ << ", "
503  << samplesToAdd_ << std::endl
504  << " correctForTimeslew " << correctForTimeslew
505  << std::endl
506  << " correctForPhaseContainment "
507  << correctForPhaseContainment << std::endl
508  << " phaseNS " << phaseNS << std::endl
509  << " useLeakCorrection " << useLeakCorrection_
510  << std::endl
511  << " correctTiming " << correctTiming_ << std::endl
512  << " firstAuxTS " << firstAuxTS_ << std::endl
513  << " pileupCleaningID " << pileupCleaningID
514  << std::endl;
515  */
516 
517  reco_.setRecoParams(correctForTimeslew,correctForPhaseContainment,useLeakCorrection_,pileupCleaningID,phaseNS);
518  }
519  }
520 
521  int first = firstSample_;
522  int toadd = samplesToAdd_;
523 
524  // check on cells to be ignored and dropped: (rof,20.Feb.09)
525  const HcalChannelStatus* mydigistatus=myqual->getValues(detcell.rawId());
526  if (mySeverity->dropChannel(mydigistatus->getValue() ) ) continue;
528  if (i->zsMarkAndPass()) continue;
529 
530  const HcalCalibrations& calibrations=conditions->getHcalCalibrations(cell);
531  const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
532  const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
533  HcalCoderDb coder (*channelCoder, *shape);
534 
535  rec->push_back(reco_.reconstruct(*i,first,toadd,coder,calibrations));
536 
537  // Fill first auxiliary word
538  unsigned int auxflag=0;
539  int fTS = firstAuxTS_;
540  if (fTS<0) fTS=0; // silly protection against time slice <0
541  for (int xx=fTS; xx<fTS+4 && xx<i->size();++xx) {
542  int adcv = i->sample(xx).adc();
543  auxflag+=((adcv&0x7F)<<(7*(xx-fTS))); // store the time slices in the first 28 bits of aux, a set of 4 7-bit adc values
544  // bits 28 and 29 are reserved for capid of the first time slice saved in aux
545  }
546  auxflag+=((i->sample(fTS).capid())<<28);
547  (rec->back()).setAux(auxflag);
548 
549  // Fill second auxiliary word
550  auxflag=0;
551  int fTS2 = (firstAuxTS_-4 < 0) ? 0 : firstAuxTS_-4;
552  for (int xx = fTS2; xx < fTS2+4 && xx<i->size(); ++xx) {
553  int adcv = i->sample(xx).adc();
554  auxflag+=((adcv&0x7F)<<(7*(xx-fTS2)));
555  }
556  auxflag+=((i->sample(fTS2).capid())<<28);
557  (rec->back()).setAuxHBHE(auxflag);
558 
559  // (rec->back()).setFlags(0); Don't want to do this because the algorithm
560  // can already set some flags
561  // Set presample flag
562  if (fTS>0)
563  (rec->back()).setFlagField((i->sample(fTS-1).adc()), HcalCaloFlagLabels::PresampleADC,7);
564 
567  if (setNoiseFlags_)
568  hbheFlagSetter_->SetFlagsFromDigi(rec->back(), *i, coder, calibrations);
571  if (setNegativeFlags_)
575  if (correctTiming_)
576  HcalTimingCorrector::Correct(rec->back(), *i, favorite_capid);
577  if (setHSCPFlags_ && i->id().ietaAbs()<16)
578  {
579  double DigiEnergy=0;
580  for(int j=0; j!=i->size(); DigiEnergy += i->sample(j++).nominal_fC());
581  if(DigiEnergy > hbheHSCPFlagSetter_->EnergyThreshold())
582  {
583  HBDigis.push_back(*i);
584  RecHitIndex.push_back(rec->size()-1);
585  }
586 
587  } // if (set HSCPFlags_ && |ieta|<16)
588  } // loop over HBHE digis
589 
590 
592  if (setHSCPFlags_) hbheHSCPFlagSetter_->hbheSetTimeFlagsFromDigi(rec.get(), HBDigis, RecHitIndex);
593  // return result
594  e.put(std::move(rec));
595 
596  // HO ------------------------------------------------------------------
597  } else if (subdet_==HcalOuter) {
599  e.getByToken(tok_ho_,digi);
600 
601  // create empty output
602  auto rec = std::make_unique<HORecHitCollection>();
603  rec->reserve(digi->size());
604  // run the algorithm
606 
607  // Vote on majority TS0 CapId
608  int favorite_capid = 0;
609  if (correctTiming_) {
610  long capid_votes[4] = {0,0,0,0};
611  for (i=digi->begin(); i!=digi->end(); i++) {
612  capid_votes[(*i)[0].capid()]++;
613  }
614  for (int k = 0; k < 4; k++)
615  if (capid_votes[k] > capid_votes[favorite_capid])
616  favorite_capid = k;
617  }
618 
619  for (i=digi->begin(); i!=digi->end(); i++) {
620  HcalDetId cell = i->id();
621  DetId detcell=(DetId)cell;
622  // firstSample & samplesToAdd
624  const HcalRecoParam* param_ts = paramTS->getValues(detcell.rawId());
625  if(tsFromDB_) {
626  firstSample_ = param_ts->firstSample();
627  samplesToAdd_ = param_ts->samplesToAdd();
628  }
629  if(recoParamsFromDB_) {
630  bool correctForTimeslew=param_ts->correctForTimeslew();
631  bool correctForPhaseContainment= param_ts->correctForPhaseContainment();
632  float phaseNS=param_ts->correctionPhaseNS();
634  correctTiming_ = param_ts->correctTiming();
635  firstAuxTS_ = param_ts->firstAuxTS();
636  int pileupCleaningID = param_ts->pileupCleaningID();
637  reco_.setRecoParams(correctForTimeslew,correctForPhaseContainment,useLeakCorrection_,pileupCleaningID,phaseNS);
638  }
639  }
640 
641  int first = firstSample_;
642  int toadd = samplesToAdd_;
643 
644  // check on cells to be ignored and dropped: (rof,20.Feb.09)
645  const HcalChannelStatus* mydigistatus=myqual->getValues(detcell.rawId());
646  if (mySeverity->dropChannel(mydigistatus->getValue() ) ) continue;
648  if (i->zsMarkAndPass()) continue;
649 
650  const HcalCalibrations& calibrations=conditions->getHcalCalibrations(cell);
651  const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
652  const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
653  HcalCoderDb coder (*channelCoder, *shape);
654 
655  rec->push_back(reco_.reconstruct(*i,first,toadd,coder,calibrations));
656 
657  // Set auxiliary flag
658  int auxflag=0;
659  int fTS = firstAuxTS_;
660  if (fTS<0) fTS=0; //silly protection against negative time slice values
661  for (int xx=fTS; xx<fTS+4 && xx<i->size();++xx)
662  auxflag+=(i->sample(xx).adc())<<(7*(xx-fTS)); // store the time slices in the first 28 bits of aux, a set of 4 7-bit adc values
663  // bits 28 and 29 are reserved for capid of the first time slice saved in aux
664  auxflag+=((i->sample(fTS).capid())<<28);
665  (rec->back()).setAux(auxflag);
666  // (rec->back()).setFlags(0); Don't want to do this because the algorithm
667  // can already set some flags
668  // Fill Presample ADC flag
669  if (fTS>0)
670  (rec->back()).setFlagField((i->sample(fTS-1).adc()), HcalCaloFlagLabels::PresampleADC,7);
671 
674  if (correctTiming_)
675  HcalTimingCorrector::Correct(rec->back(), *i, favorite_capid);
676  }
677  // return result
678  e.put(std::move(rec));
679 
680  // HF -------------------------------------------------------------------
681  } else if (subdet_==HcalForward) {
683  e.getByToken(tok_hf_,digi);
684 
685 
687  // create empty output
688  auto rec = std::make_unique<HFRecHitCollection>();
689  rec->reserve(digi->size());
690  // run the algorithm
692 
693  // Vote on majority TS0 CapId
694  int favorite_capid = 0;
695  if (correctTiming_) {
696  long capid_votes[4] = {0,0,0,0};
697  for (i=digi->begin(); i!=digi->end(); i++) {
698  capid_votes[(*i)[0].capid()]++;
699  }
700  for (int k = 0; k < 4; k++)
701  if (capid_votes[k] > capid_votes[favorite_capid])
702  favorite_capid = k;
703  }
704 
705  for (i=digi->begin(); i!=digi->end(); i++) {
706  HcalDetId cell = i->id();
707  DetId detcell=(DetId)cell;
708 
710  const HcalRecoParam* param_ts = paramTS->getValues(detcell.rawId());
711  if(tsFromDB_) {
712  firstSample_ = param_ts->firstSample();
713  samplesToAdd_ = param_ts->samplesToAdd();
714  }
715  if(recoParamsFromDB_) {
716  bool correctForTimeslew=param_ts->correctForTimeslew();
717  bool correctForPhaseContainment= param_ts->correctForPhaseContainment();
718  float phaseNS=param_ts->correctionPhaseNS();
720  correctTiming_ = param_ts->correctTiming();
721  firstAuxTS_ = param_ts->firstAuxTS();
722  int pileupCleaningID = param_ts->pileupCleaningID();
723  reco_.setRecoParams(correctForTimeslew,correctForPhaseContainment,useLeakCorrection_,pileupCleaningID,phaseNS);
724  }
725  }
726 
727  int first = firstSample_;
728  int toadd = samplesToAdd_;
729 
730  // check on cells to be ignored and dropped: (rof,20.Feb.09)
731  const HcalChannelStatus* mydigistatus=myqual->getValues(detcell.rawId());
732  if (mySeverity->dropChannel(mydigistatus->getValue() ) ) continue;
734  if (i->zsMarkAndPass()) continue;
735 
736  const HcalCalibrations& calibrations=conditions->getHcalCalibrations(cell);
737  const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
738  const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
739  HcalCoderDb coder (*channelCoder, *shape);
740 
741  // Set HFDigiTime flag values from digiTimeFromDB_
742  if (digiTimeFromDB_==true && hfdigibit_!=0)
743  {
744  const HcalFlagHFDigiTimeParam* hfDTparam = HFDigiTimeParams->getValues(detcell.rawId());
746  hfDTparam->HFdigiflagSamplesToAdd(),
747  hfDTparam->HFdigiflagExpectedPeak(),
748  hfDTparam->HFdigiflagMinEThreshold(),
749  hfDTparam->HFdigiflagCoefficients()
750  );
751  }
752 
753  //std::cout << "TOADDHF " << toadd << " " << first << " " << std::endl;
754  rec->push_back(reco_.reconstruct(*i,first,toadd,coder,calibrations));
755 
756  // Set auxiliary flag
757  int auxflag=0;
758  int fTS = firstAuxTS_;
759  if (fTS<0) fTS=0; // silly protection against negative time slice values
760  for (int xx=fTS; xx<fTS+4 && xx<i->size();++xx)
761  auxflag+=(i->sample(xx).adc())<<(7*(xx-fTS)); // store the time slices in the first 28 bits of aux, a set of 4 7-bit adc values
762  // bits 28 and 29 are reserved for capid of the first time slice saved in aux
763  auxflag+=((i->sample(fTS).capid())<<28);
764  (rec->back()).setAux(auxflag);
765 
766  // (rec->back()).setFlags(0); Don't want to do this because the algorithm
767  // can already set some flags
768 
769  // Fill Presample ADC flag
770  if (fTS>0)
771  (rec->back()).setFlagField((i->sample(fTS-1).adc()), HcalCaloFlagLabels::PresampleADC,7);
772 
773  // This calls the code for setting the HF noise bit determined from digi shape
774  if (setNoiseFlags_)
775  hfdigibit_->hfSetFlagFromDigi(rec->back(),*i,coder,calibrations);
780  if (correctTiming_)
781  HcalTimingCorrector::Correct(rec->back(), *i, favorite_capid);
782  } // for (i=digi->begin(); i!=digi->end(); i++) -- loop on all HF digis
783 
784  // The following flags require the full set of rechits
785  // These need to be set consecutively, so an energy check should be the first
786  // test performed on these hits (to minimize the loop time)
787  if (setNoiseFlags_)
788  {
789  // Step 1: Set PET flag (short fibers of |ieta|==29)
790  // Neighbor/partner channels that are flagged by Pulse Shape algorithm (HFDigiTime)
791  // won't be considered in these calculations
792  for (HFRecHitCollection::iterator i = rec->begin();i!=rec->end();++i)
793  {
794  int depth=i->id().depth();
795  int ieta=i->id().ieta();
796  // Short fibers and all channels at |ieta|=29 use PET settings in Algo 3
797  if (depth==2 || abs(ieta)==29 )
798  hfPET_->HFSetFlagFromPET(*i,*rec,myqual,mySeverity);
799  }
800 
801  // Step 2: Set S8S1 flag (short fibers or |ieta|==29)
802  for (HFRecHitCollection::iterator i = rec->begin();i!=rec->end();++i)
803  {
804  int depth=i->id().depth();
805  int ieta=i->id().ieta();
806  // Short fibers and all channels at |ieta|=29 use PET settings in Algo 3
807  if (depth==2 || abs(ieta)==29 )
808  hfS8S1_->HFSetFlagFromS9S1(*i,*rec,myqual,mySeverity);
809  }
810 
811  // Set 3: Set S9S1 flag (long fibers)
812  for (HFRecHitCollection::iterator i = rec->begin();i!=rec->end();++i)
813  {
814  int depth=i->id().depth();
815  int ieta=i->id().ieta();
816  // Short fibers and all channels at |ieta|=29 use PET settings in Algo 3
817  if (depth==1 && abs(ieta)!=29 )
818  hfS9S1_->HFSetFlagFromS9S1(*i,*rec,myqual, mySeverity);
819  }
820  }
821 
822  // return result
823  e.put(std::move(rec));
824  } else if (subdet_==HcalOther && subdetOther_==HcalCalibration) {
826  e.getByToken(tok_calib_,digi);
827 
828  // create empty output
829  auto rec = std::make_unique<HcalCalibRecHitCollection>();
830  rec->reserve(digi->size());
831  // run the algorithm
832  int first = firstSample_;
833  int toadd = samplesToAdd_;
834 
836  for (i=digi->begin(); i!=digi->end(); i++) {
837  HcalCalibDetId cell = i->id();
838  // HcalDetId cellh = i->id();
839  DetId detcell=(DetId)cell;
840  // check on cells to be ignored and dropped: (rof,20.Feb.09)
841  const HcalChannelStatus* mydigistatus=myqual->getValues(detcell.rawId());
842  if (mySeverity->dropChannel(mydigistatus->getValue() ) ) continue;
844  if (i->zsMarkAndPass()) continue;
845 
846  const HcalCalibrations& calibrations=conditions->getHcalCalibrations(cell);
847  const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
848  const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
849  HcalCoderDb coder (*channelCoder, *shape);
850 
851  // firstSample & samplesToAdd
852  if(tsFromDB_) {
853  const HcalRecoParam* param_ts = paramTS->getValues(detcell.rawId());
854  first = param_ts->firstSample();
855  toadd = param_ts->samplesToAdd();
856  }
857  rec->push_back(reco_.reconstruct(*i,first,toadd,coder,calibrations));
858 
859  /*
860  // Flag setting not available for calibration rechits
861  // Set auxiliary flag
862  int auxflag=0;
863  int fTS = firstAuxTS_;
864  for (int xx=fTS; xx<fTS+4 && xx<i->size();++xx)
865  auxflag+=(i->sample(xx).adc())<<(7*(xx-fTS)); // store the time slices in the first 28 bits of aux, a set of 4 7-bit adc values
866  // bits 28 and 29 are reserved for capid of the first time slice saved in aux
867  auxflag+=((i->sample(fTS).capid())<<28);
868  (rec->back()).setAux(auxflag);
869 
870  (rec->back()).setFlags(0); // Not yet implemented for HcalCalibRecHit
871  */
872  }
873  // return result
874  e.put(std::move(rec));
875  }
876  }
877  //DL delete myqual;
878 } // void HcalHitReconstructor::produce(...)
unsigned int firstSample() const
Definition: HcalRecoParam.h:32
void HFSetFlagFromS9S1(HFRecHit &hf, HFRecHitCollection &rec, const HcalChannelQuality *myqual, const HcalSeverityLevelComputer *mySeverity)
boost::shared_ptr< AbsOOTPileupCorrection > get(const std::string &name, const std::string &category) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
HBHERecHit reconstruct(const HBHEDataFrame &digi, int first, int toadd, const HcalCoder &coder, const HcalCalibrations &calibs) const
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
void configFilter(const HBHENegativeEFilter *f)
void setHFTimingTrustFlag(HFRecHit &rechit, const HFDataFrame &digi)
unsigned int pileupCleaningID() const
Definition: HcalRecoParam.h:44
HcalADCSaturationFlag * saturationFlagSetter_
void SetPulseShapeFlags(HBHERecHit &hbhe, const Dataframe &digi, const HcalCoder &coder, const HcalCalibrations &calib)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
uint32_t HFdigiflagSamplesToAdd() const
bool correctForPhaseContainment() const
Definition: HcalRecoParam.h:29
void hfSetFlagFromDigi(HFRecHit &hf, const HFDataFrame &digi, const HcalCoder &coder, const HcalCalibrations &calib)
std::vector< HBHEDataFrame >::const_iterator const_iterator
const Item * getValues(DetId fId, bool throwOnFail=true) const
void resetParamsFromDB(int firstSample, int samplesToAdd, int expectedPeak, double minthreshold, const std::vector< double > &coef)
bool isRealData() const
Definition: EventBase.h:62
SetCorrectionFcn setPileupCorrection_
void HFSetFlagFromPET(HFRecHit &hf, HFRecHitCollection &rec, const HcalChannelQuality *myqual, const HcalSeverityLevelComputer *mySeverity)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
std::string dataOOTCorrectionCategory_
HBHENegativeFlagSetter * hbheNegativeFlagSetter_
std::unique_ptr< HcalFlagHFDigiTimeParams > HFDigiTimeParams
void get(HolderT &iHolder) const
bool correctForTimeslew() const
Definition: HcalRecoParam.h:38
edm::EDGetTokenT< HcalCalibDigiCollection > tok_calib_
bool correctTiming() const
Definition: HcalRecoParam.h:40
RunNumber_t run() const
Definition: Event.h:94
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HcalHFStatusBitFromDigis * hfdigibit_
bool dropChannel(const uint32_t &mystatus) const
uint32_t HFdigiflagExpectedPeak() const
void hbheSetTimeFlagsFromDigi(HBHERecHitCollection *, const std::vector< HBHEDataFrame > &, const std::vector< int > &)
void setSaturationFlag(HBHERecHit &rechit, const HBHEDataFrame &digi)
unsigned int samplesToAdd() const
Definition: HcalRecoParam.h:33
edm::EDGetTokenT< HODigiCollection > tok_ho_
#define LogTrace(id)
float correctionPhaseNS() const
Definition: HcalRecoParam.h:31
std::vector< HFRecHit >::iterator iterator
int k[5][pyjets_maxn]
const_iterator end() const
std::vector< double > HFdigiflagCoefficients() const
HcalHF_PETalgorithm * hfPET_
Definition: DetId.h:18
HcalHF_S9S1algorithm * hfS9S1_
HBHEPulseShapeFlagSetter * hbhePulseShapeFlagSetter_
void setRecoParams(bool correctForTimeslew, bool correctForPulse, bool setLeakCorrection, int pileupCleaningID, float phaseNS)
void SetTimingShapedFlags(HBHERecHit &hbhe)
uint32_t HFdigiflagFirstSample() const
void setForData(int runnum)
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
HBHEStatusBitSetter * hbheFlagSetter_
HBHETimeProfileStatusBitSetter * hbheHSCPFlagSetter_
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
void SetFlagsFromDigi(HBHERecHit &hbhe, const HBHEDataFrame &digi, const HcalCoder &coder, const HcalCalibrations &calib)
HBHETimingShapedFlagSetter * hbheTimingShapedFlagSetter_
void setPulseShapeFlags(HBHERecHit &hbhe, const HBHEDataFrame &digi, const HcalCoder &coder, const HcalCalibrations &calib)
HcalHF_S9S1algorithm * hfS8S1_
size_type size() const
HcalOtherSubdetector subdetOther_
static void Correct(HBHERecHit &rechit, const HBHEDataFrame &digi, int favorite_capid)
unsigned int firstAuxTS() const
Definition: HcalRecoParam.h:41
HFTimingTrustFlag * HFTimingTrustFlagSetter_
uint32_t getValue() const
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
std::string mcOOTCorrectionCategory_
edm::EDGetTokenT< HFDigiCollection > tok_hf_
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:510
void SetFlagsFromRecHits(HBHERecHitCollection &rec)
const_iterator begin() const
HcalSimpleRecAlgo reco_
double HFdigiflagMinEThreshold() const
bool useLeakCorrection() const
Definition: HcalRecoParam.h:36

Member Data Documentation

std::string HcalHitReconstructor::cat_
private

Definition at line 116 of file HcalHitReconstructor.h.

Referenced by produce().

int HcalHitReconstructor::cntprtCorrMethod_
private

Definition at line 114 of file HcalHitReconstructor.h.

Referenced by produce().

bool HcalHitReconstructor::correctTiming_
private

Definition at line 81 of file HcalHitReconstructor.h.

Referenced by produce().

std::string HcalHitReconstructor::corrName_
private

Definition at line 116 of file HcalHitReconstructor.h.

Referenced by produce().

std::string HcalHitReconstructor::dataOOTCorrectionCategory_
private

Definition at line 105 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

std::string HcalHitReconstructor::dataOOTCorrectionName_
private

Definition at line 104 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

DetId::Detector HcalHitReconstructor::det_
private

Definition at line 72 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

bool HcalHitReconstructor::digiTimeFromDB_
private

Definition at line 97 of file HcalHitReconstructor.h.

Referenced by beginRun(), endRun(), HcalHitReconstructor(), and produce().

bool HcalHitReconstructor::dropZSmarkedPassed_
private

Definition at line 88 of file HcalHitReconstructor.h.

Referenced by produce().

bool HcalHitReconstructor::first_
private

Definition at line 115 of file HcalHitReconstructor.h.

Referenced by produce().

int HcalHitReconstructor::firstAuxTS_
private

Definition at line 90 of file HcalHitReconstructor.h.

Referenced by produce().

int HcalHitReconstructor::firstSample_
private

Definition at line 93 of file HcalHitReconstructor.h.

Referenced by produce().

HBHEStatusBitSetter* HcalHitReconstructor::hbheFlagSetter_
private
HBHETimeProfileStatusBitSetter* HcalHitReconstructor::hbheHSCPFlagSetter_
private

Definition at line 63 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), produce(), and ~HcalHitReconstructor().

HBHENegativeFlagSetter* HcalHitReconstructor::hbheNegativeFlagSetter_
private

Definition at line 66 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), produce(), and ~HcalHitReconstructor().

HBHEPulseShapeFlagSetter* HcalHitReconstructor::hbhePulseShapeFlagSetter_
private

Definition at line 65 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), produce(), and ~HcalHitReconstructor().

HBHETimingShapedFlagSetter* HcalHitReconstructor::hbheTimingShapedFlagSetter_
private

Definition at line 64 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), produce(), and ~HcalHitReconstructor().

HcalHFStatusBitFromDigis* HcalHitReconstructor::hfdigibit_
private

Definition at line 67 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), produce(), and ~HcalHitReconstructor().

std::unique_ptr<HcalFlagHFDigiTimeParams> HcalHitReconstructor::HFDigiTimeParams
private

Definition at line 111 of file HcalHitReconstructor.h.

Referenced by beginRun(), and produce().

HcalHF_PETalgorithm* HcalHitReconstructor::hfPET_
private

Definition at line 70 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), produce(), and ~HcalHitReconstructor().

HcalHF_S9S1algorithm* HcalHitReconstructor::hfS8S1_
private

Definition at line 69 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), produce(), and ~HcalHitReconstructor().

HcalHF_S9S1algorithm* HcalHitReconstructor::hfS9S1_
private

Definition at line 68 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), produce(), and ~HcalHitReconstructor().

HFTimingTrustFlag* HcalHitReconstructor::HFTimingTrustFlagSetter_
private

Definition at line 61 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), produce(), and ~HcalHitReconstructor().

edm::InputTag HcalHitReconstructor::inputLabel_
private

Definition at line 75 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor().

std::string HcalHitReconstructor::mcOOTCorrectionCategory_
private

Definition at line 107 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

std::string HcalHitReconstructor::mcOOTCorrectionName_
private

Definition at line 106 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

HcalRecoParams* HcalHitReconstructor::paramTS
private

Definition at line 110 of file HcalHitReconstructor.h.

Referenced by beginRun(), endRun(), produce(), and ~HcalHitReconstructor().

int HcalHitReconstructor::puCorrMethod_
private

Definition at line 113 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

HcalSimpleRecAlgo HcalHitReconstructor::reco_
private

Definition at line 59 of file HcalHitReconstructor.h.

Referenced by beginRun(), endRun(), HcalHitReconstructor(), and produce().

bool HcalHitReconstructor::recoParamsFromDB_
private

Definition at line 96 of file HcalHitReconstructor.h.

Referenced by beginRun(), HcalHitReconstructor(), and produce().

int HcalHitReconstructor::samplesToAdd_
private

Definition at line 94 of file HcalHitReconstructor.h.

Referenced by produce().

HcalADCSaturationFlag* HcalHitReconstructor::saturationFlagSetter_
private

Definition at line 60 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), produce(), and ~HcalHitReconstructor().

bool HcalHitReconstructor::setHSCPFlags_
private

Definition at line 83 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

bool HcalHitReconstructor::setNegativeFlags_
private

Definition at line 87 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

bool HcalHitReconstructor::setNoiseFlags_
private

Definition at line 82 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

SetCorrectionFcn HcalHitReconstructor::setPileupCorrection_
private

Definition at line 108 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

bool HcalHitReconstructor::setPulseShapeFlags_
private

Definition at line 86 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

bool HcalHitReconstructor::setSaturationFlags_
private

Definition at line 84 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

bool HcalHitReconstructor::setTimingTrustFlags_
private

Definition at line 85 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

int HcalHitReconstructor::subdet_
private

Definition at line 73 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

HcalOtherSubdetector HcalHitReconstructor::subdetOther_
private

Definition at line 74 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

edm::EDGetTokenT<HcalCalibDigiCollection> HcalHitReconstructor::tok_calib_
private

Definition at line 79 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

edm::EDGetTokenT<HBHEDigiCollection> HcalHitReconstructor::tok_hbhe_
private

Definition at line 76 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

edm::EDGetTokenT<HFDigiCollection> HcalHitReconstructor::tok_hf_
private

Definition at line 78 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

edm::EDGetTokenT<HODigiCollection> HcalHitReconstructor::tok_ho_
private

Definition at line 77 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

bool HcalHitReconstructor::tsFromDB_
private

Definition at line 95 of file HcalHitReconstructor.h.

Referenced by beginRun(), endRun(), and produce().

bool HcalHitReconstructor::useLeakCorrection_
private

Definition at line 101 of file HcalHitReconstructor.h.

Referenced by produce().