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 };
48 void HFClusterAlgo::setup(
double minTowerEnergy,
double seedThreshold,
double maximumSL,
double maximumRenergy,
49 bool usePMTflag,
bool usePulseflag,
bool forcePulseFlagMC,
int correctionSet){
50 m_seedThreshold=seedThreshold;
51 m_minTowerEnergy=minTowerEnergy;
52 m_maximumSL=maximumSL;
53 m_usePMTFlag=usePMTflag;
54 m_usePulseFlag=usePulseflag;
55 m_forcePulseFlagMC=forcePulseFlagMC;
56 m_maximumRenergy=maximumRenergy;
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++)
96 std::vector<HFCompleteHit> protoseeds, seeds;
98 std::vector<HFCompleteHit>::iterator
i;
99 std::vector<HFCompleteHit>::iterator
k;
105 bool doCluster=
false;
107 for (j=hf.
begin(); j!= hf.
end(); j++) {
108 const int aieta=j->id().ietaAbs();
111 if (j->id().depth()!=1)
continue;
112 if (aieta==40 || aieta==41 || aieta==29)
continue;
116 edm::LogWarning(
"HFClusterAlgo") <<
"Strange invalid HF hit: " << j->id();
120 if (m_cutByEta[iz]<0) {
122 m_cutByEta[iz]=m_seedThreshold*cosh(eta);
125 for(
size_t sc=0;sc<CellCorners.
size();sc++){
126 if(fabs(CellCorners[sc].
z())<1200){
127 if(fabs(CellCorners[sc].
eta())<m_seedmnEta[iz])m_seedmnEta[iz]=fabs(CellCorners[sc].
eta());
128 if(fabs(CellCorners[sc].
eta())>m_seedMXeta[iz])m_seedMXeta[iz]=fabs(CellCorners[sc].
eta());
132 double elong=j->energy()*m_correctionByEta[
indexByEta(j->id())];
133 if (elong>m_cutByEta[iz]) {
135 double eshort=(j2==hf.
end())?(0):(j2->energy());
137 eshort*=m_correctionByEta[
indexByEta(j2->id())];
138 if (((elong-eshort)/(elong+eshort))>m_maximumSL)
continue;
141 if(isPMTHit(*j))
continue;
148 protoseeds.push_back(ahit);
152 if(!protoseeds.empty()){
154 for (i=protoseeds.begin(); i!= protoseeds.end(); i++) {
158 if ( (i==protoseeds.begin()) && (isok) ) {
162 for (k=seeds.begin(); isok && k!=seeds.end(); k++) {
164 for (dE=-2; dE<=2; dE++)
165 for (dP=-4;dP<=4; dP+=2) {
166 PWrap=k->id.iphi()+dP;
172 if ( (i->id.iphi()==PWrap) && (i->id.ieta()==k->id.ieta()+dE))
183 bool clusterOk=makeCluster( i->id(),hf,
geom,clusShp,Sclus);
185 clusterShapes.push_back(clusShp);
186 SuperClusters.push_back(Sclus);
221 std::vector<double> coreCanid;
222 std::vector<double>::const_iterator ci;
224 std::vector<DetId> usedHits;
234 bool edge_type1=seedid.
ietaAbs()==39 && (seedid.
iphi()%4)==3;
236 double e_seed=si->energy()*m_correctionByEta[
indexByEta(si->id())];
238 for (de=-2; de<=2; de++)
239 for (dp=-4;dp<=4; dp+=2) {
240 phiWrap=seedid.
iphi()+dp;
248 if (edge_type1 && de==seedid.
zside()) {
271 if (il!=hf.
end()) e_long=il->energy()*m_correctionByEta[
indexByEta(il->id())];
272 if (e_long <= m_minTowerEnergy) e_long=0.0;
273 if (is!=hf.
end()) e_short=is->energy()*m_correctionByEta[
indexByEta(is->id())];
274 if (e_short <= m_minTowerEnergy) e_short=0.0;
275 double eRatio=(e_long-e_short)/
std::max(1.0,(e_long+e_short));
278 if ((
abs(eRatio) > m_maximumSL)&&(
std::max(e_long,e_short) > m_maximumRenergy)) {
279 if (dp==0 && de==0) clusterOk=
false;
283 if((il!=hf.
end())&&(isPMTHit(*il))){
284 if (dp==0 && de==0) clusterOk=
false;
292 if (e_long > m_minTowerEnergy && il!=hf.
end()) {
295 usedHits.push_back(idl.rawId());
299 if ((de>-2)&&(de<2)&&(dp>-4)&&(dp<4)) {
303 if ((dp==0)&&(de==0)) {
308 if ((de>-2)&&(de<2)&&(dp>-4)&&(dp<4)&&(e_long>(.5*e_seed))) {
309 coreCanid.push_back(e_long);
315 double d_p = p.
phi()-sp.
phi();
320 double d_e = p.
eta()-sp.
eta();
336 if (dp==0 && de==0) clusterOk=
false;
339 if (e_short > m_minTowerEnergy && is!=hf.
end()) {
341 usedHits.push_back(ids.rawId());
345 if ((de>-2)&&(de<2)&&(dp>-4)&&(dp<4)) {
349 if ((dp==0)&&(de==0)) {
356 if (!clusterOk)
return false;
360 for (ci=coreCanid.begin();ci!=coreCanid.end();ci++){
361 if(ci==coreCanid.begin()){
363 }
else if (*ci>.5*l_1e){
373 double eta=xyzclus.eta();
375 double phi=xyzclus.phi();
383 int idx= fabs(seedid.
ieta())-29;
384 int ipx=seedid.
iphi();
385 double Cphi =(phi-m_seedmnPhi[ipx])/(m_seedMXphi[ipx]-m_seedmnPhi[ipx]);
386 double Ceta=(fabs(eta)- m_seedmnEta[
idx])/(m_seedMXeta[idx]-m_seedmnEta[idx]);
389 HFEMClusterShape myClusShp(l_1, s_1, l_3, s_3, l_5,s_5, l_1e,Ceta, Cphi,seedid);
403 if (!(m_isMC && !m_forcePulseFlagMC))
411 m_cutByEta.push_back(-1);
412 m_seedmnEta.push_back(99);
413 m_seedMXeta.push_back(-1);
void clusterize(const HFRecHitCollection &hf, const CaloGeometry &geom, reco::HFEMClusterShapeCollection &clusters, reco::SuperClusterCollection &SuperClusters)
static std::vector< std::string > checklist log
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 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
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
int ieta() const
get the cell ieta
Abs< T >::type abs(const T &t)
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)
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
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
iterator find(key_type k)
const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
const CornersVec & getCorners() const
Returns the corner points of this cell's volume.
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