Producer for particle flow rechits (PFRecHit) More...
#include <PFRecHitProducerPS.h>
Public Member Functions | |
PFRecHitProducerPS (const edm::ParameterSet &) | |
~PFRecHitProducerPS () | |
Private Member Functions | |
void | createRecHits (std::vector< reco::PFRecHit > &rechits, std::vector< reco::PFRecHit > &rechitsCleaned, edm::Event &, const edm::EventSetup &) |
void | findRecHitNeighbours (reco::PFRecHit &rh, const std::map< unsigned, unsigned > &sortedHits, const CaloSubdetectorTopology &barrelTopo, const CaloSubdetectorGeometry &barrelGeom, const CaloSubdetectorTopology &endcapTopo, const CaloSubdetectorGeometry &endcapGeom) |
Private Attributes | |
edm::InputTag | inputTagEcalRecHitsES_ |
Producer for particle flow rechits (PFRecHit)
Definition at line 32 of file PFRecHitProducerPS.h.
PFRecHitProducerPS::PFRecHitProducerPS | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 32 of file PFRecHitProducerPS.cc.
References edm::ParameterSet::getParameter(), and inputTagEcalRecHitsES_.
: PFRecHitProducer(iConfig) { // access to the collections of rechits inputTagEcalRecHitsES_ = iConfig.getParameter<InputTag>("ecalRecHitsES"); }
PFRecHitProducerPS::~PFRecHitProducerPS | ( | ) |
Definition at line 45 of file PFRecHitProducerPS.cc.
{}
void PFRecHitProducerPS::createRecHits | ( | std::vector< reco::PFRecHit > & | rechits, |
std::vector< reco::PFRecHit > & | rechitsCleaned, | ||
edm::Event & | , | ||
const edm::EventSetup & | |||
) | [private, virtual] |
gets PS rechits, translate them to PFRecHits, which are stored in the rechits vector
if ( !theStatusValue )
if ( !theStatusValue )
if ( !theStatusValue )
if ( !theStatusValue )
Implements PFRecHitProducer.
Definition at line 77 of file PFRecHitProducerECAL.cc.
References EcalRecHit::checkFlag(), PFRecHitProducerECAL::createEcalRecHit(), cond::rpcobgas::detid, CaloRecHit::detid(), DetId::Ecal, PFLayer::ECAL_BARREL, PFLayer::ECAL_ENDCAP, EcalBarrel, EcalEndcap, PFRecHitProducerECAL::ecalNeighbArray(), CaloRecHit::energy(), relval_parameters_module::energy, Exception, PFRecHitProducerECAL::findRecHitNeighboursECAL(), newFWLiteAna::found, edm::EventSetup::get(), edm::Event::getByLabel(), i, PFRecHitProducerECAL::inputTagEcalRecHitsEB_, PFRecHitProducerECAL::inputTagEcalRecHitsEE_, edm::HandleBase::isValid(), EcalRecHit::kDiWeird, EcalRecHit::kOutOfTime, EcalRecHit::kTowerRecovered, EcalRecHit::kWeird, PFRecHitProducerECAL::neighbourmapcalculated_, DetId::rawId(), reco::PFRecHit::setRescale(), DetId::subdetId(), PFRecHitProducer::thresh_Barrel_, PFRecHitProducer::thresh_Endcap_, PFRecHitProducerECAL::threshCleaningEB_, PFRecHitProducerECAL::threshCleaningEE_, cond::rpcobgas::time, CaloRecHit::time(), PFRecHitProducerECAL::timingCleaning_, and PFRecHitProducerECAL::topologicalCleaning_.
{ // this map is necessary to find the rechit neighbours efficiently //C but I should think about using Florian's hashed index to do this. //C in which case the map might not be necessary anymore // // the key of this map is detId. // the value is the index in the rechits vector map<unsigned, unsigned > idSortedRecHits; // typedef map<unsigned, unsigned >::iterator IDH; edm::ESHandle<CaloGeometry> geoHandle; iSetup.get<CaloGeometryRecord>().get(geoHandle); // get the ecalBarrel geometry const CaloSubdetectorGeometry *ebtmp = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel); const EcalBarrelGeometry* ecalBarrelGeometry = dynamic_cast< const EcalBarrelGeometry* > (ebtmp); assert( ecalBarrelGeometry ); // get the ecalBarrel topology EcalBarrelTopology ecalBarrelTopology(geoHandle); // get the endcap geometry const CaloSubdetectorGeometry *eetmp = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap); const EcalEndcapGeometry* ecalEndcapGeometry = dynamic_cast< const EcalEndcapGeometry* > (eetmp); assert( ecalEndcapGeometry ); // get the endcap topology EcalEndcapTopology ecalEndcapTopology(geoHandle); if(!neighbourmapcalculated_) ecalNeighbArray( *ecalBarrelGeometry, ecalBarrelTopology, *ecalEndcapGeometry, ecalEndcapTopology ); // get the ecalBarrel rechits edm::Handle<EcalRecHitCollection> rhcHandle; bool found = iEvent.getByLabel(inputTagEcalRecHitsEB_, rhcHandle); if(!found) { ostringstream err; err<<"could not find rechits "<<inputTagEcalRecHitsEB_; LogError("PFRecHitProducerECAL")<<err.str()<<endl; throw cms::Exception( "MissingProduct", err.str()); } else { assert( rhcHandle.isValid() ); // process ecal ecalBarrel rechits for(unsigned i=0; i<rhcHandle->size(); i++) { const EcalRecHit& erh = (*rhcHandle)[i]; const DetId& detid = erh.detid(); double energy = erh.energy(); // uint32_t flag = erh.recoFlag(); double time = erh.time(); EcalSubdetector esd=(EcalSubdetector)detid.subdetId(); if (esd != 1) continue; if(energy < thresh_Barrel_ ) continue; // Check and skip the TT recovered rechits //if ( flag == EcalRecHit::kTowerRecovered ) { if ( erh.checkFlag(EcalRecHit::kTowerRecovered) ) { // std::cout << "Rechit was recovered with energy " << energy << std::endl; continue; } // Just clean ECAL Barrel rechits out of time by more than 5 sigma. // if ( timingCleaning_ && energy > threshCleaning_ && flag == EcalRecHit::kOutOfTime ) { if ( ( timingCleaning_ && energy > threshCleaningEB_ && erh.checkFlag(EcalRecHit::kOutOfTime) ) || ( topologicalCleaning_ && ( erh.checkFlag(EcalRecHit::kWeird) || erh.checkFlag(EcalRecHit::kDiWeird) ) ) ) { reco::PFRecHit *pfrhCleaned = createEcalRecHit(detid, energy, PFLayer::ECAL_BARREL, ecalBarrelGeometry); if( !pfrhCleaned ) continue; // problem with this rechit. skip it pfrhCleaned->setRescale(time); rechitsCleaned.push_back( *pfrhCleaned ); delete pfrhCleaned; continue; } reco::PFRecHit *pfrh = createEcalRecHit(detid, energy, PFLayer::ECAL_BARREL, ecalBarrelGeometry); if( !pfrh ) continue; // problem with this rechit. skip it pfrh->setRescale(time); rechits.push_back( *pfrh ); delete pfrh; idSortedRecHits.insert( make_pair(detid.rawId(), rechits.size()-1 ) ); } } //C proceed as for the barrel // process ecal endcap rechits found = iEvent.getByLabel(inputTagEcalRecHitsEE_, rhcHandle); if(!found) { ostringstream err; err<<"could not find rechits "<<inputTagEcalRecHitsEE_; LogError("PFRecHitProducerECAL")<<err.str()<<endl; throw cms::Exception( "MissingProduct", err.str()); } else { assert( rhcHandle.isValid() ); for(unsigned i=0; i<rhcHandle->size(); i++) { const EcalRecHit& erh = (*rhcHandle)[i]; const DetId& detid = erh.detid(); double energy = erh.energy(); //uint32_t flag = erh.recoFlag(); double time = erh.time(); EcalSubdetector esd=(EcalSubdetector)detid.subdetId(); if (esd != 2) continue; if(energy < thresh_Endcap_ ) continue; // Check and skip the TT recovered rechits if ( erh.checkFlag(EcalRecHit::kTowerRecovered) ) { // if ( flag == EcalRecHit::kTowerRecovered ) { // std::cout << "Rechit was recovered with energy " << energy << std::endl; continue; } // EE cleaning if ( ( timingCleaning_ && energy > threshCleaningEE_ && erh.checkFlag(EcalRecHit::kOutOfTime) ) || ( topologicalCleaning_ && ( erh.checkFlag(EcalRecHit::kWeird) ) ) ) { reco::PFRecHit *pfrhCleaned = createEcalRecHit(detid, energy, PFLayer::ECAL_ENDCAP, ecalEndcapGeometry); if( !pfrhCleaned ) continue; // problem with this rechit. skip it pfrhCleaned->setRescale(time); rechitsCleaned.push_back( *pfrhCleaned ); delete pfrhCleaned; continue; } reco::PFRecHit *pfrh = createEcalRecHit(detid, energy, PFLayer::ECAL_ENDCAP, ecalEndcapGeometry); if( !pfrh ) continue; // problem with this rechit. skip it pfrh->setRescale(time); rechits.push_back( *pfrh ); delete pfrh; idSortedRecHits.insert( make_pair(detid.rawId(), rechits.size()-1 ) ); } } // do navigation for(unsigned i=0; i<rechits.size(); i++ ) { // findRecHitNeighbours( rechits[i], idSortedRecHits, // ecalBarrelTopology, // *ecalBarrelGeometry, // ecalEndcapTopology, // *ecalEndcapGeometry); findRecHitNeighboursECAL( rechits[i], idSortedRecHits ); } }
void PFRecHitProducerPS::findRecHitNeighbours | ( | reco::PFRecHit & | rh, |
const std::map< unsigned, unsigned > & | sortedHits, | ||
const CaloSubdetectorTopology & | barrelTopo, | ||
const CaloSubdetectorGeometry & | barrelGeom, | ||
const CaloSubdetectorTopology & | endcapTopo, | ||
const CaloSubdetectorGeometry & | endcapGeom | ||
) | [private] |
find and set the neighbours to a given rechit this works for ecal, hcal, ps COLIN remonter cette fonction dans la classe de base
Definition at line 1117 of file PFRecHitProducerHCAL.cc.
References reco::PFRecHit::add4Neighbour(), reco::PFRecHit::add8Neighbour(), reco::PFRecHit::detId(), cond::rpcobgas::detid, east, CaloNavigator< T >::east(), PFLayer::ECAL_BARREL, PFLayer::ECAL_ENDCAP, geometry, PFLayer::HCAL_BARREL1, PFLayer::HCAL_ENDCAP, PFLayer::HF_EM, PFLayer::HF_HAD, CaloNavigator< T >::home(), i, reco::PFRecHit::layer(), north, CaloNavigator< T >::north(), PFLayer::PS1, PFLayer::PS2, DetId::rawId(), south, CaloNavigator< T >::south(), CaloNavigator< T >::west(), and west.
{ //cout<<"------PFRecHitProducerHcaL:findRecHitNeighbours navigation value "<<navigation_HF_<<endl; if(navigation_HF_ == false){ if( rh.layer() == PFLayer::HF_HAD ) return; if( rh.layer() == PFLayer::HF_EM ) return; } DetId detid( rh.detId() ); const CaloSubdetectorTopology* topology = 0; const CaloSubdetectorGeometry* geometry = 0; switch( rh.layer() ) { case PFLayer::ECAL_ENDCAP: topology = &endcapTopology; geometry = &endcapGeometry; break; case PFLayer::ECAL_BARREL: topology = &barrelTopology; geometry = &barrelGeometry; break; case PFLayer::HCAL_ENDCAP: topology = &endcapTopology; geometry = &endcapGeometry; break; case PFLayer::HCAL_BARREL1: topology = &barrelTopology; geometry = &barrelGeometry; break; case PFLayer::PS1: case PFLayer::PS2: topology = &barrelTopology; geometry = &barrelGeometry; break; default: assert(0); } assert( topology && geometry ); CaloNavigator<DetId> navigator(detid, topology); DetId north = navigator.north(); DetId northeast(0); if( north != DetId(0) ) { northeast = navigator.east(); } navigator.home(); DetId south = navigator.south(); DetId southwest(0); if( south != DetId(0) ) { southwest = navigator.west(); } navigator.home(); DetId east = navigator.east(); DetId southeast; if( east != DetId(0) ) { southeast = navigator.south(); } navigator.home(); DetId west = navigator.west(); DetId northwest; if( west != DetId(0) ) { northwest = navigator.north(); } navigator.home(); IDH i = sortedHits.find( north.rawId() ); if(i != sortedHits.end() ) rh.add4Neighbour( i->second ); i = sortedHits.find( northeast.rawId() ); if(i != sortedHits.end() ) rh.add8Neighbour( i->second ); i = sortedHits.find( south.rawId() ); if(i != sortedHits.end() ) rh.add4Neighbour( i->second ); i = sortedHits.find( southwest.rawId() ); if(i != sortedHits.end() ) rh.add8Neighbour( i->second ); i = sortedHits.find( east.rawId() ); if(i != sortedHits.end() ) rh.add4Neighbour( i->second ); i = sortedHits.find( southeast.rawId() ); if(i != sortedHits.end() ) rh.add8Neighbour( i->second ); i = sortedHits.find( west.rawId() ); if(i != sortedHits.end() ) rh.add4Neighbour( i->second ); i = sortedHits.find( northwest.rawId() ); if(i != sortedHits.end() ) rh.add8Neighbour( i->second ); }
Definition at line 63 of file PFRecHitProducerPS.h.
Referenced by PFRecHitProducerPS().