40 return (
id.zside()>0)?(
id.ietaAbs()-29+13):(41-
id.ietaAbs());
43 static const double MCMaterialCorrections[] = { 1.000,1.000,1.105,0.970,0.965,0.975,0.956,0.958,0.981,1.005,0.986,1.086,1.000,
44 1.000,1.086,0.986,1.005,0.981,0.958,0.956,0.975,0.965,0.970,1.105,1.000,1.000 };
46 static const double ZplusMC2010Corrections[] = { 1.0, 1.0, 1.075, 0.902, 0.983, 0.992, 0.948, 0.941, 0.975, 0.990, 0.988, 1.086, 1.0,
47 1.0, 1.126, 0.959, 0.979, 0.989, 0.959, 0.901, 0.937, 0.962, 0.967, 1.006, 1.0, 1.0};
51 void HFClusterAlgo::setup(
double minTowerEnergy,
double seedThreshold,
double maximumSL,
double maximumRenergy,
52 bool usePMTflag,
bool usePulseflag,
bool forcePulseFlagMC,
int correctionSet){
53 m_seedThreshold=seedThreshold;
54 m_minTowerEnergy=minTowerEnergy;
55 m_maximumSL=maximumSL;
56 m_usePMTFlag=usePMTflag;
57 m_usePulseFlag=usePulseflag;
58 m_forcePulseFlagMC=forcePulseFlagMC;
59 m_maximumRenergy=maximumRenergy;
60 m_correctionSet = correctionSet;
62 for(
int ii=0;ii<13;ii++){
63 m_cutByEta.push_back(-1);
67 for (
int ii=0; ii<13*2; ii++)
68 m_correctionByEta.push_back(1.0);
70 if (m_correctionSet==1) {
71 for (
int ii=0; ii<13*2; ii++)
74 if (m_correctionSet==2) {
75 for (
int ii=0; ii<13*2; ii++)
87 std::vector<HFCompleteHit> protoseeds, seeds;
89 std::vector<HFCompleteHit>::iterator
i;
90 std::vector<HFCompleteHit>::iterator
k;
98 for (j=hf.
begin(); j!= hf.
end(); j++) {
99 const int aieta=j->id().ietaAbs();
102 if (j->id().depth()!=1)
continue;
103 if (aieta==40 || aieta==41 || aieta==29)
continue;
107 edm::LogWarning(
"HFClusterAlgo") <<
"Strange invalid HF hit: " << j->id();
111 if (m_cutByEta[iz]<0) {
113 m_cutByEta[iz]=m_seedThreshold*cosh(eta);
115 double elong=j->energy()*m_correctionByEta[
indexByEta(j->id())];
116 if (elong>m_cutByEta[iz]) {
118 double eshort=(j2==hf.
end())?(0):(j2->energy());
120 eshort*=m_correctionByEta[
indexByEta(j2->id())];
121 if (((elong-eshort)/(elong+eshort))>m_maximumSL)
continue;
124 if(isPMTHit(*j))
continue;
131 protoseeds.push_back(ahit);
135 if(!protoseeds.empty()){
137 for (i=protoseeds.begin(); i!= protoseeds.end(); i++) {
141 if ( (i==protoseeds.begin()) && (isok) ) {
145 for (k=seeds.begin(); isok && k!=seeds.end(); k++) {
147 for (dE=-2; dE<=2; dE++)
148 for (dP=-4;dP<=4; dP+=2) {
149 PWrap=k->id.iphi()+dP;
155 if ( (i->id.iphi()==PWrap) && (i->id.ieta()==k->id.ieta()+dE))
166 bool clusterOk=makeCluster( i->id(),hf,
geom,clusShp,Sclus);
168 clusterShapes.push_back(clusShp);
169 SuperClusters.push_back(Sclus);
204 std::vector<double> coreCanid;
205 std::vector<double>::const_iterator ci;
207 std::vector<DetId> usedHits;
217 bool edge_type1=seedid.
ietaAbs()==39 && (seedid.
iphi()%4)==3;
219 double e_seed=si->energy()*m_correctionByEta[
indexByEta(si->id())];
221 for (de=-2; de<=2; de++)
222 for (dp=-4;dp<=4; dp+=2) {
223 phiWrap=seedid.
iphi()+dp;
231 if (edge_type1 && de==seedid.
zside()) {
254 if (il!=hf.
end()) e_long=il->energy()*m_correctionByEta[
indexByEta(il->id())];
255 if (e_long <= m_minTowerEnergy) e_long=0.0;
256 if (is!=hf.
end()) e_short=is->energy()*m_correctionByEta[
indexByEta(is->id())];
257 if (e_short <= m_minTowerEnergy) e_short=0.0;
258 double eRatio=(e_long-e_short)/
std::max(1.0,(e_long+e_short));
261 if ((
abs(eRatio) > m_maximumSL)&&(
std::max(e_long,e_short) > m_maximumRenergy)) {
262 if (dp==0 && de==0) clusterOk=
false;
266 if((il!=hf.
end())&&(isPMTHit(*il))){
267 if (dp==0 && de==0) clusterOk=
false;
291 if (e_long > m_minTowerEnergy && il!=hf.
end()) {
294 usedHits.push_back(idl.rawId());
298 if ((de>-2)&&(de<2)&&(dp>-4)&&(dp<4)) {
302 if ((dp==0)&&(de==0)) {
307 if ((de>-2)&&(de<2)&&(dp>-4)&&(dp<4)&&(e_long>(.5*e_seed))) {
308 coreCanid.push_back(e_long);
314 double d_p = p.
phi()-sp.
phi();
319 double d_e = p.
eta()-sp.
eta();
334 if (dp==0 && de==0) clusterOk=
false;
337 if (e_short > m_minTowerEnergy && is!=hf.
end()) {
339 usedHits.push_back(ids.rawId());
343 if ((de>-2)&&(de<2)&&(dp>-4)&&(dp<4)) {
347 if ((dp==0)&&(de==0)) {
354 if (!clusterOk)
return false;
358 for (ci=coreCanid.begin();ci!=coreCanid.end();ci++){
359 if(ci==coreCanid.begin()){
361 }
else if (*ci>.5*l_1e){
371 double eta=w_e/w+sp.
eta();
381 static const 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};
382 double RcellEta = fabs(eta);
383 double Cphi = (phi>0.)?(fmod((phi),0.087*2)/(0.087*2)):((fmod((phi),0.087*2)/(0.087*2))+1.0);
385 for (
int icell = 0; icell < 12; icell++ ){
386 if ( (RcellEta>HFEtaBounds[icell]) && (RcellEta<HFEtaBounds[icell+1]) )
387 Rbin = (RcellEta - HFEtaBounds[icell])/(HFEtaBounds[icell+1] - HFEtaBounds[icell]);
400 HFEMClusterShape myClusShp(l_1, s_1, l_3, s_3, l_5,s_5, l_1e,Ceta, Cphi,seedid);
414 if (!(m_isMC && !m_forcePulseFlagMC))
void clusterize(const HFRecHitCollection &hf, const CaloGeometry &geom, reco::HFEMClusterShapeCollection &clusters, reco::SuperClusterCollection &SuperClusters)
int zside() const
get the z-side of the cell (1/-1)
Geom::Phi< T > phi() const
std::vector< T >::const_iterator const_iterator
std::vector< HFEMClusterShape > HFEMClusterShapeCollection
static const double MCMaterialCorrections[]
bool makeCluster(const HcalDetId &seedid, const HFRecHitCollection &hf, const CaloGeometry &geom, reco::HFEMClusterShape &clusShp, reco::SuperCluster &SClus)
bool operator()(const HFClusterAlgo::HFCompleteHit &h1, const HFClusterAlgo::HFCompleteHit &h2) const
const T & max(const T &a, const T &b)
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
int ieta() const
get the cell ieta
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
int ietaAbs() const
get the absolute value of the cell ieta
const_iterator end() const
static int indexByEta(HcalDetId id)
static const double ZplusMC2010Corrections[]
int iphi() const
get the cell iphi
bool operator()(const double c1, const double c2) const
XYZPointD XYZPoint
point in space with cartesian internal representation
iterator find(key_type k)
bool isPMTHit(const HFRecHit &hfr)
void setup(double minTowerEnergy, double seedThreshold, double maximumSL, double m_maximumRenergy, bool usePMTflag, bool usePulseflag, bool forcePulseFlagMC, int correctionSet)
uint32_t flagField(int base, int width=1) const
const_iterator begin() const