本文整理汇总了C++中TVector2类的典型用法代码示例。如果您正苦于以下问题:C++ TVector2类的具体用法?C++ TVector2怎么用?C++ TVector2使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TVector2类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: getCeF3Position
void getCeF3Position( std::vector<float> cef3, float& xPos, float& yPos ) {
xPos=0.;
yPos=0.;
float r02 = cef3[0]/cef3[2];
float r13 = cef3[1]/cef3[3];
TF1* f1_d02 = getCef3Function("diag02");
TF1* f1_d13 = getCef3Function("diag13");
float diag02 = f1_d02->GetX(r02, -50., 50.);
float diag13 = f1_d13->GetX(r13, -50., 50.);
TVector2 v( diag13, diag02 );
float pi = 3.14159;
float theta = pi/4.; // 45 degrees
TVector2 d = v.Rotate(+theta);
xPos = d.X();
yPos = d.Y();
//xPos = diag02;
//yPos = diag13;
delete f1_d02;
delete f1_d13;
}
开发者ID:clarajorda,项目名称:BTFAnalysis,代码行数:29,代码来源:positionAnalysis.cpp
示例2: Discretize
TVector2 HashTable::Discretize(TVector2 position) {
position /= _NG_H_;
position.Set(
floor(position.X()),
floor(position.Y())
);
return position;
}
开发者ID:carbolymer,项目名称:SPH,代码行数:8,代码来源:HashTable.cpp
示例3: fopen
int Load3ds::CompileObjects()
{
#ifdef GRAPHICS_DEBUG
FILE* file = NULL;
file = fopen("normals.out", "w+");
assert( file );
#endif
int j = 0;
TVector3<float> position, normal;
TVector2<float> texCoord;
// the number of faces * 3: 3 indices per face
for (int i = 0; i < mModelData->mFaceCount * 3; i+=3)
{
mMesh->addTriangleIndices(mModelData->mFaces[ i ],
mModelData->mFaces[i + 1], mModelData->mFaces[i + 2]);
}
// set up all the information: position, normal and eventually
// the texture coordinates, and compile them into our TVertex class
for (int i = 0; i < mModelData->mVertexCount; i++)
{
j = i * 3;
position.setX( mModelData->mVertices[ j ] );
position.setY( mModelData->mVertices[j + 1] );
position.setZ( mModelData->mVertices[j + 2] );
normal.setX( mModelData->mNormals[ j ] );
normal.setY( mModelData->mNormals[j + 1] );
normal.setZ( mModelData->mNormals[j + 2] );
#ifdef GRAPHICS_DEBUG
fprintf(file, "%i: X: %f, Y: %f, Z: %f\n", i, normal.x(), normal.y(),
normal.z());
#endif
if ( mModelData->mContainsTexCoords )
{
// stride: one face -> 2 texture coordinates
j = i * 2;
texCoord.setX( mModelData->mTexCoords[ j ] );
texCoord.setY( mModelData->mTexCoords[j + 1] );
}
mMesh->addVertex( TVertex(normal, position, texCoord) );
}
#ifdef GRAPHICS_DEBUG
fclose( file );
#endif
return 1;
}
开发者ID:ramsampath,项目名称:GLSLToon,代码行数:56,代码来源:3ds.cpp
示例4:
void test::runtest3()
{
TLorentzVector v1,v2,vds;
double ecm = 14000.0;
double mxlo = 0.0;
TVector2 ptm;
TMctLib t;
// CGL/AB ExampleEvent.h: numerical = 412.629
v1.SetPxPyPzE(410.0,20.0,-20.0,422.9657197);
v2.SetPxPyPzE(-210.0,-300.0,44.0,398.1657946);
vds.SetPxPyPzE(0,0,0,0);
ptm.Set(-200.0,280.0);
mxlo = 100.0;
// // QCD J7
// double in[10] = {1.258670e+05,1.571520e+06,1.572370e+05,9.757710e+04
// ,-1.183100e+06,1.479710e+04,-5.753920e+04,-2.356870e+02,1.258670e+05,4.443730e+05};
// double in[10] = {6.256940e+04,1.288650e+05,1.180090e+06,7.800940e+04
// ,-1.329990e+05,-1.089660e+06,7.652250e+02,-8.213820e+04,8.228860e+04,4.454130e+05};
// double in[10] = {1.341360e+05,3.326890e+05,-1.283550e+06,9.644650e+04
// ,-6.514870e+04,1.149020e+06,1.437980e+03,9.277770e+04,1.341360e+05,5.101580e+05};
// double in[10] = {9.235300e+04,-3.740560e+05,-1.064090e+06,1.830350e+05
// ,3.642610e+05,1.065280e+06,-1.448250e+03,-3.466820e+04,1.830350e+05,3.324730e+05};
// double in[10] = {9.046870e+04,1.840110e+06,6.785220e+05,9.780580e+04
// ,-1.630920e+06,-6.143020e+05,-5.887950e+04,4.870900e+02,1.062900e+05,4.814570e+05};
// double in[10] = {1.182120e+05,1.367560e+06,5.090250e+05,6.409280e+04
// ,-1.290560e+06,-4.467530e+05,-2.323400e+04,-5.225580e+02,1.182120e+05,2.829080e+05};
// double in[10] = {7.755540e+04,-9.667320e+05,7.152930e+05,1.010010e+05
// ,8.471940e+05,-5.228630e+05,-8.270070e+02,3.081700e+04,1.043150e+05,2.405480e+05};
// double in[10] = {9.918510e+04,-6.460480e+04,-1.343380e+06,1.204820e+05
// ,9.848800e+04,1.335590e+06,3.381800e+02,-5.554830e+04,1.204820e+05,4.041840e+05};
// // QCD J4
// double in[10] = {1.990270e+04,8.762820e+03,1.808790e+05,1.786660e+04
// ,-1.777620e+04,-1.537630e+05,-1.771590e+02,-4.196540e+04,2.149110e+04,1.250350e+05};
// // SUSY SU3
// double in[10] = {5.393630e+04,2.803780e+05,-5.825570e+05,4.760900e+04
// ,-3.659650e+05,2.836080e+05,1.240290e+04,2.463720e+05,2.151650e+05,5.504520e+05};
//
// v1.SetPxPyPzE(in[1]*0.001,in[2]*0.001,0.0
// ,sqrt(pow(in[1],2)+pow(in[2],2)+pow(in[0],2))*0.001);
// v2.SetPxPyPzE(in[4]*0.001,in[5]*0.001,0.0
// ,sqrt(pow(in[4],2)+pow(in[5],2)+pow(in[3],2))*0.001);
// vds.SetPxPyPzE(0,0,0,0);
// ptm.Set(in[6]*0.001,in[7]*0.001);
// cout<<in[8]*0.001<<" "<<t.mt2(v1,v2,vds,ptm,ecm,mxlo)<<endl;
cout<<"MCT = "<<t.mct(v1,v2)
<<", MCTcorr = "<<t.mctcorr(v1,v2,vds,ptm,ecm,mxlo)
<<", MT2 = "<<t.mt2(v1,v2,vds,ptm,ecm,mxlo)
<<", MCy = "<<t.mcy(v1,v2,vds,ptm)
<<", MCx = "<<t.mcx(v1,v2,vds,ptm)
<<endl;
}
开发者ID:torque,项目名称:proofana-chicago,代码行数:54,代码来源:test.C
示例5: testPadDimensions
void testPadDimensions(AliMq::Station12Type station, AliMp::PlaneType plane)
{
AliMpDataProcessor mp;
AliMpDataMap* dataMap = mp.CreateDataMap("data");
AliMpDataStreams dataStreams(dataMap);
AliMpSectorReader r(dataStreams, station, plane);
AliMpSector* sector = r.BuildSector();
AliMpSectorSegmentation segmentation(sector);
segmentation.PrintZones();
TVector2 previousDimensions;
for (Int_t i=1; i<segmentation.MaxPadIndexX()+1;i++)
for (Int_t j=1;j<segmentation.MaxPadIndexY()+1;++j) {
if ( segmentation.HasPadByIndices(i,j) ) {
// Check pad dimensions
AliMpPad pad = segmentation.PadByIndices(i,j);
TVector2 dimensions = segmentation.PadDimensions(segmentation.Zone(pad));
if ( dimensions.X() != previousDimensions.X() ||
dimensions.Y() != previousDimensions.Y() ) {
// Print dimensions
cout << "Pad: " << "(" << i << "," << j << ")";
cout << " dimensions: (" << dimensions.X() << ", " << dimensions.Y() << ")"
<< endl;
previousDimensions = dimensions;
}
}
}
}
开发者ID:ktf,项目名称:AliRoot,代码行数:34,代码来源:testSt12PadDimensions.C
示例6: getPlaneProjection
bool TPinholeCamera::getPlaneProjection (const TVector& rktPOINT, TVector2& rtPROJ) const
{
TScalar u, v;
TScalar pt, pu, pv;
TVector tPoint = (rktPOINT - tLocation);
pt = dotProduct (tDirection, tPoint);
pu = dotProduct (I, tPoint) / tPixelSize;
pv = dotProduct (J, tPoint) / tPixelSize;
u = tHalfResX + ((pu / pt) / tPixelSize);
if ( ( u < 0 ) || ( u > (tHalfResX * 2) ) )
{
return false;
}
v = tHalfResY - ((pv / pt) / tPixelSize);
if ( ( v < 0 ) || ( v > (tHalfResY * 2) ) )
{
return false;
}
rtPROJ.set (u, v);
return true;
} /* getPlaneProjection() */
开发者ID:bartholomule,项目名称:panorama,代码行数:27,代码来源:pinhole.cpp
示例7: Pi_versor_reco_from_2hits
inline TVector3 Pi_versor_reco_from_2hits(double deltaz, TVector2 hit1, TVector2 hit2)
{
double px = (hit2.X() - hit1.X())/deltaz;
double py = (hit2.Y() - hit1.Y())/deltaz;
return TVector3(px, py, 1);
}
开发者ID:12345ieee,项目名称:spectrometer,代码行数:6,代码来源:analysis.cpp
示例8: getD0RedMet
// D0 RedMET with CMG trees
double getD0RedMet(double lpx1, double lpy1, double lpterr1,
double lpx2, double lpy2, double lpterr2,
double sumjpx, double sumjpy,
double pfmet, double pfmetphi,
int flav, int pickAFlav = 1) {
if( flav==3 ) {
if( pickAFlav!=1 && pickAFlav!=2 ) {
cout << " *** ERROR *** " << endl;
cout << " You need to pick a flavor in getD0RedMet(...)! " << endl;
throw std::exception();
return -1.;
}
else {
flav = pickAFlav;
}
}
// double wPerpMu = 1.0;
// double wRecMu = 2.0;
// double wUncMu = 2.5;
double wPerpMu = 1.0;
double wRecMu = 1.5;
double wUncMu = 2.75;
// double wPerpEl = 1.5;
// double wRecEl = 2.25;
// double wUncEl = 0.0;
double wPerpEl = 0.75;
double wRecEl = 1.0;
double wUncEl = 0.25;
int seplep = 1;
if (seplep == 0){
wPerpMu = 1.0;
wRecMu = 1.25;
wUncMu = 0.0;
wPerpEl = wPerpMu;
wRecEl = wRecMu;
wUncEl = wUncMu;
}
double kPerp = 1.;
double kRecoil_l = 1.;
double kRecoil_t = 1.;
double kSigmaPt_l = 1.;
double kSigmaPt_t = 1.;
if( flav==1 ) { // mm
kPerp = wPerpMu;
kRecoil_l = kRecoil_t = wRecMu;
kSigmaPt_l = kSigmaPt_t = wUncMu;
}
else if( flav==2 ) { // ee
kPerp = wPerpEl;
kRecoil_l = kRecoil_t = wRecEl;
kSigmaPt_l = kSigmaPt_t = wUncEl;
}
else {}
double pt1 = sqrt(lpx1*lpx1 + lpy1*lpy1);
double pt2 = sqrt(lpx2*lpx2 + lpy2*lpy2);
TVector2 lead, subl;
double leadpt, sublpt, leadpterr, sublpterr;
if(pt1>pt2) {
lead = TVector2(lpx1, lpy1);
subl = TVector2(lpx2, lpy2);
leadpt = pt1;
leadpterr = lpterr1;
sublpt = pt2;
sublpterr = lpterr2;
}
else {
lead = TVector2(lpx2, lpy2);
subl = TVector2(lpx1, lpy1);
leadpt = pt2;
leadpterr = lpterr2;
sublpt = pt1;
sublpterr = lpterr1;
}
// Define the thrust and dilepton
TVector2 dil = lead+subl;
TVector2 thr = lead-subl;
TVector2 longi;
TVector2 perpe;
double deltaPhi = fabs(lead.DeltaPhi(subl));
if( deltaPhi>(3.141592654/2.) ) {
longi = thr.Unit();
perpe = longi.Rotate(3.141592654/2.);
if(perpe*lead<0) perpe *= -1;
}
else {
perpe = dil.Unit();
//.........这里部分代码省略.........
开发者ID:beknapp,项目名称:usercode,代码行数:101,代码来源:plotting_functions.C
示例9: Process
void StdTopVarProcessor::Process(const InputCollections& input,VariableContainer& vars){
if(!initialized) cerr << "tree processor not initialized" << endl;
std::vector<pat::Jet> selectedTaggedJets;
std::vector<pat::Jet> selectedUntaggedJets;
for(std::vector<pat::Jet>::const_iterator itJet = input.selectedJets.begin(); itJet != input.selectedJets.end(); ++itJet){
if(BoostedUtils::PassesCSV(*itJet, 'M')) selectedTaggedJets.push_back(*itJet);
else selectedUntaggedJets.push_back(*itJet);
}
math::XYZTLorentzVector HadW;
math::XYZTLorentzVector HadW1;
math::XYZTLorentzVector HadW2;
for(std::vector<pat::Jet>::const_iterator it1Jet = selectedUntaggedJets.begin(); it1Jet != selectedUntaggedJets.end(); ++it1Jet){
for(std::vector<pat::Jet>::const_iterator it2Jet = selectedUntaggedJets.begin(); it2Jet != selectedUntaggedJets.end(); ++it2Jet){
if(abs(80.4-(it1Jet->p4()+it2Jet->p4()).M())<abs(80.4-(HadW1+HadW2).M())){
HadW1 = it1Jet->p4();
HadW2 = it2Jet->p4();
HadW = HadW1+HadW2;
}
}
}
vars.FillVar( "HadTop_W_Pt",HadW.Pt() );
vars.FillVar( "HadTop_W_E",HadW.E() );
vars.FillVar( "HadTop_W_Eta",HadW.Eta() );
vars.FillVar( "HadTop_W_Phi",HadW.Phi() );
vars.FillVar( "HadTop_W_M",HadW.M() );
vars.FillVar( "HadTop_W1_Pt",HadW1.Pt() );
vars.FillVar( "HadTop_W1_E",HadW1.E() );
vars.FillVar( "HadTop_W1_Eta",HadW1.Eta() );
vars.FillVar( "HadTop_W1_Phi",HadW1.Phi() );
vars.FillVar( "HadTop_W1_M",HadW1.M() );
vars.FillVar( "HadTop_W2_Pt",HadW2.Pt() );
vars.FillVar( "HadTop_W2_E",HadW2.E() );
vars.FillVar( "HadTop_W2_Eta",HadW2.Eta() );
vars.FillVar( "HadTop_W2_Phi",HadW2.Phi() );
vars.FillVar( "HadTop_W2_M",HadW2.M() );
math::XYZTLorentzVector HadB;
math::XYZTLorentzVector HadTop;
for(std::vector<pat::Jet>::const_iterator itJet = selectedTaggedJets.begin(); itJet != selectedTaggedJets.end(); ++itJet){
if(HadTop.M()==0 || abs(172.4-(HadW+itJet->p4()).M())<abs(172.4-HadTop.M())){
HadB = itJet->p4();
HadTop = HadB+HadW;
}
else{
cout << "HadTop_W_Pt: " << HadW.Pt() << ", HadTop_B_Pt: " << itJet->pt() << ", Top mass: " << (HadW+itJet->p4()).M() << endl;
}
}
vars.FillVar( "HadTop_B_Pt",HadB.Pt() );
vars.FillVar( "HadTop_B_E",HadB.E() );
vars.FillVar( "HadTop_B_Eta",HadB.Eta() );
vars.FillVar( "HadTop_B_Phi",HadB.Phi() );
vars.FillVar( "HadTop_B_M",HadB.M() );
// vars.FillVar( "HadTop_B_CSV",MiniAODHelper::GetJetCSV(HadB,btagger) );
// vars.FillVar( "HadTop_B_Flav",HadB.flavour() );
vars.FillVar( "HadTop_Pt",HadTop.Pt() );
vars.FillVar( "HadTop_E",HadTop.E() );
vars.FillVar( "HadTop_Eta",HadTop.Eta() );
vars.FillVar( "HadTop_Phi",HadTop.Phi() );
vars.FillVar( "HadTop_M",HadTop.M() );
math::XYZTLorentzVector nu1;
math::XYZTLorentzVector nu2;
TVector2 MET;
MET.Set(input.pfMET.px(),input.pfMET.py());
math::XYZTLorentzVector PrimLep = BoostedUtils::GetPrimLepVec(input.selectedElectrons, input.selectedMuons);
BoostedUtils::GetNuVecs(PrimLep, MET, nu1, nu2);
math::XYZTLorentzVector LepW;
if(abs(80.4-(nu1+PrimLep).M())<abs(80.4-(nu2+PrimLep).M())) LepW = nu1+PrimLep;
else LepW = nu2+PrimLep;
vars.FillVar( "LepTop_W_Pt",LepW.Pt() );
vars.FillVar( "LepTop_W_E",LepW.E() );
vars.FillVar( "LepTop_W_Eta",LepW.Eta() );
vars.FillVar( "LepTop_W_Phi",LepW.Phi() );
vars.FillVar( "LepTop_W_M",LepW.M() );
math::XYZTLorentzVector LepB;
math::XYZTLorentzVector LepTop;
for(std::vector<pat::Jet>::const_iterator itJet = selectedTaggedJets.begin(); itJet != selectedTaggedJets.end(); ++itJet){
if(LepTop.M()==0 || abs(172.4-(LepW+itJet->p4()).M())<abs(172.4-LepTop.M())){
LepB = itJet->p4();
LepTop = LepW+LepB;
}
}
vars.FillVar( "LepTop_B_Pt",LepB.Pt() );
vars.FillVar( "LepTop_B_E",LepB.E() );
vars.FillVar( "LepTop_B_Eta",LepB.Eta() );
//.........这里部分代码省略.........
开发者ID:okkuntze,项目名称:BoostedTTH,代码行数:101,代码来源:StdTopVarProcessor.cpp
示例10: ttreco2
void ttreco2( TString process ) {
cout << "\n\n" << process << "\n" << endl;
TFile* fshape = new TFile( "/afs/cern.ch/user/j/jgarciaf/mimick/mlb.root" );
TH1F* shapemlb = (TH1F*) fshape->Get( "mlb" );
MassReconstructor theMass( 100, shapemlb );
//TFile myfile( "../minitrees/" + inputdir + "/TTDM/" + process + ".root", "update" );
TFile myfile( "../../../../public/minitrees_week-1_with-ttReco/" + process + ".root", "update" );
//TFile myfile( "../minitrees/week-1-checks/" + process + ".root", "update" );
TTreeReader myreader( "latino", &myfile );
TTree* mytree = (TTree*) myfile.Get( "latino" );
//----- read -------------------------------------------------------
TTreeReaderValue<float> metPfType1 ( myreader, "metPfType1" );
TTreeReaderValue<float> metPfType1Phi( myreader, "metPfType1Phi" );
TTreeReaderValue<float> lep1pt ( myreader, "lep1pt" );
TTreeReaderValue<float> lep1eta ( myreader, "lep1eta" );
TTreeReaderValue<float> lep1phi ( myreader, "lep1phi" );
TTreeReaderValue<float> lep1mass( myreader, "lep1mass" );
TTreeReaderValue<float> lep2pt ( myreader, "lep2pt" );
TTreeReaderValue<float> lep2eta ( myreader, "lep2eta" );
TTreeReaderValue<float> lep2phi ( myreader, "lep2phi" );
TTreeReaderValue<float> lep2mass( myreader, "lep2mass" );
TTreeReaderValue<std::vector<float>> jet_pt ( myreader, "jet_pt" );
TTreeReaderValue<std::vector<float>> jet_eta( myreader, "jet_eta" );
TTreeReaderValue<std::vector<float>> jet_phi( myreader, "jet_phi" );
TTreeReaderValue<std::vector<float>> bjet30csvv2m_pt ( myreader, "bjet30csvv2m_pt" );
TTreeReaderValue<std::vector<float>> bjet30csvv2m_eta( myreader, "bjet30csvv2m_eta" );
TTreeReaderValue<std::vector<float>> bjet30csvv2m_phi( myreader, "bjet30csvv2m_phi" );
//TTreeReaderValue<float> top1pt ( myreader, "top1pt_gen" );
//TTreeReaderValue<float> top1eta ( myreader, "top1eta_gen" );
//TTreeReaderValue<float> top1phi ( myreader, "top1phi_gen" );
//TTreeReaderValue<float> top2pt ( myreader, "top2pt_gen" );
//TTreeReaderValue<float> top2eta ( myreader, "top2eta_gen" );
//TTreeReaderValue<float> top2phi ( myreader, "top2phi_gen" );
//----- write ------------------------------------------------------
float topRecoW;
float darkpt ;
TBranch* b_topRecoW = mytree -> Branch( "topRecoW", &topRecoW, "topRecoW/F" );
TBranch* b_darkpt = mytree -> Branch( "newdarkpt" , &darkpt , "darkpt/F" );
TBranch* b_mimick = mytree -> Branch( "mimick" , &mimick , "mimick/F" );
//----- loop -------------------------------------------------------
int nentries = myreader.GetEntries(1);
//if ( nentries > 10 ) nentries = 10;
for ( Long64_t ievt = 0; ievt < nentries; ievt++ ) {
if( ievt%10000 == 0 ) cout << "\n\n ievt: " << ievt << endl;
myreader.SetEntry(ievt);
//--- MET
TVector2 MET;
MET.SetMagPhi( *metPfType1, *metPfType1Phi );
myreader.SetEntry(ievt);
//--- leptons
TLorentzVector l1, l2; // top1gen, top2gen;
l1.SetPtEtaPhiM( *lep1pt, *lep1eta, *lep1phi, *lep1mass );
l2.SetPtEtaPhiM( *lep2pt, *lep2eta, *lep2phi, *lep2mass );
//top1gen.SetPtEtaPhiM( *top1pt, *top1eta, *top1phi, 173.34 );
//top2gen.SetPtEtaPhiM( *top2pt, *top2eta, *top2phi, 173.34 );
//--- jets
std::vector<TLorentzVector> jets;
std::vector<TLorentzVector> bjets;
//.........这里部分代码省略.........
开发者ID:cedricpri,项目名称:AnalysisCMS,代码行数:101,代码来源:ttreco.C
示例11: e1
void PMCSZCand::SetA(PMCSEMObj &elec1, PMCSEMObj &elec2) {
// First we need to calculate the thrust axis
//
TVector2 e1(elec1.ppx(),elec1.ppy());
TVector2 e2(elec2.ppx(),elec2.ppy());
// Calculate the two phi angles
double phi1=e1.Phi();
double phi2=e2.Phi();
// Order in phi
if (phi1<phi2) {
TVector2 dummy=e1;
e1=e2;
e2=dummy;
double dummy2=phi1;
phi1=phi2;
phi2=dummy2;
}
// Calculate lengths as well
double len1=e1.Mod();
double len2=e2.Mod();
// Good old Newton
//
// initial guess
TVector2 bisector=(e1.Unit()+e2.Unit()).Unit();
double alpha=bisector.Phi()-TMath::Pi()/2.;
double alphaBackup=alpha;
int nIt=0;
// iterate
double oldAlpha=9999.;
while (fabs(alpha-oldAlpha)>0.000001) {
oldAlpha=alpha;
double f=len2*sin(phi2-oldAlpha)+len1*sin(oldAlpha-phi1);
double fp=-len2*cos(phi2-oldAlpha)+len1*cos(oldAlpha-phi1);
alpha=oldAlpha-f/fp;
nIt++;
if (nIt>1000) {
cout<<"Newton did not converge in search for thrust axis"<<endl;
alpha=alphaBackup;
break;
}
}
// Build unit vector
TVector2 r;
r.SetMagPhi(1.,alpha);
TVector2 rPerp=r.Rotate(TMath::Pi()/2.);
// Checks
if (fabs(e1*rPerp-e2*rPerp)>0.001) {
cout<<"Looks like Newton was imprecise in calculation of thrust axis: "<<e1*rPerp<<" "<<e2*rPerp<<endl;
}
// now we can do the projections
TVector2 Z=e1+e2;
_pat=Z*rPerp;
_pal=Z*r;
}
开发者ID:hengne,项目名称:d0wmass,代码行数:62,代码来源:PMCSZCand.cpp
示例12: selectAntiWm
//.........这里部分代码省略.........
u1 = -999;
u2 = -999;
tkU1 = -999;
tkU2 = -999;
mvaU1 = -999;
mvaU2 = -999;
id_1 = -999;
id_2 = -999;
x_1 = -999;
x_2 = -999;
xPDF_1 = -999;
xPDF_2 = -999;
scalePDF = -999;
weightPDF = -999;
if(isSignal && hasGen) {
TLorentzVector *gvec=new TLorentzVector(0,0,0,0);
TLorentzVector *glep1=new TLorentzVector(0,0,0,0);
TLorentzVector *glep2=new TLorentzVector(0,0,0,0);
toolbox::fillGen(genPartArr, BOSON_ID, gvec, glep1, glep2,1);
if (gvec && glep1) {
genV = new TLorentzVector(0,0,0,0);
genV->SetPtEtaPhiM(gvec->Pt(),gvec->Eta(),gvec->Phi(),gvec->M());
genLep = new TLorentzVector(0,0,0,0);
genLep->SetPtEtaPhiM(glep1->Pt(),glep1->Eta(),glep1->Phi(),glep1->M());
genVPt = gvec->Pt();
genVPhi = gvec->Phi();
genVy = gvec->Rapidity();
genVMass = gvec->M();
genLepPt = glep1->Pt();
genLepPhi = glep1->Phi();
TVector2 vWPt((genVPt)*cos(genVPhi),(genVPt)*sin(genVPhi));
TVector2 vLepPt(vLep.Px(),vLep.Py());
TVector2 vMet((info->pfMETC)*cos(info->pfMETCphi), (info->pfMETC)*sin(info->pfMETCphi));
TVector2 vU = -1.0*(vMet+vLepPt);
u1 = ((vWPt.Px())*(vU.Px()) + (vWPt.Py())*(vU.Py()))/(genVPt); // u1 = (pT . u)/|pT|
u2 = ((vWPt.Px())*(vU.Py()) - (vWPt.Py())*(vU.Px()))/(genVPt); // u2 = (pT x u)/|pT|
TVector2 vTkMet((info->trkMET)*cos(info->trkMETphi), (info->trkMET)*sin(info->trkMETphi));
TVector2 vTkU = -1.0*(vTkMet+vLepPt);
tkU1 = ((vWPt.Px())*(vTkU.Px()) + (vWPt.Py())*(vTkU.Py()))/(genVPt); // u1 = (pT . u)/|pT|
tkU2 = ((vWPt.Px())*(vTkU.Py()) - (vWPt.Py())*(vTkU.Px()))/(genVPt); // u2 = (pT x u)/|pT|
TVector2 vMvaMet((info->mvaMET)*cos(info->mvaMETphi), (info->mvaMET)*sin(info->mvaMETphi));
TVector2 vMvaU = -1.0*(vMvaMet+vLepPt);
mvaU1 = ((vWPt.Px())*(vMvaU.Px()) + (vWPt.Py())*(vMvaU.Py()))/(genVPt); // u1 = (pT . u)/|pT|
mvaU2 = ((vWPt.Px())*(vMvaU.Py()) - (vWPt.Py())*(vMvaU.Px()))/(genVPt); // u2 = (pT x u)/|pT|
}
id_1 = gen->id_1;
id_2 = gen->id_2;
x_1 = gen->x_1;
x_2 = gen->x_2;
xPDF_1 = gen->xPDF_1;
xPDF_2 = gen->xPDF_2;
scalePDF = gen->scalePDF;
weightPDF = gen->weight;
delete gvec;
delete glep1;
delete glep2;
gvec=0; glep1=0; glep2=0;
}
开发者ID:thongonary,项目名称:MitEwk13TeV,代码行数:67,代码来源:selectAntiWm.C
示例13: x
template <typename T> ork::TVector2<T>::TVector2( const TVector2<T>& vec)
: x( vec.GetX() )
, y( vec.GetY() )
{
}
开发者ID:tweakoz,项目名称:orkid,代码行数:5,代码来源:cvector2.hpp
示例14: X
matrixstack::Vector::Vector(const TVector2 &v): TVectorT<double>(2)
{
X() = v.X();
Y() = v.Y();
}
开发者ID:A2-Collaboration-dev,项目名称:a2display,代码行数:5,代码来源:matrixstack.cpp
示例15: selectZmm
//.........这里部分代码省略.........
}
//
// Fill tree
//
runNum = info->runNum;
lumiSec = info->lumiSec;
evtNum = info->evtNum;
if (hasGenMatch) matchGen=1;
else matchGen=0;
category = icat;
vertexArr->Clear();
vertexBr->GetEntry(ientry);
npv = vertexArr->GetEntries();
npu = info->nPUmean;
genWeight= hasGen ? gen->weight: 1.;
PUWeight = puWeight;
scale1fb = weight;
scale1fbUp = weightUp;
scale1fbDown = weightDown;
met = info->pfMETC;
metPhi = info->pfMETCphi;
sumEt = 0;
tkMet = info->trkMET;
tkMetPhi = info->trkMETphi;
tkSumEt = 0;
mvaMet = info->mvaMET;
mvaMetPhi = info->mvaMETphi;
mvaSumEt = 0;
TVector2 vZPt((vDilep.Pt())*cos(vDilep.Phi()),(vDilep.Pt())*sin(vDilep.Phi()));
puppiMet = info->puppET;
puppiMetPhi = info->puppETphi;
puppiSumEt = 0;
lep1 = &vTag;
lep2 = &vProbe;
dilep = &vDilep;
sta1 = &vTagSta;
sta2 = &vProbeSta;
TVector2 vMet((info->pfMETC)*cos(info->pfMETCphi), (info->pfMETC)*sin(info->pfMETCphi));
TVector2 vU = -1.0*(vMet+vZPt);
u1 = ((vDilep.Px())*(vU.Px()) + (vDilep.Py())*(vU.Py()))/(vDilep.Pt()); // u1 = (pT . u)/|pT|
u2 = ((vDilep.Px())*(vU.Py()) - (vDilep.Py())*(vU.Px()))/(vDilep.Pt()); // u2 = (pT x u)/|pT|
TVector2 vTkMet((info->trkMET)*cos(info->trkMETphi), (info->trkMET)*sin(info->trkMETphi));
TVector2 vTkU = -1.0*(vTkMet+vZPt);
tkU1 = ((vDilep.Px())*(vTkU.Px()) + (vDilep.Py())*(vTkU.Py()))/(vDilep.Pt()); // u1 = (pT . u)/|pT|
tkU2 = ((vDilep.Px())*(vTkU.Py()) - (vDilep.Py())*(vTkU.Px()))/(vDilep.Pt()); // u2 = (pT x u)/|pT|
TVector2 vMvaMet((info->mvaMET)*cos(info->mvaMETphi), (info->mvaMET)*sin(info->mvaMETphi));
TVector2 vMvaU = -1.0*(vMvaMet+vZPt);
mvaU1 = ((vDilep.Px())*(vMvaU.Px()) + (vDilep.Py())*(vMvaU.Py()))/(vDilep.Pt()); // u1 = (pT . u)/|pT|
mvaU2 = ((vDilep.Px())*(vMvaU.Py()) - (vDilep.Py())*(vMvaU.Px()))/(vDilep.Pt()); // u2 = (pT x u)/|pT|
TVector2 vPuppiMet((info->puppET)*cos(info->puppETphi), (info->puppET)*sin(info->puppETphi));
TVector2 vPuppiU = -1.0*(vPuppiMet+vZPt);
puppiU1 = ((vDilep.Px())*(vPuppiU.Px()) + (vDilep.Py())*(vPuppiU.Py()))/(vDilep.Pt()); // u1 = (pT . u)/|pT|
puppiU2 = ((vDilep.Px())*(vPuppiU.Py()) - (vDilep.Py())*(vPuppiU.Px()))/(vDilep.Pt()); // u2 = (pT x u)/|pT|
outTree->Fill();
delete genV;
开发者ID:MiT-HEP,项目名称:MitEwk13TeV,代码行数:67,代码来源:selectZmm.C
示例16: selectZee
//.........这里部分代码省略.........
}
//
// Fill tree
//
runNum = info->runNum;
lumiSec = info->lumiSec;
evtNum = info->evtNum;
if (hasGenMatch) matchGen=1;
else matchGen=0;
category = icat;
vertexArr->Clear();
vertexBr->GetEntry(ientry);
npv = vertexArr->GetEntries();
npu = info->nPUmean;
genWeight= hasGen ? gen->weight: 1.;
PUWeight = puWeight;
scale1fb = weight;
scale1fbUp = weightUp;
scale1fbDown = weightDown;
met = info->pfMETC;
metPhi = info->pfMETCphi;
sumEt = 0;
tkMet = info->trkMET;
tkMetPhi = info->trkMETphi;
tkSumEt = 0;
mvaMet = info->mvaMET;
mvaMetPhi = info->mvaMETphi;
mvaSumEt = 0;
TVector2 vZPt((vDilep.Pt())*cos(vDilep.Phi()),(vDilep.Pt())*sin(vDilep.Phi()));
puppiMet = info->puppET;
puppiMetPhi = info->puppETphi;
puppiSumEt = 0;
lep1 = &vTag;
lep2 = &vProbe;
dilep = &vDilep;
sc1 = &vTagSC;
sc2 = &vProbeSC;
TVector2 vMet((info->pfMETC)*cos(info->pfMETCphi), (info->pfMETC)*sin(info->pfMETCphi));
TVector2 vU = -1.0*(vMet+vZPt);
u1 = ((vDilep.Px())*(vU.Px()) + (vDilep.Py())*(vU.Py()))/(vDilep.Pt()); // u1 = (pT . u)/|pT|
u2 = ((vDilep.Px())*(vU.Py()) - (vDilep.Py())*(vU.Px()))/(vDilep.Pt()); // u2 = (pT x u)/|pT|
TVector2 vTkMet((info->trkMET)*cos(info->trkMETphi), (info->trkMET)*sin(info->trkMETphi));
TVector2 vTkU = -1.0*(vTkMet+vZPt);
tkU1 = ((vDilep.Px())*(vTkU.Px()) + (vDilep.Py())*(vTkU.Py()))/(vDilep.Pt()); // u1 = (pT . u)/|pT|
tkU2 = ((vDilep.Px())*(vTkU.Py()) - (vDilep.Py())*(vTkU.Px()))/(vDilep.Pt()); // u2 = (pT x u)/|pT|
TVector2 vMvaMet((info->mvaMET)*cos(info->mvaMETphi), (info->mvaMET)*sin(info->mvaMETphi));
TVector2 vMvaU = -1.0*(vMvaMet+vZPt);
mvaU1 = ((vDilep.Px())*(vMvaU.Px()) + (vDilep.Py())*(vMvaU.Py()))/(vDilep.Pt()); // u1 = (pT . u)/|pT|
mvaU2 = ((vDilep.Px())*(vMvaU.Py()) - (vDilep.Py())*(vMvaU.Px()))/(vDilep.Pt()); // u2 = (pT x u)/|pT|
TVector2 vPuppiMet((info->puppET)*cos(info->puppETphi), (info->puppET)*sin(info->puppETphi));
TVector2 vPuppiU = -1.0*(vPuppiMet+vZPt);
puppiU1 = ((vDilep.Px())*(vPuppiU.Px()) + (vDilep.Py())*(vPuppiU.Py()))/(vDilep.Pt()); // u1 = (pT . u)/|pT|
puppiU2 = ((vDilep.Px())*(vPuppiU.Py()) - (vDilep.Py())*(vPuppiU.Px()))/(vDilep.Pt()); // u2 = (pT x u)/|pT|
outTree->Fill();
delete genV;
开发者ID:xmniu,项目名称:MitEwk13TeV,代码行数:67,代码来源:selectZee.C
示例17:
HHKinFit2::HHFitObjectMET::HHFitObjectMET(TVector2 const& v,TVector2 const& vfit)
:HHFitObject(HHLorentzVector(v.X(),v.Y(),0,sqrt(v.X()*v.X()+v.Y()*v.Y()))){
this->setFit4Vector(HHLorentzVector(vfit.X(),vfit.Y(),0,sqrt(vfit.X()*vfit.X()+vfit.Y()*vfit.Y())));
}
开发者ID:thomas-mueller,项目名称:HHKinFit2,代码行数:4,代码来源:HHFitObjectMET.cpp
示例18: selectZee
//.........这里部分代码省略.........
|| ( (abs(gen->id_2)==EGenType::kElectron) && ((toolbox::deltaR(tag->eta, tag->phi, gen->eta_2, gen->phi_2) < 0.5)) );
Bool_t match2 = ( (abs(gen->id_1)==EGenType::kElectron) && ((toolbox::deltaR(vProbe.Eta(), vProbe.Phi(), gen->eta_1, gen->phi_1) < 0.5)) )
|| ( (abs(gen->id_2)==EGenType::kElectron) && ((toolbox::deltaR(vProbe.Eta(), vProbe.Phi(), gen->eta_2, gen->phi_2) < 0.5)) );
if(match1 && match2) hasGenMatch = kTRUE;
};
//
// Fill tree
//
runNum = info->runNum;
lumiSec = info->lumiSec;
evtNum = info->evtNum;
matchGen = hasGenMatch ? 1 : 0;
category = icat;
npv = pvArr->GetEntriesFast();
npu = info->nPU;
genVPt = (hasGen) ? gen->vpt : 0;
genVPhi = (hasGen) ? gen->vphi : 0;
genVy = (hasGen) ? gen->vy : 0;
genVMass = (hasGen) ? gen->vmass : 0;
scale1fb = weight;
met = info->pfMET;
metPhi = info->pfMETphi;
sumEt = info->pfSumET;
lep1 = &vTag;
q1 = tag->q;
lep2 = &vProbe;
q2 = (eleProbe) ? eleProbe->q : -(tag->q);
dilep = &vDilep;
TVector2 vZPt((vDilep.Pt())*cos(vDilep.Phi()),(vDilep.Pt())*sin(vDilep.Phi()));
TVector2 vMet((info->pfMET)*cos(info->pfMETphi), (info->pfMET)*sin(info->pfMETphi));
TVector2 vU = -1.0*(vMet+vZPt);
u1 = ((vDilep.Px())*(vU.Px()) + (vDilep.Py())*(vU.Py()))/(vDilep.Pt()); // u1 = (pT . u)/|pT|
u2 = ((vDilep.Px())*(vU.Py()) - (vDilep.Py())*(vU.Px()))/(vDilep.Pt()); // u2 = (pT x u)/|pT|
///// electron specific /////
sc1 = &vTagSC;
trkIso1 = tag->trkIso03;
emIso1 = tag->emIso03;
hadIso1 = tag->hadIso03;
pfChIso1 = tag->pfChIso03;
pfGamIso1 = tag->pfGamIso03;
pfNeuIso1 = tag->pfNeuIso03;
pfCombIso1 = tag->pfChIso03 + TMath::Max(tag->pfNeuIso03 + tag->pfGamIso03 - (info->rhoLowEta)*getEffArea(tag->scEta), 0.);
sigieie1 = tag->sigiEtaiEta;
hovere1 = tag->HoverE;
eoverp1 = tag->EoverP;
fbrem1 = tag->fBrem;
dphi1 = tag->deltaPhiIn;
deta1 = tag->deltaEtaIn;
ecalE1 = tag->ecalE;
d01 = tag->d0;
dz1 = tag->dz;
isConv1 = tag->isConv;
nexphits1 = tag->nExpHitsInner;
typeBits1 = tag->typeBits;
sc2 = &vProbeSC;
trkIso2 = (eleProbe) ? eleProbe->trkIso03 : -1;
emIso2 = (eleProbe) ? eleProbe->emIso03 : -1;
hadIso2 = (eleProbe) ? eleProbe->hadIso03 : -1;
pfChIso2 = (eleProbe) ? eleProbe->pfChIso03 : -1;
开发者ID:jaylawhorn,项目名称:mitewk,代码行数:67,代码来源:selectZee.C
示例19: smear_JetMET
void smear_JetMET(vector <TLorentzVector> & orig_jets, const TVector2 & orig_met, vector <TLorentzVector> & smear_jets, TVector2 & smear_met, TRandom3* rand3, vector <TF1*> vPtRes, vector <TF1*> vEtaRes, vector <TF1*> vPhiRes, TLorentzVector lep_sum){
smear_jets.clear();
double sum_jpx = 0;
double sum_jpy = 0;
double sum_jpx_sm = 0;
double sum_jpy_sm = 0;
double Pt_sm, Eta_sm, Phi_sm;
TLorentzVector v_temp;
// double a, b, c;
// double Et;
for (unsigned int sui = 0; sui < orig_jets.size(); sui++){
// a = 1.84; b = 1.14; c = 0.027;
// if (orig_jets.at(sui).Eta() < 1.4){
// a = 1.78; b = 1.3; c = 0.053;
// }
// Et = orig_jets.at(sui).Pt();
// Pt_sm = Et + sqrt(a*a + b*b*Et + c*c*Et*Et) * rand3->Gaus();
// Eta_sm = orig_jets.at(sui).Eta();
// Phi_sm = orig_jets.at(sui).Phi();
Long64_t iseed = (Long64_t) 10E10;
gRandom->SetSeed(rand3->Integer(iseed));
// Pt_sm = orig_jets.at(sui).Pt() * (1 + (vPtRes.at(sui)->GetRandom() - 1) * 1.1);
Pt_sm = orig_jets.at(sui).Pt() * vPtRes.at(sui)->GetRandom();
gRandom->SetSeed(rand3->Integer(iseed));
Eta_sm = orig_jets.at(sui).Eta() + vEtaRes.at(sui)->GetRandom();
gRandom->SetSeed(rand3->Integer(iseed));
Phi_sm = orig_jets.at(sui).Phi() + vPhiRes.at(sui)->GetRandom();
v_temp.SetPtEtaPhiM(Pt_sm, Eta_sm, Phi_sm, orig_jets.at(sui).M());
sum_jpx += orig_jets.at(sui).Px();
sum_jpy += orig_jets.at(sui).Py();
sum_jpx_sm += v_temp.Px();
sum_jpy_sm += v_temp.Py();
smear_jets.push_back(v_temp);
}
double unclust_metx = orig_met.Px() + sum_jpx + lep_sum.Px();
double unclust_mety = orig_met.Py() + sum_jpy + lep_sum.Py();
//10% resolution
double unclust_metx_sm = unclust_metx * (1 + 0.1*rand3->Gaus());
double unclust_mety_sm = unclust_mety * (1 + 0.1*rand3->Gaus());
smear_met.Set(orig_met.Px() + sum_jpx - unclust_metx - sum_jpx_sm + unclust_metx_sm, orig_met.Py() + sum_jpy - unclust_mety - sum_jpy_sm + unclust_mety_sm);
}
开发者ID:AlecAivazis,项目名称:condorBatch,代码行数:64,代码来源:Resolutions.C
示例20: fillCategory
void fillCategory(EventTree* tree, TH1F* hist, double weight){
int EleP = 0;
int EleM = 0;
int MuP = 0;
int MuM = 0;
int TauP = 0;
int TauM = 0;
int ElePfid = 0;
int EleMfid = 0;
int MuPfid = 0;
int MuMfid = 0;
int nNufid = 0;
int nPhofid = 0;
int nJetfid = 0;
int nBJetfid = 0;
TVector2 MET = TVector2(0,0);
TVector2 tempNu = TVector2(0,0);
for( int mcI = 0; mcI < tree->nMC_; ++mcI){
if(abs(tree->mcMomPID->at(mcI))==24 && tree->mcParentage->at(mcI)==10){
if( tree->mcPID->at(mcI) == 11 ) EleP = 1;
if( tree->mcPID->at(mcI) == -11 ) EleM = 1;
if( tree->mcPID->at(mcI) == 13 ) MuP = 1;
if( tree->mcPID->at(mcI) == -13 ) MuM = 1;
if( tree->mcPID->at(mcI) == 15) TauP = 1;
if( tree->mcPID->at(mcI) == -15) TauM = 1;
}
if((abs(tree->mcMomPID->at(mcI))==24 && tree->mcParentage->at(mcI)==10) || (abs(tree->mcMomPID->at(mcI))==15 && tree->mcParentage->at(mcI)==26)){
if( tree->mcPID->at(mcI) == 11 ) {
if (tree->mcPt->at(mcI) > 35 && (fabs(tree->mcEta->at(mcI)) < 2.5 && !(fabs(tree->mcEta->at(mcI)) > 1.4442 && fabs(tree->mcEta->at(mcI))<1.566))) ElePfid += 1;
}
if( tree->mcPID->at(mcI) == -11 ) {
if (tree->mcPt->at(mcI) > 35 && (fabs(tree->mcEta->at(mcI)) < 2.5 && !(fabs(tree->mcEta->at(mcI)) > 1.4442 && fabs(tree->mcEta->at(mcI))<1.566))) EleMfid += 1;
}
if( tree->mcPID->at(mcI) == 13 ) {
if (tree->mcPt->at(mcI) > 26 && fabs(tree->mcEta->at(mcI)) < 2.1) MuPfid += 1;
}
if( tree->mcPID->at(mcI) == -13 ) {
if (tree->mcPt->at(mcI) > 26 && fabs(tree->mcEta->at(mcI)) < 2.1) MuMfid += 1;
}
}
if( fabs(tree->mcPID->at(mcI)) == 12 || fabs(tree->mcPID->at(mcI)) == 14 || fabs(tree->mcPID->at(mcI)) == 16 ) {
if (tree->mcPt->at(mcI) > 20){
nNufid += 1;
//cout << nNufid << "\t" << tree->run_ << tree->lumis_ << tree->event_ << "\t" << mcI << "\t" << tree->mcPt->at(mcI) << "\t" << tree->mcEta->at(mcI) << "\t" << tree->mcPhi->at(mcI) << endl;
}
tempNu.SetMagPhi(tree->mcPt->at(mcI),tree->mcPhi->at(mcI));
MET += tempNu;
// cout << nNufid << "\t" << tree->run_ << tree->lumis_ << tree->event_ << "\t" << mcI << "\t" << tree->mcPID->at(mcI) << "\t" << tree->mcPt->at(mcI) << "\t" << tree->mcEta->at(mcI) << "\t" << tree->mcPhi->at(mcI) << "\t" << MET.Mod() << endl;
}
if(tree->mcPID->at(mcI) == 22 &&
(tree->mcParentage->at(mcI)==2 || tree->mcParentage->at(mcI)==10 || tree->mcParentage->at(mcI)==26) &&
tree->mcPt->at(mcI) > 25 &&
fabs(tree->mcEta->at(mcI)) < 1.4442){
nPhofid += 1;
}
if( abs(tree->mcPID->at(mcI)) < 6 && (abs(tree->mcMomPID->at(mcI))==24 || abs(tree->mcMomPID->at(mcI))==6 ) && tree->mcPt->at(mcI) > 30 && abs(tree->mcEta->at(mcI))<2.4 ) {
nJetfid += 1;
if (abs(tree->mcMomPID->at(mcI))==6 && abs(tree->mcPID->at(mcI))==5){
nBJetfid += 1;
}
}
|
请发表评论