41 return (
id.
zside()>0)?(
id.ietaAbs()-29+13):(41-
id.ietaAbs());
43 static const double MCMaterialCorrections_3XX[] = { 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 };
49 bool usePMTflag,
bool usePulseflag,
bool forcePulseFlagMC,
int correctionSet){
53 m_usePMTFlag=usePMTflag;
54 m_usePulseFlag=usePulseflag;
57 m_correctionSet = correctionSet;
60 m_cutByEta.push_back(-1);
61 m_seedmnEta.push_back(99);
62 m_seedMXeta.push_back(-1);
65 double minphi=0.0872664*(
ii-1);
66 double maxphi=0.0872664*(
ii+1);
67 while (minphi < -
M_PI)
71 while (maxphi < -
M_PI)
77 m_seedmnPhi.push_back(minphi);
78 m_seedMXphi.push_back(maxphi);
82 for (
int ii=0;
ii<13*2;
ii++)
83 m_correctionByEta.push_back(1.0);
84 if (m_correctionSet==1) {
85 for (
int ii=0;
ii<13*2;
ii++)
97 std::vector<HFCompleteHit> protoseeds, seeds;
99 std::vector<HFCompleteHit>::iterator
i;
100 std::vector<HFCompleteHit>::iterator
k;
106 bool doCluster=
false;
108 for (j=hf.
begin(); j!= hf.
end(); j++) {
109 const int aieta=j->id().ietaAbs();
112 if (j->id().depth()!=1)
continue;
113 if (aieta==40 || aieta==41 || aieta==29)
continue;
117 edm::LogWarning(
"HFClusterAlgo") <<
"Strange invalid HF hit: " << j->id();
121 if (m_cutByEta[iz]<0) {
123 m_cutByEta[iz]=m_seedThreshold*cosh(eta);
127 if(fabs(CellCorners[
sc].z())<1200){
128 if(fabs(CellCorners[
sc].
eta())<m_seedmnEta[iz])m_seedmnEta[iz]=fabs(CellCorners[
sc].
eta());
129 if(fabs(CellCorners[
sc].
eta())>m_seedMXeta[iz])m_seedMXeta[iz]=fabs(CellCorners[
sc].
eta());
133 double elong=j->energy()*m_correctionByEta[
indexByEta(j->id())];
134 if (elong>m_cutByEta[iz]) {
136 double eshort=(j2==hf.
end())?(0):(j2->energy());
138 eshort*=m_correctionByEta[
indexByEta(j2->id())];
139 if (((elong-eshort)/(elong+eshort))>m_maximumSL)
continue;
142 if(isPMTHit(*j))
continue;
149 protoseeds.push_back(ahit);
153 if(!protoseeds.empty()){
155 for (i=protoseeds.begin(); i!= protoseeds.end(); i++) {
159 if ( (i==protoseeds.begin()) && (isok) ) {
163 for (k=seeds.begin(); isok && k!=seeds.end(); k++) {
165 for (dE=-2; dE<=2; dE++)
166 for (dP=-4;dP<=4; dP+=2) {
167 PWrap=k->id.iphi()+dP;
173 if ( (i->id.iphi()==PWrap) && (i->id.ieta()==k->id.ieta()+dE))
184 bool clusterOk=makeCluster( i->id(),
hf,
geom,clusShp,Sclus);
186 clusterShapes.push_back(clusShp);
187 SuperClusters.push_back(Sclus);
222 std::vector<double> coreCanid;
223 std::vector<double>::const_iterator ci;
225 std::vector<DetId> usedHits;
235 bool edge_type1=seedid.
ietaAbs()==39 && (seedid.
iphi()%4)==3;
237 double e_seed=si->energy()*m_correctionByEta[
indexByEta(si->id())];
239 for (de=-2; de<=2; de++)
240 for (dp=-4;dp<=4; dp+=2) {
241 phiWrap=seedid.
iphi()+dp;
249 if (edge_type1 && de==seedid.
zside()) {
272 if (il!=hf.
end()) e_long=il->energy()*m_correctionByEta[
indexByEta(il->id())];
273 if (e_long <= m_minTowerEnergy) e_long=0.0;
274 if (is!=hf.
end()) e_short=is->energy()*m_correctionByEta[
indexByEta(is->id())];
275 if (e_short <= m_minTowerEnergy) e_short=0.0;
276 double eRatio=(e_long-e_short)/
std::max(1.0,(e_long+e_short));
279 if ((
abs(eRatio) > m_maximumSL)&&(
std::max(e_long,e_short) > m_maximumRenergy)) {
280 if (dp==0 && de==0) clusterOk=
false;
284 if((il!=hf.
end())&&(isPMTHit(*il))){
285 if (dp==0 && de==0) clusterOk=
false;
293 if (e_long > m_minTowerEnergy && il!=hf.
end()) {
296 usedHits.push_back(idl.rawId());
300 if ((de>-2)&&(de<2)&&(dp>-4)&&(dp<4)) {
304 if ((dp==0)&&(de==0)) {
309 if ((de>-2)&&(de<2)&&(dp>-4)&&(dp<4)&&(e_long>(.5*e_seed))) {
310 coreCanid.push_back(e_long);
316 double d_p = p.
phi()-sp.
phi();
321 double d_e = p.
eta()-sp.
eta();
337 if (dp==0 && de==0) clusterOk=
false;
340 if (e_short > m_minTowerEnergy && is!=hf.
end()) {
342 usedHits.push_back(ids.rawId());
346 if ((de>-2)&&(de<2)&&(dp>-4)&&(dp<4)) {
350 if ((dp==0)&&(de==0)) {
357 if (!clusterOk)
return false;
360 std::sort(coreCanid.begin(), coreCanid.end(),
CompareHFCore());
361 for (ci=coreCanid.begin();ci!=coreCanid.end();ci++){
362 if(ci==coreCanid.begin()){
364 }
else if (*ci>.5*l_1e){
374 double eta=xyzclus.eta();
376 double phi=xyzclus.phi();
384 int idx= fabs(seedid.
ieta())-29;
385 int ipx=seedid.
iphi();
386 double Cphi =(phi-m_seedmnPhi[ipx])/(m_seedMXphi[ipx]-m_seedmnPhi[ipx]);
387 double Ceta=(fabs(eta)- m_seedmnEta[
idx])/(m_seedMXeta[idx]-m_seedmnEta[idx]);
390 HFEMClusterShape myClusShp(l_1, s_1, l_3, s_3, l_5,s_5, l_1e,Ceta, Cphi,seedid);
404 if (!(m_isMC && !m_forcePulseFlagMC))
412 m_cutByEta.push_back(-1);
413 m_seedmnEta.push_back(99);
414 m_seedMXeta.push_back(-1);
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< HFRecHit >::const_iterator const_iterator
std::vector< HFEMClusterShape > HFEMClusterShapeCollection
static const double MCMaterialCorrections_3XX[]
bool operator()(const HFClusterAlgo::HFCompleteHit &h1, const HFClusterAlgo::HFCompleteHit &h2) const
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
int ieta() const
get the cell ieta
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Abs< T >::type abs(const T &t)
int ietaAbs() const
get the absolute value of the cell ieta
const_iterator end() const
static int indexByEta(HcalDetId id)
int iphi() const
get the cell iphi
constexpr uint32_t flagField(int base, int width=1) const
bool operator()(const double c1, const double c2) const
XYZPointD XYZPoint
point in space with cartesian internal representation
iterator find(key_type k)
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
bool makeCluster(const HcalDetId &seedid, const HFRecHitCollection &hf, const CaloGeometry *geom, reco::HFEMClusterShape &clusShp, reco::SuperCluster &SClus)
bool isPMTHit(const HFRecHit &hfr)
void setup(double minTowerEnergy, double seedThreshold, double maximumSL, double m_maximumRenergy, bool usePMTflag, bool usePulseflag, bool forcePulseFlagMC, int correctionSet)
const_iterator begin() const