105 virtual void endJob()
override;
177 int dPhiToMETfunc(
const std::vector<reco::Jet> &jetTVec,
const double &dPhiCutVal, std::vector<reco::Jet> &closeToMETjetsVec);
201 if(
isdata )
std::cout<<
"\nInput dataset is DATA"<<std::endl<<std::endl;
202 else std::cout<<
"\nInput dataset is MC"<<std::endl<<std::endl;
223 : jetToken_ (consumes<edm::
View<
reco::
Jet> >(iConfig.getParameter<edm::
InputTag>(
"jetInputTag")))
224 , jetSelCuts_ (iConfig.getParameter<std::vector<double> >(
"jetSelCuts"))
226 , metToken_ (consumes<edm::
View<
reco::
MET> >(iConfig.getParameter<edm::
InputTag>(
"metInputTag")))
228 , debug_ (iConfig.getUntrackedParameter<bool>(
"debug",
false))
229 , printSkimInfo_ (iConfig.getUntrackedParameter<bool>(
"printSkimInfo",
false))
231 , maskedEcalChannelStatusThreshold_ (iConfig.getParameter<int>(
"maskedEcalChannelStatusThreshold"))
232 , chnStatusToBeEvaluated_ (iConfig.getParameter<int>(
"chnStatusToBeEvaluated"))
234 , makeProfileRoot_ (iConfig.getUntrackedParameter<bool>(
"makeProfileRoot",
true))
235 , profileRootName_ (iConfig.getUntrackedParameter<std::
string>(
"profileRootName",
"EcalDeadCellDeltaRFilter.root"))
237 , isProd_ (iConfig.getUntrackedParameter<bool>(
"isProd"))
238 , verbose_ (iConfig.getParameter<int>(
"verbose"))
240 , doCracks_ (iConfig.getUntrackedParameter<bool>(
"doCracks"))
241 , cracksHBHEdef_ (iConfig.getParameter<std::vector<double> > (
"cracksHBHEdef"))
242 , cracksHEHFdef_ (iConfig.getParameter<std::vector<double> > (
"cracksHEHFdef"))
244 , EcalDeadCellDeltaRFilterInput_ (iConfig.getParameter<std::vector<double> >(
"EcalDeadCellDeltaRFilterInput"))
246 , taggingMode_ (iConfig.getParameter<bool>(
"taggingMode"))
248 produces<int> (
"deadCellStatus"); produces<int> (
"boundaryStatus");
253 h1_dummy =
new TH1F(
"dummy",
"dummy", 500, 0, 500);
279 if( !
ecalStatus.isValid() )
throw "Failed to get ECAL channel status!";
298 std::vector<reco::Jet> seledJets;
306 if( seledJets.empty() )
return pass;
310 std::vector<reco::Jet> closeToMETjetsVec;
312 int dPhiToMETstatus =
dPhiToMETfunc(seledJets, dPhiToMET, closeToMETjetsVec);
320 printf(
"\nrun : %8u event : %12llu ls : %8u dPhiToMETstatus : %d deadCellStatus : %d boundaryStatus : %d\n",
run,
event,
ls, dPhiToMETstatus, deadCellStatus, boundaryStatus);
321 printf(
"met : %6.2f metphi : % 6.3f dPhiToMET : %5.3f dRtoDeadCell : %5.3f\n", (*
met)[0].
pt(), (*
met)[0].
phi(), dPhiToMET, dRtoDeadCell);
328 std::auto_ptr<int> deadCellStatusPtr (
new int(deadCellStatus) );
329 std::auto_ptr<int> boundaryStatusPtr (
new int(boundaryStatus) );
331 iEvent.
put( deadCellStatusPtr,
"deadCellStatus");
332 iEvent.
put( boundaryStatusPtr,
"boundaryStatus");
334 if( deadCellStatus || (
doCracks_ && boundaryStatus) ) pass =
false;
336 iEvent.
put( std::auto_ptr<bool>(
new bool(pass)) );
374 for(
unsigned int ij=0; ij<jetTVec.size(); ij++){
376 double recoJetEta = jetTVec[ij].eta();
381 if( isClose/
pow(10, cntOrder10) >=3 ) cntOrder10 = isClose/10 + 1;
392 closeToMETjetsVec.clear();
396 for(
unsigned int ii=0;
ii<jetTVec.size();
ii++){
401 if( deltaPhi > dPhiCutVal )
continue;
403 closeToMETjetsVec.push_back(jetTVec[
ii]);
405 if( deltaPhi < minDphi ){
415 return (
int)closeToMETjetsVec.size();
423 for(
unsigned int ii=0;
ii<jetTVec.size();
ii++){
427 std::map<double, DetId> dummy;
430 if( isPerJetClose ){ isClose ++; }
442 deltaRdetIdMap.clear();
444 double min_dist = 999;
447 std::map<DetId, std::vector<int> >::iterator bitItor;
450 DetId maskedDetId = bitItor->first;
452 int status = bitItor->second.back();
454 if( chnStatus >0 && status != chnStatus )
continue;
455 if( chnStatus <0 && status <
abs(chnStatus) )
continue;
460 double eta = (valItor->second)[0],
phi = (valItor->second)[1];
464 if( min_dist > dist ){ min_dist = dist; min_detId = maskedDetId; }
467 if( min_dist > deltaRCut && deltaRCut >0 )
return 0;
469 deltaRdetIdMap.insert( std::make_pair(min_dist, min_detId) );
480 for(
int ieta=-85; ieta<=85; ieta++ ){
481 for(
int iphi=0; iphi<=360; iphi++ ){
487 int status = ( chit !=
ecalStatus->end() ) ? chit->getStatusCode() & 0x1F : -1;
496 std::vector<double> valVec; std::vector<int> bitVec;
497 valVec.push_back(eta); valVec.push_back(phi); valVec.push_back(theta);
498 bitVec.push_back(1); bitVec.push_back(ieta); bitVec.push_back(iphi); bitVec.push_back(status);
506 for(
int ix=0; ix<=100; ix++ ){
507 for(
int iy=0; iy<=100; iy++ ){
508 for(
int iz=-1; iz<=1; iz++ ){
514 int status = ( chit !=
ecalStatus->end() ) ? chit->getStatusCode() & 0x1F : -1;
523 std::vector<double> valVec; std::vector<int> bitVec;
524 valVec.push_back(eta); valVec.push_back(phi); valVec.push_back(theta);
525 bitVec.push_back(2); bitVec.push_back(ix); bitVec.push_back(iy); bitVec.push_back(iz); bitVec.push_back(status);
534 std::map<DetId, std::vector<int> >::iterator bitItor;
536 const DetId id = bitItor->first;
EventNumber_t event() const
EcalDeadCellDeltaRFilter(const edm::ParameterSet &)
void setEventSetup(const edm::EventSetup &evtSetup)
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
const std::vector< double > cracksHBHEdef_
virtual void endJob() override
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
unsigned long long EventNumber_t
edm::LuminosityBlockNumber_t luminosityBlock() const
const int chnStatusToBeEvaluated_
int dPhiToMETfunc(const std::vector< reco::Jet > &jetTVec, const double &dPhiCutVal, std::vector< reco::Jet > &closeToMETjetsVec)
double deltaR(const T1 &t1, const T2 &t2)
unsigned int LuminosityBlockNumber_t
virtual void beginRun(const edm::Run &, const edm::EventSetup &) override
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.
static bool validDetId(int i, int j)
check if a valid index combination
virtual bool filter(edm::Event &, const edm::EventSetup &) override
Geom::Theta< T > theta() const
virtual void beginJob() override
int dRtoMaskedChnsEvtFilterFunc(const std::vector< reco::Jet > &jetTVec, const int &chnStatus, const double &dRCutVal)
int isCloseToBadEcalChannel(const reco::Jet &jet, const double &deltaRCut, const int &chnStatus, std::map< double, DetId > &deltaRdetIdMap)
void loadMET(const edm::Event &iEvent, const edm::EventSetup &iSetup)
const_iterator begin() const
edm::Handle< edm::View< reco::MET > > met
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
edm::LuminosityBlockNumber_t ls
void loadEventInfo(const edm::Event &iEvent, const edm::EventSetup &iSetup)
const std::vector< double > cracksHEHFdef_
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
virtual void endRun(const edm::Run &, const edm::EventSetup &) override
virtual void envSet(const edm::EventSetup &)
edm::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
edm::ESHandle< CaloGeometry > geometry
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)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
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
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
edm::ESHandle< EcalChannelStatus > ecalStatus
const_iterator end() const
const bool makeProfileRoot_
edm::Handle< edm::View< reco::Jet > > jets
volatile std::atomic< bool > shutdown_flag false
const std::vector< double > EcalDeadCellDeltaRFilterInput_
const int maskedEcalChannelStatusThreshold_
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
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)