CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CastorJetIDHelper.cc
Go to the documentation of this file.
2 
6 
7 #include "TMath.h"
8 #include <vector>
9 #include <numeric>
10 #include <iostream>
11 
12 
14 {
15 
16  initValues();
17 }
18 
20 {
21  emEnergy_ = 0.0;
22  hadEnergy_ = 0.0;
23  fem_ = 0.0;
24  width_ = 0.0;
25  depth_ = 0.0;
26  fhot_ = 0.0;
27  sigmaz_ = 0.0;
28  nTowers_ = 0;
29 }
30 
31 
33 {
34  initValues();
35 
36  // calculate Castor JetID properties
37 
38  double zmean = 0.;
39  double z2mean = 0.;
40 
41  std::vector<CandidatePtr> ccp = jet.getJetConstituents();
42  std::vector<CandidatePtr>::const_iterator itParticle;
43  for (itParticle=ccp.begin();itParticle!=ccp.end();++itParticle){
44  const CastorTower* castorcand = dynamic_cast<const CastorTower*>(itParticle->get());
45  emEnergy_ += castorcand->emEnergy();
46  hadEnergy_ += castorcand->hadEnergy();
47  depth_ += castorcand->depth()*castorcand->energy();
48  width_ += pow(phiangle(castorcand->phi() - jet.phi()),2)*castorcand->energy();
49  fhot_ += castorcand->fhot()*castorcand->energy();
50 
51  // loop over cells
52  for (CastorCell_iterator it = castorcand->cellsBegin(); it != castorcand->cellsEnd(); it++) {
53  CastorCellRef cell_p = *it;
54  math::XYZPointD rcell = cell_p->position();
55  double Ecell = cell_p->energy();
56  zmean += Ecell*cell_p->z();
57  z2mean += Ecell*cell_p->z()*cell_p->z();
58  } // end loop over cells
59 
60  nTowers_++;
61  }
62  //cout << "" << endl;
63 
64  depth_ = depth_/jet.energy();
65  width_ = sqrt(width_/jet.energy());
66  fhot_ = fhot_/jet.energy();
67  fem_ = emEnergy_/jet.energy();
68 
69  zmean = zmean/jet.energy();
70  z2mean = z2mean/jet.energy();
71  double sigmaz2 = z2mean - zmean*zmean;
72  if(sigmaz2 > 0) sigmaz_ = sqrt(sigmaz2);
73 
74 
75 }
76 
77 // help function to calculate phi within [-pi,+pi]
79  double phi = testphi;
80  while (phi>M_PI) phi -= (2*M_PI);
81  while (phi<-M_PI) phi += (2*M_PI);
82  return phi;
83 }
84 
85 
86 
CastorCell_iterator cellsEnd() const
last iterator over CastorCell constituents
Definition: CastorTower.h:67
double emEnergy() const
tower em energy
Definition: CastorTower.h:46
CastorCell_iterator cellsBegin() const
fist iterator over CastorCell constituents
Definition: CastorTower.h:64
Jets made from CaloTowers.
Definition: BasicJet.h:21
virtual double energy() const
energy
void calculate(const edm::Event &event, const reco::BasicJet &jet)
T sqrt(T t)
Definition: SSEVec.h:28
double phiangle(double testphi)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
double energy() const
tower energy
Definition: CastorTower.h:40
#define M_PI
Definition: BFit3D.cc:3
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double > > XYZPointD
point in space with cartesian internal representation
Definition: Point3D.h:9
double fhot() const
tower hotcell/tot ratio
Definition: CastorTower.h:58
double depth() const
tower depth in z
Definition: CastorTower.h:55
double hadEnergy() const
tower had energy
Definition: CastorTower.h:49
virtual double phi() const
momentum azimuthal angle
double phi() const
azimuthal angle of tower centroid
Definition: CastorTower.h:91
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
virtual Constituents getJetConstituents() const
list of constituents
Definition: Jet.cc:349
Definition: DDAxes.h:10