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 
7 
8 #include "TMath.h"
9 #include <vector>
10 #include <numeric>
11 #include <iostream>
12 
13 
15 {
16 
17  initValues();
18 }
19 
21 {
22  emEnergy_ = 0.0;
23  hadEnergy_ = 0.0;
24  fem_ = 0.0;
25  width_ = 0.0;
26  depth_ = 0.0;
27  fhot_ = 0.0;
28  sigmaz_ = 0.0;
29  nTowers_ = 0;
30 }
31 
32 
34 {
35  initValues();
36 
37  // calculate Castor JetID properties
38 
39  double zmean = 0.;
40  double z2mean = 0.;
41 
42  std::vector<CandidatePtr> ccp = jet.getJetConstituents();
43  std::vector<CandidatePtr>::const_iterator itParticle;
44  for (itParticle=ccp.begin();itParticle!=ccp.end();++itParticle){
45  const CastorTower* castorcand = dynamic_cast<const CastorTower*>(itParticle->get());
46  emEnergy_ += castorcand->emEnergy();
47  hadEnergy_ += castorcand->hadEnergy();
48  depth_ += castorcand->depth()*castorcand->energy();
49  width_ += pow(phiangle(castorcand->phi() - jet.phi()),2)*castorcand->energy();
50  fhot_ += castorcand->fhot()*castorcand->energy();
51 
52  // loop over rechits
53  for (edm::RefVector<edm::SortedCollection<CastorRecHit> >::iterator it = castorcand->rechitsBegin(); it != castorcand->rechitsEnd(); it++) {
55  double Erechit = rechit_p->energy();
56  HcalCastorDetId id = rechit_p->id();
57  int module = id.module();
58  double zrechit = 0;
59  if (module < 3) zrechit = -14390 - 24.75 - 49.5*(module-1);
60  if (module > 2) zrechit = -14390 - 99 - 49.5 - 99*(module-3);
61  zmean += Erechit*zrechit;
62  z2mean += Erechit*zrechit*zrechit;
63  } // end loop over rechits
64 
65  nTowers_++;
66  }
67  //cout << "" << endl;
68 
69  depth_ = depth_/jet.energy();
70  width_ = sqrt(width_/jet.energy());
71  fhot_ = fhot_/jet.energy();
72  fem_ = emEnergy_/jet.energy();
73 
74  zmean = zmean/jet.energy();
75  z2mean = z2mean/jet.energy();
76  double sigmaz2 = z2mean - zmean*zmean;
77  if(sigmaz2 > 0) sigmaz_ = sqrt(sigmaz2);
78 
79 
80 }
81 
82 // help function to calculate phi within [-pi,+pi]
84  double phi = testphi;
85  while (phi>M_PI) phi -= (2*M_PI);
86  while (phi<-M_PI) phi += (2*M_PI);
87  return phi;
88 }
89 
90 
91 
double emEnergy() const
tower em energy
Definition: CastorTower.h:48
virtual double energy() const GCC11_FINAL
energy
module()
Definition: vlib.cc:994
CastorRecHitRefs::iterator rechitsBegin() const
fist iterator over CastorRecHit constituents
Definition: CastorTower.h:66
Jets made from CaloTowers.
Definition: BasicJet.h:20
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
void calculate(const edm::Event &event, const reco::BasicJet &jet)
T sqrt(T t)
Definition: SSEVec.h:48
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
#define M_PI
double fhot() const
tower hotcell/tot ratio
Definition: CastorTower.h:60
double depth() const
tower depth in z
Definition: CastorTower.h:57
double hadEnergy() const
tower had energy
Definition: CastorTower.h:51
CastorRecHitRefs::iterator rechitsEnd() const
last iterator over CastorRecHit constituents
Definition: CastorTower.h:69
ProductID id() const
Accessor for product ID.
Definition: Ref.h:256
Definition: vlib.h:208
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:350
Definition: DDAxes.h:10