24 constexpr char sigmaIPhiIPhi_[] =
"sigmaIPhiIPhi";
25 constexpr char sigmaIEtaIPhi_[] =
"sigmaIEtaIPhi";
28 constexpr char e2x5Right_[] =
"e2x5Right";
30 constexpr char e2x5Bottom_[] =
"e2x5Bottom";
48 const std::vector<float> &
values,
52 std::unique_ptr<EcalClusterLazyToolsBase>
lazyTools;
70 use_full5x5_(iConfig.getParameter<bool>(
"useFull5x5")) {
76 (
"ebReducedRecHitCollection"));
78 (
"ebReducedRecHitCollectionMiniAOD"));
81 (
"eeReducedRecHitCollection"));
83 (
"eeReducedRecHitCollectionMiniAOD"));
86 (
"esReducedRecHitCollection"));
88 (
"esReducedRecHitCollectionMiniAOD"));
98 produces<edm::ValueMap<float> >(sigmaIPhiIPhi_);
99 produces<edm::ValueMap<float> >(sigmaIEtaIPhi_);
100 produces<edm::ValueMap<float> >(e2x5Max_);
101 produces<edm::ValueMap<float> >(e2x5Left_);
102 produces<edm::ValueMap<float> >(e2x5Right_);
103 produces<edm::ValueMap<float> >(e2x5Top_);
104 produces<edm::ValueMap<float> >(e2x5Bottom_);
110 template<
typename LazyTools,
typename SeedType>
112 const SeedType& the_seed,
113 std::vector<float>& sigmaIPhiIPhi,
114 std::vector<float>& sigmaIEtaIPhi,
115 std::vector<float>& e2x5Max,
116 std::vector<float>& e2x5Left,
117 std::vector<float>& e2x5Right,
118 std::vector<float>& e2x5Top,
119 std::vector<float>& e2x5Bottom) {
120 LazyTools* tools =
static_cast<LazyTools*
>(tools_tocast);
123 std::vector<float> vCov = tools->localCovariances( the_seed );
124 spp = (
isnan(vCov[2]) ? 0. :
sqrt(vCov[2]));
126 sigmaIPhiIPhi.push_back(spp);
127 sigmaIEtaIPhi.push_back(sep);
128 e2x5Max .push_back(tools->e2x5Max(the_seed) );
129 e2x5Left .push_back(tools->e2x5Left(the_seed) );
130 e2x5Right .push_back(tools->e2x5Right(the_seed) );
131 e2x5Top .push_back(tools->e2x5Top(the_seed) );
132 e2x5Bottom.push_back(tools->e2x5Bottom(the_seed) );
148 if( !
src.isValid() ) {
150 <<
"DataFormat does not contain a photon source!";
168 ebrh, eerh, esrh ) );
171 ebrh, eerh, esrh ) );
174 if( !isAOD &&
src->size() ) {
176 if(
test.isNull() || !
test.isAvailable() ) {
178 <<
"DataFormat is detected as miniAOD but cannot cast to pat::Photon!";
183 std::vector<float> sigmaIPhiIPhi;
184 std::vector<float> sigmaIEtaIPhi;
185 std::vector<float> e2x5Max;
186 std::vector<float> e2x5Left;
187 std::vector<float> e2x5Right;
188 std::vector<float> e2x5Top;
189 std::vector<float> e2x5Bottom;
192 for (
unsigned idxpho = 0; idxpho <
src->size(); ++idxpho) {
193 const auto& iPho =
src->ptrAt(idxpho);
198 const auto& theseed = *(iPho->superCluster()->seed());
201 calculateValues<noZS::EcalClusterLazyTools>(
lazyTools.get(),
211 calculateValues<EcalClusterLazyTools>(
lazyTools.get(),
237 const std::vector<float> &
values,
246 iEvent.
put(valMap, label);
edm::EDGetToken srcMiniAOD_
T getParameter(std::string const &) const
std::unique_ptr< EcalClusterLazyToolsBase > lazyTools
edm::EDGetTokenT< EcalRecHitCollection > ebReducedRecHitCollectionMiniAOD_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< EcalRecHitCollection > esReducedRecHitCollectionMiniAOD_
void insert(const H &h, I begin, I end)
edm::EDGetTokenT< EcalRecHitCollection > eeReducedRecHitCollection_
edm::EDGetTokenT< EcalRecHitCollection > ebReducedRecHitCollection_
void addDefault(ParameterSetDescription const &psetDescription)
PhotonRegressionValueMapProducer(const edm::ParameterSet &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
~PhotonRegressionValueMapProducer()
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void writeValueMap(edm::Event &iEvent, const edm::Handle< edm::View< reco::Photon > > &handle, const std::vector< float > &values, const std::string &label) const
void calculateValues(EcalClusterLazyToolsBase *tools_tocast, const edm::Ptr< reco::GsfElectron > &iEle, const edm::EventSetup &iSetup, std::vector< float > &vsigmaIEtaIPhi, std::vector< float > &veMax, std::vector< float > &ve2nd, std::vector< float > &veTop, std::vector< float > &veBottom, std::vector< float > &veLeft, std::vector< float > &veRight, std::vector< float > &vclusterMaxDR, std::vector< float > &vclusterMaxDRDPhi, std::vector< float > &vclusterMaxDRDEta, std::vector< float > &vclusterMaxDRRawEnergy, std::vector< float > &vclusterRawEnergy0, std::vector< float > &vclusterRawEnergy1, std::vector< float > &vclusterRawEnergy2, std::vector< float > &vclusterDPhiToSeed0, std::vector< float > &vclusterDPhiToSeed1, std::vector< float > &vclusterDPhiToSeed2, std::vector< float > &vclusterDEtaToSeed0, std::vector< float > &vclusterDEtaToSeed1, std::vector< float > &vclusterDEtaToSeed2, std::vector< int > &veleIPhi, std::vector< int > &veleIEta, std::vector< float > &veleCryPhi, std::vector< float > &veleCryEta)
edm::EDGetTokenT< EcalRecHitCollection > esReducedRecHitCollection_
edm::EDGetTokenT< EcalRecHitCollection > eeReducedRecHitCollectionMiniAOD_
virtual void produce(edm::Event &, const edm::EventSetup &) override