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 Member Functions | Private Attributes
TxCalculator Class Reference

#include <TxCalculator.h>

Public Member Functions

double getCTx (const reco::Photon &clus, double i, double threshold, double innerDR=0, double effRatio=2)
 
double getJct (const reco::Photon &cluster, double r1=0.4, double r2=0.04, double jWidth=0.015, double threshold=2)
 
double getJt (const reco::Photon &cluster, double r1=0.4, double r2=0.04, double jWidth=0.015, double threshold=2)
 
double getJurassicArea (double r1, double r2, double width)
 
double getMPT (double ptCut=0, double etaCut=1000)
 
double getTx (const reco::Photon &clus, double i, double threshold, double innerDR=0, double effRatio=2)
 
 TxCalculator (const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::InputTag &trackLabel)
 

Private Member Functions

double calcDphi (double phi1_, double phi2_)
 
double dRDistance (double eta1, double phi1, double eta2, double phi2)
 

Private Attributes

edm::Handle
< reco::TrackCollection
recCollection
 
CLHEP::HepRandomEngine * theDice
 

Detailed Description

Definition at line 28 of file TxCalculator.h.

Constructor & Destructor Documentation

TxCalculator::TxCalculator ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const edm::InputTag trackLabel 
)

Definition at line 26 of file TxCalculator.cc.

References edm::hlt::Exception, edm::Event::getByLabel(), edm::RandomNumberGenerator::getEngine(), edm::Service< T >::isAvailable(), and edm::Event::streamID().

27 {
28  iEvent.getByLabel(trackLabel, recCollection);
30  if ( ! rng.isAvailable()) {
31  throw cms::Exception("Configuration")
32  << "XXXXXXX requires the RandomNumberGeneratorService\n"
33  "which is not present in the configuration file. You must add the service\n"
34  "in the configuration file or remove the modules that require it.";
35  }
36  theDice = &rng->getEngine(iEvent.streamID());
37 }
edm::Handle< reco::TrackCollection > recCollection
Definition: TxCalculator.h:44
bool isAvailable() const
Definition: Service.h:46
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &) const =0
Use this engine in event methods.
StreamID streamID() const
Definition: Event.h:75
CLHEP::HepRandomEngine * theDice
Definition: TxCalculator.h:45

Member Function Documentation

double TxCalculator::calcDphi ( double  phi1_,
double  phi2_ 
)
inlineprivate

Definition at line 55 of file TxCalculator.h.

References PI.

Referenced by dRDistance().

56  {
57  double dphi=phi1_-phi2_;
58 
59  if (dphi>0){
60  while (dphi>2*PI) dphi-=2*PI;
61  if (dphi>PI) dphi=2*PI-dphi;
62  } else {
63  while (dphi<-2*PI) dphi+=2*PI;
64  if (dphi<-PI) dphi=-2*PI-dphi;
65  }
66  return dphi;
67  }
#define PI
double TxCalculator::dRDistance ( double  eta1,
double  phi1,
double  eta2,
double  phi2 
)
inlineprivate

Definition at line 47 of file TxCalculator.h.

References calcDphi(), and mathSSE::sqrt().

48  {
49  double deta = eta1 - eta2;
50  double dphi = (calcDphi(phi1, phi2));
51 
52  return sqrt(deta * deta + dphi * dphi);
53  }
T sqrt(T t)
Definition: SSEVec.h:48
double calcDphi(double phi1_, double phi2_)
Definition: TxCalculator.h:55
double TxCalculator::getCTx ( const reco::Photon clus,
double  i,
double  threshold,
double  innerDR = 0,
double  effRatio = 2 
)

Definition at line 124 of file TxCalculator.cc.

References reco::LeafCandidate::eta(), reco::LeafCandidate::phi(), RecoTauCleanerPlugins::pt, dt_dqm_sourceclient_common_cff::reco, and x.

125 {
126  using namespace edm;
127  using namespace reco;
128 
129  double SClusterEta = cluster.eta();
130  double SClusterPhi = cluster.phi();
131  double TotalPt = 0;
132 
133  TotalPt = 0;
134 
135  for(reco::TrackCollection::const_iterator
136  recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
137  {
138  double diceNum = theDice->flat();
139  if ( (effRatio < 1 ) && ( diceNum > effRatio))
140  continue;
141 
142 
143  double pt = recTrack->pt();
144  double eta2 = recTrack->eta();
145  double phi2 = recTrack->phi();
146  double dEta = fabs(eta2-SClusterEta);
147 
148  if(dEta >= 0.1 * x)
149  continue;
150  if(dRDistance(SClusterEta,SClusterPhi,eta2,phi2) < innerDR)
151  continue;
152 
153  if(pt > threshold)
154  TotalPt = TotalPt + pt;
155  }
156 
157  double Tx = getTx(cluster,x,threshold,innerDR,effRatio);
158  double CTx = Tx - TotalPt / 40.0 * x;
159 
160  return CTx;
161 }
edm::Handle< reco::TrackCollection > recCollection
Definition: TxCalculator.h:44
double dRDistance(double eta1, double phi1, double eta2, double phi2)
Definition: TxCalculator.h:47
double getTx(const reco::Photon &clus, double i, double threshold, double innerDR=0, double effRatio=2)
Definition: TxCalculator.cc:86
Definition: DDAxes.h:10
CLHEP::HepRandomEngine * theDice
Definition: TxCalculator.h:45
double TxCalculator::getJct ( const reco::Photon cluster,
double  r1 = 0.4,
double  r2 = 0.04,
double  jWidth = 0.015,
double  threshold = 2 
)

Definition at line 203 of file TxCalculator.cc.

References gather_cfg::cout, dPhi(), eta(), reco::LeafCandidate::eta(), phi, reco::LeafCandidate::phi(), PI, RecoTauCleanerPlugins::pt, diffTwoXMLs::r1, and dt_dqm_sourceclient_common_cff::reco.

204 {
205 
206  using namespace edm;
207  using namespace reco;
208 
209 
210  double SClusterEta = cluster.eta();
211  double SClusterPhi = cluster.phi();
212  double TotalPt = 0;
213 
214  for(reco::TrackCollection::const_iterator
215  recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
216  {
217  double pt = recTrack->pt();
218  double eta = recTrack->eta();
219  double phi = recTrack->phi();
220  double dEta = fabs(eta-SClusterEta);
221  double dPhi = phi-SClusterPhi;
222  if ( dPhi < -PI ) dPhi = dPhi + 2*PI ;
223  if ( dPhi > PI ) dPhi = dPhi - 2*PI ;
224  if ( fabs(dPhi) >PI ) cout << " error!!! dphi > 2pi : " << dPhi << endl;
225  // double dR = sqrt(dEta*dEta+dPhi*dPhi);
226 
227 
229  if ( fabs(dEta) > r1 ) continue;
230  if ( fabs(dPhi) <r1 ) continue;
232 
233  if(pt > threshold)
234  TotalPt = TotalPt + pt;
235  }
236 
237  double areaStrip = 4*PI*r1 - 4*r1*r1;
238  double areaJura = getJurassicArea(r1,r2, jWidth) ;
239  double theCJ = getJt(cluster,r1, r2, jWidth, threshold);
240 
241  double theCCJ = theCJ - TotalPt * areaJura / areaStrip ;
242  return theCCJ;
243 
244 }
#define PI
double getJt(const reco::Photon &cluster, double r1=0.4, double r2=0.04, double jWidth=0.015, double threshold=2)
virtual float phi() const
momentum azimuthal angle
edm::Handle< reco::TrackCollection > recCollection
Definition: TxCalculator.h:44
T eta() const
double getJurassicArea(double r1, double r2, double width)
Definition: TxCalculator.cc:40
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
virtual float eta() const
momentum pseudorapidity
tuple cout
Definition: gather_cfg.py:121
Definition: DDAxes.h:10
double TxCalculator::getJt ( const reco::Photon cluster,
double  r1 = 0.4,
double  r2 = 0.04,
double  jWidth = 0.015,
double  threshold = 2 
)

Definition at line 165 of file TxCalculator.cc.

References gather_cfg::cout, dPhi(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, eta(), reco::LeafCandidate::eta(), phi, reco::LeafCandidate::phi(), PI, RecoTauCleanerPlugins::pt, dt_dqm_sourceclient_common_cff::reco, and mathSSE::sqrt().

166 {
167 
168  using namespace edm;
169  using namespace reco;
170 
171 
172  double SClusterEta = cluster.eta();
173  double SClusterPhi = cluster.phi();
174  double TotalPt = 0;
175 
176  for(reco::TrackCollection::const_iterator
177  recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
178  {
179  double pt = recTrack->pt();
180  double eta = recTrack->eta();
181  double phi = recTrack->phi();
182  double dEta = fabs(eta-SClusterEta);
183  double dPhi = phi-SClusterPhi;
184  if ( dPhi < -PI ) dPhi = dPhi + 2*PI ;
185  if ( dPhi > PI ) dPhi = dPhi - 2*PI ;
186  if ( fabs(dPhi) >PI ) cout << " error!!! dphi > 2pi : " << dPhi << endl;
187  double dR = sqrt(dEta*dEta+dPhi*dPhi);
188  // Jurassic Cone /////
189  if ( dR > r1 ) continue;
190  if ( dR < r2 ) continue;
191  if ( fabs(dEta) < jWidth) continue;
192  // stupid bug if ( fabs(dPhi) > jWidth) continue;
194 
195  if(pt > threshold)
196  TotalPt = TotalPt + pt;
197  }
198 
199  return TotalPt;
200 }
#define PI
virtual float phi() const
momentum azimuthal angle
edm::Handle< reco::TrackCollection > recCollection
Definition: TxCalculator.h:44
T eta() const
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
virtual float eta() const
momentum pseudorapidity
T sqrt(T t)
Definition: SSEVec.h:48
tuple cout
Definition: gather_cfg.py:121
Definition: DDAxes.h:10
double TxCalculator::getJurassicArea ( double  r1,
double  r2,
double  width 
)

Definition at line 40 of file TxCalculator.cc.

References funct::cos(), and mathSSE::sqrt().

40  {
41 
42  float theta1 = asin( width / r1);
43  float theta2 = asin( width / r2);
44  float theA = sqrt ( r1*r1 + r2*r2 - 2 * r1 * r2 * cos ( theta1 - theta2) );
45  float area1 = 0.5 * r1*r1 * ( 3.141592 - 2 * theta1 ) ;
46  float area2 = 0.5 * r2*r2 * ( 3.141592 - 2 * theta2 ) ;
47  float area3 = width * theA;
48  float finalArea = 2 * ( area1 - area2 - area3);
49  return finalArea;
50 }
T sqrt(T t)
Definition: SSEVec.h:48
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double TxCalculator::getMPT ( double  ptCut = 0,
double  etaCut = 1000 
)

Definition at line 53 of file TxCalculator.cc.

References eta(), RecoTauCleanerPlugins::pt, dt_dqm_sourceclient_common_cff::reco, and mathSSE::sqrt().

54 {
55  using namespace edm;
56  using namespace reco;
57 
58  double sumpx(0), sumpy(0);
59 
60  for(reco::TrackCollection::const_iterator
61  recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
62  {
63  double pt = recTrack->pt();
64  double eta = recTrack->eta();
65 
66  if(pt < ptCut )
67  continue;
68  if ( fabs( eta) > etaCut )
69  continue;
70 
71  double pxTemp = recTrack->px();
72  double pyTemp = recTrack->py();
73 
74  sumpx = sumpx + pxTemp;
75  sumpy = sumpy + pyTemp;
76  // cout << " pt = " << recTrack->pt() << " and px = " << pxTemp << " and py = " << pyTemp << endl;
77  }
78  // cout << " square = " << sumpx*sumpx + sumpy*sumpy << endl;
79  double theMPT = sqrt(sumpx*sumpx + sumpy*sumpy) ;
80  // cout << " mpt = "<< theMPT << endl;
81 
82  return theMPT;
83 }
edm::Handle< reco::TrackCollection > recCollection
Definition: TxCalculator.h:44
T eta() const
T sqrt(T t)
Definition: SSEVec.h:48
double TxCalculator::getTx ( const reco::Photon clus,
double  i,
double  threshold,
double  innerDR = 0,
double  effRatio = 2 
)

Definition at line 86 of file TxCalculator.cc.

References reco::LeafCandidate::eta(), reco::LeafCandidate::phi(), RecoTauCleanerPlugins::pt, and dt_dqm_sourceclient_common_cff::reco.

87 {
88 
89  using namespace edm;
90  using namespace reco;
91 
92 
93 
94  double SClusterEta = cluster.eta();
95  double SClusterPhi = cluster.phi();
96  double TotalPt = 0;
97 
98  for(reco::TrackCollection::const_iterator
99  recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
100  {
101  double diceNum = theDice->flat();
102  if ( (effRatio < 1 ) && ( diceNum > effRatio))
103  continue;
104 
105  double pt = recTrack->pt();
106  double eta2 = recTrack->eta();
107  double phi2 = recTrack->phi();
108 
109  if(dRDistance(SClusterEta,SClusterPhi,eta2,phi2) >= 0.1 * x)
110  continue;
111  if(dRDistance(SClusterEta,SClusterPhi,eta2,phi2) < innerDR)
112  continue;
113  if(pt > threshold)
114  TotalPt = TotalPt + pt;
115  }
116 
117  return TotalPt;
118 }
edm::Handle< reco::TrackCollection > recCollection
Definition: TxCalculator.h:44
double dRDistance(double eta1, double phi1, double eta2, double phi2)
Definition: TxCalculator.h:47
Definition: DDAxes.h:10
CLHEP::HepRandomEngine * theDice
Definition: TxCalculator.h:45

Member Data Documentation

edm::Handle<reco::TrackCollection> TxCalculator::recCollection
private

Definition at line 44 of file TxCalculator.h.

CLHEP::HepRandomEngine* TxCalculator::theDice
private

Definition at line 45 of file TxCalculator.h.