46 verbosity_ = ( cfg.
exists(
"verbosity") ) ?
59 edm::LogPrint(
"PFTauAgainstEleDeadECAL") <<
"<PFRecoTauDiscriminationAgainstElectronDeadECAL::discriminate>:" ;
61 edm::LogPrint(
"PFTauAgainstEleDeadECAL") <<
"#badTowers = " << badTowers_.size() ;
62 edm::LogPrint(
"PFTauAgainstEleDeadECAL") <<
"tau: Pt = " << pfTau->pt() <<
", eta = " << pfTau->eta() <<
", phi = " << pfTau->phi() ;
65 for ( std::vector<towerInfo>::const_iterator badTower = badTowers_.begin();
66 badTower != badTowers_.end(); ++badTower ) {
67 if (
deltaR(badTower->eta_, badTower->phi_, pfTau->eta(), pfTau->phi()) < dR_ ) {
69 edm::LogPrint(
"PFTauAgainstEleDeadECAL") <<
" matches badTower: eta = " << badTower->eta_ <<
", phi = " << badTower->phi_ ;
89 if ( !isFirstEvent_ && channelStatusId == channelStatusId_cache_ && caloGeometryId == caloGeometryId_cache_ && idealGeometryId == idealGeometryId_cache_ )
return;
93 channelStatusId_cache_ = channelStatusId;
97 caloGeometryId_cache_ = caloGeometryId;
101 idealGeometryId_cache_ = idealGeometryId;
103 std::map<uint32_t,unsigned> nBadCrystals, maxStatus;
104 std::map<uint32_t,double> sumEta, sumPhi;
106 loopXtals<EBDetId>(nBadCrystals, maxStatus, sumEta, sumPhi, channelStatus.
product(), caloGeometry.
product(), ttMap.
product());
107 loopXtals<EEDetId>(nBadCrystals, maxStatus, sumEta, sumPhi, channelStatus.
product(), caloGeometry.
product(), ttMap.
product());
110 for ( std::map<uint32_t, unsigned>::const_iterator it = nBadCrystals.begin();
111 it != nBadCrystals.end(); ++it ) {
112 uint32_t
key = it->first;
113 badTowers_.push_back(
towerInfo(key, it->second, maxStatus[key], sumEta[key]/it->second, sumPhi[key]/it->second));
116 isFirstEvent_ =
false;
120 void loopXtals(std::map<uint32_t, unsigned>& nBadCrystals,
121 std::map<uint32_t, unsigned>& maxStatus,
122 std::map<uint32_t, double>& sumEta,
123 std::map<uint32_t, double>& sumPhi ,
130 for (
int i = 0;
i < Id::kSizeForDenseIndexing; ++
i ) {
131 Id
id = Id::unhashIndex(
i);
132 if (
id == Id(0) )
continue;
134 unsigned status = ( it == channelStatus->
end() ) ?
135 0 : (it->getStatusCode() & statusMask_);
136 if ( status >= minStatus_ ) {
141 sumEta[
key] += point.
eta();
142 sumPhi[
key] += point.
phi();
149 towerInfo(uint32_t
id,
unsigned nBad,
unsigned maxStatus,
double eta,
double phi)
152 maxStatus_(maxStatus),
169 static const uint16_t statusMask_ = 0x1F;
T getParameter(std::string const &) const
uint32_t caloGeometryId_cache_
const self & getMap() const
#define DEFINE_FWK_MODULE(type)
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiE4D< double > > PolarLorentzVector
Geom::Phi< T > phi() const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::vector< towerInfo > badTowers_
PFRecoTauDiscriminationAgainstElectronDeadECAL(const edm::ParameterSet &cfg)
EcalTrigTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
uint32_t channelStatusId_cache_
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
void loopXtals(std::map< uint32_t, unsigned > &nBadCrystals, std::map< uint32_t, unsigned > &maxStatus, std::map< uint32_t, double > &sumEta, std::map< uint32_t, double > &sumPhi, const EcalChannelStatus *channelStatus, const CaloGeometry *caloGeometry, const EcalTrigTowerConstituentsMap *ttMap) const
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
double discriminate(const PFTauRef &pfTau) const override
uint32_t idealGeometryId_cache_
std::vector< Item >::const_iterator const_iterator
T const * product() const
const_iterator find(uint32_t rawId) const
const_iterator end() const
~PFRecoTauDiscriminationAgainstElectronDeadECAL()
void updateBadTowers(const edm::EventSetup &es)
towerInfo(uint32_t id, unsigned nBad, unsigned maxStatus, double eta, double phi)
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
void beginEvent(const edm::Event &evt, const edm::EventSetup &es) override