#include <RecoEcal/EgammaClusterAlgos/interface/IslandClusterAlgo.h>
Definition at line 27 of file IslandClusterAlgo.h.
IslandClusterAlgo::IslandClusterAlgo | ( | ) | [inline] |
IslandClusterAlgo::IslandClusterAlgo | ( | double | ebst, | |
double | ecst, | |||
const PositionCalc & | posCalc, | |||
VerbosityLevel | the_verbosity = pERROR | |||
) | [inline] |
Definition at line 37 of file IslandClusterAlgo.h.
References posCalculator_.
00037 : 00038 ecalBarrelSeedThreshold(ebst), ecalEndcapSeedThreshold(ecst), verbosity(the_verbosity) { 00039 posCalculator_ = posCalc; 00040 }
virtual IslandClusterAlgo::~IslandClusterAlgo | ( | ) | [inline, virtual] |
void IslandClusterAlgo::mainSearch | ( | const EcalRecHitCollection * | hits, | |
const CaloSubdetectorGeometry * | geometry_p, | |||
const CaloSubdetectorTopology * | topology_p, | |||
const CaloSubdetectorGeometry * | geometryES_p, | |||
EcalPart | ecalPart | |||
) | [private] |
Definition at line 105 of file IslandClusterAlgo.cc.
References GenMuonPlsPt100GeV_cfg::cout, current_v, lat::endl(), it, makeCluster(), pINFO, searchEast(), searchNorth(), searchSouth(), searchWest(), seeds, used_s, and verbosity.
Referenced by makeClusters().
00110 { 00111 if (verbosity < pINFO) 00112 { 00113 std::cout << "Building clusters............" << std::endl; 00114 } 00115 00116 // Loop over seeds: 00117 std::vector<EcalRecHit>::iterator it; 00118 for (it = seeds.begin(); it != seeds.end(); it++) 00119 { 00120 // make sure the current seed does not belong to a cluster already. 00121 if (used_s.find(it->id()) != used_s.end()) 00122 { 00123 if (it == seeds.begin()) 00124 { 00125 if (verbosity < pINFO) 00126 { 00127 std::cout << "##############################################################" << std::endl; 00128 std::cout << "DEBUG ALERT: Highest energy seed already belongs to a cluster!" << std::endl; 00129 std::cout << "##############################################################" << std::endl; 00130 } 00131 } 00132 continue; 00133 } 00134 00135 // clear the vector of hits in current cluster 00136 current_v.clear(); 00137 00138 current_v.push_back(it->id()); 00139 used_s.insert(it->id()); 00140 00141 // Create a navigator at the seed 00142 CaloNavigator<DetId> navigator(it->id(), topology_p); 00143 00144 searchNorth(navigator); 00145 navigator.home(); 00146 searchSouth(navigator); 00147 navigator.home(); 00148 searchWest(navigator, topology_p); 00149 navigator.home(); 00150 searchEast(navigator, topology_p); 00151 00152 makeCluster(hits,geometry_p,geometryES_p); 00153 } 00154 }
void IslandClusterAlgo::makeCluster | ( | const EcalRecHitCollection * | hits, | |
const CaloSubdetectorGeometry * | geometry_p, | |||
const CaloSubdetectorGeometry * | geometryES_p | |||
) | [private] |
Definition at line 265 of file IslandClusterAlgo.cc.
References PositionCalc::Calculate_Location(), clusters_v, GenMuonPlsPt100GeV_cfg::cout, current_v, lat::endl(), CaloRecHit::energy(), relval_parameters_module::energy, edm::SortedCollection< T, SORT >::find(), reco::island, it, pINFO, posCalculator_, and verbosity.
Referenced by mainSearch().
00268 { 00269 double energy = 0; 00270 double chi2 = 0; 00271 00272 Point position; 00273 position = posCalculator_.Calculate_Location(current_v,hits,geometry,geometryES); 00274 00275 std::vector<DetId>::iterator it; 00276 for (it = current_v.begin(); it != current_v.end(); it++) 00277 { 00278 EcalRecHitCollection::const_iterator itt = hits->find(*it); 00279 EcalRecHit hit_p = *itt; 00280 // if (hit_p != 0) 00281 // { 00282 energy += hit_p.energy(); 00283 // } 00284 // else 00285 // { 00286 // std::cout << "DEBUG ALERT: Requested rechit has gone missing from rechits map! :-S" << std::endl; 00287 // } 00288 chi2 += 0; 00289 } 00290 chi2 /= energy; 00291 00292 if (verbosity < pINFO) 00293 { 00294 std::cout << "******** NEW CLUSTER ********" << std::endl; 00295 std::cout << "No. of crystals = " << current_v.size() << std::endl; 00296 std::cout << " Energy = " << energy << std::endl; 00297 std::cout << " Phi = " << position.phi() << std::endl; 00298 std::cout << " Eta = " << position.eta() << std::endl; 00299 std::cout << "*****************************" << std::endl; 00300 } 00301 00302 clusters_v.push_back(reco::BasicCluster(energy, position, chi2, current_v, reco::island)); 00303 }
std::vector< reco::BasicCluster > IslandClusterAlgo::makeClusters | ( | const EcalRecHitCollection * | hits, | |
const CaloSubdetectorGeometry * | geometry, | |||
const CaloSubdetectorTopology * | topology_p, | |||
const CaloSubdetectorGeometry * | geometryES_p, | |||
EcalPart | ecalPart, | |||
bool | regional = false , |
|||
const std::vector< EcalEtaPhiRegion > & | regions = std::vector<EcalEtaPhiRegion>() | |||
) |
Definition at line 16 of file IslandClusterAlgo.cc.
References barrel, edm::SortedCollection< T, SORT >::begin(), clusters_v, GenMuonPlsPt100GeV_cfg::cout, ecalBarrelSeedThreshold, ecalEndcapSeedThreshold, edm::SortedCollection< T, SORT >::end(), endcap, lat::endl(), relval_parameters_module::energy, ET, CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), it, mainSearch(), pINFO, recHits_, seeds, funct::sin(), python::multivaluedict::sort(), PV3DBase< T, PVType, FrameType >::theta(), dimuonsSequences_cff::threshold, used_s, and verbosity.
Referenced by EgammaHLTIslandClusterProducer::clusterizeECALPart(), IslandClusterProducer::clusterizeECALPart(), and Pi0FixedMassWindowCalibration::duringLoop().
00024 { 00025 seeds.clear(); 00026 used_s.clear(); 00027 clusters_v.clear(); 00028 00029 recHits_ = hits; 00030 00031 double threshold = 0; 00032 std::string ecalPart_string; 00033 if (ecalPart == endcap) 00034 { 00035 threshold = ecalEndcapSeedThreshold; 00036 ecalPart_string = "EndCap"; 00037 } 00038 if (ecalPart == barrel) 00039 { 00040 threshold = ecalBarrelSeedThreshold; 00041 ecalPart_string = "Barrel"; 00042 } 00043 00044 if (verbosity < pINFO) 00045 { 00046 std::cout << "-------------------------------------------------------------" << std::endl; 00047 std::cout << "Island algorithm invoked for ECAL" << ecalPart_string << std::endl; 00048 std::cout << "Looking for seeds, energy threshold used = " << threshold << " GeV" <<std::endl; 00049 } 00050 00051 int nregions=0; 00052 if(regional) nregions=regions.size(); 00053 00054 if(!regional || nregions) { 00055 00056 EcalRecHitCollection::const_iterator it; 00057 for(it = hits->begin(); it != hits->end(); it++) 00058 { 00059 double energy = it->energy(); 00060 if (energy < threshold) continue; // need to check to see if this line is useful! 00061 00062 const CaloCellGeometry *thisCell = geometry_p->getGeometry(it->id()); 00063 GlobalPoint position = thisCell->getPosition(); 00064 00065 // Require that RecHit is within clustering region in case 00066 // of regional reconstruction 00067 bool withinRegion = false; 00068 if (regional) { 00069 std::vector<EcalEtaPhiRegion>::const_iterator region; 00070 for (region=regions.begin(); region!=regions.end(); region++) { 00071 if (region->inRegion(position)) { 00072 withinRegion = true; 00073 break; 00074 } 00075 } 00076 } 00077 00078 if (!regional || withinRegion) { 00079 float ET = it->energy() * sin(position.theta()); 00080 if (ET > threshold) seeds.push_back(*it); 00081 } 00082 } 00083 00084 } 00085 00086 sort(seeds.begin(), seeds.end(), EcalRecHitLess()); 00087 00088 if (verbosity < pINFO) 00089 { 00090 std::cout << "Total number of seeds found in event = " << seeds.size() << std::endl; 00091 } 00092 00093 mainSearch(hits,geometry_p,topology_p,geometryES_p,ecalPart); 00094 sort(clusters_v.rbegin(), clusters_v.rend(), ClusterEtLess()); 00095 00096 if (verbosity < pINFO) 00097 { 00098 std::cout << "---------- end of main search. clusters have been sorted ----" << std::endl; 00099 } 00100 00101 return clusters_v; 00102 }
void IslandClusterAlgo::searchEast | ( | const CaloNavigator< DetId > & | navigator, | |
const CaloSubdetectorTopology * | topology | |||
) | [private] |
Definition at line 225 of file IslandClusterAlgo.cc.
References current_v, CaloNavigator< T >::east(), edm::SortedCollection< T, SORT >::find(), CaloNavigator< T >::home(), CaloNavigator< T >::pos(), recHits_, searchNorth(), searchSouth(), shouldBeAdded(), and used_s.
Referenced by mainSearch().
00226 { 00227 DetId western = navigator.pos(); 00228 EcalRecHitCollection::const_iterator western_it = recHits_->find(western); 00229 00230 DetId eastern = navigator.east(); 00231 if (eastern == DetId(0)) return; // This means that we went off the ECAL! 00232 EcalRecHitCollection::const_iterator eastern_it = recHits_->find(eastern); 00233 00234 if (shouldBeAdded(eastern_it, western_it)) 00235 { 00236 CaloNavigator<DetId> nsNavigator(eastern, topology); 00237 00238 searchNorth(nsNavigator); 00239 nsNavigator.home(); 00240 searchSouth(nsNavigator); 00241 nsNavigator.home(); 00242 searchEast(navigator, topology); 00243 00244 current_v.push_back(eastern); 00245 used_s.insert(eastern); 00246 } 00247 }
void IslandClusterAlgo::searchNorth | ( | const CaloNavigator< DetId > & | navigator | ) | [private] |
Definition at line 157 of file IslandClusterAlgo.cc.
References current_v, edm::SortedCollection< T, SORT >::find(), CaloNavigator< T >::north(), CaloNavigator< T >::pos(), recHits_, shouldBeAdded(), and used_s.
Referenced by mainSearch(), searchEast(), and searchWest().
00158 { 00159 DetId southern = navigator.pos(); 00160 00161 DetId northern = navigator.north(); 00162 if (northern == DetId(0)) return; // This means that we went off the ECAL! 00163 // if the crystal to the north belongs to another cluster return 00164 if (used_s.find(northern) != used_s.end()) return; 00165 00166 00167 EcalRecHitCollection::const_iterator southern_it = recHits_->find(southern); 00168 EcalRecHitCollection::const_iterator northern_it = recHits_->find(northern); 00169 00170 if (shouldBeAdded(northern_it, southern_it)) 00171 { 00172 current_v.push_back(northern); 00173 used_s.insert(northern); 00174 searchNorth(navigator); 00175 } 00176 }
void IslandClusterAlgo::searchSouth | ( | const CaloNavigator< DetId > & | navigator | ) | [private] |
Definition at line 179 of file IslandClusterAlgo.cc.
References current_v, edm::SortedCollection< T, SORT >::find(), CaloNavigator< T >::pos(), recHits_, shouldBeAdded(), CaloNavigator< T >::south(), and used_s.
Referenced by mainSearch(), searchEast(), and searchWest().
00180 { 00181 DetId northern = navigator.pos(); 00182 00183 DetId southern = navigator.south(); 00184 if (southern == DetId(0)) return; // This means that we went off the ECAL! 00185 if (used_s.find(southern) != used_s.end()) return; 00186 00187 00188 EcalRecHitCollection::const_iterator northern_it = recHits_->find(northern); 00189 EcalRecHitCollection::const_iterator southern_it = recHits_->find(southern); 00190 00191 if (shouldBeAdded(southern_it, northern_it)) 00192 { 00193 current_v.push_back(southern); 00194 used_s.insert(southern); 00195 searchSouth(navigator); 00196 } 00197 }
void IslandClusterAlgo::searchWest | ( | const CaloNavigator< DetId > & | navigator, | |
const CaloSubdetectorTopology * | topology | |||
) | [private] |
Definition at line 200 of file IslandClusterAlgo.cc.
References current_v, edm::SortedCollection< T, SORT >::find(), CaloNavigator< T >::home(), CaloNavigator< T >::pos(), recHits_, searchNorth(), searchSouth(), shouldBeAdded(), used_s, and CaloNavigator< T >::west().
Referenced by mainSearch().
00201 { 00202 DetId eastern = navigator.pos(); 00203 EcalRecHitCollection::const_iterator eastern_it = recHits_->find(eastern); 00204 00205 DetId western = navigator.west(); 00206 if (western == DetId(0)) return; // This means that we went off the ECAL! 00207 EcalRecHitCollection::const_iterator western_it = recHits_->find(western); 00208 00209 if (shouldBeAdded(western_it, eastern_it)) 00210 { 00211 CaloNavigator<DetId> nsNavigator(western, topology); 00212 00213 searchNorth(nsNavigator); 00214 nsNavigator.home(); 00215 searchSouth(nsNavigator); 00216 nsNavigator.home(); 00217 searchWest(navigator, topology); 00218 00219 current_v.push_back(western); 00220 used_s.insert(western); 00221 } 00222 }
void IslandClusterAlgo::setVerbosity | ( | VerbosityLevel | the_verbosity | ) | [inline] |
Definition at line 46 of file IslandClusterAlgo.h.
References verbosity.
00047 { 00048 verbosity = the_verbosity; 00049 }
bool IslandClusterAlgo::shouldBeAdded | ( | EcalRecHitCollection::const_iterator | candidate_it, | |
EcalRecHitCollection::const_iterator | previous_it | |||
) | [private] |
Definition at line 251 of file IslandClusterAlgo.cc.
References edm::SortedCollection< T, SORT >::end(), recHits_, and used_s.
Referenced by searchEast(), searchNorth(), searchSouth(), and searchWest().
00252 { 00253 // crystal should not be included... 00254 if ( (candidate_it == recHits_->end()) || // ...if it does not correspond to a hit 00255 (used_s.find(candidate_it->id()) != used_s.end()) || // ...if it already belongs to a cluster 00256 (candidate_it->energy() <= 0) || // ...if it has a negative or zero energy 00257 (candidate_it->energy() > previous_it->energy())) // ...or if the previous crystal had lower E 00258 { 00259 return false; 00260 } 00261 return true; 00262 }
std::vector<reco::BasicCluster> IslandClusterAlgo::clusters_v [private] |
std::vector<DetId> IslandClusterAlgo::current_v [private] |
Definition at line 83 of file IslandClusterAlgo.h.
Referenced by mainSearch(), makeCluster(), searchEast(), searchNorth(), searchSouth(), and searchWest().
double IslandClusterAlgo::ecalBarrelSeedThreshold [private] |
double IslandClusterAlgo::ecalEndcapSeedThreshold [private] |
Definition at line 66 of file IslandClusterAlgo.h.
Referenced by IslandClusterAlgo(), and makeCluster().
const EcalRecHitCollection* IslandClusterAlgo::recHits_ [private] |
Definition at line 74 of file IslandClusterAlgo.h.
Referenced by makeClusters(), searchEast(), searchNorth(), searchSouth(), searchWest(), and shouldBeAdded().
std::vector<EcalRecHit> IslandClusterAlgo::seeds [private] |
std::set<DetId> IslandClusterAlgo::used_s [private] |
Definition at line 80 of file IslandClusterAlgo.h.
Referenced by mainSearch(), makeClusters(), searchEast(), searchNorth(), searchSouth(), searchWest(), and shouldBeAdded().
VerbosityLevel IslandClusterAlgo::verbosity [private] |
Definition at line 89 of file IslandClusterAlgo.h.
Referenced by mainSearch(), makeCluster(), makeClusters(), and setVerbosity().