CMS 3D CMS Logo

SimG4HcalHitJetFinder Class Reference

#include <Validation/HcalHits/interface/SimG4HcalHitJetFinder.h>

List of all members.

Public Member Functions

std::vector
< SimG4HcalHitCluster > * 
getClusters (bool)
double rDist (const double, const double, const double, const double) const
double rDist (const SimG4HcalHitCluster *, const CaloHit *) 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 12 of file SimG4HcalHitJetFinder.cc.

00012 : jetcone(cone) {}

SimG4HcalHitJetFinder::~SimG4HcalHitJetFinder (  )  [virtual]

Definition at line 14 of file SimG4HcalHitJetFinder.cc.

00014                                               {
00015   edm::LogInfo("ValidHcal") << "SimG4HcalHitJetFinder:: Deleting";
00016 }


Member Function Documentation

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

Definition at line 26 of file SimG4HcalHitJetFinder.cc.

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

Referenced by SimG4HcalValidation::jetAnalysis().

00026                                                                                 {
00027   clusvector.erase(clusvector.begin(),clusvector.end()); 
00028   if (input.size() == 0) { 
00029     return &clusvector;
00030   }
00031 
00032   std::vector<CaloHit>::iterator itr;
00033   for (itr = input.begin(); itr != input.end(); itr++) {
00034     LogDebug("ValidHcal") << "HcalHitJetFinder::getClusters_1 - input :  e " 
00035                           << itr->e() << "  eta " << itr->eta() << "  phi " 
00036                           << itr->phi() << "  subdet " << itr->det();
00037   }
00038 
00039   sort(input.begin(),input.end()); // sort input in descending order
00040  
00041   for (itr = input.begin(); itr != input.end(); itr++) {
00042     LogDebug("ValidHcal") << "HcalHitJetFinder::getClusters_2 - input :  e " 
00043                           << itr->e() << "  eta " << itr->eta() << "  phi " 
00044                           << itr->phi() << "  subdet " << itr->det();
00045   }
00046 
00047   std::vector<SimG4HcalHitCluster> temp;   // dummy container for clusters
00048 
00049   //  first input hit -> first cluster
00050 
00051   CaloHit             hit;
00052   SimG4HcalHitCluster cluster;
00053 
00054   std::vector<CaloHit>::iterator itr_hits;
00055 
00056   int j, first_seed = 0;
00057   for (j=0, itr_hits = input.begin(); itr_hits != input.end();
00058        j++, itr_hits++) {
00059     int h_type = itr_hits->det(); //if desired HCAL hits (only) clusterfinding
00060     if (((h_type == static_cast<int>(HcalBarrel) ||
00061           h_type == static_cast<int>(HcalEndcap) ||
00062           h_type == static_cast<int>(HcalForward)) && hcal_only) || 
00063         (!hcal_only)) {
00064       cluster += input[j];
00065       LogDebug("ValidHcal") << "HcalHitJetFinder:: First seed hit "
00066                             << "..................\n" << (*itr_hits);
00067       first_seed = j;
00068       break;
00069     }
00070   }
00071   
00072   temp.push_back(cluster);
00073   
00074   std::vector<SimG4HcalHitCluster>::iterator itr_clus;
00075 
00076   for (j=0, itr_hits = input.begin(); itr_hits != input.end();
00077        j++, itr_hits++) {
00078     int h_type = itr_hits->det(); //if desired HCAL hits (only) clusterfinding
00079     if ((((h_type == static_cast<int>(HcalBarrel) ||
00080            h_type == static_cast<int>(HcalEndcap) ||
00081            h_type == static_cast<int>(HcalForward)) && hcal_only) || 
00082          (!hcal_only)) && (j != first_seed)) {
00083       LogDebug("ValidHcal") << "HcalHitJetFinder:: ........... Consider hit"
00084                             << " ..................\n" << (*itr_hits);
00085       
00086       int incl = 0; // if the hit is included in one of clusters
00087       
00088       int iclus;  
00089       for (itr_clus = temp.begin(), iclus = 0; itr_clus != temp.end();
00090            itr_clus++, iclus++) { 
00091         
00092         LogDebug("ValidHcal") << "HcalHitJetFinder::=======> Cluster " 
00093                               << iclus << "\n" << (*itr_clus);
00094         
00095         double d = rDist(&(*itr_clus), &(*itr_hits));
00096         if (d < jetcone) {
00097           LogDebug("ValidHcal") << "HcalHitJetFinder:: -> associated ... ";
00098           temp[iclus] += *itr_hits;
00099           incl = 1;
00100           break;  
00101         }
00102       }
00103       
00104       // to here jumps "break"
00105       if (incl == 0) {
00106         SimG4HcalHitCluster cl;
00107         cl += *itr_hits;
00108         temp.push_back(cl);
00109         LogDebug("ValidHcal") << "HcalHitJetFinder:: ************ NEW CLUSTER"
00110                               << " !\n" << cl;
00111       }
00112     }
00113   }
00114 
00115   clusvector = temp;
00116   return &clusvector;
00117 }

double SimG4HcalHitJetFinder::rDist ( const   double,
const   double,
const   double,
const   double 
) const

Definition at line 132 of file SimG4HcalHitJetFinder.cc.

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

00133                                                                               {
00134 
00135   double delta_eta = etac - etah;
00136   double delta_phi = phic - phih;
00137 
00138   if (phic < phih)      delta_phi = phih - phic;
00139   if (delta_phi > M_PI) delta_phi = 2*M_PI - delta_phi;
00140 
00141   double tmp = sqrt(delta_eta * delta_eta + delta_phi * delta_phi);
00142 
00143   LogDebug("ValidHcal") << "HcalHitJetFinder::rDist:\n"
00144                         << " Clus. eta, phi = " << etac << " " << phic << "\n"
00145                         << " hit   eta, phi = " << etah << " " << phih 
00146                         << " rDist = " << tmp;
00147 
00148   return tmp;
00149 }

double SimG4HcalHitJetFinder::rDist ( const SimG4HcalHitCluster cluster,
const CaloHit hit 
) const

Definition at line 119 of file SimG4HcalHitJetFinder.cc.

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

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

00120                                                               {
00121 
00122   double etac = cluster->eta();
00123   double phic = cluster->phi();
00124   
00125   double etah = hit->eta();
00126   double phih = hit->phi();
00127 
00128   return rDist(etac, phic, etah, phih);
00129 }

void SimG4HcalHitJetFinder::setCone ( double  cone  ) 

Definition at line 18 of file SimG4HcalHitJetFinder.cc.

References jetcone.

00018                                                { 
00019   jetcone = cone;
00020 }   

void SimG4HcalHitJetFinder::setInput ( std::vector< CaloHit > *  hhit  ) 

Definition at line 22 of file SimG4HcalHitJetFinder.cc.

References input.

Referenced by SimG4HcalValidation::jetAnalysis().

00022                                                              { 
00023   input   = * hhit;
00024 }


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().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:31:33 2009 for CMSSW by  doxygen 1.5.4