CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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) overridefinal
 
virtual void endRun (edm::Run const &r, edm::EventSetup const &es) overridefinal
 
 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
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

typedef void(HcalSimpleRecAlgo::* SetCorrectionFcn )(boost::shared_ptr< AbsOOTPileupCorrection >)
 
typedef void(HBHENegativeFlagSetter::* SetCorrectionFcnForNegative )(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
< HcalFlagHFDigiTimeParams
HFDigiTimeParams
 
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_
 
SetCorrectionFcnForNegative setPileupCorrectionForNegative_
 
bool setPulseShapeFlags_
 
bool setSaturationFlags_
 
bool setTimingTrustFlags_
 
int subdet_
 
HcalOtherSubdetector subdetOther_
 
edm::EDGetTokenT
< HcalCalibDigiCollection
tok_calib_
 
edm::EDGetTokenT
< HBHEDigiCollection
tok_hbhe_
 
edm::EDGetTokenT
< HFDigiCollection
tok_hf_
 
edm::EDGetTokenT
< HODigiCollection
tok_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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 56 of file HcalHitReconstructor.h.

typedef void(HBHENegativeFlagSetter::* HcalHitReconstructor::SetCorrectionFcnForNegative)(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 24 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_, HBHENegativeFlagSetter::setHBHEPileupCorrection(), HcalSimpleRecAlgo::setHBHEPileupCorrection(), HcalSimpleRecAlgo::setHFPileupCorrection(), HcalSimpleRecAlgo::setHOPileupCorrection(), setHSCPFlags_, setNegativeFlags_, setNoiseFlags_, setPileupCorrection_, setPileupCorrectionForNegative_, HcalSimpleRecAlgo::setpuCorrMethod(), HcalSimpleRecAlgo::setpuCorrParams(), setPulseShapeFlags_, setSaturationFlags_, setTimingTrustFlags_, AlCaHLTBitMon_QueryRunRegistry::string, subdet_, HcalZDCDetId::SubdetectorId, subdetOther_, tok_calib_, tok_hbhe_, tok_hf_, and tok_ho_.

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

Definition at line 288 of file HcalHitReconstructor.cc.

References hbheFlagSetter_, hbheHSCPFlagSetter_, hbhePulseShapeFlagSetter_, hfdigibit_, hfPET_, hfS9S1_, and paramTS.

288  {
289  delete hbheFlagSetter_;
290  delete hfdigibit_;
291  delete hbheHSCPFlagSetter_;
293  delete hfS9S1_;
294  delete hfPET_;
295  delete paramTS;
296 }
HcalHFStatusBitFromDigis * hfdigibit_
HcalHF_PETalgorithm * hfPET_
HcalHF_S9S1algorithm * hfS9S1_
HBHEPulseShapeFlagSetter * hbhePulseShapeFlagSetter_
HBHEStatusBitSetter * hbheFlagSetter_
HBHETimeProfileStatusBitSetter * hbheHSCPFlagSetter_

Member Function Documentation

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

Reimplemented from edm::stream::EDProducerBase.

Definition at line 298 of file HcalHitReconstructor.cc.

References HcalSimpleRecAlgo::beginRun(), digiTimeFromDB_, edm::EventSetup::get(), HFDigiTimeParams, AlCaHLTBitMon_ParallelJobs::p, paramTS, edm::ESHandle< class >::product(), reco_, recoParamsFromDB_, HcalCondObjectContainerBase::setTopo(), and tsFromDB_.

298  {
299 
301  es.get<IdealGeometryRecord>().get(htopo);
302 
303  if ( tsFromDB_== true || recoParamsFromDB_ == true )
304  {
306  es.get<HcalRecoParamsRcd>().get(p);
307  paramTS = new HcalRecoParams(*p.product());
308  paramTS->setTopo(htopo.product());
309 
310 
311 
312 
313  // std::cout<<" skdump in HcalHitReconstructor::beginRun dupm RecoParams "<<std::endl;
314  // std::ofstream skfile("skdumpRecoParamsNewFormat.txt");
315  // HcalDbASCIIIO::dumpObject(skfile, (*paramTS) );
316  }
317 
318  if (digiTimeFromDB_==true)
319  {
321  es.get<HcalFlagHFDigiTimeParamsRcd>().get(p);
322  HFDigiTimeParams.reset( new HcalFlagHFDigiTimeParams( *p ) );
323 
325  es.get<IdealGeometryRecord>().get(htopo);
326  HFDigiTimeParams->setTopo(htopo.product());
327 
328  }
329 
330  reco_.beginRun(es);
331 }
void beginRun(edm::EventSetup const &es)
std::unique_ptr< HcalFlagHFDigiTimeParams > HFDigiTimeParams
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 333 of file HcalHitReconstructor.cc.

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

333  {
334  if (tsFromDB_==true)
335  {
336  delete paramTS; paramTS=0;
337  }
338  if (digiTimeFromDB_==true)
339  {
340  //DL delete HFDigiTimeParams; HFDigiTimeParams = 0;
341  }
342  reco_.endRun();
343 }
HcalSimpleRecAlgo reco_
void HcalHitReconstructor::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 345 of file HcalHitReconstructor.cc.

References funct::abs(), cat_, HBHEStatusBitSetter::Clear(), cntprtCorrMethod_, HcalTimingCorrector::Correct(), HcalRecoParam::correctForPhaseContainment(), HLT_25ns14e33_v1_cff::correctForPhaseContainment, HcalRecoParam::correctForTimeslew(), HLT_25ns14e33_v1_cff::correctForTimeslew, HcalRecoParam::correctionPhaseNS(), HcalRecoParam::correctTiming(), correctTiming_, corrName_, dataOOTCorrectionCategory_, dataOOTCorrectionName_, HLT_25ns14e33_v1_cff::depth, det_, digiTimeFromDB_, HcalSeverityLevelComputer::dropChannel(), dropZSmarkedPassed_, HBHETimeProfileStatusBitSetter::EnergyThreshold(), edm::EventSetup::find(), plotBeamSpotDB::first, first_, HcalRecoParam::firstAuxTS(), firstAuxTS_, HcalRecoParam::firstSample(), firstSample_, edm::EventSetup::get(), edm::eventsetup::EventSetupRecord::get(), edm::Event::getByToken(), 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_, i, edm::EventBase::isRealData(), j, relval_steps::k, LogTrace, mcOOTCorrectionCategory_, mcOOTCorrectionName_, AlCaHLTBitMon_ParallelJobs::p, paramTS, HcalRecoParam::pileupCleaningID(), HcalCaloFlagLabels::PresampleADC, edm::ESHandle< class >::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_, setPileupCorrectionForNegative_, HBHENegativeFlagSetter::setPulseShapeFlags(), HBHEPulseShapeFlagSetter::SetPulseShapeFlags(), setPulseShapeFlags_, HcalSimpleRecAlgo::setRecoParams(), HcalADCSaturationFlag::setSaturationFlag(), setSaturationFlags_, HBHETimingShapedFlagSetter::SetTimingShapedFlags(), setTimingTrustFlags_, subdet_, subdetOther_, tok_calib_, tok_hbhe_, tok_hf_, tok_ho_, tsFromDB_, HcalRecoParam::useLeakCorrection(), and useLeakCorrection_.

346 {
347 
348  // get conditions
350  eventSetup.get<IdealGeometryRecord>().get(topo);
351 
352  edm::ESHandle<HcalDbService> conditions;
353  eventSetup.get<HcalDbRecord>().get(conditions);
354 
355  // HACK related to HB- corrections
356  if ( first_ ) {
357  const bool isData = e.isRealData();
358  if (isData) reco_.setForData(e.run()); else reco_.setForData(0);
361  first_=false;
362  }
364 
366  eventSetup.get<HcalChannelQualityRcd>().get("withTopo",p);
367  const HcalChannelQuality* myqual = p.product();
368 
370  eventSetup.get<HcalSeverityLevelComputerRcd>().get(mycomputer);
371  const HcalSeverityLevelComputer* mySeverity = mycomputer.product();
372 
373  // Configure OOT pileup corrections
374  bool isMethod1Set = false;
375  if (!corrName_.empty())
376  {
377  edm::ESHandle<OOTPileupCorrectionColl> pileupCorrections;
378  if (eventSetup.find(edm::eventsetup::EventSetupRecordKey::makeKey<HcalOOTPileupCorrectionRcd>()))
379  eventSetup.get<HcalOOTPileupCorrectionRcd>().get(pileupCorrections);
380  else
381  eventSetup.get<HcalOOTPileupCompatibilityRcd>().get(pileupCorrections);
382 
383  if( setPileupCorrection_ ){
384  const OOTPileupCorrData * testMethod1Ptr = dynamic_cast<OOTPileupCorrData*>((pileupCorrections->get(corrName_, cat_)).get());
385  if( testMethod1Ptr ) isMethod1Set = true;
386  (reco_.*setPileupCorrection_)(pileupCorrections->get(corrName_, cat_));
387  }
388 
391  }
392 // Only for HBHE
393  if( subdet_ == HcalBarrel ){
394  if( !cntprtCorrMethod_ ){
396  if( puCorrMethod_ == 2 ) LogTrace("HcalPUcorrMethod") << "Using Hcal OOTPU method 2" << std::endl;
397  else if( puCorrMethod_ == 1 ){
398  if( isMethod1Set ) LogTrace("HcalPUcorrMethod") << "Using Hcal OOTPU method 1" << std::endl;
399  else edm::LogWarning("HcalPUcorrMethod") <<"puCorrMethod_ set to be 1 but method 1 is NOT activated (method 0 used instead)!\n"
400  <<"Please check GlobalTag usage or method 1 seperately disabled by dataOOTCorrectionName & mcOOTCorrectionName?" << std::endl;
401  }else if (puCorrMethod_ == 3) {
402  LogTrace("HcalPUcorrMethod") << "Using Hcal Deterministic Fit Method!" << std::endl;
403  } else LogTrace("HcalPUcorrMethod") << "Using Hcal OOTPU method 0" << std::endl;
404  }
405  }
406 
407  // GET THE BEAM CROSSING INFO HERE, WHEN WE UNDERSTAND HOW THINGS WORK.
408  // Then, call "setBXInfo" method of the reco_ object.
409  // Also remember to call SetBXInfo in the negative energy flag setter.
410 
411  if (det_==DetId::Hcal) {
412 
413  // HBHE -------------------------------------------------------------------
416 
417  e.getByToken(tok_hbhe_,digi);
418 
419  // create empty output
420  std::auto_ptr<HBHERecHitCollection> rec(new HBHERecHitCollection);
421  rec->reserve(digi->size());
422  // run the algorithm
425  std::vector<HBHEDataFrame> HBDigis;
426  std::vector<int> RecHitIndex;
427 
428  // Vote on majority TS0 CapId
429  int favorite_capid = 0;
430  if (correctTiming_) {
431  long capid_votes[4] = {0,0,0,0};
432  for (i=digi->begin(); i!=digi->end(); i++) {
433  capid_votes[(*i)[0].capid()]++;
434  }
435  for (int k = 0; k < 4; k++)
436  if (capid_votes[k] > capid_votes[favorite_capid])
437  favorite_capid = k;
438  }
439 
440  for (i=digi->begin(); i!=digi->end(); i++) {
441  HcalDetId cell = i->id();
442  DetId detcell=(DetId)cell;
443 
445  const HcalRecoParam* param_ts = paramTS->getValues(detcell.rawId());
446  if(tsFromDB_) {
447  firstSample_ = param_ts->firstSample();
448  samplesToAdd_ = param_ts->samplesToAdd();
449  }
450  if(recoParamsFromDB_) {
451  bool correctForTimeslew=param_ts->correctForTimeslew();
453  float phaseNS=param_ts->correctionPhaseNS();
455  correctTiming_ = param_ts->correctTiming();
456  firstAuxTS_ = param_ts->firstAuxTS();
457  int pileupCleaningID = param_ts->pileupCleaningID();
458 
459  /*
460  int sub = cell.subdet();
461  int depth = cell.depth();
462  int inteta = cell.ieta();
463  int intphi = cell.iphi();
464 
465  std::cout << "HcalHitReconstructor::produce cell:"
466  << " sub, ieta, iphi, depth = "
467  << sub << " " << inteta << " " << intphi
468  << " " << depth << std::endl
469  << " first, toadd = " << firstSample_ << ", "
470  << samplesToAdd_ << std::endl
471  << " correctForTimeslew " << correctForTimeslew
472  << std::endl
473  << " correctForPhaseContainment "
474  << correctForPhaseContainment << std::endl
475  << " phaseNS " << phaseNS << std::endl
476  << " useLeakCorrection " << useLeakCorrection_
477  << std::endl
478  << " correctTiming " << correctTiming_ << std::endl
479  << " firstAuxTS " << firstAuxTS_ << std::endl
480  << " pileupCleaningID " << pileupCleaningID
481  << std::endl;
482  */
483 
484  reco_.setRecoParams(correctForTimeslew,correctForPhaseContainment,useLeakCorrection_,pileupCleaningID,phaseNS);
485  }
486  }
487 
488  int first = firstSample_;
489  int toadd = samplesToAdd_;
490 
491  // check on cells to be ignored and dropped: (rof,20.Feb.09)
492  const HcalChannelStatus* mydigistatus=myqual->getValues(detcell.rawId());
493  if (mySeverity->dropChannel(mydigistatus->getValue() ) ) continue;
495  if (i->zsMarkAndPass()) continue;
496 
497  const HcalCalibrations& calibrations=conditions->getHcalCalibrations(cell);
498  const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
499  const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
500  HcalCoderDb coder (*channelCoder, *shape);
501 
502  rec->push_back(reco_.reconstruct(*i,first,toadd,coder,calibrations));
503 
504  // Fill first auxiliary word
505  unsigned int auxflag=0;
506  int fTS = firstAuxTS_;
507  if (fTS<0) fTS=0; // silly protection against time slice <0
508  for (int xx=fTS; xx<fTS+4 && xx<i->size();++xx) {
509  int adcv = i->sample(xx).adc();
510  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
511  // bits 28 and 29 are reserved for capid of the first time slice saved in aux
512  }
513  auxflag+=((i->sample(fTS).capid())<<28);
514  (rec->back()).setAux(auxflag);
515 
516  // Fill second auxiliary word
517  auxflag=0;
518  int fTS2 = (firstAuxTS_-4 < 0) ? 0 : firstAuxTS_-4;
519  for (int xx = fTS2; xx < fTS2+4 && xx<i->size(); ++xx) {
520  int adcv = i->sample(xx).adc();
521  auxflag+=((adcv&0x7F)<<(7*(xx-fTS2)));
522  }
523  auxflag+=((i->sample(fTS2).capid())<<28);
524  (rec->back()).setAuxHBHE(auxflag);
525 
526  (rec->back()).setFlags(0); // this sets all flag bits to 0
527  // Set presample flag
528  if (fTS>0)
529  (rec->back()).setFlagField((i->sample(fTS-1).adc()), HcalCaloFlagLabels::PresampleADC,7);
530 
533  if (setNoiseFlags_)
534  hbheFlagSetter_->SetFlagsFromDigi(&(*topo),rec->back(),*i,coder,calibrations,first,toadd);
535  if (setPulseShapeFlags_ == true)
536  hbhePulseShapeFlagSetter_->SetPulseShapeFlags(rec->back(), *i, coder, calibrations);
537  if (setNegativeFlags_ == true)
538  hbheNegativeFlagSetter_->setPulseShapeFlags(rec->back(), *i, coder, calibrations);
541  if (correctTiming_)
542  HcalTimingCorrector::Correct(rec->back(), *i, favorite_capid);
543  if (setHSCPFlags_ && i->id().ietaAbs()<16)
544  {
545  double DigiEnergy=0;
546  for(int j=0; j!=i->size(); DigiEnergy += i->sample(j++).nominal_fC());
547  if(DigiEnergy > hbheHSCPFlagSetter_->EnergyThreshold())
548  {
549  HBDigis.push_back(*i);
550  RecHitIndex.push_back(rec->size()-1);
551  }
552 
553  } // if (set HSCPFlags_ && |ieta|<16)
554  } // loop over HBHE digis
555 
556 
558  if (setHSCPFlags_) hbheHSCPFlagSetter_->hbheSetTimeFlagsFromDigi(rec.get(), HBDigis, RecHitIndex);
559  // return result
560  e.put(rec);
561 
562  // HO ------------------------------------------------------------------
563  } else if (subdet_==HcalOuter) {
565  e.getByToken(tok_ho_,digi);
566 
567  // create empty output
568  std::auto_ptr<HORecHitCollection> rec(new HORecHitCollection);
569  rec->reserve(digi->size());
570  // run the algorithm
572 
573  // Vote on majority TS0 CapId
574  int favorite_capid = 0;
575  if (correctTiming_) {
576  long capid_votes[4] = {0,0,0,0};
577  for (i=digi->begin(); i!=digi->end(); i++) {
578  capid_votes[(*i)[0].capid()]++;
579  }
580  for (int k = 0; k < 4; k++)
581  if (capid_votes[k] > capid_votes[favorite_capid])
582  favorite_capid = k;
583  }
584 
585  for (i=digi->begin(); i!=digi->end(); i++) {
586  HcalDetId cell = i->id();
587  DetId detcell=(DetId)cell;
588  // firstSample & samplesToAdd
590  const HcalRecoParam* param_ts = paramTS->getValues(detcell.rawId());
591  if(tsFromDB_) {
592  firstSample_ = param_ts->firstSample();
593  samplesToAdd_ = param_ts->samplesToAdd();
594  }
595  if(recoParamsFromDB_) {
596  bool correctForTimeslew=param_ts->correctForTimeslew();
597  bool correctForPhaseContainment= param_ts->correctForPhaseContainment();
598  float phaseNS=param_ts->correctionPhaseNS();
600  correctTiming_ = param_ts->correctTiming();
601  firstAuxTS_ = param_ts->firstAuxTS();
602  int pileupCleaningID = param_ts->pileupCleaningID();
603  reco_.setRecoParams(correctForTimeslew,correctForPhaseContainment,useLeakCorrection_,pileupCleaningID,phaseNS);
604  }
605  }
606 
607  int first = firstSample_;
608  int toadd = samplesToAdd_;
609 
610  // check on cells to be ignored and dropped: (rof,20.Feb.09)
611  const HcalChannelStatus* mydigistatus=myqual->getValues(detcell.rawId());
612  if (mySeverity->dropChannel(mydigistatus->getValue() ) ) continue;
614  if (i->zsMarkAndPass()) continue;
615 
616  const HcalCalibrations& calibrations=conditions->getHcalCalibrations(cell);
617  const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
618  const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
619  HcalCoderDb coder (*channelCoder, *shape);
620 
621  rec->push_back(reco_.reconstruct(*i,first,toadd,coder,calibrations));
622 
623  // Set auxiliary flag
624  int auxflag=0;
625  int fTS = firstAuxTS_;
626  if (fTS<0) fTS=0; //silly protection against negative time slice values
627  for (int xx=fTS; xx<fTS+4 && xx<i->size();++xx)
628  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
629  // bits 28 and 29 are reserved for capid of the first time slice saved in aux
630  auxflag+=((i->sample(fTS).capid())<<28);
631  (rec->back()).setAux(auxflag);
632  (rec->back()).setFlags(0);
633  // Fill Presample ADC flag
634  if (fTS>0)
635  (rec->back()).setFlagField((i->sample(fTS-1).adc()), HcalCaloFlagLabels::PresampleADC,7);
636 
639  if (correctTiming_)
640  HcalTimingCorrector::Correct(rec->back(), *i, favorite_capid);
641  }
642  // return result
643  e.put(rec);
644 
645  // HF -------------------------------------------------------------------
646  } else if (subdet_==HcalForward) {
648  e.getByToken(tok_hf_,digi);
649 
650 
652  // create empty output
653  std::auto_ptr<HFRecHitCollection> rec(new HFRecHitCollection);
654  rec->reserve(digi->size());
655  // run the algorithm
657 
658  // Vote on majority TS0 CapId
659  int favorite_capid = 0;
660  if (correctTiming_) {
661  long capid_votes[4] = {0,0,0,0};
662  for (i=digi->begin(); i!=digi->end(); i++) {
663  capid_votes[(*i)[0].capid()]++;
664  }
665  for (int k = 0; k < 4; k++)
666  if (capid_votes[k] > capid_votes[favorite_capid])
667  favorite_capid = k;
668  }
669 
670  for (i=digi->begin(); i!=digi->end(); i++) {
671  HcalDetId cell = i->id();
672  DetId detcell=(DetId)cell;
673 
675  const HcalRecoParam* param_ts = paramTS->getValues(detcell.rawId());
676  if(tsFromDB_) {
677  firstSample_ = param_ts->firstSample();
678  samplesToAdd_ = param_ts->samplesToAdd();
679  }
680  if(recoParamsFromDB_) {
681  bool correctForTimeslew=param_ts->correctForTimeslew();
682  bool correctForPhaseContainment= param_ts->correctForPhaseContainment();
683  float phaseNS=param_ts->correctionPhaseNS();
685  correctTiming_ = param_ts->correctTiming();
686  firstAuxTS_ = param_ts->firstAuxTS();
687  int pileupCleaningID = param_ts->pileupCleaningID();
688  reco_.setRecoParams(correctForTimeslew,correctForPhaseContainment,useLeakCorrection_,pileupCleaningID,phaseNS);
689  }
690  }
691 
692  int first = firstSample_;
693  int toadd = samplesToAdd_;
694 
695  // check on cells to be ignored and dropped: (rof,20.Feb.09)
696  const HcalChannelStatus* mydigistatus=myqual->getValues(detcell.rawId());
697  if (mySeverity->dropChannel(mydigistatus->getValue() ) ) continue;
699  if (i->zsMarkAndPass()) continue;
700 
701  const HcalCalibrations& calibrations=conditions->getHcalCalibrations(cell);
702  const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
703  const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
704  HcalCoderDb coder (*channelCoder, *shape);
705 
706  // Set HFDigiTime flag values from digiTimeFromDB_
707  if (digiTimeFromDB_==true && hfdigibit_!=0)
708  {
709  const HcalFlagHFDigiTimeParam* hfDTparam = HFDigiTimeParams->getValues(detcell.rawId());
711  hfDTparam->HFdigiflagSamplesToAdd(),
712  hfDTparam->HFdigiflagExpectedPeak(),
713  hfDTparam->HFdigiflagMinEThreshold(),
714  hfDTparam->HFdigiflagCoefficients()
715  );
716  }
717 
718  //std::cout << "TOADDHF " << toadd << " " << first << " " << std::endl;
719  rec->push_back(reco_.reconstruct(*i,first,toadd,coder,calibrations));
720 
721  // Set auxiliary flag
722  int auxflag=0;
723  int fTS = firstAuxTS_;
724  if (fTS<0) fTS=0; // silly protection against negative time slice values
725  for (int xx=fTS; xx<fTS+4 && xx<i->size();++xx)
726  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
727  // bits 28 and 29 are reserved for capid of the first time slice saved in aux
728  auxflag+=((i->sample(fTS).capid())<<28);
729  (rec->back()).setAux(auxflag);
730 
731  // Clear flags
732  (rec->back()).setFlags(0);
733 
734  // Fill Presample ADC flag
735  if (fTS>0)
736  (rec->back()).setFlagField((i->sample(fTS-1).adc()), HcalCaloFlagLabels::PresampleADC,7);
737 
738  // This calls the code for setting the HF noise bit determined from digi shape
739  if (setNoiseFlags_)
740  hfdigibit_->hfSetFlagFromDigi(rec->back(),*i,coder,calibrations);
745  if (correctTiming_)
746  HcalTimingCorrector::Correct(rec->back(), *i, favorite_capid);
747  } // for (i=digi->begin(); i!=digi->end(); i++) -- loop on all HF digis
748 
749  // The following flags require the full set of rechits
750  // These need to be set consecutively, so an energy check should be the first
751  // test performed on these hits (to minimize the loop time)
752  if (setNoiseFlags_)
753  {
754  // Step 1: Set PET flag (short fibers of |ieta|==29)
755  // Neighbor/partner channels that are flagged by Pulse Shape algorithm (HFDigiTime)
756  // won't be considered in these calculations
757  for (HFRecHitCollection::iterator i = rec->begin();i!=rec->end();++i)
758  {
759  int depth=i->id().depth();
760  int ieta=i->id().ieta();
761  // Short fibers and all channels at |ieta|=29 use PET settings in Algo 3
762  if (depth==2 || abs(ieta)==29 )
763  hfPET_->HFSetFlagFromPET(*i,*rec,myqual,mySeverity);
764  }
765 
766  // Step 2: Set S8S1 flag (short fibers or |ieta|==29)
767  for (HFRecHitCollection::iterator i = rec->begin();i!=rec->end();++i)
768  {
769  int depth=i->id().depth();
770  int ieta=i->id().ieta();
771  // Short fibers and all channels at |ieta|=29 use PET settings in Algo 3
772  if (depth==2 || abs(ieta)==29 )
773  hfS8S1_->HFSetFlagFromS9S1(*i,*rec,myqual,mySeverity);
774  }
775 
776  // Set 3: Set S9S1 flag (long fibers)
777  for (HFRecHitCollection::iterator i = rec->begin();i!=rec->end();++i)
778  {
779  int depth=i->id().depth();
780  int ieta=i->id().ieta();
781  // Short fibers and all channels at |ieta|=29 use PET settings in Algo 3
782  if (depth==1 && abs(ieta)!=29 )
783  hfS9S1_->HFSetFlagFromS9S1(*i,*rec,myqual, mySeverity);
784  }
785  }
786 
787  // return result
788  e.put(rec);
789  } else if (subdet_==HcalOther && subdetOther_==HcalCalibration) {
791  e.getByToken(tok_calib_,digi);
792 
793  // create empty output
794  std::auto_ptr<HcalCalibRecHitCollection> rec(new HcalCalibRecHitCollection);
795  rec->reserve(digi->size());
796  // run the algorithm
797  int first = firstSample_;
798  int toadd = samplesToAdd_;
799 
801  for (i=digi->begin(); i!=digi->end(); i++) {
802  HcalCalibDetId cell = i->id();
803  // HcalDetId cellh = i->id();
804  DetId detcell=(DetId)cell;
805  // check on cells to be ignored and dropped: (rof,20.Feb.09)
806  const HcalChannelStatus* mydigistatus=myqual->getValues(detcell.rawId());
807  if (mySeverity->dropChannel(mydigistatus->getValue() ) ) continue;
809  if (i->zsMarkAndPass()) continue;
810 
811  const HcalCalibrations& calibrations=conditions->getHcalCalibrations(cell);
812  const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
813  const HcalQIEShape* shape = conditions->getHcalShape (channelCoder);
814  HcalCoderDb coder (*channelCoder, *shape);
815 
816  // firstSample & samplesToAdd
817  if(tsFromDB_) {
818  const HcalRecoParam* param_ts = paramTS->getValues(detcell.rawId());
819  first = param_ts->firstSample();
820  toadd = param_ts->samplesToAdd();
821  }
822  rec->push_back(reco_.reconstruct(*i,first,toadd,coder,calibrations));
823 
824  /*
825  // Flag setting not available for calibration rechits
826  // Set auxiliary flag
827  int auxflag=0;
828  int fTS = firstAuxTS_;
829  for (int xx=fTS; xx<fTS+4 && xx<i->size();++xx)
830  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
831  // bits 28 and 29 are reserved for capid of the first time slice saved in aux
832  auxflag+=((i->sample(fTS).capid())<<28);
833  (rec->back()).setAux(auxflag);
834 
835  (rec->back()).setFlags(0); // Not yet implemented for HcalCalibRecHit
836  */
837  }
838  // return result
839  e.put(rec);
840  }
841  }
842  //DL delete myqual;
843 } // void HcalHitReconstructor::produce(...)
unsigned int firstSample() const
Definition: HcalRecoParam.h:32
int i
Definition: DBlmapReader.cc:9
void HFSetFlagFromS9S1(HFRecHit &hf, HFRecHitCollection &rec, const HcalChannelQuality *myqual, const HcalSeverityLevelComputer *mySeverity)
HBHERecHit reconstruct(const HBHEDataFrame &digi, int first, int toadd, const HcalCoder &coder, const HcalCalibrations &calibs) const
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
void setHFTimingTrustFlag(HFRecHit &rechit, const HFDataFrame &digi)
unsigned int pileupCleaningID() const
Definition: HcalRecoParam.h:44
HcalADCSaturationFlag * saturationFlagSetter_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
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
SetCorrectionFcnForNegative setPileupCorrectionForNegative_
void resetParamsFromDB(int firstSample, int samplesToAdd, int expectedPeak, double minthreshold, const std::vector< double > &coef)
bool isRealData() const
Definition: EventBase.h:64
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_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
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:85
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HcalHFStatusBitFromDigis * hfdigibit_
int j
Definition: DBlmapReader.cc:9
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
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)
T const * product() const
Definition: ESHandle.h:86
HBHEStatusBitSetter * hbheFlagSetter_
HBHETimeProfileStatusBitSetter * hbheHSCPFlagSetter_
HBHETimingShapedFlagSetter * hbheTimingShapedFlagSetter_
void setPulseShapeFlags(HBHERecHit &hbhe, const HBHEDataFrame &digi, const HcalCoder &coder, const HcalCalibrations &calib)
HcalHF_S9S1algorithm * hfS8S1_
void SetFlagsFromRecHits(const HcalTopology *topo, HBHERecHitCollection &rec)
HcalOtherSubdetector subdetOther_
static void Correct(HBHERecHit &rechit, const HBHEDataFrame &digi, int favorite_capid)
void SetPulseShapeFlags(HBHERecHit &hbhe, const HBHEDataFrame &digi, const HcalCoder &coder, const HcalCalibrations &calib)
unsigned int firstAuxTS() const
Definition: HcalRecoParam.h:41
HFTimingTrustFlag * HFTimingTrustFlagSetter_
uint32_t getValue() const
void SetFlagsFromDigi(const HcalTopology *topo, HBHERecHit &hbhe, const HBHEDataFrame &digi, const HcalCoder &coder, const HcalCalibrations &calib, int firstSample=3, int samplesToAdd=4)
std::string mcOOTCorrectionCategory_
edm::EDGetTokenT< HFDigiCollection > tok_hf_
HcalSimpleRecAlgo reco_
double HFdigiflagMinEThreshold() const
bool useLeakCorrection() const
Definition: HcalRecoParam.h:36

Member Data Documentation

std::string HcalHitReconstructor::cat_
private

Definition at line 117 of file HcalHitReconstructor.h.

Referenced by produce().

int HcalHitReconstructor::cntprtCorrMethod_
private

Definition at line 115 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 117 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 116 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

Definition at line 62 of file HcalHitReconstructor.h.

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

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(), and produce().

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(), and produce().

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 112 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(), and produce().

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(), and produce().

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 111 of file HcalHitReconstructor.h.

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

int HcalHitReconstructor::puCorrMethod_
private

Definition at line 114 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(), and produce().

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().

SetCorrectionFcnForNegative HcalHitReconstructor::setPileupCorrectionForNegative_
private

Definition at line 109 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().