CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
HcalLaserHBHEHFFilter2012 Class Reference

#include <UserCode/HcalLaserHBHEFilter2012/src/HcalLaserHBHEHFFilter2012.cc>

Inheritance diagram for HcalLaserHBHEHFFilter2012:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HcalLaserHBHEHFFilter2012 (const edm::ParameterSet &)
 
 ~HcalLaserHBHEHFFilter2012 ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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 ()
 

Static Public Member Functions

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

Private Member Functions

virtual void endJob () override
 
virtual bool filter (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::vector< int > CalibTS_
 
edm::InputTag digiLabel_
 
bool filterHBHE_
 
bool filterHF_
 
bool forceFilterTrue_
 
double HBHEcalibThreshold_
 
int minCalibChannelsHBHELaser_
 
int minCalibChannelsHFLaser_
 
double minFracDiffHBHELaser_
 
std::ofstream outfile_
 
std::string prefix_
 
edm::EDGetTokenT
< HcalCalibDigiCollection
tok_calib_
 
edm::EDGetTokenT
< HBHEDigiCollection
tok_hbhe_
 
bool verbose_
 
bool WriteBadToFile_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: [filters out HBHE laser events based on number of HBHE calib digis above threshold and the distribution of HBHE calib digis]

Implementation: [Notes on implementation]

Definition at line 51 of file HcalLaserHBHEHFFilter2012.cc.

Constructor & Destructor Documentation

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

Definition at line 95 of file HcalLaserHBHEHFFilter2012.cc.

References CalibTS_, digiLabel_, filterHBHE_, filterHF_, forceFilterTrue_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), HBHEcalibThreshold_, minCalibChannelsHBHELaser_, minCalibChannelsHFLaser_, minFracDiffHBHELaser_, outfile_, prefix_, AlCaHLTBitMon_QueryRunRegistry::string, tok_calib_, tok_hbhe_, verbose_, and WriteBadToFile_.

96 {
97  //now do what ever initialization is needed
98  filterHBHE_ = ps.getParameter<bool>("filterHBHE");
99  minCalibChannelsHBHELaser_ = ps.getParameter<int>("minCalibChannelsHBHELaser");
100  minFracDiffHBHELaser_ = ps.getParameter<double>("minFracDiffHBHELaser");
101  HBHEcalibThreshold_ = ps.getParameter<double>("HBHEcalibThreshold");
102  CalibTS_ = ps.getParameter<std::vector<int> >("CalibTS");
103 
104  filterHF_ = ps.getParameter<bool>("filterHF");
105  minCalibChannelsHFLaser_ = ps.getParameter<int>("minCalibChannelsHFLaser");
106 
107  digiLabel_ = ps.getParameter<edm::InputTag>("digiLabel");
108  tok_calib_ = consumes<HcalCalibDigiCollection>(digiLabel_);
109  tok_hbhe_ = consumes<HBHEDigiCollection>(digiLabel_);
110 
111  verbose_ = ps.getUntrackedParameter<bool>("verbose",false);
112  prefix_ = ps.getUntrackedParameter<std::string>("prefix","");
113  WriteBadToFile_ = ps.getUntrackedParameter<bool>("WriteBadToFile",false);
114  forceFilterTrue_ = ps.getUntrackedParameter<bool>("forceFilterTrue",false);
115  if (WriteBadToFile_)
116  outfile_.open("badHcalLaserList_hcalfilter.txt");
117 } // HcalLaserHBHEHFFilter2012::HcalLaserHBHEHFFilter2012 constructor
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< HcalCalibDigiCollection > tok_calib_
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
HcalLaserHBHEHFFilter2012::~HcalLaserHBHEHFFilter2012 ( )

Definition at line 120 of file HcalLaserHBHEHFFilter2012.cc.

121 {
122 
123  // do anything here that needs to be done at destruction time
124  // (e.g. close files, deallocate resources etc.)
125 
126 }

Member Function Documentation

void HcalLaserHBHEHFFilter2012::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 253 of file HcalLaserHBHEHFFilter2012.cc.

References outfile_, and WriteBadToFile_.

253  {
254  if (WriteBadToFile_) outfile_.close();
255 
256 }
void HcalLaserHBHEHFFilter2012::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 260 of file HcalLaserHBHEHFFilter2012.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

260  {
261  //The following says we do not know what parameters are allowed so do no validation
262  // Please change this to state exactly what you do use, even if it is no parameters
264  desc.setUnknown();
265  descriptions.addDefault(desc);
266 }
void addDefault(ParameterSetDescription const &psetDescription)
bool HcalLaserHBHEHFFilter2012::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDFilter.

Definition at line 135 of file HcalLaserHBHEHFFilter2012.cc.

References HcalCalibDetId::calibFlavor(), CalibTS_, gather_cfg::cout, digiLabel_, edm::EventID::event(), filterHBHE_, filterHF_, forceFilterTrue_, edm::Event::getByToken(), HBHEcalibThreshold_, HcalBarrel, HcalEndcap, HcalForward, HcalCalibDetId::hcalSubdet(), HcalCalibDetId::HOCrosstalk, i, HBHEDataFrame::id(), HcalCalibDataFrame::id(), edm::EventBase::id(), HcalDetId::ieta(), HcalDetId::iphi(), edm::HandleBase::isValid(), edm::EventBase::luminosityBlock(), minCalibChannelsHBHELaser_, minCalibChannelsHFLaser_, minFracDiffHBHELaser_, outfile_, prefix_, edm::EventID::run(), HcalDetId::subdet(), tok_calib_, tok_hbhe_, verbose_, WriteBadToFile_, and HcalCalibDataFrame::zsMarkAndPass().

Referenced by Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

136 {
137  // Step 1:: try to get calib digi and HBHE collections.
138  // Return true if collection not found? Or false? What should default behavior be?
140  if (!(iEvent.getByToken(tok_calib_,calib_digi)))
141  {
142  edm::LogWarning("HcalLaserFilter2012")<< digiLabel_<<" calib_digi not available";
143  return true;
144  }
145 
146  if (!(calib_digi.isValid()))
147  {
148  edm::LogWarning("HcalLaserFilter2012")<< digiLabel_<<" calib_digi is not valid";
149  return true;
150  }
151 
153  if (!(iEvent.getByToken(tok_hbhe_,hbhe_digi)))
154  {
155  edm::LogWarning("HcalLaserFilter2012")<< digiLabel_<<" hbhe_digi not available";
156  return true;
157  }
158 
159  if (!(hbhe_digi.isValid()))
160  {
161  edm::LogWarning("HcalLaserHBHEHFFilter2012")<< digiLabel_<<" hbhe_digi is not valid";
162  return true;
163  }
164 
165  // Step 2: Count HBHE digi calib channels
166  int ncalibHBHE=0; // this will track number of HBHE digi channels
167  int ncalibHF=0; // this will track number of HF digi channels
168 
169 
170  for (HcalCalibDigiCollection::const_iterator Calibiter = calib_digi->begin();
171  Calibiter != calib_digi->end(); ++ Calibiter) {
172  const HcalCalibDataFrame digi = (const HcalCalibDataFrame)(*Calibiter);
173  if (digi.zsMarkAndPass()) continue; // skip digis labeled as "mark and pass" in NZS events
174  HcalCalibDetId myid=(HcalCalibDetId)digi.id();
175  if (filterHBHE_ && (myid.hcalSubdet()==HcalBarrel || myid.hcalSubdet()==HcalEndcap))
176  {
177  if ( myid.calibFlavor()==HcalCalibDetId::HOCrosstalk) continue;
178  // Compute charge in current channel (for relevant TS only)
179  // If total charge in channel exceeds threshold, increment count of calib channels
180  double thischarge=0;
181  for (unsigned int i=0;i<CalibTS_.size();++i) {
182  thischarge+=digi[CalibTS_[i]].nominal_fC();
183  if (thischarge> HBHEcalibThreshold_ ) {
184  ++ncalibHBHE;
185  break;
186  }
187  }
188 
189  if (ncalibHBHE>=minCalibChannelsHBHELaser_) {
190  if (verbose_)
191  std::cout <<prefix_<<iEvent.id().run()<<":"<<iEvent.luminosityBlock()<<":"<<iEvent.id().event()<<std::endl;
192  if (WriteBadToFile_)
193  outfile_<<iEvent.id().run()<<":"<<iEvent.luminosityBlock()<<":"<<iEvent.id().event()<<std::endl;
194  if (forceFilterTrue_) return true; // if special input boolean set, always return true, regardless of filter decision
195  else return false;
196  } // if (ncalibHBHE>=minCalibChannelsHBHELaser_)
197 
198  }
199  else if (filterHF_ && (myid.hcalSubdet()==HcalForward))
200  {
201  ++ncalibHF;
202  if (ncalibHF>=minCalibChannelsHFLaser_) {
203  if (verbose_) std::cout <<prefix_<<iEvent.id().run()<<":"<<iEvent.luminosityBlock()<<":"<<iEvent.id().event()<<std::endl;
204  if (WriteBadToFile_)
205  outfile_<<iEvent.id().run()<<":"<<iEvent.luminosityBlock()<<":"<<iEvent.id().event()<<std::endl;
206  if (forceFilterTrue_) return true; // if special input boolean set, always return true, regardless of filter decision
207  else return false;
208  }
209  }
210  }
211 
212  if (filterHBHE_) {
213  // Step 3: Look at distribution of HBHE hits
214  // Count digis in good, bad RBXes. ('bad' RBXes see no laser signal)
215  double badrbxfrac=0.;
216  double goodrbxfrac=0.;
217  int Nbad=72*3; // 3 bad RBXes, 72 channels each
218  int Ngood=2592*2-Nbad; // remaining HBHE channels are 'good'
219  for (HBHEDigiCollection::const_iterator hbhe = hbhe_digi->begin();
220  hbhe != hbhe_digi->end(); ++ hbhe)
221  {
222  const HBHEDataFrame digi = (const HBHEDataFrame)(*hbhe);
223  HcalDetId myid=(HcalDetId)digi.id();
224  bool isbad=false; // assume channel is not bad
225  if ( myid.subdet()==HcalBarrel && myid.ieta()<0 )
226  {
227  if (myid.iphi()>=15 && myid.iphi()<=18) isbad=true;
228  else if (myid.iphi()>=27 && myid.iphi()<=34) isbad=true;
229  }
230  if (isbad==true) badrbxfrac+=1.;
231  else goodrbxfrac+=1.;
232  }
233  goodrbxfrac/=Ngood;
234  badrbxfrac/=Nbad;
235  if (goodrbxfrac-badrbxfrac>minFracDiffHBHELaser_)
236  {
237  if (verbose_)
238  std::cout <<prefix_<<iEvent.id().run()<<":"<<iEvent.luminosityBlock()<<":"<<iEvent.id().event()<<std::endl;
239  if (WriteBadToFile_)
240  outfile_<<iEvent.id().run()<<":"<<iEvent.luminosityBlock()<<":"<<iEvent.id().event()<<std::endl;
241 
242  if (forceFilterTrue_) return true; // if special input boolean set, always return true, regardless of filter decision
243  else return false;
244  }
245  }
246  // Step 4: HBHEHF laser tests passed. return true
247  return true;
248 
249 } // HcalLaserHBHEHFFilter2012::filter
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
int i
Definition: DBlmapReader.cc:9
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:45
CalibDetType calibFlavor() const
get the flavor of this calibration detid
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
std::vector< HcalCalibDataFrame >::const_iterator const_iterator
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:63
edm::EDGetTokenT< HcalCalibDigiCollection > tok_calib_
int ieta() const
get the cell ieta
Definition: HcalDetId.h:51
const HcalCalibDetId & id() const
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
bool isValid() const
Definition: HandleBase.h:75
int iphi() const
get the cell iphi
Definition: HcalDetId.h:53
edm::EventID id() const
Definition: EventBase.h:60
const HcalDetId & id() const
Definition: HBHEDataFrame.h:22
tuple cout
Definition: gather_cfg.py:121
bool zsMarkAndPass() const
was ZS MarkAndPass?
HcalSubdetector hcalSubdet() const
get the HcalSubdetector (if relevant)

Member Data Documentation

std::vector<int> HcalLaserHBHEHFFilter2012::CalibTS_
private

Definition at line 68 of file HcalLaserHBHEHFFilter2012.cc.

Referenced by filter(), and HcalLaserHBHEHFFilter2012().

edm::InputTag HcalLaserHBHEHFFilter2012::digiLabel_
private

Definition at line 73 of file HcalLaserHBHEHFFilter2012.cc.

Referenced by filter(), and HcalLaserHBHEHFFilter2012().

bool HcalLaserHBHEHFFilter2012::filterHBHE_
private

Definition at line 63 of file HcalLaserHBHEHFFilter2012.cc.

Referenced by filter(), and HcalLaserHBHEHFFilter2012().

bool HcalLaserHBHEHFFilter2012::filterHF_
private

Definition at line 70 of file HcalLaserHBHEHFFilter2012.cc.

Referenced by filter(), and HcalLaserHBHEHFFilter2012().

bool HcalLaserHBHEHFFilter2012::forceFilterTrue_
private

Definition at line 80 of file HcalLaserHBHEHFFilter2012.cc.

Referenced by filter(), and HcalLaserHBHEHFFilter2012().

double HcalLaserHBHEHFFilter2012::HBHEcalibThreshold_
private

Definition at line 67 of file HcalLaserHBHEHFFilter2012.cc.

Referenced by filter(), and HcalLaserHBHEHFFilter2012().

int HcalLaserHBHEHFFilter2012::minCalibChannelsHBHELaser_
private

Definition at line 64 of file HcalLaserHBHEHFFilter2012.cc.

Referenced by filter(), and HcalLaserHBHEHFFilter2012().

int HcalLaserHBHEHFFilter2012::minCalibChannelsHFLaser_
private

Definition at line 71 of file HcalLaserHBHEHFFilter2012.cc.

Referenced by filter(), and HcalLaserHBHEHFFilter2012().

double HcalLaserHBHEHFFilter2012::minFracDiffHBHELaser_
private

Definition at line 65 of file HcalLaserHBHEHFFilter2012.cc.

Referenced by filter(), and HcalLaserHBHEHFFilter2012().

std::ofstream HcalLaserHBHEHFFilter2012::outfile_
private

Definition at line 81 of file HcalLaserHBHEHFFilter2012.cc.

Referenced by endJob(), filter(), and HcalLaserHBHEHFFilter2012().

std::string HcalLaserHBHEHFFilter2012::prefix_
private

Definition at line 78 of file HcalLaserHBHEHFFilter2012.cc.

Referenced by filter(), and HcalLaserHBHEHFFilter2012().

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

Definition at line 74 of file HcalLaserHBHEHFFilter2012.cc.

Referenced by filter(), and HcalLaserHBHEHFFilter2012().

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

Definition at line 75 of file HcalLaserHBHEHFFilter2012.cc.

Referenced by filter(), and HcalLaserHBHEHFFilter2012().

bool HcalLaserHBHEHFFilter2012::verbose_
private

Definition at line 77 of file HcalLaserHBHEHFFilter2012.cc.

Referenced by filter(), and HcalLaserHBHEHFFilter2012().

bool HcalLaserHBHEHFFilter2012::WriteBadToFile_
private

Definition at line 79 of file HcalLaserHBHEHFFilter2012.cc.

Referenced by endJob(), filter(), and HcalLaserHBHEHFFilter2012().