121 int getChannelStatusMaps();
137 int hasReducedRecHits_ = 0;
139 bool useTPmethod_ =
false;
140 bool useHITmethod_ =
false;
156 int setEvtRecHitstatus(
const double &tpValCut,
const int &chnStatus,
const int &towerTest,
166 : taggingMode_ (iConfig.getParameter<
bool>(
"taggingMode") )
167 , debug_ (iConfig.getParameter<
bool>(
"debug") )
168 , verbose_ (iConfig.getParameter<
int>(
"verbose") )
169 , doEEfilter_ (iConfig.getUntrackedParameter<
bool>(
"doEEfilter") )
170 , ebReducedRecHitCollection_ (iConfig.getParameter<
edm::InputTag>(
"ebReducedRecHitCollection") )
171 , eeReducedRecHitCollection_ (iConfig.getParameter<
edm::InputTag>(
"eeReducedRecHitCollection") )
172 , maskedEcalChannelStatusThreshold_ (iConfig.getParameter<
int>(
"maskedEcalChannelStatusThreshold") )
173 , etValToBeFlagged_ (iConfig.getParameter<double>(
"etValToBeFlagged") )
174 , tpDigiCollection_ (iConfig.getParameter<
edm::InputTag>(
"tpDigiCollection") )
176 , useTTsum_ (iConfig.getParameter<
bool>(
"useTTsum") )
177 , usekTPSaturated_ (iConfig.getParameter<
bool>(
"usekTPSaturated") )
178 , putToken_ ( produces<
bool>() )
211 edm::LogInfo(
"EcalDeadCellTriggerPrimitiveFilter")<<
"\nWARNING ... Cannot find either tpDigiCollection_ or reducedRecHitCollecion_ ?!";
212 edm::LogInfo(
"EcalDeadCellTriggerPrimitiveFilter")<<
" Will NOT DO ANY FILTERING !";
250 if( !
ecalStatus.isValid() )
throw "Failed to get ECAL channel status!";
251 if( !
geometry.isValid() )
throw "Failed to get the geometry!";
279 loadEcalRecHits(iEvent, barrelReducedRecHitsHandle, endcapReducedRecHitsHandle);
283 if( evtTagged ){ pass =
false; }
286 int evtstatusABS =
abs(evtTagged);
287 printf(
"\nrun : %8u event : %10llu lumi : %4u evtTPstatus ABS : %d 13 : % 2d\n", run,
event, ls, evtstatusABS, evtTagged);
325 for (ebrechit = HitecalEB.
begin(); ebrechit != HitecalEB.
end(); ebrechit++) {
332 double theta = valItor->second.back();
340 int status = bitItor->second.back();
343 if( chnStatus >0 && status == chnStatus ) toDo =
true;
344 if( chnStatus <0 && status >=
abs(chnStatus) ) toDo =
true;
347 if( !ebrechit->isRecovered() ) toDo =
false;
358 int ttzside = ttDetId.
zside();
362 for(std::vector<DetId>::const_iterator dit = vid.begin(); dit != vid.end(); ++dit ) {
365 if( towerTest >0 && bit2Itor->second.back() == towerTest )
continue;
366 if( towerTest <0 && bit2Itor->
second.back() >=
abs(towerTest) )
continue;
369 if( towerTestCnt !=0 &&
debug_ &&
verbose_ >=2)
edm::LogInfo(
"EcalDeadCellTriggerPrimitiveFilter")<<
"towerTestCnt : "<<towerTestCnt<<
" for towerTest : "<<towerTest;
378 std::map<EcalTrigTowerDetId, double>::iterator ttetItor =
accuTTetMap.find(ttDetId);
391 for (eerechit = HitecalEE.
begin(); eerechit != HitecalEE.
end(); eerechit++) {
398 double theta = valItor->second.back();
406 int status = bitItor->second.back();
409 if( chnStatus >0 && status == chnStatus ) toDo =
true;
410 if( chnStatus <0 && status >=
abs(chnStatus) ) toDo =
true;
413 if( !eerechit->isRecovered() ) toDo =
false;
427 for(std::vector<DetId>::const_iterator dit = vid.begin(); dit != vid.end(); ++dit ) {
430 if( towerTest >0 && bit2Itor->second.back() == towerTest )
continue;
431 if( towerTest <0 && bit2Itor->
second.back() >=
abs(towerTest) )
continue;
434 if( towerTestCnt !=0 &&
debug_ &&
verbose_ >=2)
edm::LogInfo(
"EcalDeadCellTriggerPrimitiveFilter")<<
"towerTestCnt : "<<towerTestCnt<<
" for towerTest : "<<towerTest;
446 std::map<EcalScDetId, double>::iterator scetItor =
accuSCetMap.find(
sc);
462 std::map<EcalTrigTowerDetId, double>::iterator ttetItor;
467 double ttetVal = ttetItor->second;
469 std::map<EcalTrigTowerDetId, int>::iterator ttchnItor =
accuTTchnMap.find(ttDetId);
470 if( ttchnItor ==
accuTTchnMap.end() ){
edm::LogError(
"EcalDeadCellTriggerPrimitiveFilter")<<
"\nERROR cannot find ttDetId : "<<ttDetId<<
" in accuTTchnMap?!"; }
472 std::map<EcalTrigTowerDetId, int>::iterator ttzsideItor =
TTzsideMap.find(ttDetId);
473 if( ttzsideItor ==
TTzsideMap.end() ){
edm::LogError(
"EcalDeadCellTriggerPrimitiveFilter")<<
"\nERROR cannot find ttDetId : "<<ttDetId<<
" in TTzsideMap?!"; }
475 if( ttchnItor->second != 25 &&
debug_ &&
verbose_ >=2)
edm::LogInfo(
"EcalDeadCellTriggerPrimitiveFilter")<<
"WARNING ... ttchnCnt : "<<ttchnItor->second<<
" NOT equal 25!";
477 if( ttetVal >= tpValCut ){ isPassCut = 1; isPassCut *= ttzsideItor->second; }
482 std::map<EcalScDetId, double>::iterator scetItor;
487 double scetVal = scetItor->second;
489 std::map<EcalScDetId, int>::iterator scchnItor =
accuSCchnMap.find(scDetId);
490 if( scchnItor ==
accuSCchnMap.end() ){
edm::LogError(
"EcalDeadCellTriggerPrimitiveFilter")<<
"\nERROR cannot find scDetId : "<<scDetId<<
" in accuSCchnMap?!"; }
492 std::map<EcalScDetId, int>::iterator sczsideItor =
SCzsideMap.find(scDetId);
493 if( sczsideItor ==
SCzsideMap.end() ){
edm::LogError(
"EcalDeadCellTriggerPrimitiveFilter")<<
"\nERROR cannot find scDetId : "<<scDetId<<
" in SCzsideMap?!"; }
495 if( scchnItor->second != 25 &&
debug_ &&
verbose_ >=2)
edm::LogInfo(
"EcalDeadCellTriggerPrimitiveFilter")<<
"WARNING ... scchnCnt : "<<scchnItor->second<<
" NOT equal 25!";
497 if( scetVal >= tpValCut ){ isPassCut = 1; isPassCut *= sczsideItor->second; }
514 std::map<DetId, std::vector<int> >::iterator bitItor;
517 DetId maskedDetId = bitItor->first;
518 int subdet = bitItor->second.front(),
status = bitItor->second.back();
527 if( chnStatus >0 &&
status == chnStatus ) toDo =
true;
528 if( chnStatus <0 && status >=
abs(chnStatus) ) toDo =
true;
533 int ttzside = ttDetId.
zside();
536 if( tp != tpDigis.
end() ){
537 double tpEt = ecalScale.
getTPGInGeV( tp->compressedEt(), tp->id() );
538 if(tpEt >= tpValCut ){ isPassCut = 1; isPassCut *= ttzside; }
554 for(
int ieta=-85; ieta<=85; ieta++ ){
555 for(
int iphi=0; iphi<=360; iphi++ ){
561 int status = ( chit !=
ecalStatus->end() ) ? chit->getStatusCode() & 0x1F : -1;
565 double eta = cellGeom->getPosition ().eta ();
566 double phi = cellGeom->getPosition ().phi ();
567 double theta = cellGeom->getPosition().theta();
570 std::vector<double> valVec; std::vector<int> bitVec;
571 valVec.push_back(eta); valVec.push_back(phi); valVec.push_back(theta);
572 bitVec.push_back(1); bitVec.push_back(ieta); bitVec.push_back(iphi); bitVec.push_back(status);
581 for(
int ix=0; ix<=100; ix++ ){
582 for(
int iy=0; iy<=100; iy++ ){
583 for(
int iz=-1; iz<=1; iz++ ){
589 int status = ( chit !=
ecalStatus->end() ) ? chit->getStatusCode() & 0x1F : -1;
593 double eta = cellGeom->getPosition ().eta () ;
594 double phi = cellGeom->getPosition ().phi () ;
595 double theta = cellGeom->getPosition().theta();
598 std::vector<double> valVec; std::vector<int> bitVec;
599 valVec.push_back(eta); valVec.push_back(phi); valVec.push_back(theta);
600 bitVec.push_back(2); bitVec.push_back(ix); bitVec.push_back(iy); bitVec.push_back(iz); bitVec.push_back(status);
610 std::map<DetId, std::vector<int> >::iterator bitItor;
612 const DetId id = bitItor->first;
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
EventNumber_t event() const
edm::EDGetTokenT< EcalRecHitCollection > ebReducedRecHitCollectionToken_
std::map< DetId, std::vector< int > > EcalAllDeadChannelsBitMap
std::map< EcalScDetId, int > accuSCchnMap
edm::ESHandle< CaloGeometry > geometry
void setEventSetup(const edm::EventSetup &evtSetup)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const bool usekTPSaturated_
Sin< T >::type sin(const T &t)
std::vector< EcalRecHit >::const_iterator const_iterator
Geom::Theta< T > theta() const
unsigned long long EventNumber_t
edm::LuminosityBlockNumber_t luminosityBlock() const
EcalDeadCellTriggerPrimitiveFilter
std::vector< DetId > avoidDuplicateVec
double getTPGInGeV(const EcalTriggerPrimitiveDigi &tpDigi)
const int maskedEcalChannelStatusThreshold_
int getChannelStatusMaps()
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::map< EcalTrigTowerDetId, int > accuTTchnMap
void loadEcalDigis(edm::Event &iEvent, edm::Handle< EcalTrigPrimDigiCollection > &pTPDigis)
unsigned int LuminosityBlockNumber_t
std::map< EcalScDetId, double > accuSCetMap
const double etValToBeFlagged_
EcalTrigTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
int zside() const
get the z-side of the tower (1/-1)
static bool validDetId(int i, int j)
check if a valid index combination
~EcalDeadCellTriggerPrimitiveFilter() override
U second(std::pair< T, U > const &p)
edm::EDPutTokenT< bool > putToken_
edm::EDGetTokenT< EcalRecHitCollection > eeReducedRecHitCollectionToken_
#define DEFINE_FWK_MODULE(type)
std::string const & moduleLabel() const
Abs< T >::type abs(const T &t)
std::vector< DetId > constituentsOf(const EcalTrigTowerDetId &id) const
Get the constituent detids for this tower id.
static const int ETAPHIMODE
std::map< EcalScDetId, int > SCzsideMap
edm::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
const_iterator end() const
int setEvtRecHitstatus(const double &tpValCut, const int &chnStatus, const int &towerTest, const EBRecHitCollection &HitecalEB, const EERecHitCollection &HitecalEE)
std::map< EcalTrigTowerDetId, double > accuTTetMap
std::map< DetId, std::vector< double > > EcalAllDeadChannelsValMap
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
virtual std::shared_ptr< 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 crystal_ix, int crystal_iy, int iz)
void beginStream(edm::StreamID) override
std::vector< Item >::const_iterator const_iterator
int setEvtTPstatus(const EcalTrigPrimDigiCollection &, const double &tpCntCut, const int &chnStatus, EcalTPGScale &)
bool filter(edm::Event &, const edm::EventSetup &) override
const edm::InputTag ebReducedRecHitCollection_
void beginRun(const edm::Run &, const edm::EventSetup &) override
iterator find(key_type k)
EcalDeadCellTriggerPrimitiveFilter(const edm::ParameterSet &)
edm::EDGetTokenT< EcalTrigPrimDigiCollection > tpDigiCollectionToken_
std::map< EcalTrigTowerDetId, int > TTzsideMap
const edm::InputTag eeReducedRecHitCollection_
void envSet(const edm::EventSetup &)
const edm::InputTag tpDigiCollection_
std::map< DetId, EcalTrigTowerDetId > EcalAllDeadChannelsTTMap
edm::ESHandle< EcalChannelStatus > ecalStatus
const_iterator begin() const
void loadEcalRecHits(edm::Event &iEvent, edm::Handle< EcalRecHitCollection > &barrelReducedRecHitsHandle, edm::Handle< EcalRecHitCollection > &endcapReducedRecHitsHandle)