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

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_
 
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.

Constructor & Destructor Documentation

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

Definition at line 25 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(), HcalSimpleRecAlgo::setHFPileupCorrection(), HcalSimpleRecAlgo::setHOPileupCorrection(), setHSCPFlags_, 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_.

25  :
26  reco_(conf.getParameter<bool>("correctForTimeslew"),
27  conf.getParameter<bool>("correctForPhaseContainment"),
28  conf.getParameter<double>("correctionPhaseNS")),
30  inputLabel_(conf.getParameter<edm::InputTag>("digiLabel")),
31  correctTiming_(conf.getParameter<bool>("correctTiming")),
32  setNoiseFlags_(conf.getParameter<bool>("setNoiseFlags")),
33  setHSCPFlags_(conf.getParameter<bool>("setHSCPFlags")),
34  setSaturationFlags_(conf.getParameter<bool>("setSaturationFlags")),
35  setTimingTrustFlags_(conf.getParameter<bool>("setTimingTrustFlags")),
36  setPulseShapeFlags_(conf.getParameter<bool>("setPulseShapeFlags")),
37  setNegativeFlags_(false),
38  dropZSmarkedPassed_(conf.getParameter<bool>("dropZSmarkedPassed")),
39  firstAuxTS_(conf.getParameter<int>("firstAuxTS")),
40  firstSample_(conf.getParameter<int>("firstSample")),
41  samplesToAdd_(conf.getParameter<int>("samplesToAdd")),
42  tsFromDB_(conf.getParameter<bool>("tsFromDB")),
43  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 
100 
101  bool timingShapedCutsFlags = conf.getParameter<bool>("setTimingShapedCutsFlags");
102  if (timingShapedCutsFlags)
103  {
104  const edm::ParameterSet& psTshaped = conf.getParameter<edm::ParameterSet>("timingshapedcutsParameters");
105  hbheTimingShapedFlagSetter_ = new HBHETimingShapedFlagSetter(psTshaped.getParameter<std::vector<double> >("tfilterEnvelope"),
106  psTshaped.getParameter<bool>("ignorelowest"),
107  psTshaped.getParameter<bool>("ignorehighest"),
108  psTshaped.getParameter<double>("win_offset"),
109  psTshaped.getParameter<double>("win_gain"));
110  }
111 
112  if (setNoiseFlags_)
113  {
114  const edm::ParameterSet& psdigi =conf.getParameter<edm::ParameterSet>("flagParameters");
115  hbheFlagSetter_=new HBHEStatusBitSetter(psdigi.getParameter<double>("nominalPedestal"),
116  psdigi.getParameter<double>("hitEnergyMinimum"),
117  psdigi.getParameter<int>("hitMultiplicityThreshold"),
118  psdigi.getParameter<std::vector<edm::ParameterSet> >("pulseShapeParameterSets")
119  );
120  } // if (setNoiseFlags_)
121  if (setHSCPFlags_)
122  {
123  const edm::ParameterSet& psHSCP = conf.getParameter<edm::ParameterSet>("hscpParameters");
125  psHSCP.getParameter<double>("r1Max"),
126  psHSCP.getParameter<double>("r2Min"),
127  psHSCP.getParameter<double>("r2Max"),
128  psHSCP.getParameter<double>("fracLeaderMin"),
129  psHSCP.getParameter<double>("fracLeaderMax"),
130  psHSCP.getParameter<double>("slopeMin"),
131  psHSCP.getParameter<double>("slopeMax"),
132  psHSCP.getParameter<double>("outerMin"),
133  psHSCP.getParameter<double>("outerMax"),
134  psHSCP.getParameter<double>("TimingEnergyThreshold"));
135  } // if (setHSCPFlags_)
137  {
138  const edm::ParameterSet &psPulseShape = conf.getParameter<edm::ParameterSet>("pulseShapeParameters");
140  psPulseShape.getParameter<double>("MinimumChargeThreshold"),
141  psPulseShape.getParameter<double>("TS4TS5ChargeThreshold"),
142  psPulseShape.getParameter<unsigned int>("TrianglePeakTS"),
143  psPulseShape.getParameter<std::vector<double> >("LinearThreshold"),
144  psPulseShape.getParameter<std::vector<double> >("LinearCut"),
145  psPulseShape.getParameter<std::vector<double> >("RMS8MaxThreshold"),
146  psPulseShape.getParameter<std::vector<double> >("RMS8MaxCut"),
147  psPulseShape.getParameter<std::vector<double> >("LeftSlopeThreshold"),
148  psPulseShape.getParameter<std::vector<double> >("LeftSlopeCut"),
149  psPulseShape.getParameter<std::vector<double> >("RightSlopeThreshold"),
150  psPulseShape.getParameter<std::vector<double> >("RightSlopeCut"),
151  psPulseShape.getParameter<std::vector<double> >("RightSlopeSmallThreshold"),
152  psPulseShape.getParameter<std::vector<double> >("RightSlopeSmallCut"),
153  psPulseShape.getParameter<std::vector<double> >("TS4TS5LowerThreshold"),
154  psPulseShape.getParameter<std::vector<double> >("TS4TS5LowerCut"),
155  psPulseShape.getParameter<std::vector<double> >("TS4TS5UpperThreshold"),
156  psPulseShape.getParameter<std::vector<double> >("TS4TS5UpperCut"),
157  psPulseShape.getParameter<bool>("UseDualFit"),
158  psPulseShape.getParameter<bool>("TriangleIgnoreSlow"));
159  } // if (setPulseShapeFlags_)
160  if (setNegativeFlags_)
162 
163  produces<HBHERecHitCollection>();
164  } else if (!strcasecmp(subd.c_str(),"HO")) {
168  produces<HORecHitCollection>();
169  } else if (!strcasecmp(subd.c_str(),"HF")) {
173  digiTimeFromDB_=conf.getParameter<bool>("digiTimeFromDB");
174 
175  if (setTimingTrustFlags_) {
176 
177  const edm::ParameterSet& pstrust = conf.getParameter<edm::ParameterSet>("hfTimingTrustParameters");
178  HFTimingTrustFlagSetter_=new HFTimingTrustFlag(pstrust.getParameter<int>("hfTimingTrustLevel1"),
179  pstrust.getParameter<int>("hfTimingTrustLevel2"));
180  }
181 
182  if (setNoiseFlags_)
183  {
184  const edm::ParameterSet& psdigi =conf.getParameter<edm::ParameterSet>("digistat");
185  const edm::ParameterSet& psTimeWin =conf.getParameter<edm::ParameterSet>("HFInWindowStat");
186  hfdigibit_=new HcalHFStatusBitFromDigis(psdigi,psTimeWin);
187 
188  const edm::ParameterSet& psS9S1 = conf.getParameter<edm::ParameterSet>("S9S1stat");
189  hfS9S1_ = new HcalHF_S9S1algorithm(psS9S1.getParameter<std::vector<double> >("short_optimumSlope"),
190  psS9S1.getParameter<std::vector<double> >("shortEnergyParams"),
191  psS9S1.getParameter<std::vector<double> >("shortETParams"),
192  psS9S1.getParameter<std::vector<double> >("long_optimumSlope"),
193  psS9S1.getParameter<std::vector<double> >("longEnergyParams"),
194  psS9S1.getParameter<std::vector<double> >("longETParams"),
195  psS9S1.getParameter<int>("HcalAcceptSeverityLevel"),
196  psS9S1.getParameter<bool>("isS8S1")
197  );
198 
199  const edm::ParameterSet& psS8S1 = conf.getParameter<edm::ParameterSet>("S8S1stat");
200  hfS8S1_ = new HcalHF_S9S1algorithm(psS8S1.getParameter<std::vector<double> >("short_optimumSlope"),
201  psS8S1.getParameter<std::vector<double> >("shortEnergyParams"),
202  psS8S1.getParameter<std::vector<double> >("shortETParams"),
203  psS8S1.getParameter<std::vector<double> >("long_optimumSlope"),
204  psS8S1.getParameter<std::vector<double> >("longEnergyParams"),
205  psS8S1.getParameter<std::vector<double> >("longETParams"),
206  psS8S1.getParameter<int>("HcalAcceptSeverityLevel"),
207  psS8S1.getParameter<bool>("isS8S1")
208  );
209 
210  const edm::ParameterSet& psPET = conf.getParameter<edm::ParameterSet>("PETstat");
211  hfPET_ = new HcalHF_PETalgorithm(psPET.getParameter<std::vector<double> >("short_R"),
212  psPET.getParameter<std::vector<double> >("shortEnergyParams"),
213  psPET.getParameter<std::vector<double> >("shortETParams"),
214  psPET.getParameter<std::vector<double> >("long_R"),
215  psPET.getParameter<std::vector<double> >("longEnergyParams"),
216  psPET.getParameter<std::vector<double> >("longETParams"),
217  psPET.getParameter<int>("HcalAcceptSeverityLevel"),
218  psPET.getParameter<std::vector<double> >("short_R_29"),
219  psPET.getParameter<std::vector<double> >("long_R_29")
220  );
221  }
222  produces<HFRecHitCollection>();
223  } else if (!strcasecmp(subd.c_str(),"ZDC")) {
226  produces<ZDCRecHitCollection>();
227  } else if (!strcasecmp(subd.c_str(),"CALIB")) {
230  produces<HcalCalibRecHitCollection>();
231  } else {
232  edm::LogWarning("Configuration") << "HcalHitReconstructor is not associated with a specific subdetector!" << std::endl;
233  }
234 
235  // If no valid OOT pileup correction name specified,
236  // disable the correction
237  if (conf.existsAs<std::string>("dataOOTCorrectionName"))
238  dataOOTCorrectionName_ = conf.getParameter<std::string>("dataOOTCorrectionName");
239  if (conf.existsAs<std::string>("dataOOTCorrectionCategory"))
240  dataOOTCorrectionCategory_ = conf.getParameter<std::string>("dataOOTCorrectionCategory");
241  if (conf.existsAs<std::string>("mcOOTCorrectionName"))
242  mcOOTCorrectionName_ = conf.getParameter<std::string>("mcOOTCorrectionName");
243  if (conf.existsAs<std::string>("mcOOTCorrectionCategory"))
244  mcOOTCorrectionCategory_ = conf.getParameter<std::string>("mcOOTCorrectionCategory");
245  if (dataOOTCorrectionName_.empty() && mcOOTCorrectionName_.empty())
247 
249  if(puCorrMethod_ == 2) {
251  conf.getParameter<bool> ("applyPedConstraint"),
252  conf.getParameter<bool> ("applyTimeConstraint"),
253  conf.getParameter<bool> ("applyPulseJitter"),
254  conf.getParameter<bool> ("applyUnconstrainedFit"),
255  conf.getParameter<bool> ("applyTimeSlew"),
256  conf.getParameter<double>("ts4Min"),
257  conf.getParameter<double>("ts4Max"),
258  conf.getParameter<double>("pulseJitter"),
259  conf.getParameter<double>("meanTime"),
260  conf.getParameter<double>("timeSigma"),
261  conf.getParameter<double>("meanPed"),
262  conf.getParameter<double>("pedSigma"),
263  conf.getParameter<double>("noise"),
264  conf.getParameter<double>("timeMin"),
265  conf.getParameter<double>("timeMax"),
266  conf.getParameter<double>("ts3chi2"),
267  conf.getParameter<double>("ts4chi2"),
268  conf.getParameter<double>("ts345chi2"),
269  conf.getParameter<double>("chargeMax"), //For the unconstrained Fit
270  conf.getParameter<int> ("fitTimes")
271  );
272  }
273 }
T getParameter(std::string const &) const
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
HcalADCSaturationFlag * saturationFlagSetter_
void setHOPileupCorrection(boost::shared_ptr< AbsOOTPileupCorrection > corr)
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
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 275 of file HcalHitReconstructor.cc.

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

275  {
276  delete hbheFlagSetter_;
277  delete hbheHSCPFlagSetter_;
281  delete hfdigibit_;
282 
283  delete hfS9S1_;
284  delete hfS8S1_;
285  delete hfPET_;
286  delete saturationFlagSetter_;
288 
289  delete paramTS;
290 }
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 292 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_.

292  {
293 
295  es.get<IdealGeometryRecord>().get(htopo);
296 
297  if ( tsFromDB_== true || recoParamsFromDB_ == true )
298  {
300  es.get<HcalRecoParamsRcd>().get(p);
301  paramTS = new HcalRecoParams(*p.product());
302  paramTS->setTopo(htopo.product());
303 
304 
305 
306 
307  // std::cout<<" skdump in HcalHitReconstructor::beginRun dupm RecoParams "<<std::endl;
308  // std::ofstream skfile("skdumpRecoParamsNewFormat.txt");
309  // HcalDbASCIIIO::dumpObject(skfile, (*paramTS) );
310  }
311 
312  if (digiTimeFromDB_==true)
313  {
315  es.get<HcalFlagHFDigiTimeParamsRcd>().get(p);
316  HFDigiTimeParams.reset( new HcalFlagHFDigiTimeParams( *p ) );
317 
319  es.get<IdealGeometryRecord>().get(htopo);
320  HFDigiTimeParams->setTopo(htopo.product());
321 
322  }
323 
324  reco_.beginRun(es);
325 }
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 327 of file HcalHitReconstructor.cc.

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

327  {
328  if (tsFromDB_==true)
329  {
330  delete paramTS; paramTS=0;
331  }
332  if (digiTimeFromDB_==true)
333  {
334  //DL delete HFDigiTimeParams; HFDigiTimeParams = 0;
335  }
336  reco_.endRun();
337 }
HcalSimpleRecAlgo reco_
void HcalHitReconstructor::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 339 of file HcalHitReconstructor.cc.

References funct::abs(), cat_, HBHEStatusBitSetter::Clear(), cntprtCorrMethod_, HBHENegativeFlagSetter::configFilter(), HcalTimingCorrector::Correct(), HcalRecoParam::correctForPhaseContainment(), castor_dqm_sourceclient-live_cfg::correctForPhaseContainment, HcalRecoParam::correctForTimeslew(), castor_dqm_sourceclient-live_cfg::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_, 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_.

340 {
341 
342  // get conditions
344  eventSetup.get<IdealGeometryRecord>().get(topo);
345 
346  edm::ESHandle<HcalDbService> conditions;
347  eventSetup.get<HcalDbRecord>().get(conditions);
348 
349  // HACK related to HB- corrections
350  if ( first_ ) {
351  const bool isData = e.isRealData();
352  if (isData) reco_.setForData(e.run()); else reco_.setForData(0);
355  first_=false;
356  }
358 
360  eventSetup.get<HcalChannelQualityRcd>().get("withTopo",p);
361  const HcalChannelQuality* myqual = p.product();
362 
364  eventSetup.get<HcalSeverityLevelComputerRcd>().get(mycomputer);
365  const HcalSeverityLevelComputer* mySeverity = mycomputer.product();
366 
367  // Configure OOT pileup corrections
368  bool isMethod1Set = false;
369  if (!corrName_.empty())
370  {
371  edm::ESHandle<OOTPileupCorrectionColl> pileupCorrections;
372  if (eventSetup.find(edm::eventsetup::EventSetupRecordKey::makeKey<HcalOOTPileupCorrectionRcd>()))
373  eventSetup.get<HcalOOTPileupCorrectionRcd>().get(pileupCorrections);
374  else
375  eventSetup.get<HcalOOTPileupCompatibilityRcd>().get(pileupCorrections);
376 
377  if( setPileupCorrection_ ){
378  const OOTPileupCorrData * testMethod1Ptr = dynamic_cast<OOTPileupCorrData*>((pileupCorrections->get(corrName_, cat_)).get());
379  if( testMethod1Ptr ) isMethod1Set = true;
380  (reco_.*setPileupCorrection_)(pileupCorrections->get(corrName_, cat_));
381  }
382  }
383 
384  // Configure the negative energy filter
387  {
388  eventSetup.get<HBHENegativeEFilterRcd>().get(negEhandle);
390  }
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 separately 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);
536  hbhePulseShapeFlagSetter_->SetPulseShapeFlags(rec->back(), *i, coder, calibrations);
537  if (setNegativeFlags_)
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 configFilter(const HBHENegativeEFilter *f)
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
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 115 of file HcalHitReconstructor.h.

Referenced by produce().

int HcalHitReconstructor::cntprtCorrMethod_
private

Definition at line 113 of file HcalHitReconstructor.h.

Referenced by produce().

bool HcalHitReconstructor::correctTiming_
private

Definition at line 80 of file HcalHitReconstructor.h.

Referenced by produce().

std::string HcalHitReconstructor::corrName_
private

Definition at line 115 of file HcalHitReconstructor.h.

Referenced by produce().

std::string HcalHitReconstructor::dataOOTCorrectionCategory_
private

Definition at line 104 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

std::string HcalHitReconstructor::dataOOTCorrectionName_
private

Definition at line 103 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

DetId::Detector HcalHitReconstructor::det_
private

Definition at line 71 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

bool HcalHitReconstructor::digiTimeFromDB_
private

Definition at line 96 of file HcalHitReconstructor.h.

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

bool HcalHitReconstructor::dropZSmarkedPassed_
private

Definition at line 87 of file HcalHitReconstructor.h.

Referenced by produce().

bool HcalHitReconstructor::first_
private

Definition at line 114 of file HcalHitReconstructor.h.

Referenced by produce().

int HcalHitReconstructor::firstAuxTS_
private

Definition at line 89 of file HcalHitReconstructor.h.

Referenced by produce().

int HcalHitReconstructor::firstSample_
private

Definition at line 92 of file HcalHitReconstructor.h.

Referenced by produce().

HBHEStatusBitSetter* HcalHitReconstructor::hbheFlagSetter_
private

Definition at line 61 of file HcalHitReconstructor.h.

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

HBHETimeProfileStatusBitSetter* HcalHitReconstructor::hbheHSCPFlagSetter_
private

Definition at line 62 of file HcalHitReconstructor.h.

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

HBHENegativeFlagSetter* HcalHitReconstructor::hbheNegativeFlagSetter_
private

Definition at line 65 of file HcalHitReconstructor.h.

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

HBHEPulseShapeFlagSetter* HcalHitReconstructor::hbhePulseShapeFlagSetter_
private

Definition at line 64 of file HcalHitReconstructor.h.

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

HBHETimingShapedFlagSetter* HcalHitReconstructor::hbheTimingShapedFlagSetter_
private

Definition at line 63 of file HcalHitReconstructor.h.

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

HcalHFStatusBitFromDigis* HcalHitReconstructor::hfdigibit_
private

Definition at line 66 of file HcalHitReconstructor.h.

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

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

Definition at line 110 of file HcalHitReconstructor.h.

Referenced by beginRun(), and produce().

HcalHF_PETalgorithm* HcalHitReconstructor::hfPET_
private

Definition at line 69 of file HcalHitReconstructor.h.

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

HcalHF_S9S1algorithm* HcalHitReconstructor::hfS8S1_
private

Definition at line 68 of file HcalHitReconstructor.h.

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

HcalHF_S9S1algorithm* HcalHitReconstructor::hfS9S1_
private

Definition at line 67 of file HcalHitReconstructor.h.

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

HFTimingTrustFlag* HcalHitReconstructor::HFTimingTrustFlagSetter_
private

Definition at line 60 of file HcalHitReconstructor.h.

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

edm::InputTag HcalHitReconstructor::inputLabel_
private

Definition at line 74 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor().

std::string HcalHitReconstructor::mcOOTCorrectionCategory_
private

Definition at line 106 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

std::string HcalHitReconstructor::mcOOTCorrectionName_
private

Definition at line 105 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

HcalRecoParams* HcalHitReconstructor::paramTS
private

Definition at line 109 of file HcalHitReconstructor.h.

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

int HcalHitReconstructor::puCorrMethod_
private

Definition at line 112 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

HcalSimpleRecAlgo HcalHitReconstructor::reco_
private

Definition at line 58 of file HcalHitReconstructor.h.

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

bool HcalHitReconstructor::recoParamsFromDB_
private

Definition at line 95 of file HcalHitReconstructor.h.

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

int HcalHitReconstructor::samplesToAdd_
private

Definition at line 93 of file HcalHitReconstructor.h.

Referenced by produce().

HcalADCSaturationFlag* HcalHitReconstructor::saturationFlagSetter_
private

Definition at line 59 of file HcalHitReconstructor.h.

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

bool HcalHitReconstructor::setHSCPFlags_
private

Definition at line 82 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

bool HcalHitReconstructor::setNegativeFlags_
private

Definition at line 86 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

bool HcalHitReconstructor::setNoiseFlags_
private

Definition at line 81 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

SetCorrectionFcn HcalHitReconstructor::setPileupCorrection_
private

Definition at line 107 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

bool HcalHitReconstructor::setPulseShapeFlags_
private

Definition at line 85 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

bool HcalHitReconstructor::setSaturationFlags_
private

Definition at line 83 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

bool HcalHitReconstructor::setTimingTrustFlags_
private

Definition at line 84 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

int HcalHitReconstructor::subdet_
private

Definition at line 72 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

HcalOtherSubdetector HcalHitReconstructor::subdetOther_
private

Definition at line 73 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

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

Definition at line 78 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

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

Definition at line 75 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

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

Definition at line 77 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

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

Definition at line 76 of file HcalHitReconstructor.h.

Referenced by HcalHitReconstructor(), and produce().

bool HcalHitReconstructor::tsFromDB_
private

Definition at line 94 of file HcalHitReconstructor.h.

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

bool HcalHitReconstructor::useLeakCorrection_
private

Definition at line 100 of file HcalHitReconstructor.h.

Referenced by produce().