#include <RecoEgamma/EgammaHFProducers/interface/HFClusterAlgo.h>
Public Member Functions | |
void | clusterize (const HFRecHitCollection &hf, const CaloGeometry &geom, reco::HFEMClusterShapeCollection &clusters, reco::BasicClusterCollection &BasicClusters, reco::SuperClusterCollection &SuperClusters) |
Analyze the hits. | |
HFClusterAlgo () | |
void | setup (double minTowerEnergy) |
Private Member Functions | |
void | makeCluster (const HcalDetId &seedid, const HFRecHitCollection &hf, const CaloGeometry &geom, reco::HFEMClusterShape &clusShp, reco::BasicCluster &Bclus, reco::SuperCluster &SClus) |
Private Attributes | |
double | m_minTowerEnergy |
Friends | |
class | CompareHFCompleteHitET |
class | CompareHFCore |
Classes | |
struct | HFCompleteHit |
Klapoetke -- Minnesota
$Id:version 1.2
Definition at line 22 of file HFClusterAlgo.h.
HFClusterAlgo::HFClusterAlgo | ( | ) |
void HFClusterAlgo::clusterize | ( | const HFRecHitCollection & | hf, | |
const CaloGeometry & | geom, | |||
reco::HFEMClusterShapeCollection & | clusters, | |||
reco::BasicClusterCollection & | BasicClusters, | |||
reco::SuperClusterCollection & | SuperClusters | |||
) |
Analyze the hits.
Definition at line 41 of file HFClusterAlgo.cc.
References edm::SortedCollection< T, SORT >::begin(), CompareHFCompleteHitET, edm::SortedCollection< T, SORT >::end(), HFClusterAlgo::HFCompleteHit::energy, HFClusterAlgo::HFCompleteHit::et, eta, CaloGeometry::getPosition(), i, HFClusterAlgo::HFCompleteHit::id, j, k, makeCluster(), and python::multivaluedict::sort().
Referenced by HFEMClusterProducer::produce().
00045 { 00046 00047 std::vector<HFCompleteHit> hits, seeds; 00048 HFRecHitCollection::const_iterator j; 00049 std::vector<HFCompleteHit>::iterator i; 00050 std::vector<HFCompleteHit>::iterator k; 00051 int dP, dE, PWrap; 00052 bool isok=true; 00053 HFEMClusterShape clusShp; 00054 BasicCluster Bclus; 00055 SuperCluster Sclus; 00056 bool doCluster=false; 00057 for (j=hf.begin(); j!= hf.end(); j++) { 00058 HFCompleteHit ahit; 00059 ahit.id=j->id(); 00060 ahit.energy=j->energy(); 00061 double eta=geom.getPosition(j->id()).eta(); 00062 ahit.et=ahit.energy/cosh(eta); 00063 00064 hits.push_back(ahit); 00065 } 00066 00067 std::sort(hits.begin(), hits.end(), CompareHFCompleteHitET()); 00068 for (i=hits.begin(); i!= hits.end(); i++) { 00069 00070 if (i->et > 10) { 00071 if ((i->id.ietaAbs()==40)||(i->id.ietaAbs()==41)||(i->id.ietaAbs()==29)||(i->id.depth()!=1)) 00072 isok = false; 00073 00074 if ( (i==hits.begin()) && (isok) ) { 00075 doCluster=true; 00076 // seeds.push_back(*i); 00077 // makeCluster( i->id(),hf, geom,clusShp,Bclus,Sclus); 00078 // clusterShapes.push_back(clusShp); 00079 // BasicClusters.push_back(Bclus); 00080 // SuperClusters.push_back(Sclus); 00081 //clusterAsoc.insert(SuperClusters,clusterShapes); 00082 00083 } 00084 else { 00085 for (k=seeds.begin(); isok && k!=seeds.end(); k++) { //i->hits, k->seeds 00086 00087 for (dE=-2; dE<=2; dE++) 00088 for (dP=-4;dP<=4; dP+=2) { 00089 PWrap=k->id.iphi()+dP; 00090 if (PWrap<0) 00091 PWrap+=72; 00092 if (PWrap>72) 00093 PWrap-=72; 00094 00095 if ( (i->id.iphi()==PWrap) && (i->id.ieta()==k->id.ieta()+dE)) 00096 isok = false; 00097 } 00098 } 00099 if (isok) { 00100 doCluster=true; 00101 } 00102 } 00103 if (doCluster) { 00104 seeds.push_back(*i); 00105 makeCluster( i->id(),hf, geom,clusShp,Bclus,Sclus); 00106 00107 clusterShapes.push_back(clusShp); 00108 BasicClusters.push_back(Bclus); 00109 SuperClusters.push_back(Sclus); 00110 00111 // clusterAssoc.insert(edm::Ref<SuperClusterCollection>(SuperClusters,where), 00112 // edm::Ref<HFEMClusterShapeCollection>(clusterShapes,where)); 00113 00114 } 00115 00116 } 00117 // clusterAsoc.insert(SuperClusters,clusters); 00118 } 00119 }
void HFClusterAlgo::makeCluster | ( | const HcalDetId & | seedid, | |
const HFRecHitCollection & | hf, | |||
const CaloGeometry & | geom, | |||
reco::HFEMClusterShape & | clusShp, | |||
reco::BasicCluster & | Bclus, | |||
reco::SuperCluster & | SClus | |||
) | [private] |
Definition at line 121 of file HFClusterAlgo.cc.
References CompareHFCore, edm::SortedCollection< T, SORT >::end(), eta, PV3DBase< T, PVType, FrameType >::eta(), edm::SortedCollection< T, SORT >::find(), CaloGeometry::getPosition(), HcalForward, reco::hybrid, i, id, HcalDetId::ieta(), HcalDetId::ietaAbs(), HcalDetId::iphi(), funct::log(), ls, m_minTowerEnergy, p, PV3DBase< T, PVType, FrameType >::phi(), phi, python::multivaluedict::sort(), w, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and HcalDetId::zside().
Referenced by clusterize().
00126 { 00127 00128 00129 double w=0;//sum over all log E's 00130 double wgt=0; 00131 double w_e=0;//sum over ieat*energy 00132 double w_x=0; 00133 double w_y=0; 00134 double w_z=0; 00135 double wp_e=0;//sum over iphi*energy 00136 double e_e=0;//nonwieghted eta sum 00137 double e_ep=0; //nonweighted phi sum 00138 double sum_energy=0; 00139 double l_3=0;//sum for enenergy in 3x3 long fibers etc. 00140 double s_3=0; 00141 double l_5=0; 00142 double s_5=0; 00143 double l_1=0; 00144 double s_1=0; 00145 int de, dp, ls, phiWrap; 00146 double l_1e=0; 00147 GlobalPoint sp=geom.getPosition(seedid); 00148 std::vector<double> coreCanid; 00149 std::vector<double>::const_iterator ci; 00150 HFRecHitCollection::const_iterator i; 00151 std::vector<DetId> usedHits; 00152 00153 HFRecHitCollection::const_iterator si; 00154 HcalDetId sid(HcalForward,seedid.ieta(),seedid.iphi(),1); 00155 si=hf.find(sid); 00156 00157 // lots happens here 00158 // edge type 1 has 40/41 in 3x3 and 5x5 00159 bool edge_type1=seedid.ietaAbs()==39 && (seedid.iphi()%4)==3; 00160 00161 for (de=-2; de<=2; de++) 00162 for (dp=-4;dp<=4; dp+=2) { 00163 phiWrap=seedid.iphi()+dp; 00164 if (phiWrap<0) 00165 phiWrap+=72; 00166 if (phiWrap>72) 00167 phiWrap-=72; 00168 00169 for (ls=1;ls<=2; ls++){ 00170 00171 /* Handling of phi-width change problems */ 00172 if (edge_type1 && de==seedid.zside()) 00173 if (dp==-2) { // we want it in the 3x3 00174 phiWrap-=2; 00175 if (phiWrap<0) phiWrap+=72; 00176 } else if (dp==-4) continue; // but not double counted in 5x5 00177 00178 HcalDetId id(HcalForward,seedid.ieta()+de,phiWrap,ls); 00179 i=hf.find(id); 00180 00181 DetId Did(id.rawId()); 00182 usedHits.push_back(Did); 00183 00184 if (i==hf.end()) continue; 00185 if (i->energy()> m_minTowerEnergy){ 00186 if (ls==1) { 00187 l_5+=i->energy(); 00188 } 00189 00190 if ((ls==1)&&(de>-2)&&(de<2)&&(dp>-4)&&(dp<4)) { 00191 l_3+=i->energy(); 00192 } 00193 if ((ls==1)&&(dp==0)&&(de==0)) { 00194 l_1=i->energy(); 00195 } 00196 if (ls==2) { 00197 s_5+=i->energy(); 00198 } 00199 if ((ls==2)&&(de>-2)&&(de<2)&&(dp>-4)&&(dp<4)) { 00200 s_3+=i->energy(); 00201 } 00202 if ((ls==2)&&(dp==0)&&(de==0)) { 00203 s_1=i->energy(); 00204 } 00205 if ((ls==1)&&(de>-2)&&(de<2)&&(dp>-4)&&(dp<4)&&(i->energy()>(.5*si->energy()))) { 00206 coreCanid.push_back(i->energy()); 00207 } 00208 00209 00210 GlobalPoint p=geom.getPosition(id); 00211 00212 double d_p = p.phi()-sp.phi(); 00213 while (d_p < -M_PI) 00214 d_p+=2*M_PI; 00215 while (d_p > M_PI) 00216 d_p-=2*M_PI; 00217 double d_e = p.eta()-sp.eta(); 00218 if((de>-2)&&(de<2)&&(dp>-4)&&(dp<4)/*&&(ls==1)*/ && i->energy()>0) {//long only 00219 wgt=log((i->energy())); 00220 if (wgt>0){ 00221 w+=wgt; 00222 w_e+=(d_e)*wgt; 00223 wp_e+=(d_p)*wgt; 00224 e_e+=d_e; 00225 e_ep+=d_p; 00226 sum_energy+=i->energy(); 00227 w_x+=(p.x())*wgt;//(p.x()-sp.x())*wgt; 00228 w_y+=(p.y())*wgt; 00229 w_z+=(p.z())*wgt; 00230 } 00231 } 00232 } 00233 } 00234 } 00235 //Core sorting done here 00236 std::sort(coreCanid.begin(), coreCanid.end(), CompareHFCore()); 00237 for (ci=coreCanid.begin();ci!=coreCanid.end();ci++){ 00238 if(ci==coreCanid.begin()){ 00239 l_1e=*ci; 00240 }else if (*ci>.5*l_1e){ 00241 l_1e+=*ci; 00242 } 00243 }//core sorting end 00244 00245 double z_=w_z/w; //w_z/w+sp.z(); if changed to delta z style 00246 double x_=w_x/w; 00247 double y_=w_y/w; 00248 00249 double eta=w_e/w+sp.eta(); 00250 00251 double phi=(wp_e/w)+sp.phi(); 00252 00253 while (phi < -M_PI) 00254 phi+=2*M_PI; 00255 while (phi > M_PI) 00256 phi-=2*M_PI; 00257 00258 double HFEtaBounds[14] = {2.853, 2.964, 3.139, 3.314, 3.489, 3.664, 3.839, 4.013, 4.191, 4.363, 4.538, 4.716, 4.889, 5.191}; 00259 double RcellEta = eta; 00260 double Cphi = (phi>0.)?(fmod((phi),0.087*2)/(0.087*2)):((fmod((phi),0.087*2)/(0.087*2))+1.0); 00261 double Rbin = -1.0; 00262 for (int icell = 0; icell < 12; icell++ ){ 00263 if ( (RcellEta>HFEtaBounds[icell]) && (RcellEta<HFEtaBounds[icell+1]) ) 00264 Rbin = (RcellEta - HFEtaBounds[icell])/(HFEtaBounds[icell+1] - HFEtaBounds[icell]); 00265 } 00266 double Ceta=Rbin; 00267 00268 while (phi< -M_PI) 00269 phi+=2*M_PI; 00270 while (phi > M_PI) 00271 phi-=2*M_PI; 00272 00273 00274 math::XYZPoint xyzclus(x_,y_,z_); 00275 00276 double chi2=-1; 00277 AlgoId algoID = hybrid; 00278 //return HFEMClusterShape, BasicCluster, SuperCluster 00279 00280 HFEMClusterShape myClusShp(l_1, s_1, l_3, s_3, l_5,s_5, l_1e,Ceta, Cphi,seedid); 00281 00282 clusShp = myClusShp; 00283 00284 BasicCluster MyBclus(l_3,xyzclus,chi2,usedHits,algoID); 00285 Bclus=MyBclus; 00286 00287 00288 SuperCluster MySclus(l_3,xyzclus); 00289 Sclus=MySclus; 00290 00291 }
void HFClusterAlgo::setup | ( | double | minTowerEnergy | ) |
Definition at line 35 of file HFClusterAlgo.cc.
References m_minTowerEnergy.
Referenced by HFEMClusterProducer::HFEMClusterProducer().
00035 { 00036 00037 m_minTowerEnergy=minTowerEnergy; 00038 }
friend class CompareHFCompleteHitET [friend] |
friend class CompareHFCore [friend] |
double HFClusterAlgo::m_minTowerEnergy [private] |