CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
SimG4HcalHitJetFinder Class Reference

#include <SimG4HcalHitJetFinder.h>

Public Member Functions

std::vector
< SimG4HcalHitCluster > * 
getClusters (bool)
 
double rDist (const SimG4HcalHitCluster *, const CaloHit *) const
 
double rDist (const double, const double, const double, const double) const
 
void setCone (double)
 
void setInput (std::vector< CaloHit > *)
 
 SimG4HcalHitJetFinder (double cone=0.5)
 
virtual ~SimG4HcalHitJetFinder ()
 

Private Attributes

std::vector< SimG4HcalHitClusterclusvector
 
std::vector< CaloHitinput
 
double jetcone
 

Detailed Description

Definition at line 13 of file SimG4HcalHitJetFinder.h.

Constructor & Destructor Documentation

SimG4HcalHitJetFinder::SimG4HcalHitJetFinder ( double  cone = 0.5)

Definition at line 13 of file SimG4HcalHitJetFinder.cc.

13 : jetcone(cone) {}
SimG4HcalHitJetFinder::~SimG4HcalHitJetFinder ( )
virtual

Definition at line 15 of file SimG4HcalHitJetFinder.cc.

15  {
16  edm::LogInfo("ValidHcal") << "SimG4HcalHitJetFinder:: Deleting";
17 }

Member Function Documentation

std::vector< SimG4HcalHitCluster > * SimG4HcalHitJetFinder::getClusters ( bool  hcal_only)

Definition at line 27 of file SimG4HcalHitJetFinder.cc.

References GetRecoTauVFromDQM_MC_cff::cl, clusvector, HcalBarrel, HcalEndcap, HcalForward, input, j, jetcone, LogDebug, rDist(), python.multivaluedict::sort(), and groupFilesInBlocks::temp.

Referenced by SimG4HcalValidation::jetAnalysis().

27  {
28  clusvector.erase(clusvector.begin(),clusvector.end());
29  if (input.size() == 0) {
30  return &clusvector;
31  }
32 
33  std::vector<CaloHit>::iterator itr;
34  for (itr = input.begin(); itr != input.end(); itr++) {
35  LogDebug("ValidHcal") << "HcalHitJetFinder::getClusters_1 - input : e "
36  << itr->e() << " eta " << itr->eta() << " phi "
37  << itr->phi() << " subdet " << itr->det();
38  }
39 
40  sort(input.begin(),input.end()); // sort input in descending order
41 
42  for (itr = input.begin(); itr != input.end(); itr++) {
43  LogDebug("ValidHcal") << "HcalHitJetFinder::getClusters_2 - input : e "
44  << itr->e() << " eta " << itr->eta() << " phi "
45  << itr->phi() << " subdet " << itr->det();
46  }
47 
48  std::vector<SimG4HcalHitCluster> temp; // dummy container for clusters
49 
50  // first input hit -> first cluster
51 
52  CaloHit hit;
53  SimG4HcalHitCluster cluster;
54 
55  std::vector<CaloHit>::iterator itr_hits;
56 
57  int j, first_seed = 0;
58  for (j=0, itr_hits = input.begin(); itr_hits != input.end();
59  j++, itr_hits++) {
60  int h_type = itr_hits->det(); //if desired HCAL hits (only) clusterfinding
61  if (((h_type == static_cast<int>(HcalBarrel) ||
62  h_type == static_cast<int>(HcalEndcap) ||
63  h_type == static_cast<int>(HcalForward)) && hcal_only) ||
64  (!hcal_only)) {
65  cluster += input[j];
66  LogDebug("ValidHcal") << "HcalHitJetFinder:: First seed hit "
67  << "..................\n" << (*itr_hits);
68  first_seed = j;
69  break;
70  }
71  }
72 
73  temp.push_back(cluster);
74 
75  std::vector<SimG4HcalHitCluster>::iterator itr_clus;
76 
77  for (j=0, itr_hits = input.begin(); itr_hits != input.end();
78  j++, itr_hits++) {
79  int h_type = itr_hits->det(); //if desired HCAL hits (only) clusterfinding
80  if ((((h_type == static_cast<int>(HcalBarrel) ||
81  h_type == static_cast<int>(HcalEndcap) ||
82  h_type == static_cast<int>(HcalForward)) && hcal_only) ||
83  (!hcal_only)) && (j != first_seed)) {
84  LogDebug("ValidHcal") << "HcalHitJetFinder:: ........... Consider hit"
85  << " ..................\n" << (*itr_hits);
86 
87  int incl = 0; // if the hit is included in one of clusters
88 
89  int iclus;
90  for (itr_clus = temp.begin(), iclus = 0; itr_clus != temp.end();
91  itr_clus++, iclus++) {
92 
93  LogDebug("ValidHcal") << "HcalHitJetFinder::=======> Cluster "
94  << iclus << "\n" << (*itr_clus);
95 
96  double d = rDist(&(*itr_clus), &(*itr_hits));
97  if (d < jetcone) {
98  LogDebug("ValidHcal") << "HcalHitJetFinder:: -> associated ... ";
99  temp[iclus] += *itr_hits;
100  incl = 1;
101  break;
102  }
103  }
104 
105  // to here jumps "break"
106  if (incl == 0) {
108  cl += *itr_hits;
109  temp.push_back(cl);
110  LogDebug("ValidHcal") << "HcalHitJetFinder:: ************ NEW CLUSTER"
111  << " !\n" << cl;
112  }
113  }
114  }
115 
116  clusvector = temp;
117  return &clusvector;
118 }
#define LogDebug(id)
std::vector< CaloHit > input
int j
Definition: DBlmapReader.cc:9
std::vector< SimG4HcalHitCluster > clusvector
double rDist(const SimG4HcalHitCluster *, const CaloHit *) const
double SimG4HcalHitJetFinder::rDist ( const SimG4HcalHitCluster cluster,
const CaloHit hit 
) const

Definition at line 120 of file SimG4HcalHitJetFinder.cc.

References SimG4HcalHitCluster::eta(), CaloHit::eta(), SimG4HcalHitCluster::phi(), and CaloHit::phi().

Referenced by SimG4HcalValidation::collectEnergyRdir(), getClusters(), and SimG4HcalValidation::jetAnalysis().

121  {
122 
123  double etac = cluster->eta();
124  double phic = cluster->phi();
125 
126  double etah = hit->eta();
127  double phih = hit->phi();
128 
129  return rDist(etac, phic, etah, phih);
130 }
double phi() const
Definition: CaloHit.h:26
double eta() const
Definition: CaloHit.h:25
double rDist(const SimG4HcalHitCluster *, const CaloHit *) const
double SimG4HcalHitJetFinder::rDist ( const double  etac,
const double  phic,
const double  etah,
const double  phih 
) const

Definition at line 133 of file SimG4HcalHitJetFinder.cc.

References kinem::delta_eta(), kinem::delta_phi(), LogDebug, M_PI, mathSSE::sqrt(), and tmp.

134  {
135 
136  double delta_eta = etac - etah;
137  double delta_phi = phic - phih;
138 
139  if (phic < phih) delta_phi = phih - phic;
140  if (delta_phi > M_PI) delta_phi = 2*M_PI - delta_phi;
141 
142  double tmp = sqrt(delta_eta * delta_eta + delta_phi * delta_phi);
143 
144  LogDebug("ValidHcal") << "HcalHitJetFinder::rDist:\n"
145  << " Clus. eta, phi = " << etac << " " << phic << "\n"
146  << " hit eta, phi = " << etah << " " << phih
147  << " rDist = " << tmp;
148 
149  return tmp;
150 }
#define LogDebug(id)
double delta_eta(double eta1, double eta2)
Definition: AnglesUtil.h:98
T sqrt(T t)
Definition: SSEVec.h:48
double delta_phi(double ph11, double phi2)
Definition: AnglesUtil.h:91
#define M_PI
Definition: BFit3D.cc:3
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void SimG4HcalHitJetFinder::setCone ( double  cone)

Definition at line 19 of file SimG4HcalHitJetFinder.cc.

References jetcone.

19  {
20  jetcone = cone;
21 }
void SimG4HcalHitJetFinder::setInput ( std::vector< CaloHit > *  hhit)

Definition at line 23 of file SimG4HcalHitJetFinder.cc.

References input.

Referenced by SimG4HcalValidation::jetAnalysis().

23  {
24  input = * hhit;
25 }
std::vector< CaloHit > input

Member Data Documentation

std::vector<SimG4HcalHitCluster> SimG4HcalHitJetFinder::clusvector
private

Definition at line 30 of file SimG4HcalHitJetFinder.h.

Referenced by getClusters().

std::vector<CaloHit> SimG4HcalHitJetFinder::input
private

Definition at line 29 of file SimG4HcalHitJetFinder.h.

Referenced by getClusters(), and setInput().

double SimG4HcalHitJetFinder::jetcone
private

Definition at line 28 of file SimG4HcalHitJetFinder.h.

Referenced by getClusters(), and setCone().