43 moduleLabel_(cfg.getParameter<
std::
string>(
"@module_label")),
61 edm::LogPrint(
"PFTauAgainstEleDeadECAL") <<
"<PFRecoTauDiscriminationAgainstElectronDeadECAL::discriminate>:" ;
62 edm::LogPrint(
"PFTauAgainstEleDeadECAL") <<
" moduleLabel = " << moduleLabel_ ;
63 edm::LogPrint(
"PFTauAgainstEleDeadECAL") <<
"#badTowers = " << badTowers_.size() ;
64 edm::LogPrint(
"PFTauAgainstEleDeadECAL") <<
"tau: Pt = " << pfTau->pt() <<
", eta = " << pfTau->eta() <<
", phi = " << pfTau->phi() ;
67 for ( std::vector<towerInfo>::const_iterator badTower = badTowers_.begin();
68 badTower != badTowers_.end(); ++badTower ) {
69 if (
deltaR(badTower->eta_, badTower->phi_, pfTau->eta(), pfTau->phi()) < dR_ ) {
71 edm::LogPrint(
"PFTauAgainstEleDeadECAL") <<
" matches badTower: eta = " << badTower->eta_ <<
", phi = " << badTower->phi_ ;
93 if ( !isFirstEvent_ && channelStatusId == channelStatusId_cache_ && caloGeometryId == caloGeometryId_cache_ && idealGeometryId == idealGeometryId_cache_ )
return;
97 channelStatusId_cache_ = channelStatusId;
101 caloGeometryId_cache_ = caloGeometryId;
105 idealGeometryId_cache_ = idealGeometryId;
107 std::map<uint32_t,unsigned> nBadCrystals, maxStatus;
108 std::map<uint32_t,double> sumEta, sumPhi;
110 loopXtals<EBDetId>(nBadCrystals, maxStatus, sumEta, sumPhi, channelStatus.
product(), caloGeometry.
product(), ttMap.
product());
111 loopXtals<EEDetId>(nBadCrystals, maxStatus, sumEta, sumPhi, channelStatus.
product(), caloGeometry.
product(), ttMap.
product());
114 for ( std::map<uint32_t, unsigned>::const_iterator it = nBadCrystals.begin();
115 it != nBadCrystals.end(); ++it ) {
116 uint32_t
key = it->first;
117 badTowers_.push_back(
towerInfo(key, it->second, maxStatus[key], sumEta[key]/it->second, sumPhi[key]/it->second));
120 isFirstEvent_ =
false;
124 void loopXtals(std::map<uint32_t, unsigned>& nBadCrystals,
125 std::map<uint32_t, unsigned>& maxStatus,
126 std::map<uint32_t, double>& sumEta,
127 std::map<uint32_t, double>& sumPhi ,
134 for (
int i = 0;
i < Id::kSizeForDenseIndexing; ++
i ) {
135 Id
id = Id::unhashIndex(
i);
136 if (
id == Id(0) )
continue;
138 unsigned status = ( it == channelStatus->
end() ) ?
139 0 : (it->getStatusCode() & statusMask_);
140 if ( status >= minStatus_ ) {
145 sumEta[
key] += point.
eta();
146 sumPhi[
key] += point.
phi();
153 towerInfo(uint32_t
id,
unsigned nBad,
unsigned maxStatus,
double eta,
double phi)
156 maxStatus_(maxStatus),
173 static const uint16_t statusMask_ = 0x1F;
187 desc.
add<
int>(
"verbosity", 0);
193 psd1.
add<
double>(
"cut");
201 psd1.
add<
double>(
"cut");
207 desc.
add<
double>(
"dR", 0.08);
209 desc.
add<
unsigned int>(
"minStatus", 12);
210 descriptions.
add(
"pfRecoTauDiscriminationAgainstElectronDeadECAL", desc);
T getParameter(std::string const &) const
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
uint32_t caloGeometryId_cache_
const self & getMap() const
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiE4D< double > > PolarLorentzVector
Geom::Phi< T > phi() const
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)
#define DEFINE_FWK_MODULE(type)
uint32_t channelStatusId_cache_
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
ParameterDescriptionBase * add(U const &iLabel, T const &value)
double discriminate(const PFTauRef &pfTau) const override
~PFRecoTauDiscriminationAgainstElectronDeadECAL() override
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
uint32_t idealGeometryId_cache_
std::vector< Item >::const_iterator const_iterator
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const_iterator find(uint32_t rawId) const
const_iterator end() const
void updateBadTowers(const edm::EventSetup &es)
towerInfo(uint32_t id, unsigned nBad, unsigned maxStatus, double eta, double phi)
T const * product() const
*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