116 endcapSClusterToken_ =
119 esGainToken_ = esConsumes<ESGain, ESGainRcd>();
120 esMIPToGeVToken_ = esConsumes<ESMIPToGeVConstant, ESMIPToGeVConstantRcd>();
121 esEEInterCalibToken_ = esConsumes<ESEEIntercalibConstants, ESEEIntercalibConstantsRcd>();
122 esMissingECalibToken_ = esConsumes<ESMissingEnergyCalibration, ESMissingEnergyCalibrationRcd>();
123 esChannelStatusToken_ = esConsumes<ESChannelStatus, ESChannelStatusRcd>();
124 caloGeometryToken_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
135 produces<reco::PreshowerClusterCollection>(preshClusterCollectionX_);
136 produces<reco::PreshowerClusterCollection>(preshClusterCollectionY_);
137 produces<reco::SuperClusterCollection>(assocSClusterCollection_);
139 float preshStripECut = ps.
getParameter<
double>(
"preshStripEnergyCut");
140 int preshSeededNst = ps.
getParameter<
int>(
"preshSeededNstrip");
141 preshClustECut = ps.
getParameter<
double>(
"preshClusterEnergyCut");
164 auto clusters_p1 = std::make_unique<reco::PreshowerClusterCollection>();
165 auto clusters_p2 = std::make_unique<reco::PreshowerClusterCollection>();
167 auto superclusters_p = std::make_unique<reco::SuperClusterCollection>();
169 std::unique_ptr<CaloSubdetectorTopology> topology_p;
171 topology_p = std::make_unique<EcalPreshowerTopology>();
174 evt.
getByToken(endcapSClusterToken_, pSuperClusters);
182 LogTrace(
"EcalClusters") <<
"PreshowerClusterProducerInfo: ### Total # of preshower RecHits: " << rechits->
size();
185 std::map<DetId, EcalRecHit> rechits_map;
187 for (it = rechits->
begin(); it != rechits->
end(); it++) {
189 if (it->recoFlag() == 1 || it->recoFlag() == 14 || (it->recoFlag() <= 10 && it->recoFlag() >= 5))
192 rechits_map.insert(std::make_pair(it->id(), *it));
195 std::set<DetId> used_strips;
197 LogTrace(
"EcalClusters") <<
"PreshowerClusterProducerInfo: ### rechits_map of size " << rechits_map.size()
204 reco::SuperClusterCollection::const_iterator it_super;
206 for (it_super = SClusts->begin(); it_super != SClusts->end(); ++it_super) {
213 LogTrace(
"EcalClusters") <<
" superE = " << it_super->energy() <<
" superETA = " << it_super->eta()
214 <<
" superPHI = " << it_super->phi();
220 for (; bc_iter != it_super->clustersEnd(); ++bc_iter) {
223 double X = (*bc_iter)->x();
224 double Y = (*bc_iter)->y();
225 double Z = (*bc_iter)->z();
237 if (status_p1->getStatusCode() == 1)
239 if (status_p2->getStatusCode() == 1)
241 }
else if (strip1 ==
ESDetId(0))
248 for (
int i = 0;
i < preshNclust_;
i++) {
250 presh_algo->makeOneCluster(strip1, &used_strips, &rechits_map, geometry_p, topology_p.get());
252 if (cl1.
energy() > preshClustECut) {
253 clusters1.push_back(cl1);
257 presh_algo->makeOneCluster(strip2, &used_strips, &rechits_map, geometry_p, topology_p.get());
260 if (cl2.
energy() > preshClustECut) {
261 clusters2.push_back(cl2);
271 LogTrace(
"EcalClusters") <<
" For SC #" << isc - 1 <<
", containing " << it_super->clustersSize()
272 <<
" basic clusters, PreshowerClusterAlgo made " << clusters1.size() <<
" in X plane and "
273 << clusters2.size() <<
" in Y plane "
274 <<
" preshower clusters ";
277 if (e1 + e2 > 1.0
e-10) {
281 if (condP1 == 1 && condP2 == 1) {
282 deltaE = gamma0_ * (e1 + alpha0_ * e2);
283 }
else if (condP1 == 1 && condP2 == 0) {
284 deltaE = gamma1_ * (e1 + alpha1_ * e2);
285 }
else if (condP1 == 0 && condP2 == 1) {
286 deltaE = gamma2_ * (e1 + alpha2_ * e2);
287 }
else if (condP1 == 0 && condP2 == 0) {
288 deltaE = gamma3_ * (e1 + alpha3_ * e2);
293 float E = it_super->energy() + deltaE;
295 LogTrace(
"EcalClusters") <<
" Creating corrected SC ";
298 if (condP1 == 1 && condP2 == 1)
300 else if (condP1 == 1 && condP2 == 0)
301 sc.setPreshowerPlanesStatus(1);
302 else if (condP1 == 0 && condP2 == 1)
303 sc.setPreshowerPlanesStatus(2);
304 else if (condP1 == 0 && condP2 == 0)
305 sc.setPreshowerPlanesStatus(3);
307 if (sc.energy() *
sin(sc.position().theta()) > etThresh_)
308 new_SC.push_back(sc);
309 LogTrace(
"EcalClusters") <<
" SuperClusters energies: new E = " << sc.energy()
310 <<
" vs. old E =" << it_super->energy();
315 clusters_p1->assign(clusters1.begin(), clusters1.end());
316 clusters_p2->assign(clusters2.begin(), clusters2.end());
318 evt.
put(
std::move(clusters_p1), preshClusterCollectionX_);
319 evt.
put(
std::move(clusters_p2), preshClusterCollectionY_);
320 LogTrace(
"EcalClusters") <<
"Preshower clusters added to the event";
323 superclusters_p->assign(new_SC.begin(), new_SC.end());
324 evt.
put(
std::move(superclusters_p), assocSClusterCollection_);
325 LogTrace(
"EcalClusters") <<
"Corrected SClusters added to the event";
332 const ESGain* gain = esgain_.product();
336 esMIPToGeV_ = es.
getHandle(esMIPToGeVToken_);
341 esChannelStatus_ = es.
getHandle(esChannelStatusToken_);
343 esEEInterCalib_ = es.
getHandle(esEEInterCalibToken_);
347 gamma0_ = (ESGain == 1) ? 0.02 : esEEInterCalib->
getGammaHigh0();
359 gamma3_ = (ESGain == 1) ? 0.02 : esEEInterCalib->
getGammaHigh3();
362 esMissingECalib_ = es.
getHandle(esMissingECalibToken_);
~PreshowerClusterProducer() override
float getConstAEta1() const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::ESGetToken< ESEEIntercalibConstants, ESEEIntercalibConstantsRcd > esEEInterCalibToken_
edm::ESHandle< ESMissingEnergyCalibration > esMissingECalib_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
void push_back(Ptr< T > const &iPtr)
const self & getMap() const
edm::ESHandle< ESGain > esgain_
std::string preshClusterCollectionY_
float getESValueLow() const
edm::ESGetToken< ESMIPToGeVConstant, ESMIPToGeVConstantRcd > esMIPToGeVToken_
Sin< T >::type sin(const T &t)
float getConstAEta2() const
std::vector< EcalRecHit >::const_iterator const_iterator
PreshowerClusterAlgo * presh_algo
float getGammaLow2() const
float getAlphaHigh3() const
float getGammaHigh2() const
float getConstAEta0() const
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
edm::ESHandle< ESChannelStatus > esChannelStatus_
void setBCRef(const CaloClusterPtr &r)
DetIds of component RecHits – now inherited from CaloCluster.
const_iterator find(uint32_t rawId) const
float getConstBEta0() const
std::vector< PreshowerCluster > PreshowerClusterCollection
collection of PreshowerCluster objects
double energy() const
cluster energy
edm::ESGetToken< ESGain, ESGainRcd > esGainToken_
float getConstBEta2() const
float getConstAEta3() const
edm::ESGetToken< ESChannelStatus, ESChannelStatusRcd > esChannelStatusToken_
float getGammaHigh3() const
float getConstBEta1() const
edm::ESHandle< ESMIPToGeVConstant > esMIPToGeV_
float getGammaHigh1() const
const_iterator end() const
std::string preshClusterCollectionX_
edm::ESHandle< ESEEIntercalibConstants > esEEInterCalib_
void setPreshowerPlanesStatus(const uint32_t &status)
edm::EDGetTokenT< EcalRecHitCollection > preshHitsToken_
T const * product() const
float getAlphaHigh0() const
XYZPointD XYZPoint
point in space with cartesian internal representation
float getAlphaLow3() const
float getAlphaHigh2() const
T getParameter(std::string const &) const
PreshowerClusterProducer(const edm::ParameterSet &ps)
void set(const edm::EventSetup &es)
float getAlphaLow2() const
std::vector< Item >::const_iterator const_iterator
float getGammaLow1() const
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
float getAlphaHigh1() const
edm::ESGetToken< ESMissingEnergyCalibration, ESMissingEnergyCalibrationRcd > esMissingECalibToken_
float getConstBEta3() const
std::string assocSClusterCollection_
void produce(edm::Event &evt, const edm::EventSetup &es) override
float getGammaHigh0() const
float getAlphaLow1() const
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
edm::EDGetTokenT< reco::SuperClusterCollection > endcapSClusterToken_
float getESValueHigh() 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
float getAlphaLow0() const
const_iterator begin() const