172 int dPhiToMETfunc(
const std::vector<reco::Jet> &jetTVec,
const double &dPhiCutVal, std::vector<reco::Jet> &closeToMETjetsVec);
196 if(
isdata )
std::cout<<
"\nInput dataset is DATA"<<std::endl<<std::endl;
197 else std::cout<<
"\nInput dataset is MC"<<std::endl<<std::endl;
218 : jetInputTag_ (iConfig.getParameter<edm::InputTag>(
"jetInputTag"))
219 , jetSelCuts_ (iConfig.getParameter<std::vector<double> >(
"jetSelCuts"))
221 , metInputTag_ (iConfig.getParameter<edm::InputTag>(
"metInputTag"))
223 , debug_ (iConfig.getUntrackedParameter<bool>(
"debug",
false))
224 , printSkimInfo_ (iConfig.getUntrackedParameter<bool>(
"printSkimInfo",
false))
226 , maskedEcalChannelStatusThreshold_ (iConfig.getParameter<int>(
"maskedEcalChannelStatusThreshold"))
227 , chnStatusToBeEvaluated_ (iConfig.getParameter<int>(
"chnStatusToBeEvaluated"))
229 , makeProfileRoot_ (iConfig.getUntrackedParameter<bool>(
"makeProfileRoot",
true))
230 , profileRootName_ (iConfig.getUntrackedParameter<std::string>(
"profileRootName",
"EcalDeadCellDeltaRFilter.root"))
232 , isProd_ (iConfig.getUntrackedParameter<bool>(
"isProd"))
233 , verbose_ (iConfig.getParameter<int>(
"verbose"))
235 , doCracks_ (iConfig.getUntrackedParameter<bool>(
"doCracks"))
236 , cracksHBHEdef_ (iConfig.getParameter<std::vector<double> > (
"cracksHBHEdef"))
237 , cracksHEHFdef_ (iConfig.getParameter<std::vector<double> > (
"cracksHEHFdef"))
239 , EcalDeadCellDeltaRFilterInput_ (iConfig.getParameter<std::vector<double> >(
"EcalDeadCellDeltaRFilterInput"))
241 , taggingMode_ (iConfig.getParameter<bool>(
"taggingMode"))
243 produces<int> (
"deadCellStatus"); produces<int> (
"boundaryStatus");
248 h1_dummy =
new TH1F(
"dummy",
"dummy", 500, 0, 500);
274 if( !
ecalStatus.isValid() )
throw "Failed to get ECAL channel status!";
293 std::vector<reco::Jet> seledJets;
301 if( seledJets.empty() )
return pass;
305 std::vector<reco::Jet> closeToMETjetsVec;
307 int dPhiToMETstatus =
dPhiToMETfunc(seledJets, dPhiToMET, closeToMETjetsVec);
315 printf(
"\nrun : %8d event : %12d ls : %8d dPhiToMETstatus : %d deadCellStatus : %d boundaryStatus : %d\n",
run,
event,
ls, dPhiToMETstatus, deadCellStatus, boundaryStatus);
316 printf(
"met : %6.2f metphi : % 6.3f dPhiToMET : %5.3f dRtoDeadCell : %5.3f\n", (*
met)[0].pt(), (*
met)[0].
phi(), dPhiToMET, dRtoDeadCell);
323 std::auto_ptr<int> deadCellStatusPtr (
new int(deadCellStatus) );
324 std::auto_ptr<int> boundaryStatusPtr (
new int(boundaryStatus) );
326 iEvent.
put( deadCellStatusPtr,
"deadCellStatus");
327 iEvent.
put( boundaryStatusPtr,
"boundaryStatus");
329 if( deadCellStatus || (
doCracks_ && boundaryStatus) ) pass =
false;
331 iEvent.
put( std::auto_ptr<bool>(
new bool(pass)) );
369 for(
unsigned int ij=0; ij<jetTVec.size(); ij++){
371 double recoJetEta = jetTVec[ij].eta();
376 if( isClose/
pow(10, cntOrder10) >=3 ) cntOrder10 = isClose/10 + 1;
387 closeToMETjetsVec.clear();
389 double minDphi = 999.0;
391 for(
unsigned int ii=0; ii<jetTVec.size(); ii++){
396 if( deltaPhi > dPhiCutVal )
continue;
398 closeToMETjetsVec.push_back(jetTVec[ii]);
400 if( deltaPhi < minDphi ){
410 return (
int)closeToMETjetsVec.size();
418 for(
unsigned int ii=0; ii<jetTVec.size(); ii++){
422 std::map<double, DetId> dummy;
425 if( isPerJetClose ){ isClose ++; }
437 deltaRdetIdMap.clear();
439 double min_dist = 999;
442 std::map<DetId, std::vector<int> >::iterator bitItor;
445 DetId maskedDetId = bitItor->first;
447 int status = bitItor->second.back();
449 if( chnStatus >0 && status != chnStatus )
continue;
450 if( chnStatus <0 && status <
abs(chnStatus) )
continue;
455 double eta = (valItor->second)[0],
phi = (valItor->second)[1];
459 if( min_dist > dist ){ min_dist = dist; min_detId = maskedDetId; }
462 if( min_dist > deltaRCut && deltaRCut >0 )
return 0;
464 deltaRdetIdMap.insert( std::make_pair(min_dist, min_detId) );
475 for(
int ieta=-85; ieta<=85; ieta++ ){
476 for(
int iphi=0; iphi<=360; iphi++ ){
482 int status = ( chit !=
ecalStatus->end() ) ? chit->getStatusCode() & 0x1F : -1;
491 std::vector<double> valVec; std::vector<int> bitVec;
492 valVec.push_back(eta); valVec.push_back(phi); valVec.push_back(theta);
493 bitVec.push_back(1); bitVec.push_back(ieta); bitVec.push_back(iphi); bitVec.push_back(status);
501 for(
int ix=0; ix<=100; ix++ ){
502 for(
int iy=0; iy<=100; iy++ ){
503 for(
int iz=-1; iz<=1; iz++ ){
509 int status = ( chit !=
ecalStatus->end() ) ? chit->getStatusCode() & 0x1F : -1;
518 std::vector<double> valVec; std::vector<int> bitVec;
519 valVec.push_back(eta); valVec.push_back(phi); valVec.push_back(theta);
520 bitVec.push_back(2); bitVec.push_back(ix); bitVec.push_back(iy); bitVec.push_back(iz); bitVec.push_back(status);
529 std::map<DetId, std::vector<int> >::iterator bitItor;
531 const DetId id = bitItor->first;
static bool validDetId(int i, int j)
check if a valid index combination
EventNumber_t event() const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
EcalDeadCellDeltaRFilter(const edm::ParameterSet &)
void setEventSetup(const edm::EventSetup &evtSetup)
#define DEFINE_FWK_MODULE(type)
const std::vector< double > cracksHBHEdef_
Base class for all types of Jets.
~EcalDeadCellDeltaRFilter()
int getChannelStatusMaps()
Geom::Phi< T > phi() const
std::map< DetId, EcalTrigTowerDetId > EcalAllDeadChannelsTTMap
Geom::Theta< T > theta() const
edm::LuminosityBlockNumber_t luminosityBlock() const
const int chnStatusToBeEvaluated_
int dPhiToMETfunc(const std::vector< reco::Jet > &jetTVec, const double &dPhiCutVal, std::vector< reco::Jet > &closeToMETjetsVec)
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
virtual double eta() const
momentum pseudorapidity
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
double deltaR(double eta1, double phi1, double eta2, double phi2)
Geom::Theta< T > theta() const
int dRtoMaskedChnsEvtFilterFunc(const std::vector< reco::Jet > &jetTVec, const int &chnStatus, const double &dRCutVal)
virtual bool filter(edm::Event &, const edm::EventSetup &)
int isCloseToBadEcalChannel(const reco::Jet &jet, const double &deltaRCut, const int &chnStatus, std::map< double, DetId > &deltaRdetIdMap)
const edm::InputTag jetInputTag_
void loadMET(const edm::Event &iEvent, const edm::EventSetup &iSetup)
virtual bool beginRun(edm::Run &, const edm::EventSetup &)
edm::Handle< edm::View< reco::MET > > met
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
void loadEventInfo(const edm::Event &iEvent, const edm::EventSetup &iSetup)
virtual bool endRun(edm::Run &, const edm::EventSetup &)
const std::vector< double > cracksHEHFdef_
virtual void envSet(const edm::EventSetup &)
edm::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
edm::ESHandle< CaloGeometry > geometry
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
static const int ETAPHIMODE
std::map< DetId, std::vector< double > > EcalAllDeadChannelsValMap
const bool printSkimInfo_
int etaToBoundary(const std::vector< reco::Jet > &jetTVec)
double deltaPhi(double phi1, double phi2)
std::vector< Item >::const_iterator const_iterator
void loadJets(const edm::Event &iEvent, const edm::EventSetup &iSetup)
const std::vector< double > jetSelCuts_
std::map< DetId, std::vector< int > > EcalAllDeadChannelsBitMap
edm::ESHandle< EcalChannelStatus > ecalStatus
const bool makeProfileRoot_
edm::Handle< edm::View< reco::Jet > > jets
const std::vector< double > EcalDeadCellDeltaRFilterInput_
const int maskedEcalChannelStatusThreshold_
edm::ESHandle< HcalChannelQuality > hcalStatus
virtual double phi() const
momentum azimuthal angle
const std::string profileRootName_
Power< A, B >::type pow(const A &a, const B &b)
const edm::InputTag metInputTag_