![]() |
![]() |
#include <PreshowerClusterProducer.h>
Public Types | |
typedef math::XYZPoint | Point |
Public Member Functions | |
PreshowerClusterProducer (const edm::ParameterSet &ps) | |
virtual void | produce (edm::Event &evt, const edm::EventSetup &es) |
void | set (const edm::EventSetup &es) |
~PreshowerClusterProducer () | |
Private Attributes | |
double | alpha0_ |
double | alpha1_ |
double | alpha2_ |
double | alpha3_ |
std::string | assocSClusterCollection_ |
PreshowerClusterAlgo::DebugLevel | debugL |
edm::InputTag | endcapSClusterProducer_ |
edm::ESHandle< ESChannelStatus > | esChannelStatus_ |
edm::ESHandle < ESEEIntercalibConstants > | esEEInterCalib_ |
edm::ESHandle< ESGain > | esgain_ |
edm::ESHandle< ESMIPToGeVConstant > | esMIPToGeV_ |
double | etThresh_ |
double | gamma0_ |
double | gamma1_ |
double | gamma2_ |
double | gamma3_ |
double | mip_ |
int | nEvt_ |
PreshowerClusterAlgo * | presh_algo |
float | preshClustECut |
std::string | preshClusterCollectionX_ |
std::string | preshClusterCollectionY_ |
edm::InputTag | preshHitProducer_ |
int | preshNclust_ |
Definition at line 20 of file PreshowerClusterProducer.h.
Definition at line 24 of file PreshowerClusterProducer.h.
PreshowerClusterProducer::PreshowerClusterProducer | ( | const edm::ParameterSet & | ps | ) | [explicit] |
Definition at line 49 of file PreshowerClusterProducer.cc.
References edm::ParameterSet::getParameter(), PreshowerClusterAlgo::pDEBUG, PreshowerClusterAlgo::pERROR, and PreshowerClusterAlgo::pINFO.
{ // use configuration file to setup input/output collection names preshHitProducer_ = ps.getParameter<edm::InputTag>("preshRecHitProducer"); // Name of a SuperClusterCollection to make associations: endcapSClusterProducer_ = ps.getParameter<edm::InputTag>("endcapSClusterProducer"); // Output collections: preshClusterCollectionX_ = ps.getParameter<std::string>("preshClusterCollectionX"); preshClusterCollectionY_ = ps.getParameter<std::string>("preshClusterCollectionY"); preshNclust_ = ps.getParameter<int>("preshNclust"); etThresh_ = ps.getParameter<double>("etThresh"); assocSClusterCollection_ = ps.getParameter<std::string>("assocSClusterCollection"); produces< reco::PreshowerClusterCollection >(preshClusterCollectionX_); produces< reco::PreshowerClusterCollection >(preshClusterCollectionY_); produces< reco::SuperClusterCollection >(assocSClusterCollection_); float preshStripECut = ps.getParameter<double>("preshStripEnergyCut"); int preshSeededNst = ps.getParameter<int>("preshSeededNstrip"); preshClustECut = ps.getParameter<double>("preshClusterEnergyCut"); // The debug level std::string debugString = ps.getParameter<std::string>("debugLevel"); if (debugString == "DEBUG") debugL = PreshowerClusterAlgo::pDEBUG; else if (debugString == "INFO") debugL = PreshowerClusterAlgo::pINFO; else debugL = PreshowerClusterAlgo::pERROR; presh_algo = new PreshowerClusterAlgo(preshStripECut,preshClustECut,preshSeededNst,debugL); nEvt_ = 0; }
PreshowerClusterProducer::~PreshowerClusterProducer | ( | ) |
Definition at line 87 of file PreshowerClusterProducer.cc.
{ delete presh_algo; }
void PreshowerClusterProducer::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | es | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 92 of file PreshowerClusterProducer.cc.
References edm::SortedCollection< T, SORT >::begin(), gather_cfg::cout, DetId::Ecal, EcalPreshower, edm::SortedCollection< T, SORT >::end(), reco::CaloCluster::energy(), geometry, edm::EventSetup::get(), edm::Event::getByLabel(), ESCondObjectContainer< T >::getMap(), i, PreshowerClusterAlgo::pDEBUG, PreshowerClusterAlgo::pINFO, point, edm::Handle< T >::product(), edm::PtrVector< T >::push_back(), edm::Event::put(), reco::PreshowerCluster::setBCRef(), reco::SuperCluster::setPreshowerPlanesStatus(), funct::sin(), edm::SortedCollection< T, SORT >::size(), X, and Gflash::Z.
{ edm::Handle< EcalRecHitCollection > pRecHits; edm::Handle< reco::SuperClusterCollection > pSuperClusters; // get the ECAL geometry: edm::ESHandle<CaloGeometry> geoHandle; es.get<CaloGeometryRecord>().get(geoHandle); // retrieve ES-EE intercalibration constants and channel status set(es); const ESChannelStatus *channelStatus = esChannelStatus_.product(); const CaloSubdetectorGeometry *geometry = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower); const CaloSubdetectorGeometry *& geometry_p = geometry; // create auto_ptr to a PreshowerClusterCollection std::auto_ptr< reco::PreshowerClusterCollection > clusters_p1(new reco::PreshowerClusterCollection); std::auto_ptr< reco::PreshowerClusterCollection > clusters_p2(new reco::PreshowerClusterCollection); // create new collection of corrected super clusters std::auto_ptr< reco::SuperClusterCollection > superclusters_p(new reco::SuperClusterCollection); CaloSubdetectorTopology * topology_p=0; if (geometry) topology_p = new EcalPreshowerTopology(geoHandle); // fetch the product (pSuperClusters) evt.getByLabel(endcapSClusterProducer_, pSuperClusters); const reco::SuperClusterCollection* SClusts = pSuperClusters.product(); if ( debugL <= PreshowerClusterAlgo::pINFO ) std::cout <<"### Total # Endcap Superclusters: " << SClusts->size() << std::endl; // fetch the product (RecHits) evt.getByLabel( preshHitProducer_, pRecHits); // pointer to the object in the product const EcalRecHitCollection* rechits = pRecHits.product(); // EcalRecHitCollection hit_collection = *rhcHandle; if ( debugL == PreshowerClusterAlgo::pDEBUG ) std::cout << "PreshowerClusterProducerInfo: ### Total # of preshower RecHits: " << rechits->size() << std::endl; // make the map of rechits: std::map<DetId, EcalRecHit> rechits_map; EcalRecHitCollection::const_iterator it; for (it = rechits->begin(); it != rechits->end(); it++) { // remove bad ES rechits if (it->recoFlag()==14 || (it->recoFlag()<=10 && it->recoFlag()>=5)) continue; //Make the map of DetID, EcalRecHit pairs rechits_map.insert(std::make_pair(it->id(), *it)); } // The set of used DetID's for a given event: std::set<DetId> used_strips; used_strips.clear(); if ( debugL <= PreshowerClusterAlgo::pINFO ) std::cout << "PreshowerClusterProducerInfo: ### rechits_map of size " << rechits_map.size() <<" was created!" << std::endl; reco::PreshowerClusterCollection clusters1, clusters2; // output collection of corrected PCs reco::SuperClusterCollection new_SC; // output collection of corrected SCs if ( debugL == PreshowerClusterAlgo::pDEBUG ) std::cout << " Making a cycle over Superclusters ..." << std::endl; //make cycle over super clusters reco::SuperClusterCollection::const_iterator it_super; int isc = 0; for ( it_super=SClusts->begin(); it_super!=SClusts->end(); it_super++ ) { float e1=0; float e2=0; float deltaE=0; reco::CaloClusterPtrVector new_BC; ++isc; if ( debugL <= PreshowerClusterAlgo::pINFO ) std::cout << " superE = " << it_super->energy() << " superETA = " << it_super->eta() << " superPHI = " << it_super->phi() << std::endl; if ( debugL == PreshowerClusterAlgo::pINFO ) std::cout << " This SC contains " << it_super->clustersSize() << " BCs" << std::endl; int nBC = 0; int condP1 = 1; // 0: dead channel; 1: active channel int condP2 = 1; reco::CaloCluster_iterator bc_iter = it_super->clustersBegin(); for ( ; bc_iter !=it_super->clustersEnd(); ++bc_iter ) { if (geometry) { // Get strip position at intersection point of the line EE - Vertex: double X = (*bc_iter)->x(); double Y = (*bc_iter)->y(); double Z = (*bc_iter)->z(); const GlobalPoint point(X,Y,Z); DetId tmp1 = (dynamic_cast<const EcalPreshowerGeometry*>(geometry_p))->getClosestCellInPlane(point, 1); DetId tmp2 = (dynamic_cast<const EcalPreshowerGeometry*>(geometry_p))->getClosestCellInPlane(point, 2); ESDetId strip1 = (tmp1 == DetId(0)) ? ESDetId(0) : ESDetId(tmp1); ESDetId strip2 = (tmp2 == DetId(0)) ? ESDetId(0) : ESDetId(tmp2); if (nBC == 0) { if (strip1 != ESDetId(0) && strip2 != ESDetId(0)) { ESChannelStatusMap::const_iterator status_p1 = channelStatus->getMap().find(strip1); ESChannelStatusMap::const_iterator status_p2 = channelStatus->getMap().find(strip2); if (status_p1->getStatusCode() == 1) condP1 = 0; if (status_p2->getStatusCode() == 1) condP2 = 0; } else if (strip1 == ESDetId(0)) condP1 = 0; else if (strip2 == ESDetId(0)) condP2 = 0; } if ( debugL <= PreshowerClusterAlgo::pINFO ) { if ( strip1 != ESDetId(0) && strip2 != ESDetId(0) ) { std::cout << " Intersected preshower strips are: " << std::endl; std::cout << strip1 << std::endl; std::cout << strip2 << std::endl; } else if ( strip1 == ESDetId(0) ) std::cout << " No intersected strip in plane 1 " << std::endl; else if ( strip2 == ESDetId(0) ) std::cout << " No intersected strip in plane 2 " << std::endl; } // Get a vector of ES clusters (found by the PreshSeeded algorithm) associated with a given EE basic cluster. for (int i=0; i<preshNclust_; i++) { reco::PreshowerCluster cl1 = presh_algo->makeOneCluster(strip1,&used_strips,&rechits_map,geometry_p,topology_p); cl1.setBCRef(*bc_iter); if (cl1.energy() > preshClustECut) { clusters1.push_back(cl1); e1 += cl1.energy(); } reco::PreshowerCluster cl2 = presh_algo->makeOneCluster(strip2,&used_strips,&rechits_map,geometry_p,topology_p); cl2.setBCRef(*bc_iter); if ( cl2.energy() > preshClustECut) { clusters2.push_back(cl2); e2 += cl2.energy(); } } // end of cycle over ES clusters } new_BC.push_back(*bc_iter); nBC++; } // end of cycle over BCs if ( debugL <= PreshowerClusterAlgo::pINFO ) std::cout << " For SC #" << isc-1 << ", containing " << it_super->clustersSize() << " basic clusters, PreshowerClusterAlgo made " << clusters1.size() << " in X plane and " << clusters2.size() << " in Y plane " << " preshower clusters " << std::endl; // update energy of the SuperCluster if(e1+e2 > 1.0e-10) { // GeV to #MIPs e1 = e1 / mip_; e2 = e2 / mip_; if (condP1 == 1 && condP2 == 1) deltaE = gamma0_*(e1 + alpha0_*e2); else if (condP1 == 1 && condP2 == 0) deltaE = gamma1_*(e1 + alpha1_*e2); else if (condP1 == 0 && condP2 == 1) deltaE = gamma2_*(e1 + alpha2_*e2); else if (condP1 == 0 && condP2 == 0) deltaE = gamma3_*(e1 + alpha3_*e2); } //corrected Energy float E = it_super->energy() + deltaE; if (debugL == PreshowerClusterAlgo::pDEBUG) std::cout << " Creating corrected SC " << std::endl; reco::SuperCluster sc(E, it_super->position(), it_super->seed(), new_BC, deltaE); if (condP1 == 1 && condP2 == 1) sc.setPreshowerPlanesStatus(0); else if (condP1 == 1 && condP2 == 0) sc.setPreshowerPlanesStatus(1); else if (condP1 == 0 && condP2 == 1) sc.setPreshowerPlanesStatus(2); else if (condP1 == 0 && condP2 == 0) sc.setPreshowerPlanesStatus(3); if (sc.energy()*sin(sc.position().theta())>etThresh_) new_SC.push_back(sc); if (debugL <= PreshowerClusterAlgo::pINFO) std::cout << " SuperClusters energies: new E = " << sc.energy() << " vs. old E =" << it_super->energy() << std::endl; } // end of cycle over SCs // copy the preshower clusters into collections and put in the Event: clusters_p1->assign(clusters1.begin(), clusters1.end()); clusters_p2->assign(clusters2.begin(), clusters2.end()); // put collection of preshower clusters to the event evt.put( clusters_p1, preshClusterCollectionX_ ); evt.put( clusters_p2, preshClusterCollectionY_ ); if ( debugL <= PreshowerClusterAlgo::pINFO ) std::cout << "Preshower clusters added to the event" << std::endl; // put collection of corrected super clusters to the event superclusters_p->assign(new_SC.begin(), new_SC.end()); evt.put(superclusters_p, assocSClusterCollection_); if ( debugL <= PreshowerClusterAlgo::pINFO ) std::cout << "Corrected SClusters added to the event" << std::endl; if (topology_p) delete topology_p; nEvt_++; }
void PreshowerClusterProducer::set | ( | const edm::EventSetup & | es | ) |
Definition at line 281 of file PreshowerClusterProducer.cc.
References edm::EventSetup::get(), ESEEIntercalibConstants::getAlphaHigh0(), ESEEIntercalibConstants::getAlphaHigh1(), ESEEIntercalibConstants::getAlphaHigh2(), ESEEIntercalibConstants::getAlphaHigh3(), ESEEIntercalibConstants::getAlphaLow0(), ESEEIntercalibConstants::getAlphaLow1(), ESEEIntercalibConstants::getAlphaLow2(), ESEEIntercalibConstants::getAlphaLow3(), ESGain::getESGain(), ESMIPToGeVConstant::getESValueHigh(), ESMIPToGeVConstant::getESValueLow(), ESEEIntercalibConstants::getGammaHigh0(), ESEEIntercalibConstants::getGammaHigh1(), ESEEIntercalibConstants::getGammaHigh2(), ESEEIntercalibConstants::getGammaHigh3(), ESEEIntercalibConstants::getGammaLow0(), ESEEIntercalibConstants::getGammaLow1(), ESEEIntercalibConstants::getGammaLow2(), and ESEEIntercalibConstants::getGammaLow3().
{ es.get<ESGainRcd>().get(esgain_); const ESGain *gain = esgain_.product(); double ESGain = gain->getESGain(); es.get<ESMIPToGeVConstantRcd>().get(esMIPToGeV_); const ESMIPToGeVConstant *mipToGeV = esMIPToGeV_.product(); mip_ = (ESGain == 1) ? mipToGeV->getESValueLow() : mipToGeV->getESValueHigh(); es.get<ESChannelStatusRcd>().get(esChannelStatus_); es.get<ESEEIntercalibConstantsRcd>().get(esEEInterCalib_); const ESEEIntercalibConstants *esEEInterCalib = esEEInterCalib_.product(); // both planes work gamma0_ = (ESGain == 1) ? esEEInterCalib->getGammaLow0() : esEEInterCalib->getGammaHigh0(); alpha0_ = (ESGain == 1) ? esEEInterCalib->getAlphaLow0() : esEEInterCalib->getAlphaHigh0(); // only first plane works gamma1_ = (ESGain == 1) ? esEEInterCalib->getGammaLow1() : esEEInterCalib->getGammaHigh1(); alpha1_ = (ESGain == 1) ? esEEInterCalib->getAlphaLow1() : esEEInterCalib->getAlphaHigh1(); // only second plane works gamma2_ = (ESGain == 1) ? esEEInterCalib->getGammaLow2() : esEEInterCalib->getGammaHigh2(); alpha2_ = (ESGain == 1) ? esEEInterCalib->getAlphaLow2() : esEEInterCalib->getAlphaHigh2(); // both planes do not work gamma3_ = (ESGain == 1) ? esEEInterCalib->getGammaLow3() : esEEInterCalib->getGammaHigh3(); alpha3_ = (ESGain == 1) ? esEEInterCalib->getAlphaLow3() : esEEInterCalib->getAlphaHigh3(); }
double PreshowerClusterProducer::alpha0_ [private] |
Definition at line 62 of file PreshowerClusterProducer.h.
double PreshowerClusterProducer::alpha1_ [private] |
Definition at line 63 of file PreshowerClusterProducer.h.
double PreshowerClusterProducer::alpha2_ [private] |
Definition at line 64 of file PreshowerClusterProducer.h.
double PreshowerClusterProducer::alpha3_ [private] |
Definition at line 65 of file PreshowerClusterProducer.h.
std::string PreshowerClusterProducer::assocSClusterCollection_ [private] |
Definition at line 51 of file PreshowerClusterProducer.h.
Definition at line 71 of file PreshowerClusterProducer.h.
Definition at line 39 of file PreshowerClusterProducer.h.
Definition at line 56 of file PreshowerClusterProducer.h.
Definition at line 55 of file PreshowerClusterProducer.h.
edm::ESHandle<ESGain> PreshowerClusterProducer::esgain_ [private] |
Definition at line 53 of file PreshowerClusterProducer.h.
Definition at line 54 of file PreshowerClusterProducer.h.
double PreshowerClusterProducer::etThresh_ [private] |
Definition at line 48 of file PreshowerClusterProducer.h.
double PreshowerClusterProducer::gamma0_ [private] |
Definition at line 58 of file PreshowerClusterProducer.h.
double PreshowerClusterProducer::gamma1_ [private] |
Definition at line 59 of file PreshowerClusterProducer.h.
double PreshowerClusterProducer::gamma2_ [private] |
Definition at line 60 of file PreshowerClusterProducer.h.
double PreshowerClusterProducer::gamma3_ [private] |
Definition at line 61 of file PreshowerClusterProducer.h.
double PreshowerClusterProducer::mip_ [private] |
Definition at line 57 of file PreshowerClusterProducer.h.
int PreshowerClusterProducer::nEvt_ [private] |
Definition at line 35 of file PreshowerClusterProducer.h.
Definition at line 67 of file PreshowerClusterProducer.h.
float PreshowerClusterProducer::preshClustECut [private] |
Definition at line 47 of file PreshowerClusterProducer.h.
std::string PreshowerClusterProducer::preshClusterCollectionX_ [private] |
Definition at line 42 of file PreshowerClusterProducer.h.
std::string PreshowerClusterProducer::preshClusterCollectionY_ [private] |
Definition at line 43 of file PreshowerClusterProducer.h.
Definition at line 38 of file PreshowerClusterProducer.h.
int PreshowerClusterProducer::preshNclust_ [private] |
Definition at line 46 of file PreshowerClusterProducer.h.