2 #include <Math/VectorUtil.h>
18 #include "CLHEP/Random/RandomEngine.h"
23 using namespace ROOT::Math::VectorUtil;
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.";
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);
58 double sumpx(0), sumpy(0);
60 for(reco::TrackCollection::const_iterator
61 recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
63 double pt = recTrack->pt();
64 double eta = recTrack->eta();
68 if ( fabs( eta) > etaCut )
71 double pxTemp = recTrack->px();
72 double pyTemp = recTrack->py();
74 sumpx = sumpx + pxTemp;
75 sumpy = sumpy + pyTemp;
79 double theMPT =
sqrt(sumpx*sumpx + sumpy*sumpy) ;
94 double SClusterEta = cluster.
eta();
95 double SClusterPhi = cluster.
phi();
98 for(reco::TrackCollection::const_iterator
99 recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
101 double diceNum = theDice->flat();
102 if ( (effRatio < 1 ) && ( diceNum > effRatio))
105 double pt = recTrack->pt();
106 double eta2 = recTrack->eta();
107 double phi2 = recTrack->phi();
109 if(dRDistance(SClusterEta,SClusterPhi,eta2,phi2) >= 0.1 * x)
111 if(dRDistance(SClusterEta,SClusterPhi,eta2,phi2) < innerDR)
114 TotalPt = TotalPt +
pt;
127 using namespace reco;
129 double SClusterEta = cluster.
eta();
130 double SClusterPhi = cluster.
phi();
135 for(reco::TrackCollection::const_iterator
136 recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
138 double diceNum = theDice->flat();
139 if ( (effRatio < 1 ) && ( diceNum > effRatio))
143 double pt = recTrack->pt();
144 double eta2 = recTrack->eta();
145 double phi2 = recTrack->phi();
146 double dEta = fabs(eta2-SClusterEta);
150 if(dRDistance(SClusterEta,SClusterPhi,eta2,phi2) < innerDR)
154 TotalPt = TotalPt +
pt;
157 double Tx = getTx(cluster,x,threshold,innerDR,effRatio);
158 double CTx = Tx - TotalPt / 40.0 *
x;
169 using namespace reco;
172 double SClusterEta = cluster.
eta();
173 double SClusterPhi = cluster.
phi();
176 for(reco::TrackCollection::const_iterator
177 recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
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);
189 if ( dR > r1 )
continue;
190 if ( dR < r2 )
continue;
191 if ( fabs(dEta) < jWidth)
continue;
196 TotalPt = TotalPt +
pt;
207 using namespace reco;
210 double SClusterEta = cluster.
eta();
211 double SClusterPhi = cluster.
phi();
214 for(reco::TrackCollection::const_iterator
215 recTrack = recCollection->begin(); recTrack!= recCollection->end(); recTrack++)
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;
229 if ( fabs(dEta) > r1 )
continue;
230 if ( fabs(dPhi) <r1 )
continue;
234 TotalPt = TotalPt +
pt;
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);
241 double theCCJ = theCJ - TotalPt * areaJura / areaStrip ;
double getMPT(double ptCut=0, double etaCut=1000)
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
double getJurassicArea(double r1, double r2, double width)
double dPhi(double phi1, double phi2)
virtual float eta() const
momentum pseudorapidity
Cos< T >::type cos(const T &t)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
double getTx(const reco::Photon &clus, double i, double threshold, double innerDR=0, double effRatio=2)
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &) const =0
Use this engine in event methods.
double getJct(const reco::Photon &cluster, double r1=0.4, double r2=0.04, double jWidth=0.015, double threshold=2)
StreamID streamID() const
TxCalculator(const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::InputTag &trackLabel)
double getCTx(const reco::Photon &clus, double i, double threshold, double innerDR=0, double effRatio=2)