//returns a projection onto the 2D plane TVector3 Projection(TVector3 jaxis){ //Find the projection of a jet onto this subspace if(v1.Mag() == 0) { scalar1 = 0; } else { scalar1 = jaxis.Dot(v1)/(v1.Dot(v1)); } if(v2.Mag() == 0) { scalar2 = 0; } else { scalar2 = jaxis.Dot(v2)/(v2.Dot(v2)); } v1 = scalar1*v1; v2 = scalar2*v2; proj(0) = v1(0) + v2(0); proj(1) = v1(1) + v2(1); proj(2) = v1(2) + v2(2); return proj; }//end of projection
// This is the pt corrected MR - here, we assume the pt // of the Higgs is (MET+Pt+Qt); // L1 and L2 are the 4-vectors for the 2 hemispheres, or in you case, // the two leptons - setting mass to 0 should be fine // MET is the MET 3 vector (don't forget to set the z-component of // MET to 0) // Also, 2 times this variable should give you the Higgs mass double HWWKinematics::CalcMRNEW(){ TVector3 vI = MET+L1.Vect()+L2.Vect(); vI.SetZ(0.0); double L1pL2 = CalcMR(); //Note - this calls the old MR function double vptx = (L1+L2).Px(); double vpty = (L1+L2).Py(); TVector3 vpt; vpt.SetXYZ(vptx,vpty,0.0); float MR2 = 0.5*(L1pL2*L1pL2-vpt.Dot(vI)+L1pL2*sqrt(L1pL2*L1pL2+vI.Dot(vI)-2.*vI.Dot(vpt))); return sqrt(MR2); }
// M is the MET 3 vector (don't forget to set the z-component of // MET to 0) double HWWKinematics::CalcMRNEW(TLorentzVector P, TLorentzVector Q, TVector3 M){ TVector3 vI = M+P.Vect()+Q.Vect(); vI.SetZ(0.0); double PpQ = CalcMR(P,Q); //Note - this calls the old MR function double vptx = (P+Q).Px(); double vpty = (P+Q).Py(); TVector3 vpt; vpt.SetXYZ(vptx,vpty,0.0); float MR2 = 0.5*(PpQ*PpQ-vpt.Dot(vI)+PpQ*sqrt(PpQ*PpQ+vI.Dot(vI)-2.*vI.Dot(vpt))); return sqrt(MR2); }
// This is the pt corrected delta phi between the 2 leptons // P and L2 are the 4-vectors for the 2 hemispheres, or in you case, // the two leptons - setting mass to 0 should be fine // MET is the MET 3 vector (don't forget to set the z-component of // MET to 0) // This function will do the correct Lorentz transformations of the // leptons for you double HWWKinematics::CalcDeltaPhiRFRAME(){ // first calculate pt-corrected MR float mymrnew = CalcMRNEW(); // Now, boost lepton system to rest in z // (approximate accounting for longitudinal boost) TVector3 BL = L1.Vect()+L2.Vect(); BL.SetX(0.0); BL.SetY(0.0); BL = (1./(L1.P()+L2.P()))*BL; L1.Boost(-BL); L2.Boost(-BL); // Next, calculate the transverse Lorentz transformation // to go to Higgs approximate rest frame TVector3 B = L1.Vect()+L2.Vect()+MET; B.SetZ(0.0); B = (-1./(sqrt(4.*mymrnew*mymrnew+B.Dot(B))))*B; L1.Boost(B); L2.Boost(B); //Now, re-calculate the delta phi // in the new reference frame: return L1.DeltaPhi(L2); }
// This is the deltaphi between the di-lepton system and the Higgs // boost in the approximate Higgs rest frame, or R-FRAME // L1 and L2 are the 4-vectors for the 2 hemispheres, or in you case, // the two leptons - setting mass to 0 should be fine // MET is the MET 3 vector (don't forget to set the z-component of // MET to 0) // This function will do the correct Lorentz transformations of the // leptons for you double HWWKinematics::CalcDoubleDphiRFRAME(){ // first calculate pt-corrected MR float mymrnew = CalcMRNEW(); TVector3 BL = L1.Vect()+L2.Vect(); BL.SetX(0.0); BL.SetY(0.0); BL = (1./(L1.P()+L2.P()))*BL; L1.Boost(-BL); L2.Boost(-BL); //Next, calculate the transverse Lorentz transformation TVector3 B = L1.Vect()+L2.Vect()+MET; B.SetZ(0.0); B = (-1./(sqrt(4.*mymrnew*mymrnew+B.Dot(B))))*B; L1.Boost(B); L2.Boost(B); // Now, calculate the delta phi // between di-lepton axis and boost // in new reference frame return B.DeltaPhi(L1.Vect()+L2.Vect()); }
// // // double analysisClass::visPzeta( unsigned int iMuR, unsigned int iTauR ){ TVector3 muT; TVector3 tauT; TVector3 unitmuT; TVector3 unittauT; TVector3 unitbisecT; TVector3 MET; muT.SetPtEtaPhi( muPtcorr(iMuR), 0, MuonPhi->at(iMuR) ); tauT.SetPtEtaPhi( tauPtcorr(iTauR), 0, HPSTauPhi->at(iTauR) ); unitmuT=muT*(1./muT.Mag()); unittauT=tauT*(1./tauT.Mag()); unitbisecT=(unitmuT+unittauT)*(1./((unitmuT+unittauT).Mag())); MET.SetPtEtaPhi( METcorr("Pt"), 0, METcorr("Phi") ); double pZetaVis; pZetaVis = unitbisecT.Dot( (muT+tauT) ); return pZetaVis; }
TVector3 CalculateScatVec(TVector3 Incoming ,TVector3 ScatLab){ //What is quicker passing in same value each time or defining value here each time? zprime = income.Unit(); yprime = zlab.Cross(-income); yprime = yprime.Unit(); xprime = yprime.Cross(zprime); xprime = xprime.Unit(); RotM[0][0] = xlab.Dot(xprime) ; RotM[0][1] = xlab.Dot(yprime); RotM[0][2] = xlab.Dot(zprime); RotM[1][0] = ylab.Dot(xprime); RotM[1][1] = ylab.Dot(yprime) ; RotM[1][2] = ylab.Dot(zprime) ; RotM[2][0] = zlab.Dot(xprime); RotM[2][1] = zlab.Dot(yprime); RotM[2][2] = zlab.Dot(zprime); TVector3 ScatNuc; ScatNuc(0) = (RotM[0][0]*ScatLab(0) + RotM[1][0]*ScatLab(1) + RotM[2][0]*ScatLab(2) ); ScatNuc(1) = (RotM[0][1]*ScatLab(0) + RotM[1][1]*ScatLab(1) + RotM[2][1]*ScatLab(2) ); ScatNuc(2) = (RotM[0][2]*ScatLab(0) + RotM[1][2]*ScatLab(1) + RotM[2][2]*ScatLab(2) ); //std::cout << zprime(0) << " " << zprime(1) << " " << zprime(2) <<std::endl; return ScatNuc; }
// This is the pt corrected delta phi between the 2 mega-jets // P and Q are the 4-vectors for the 2 hemispheres // M is the MET 3 vector (don't forget to set the z-component of // MET to 0) // This function will do the correct Lorentz transformations of the // leptons for you double HWWKinematics::CalcDeltaPhiNEW(TLorentzVector P, TLorentzVector Q, TVector3 M){ // first calculate pt-corrected MR float mymrnew = CalcMRNEW(L1,L2,MET); //Next, calculate the transverse Lorentz transformation TVector3 B = P.Vect()+Q.Vect()+MET; B.SetZ(0.0); B = (-1./(sqrt(4.*mymrnew*mymrnew+B.Dot(B))))*B; P.Boost(B); Q.Boost(B); //Now, re-calculate the delta phi // in the new reference frame: return P.DeltaPhi(Q); }
// // // double analysisClass::deltaPzeta( unsigned int iMuR, unsigned int iTauR ){ TVector3 muT; TVector3 tauT; TVector3 unitmuT; TVector3 unittauT; TVector3 unitbisecT; TVector3 MET; muT.SetPtEtaPhi( muPtcorr(iMuR), 0, MuonPhi->at(iMuR) ); tauT.SetPtEtaPhi( tauPtcorr(iTauR), 0, HPSTauPhi->at(iTauR) ); unitmuT=muT*(1./muT.Mag()); unittauT=tauT*(1./tauT.Mag()); unitbisecT=(unitmuT+unittauT)*(1./((unitmuT+unittauT).Mag())); MET.SetPtEtaPhi( METcorr("Pt"), 0, METcorr("Phi") ); double pZeta; double pZetaVis; pZeta = unitbisecT.Dot( (muT+tauT+MET) ); pZetaVis = unitbisecT.Dot( (muT+tauT) ); /*std::cout<<" TauMag, MuMag: "<<unitmuT.Mag()<<" "<<unittauT.Mag()<<std::endl; std::cout<<" Mu-bisec: "<<muT.DeltaPhi(unitbisecT)<<std::endl; std::cout<<" Tau-bisec: "<<tauT.DeltaPhi(unitbisecT)<<std::endl; std::cout<<" Tau-Mu: "<<tauT.DeltaPhi(muT)<<std::endl; std::cout<<"(pZeta-1.5*pZetaVis): "<<(pZeta-1.5*pZetaVis)<<std::endl; std::cout<<std::endl;*/ return (pZeta-1.5*pZetaVis); }
double HWWKinematics::CalcUnboostedMTR(TLorentzVector P, TLorentzVector Q, TVector3 M){ // first calculate pt-corrected MR float mymrnew = CalcMRNEW(L1,L2,MET); //Next, calculate the transverse Lorentz transformation TVector3 B = P.Vect()+Q.Vect()+MET; B.SetZ(0.0); B = (-1./(sqrt(4.*mymrnew*mymrnew+B.Dot(B))))*B; P.Boost(B); Q.Boost(B); //Now, re-calculate MTR in the new reference frame: float mymtrnew = CalcMTRNEW(P, Q); //R is now just the ratio of mymrnew and mymtrnew; return mymtrnew; }
void findEangHang(const TVector3& antnorm, const TVector3& sourcedir, Float_t& eang, Float_t& hang) { // both should already be unit vectors // E angle projects onto the plane const TVector3 w = (antnorm.Dot(sourcedir)) * antnorm; const TVector3 v = sourcedir - w; eang = TMath::Abs( TMath::Pi() - v.Theta() ); // H angle projects out of the plane hang = TMath::Abs( TMath::Pi() - w.Theta() ); #ifdef DEBUG Printf("w:"); w.Print(); Printf("v:"); v.Print(); #endif }
//_____________________________________________________________________________ bool THaSpectrometerDetector::CalcTrackIntercept(THaTrack* theTrack, Double_t& t, Double_t& xcross, Double_t& ycross) { // projects a given track on to the plane of the detector // xcross and ycross are the x and y coords of this intersection // t is the distance from the origin of the track to the given plane. // // If a hit is NOT found, then t, xcross, and ycross are unchanged. TVector3 t0( theTrack->GetX(), theTrack->GetY(), 0.0 ); Double_t norm = TMath::Sqrt(1.0 + theTrack->GetTheta()*theTrack->GetTheta() + theTrack->GetPhi()*theTrack->GetPhi()); TVector3 t_hat( theTrack->GetTheta()/norm, theTrack->GetPhi()/norm, 1.0/norm ); TVector3 v; if( !IntersectPlaneWithRay( fXax, fYax, fOrigin, t0, t_hat, t, v )) return false; v -= fOrigin; xcross = v.Dot(fXax); ycross = v.Dot(fYax); return true; }
//________________________________________________________________________________ //void Db(const Char_t *tabNam = "Calibrations/tpc/noiseElim", // void DbS(const Char_t *tabNam = // "Survey/svt/LadderOnSurvey",Int_t date = 20051101, Int_t time = 0 void MakeSvtWaferOnGlobal(Int_t date = 20050101, Int_t time = 65 ){ TGeoHMatrix GL, WL,LSU,LSH,SHG,WG; if (dbMk == 0) Load(); dbMk->SetDebug(2); dbMk->SetDateTime(date,time); // dbMk->SetFlavor("ofl+laserDV","tpcDriftVelocity"); // dbMk->SetMaxEntryTime(20040520,0); // to browse 1 database, use this one TDataSet *set = dbMk->GetDataBase("Geometry/ssd"); if (! set) return; // Positioning of the SSD: St_Survey *SsdOnGlobal = (St_Survey *) set->Find("SsdOnGlobal"); if (! SsdOnGlobal) {cout << "SsdOnGlobal has not been found" << endl; return;} Survey_st *OnGlobal = SsdOnGlobal->GetTable(); // SSD and SVT as whole GL.SetRotation(&OnGlobal->r00); GL.SetTranslation(&OnGlobal->t0); //cout << "WL\t"; WL.Print(); set = dbMk->GetDataBase("Geometry/svt"); St_Survey *WaferOnLadder = (St_Survey *) set->Find("WaferOnLadder"); St_Survey *LadderOnSurvey = (St_Survey *) set->Find("LadderOnSurvey"); St_Survey *LadderOnShell = (St_Survey *) set->Find("LadderOnShell"); St_Survey *ShellOnGlobal = (St_Survey *) set->Find("ShellOnGlobal"); Int_t NW = WaferOnLadder->GetNRows(); Int_t NL = LadderOnSurvey->GetNRows(); Survey_st *waferOnLadder = WaferOnLadder->GetTable(); Survey_st *ladderOnSurvey = LadderOnSurvey->GetTable(); Survey_st *ladderOnShell = LadderOnShell->GetTable(); Survey_st *shellOnGlobal0 = ShellOnGlobal->GetTable(0); Survey_st *shellOnGlobal1 = ShellOnGlobal->GetTable(1); St_svtWafersPosition *svtwafer = new St_svtWafersPosition("svtWafersPosition",216); svtWafersPosition_st row; for (Int_t i = 0; i < NW; i++, waferOnLadder++) { Int_t Idw = waferOnLadder->Id; WL.SetRotation(&waferOnLadder->r00); WL.SetTranslation(&waferOnLadder->t0); // if (i==0) WL.Print(); Int_t wshell = 0; Int_t wbarrel = Idw/1000; Int_t wwafer = (Idw - 1000*wbarrel)/100; Int_t wladder = Idw%100; Int_t wlayer = 2*wbarrel + wladder%2 - 1; // cout << waferOnLadder->Id << " "<< Idw<< " " << 100*wwafer + wladder + 1000*wlayer <<endl; for ( Int_t j = 0; j < NL; j++, ladderOnSurvey++, ladderOnShell++) { Int_t Idl = ladderOnSurvey->Id; Int_t lbarrel = Idl/1000; Int_t lladder = Idl%100; if( wladder == lladder ) { LSU.SetRotation(&ladderOnSurvey->r00); LSU.SetTranslation(&ladderOnSurvey->t0); LSH.SetRotation(&ladderOnShell->r00); LSH.SetTranslation(&ladderOnShell->t0); if( (wbarrel == 1 && wladder <= 4) || (wbarrel == 2 && wladder <= 6) || (wbarrel == 3 && wladder <= 8) ) { SHG.SetRotation(&shellOnGlobal0->r00); SHG.SetTranslation(&shellOnGlobal0->t0); }else { SHG.SetRotation(&shellOnGlobal1->r00); SHG.SetTranslation(&shellOnGlobal1->t0); } // SsdOnGlobal * ShellOnGlobal * LadderOnShell * LadderOnSurvey * WaferOnLadder WG = GL * SHG * LSH * LSU * WL; // WG.Print(); // TGeoHMatrix WGInv = WG.Inverse(); Double_t *r = WG.GetRotationMatrix(); Int_t fail = 0; for (int l = 0; l < 9; l++) { if (TMath::Abs(r[l]) >= 1.000001) fail++; } if (fail) { cout << "===============" << waferOnLadder->Id << " "<< Idw << " " << 100*wwafer + wladder + 1000*wlayer <<endl; cout << "WG\t"; WG.Print(); // cout << "SHG\t"; SHG.Print(); // cout << "LSH\t"; LSH.Print(); // cout << "LSU\t"; LSU.Print(); // cout << "WL\t"; WL.Print(); } row.driftDirection[0] = r[0]; row.normalDirection[0] = r[1]; row.transverseDirection[0] = r[2]; row.driftDirection[1] = r[3]; row.normalDirection[1] = r[4]; row.transverseDirection[1] = r[5]; row.driftDirection[2] = r[6]; row.normalDirection[2] = r[7]; row.transverseDirection[2] = r[8]; Double_t norm; TVector3 d(row.driftDirection); norm = 1/d.Mag(); d *= norm; TVector3 t(row.transverseDirection); norm = 1/t.Mag(); t *= norm; TVector3 n(row.normalDirection); TVector3 c = d.Cross(t); if (c.Dot(n) < 0) c *= -1; d.GetXYZ(row.driftDirection); t.GetXYZ(row.transverseDirection); c.GetXYZ(row.normalDirection); row.ID = 100*wwafer + wladder + 1000*wlayer; Double_t *wgtr = WG.GetTranslation(); memcpy(row.centerPosition,wgtr, 3*sizeof(Double_t)); svtwafer->AddAt(&row); break; } } } ofstream out; out.open(Form("svtWafersPosition.%8i.%06i.C",date,time)); svtwafer->SavePrimitive(out,""); out.close(); }
Bool_t Selector_p3pi::Process(Long64_t entry) { // The Process() function is called for each entry in the tree (or possibly // keyed object in the case of PROOF) to be processed. The entry argument // specifies which entry in the currently loaded tree is to be processed. // It can be passed to either Selector_p3pi::GetEntry() or TBranch::GetEntry() // to read either all or the required parts of the data. When processing // keyed objects with PROOF, the object is already loaded and is available // via the fObject pointer. // // This function should contain the "body" of the analysis. It can contain // simple or elaborate selection criteria, run algorithms on the data // of the event and typically fill histograms. // // The processing can be stopped by calling Abort(). // // Use fStatus to set the return value of TTree::Process(). // // The return value is currently not used. GetEntry(entry); /********************************************* SETUP UNIQUENESS TRACKING ********************************************/ //PREVENT-DOUBLE COUNTING WHEN HISTOGRAMMING //Sometimes, some content is the exact same between one combo and the next //e.g. maybe two combos have different beam particles, but the same data for the final-state //When histogramming, you don't want to double-count when this happens: artificially inflates your signal (or background) //So, for each quantity you histogram, keep track of what particles you used (for a given combo) //Use the combo-independent particle indices (i.e. the indices to "ChargedHypo," "NeutralShower," and/or "Beam" //Then for each combo, just compare to what you used before, and make sure it's unique //In general: Could have multiple particles with the same PID: Use a set (easier, faster to search) //In general: Multiple PIDs, so multiple sets: Contain within a map //Multiple combos: Contain maps within a set (easier, faster to search) set<map<Particle_t, set<Int_t> > > locUsedSoFar_Pi0Mass; set<map<Particle_t, set<Int_t> > > locUsedSoFar_MissingMass; set<map<Particle_t, set<Int_t> > > locUsedSoFar_OmegaMass; set<Int_t> locUsedSoFar_BeamEnergy; set<Int_t> locUsedSoFar_MandelstamT; set<set<Int_t> > locUsedSoFar_ExtraPi0; bool locNumExtraTracksFilledFlag = false; /************************************************* LOOP OVER COMBOS *************************************************/ //Loop over combos int locNumSurvivingCombos = 0; for(UInt_t loc_i = 0; loc_i < NumCombos; ++loc_i) { // Is used to mark when combos are cut if(IsComboCut[loc_i]) // Is false initially continue; // Combo has been cut previously /***************************************** READ/SETUP DATA FOR THIS COMBO ****************************************/ // Particle info is split between combo-dependent and combo-independent // For combo-dependent (e.g. PID, kinfit p4), use the branches starting with the particle name (<Name>) // e.g. PiPlus__P4_KinFit // For combo-independent (e.g. measured p4, dE/dx, etc.), use the branches starting with either: // "ChargedHypo," "NeutralShower," or "Beam" // However, these are arrays. The array index that you need is given by the branches: // "<Name>__ChargedIndex," "<Name>__ShowerIndex," or "ComboBeam__BeamIndex" // If using charged PIDs for which hypos are not created by default (e.g. e+, e-), beware! (pi+/-, k+/-, and p are fine) // The energy in the "P4_Measured" will be computed with a different mass than the one you're using // So you'll need to recompute it yourself. However, the "P4_KinFit" will be fine. // Get particle indices: These point from combo-particle to combo-independent data Int_t locPhoton1Index = Photon1__ShowerIndex[loc_i]; Int_t locPhoton2Index = Photon2__ShowerIndex[loc_i]; Int_t locPiPlusIndex = PiPlus__ChargedIndex[loc_i]; Int_t locPiMinusIndex = PiMinus__ChargedIndex[loc_i]; Int_t locProtonIndex = Proton__ChargedIndex[loc_i]; Int_t locBeamIndex = ComboBeam__BeamIndex[loc_i]; // Get Measured Neutral P4's: Combo-dependent (P4 defined by combo-dependent vertex position) TLorentzVector& locPhoton1P4_Measured = *((TLorentzVector*)Photon1__P4_Measured->At(loc_i)); TLorentzVector& locPhoton2P4_Measured = *((TLorentzVector*)Photon2__P4_Measured->At(loc_i)); // Get KinFit Neutral P4's: Combo-dependent TLorentzVector& locPhoton1P4_KinFit = *((TLorentzVector*)Photon1__P4_KinFit->At(loc_i)); TLorentzVector& locPhoton2P4_KinFit = *((TLorentzVector*)Photon2__P4_KinFit->At(loc_i)); // Get Measured Charged P4's: Combo-independent TLorentzVector& locPiPlusP4_Measured = *((TLorentzVector*)ChargedHypo__P4_Measured->At(locPiPlusIndex)); TLorentzVector& locPiMinusP4_Measured = *((TLorentzVector*)ChargedHypo__P4_Measured->At(locPiMinusIndex)); TLorentzVector& locProtonP4_Measured = *((TLorentzVector*)ChargedHypo__P4_Measured->At(locProtonIndex)); // Get KinFit Charged P4's: Combo-dependent TLorentzVector& locPiPlusP4_KinFit = *((TLorentzVector*)PiPlus__P4_KinFit->At(loc_i)); TLorentzVector& locPiMinusP4_KinFit = *((TLorentzVector*)PiMinus__P4_KinFit->At(loc_i)); TLorentzVector& locProtonP4_KinFit = *((TLorentzVector*)Proton__P4_KinFit->At(loc_i)); // Get Measured Beam P4: Combo-independent TLorentzVector& locBeamP4_Measured = *((TLorentzVector*)Beam__P4_Measured->At(locBeamIndex)); // Get KinFit Beam P4: Combo-dependent TLorentzVector& locBeamP4_KinFit = *((TLorentzVector*)ComboBeam__P4_KinFit->At(locBeamIndex)); // Combine 4-vectors TLorentzVector locPi0P4_Measured = locPhoton1P4_Measured + locPhoton2P4_Measured; TLorentzVector locPi0P4_KinFit = locPhoton1P4_KinFit + locPhoton2P4_KinFit; TLorentzVector locOmegaP4_Measured = locPiPlusP4_Measured + locPiMinusP4_Measured + locPi0P4_Measured; TLorentzVector locOmegaP4_KinFit = locPiPlusP4_KinFit + locPiMinusP4_KinFit + locPi0P4_KinFit; TLorentzVector locFinalStateP4_Measured = locOmegaP4_Measured + locProtonP4_Measured; TLorentzVector locFinalStateP4_KinFit = locOmegaP4_KinFit + locProtonP4_KinFit; TLorentzVector locInitialStateP4_Measured = locBeamP4_Measured + dTargetP4; TLorentzVector locInitialStateP4_KinFit = locBeamP4_KinFit + dTargetP4; TLorentzVector locMissingP4_Measured = locInitialStateP4_Measured - locFinalStateP4_Measured; /****************************************************** PI0 ******************************************************/ //Mass double locPi0Mass_Measured = locPi0P4_Measured.M(); double locPi0Mass_KinFit = locPi0P4_KinFit.M(); //Build the map of particles used for the pi0 mass map<Particle_t, set<Int_t> > locUsedThisCombo_Pi0Mass; locUsedThisCombo_Pi0Mass[Gamma].insert(locPhoton1Index); locUsedThisCombo_Pi0Mass[Gamma].insert(locPhoton2Index); //compare to what's been used so far if(locUsedSoFar_Pi0Mass.find(locUsedThisCombo_Pi0Mass) == locUsedSoFar_Pi0Mass.end()) { //unique pi0 combo: histogram it, and register this combo of particles dHist_Pi0Mass_Measured->Fill(locPi0Mass_Measured); dHist_Pi0Mass_KinFit->Fill(locPi0Mass_KinFit); locUsedSoFar_Pi0Mass.insert(locUsedThisCombo_Pi0Mass); } //Cut pi0 mass (+/- 3 sigma) // if((locPi0Mass_Measured < 0.0775209) || (locPi0Mass_Measured > 0.188047)) // continue; //could also mark combo as cut, then save cut results to a new TTree if((locPi0Mass_KinFit < 0.102284) || (locPi0Mass_KinFit > 0.167278)) continue; //could also mark combo as cut, then save cut results to a new TTree /********************************************* MISSING MASS SQUARED **********************************************/ //Missing Mass Squared double locMissingMassSquared = locMissingP4_Measured.M2(); //Build the map of particles used for the missing mass //For beam: Don't want to group with final-state photons. Instead use "Unknown" PID (not ideal, but it's easy). map<Particle_t, set<Int_t> > locUsedThisCombo_MissingMass; locUsedThisCombo_MissingMass[Gamma] = locUsedThisCombo_Pi0Mass[Gamma]; locUsedThisCombo_MissingMass[PiPlus].insert(locPiPlusIndex); locUsedThisCombo_MissingMass[PiMinus].insert(locPiMinusIndex); locUsedThisCombo_MissingMass[Proton].insert(locProtonIndex); locUsedThisCombo_MissingMass[Unknown].insert(locBeamIndex); //beam //compare to what's been used so far if(locUsedSoFar_MissingMass.find(locUsedThisCombo_MissingMass) == locUsedSoFar_MissingMass.end()) { //unique missing mass combo: histogram it, and register this combo of particles dHist_MissingMassSquared->Fill(locMissingMassSquared); locUsedSoFar_MissingMass.insert(locUsedThisCombo_MissingMass); } //Cut if((locMissingMassSquared < -0.007) || (locMissingMassSquared > 0.005)) continue; //could also mark combo as cut, then save cut results to a new TTree /***************************************************** OMEGA *****************************************************/ //Mass double locOmegaMass_Measured = locOmegaP4_Measured.M(); double locOmegaMass_KinFit = locOmegaP4_KinFit.M(); //Build the map of particles used for the omega mass map<Particle_t, set<Int_t> > locUsedThisCombo_OmegaMass; locUsedThisCombo_OmegaMass[Gamma] = locUsedThisCombo_Pi0Mass[Gamma]; locUsedThisCombo_OmegaMass[PiPlus].insert(locPiPlusIndex); locUsedThisCombo_OmegaMass[PiMinus].insert(locPiMinusIndex); //compare to what's been used so far bool locOmegaUniqueFlag = false; //will check later for asymmetry if(locUsedSoFar_OmegaMass.find(locUsedThisCombo_OmegaMass) == locUsedSoFar_OmegaMass.end()) { //unique missing mass combo: histogram it, and register this combo of particles locOmegaUniqueFlag = true; dHist_OmegaMass_Measured->Fill(locOmegaMass_Measured); dHist_OmegaMass_KinFit->Fill(locOmegaMass_KinFit); locUsedSoFar_OmegaMass.insert(locUsedThisCombo_OmegaMass); } //Cut if((locOmegaMass_KinFit < 0.72) || (locOmegaMass_KinFit > 0.84)) continue; //could also mark combo as cut, then save cut results to a new TTree /************************************************ BEAM ENERGY, T *************************************************/ //Histogram beam energy (if haven't already) if(locUsedSoFar_BeamEnergy.find(locBeamIndex) == locUsedSoFar_BeamEnergy.end()) { dHist_BeamEnergy->Fill(locBeamP4_KinFit.E()); locUsedSoFar_BeamEnergy.insert(locBeamIndex); } if((locBeamP4_KinFit.E() < 2.5) || (locBeamP4_KinFit.E() > 3.0)) continue; //could also mark combo as cut, then save cut results to a new TTree double locT = (locProtonP4_KinFit - dTargetP4).Mag2(); if(locUsedSoFar_MandelstamT.find(locProtonIndex) == locUsedSoFar_MandelstamT.end()) { dHist_MandelstamT->Fill(locT); locUsedSoFar_MandelstamT.insert(locProtonIndex); } if((fabs(locT) < 0.02) || (fabs(locT) > 0.3)) continue; /*********************************************** EXTRA PARTICLES *************************************************/ //loop through all hypotheses, find how many physical tracks there are set<Int_t> locFoundTrackIDs; //keep track of unique track ids for(size_t loc_j = 0; loc_j < NumChargedHypos; ++loc_j) locFoundTrackIDs.insert(ChargedHypo__TrackID[loc_j]); int locNumExtraTracks = locFoundTrackIDs.size() - 3; //proton, pi+, pi- used //Fill the histogram if it hasn't already been filled for this event (quantity is combo-independent) if(!locNumExtraTracksFilledFlag) { dHist_NumExtraTracks->Fill(locNumExtraTracks); locNumExtraTracksFilledFlag = true; } //cut, requiring no extra tracks in the event if(locNumExtraTracks > 0) continue; //Loop through showers, see if there are any additional pi0s TVector3 locProductionVertex = ((TLorentzVector*)ComboBeam__X4_Measured->At(loc_i))->Vect(); for(Int_t loc_j = 0; loc_j < Int_t(NumNeutralShowers); ++loc_j) { if((loc_j == locPhoton1Index) || (loc_j == locPhoton2Index)) continue; //don't choose a shower that's already in the combo //Construct extra photon 1 p4 TLorentzVector& locShower1X4 = *((TLorentzVector*)NeutralShower__X4_Shower->At(loc_j)); double locShower1Energy = (NeutralShower__Energy_BCAL[loc_j] > 0.0) ? NeutralShower__Energy_BCAL[loc_j] : NeutralShower__Energy_FCAL[loc_j]; TVector3 locExtraPhoton1P3 = locShower1X4.Vect() - locProductionVertex; locExtraPhoton1P3.SetMag(locShower1Energy); TLorentzVector locExtraPhoton1P4(locExtraPhoton1P3, locShower1Energy); //need 2 photons for a pi0 for(Int_t loc_k = loc_j + 1; loc_k < Int_t(NumNeutralShowers); ++loc_k) { if((loc_k == locPhoton1Index) || (loc_k == locPhoton2Index)) continue; //don't choose a shower that's already in the combo //Construct extra photon 2 p4 TLorentzVector& locShower2X4 = *((TLorentzVector*)NeutralShower__X4_Shower->At(loc_k)); double locShower2Energy = (NeutralShower__Energy_BCAL[loc_k] > 0.0) ? NeutralShower__Energy_BCAL[loc_k] : NeutralShower__Energy_FCAL[loc_k]; TVector3 locExtraPhoton2P3 = locShower2X4.Vect() - locProductionVertex; locExtraPhoton2P3.SetMag(locShower2Energy); TLorentzVector locExtraPhoton2P4(locExtraPhoton2P3, locShower2Energy); TLorentzVector locExtraPi0P4 = locExtraPhoton1P4 + locExtraPhoton2P4; double locExtraPi0Mass = locExtraPi0P4.M(); //see if this combo has been histogrammed yet set<Int_t> locUsedThisCombo_ExtraPi0; locUsedThisCombo_ExtraPi0.insert(loc_j); locUsedThisCombo_ExtraPi0.insert(loc_k); if(locUsedSoFar_ExtraPi0.find(locUsedThisCombo_ExtraPi0) == locUsedSoFar_ExtraPi0.end()) { //it has not: histogram and register dHist_ExtraPi0InvariantMass->Fill(locExtraPi0Mass); locUsedSoFar_ExtraPi0.insert(locUsedThisCombo_ExtraPi0); } } } ++locNumSurvivingCombos; if(locNumSurvivingCombos > 1) cout << "# combos = " << locNumSurvivingCombos << endl; /************************************************ OMEGA ASYMMETRY ************************************************/ //Polarization plane: //Beam is in the lab z-direction //(FYI) Circularly polarized photon beam: Polarization rotates through the plane perpendicular to the direction of the photon: The XY Plane //The polarization vector is perpendicular to the direction of the photon //Linearly polarized photon beam: Polarization is confined to a plane along the direction of the photon //Plane defined by z-direction & some angle phi. Thus, polarization vector defined by phi. //PARA: Polarization plane parallel to the floor: The XZ plane. Polarization Vector = +/- x-axis //PERP: Polarization plane perpendicular to the floor: The YZ plane. Polarization Vector = +/- y-axis //Here: Assume that the beam polarization plane is parallel to the floor (Run 3185) (xz plane, choose +x-axis) //Production CM frame: The center-of-mass frame of the production step. Here: g, p -> omega, p //In general, the beam energy is measured more accurately than the combination of all of the final-state particles //So define the production CM frame using the initial state TVector3 locBoostVector_ProdCM = -1.0*(locInitialStateP4_KinFit.BoostVector()); //negative due to coordinate system convention //boost beam & proton to production CM frame TLorentzVector locBeamP4_ProdCM(locBeamP4_KinFit); locBeamP4_ProdCM.Boost(locBoostVector_ProdCM); TLorentzVector locProtonP4_ProdCM(locProtonP4_KinFit); locProtonP4_ProdCM.Boost(locBoostVector_ProdCM); //Production plane: //The production plane is the plane containing the produced particles. Here: Defined by the proton and the omega //However, when you boost to the production CM frame, the production plane is no longer well defined: the particles are back-to-back //So, by convention, define the production plane in the production CM frame by the beam and the vector meson. //Production CM frame axes: "HELICITY SYSTEM" //The z-axis is defined as the direction of the meson (omega): z = Omega //The y-axis is defined by the vector cross product: y = Beam X Omega //The x-axis is defined by the vector cross product: x = y cross z //However, the proton momentum is in general better known than the omega momentum, so use it instead (they are back-to-back) //z = -1 * Proton //y = -1 * (Beam X Proton) //x = y cross z //Thus the production plane in the production frame is the XZ plane, and the normal vector is the Y-axis //Define production CM frame helicity axes TVector3 locHelicityZAxis_ProdCM = -1.0*locProtonP4_ProdCM.Vect().Unit(); TVector3 locHelicityYAxis_ProdCM = -1.0*locBeamP4_ProdCM.Vect().Cross(locProtonP4_ProdCM.Vect()).Unit(); TVector3 locHelicityXAxis_ProdCM = locHelicityYAxis_ProdCM.Cross(locHelicityZAxis_ProdCM).Unit(); //Since the beam is in PARA configuration (Run 3185), the polarization vector is along the lab x-axis //Since the boost is in the z-direction, this vector is the same in the production CM frame TVector3 locPolUnit(1.0, 0.0, 0.0); //In the production CM frame, locPHI is the angle between the polarization vector and the production plane double locCosPHI = locBeamP4_ProdCM.Vect().Unit().Dot(locPolUnit.Cross(locHelicityYAxis_ProdCM)); double locPHI = acos(locCosPHI); //reports phi between 0 and pi: sign ambiguity //Resolve the sign ambiguity double locSinPHI = locPolUnit.Dot(locHelicityYAxis_ProdCM); if(locSinPHI < 0.0) locPHI *= -1.0; //Now, we need the theta, phi angles between the omega decay plane and the production plane //The omega decay plane is defined by decay products in the omega CM frame //2 particles (vectors) define a plane. //However, to conserve momentum, the third particle cannot be out of that plane (so must also be in it) //So, use the pi+ and the pi- to define the plane (pi0 measurement has less resolution) //By the way, for rho decays, the theta & phi angles are those of the pi+ in the rho CM frame, with respect to the helicity axes //boost pi+/- to omega CM frame TVector3 locBoostVector_OmegaCM = -1.0*(locOmegaP4_KinFit.BoostVector()); //negative due to coordinate system convention TLorentzVector locBeamP4_OmegaCM(locBeamP4_KinFit); locBeamP4_OmegaCM.Boost(locBoostVector_OmegaCM); TLorentzVector locProtonP4_OmegaCM(locProtonP4_KinFit); locProtonP4_OmegaCM.Boost(locBoostVector_OmegaCM); TLorentzVector locPiPlusP4_OmegaCM(locPiPlusP4_KinFit); locPiPlusP4_OmegaCM.Boost(locBoostVector_OmegaCM); TLorentzVector locPiMinusP4_OmegaCM(locPiMinusP4_KinFit); locPiMinusP4_OmegaCM.Boost(locBoostVector_OmegaCM); //Define omega CM frame helicity axes //These are defined the same way as before, but with the boost, the direction of the x & y axes has changed TVector3 locHelicityZAxis_OmegaCM = -1.0*locProtonP4_OmegaCM.Vect().Unit(); TVector3 locHelicityYAxis_OmegaCM = -1.0*locBeamP4_OmegaCM.Vect().Cross(locProtonP4_OmegaCM.Vect()).Unit(); TVector3 locHelicityXAxis_OmegaCM = locHelicityYAxis_OmegaCM.Cross(locHelicityZAxis_OmegaCM).Unit(); //Compute the normal vector to the omega decay plane (pi+ x pi-) TVector3 locOmegaNormal = (locPiPlusP4_OmegaCM.Vect().Cross(locPiMinusP4_OmegaCM.Vect())); //Compute the theta angle to the omega decay plane double locCosTheta = locOmegaNormal.Dot(locHelicityZAxis_OmegaCM)/locOmegaNormal.Mag(); double lcoTheta = acos(locCosTheta); //Compute the phi angle to the omega decay plane TVector3 locZCrossOmegaNormal = locHelicityZAxis_OmegaCM.Cross(locOmegaNormal); double locZCrossOmegaNormalMag = locZCrossOmegaNormal.Mag(); double locCosPhi = locHelicityYAxis_OmegaCM.Dot(locZCrossOmegaNormal)/locZCrossOmegaNormalMag; double locPhi = acos(locCosPhi); //reports phi between 0 and pi: sign ambiguity //Resolve the sign ambiguity double locSinPhi = -1.0*locHelicityXAxis_OmegaCM.Dot(locZCrossOmegaNormal)/locZCrossOmegaNormalMag; if(locSinPhi < 0.0) locPhi *= -1.0; //Compute the "psi" angle: works at forward angles double locPsi = locPhi - locPHI; while(locPsi < -1.0*TMath::Pi()) locPsi += 2.0*TMath::Pi(); while(locPsi > TMath::Pi()) locPsi -= 2.0*TMath::Pi(); //result is defined by omega, only histogram if omega is unique if(locOmegaUniqueFlag) { dHist_OmegaPsi->Fill(180.0*locPsi/TMath::Pi()); dHist_OmegaCosTheta->Fill(locCosTheta); } } //end combo loop return kTRUE; }
void NewVariables(){ const double protonmass = 938.272013; //MeV const double pionmass = 139.57018; //MeV const double kaonmass = 493.677; //MeV //const double muonmass = 105.6583715; //MeV TStopwatch *clock = new TStopwatch(); clock->Start(1); double p_PT, p_ETA, p_PHI; double K_PT, K_ETA, K_PHI; double pi_PT, pi_ETA, pi_PHI; double Xb_OWNPV_X, Xb_OWNPV_Y, Xb_OWNPV_Z; double Xb_ENDVERTEX_X, Xb_ENDVERTEX_Y, Xb_ENDVERTEX_Z; double Xb_PT, Xb_ETA, Xb_PHI, Xb_M; double Xc_PT, Xc_ETA, Xc_PHI, Xc_M; float Added_H_PT[200], Added_H_ETA[200], Added_H_PHI[200]; int Added_n_Particles; gErrorIgnoreLevel = kError; TFile *fSLBS = new TFile("/auto/data/mstahl/SLBaryonSpectroscopy/SLBaryonSpectroscopyStrp21.root","read"); TTree *Xic_tree = (TTree*)gDirectory->Get("Xib02XicMuNu/Xic2pKpi/DecayTree"); gErrorIgnoreLevel = kPrint; Xic_tree->SetBranchStatus("*",0); //disable all branches //now switch on the ones we need (saves a lot of time) Xic_tree->SetBranchStatus("Xib_M",1); Xic_tree->SetBranchStatus("Xib_PT",1); Xic_tree->SetBranchStatus("Xib_ETA",1); Xic_tree->SetBranchStatus("Xib_PHI",1); Xic_tree->SetBranchStatus("Xib_OWNPV_X",1); Xic_tree->SetBranchStatus("Xib_OWNPV_Y",1); Xic_tree->SetBranchStatus("Xib_OWNPV_Z",1); Xic_tree->SetBranchStatus("Xib_ENDVERTEX_X",1); Xic_tree->SetBranchStatus("Xib_ENDVERTEX_Y",1); Xic_tree->SetBranchStatus("Xib_ENDVERTEX_Z",1); Xic_tree->SetBranchStatus("Xic_M",1); Xic_tree->SetBranchStatus("Xic_PT",1); Xic_tree->SetBranchStatus("Xic_ETA",1); Xic_tree->SetBranchStatus("Xic_PHI",1); Xic_tree->SetBranchStatus("Added_n_Particles",1); Xic_tree->SetBranchStatus("Added_H_PT",1); Xic_tree->SetBranchStatus("Added_H_ETA",1); Xic_tree->SetBranchStatus("Added_H_PHI",1); Xic_tree->SetBranchStatus("p_PT",1); Xic_tree->SetBranchStatus("p_ETA",1); Xic_tree->SetBranchStatus("p_PHI",1); Xic_tree->SetBranchStatus("K_PT",1); Xic_tree->SetBranchStatus("K_ETA",1); Xic_tree->SetBranchStatus("K_PHI",1); Xic_tree->SetBranchStatus("pi_PT",1); Xic_tree->SetBranchStatus("pi_ETA",1); Xic_tree->SetBranchStatus("pi_PHI",1); //set the branch addresses Xic_tree->SetBranchAddress("Xib_M",&Xb_M); Xic_tree->SetBranchAddress("Xib_PT",&Xb_PT); Xic_tree->SetBranchAddress("Xib_ETA",&Xb_ETA); Xic_tree->SetBranchAddress("Xib_PHI",&Xb_PHI); Xic_tree->SetBranchAddress("Xib_OWNPV_X",&Xb_OWNPV_X); Xic_tree->SetBranchAddress("Xib_OWNPV_Y",&Xb_OWNPV_Y); Xic_tree->SetBranchAddress("Xib_OWNPV_Z",&Xb_OWNPV_Z); Xic_tree->SetBranchAddress("Xib_ENDVERTEX_X",&Xb_ENDVERTEX_X); Xic_tree->SetBranchAddress("Xib_ENDVERTEX_Y",&Xb_ENDVERTEX_Y); Xic_tree->SetBranchAddress("Xib_ENDVERTEX_Z",&Xb_ENDVERTEX_Z); Xic_tree->SetBranchAddress("Xic_M",&Xc_M); Xic_tree->SetBranchAddress("Xic_PT",&Xc_PT); Xic_tree->SetBranchAddress("Xic_ETA",&Xc_ETA); Xic_tree->SetBranchAddress("Xic_PHI",&Xc_PHI); Xic_tree->SetBranchAddress("Added_n_Particles",&Added_n_Particles); Xic_tree->SetBranchAddress("Added_H_PT",&Added_H_PT); Xic_tree->SetBranchAddress("Added_H_ETA",&Added_H_ETA); Xic_tree->SetBranchAddress("Added_H_PHI",&Added_H_PHI); Xic_tree->SetBranchAddress("p_PT",&p_PT); Xic_tree->SetBranchAddress("p_ETA",&p_ETA); Xic_tree->SetBranchAddress("p_PHI",&p_PHI); Xic_tree->SetBranchAddress("K_PT",&K_PT); Xic_tree->SetBranchAddress("K_ETA",&K_ETA); Xic_tree->SetBranchAddress("K_PHI",&K_PHI); Xic_tree->SetBranchAddress("pi_PT",&pi_PT); Xic_tree->SetBranchAddress("pi_ETA",&pi_ETA); Xic_tree->SetBranchAddress("pi_PHI",&pi_PHI); //SLBS_tree->AddBranchToCache("*"); //SLBS_tree->LoadBaskets(1000000000);//Load baskets up to 1 GB to memory double Xb_CorrM, p_beta, K_beta, pi_beta; float Xcpi_CosTheta[200],XcK_CosTheta[200],Xcp_CosTheta[200]; double p_as_piKpi_M, p_as_KKpi_M, pK_as_pipi_M, pK_as_ppi_M, pKpi_as_K_M, pKpi_as_p_M; TFile *f1 = new TFile("/auto/data/mstahl/SLBaryonSpectroscopy/SLBaryonSpectroscopyStrp21_friend.root","RECREATE"); //f1->mkdir("Xib02XicMuNu/Xic2pKpi"); //f1->cd("Xib02XicMuNu/Xic2pKpi"); TTree added_Xic_tree("Xic2pKpi","Xic2pKpi"); added_Xic_tree.Branch("Xib_CorrM", &Xb_CorrM, "Xib_CorrM/D"); added_Xic_tree.Branch("p_beta", &p_beta, "p_beta/D"); added_Xic_tree.Branch("K_beta", &K_beta, "K_beta/D"); added_Xic_tree.Branch("pi_beta", &pi_beta, "pi_beta/D"); added_Xic_tree.Branch("Added_n_Particles", &Added_n_Particles, "Added_n_Particles/I"); added_Xic_tree.Branch("Xcpi_CosTheta", &Xcpi_CosTheta, "Xcpi_CosTheta[Added_n_Particles]/F"); added_Xic_tree.Branch("XcK_CosTheta", &XcK_CosTheta, "XcK_CosTheta[Added_n_Particles]/F"); added_Xic_tree.Branch("Xcp_CosTheta", &Xcp_CosTheta, "Xcp_CosTheta[Added_n_Particles]/F"); added_Xic_tree.Branch("p_as_piKpi_M", &p_as_piKpi_M, "p_as_piKpi_M/D"); added_Xic_tree.Branch("p_as_KKpi_M", &p_as_KKpi_M, "p_as_KKpi_M/D"); added_Xic_tree.Branch("pK_as_pipi_M", &pK_as_pipi_M, "pK_as_pipi_M/D"); added_Xic_tree.Branch("pK_as_ppi_M", &pK_as_ppi_M, "pK_as_ppi_M/D"); added_Xic_tree.Branch("pKpi_as_K_M", &pKpi_as_K_M, "pKpi_as_K_M/D"); added_Xic_tree.Branch("pKpi_as_p_M", &pKpi_as_p_M, "pKpi_as_p_M/D"); UInt_t Xic_nevents = Xic_tree->GetEntries(); cout << "Entries in Xic tree: " << Xic_nevents << endl; for (UInt_t evt = 0; evt < Xic_nevents;evt++) { Xic_tree->GetEntry(evt); TVector3 dir(Xb_ENDVERTEX_X-Xb_OWNPV_X,Xb_ENDVERTEX_Y-Xb_OWNPV_Y,Xb_ENDVERTEX_Z-Xb_OWNPV_Z); TVector3 mom; mom.SetPtEtaPhi(Xb_PT,Xb_ETA,Xb_PHI); double dmag2 = dir.Mag2(); double ptprime = 0; if ( 0 == dmag2 ) ptprime = mom.Mag(); else ptprime = (mom - dir * ( mom.Dot( dir ) / dmag2 )).Mag() ; Xb_CorrM = sqrt(Xb_M*Xb_M + ptprime*ptprime) + ptprime; TLorentzVector Xb; Xb.SetPtEtaPhiM(Xb_PT,Xb_ETA,Xb_PHI,Xb_CorrM); TLorentzVector Xc; Xc.SetPtEtaPhiM(Xc_PT,Xc_ETA,Xc_PHI,Xc_M); for(int i = 0; i < Added_n_Particles; i++){ TLorentzVector Hpi; Hpi.SetPtEtaPhiM(Added_H_PT[i],Added_H_ETA[i],Added_H_PHI[i],pionmass); TLorentzVector HK; HK.SetPtEtaPhiM(Added_H_PT[i],Added_H_ETA[i],Added_H_PHI[i],kaonmass); TLorentzVector Hp; Hp.SetPtEtaPhiM(Added_H_PT[i],Added_H_ETA[i],Added_H_PHI[i],protonmass); TLorentzVector Xcpi = Hpi + Xc; TLorentzVector XcK = HK + Xc; TLorentzVector Xcp = Hp + Xc; Xcpi.Boost(-Xb.BoostVector()); Xcpi_CosTheta[i] = cos(Xcpi.Angle(Xb.Vect())); XcK.Boost(-Xb.BoostVector()); XcK_CosTheta[i] = cos(XcK.Angle(Xb.Vect())); Xcp.Boost(-Xb.BoostVector()); Xcp_CosTheta[i] = cos(Xcp.Angle(Xb.Vect())); } TLorentzVector proton; proton.SetPtEtaPhiM(p_PT,p_ETA,p_PHI,protonmass); TLorentzVector kaon; kaon.SetPtEtaPhiM(K_PT,K_ETA,K_PHI,kaonmass); TLorentzVector pion; pion.SetPtEtaPhiM(pi_PT,pi_ETA,pi_PHI,pionmass); p_beta = (-proton.P()+kaon.P()+pion.P())/(proton.P()+kaon.P()+pion.P()); K_beta = ( proton.P()-kaon.P()+pion.P())/(proton.P()+kaon.P()+pion.P()); pi_beta = ( proton.P()+kaon.P()-pion.P())/(proton.P()+kaon.P()+pion.P()); TLorentzVector p_as_pi; p_as_pi.SetVectM(proton.Vect(),pionmass); TLorentzVector p_as_K; p_as_K.SetVectM(proton.Vect(),kaonmass); TLorentzVector K_as_pi; K_as_pi.SetVectM(kaon.Vect(),pionmass); TLorentzVector K_as_p; K_as_p.SetVectM(kaon.Vect(),protonmass); TLorentzVector pi_as_K; pi_as_K.SetVectM(pion.Vect(),kaonmass); TLorentzVector pi_as_p; pi_as_p.SetVectM(pion.Vect(),protonmass); p_as_piKpi_M = (p_as_pi + kaon + pion).M(); p_as_KKpi_M = (p_as_K + kaon + pion).M(); pK_as_pipi_M = (proton + K_as_pi + pion).M(); pK_as_ppi_M = (proton + K_as_p + pion).M(); pKpi_as_K_M = (proton + kaon + pi_as_K).M(); pKpi_as_p_M = (proton + kaon + pi_as_p).M(); added_Xic_tree.Fill(); } Xic_tree->SetDirectory(0); added_Xic_tree.Write(); fSLBS->cd(); TTree *Xic0_tree = (TTree*)gDirectory->Get("Xib2Xic0MuNu/Xic02pKKpi/DecayTree"); double p_P, SSK1_P, SSK2_P, pi_P; double SSK1_PT, SSK2_PT, SSK1_ETA, SSK2_ETA, SSK1_PHI, SSK2_PHI; Xic0_tree->SetBranchStatus("*",0); //disable all branches //now switch on the ones we need (saves a lot of time) Xic0_tree->SetBranchStatus("Xib_M",1); Xic0_tree->SetBranchStatus("Xib_PT",1); Xic0_tree->SetBranchStatus("Xib_ETA",1); Xic0_tree->SetBranchStatus("Xib_PHI",1); Xic0_tree->SetBranchStatus("Xib_OWNPV_X",1); Xic0_tree->SetBranchStatus("Xib_OWNPV_Y",1); Xic0_tree->SetBranchStatus("Xib_OWNPV_Z",1); Xic0_tree->SetBranchStatus("Xib_ENDVERTEX_X",1); Xic0_tree->SetBranchStatus("Xib_ENDVERTEX_Y",1); Xic0_tree->SetBranchStatus("Xib_ENDVERTEX_Z",1); Xic0_tree->SetBranchStatus("Xic_M",1); Xic0_tree->SetBranchStatus("Xic_PT",1); Xic0_tree->SetBranchStatus("Xic_ETA",1); Xic0_tree->SetBranchStatus("Xic_PHI",1); Xic0_tree->SetBranchStatus("Added_n_Particles",1); Xic0_tree->SetBranchStatus("Added_H_PT",1); Xic0_tree->SetBranchStatus("Added_H_ETA",1); Xic0_tree->SetBranchStatus("Added_H_PHI",1); Xic0_tree->SetBranchStatus("p_P",1); Xic0_tree->SetBranchStatus("SSK1_P",1); Xic0_tree->SetBranchStatus("SSK2_P",1); Xic0_tree->SetBranchStatus("pi_P",1); Xic0_tree->SetBranchStatus("p_PT",1); Xic0_tree->SetBranchStatus("p_ETA",1); Xic0_tree->SetBranchStatus("p_PHI",1); Xic0_tree->SetBranchStatus("SSK1_PT",1); Xic0_tree->SetBranchStatus("SSK1_ETA",1); Xic0_tree->SetBranchStatus("SSK1_PHI",1); Xic0_tree->SetBranchStatus("SSK2_PT",1); Xic0_tree->SetBranchStatus("SSK2_ETA",1); Xic0_tree->SetBranchStatus("SSK2_PHI",1); Xic0_tree->SetBranchStatus("pi_PT",1); Xic0_tree->SetBranchStatus("pi_ETA",1); Xic0_tree->SetBranchStatus("pi_PHI",1); //set the branch addresses Xic0_tree->SetBranchAddress("Xib_M",&Xb_M); Xic0_tree->SetBranchAddress("Xib_PT",&Xb_PT); Xic0_tree->SetBranchAddress("Xib_ETA",&Xb_ETA); Xic0_tree->SetBranchAddress("Xib_PHI",&Xb_PHI); Xic0_tree->SetBranchAddress("Xib_OWNPV_X",&Xb_OWNPV_X); Xic0_tree->SetBranchAddress("Xib_OWNPV_Y",&Xb_OWNPV_Y); Xic0_tree->SetBranchAddress("Xib_OWNPV_Z",&Xb_OWNPV_Z); Xic0_tree->SetBranchAddress("Xib_ENDVERTEX_X",&Xb_ENDVERTEX_X); Xic0_tree->SetBranchAddress("Xib_ENDVERTEX_Y",&Xb_ENDVERTEX_Y); Xic0_tree->SetBranchAddress("Xib_ENDVERTEX_Z",&Xb_ENDVERTEX_Z); Xic0_tree->SetBranchAddress("Xic_M",&Xc_M); Xic0_tree->SetBranchAddress("Xic_PT",&Xc_PT); Xic0_tree->SetBranchAddress("Xic_ETA",&Xc_ETA); Xic0_tree->SetBranchAddress("Xic_PHI",&Xc_PHI); Xic0_tree->SetBranchAddress("Added_n_Particles",&Added_n_Particles); Xic0_tree->SetBranchAddress("Added_H_PT",&Added_H_PT); Xic0_tree->SetBranchAddress("Added_H_ETA",&Added_H_ETA); Xic0_tree->SetBranchAddress("Added_H_PHI",&Added_H_PHI); Xic0_tree->SetBranchAddress("p_P",&p_P); Xic0_tree->SetBranchAddress("SSK1_P",&SSK1_P); Xic0_tree->SetBranchAddress("SSK2_P",&SSK2_P); Xic0_tree->SetBranchAddress("pi_P",&pi_P); Xic0_tree->SetBranchAddress("p_PT",&p_PT); Xic0_tree->SetBranchAddress("SSK1_PT",&SSK1_PT); Xic0_tree->SetBranchAddress("SSK2_PT",&SSK2_PT); Xic0_tree->SetBranchAddress("pi_PT",&pi_PT); Xic0_tree->SetBranchAddress("p_ETA",&p_ETA); Xic0_tree->SetBranchAddress("SSK1_ETA",&SSK1_ETA); Xic0_tree->SetBranchAddress("SSK2_ETA",&SSK2_ETA); Xic0_tree->SetBranchAddress("pi_ETA",&pi_ETA); Xic0_tree->SetBranchAddress("p_PHI",&p_PHI); Xic0_tree->SetBranchAddress("SSK1_PHI",&SSK1_PHI); Xic0_tree->SetBranchAddress("SSK2_PHI",&SSK2_PHI); Xic0_tree->SetBranchAddress("pi_PHI",&pi_PHI); double SSK1_beta, SSK2_beta; f1->cd(); //f1->mkdir("Xib2Xic0MuNu/Xic02pKKpi"); //f1->cd("Xib2Xic0MuNu/Xic02pKKpi"); TTree added_Xic0_tree("Xic02pKKpi","Xic02pKKpi"); added_Xic0_tree.Branch("Xib_CorrM", &Xb_CorrM, "Xib_CorrM/D"); added_Xic0_tree.Branch("p_beta", &p_beta, "p_beta/D"); added_Xic0_tree.Branch("SSK1_beta", &SSK1_beta, "SSK1_beta/D"); added_Xic0_tree.Branch("SSK2_beta", &SSK2_beta, "SSK2_beta/D"); added_Xic0_tree.Branch("pi_beta", &pi_beta, "pi_beta/D"); added_Xic0_tree.Branch("Added_n_Particles", &Added_n_Particles, "Added_n_Particles/I"); added_Xic0_tree.Branch("Xcpi_CosTheta", &Xcpi_CosTheta, "Xcpi_CosTheta[Added_n_Particles]/F"); added_Xic0_tree.Branch("XcK_CosTheta", &XcK_CosTheta, "XcK_CosTheta[Added_n_Particles]/F"); added_Xic0_tree.Branch("Xcp_CosTheta", &Xcp_CosTheta, "Xcp_CosTheta[Added_n_Particles]/F"); added_Xic0_tree.Branch("p_as_piKKpi_M", &p_as_piKpi_M, "p_as_piKKpi_M/D"); added_Xic0_tree.Branch("p_as_KKKpi_M", &p_as_KKpi_M, "p_as_KKKpi_M/D"); UInt_t Xic0_nevents = Xic0_tree->GetEntries(); cout << "Entries in Xic0 tree: " << Xic0_nevents << endl; for (UInt_t evt = 0; evt < Xic0_nevents;evt++) { Xic0_tree->GetEntry(evt); TVector3 dir(Xb_ENDVERTEX_X-Xb_OWNPV_X,Xb_ENDVERTEX_Y-Xb_OWNPV_Y,Xb_ENDVERTEX_Z-Xb_OWNPV_Z); TVector3 mom; mom.SetPtEtaPhi(Xb_PT,Xb_ETA,Xb_PHI); double dmag2 = dir.Mag2(); double ptprime = 0; if ( 0 == dmag2 ) ptprime = mom.Mag(); else ptprime = (mom - dir * ( mom.Dot( dir ) / dmag2 )).Mag() ; Xb_CorrM = sqrt(Xb_M*Xb_M + ptprime*ptprime) + ptprime; TLorentzVector Xb; Xb.SetPtEtaPhiM(Xb_PT,Xb_ETA,Xb_PHI,Xb_CorrM); TLorentzVector Xc; Xc.SetPtEtaPhiM(Xc_PT,Xc_ETA,Xc_PHI,Xc_M); for(int i = 0; i < Added_n_Particles; i++){ TLorentzVector Hpi; Hpi.SetPtEtaPhiM(Added_H_PT[i],Added_H_ETA[i],Added_H_PHI[i],pionmass); TLorentzVector HK; HK.SetPtEtaPhiM(Added_H_PT[i],Added_H_ETA[i],Added_H_PHI[i],kaonmass); TLorentzVector Hp; Hp.SetPtEtaPhiM(Added_H_PT[i],Added_H_ETA[i],Added_H_PHI[i],protonmass); TLorentzVector Xcpi = Hpi + Xc; TLorentzVector XcK = HK + Xc; TLorentzVector Xcp = Hp + Xc; Xcpi.Boost(-Xb.BoostVector()); Xcpi_CosTheta[i] = cos(Xcpi.Angle(Xb.Vect())); XcK.Boost(-Xb.BoostVector()); XcK_CosTheta[i] = cos(XcK.Angle(Xb.Vect())); Xcp.Boost(-Xb.BoostVector()); Xcp_CosTheta[i] = cos(Xcp.Angle(Xb.Vect())); } p_beta = (-p_P+SSK1_P+SSK2_P+pi_P)/(p_P+SSK1_P+SSK2_P+pi_P); SSK1_beta = ( p_P-SSK1_P+SSK2_P+pi_P)/(p_P+SSK1_P+SSK2_P+pi_P); SSK2_beta = ( p_P+SSK1_P-SSK2_P+pi_P)/(p_P+SSK1_P+SSK2_P+pi_P); pi_beta = ( p_P+SSK1_P+SSK2_P-pi_P)/(p_P+SSK1_P+SSK2_P+pi_P); TLorentzVector proton; proton.SetPtEtaPhiM(p_PT,p_ETA,p_PHI,protonmass); TLorentzVector kaon1; kaon1.SetPtEtaPhiM(SSK1_PT,SSK1_ETA,SSK1_PHI,kaonmass); TLorentzVector kaon2; kaon2.SetPtEtaPhiM(SSK2_PT,SSK2_ETA,SSK2_PHI,kaonmass); TLorentzVector pion; pion.SetPtEtaPhiM(pi_PT,pi_ETA,pi_PHI,pionmass); TLorentzVector p_as_pi; p_as_pi.SetVectM(proton.Vect(),pionmass); TLorentzVector p_as_K; p_as_K.SetVectM(proton.Vect(),kaonmass); p_as_piKpi_M = (p_as_pi + kaon1 + kaon2 + pion).M(); p_as_KKpi_M = (p_as_K + kaon1 + kaon2 + pion).M(); added_Xic0_tree.Fill(); } added_Xic0_tree.Write(); fSLBS->cd(); TTree *Omegac_tree = (TTree*)gDirectory->Get("Omegab2Omegac0MuNu/Omegac2pKKpi/DecayTree"); Omegac_tree->SetBranchStatus("*",0); //disable all branches //now switch on the ones we need (saves a lot of time) Omegac_tree->SetBranchStatus("Omegab_M",1); Omegac_tree->SetBranchStatus("Omegab_PT",1); Omegac_tree->SetBranchStatus("Omegab_ETA",1); Omegac_tree->SetBranchStatus("Omegab_PHI",1); Omegac_tree->SetBranchStatus("Omegab_OWNPV_X",1); Omegac_tree->SetBranchStatus("Omegab_OWNPV_Y",1); Omegac_tree->SetBranchStatus("Omegab_OWNPV_Z",1); Omegac_tree->SetBranchStatus("Omegab_ENDVERTEX_X",1); Omegac_tree->SetBranchStatus("Omegab_ENDVERTEX_Y",1); Omegac_tree->SetBranchStatus("Omegab_ENDVERTEX_Z",1); Omegac_tree->SetBranchStatus("Omegac_M",1); Omegac_tree->SetBranchStatus("Omegac_PT",1); Omegac_tree->SetBranchStatus("Omegac_ETA",1); Omegac_tree->SetBranchStatus("Omegac_PHI",1); Omegac_tree->SetBranchStatus("Added_n_Particles",1); Omegac_tree->SetBranchStatus("Added_H_PT",1); Omegac_tree->SetBranchStatus("Added_H_ETA",1); Omegac_tree->SetBranchStatus("Added_H_PHI",1); Omegac_tree->SetBranchStatus("p_P",1); Omegac_tree->SetBranchStatus("SSK1_P",1); Omegac_tree->SetBranchStatus("SSK2_P",1); Omegac_tree->SetBranchStatus("pi_P",1); //set the branch addresses Omegac_tree->SetBranchAddress("Omegab_M",&Xb_M); Omegac_tree->SetBranchAddress("Omegab_PT",&Xb_PT); Omegac_tree->SetBranchAddress("Omegab_ETA",&Xb_ETA); Omegac_tree->SetBranchAddress("Omegab_PHI",&Xb_PHI); Omegac_tree->SetBranchAddress("Omegab_OWNPV_X",&Xb_OWNPV_X); Omegac_tree->SetBranchAddress("Omegab_OWNPV_Y",&Xb_OWNPV_Y); Omegac_tree->SetBranchAddress("Omegab_OWNPV_Z",&Xb_OWNPV_Z); Omegac_tree->SetBranchAddress("Omegab_ENDVERTEX_X",&Xb_ENDVERTEX_X); Omegac_tree->SetBranchAddress("Omegab_ENDVERTEX_Y",&Xb_ENDVERTEX_Y); Omegac_tree->SetBranchAddress("Omegab_ENDVERTEX_Z",&Xb_ENDVERTEX_Z); Omegac_tree->SetBranchAddress("Omegac_M",&Xc_M); Omegac_tree->SetBranchAddress("Omegac_PT",&Xc_PT); Omegac_tree->SetBranchAddress("Omegac_ETA",&Xc_ETA); Omegac_tree->SetBranchAddress("Omegac_PHI",&Xc_PHI); Omegac_tree->SetBranchAddress("Added_n_Particles",&Added_n_Particles); Omegac_tree->SetBranchAddress("Added_H_PT",&Added_H_PT); Omegac_tree->SetBranchAddress("Added_H_ETA",&Added_H_ETA); Omegac_tree->SetBranchAddress("Added_H_PHI",&Added_H_PHI); Omegac_tree->SetBranchAddress("p_P",&p_P); Omegac_tree->SetBranchAddress("SSK1_P",&SSK1_P); Omegac_tree->SetBranchAddress("SSK2_P",&SSK2_P); Omegac_tree->SetBranchAddress("pi_P",&pi_P); f1->cd(); //f1->mkdir("Omegab2Omegac0MuNu/Omegac2pKKpi"); //f1->cd("Omegab2Omegac0MuNu/Omegac2pKKpi"); TTree added_Omegac_tree("Omegac2pKKpi","Omegac2pKKpi"); added_Omegac_tree.Branch("Omegab_CorrM", &Xb_CorrM, "Omegab_CorrM/D"); added_Omegac_tree.Branch("p_beta", &p_beta, "p_beta/D"); added_Omegac_tree.Branch("SSK1_beta", &SSK1_beta, "SSK1_beta/D"); added_Omegac_tree.Branch("SSK2_beta", &SSK2_beta, "SSK2_beta/D"); added_Omegac_tree.Branch("pi_beta", &pi_beta, "pi_beta/D"); added_Omegac_tree.Branch("Added_n_Particles", &Added_n_Particles, "Added_n_Particles/I"); added_Omegac_tree.Branch("Xcpi_CosTheta", &Xcpi_CosTheta, "Xcpi_CosTheta[Added_n_Particles]/F"); added_Omegac_tree.Branch("XcK_CosTheta", &XcK_CosTheta, "XcK_CosTheta[Added_n_Particles]/F"); added_Omegac_tree.Branch("Xcp_CosTheta", &Xcp_CosTheta, "Xcp_CosTheta[Added_n_Particles]/F"); UInt_t Omegac_nevents = Omegac_tree->GetEntries(); cout << "Entries in Omegac tree: " << Omegac_nevents << endl; for (UInt_t evt = 0; evt < Omegac_nevents;evt++) { Omegac_tree->GetEntry(evt); TVector3 dir(Xb_ENDVERTEX_X-Xb_OWNPV_X,Xb_ENDVERTEX_Y-Xb_OWNPV_Y,Xb_ENDVERTEX_Z-Xb_OWNPV_Z); TVector3 mom; mom.SetPtEtaPhi(Xb_PT,Xb_ETA,Xb_PHI); double dmag2 = dir.Mag2(); double ptprime = 0; if ( 0 == dmag2 ) ptprime = mom.Mag(); else ptprime = (mom - dir * ( mom.Dot( dir ) / dmag2 )).Mag() ; Xb_CorrM = sqrt(Xb_M*Xb_M + ptprime*ptprime) + ptprime; TLorentzVector Xb; Xb.SetPtEtaPhiM(Xb_PT,Xb_ETA,Xb_PHI,Xb_CorrM); TLorentzVector Xc; Xc.SetPtEtaPhiM(Xc_PT,Xc_ETA,Xc_PHI,Xc_M); for(int i = 0; i < Added_n_Particles; i++){ TLorentzVector Hpi; Hpi.SetPtEtaPhiM(Added_H_PT[i],Added_H_ETA[i],Added_H_PHI[i],pionmass); TLorentzVector HK; HK.SetPtEtaPhiM(Added_H_PT[i],Added_H_ETA[i],Added_H_PHI[i],kaonmass); TLorentzVector Hp; Hp.SetPtEtaPhiM(Added_H_PT[i],Added_H_ETA[i],Added_H_PHI[i],protonmass); TLorentzVector Xcpi = Hpi + Xc; TLorentzVector XcK = HK + Xc; TLorentzVector Xcp = Hp + Xc; Xcpi.Boost(-Xb.BoostVector()); Xcpi_CosTheta[i] = cos(Xcpi.Angle(Xb.Vect())); XcK.Boost(-Xb.BoostVector()); XcK_CosTheta[i] = cos(XcK.Angle(Xb.Vect())); Xcp.Boost(-Xb.BoostVector()); Xcp_CosTheta[i] = cos(Xcp.Angle(Xb.Vect())); } p_beta = (-p_P+SSK1_P+SSK2_P+pi_P)/(p_P+SSK1_P+SSK2_P+pi_P); SSK1_beta = ( p_P-SSK1_P+SSK2_P+pi_P)/(p_P+SSK1_P+SSK2_P+pi_P); SSK2_beta = ( p_P+SSK1_P-SSK2_P+pi_P)/(p_P+SSK1_P+SSK2_P+pi_P); pi_beta = ( p_P+SSK1_P+SSK2_P-pi_P)/(p_P+SSK1_P+SSK2_P+pi_P); added_Omegac_tree.Fill(); } added_Omegac_tree.Write(); clock->Stop();clock->Print();delete clock; return; }
DGLE_RESULT DGLE_API CMesh::RecalculateTangentSpace() { if (!_pBuffer) return S_FALSE; TDrawDataDesc desc; _pBuffer->GetBufferDrawDataDesc(desc); if (desc.uiTextureVertexOffset == -1 || (desc.uiTangentOffset == -1 && desc.uiBinormalOffset != -1) || (desc.uiTangentOffset != -1 && desc.uiBinormalOffset == -1)) // confusing situation should never happen return E_ABORT; if (desc.uiNormalOffset == -1) RecalculateNormals(false); uint stride, verts_data_size, verts_count, idxs_data_size, idxs_count; _CopyMeshData(desc, stride, verts_data_size, verts_count, idxs_data_size, idxs_count); TDrawDataDesc desc_new(desc); bool do_delete_new = false; if (desc.uiTangentOffset == -1 && desc.uiBinormalOffset == -1) { do_delete_new = true; const uint new_verts_data_size = verts_data_size + verts_count * 6 * sizeof(float); desc_new.pData = new uint8[new_verts_data_size + idxs_data_size]; memcpy(desc_new.pData, desc.pData, verts_data_size); desc_new.uiTangentOffset = verts_data_size; desc_new.uiTangentStride = 0; desc_new.uiBinormalOffset = verts_data_size + verts_count * 3 * sizeof(float); desc_new.uiBinormalStride = 0; if (idxs_count != 0) { desc_new.pIndexBuffer = &desc_new.pData[new_verts_data_size]; memcpy(&desc_new.pData[new_verts_data_size], &desc.pData[verts_data_size], idxs_data_size); } memset(&desc_new.pData[verts_data_size], 0, new_verts_data_size - verts_data_size); } else { const uint t_stride = desc_new.uiTangentStride == 0 ? 3 * sizeof(float) : desc_new.uiTangentStride, b_stride = desc_new.uiBinormalStride == 0 ? 3 * sizeof(float) : desc_new.uiBinormalStride; for (uint i = 0; i < verts_count; ++i) { *(reinterpret_cast<TVector3 *>(&desc_new.pData[desc_new.uiTangentOffset + i * t_stride])) = TVector3(); *(reinterpret_cast<TVector3 *>(&desc_new.pData[desc_new.uiBinormalOffset + i * b_stride])) = TVector3(); } } const uint t_stride = desc_new.uiTangentStride == 0 ? 3 * sizeof(float) : desc_new.uiTangentStride, b_stride = desc_new.uiBinormalStride == 0 ? 3 * sizeof(float) : desc_new.uiBinormalStride, tex_stride = desc_new.uiTextureVertexStride == 0 ? 2 * sizeof(float) : desc_new.uiTextureVertexStride, v_stride = desc_new.uiVertexStride == 0 ? 3 * sizeof(float) : desc_new.uiVertexStride, n_stride = desc_new.uiNormalStride == 0 ? 3 * sizeof(float) : desc_new.uiNormalStride, count = idxs_count == 0 ? verts_count / 3 : idxs_count / 3; for(uint i = 0; i < count; ++i) { uint face[3]; if (idxs_count == 0) { face[0] = i * 3; face[1] = i * 3 + 1; face[2] = i * 3 + 2; } else if (desc_new.bIndexBuffer32) { face[0] = reinterpret_cast<uint *>(&desc_new.pIndexBuffer[i * 3 * sizeof(uint)])[0]; face[1] = reinterpret_cast<uint *>(&desc_new.pIndexBuffer[i * 3 * sizeof(uint)])[1]; face[2] = reinterpret_cast<uint *>(&desc_new.pIndexBuffer[i * 3 * sizeof(uint)])[2]; } else { face[0] = reinterpret_cast<uint16 *>(&desc_new.pIndexBuffer[i * 3 * sizeof(uint16)])[0]; face[1] = reinterpret_cast<uint16 *>(&desc_new.pIndexBuffer[i * 3 * sizeof(uint16)])[1]; face[2] = reinterpret_cast<uint16 *>(&desc_new.pIndexBuffer[i * 3 * sizeof(uint16)])[2]; } const TPoint3 * const v[3] = { reinterpret_cast<TPoint3 *>(&desc_new.pData[face[0] * v_stride]), reinterpret_cast<TPoint3 *>(&desc_new.pData[face[1] * v_stride]), reinterpret_cast<TPoint3 *>(&desc_new.pData[face[2] * v_stride])}; const TPoint2 * const t[3] = { reinterpret_cast<TPoint2 *>(&desc_new.pData[desc_new.uiTextureVertexOffset + face[0] * tex_stride]), reinterpret_cast<TPoint2 *>(&desc_new.pData[desc_new.uiTextureVertexOffset + face[1] * tex_stride]), reinterpret_cast<TPoint2 *>(&desc_new.pData[desc_new.uiTextureVertexOffset + face[2] * tex_stride])}; const TVector3 v1 = *v[1] - *v[0], v2 = *v[2] - *v[0]; const TVector2 v3 = *t[1] - *t[0], v4 = *t[2] - *t[0]; const float d = v3.Cross(v4); if (d == 0.f) continue; const float r = 1.f / d; const TVector3 sdir = TVector3(v4.y * v1.x - v4.x * v2.x, v4.y * v1.y - v4.x * v2.y, v4.y * v1.z - v4.x * v2.z) * r, tdir = TVector3(v3.x * v2.x - v3.y * v1.x, v3.x * v2.y - v3.y * v1.y, v3.x * v2.z - v3.y * v1.z) * r; *(reinterpret_cast<TVector3 *>(&desc_new.pData[desc_new.uiTangentOffset + face[0] * t_stride])) += sdir; *(reinterpret_cast<TVector3 *>(&desc_new.pData[desc_new.uiTangentOffset + face[1] * t_stride])) += sdir; *(reinterpret_cast<TVector3 *>(&desc_new.pData[desc_new.uiTangentOffset + face[2] * t_stride])) += sdir; *(reinterpret_cast<TVector3 *>(&desc_new.pData[desc_new.uiBinormalOffset + face[0] * b_stride])) += tdir; *(reinterpret_cast<TVector3 *>(&desc_new.pData[desc_new.uiBinormalOffset + face[1] * b_stride])) += tdir; *(reinterpret_cast<TVector3 *>(&desc_new.pData[desc_new.uiBinormalOffset + face[2] * b_stride])) += tdir; } for (uint i = 0; i < verts_count; ++i) { const TVector3 * const normal = reinterpret_cast<TVector3 *>(&desc_new.pData[desc_new.uiNormalOffset + i * n_stride]); TVector3 *tangent = reinterpret_cast<TVector3 *>(&desc_new.pData[desc_new.uiTangentOffset + i * t_stride]), *binormal = reinterpret_cast<TVector3 *>(&desc_new.pData[desc_new.uiBinormalOffset + i * b_stride]); float dot_1 = normal->Dot(*tangent), dot_2; *tangent = (*tangent - *normal * dot_1).Normalize(); dot_1 = normal->Dot(*tangent); dot_2 = tangent->Dot(*binormal); *binormal = (*binormal - *normal * dot_1 + *tangent * dot_2).Normalize(); } PARANOIC_CHECK_RES(_pBuffer->Reallocate(desc_new, verts_count, idxs_count, CRDM_TRIANGLES)); if (do_delete_new) delete[] desc_new.pData; delete[] desc.pData; return S_OK; }
void pgsAnalysis::Loop() { double tHrec, tZ1m, tZ2m, tcosthetaStar, tPhi, tPhi1, tcostheta1, tcostheta2,tHrec_constr,tZ1m_constr, tZ2m_constr; string ttype; hists->Branch("Hrec", &tHrec); hists->Branch("Z1m", &tZ1m); hists->Branch("Z2m", &tZ2m); hists->Branch("costhetaStar", &tcosthetaStar); hists->Branch("Phi", &tPhi); hists->Branch("Phi1", &tPhi1); hists->Branch("costheta1", &tcostheta1); hists->Branch("costheta2", &tcostheta2); hists->Branch("type", &ttype); //event type!! int eeee, xxxx, eexx, xxee; double Zmass = 91.19; double vZmass; if (pairing == 0){ vZmass = 91.19; } else{ vZmass = 45.; } TVectorT<double> elSum(4); TVectorT<double> muSum(4); //electrons array vector<int> el; int elC = 0; //muons array vector<int> mu; int muC = 0; //antielectrons array vector<int> antiel; int antielC = 0; //antimuons array vector<int> antimu; int antimuC = 0; vector<TVector3> leptons; TVector3 lep1,lep2,lep3,lep4; TVector3 Za, Zb, Zc, Zd, H; int lCounter = 0; int totaLlCounter = 0; int goodEventCounter = 0; int histCounter = 0; if (fChain == 0) return; int nentries = n; // cout << " nentries are "<<nentries<<endl; Long64_t nbytes = 0, nb = 0; for (Long64_t jentry=0; jentry<nentries;jentry++) { Long64_t ientry = LoadTree(jentry); if (ientry < 0) break; nb = fChain->GetEntry(jentry); nbytes += nb; // if (Cut(ientry) < 0) continue; el.clear(); antiel.clear(); mu.clear(); antimu.clear(); lCounter = 0; eeee = 0; xxxx = 0; eexx = 0; xxee = 0; //particles identified by type, ntrk for (int inst = 0; inst < npart; inst++){ // inst from "instance" on the scan tree // cout<< " instance "<< inst <<endl; // cout<< pT[inst]<< endl; //fill el mu vectors if ( typ[inst] == 1 && ntrk[inst] == -1){ el.push_back(inst); elC++; lCounter++; totaLlCounter++; } if ( typ[inst] == 1 && ntrk[inst] == 1){ antiel.push_back(inst); antielC++; lCounter++; totaLlCounter++; } if ( typ[inst] == 2 && ntrk[inst] == -1){ mu.push_back(inst); muC++; lCounter++; totaLlCounter++; } if ( typ[inst] == 2 && ntrk[inst] == 1){ antimu.push_back(inst); antimuC++; lCounter++; totaLlCounter++; } if ( (typ[inst] == 4 && jmas[inst] > 10. )|| (typ[inst] == 6 && pT[inst] > 10. )){ lCounter = 0; //dont count the event } }//end instance loop (particles in an event // cout<< "leptons in the event are "<< lCounter<<endl; // if (lCounter == 4) { fillFlag = false; // If else if loops reconstructing the particles according to the type 4e,4mu, 2e2mu if (el.size() == 1 && mu.size() == 1 && antiel.size() == 1 && antimu.size() == 1){ //2e2m goodEventCounter++; lep1.SetPtEtaPhi( pT[el[0]], eta[el[0]] , phi[el[0]]); //set up of lepton four-vectors lep2.SetPtEtaPhi( pT[antiel[0]], eta[antiel[0]] , phi[antiel[0]]); lep3.SetPtEtaPhi( pT[mu[0]], eta[mu[0]] , phi[mu[0]]); lep4.SetPtEtaPhi( pT[antimu[0]], eta[antimu[0]] , phi[antimu[0]]); Za = lep1 + lep2; Zb = lep3 + lep4; mZ1 = sqrt(pow(lep1.Mag()+lep2.Mag(),2)-Za.Mag2()); // reconstruct z masses mZ2 = sqrt(pow(lep3.Mag()+lep4.Mag(),2)-Zb.Mag2()); //select leading Z if(mZ1 > mZ2) { Z1.SetVectM( Za, mZ1); Z2.SetVectM(Zb,mZ2); lep_min1.SetPtEtaPhiE(lep1.Pt(),lep1.Eta(), lep1.Phi(),lep1.Mag()); lep_plus1.SetPtEtaPhiE(lep2.Pt(),lep2.Eta(), lep2.Phi(),lep2.Mag()); lep_min2.SetPtEtaPhiE(lep3.Pt(),lep3.Eta(), lep3.Phi(),lep3.Mag()); lep_plus2.SetPtEtaPhiE(lep4.Pt(),lep4.Eta(), lep4.Phi(),lep4.Mag());eexx++;} //to set the highest mass the z else { Z2.SetVectM( Za, mZ1); Z1.SetVectM(Zb,mZ2); lep_min2.SetPtEtaPhiE(lep1.Pt(),lep1.Eta(), lep1.Phi(),lep1.Mag()); lep_plus2.SetPtEtaPhiE(lep2.Pt(),lep2.Eta(), lep2.Phi(),lep2.Mag()); lep_min1.SetPtEtaPhiE(lep3.Pt(),lep3.Eta(), lep3.Phi(),lep3.Mag()); lep_plus1.SetPtEtaPhiE(lep4.Pt(),lep4.Eta(), lep4.Phi(),lep4.Mag());xxee++;} fillFlag = true; } else if (el.size() == 2 && mu.size() == 0 && antiel.size() == 2 && antimu.size() == 0){ //4e goodEventCounter++; lep1.SetPtEtaPhi( pT[el[0]], eta[el[0]] , phi[el[0]]); lep2.SetPtEtaPhi( pT[antiel[0]], eta[antiel[0]] , phi[antiel[0]]); lep3.SetPtEtaPhi( pT[el[1]], eta[el[1]] , phi[el[1]]); lep4.SetPtEtaPhi( pT[antiel[1]], eta[antiel[1]] , phi[antiel[1]]); Za = lep1 + lep2; Zb = lep3 + lep4; Zc = lep1 + lep4; Zd = lep3 + lep2; double mZa = sqrt(pow(lep1.Mag()+lep2.Mag(),2)-Za.Mag2()); double mZb = sqrt(pow(lep3.Mag()+lep4.Mag(),2)-Zb.Mag2()); double mZc = sqrt(pow(lep1.Mag()+lep4.Mag(),2)-Zc.Mag2()); double mZd = sqrt(pow(lep2.Mag()+lep3.Mag(),2)-Zd.Mag2()); double s1a; double s1b; double s2a; double s2b; if ( pairing == 0){ s1a = pow(mZa-vZmass,2) + pow(mZb-Zmass,2); s1b = pow(mZa-Zmass,2) + pow(mZb-vZmass,2); s2a = pow(mZc-vZmass,2) + pow(mZd-Zmass,2); s2b = pow(mZc-Zmass,2) + pow(mZd-vZmass,2); } else{ s1a = fabs(mZb-Zmass); s1b = fabs(mZa-Zmass); s2a = fabs(mZd-Zmass); s2b = fabs(mZc-Zmass); } elSum[0] = s1a; elSum[1] = s1b; elSum[2] = s2a; elSum[3] = s2b; int min = TMath::LocMin(4, &elSum[0]); if( (min == 0 || min == 1) ){ if(mZa > mZb) { Z1.SetVectM( Za, mZa); Z2.SetVectM(Zb,mZb); lep_min1.SetPtEtaPhiE(lep1.Pt(),lep1.Eta(), lep1.Phi(),lep1.Mag()); lep_plus1.SetPtEtaPhiE(lep2.Pt(),lep2.Eta(), lep2.Phi(),lep2.Mag()); lep_min2.SetPtEtaPhiE(lep3.Pt(),lep3.Eta(), lep3.Phi(),lep3.Mag()); lep_plus2.SetPtEtaPhiE(lep4.Pt(),lep4.Eta(), lep4.Phi(),lep4.Mag());} //to set the highest mass the z else { Z2.SetVectM( Za, mZa); Z1.SetVectM(Zb,mZb); lep_min2.SetPtEtaPhiE(lep1.Pt(),lep1.Eta(), lep1.Phi(),lep1.Mag()); lep_plus2.SetPtEtaPhiE(lep2.Pt(),lep2.Eta(), lep2.Phi(),lep2.Mag()); lep_min1.SetPtEtaPhiE(lep3.Pt(),lep3.Eta(), lep3.Phi(),lep3.Mag()); lep_plus1.SetPtEtaPhiE(lep4.Pt(),lep4.Eta(), lep4.Phi(),lep4.Mag());} } else if( (min == 2 || min == 3) ){ if(mZc > mZd) { Z1.SetVectM( Zc, mZc); Z2.SetVectM(Zd,mZd); lep_min1.SetPtEtaPhiE(lep1.Pt(),lep1.Eta(), lep1.Phi(),lep1.Mag()); lep_plus1.SetPtEtaPhiE(lep4.Pt(),lep4.Eta(), lep4.Phi(),lep4.Mag()); lep_min2.SetPtEtaPhiE(lep3.Pt(),lep3.Eta(), lep3.Phi(),lep3.Mag()); lep_plus2.SetPtEtaPhiE(lep2.Pt(),lep2.Eta(), lep2.Phi(),lep2.Mag());} //to set the highest mass the z else { Z2.SetVectM( Zc, mZc); Z1.SetVectM(Zd,mZd); lep_min2.SetPtEtaPhiE(lep1.Pt(),lep1.Eta(), lep1.Phi(),lep1.Mag()); lep_plus2.SetPtEtaPhiE(lep4.Pt(),lep4.Eta(), lep4.Phi(),lep4.Mag()); lep_min1.SetPtEtaPhiE(lep3.Pt(),lep3.Eta(), lep3.Phi(),lep3.Mag()); lep_plus1.SetPtEtaPhiE(lep2.Pt(),lep2.Eta(), lep2.Phi(),lep2.Mag());} } eeee++; fillFlag = true; } else if(el.size() == 0 && mu.size() == 2 && antiel.size() == 0 && antimu.size() == 2 ) { //4m goodEventCounter++; lep1.SetPtEtaPhi( pT[mu[0]], eta[mu[0]] , phi[mu[0]]); lep2.SetPtEtaPhi( pT[antimu[0]], eta[antimu[0]] , phi[antimu[0]]); lep3.SetPtEtaPhi( pT[mu[1]], eta[mu[1]] , phi[mu[1]]); lep4.SetPtEtaPhi( pT[antimu[1]], eta[antimu[1]] , phi[antimu[1]]); Za = lep1 + lep2; Zb = lep3 + lep4; Zc = lep1 + lep4; Zd = lep3 + lep2; double mZa = sqrt(pow(lep1.Mag()+lep2.Mag(),2)-Za.Mag2()); double mZb = sqrt(pow(lep3.Mag()+lep4.Mag(),2)-Zb.Mag2()); double mZc = sqrt(pow(lep1.Mag()+lep4.Mag(),2)-Zc.Mag2()); double mZd = sqrt(pow(lep2.Mag()+lep3.Mag(),2)-Zd.Mag2()); double s1a; double s1b; double s2a; double s2b; if ( pairing == 0){ s1a = pow(mZa-vZmass,2) + pow(mZb-Zmass,2); s1b = pow(mZa-Zmass,2) + pow(mZb-vZmass,2); s2a = pow(mZc-vZmass,2) + pow(mZd-Zmass,2); s2b = pow(mZc-Zmass,2) + pow(mZd-vZmass,2); } else{ s1a = fabs(mZb-Zmass); s1b = fabs(mZa-Zmass); s2a = fabs(mZd-Zmass); s2b = fabs(mZc-Zmass); } muSum[0] = s1a; muSum[1] = s1b; muSum[2] = s2a; muSum[3] = s2b; int min = TMath::LocMin(4, &muSum[0]); if( (min == 0 || min == 1) ){ if(mZa > mZb) { Z1.SetVectM( Za, mZa); Z2.SetVectM(Zb,mZb); lep_min1.SetPtEtaPhiE(lep1.Pt(),lep1.Eta(), lep1.Phi(),lep1.Mag()); lep_plus1.SetPtEtaPhiE(lep2.Pt(),lep2.Eta(), lep2.Phi(),lep2.Mag()); lep_min2.SetPtEtaPhiE(lep3.Pt(),lep3.Eta(), lep3.Phi(),lep3.Mag()); lep_plus2.SetPtEtaPhiE(lep4.Pt(),lep4.Eta(), lep4.Phi(),lep4.Mag());} //to set the highest mass the z else { Z2.SetVectM( Za, mZa); Z1.SetVectM(Zb,mZb); lep_min2.SetPtEtaPhiE(lep1.Pt(),lep1.Eta(), lep1.Phi(),lep1.Mag()); lep_plus2.SetPtEtaPhiE(lep2.Pt(),lep2.Eta(), lep2.Phi(),lep2.Mag()); lep_min1.SetPtEtaPhiE(lep3.Pt(),lep3.Eta(), lep3.Phi(),lep3.Mag()); lep_plus1.SetPtEtaPhiE(lep4.Pt(),lep4.Eta(), lep4.Phi(),lep4.Mag());} } else if( (min == 2 || min == 3) ){ if(mZc > mZd) { Z1.SetVectM( Zc, mZc); Z2.SetVectM(Zd,mZd); lep_min1.SetPtEtaPhiE(lep1.Pt(),lep1.Eta(), lep1.Phi(),lep1.Mag()); lep_plus1.SetPtEtaPhiE(lep4.Pt(),lep4.Eta(), lep4.Phi(),lep4.Mag()); lep_min2.SetPtEtaPhiE(lep3.Pt(),lep3.Eta(), lep3.Phi(),lep3.Mag()); lep_plus2.SetPtEtaPhiE(lep2.Pt(),lep2.Eta(), lep2.Phi(),lep2.Mag());} //to set the highest mass the z else { Z2.SetVectM( Zc, mZc); Z1.SetVectM(Zd,mZd); lep_min2.SetPtEtaPhiE(lep1.Pt(),lep1.Eta(), lep1.Phi(),lep1.Mag()); lep_plus2.SetPtEtaPhiE(lep4.Pt(),lep4.Eta(), lep4.Phi(),lep4.Mag()); lep_min1.SetPtEtaPhiE(lep3.Pt(),lep3.Eta(), lep3.Phi(),lep3.Mag()); lep_plus1.SetPtEtaPhiE(lep2.Pt(),lep2.Eta(), lep2.Phi(),lep2.Mag());} } xxxx++; fillFlag = true; } if ( fillFlag == true && goodEventCounter < 25001) { //if it fullfills the specs then fill and find angles rec_H = Z1 + Z2; double Hmass = rec_H.M(); tHrec = Hmass; // cout<<tHrec<<endl; double Z1mass = Z1.M(); tZ1m = Z1mass; double Z2mass = Z2.M(); tZ2m = Z2mass; double ptlepp1 = lep_plus1.Pt(); double ptlepm1 = lep_min1.Pt(); double ptlepp2 = lep_plus2.Pt(); double ptlepm2 = lep_min2.Pt(); double dR1 = sqrt(pow(fabs(lep_min1.Eta() - lep_plus1.Eta()),2)+pow(fabs(lep_min1.DeltaPhi(lep_plus1)),2)); double dR2 = sqrt(pow(fabs(lep_min2.Eta() - lep_plus2.Eta()),2)+pow(fabs(lep_min2.DeltaPhi(lep_plus2)),2)); // if ( /*Hmass<120 || Hmass>130 || */Z1mass < 49 || Z1mass>107 || Z2mass < 12 || Z2mass> 115 ){continue;} //constrains //filling the simple histogram values h_Z1_m -> Fill(Z1.M()); h_Z1_E -> Fill(Z1.E()); h_Z1_Pt -> Fill(Z1.Pt()); h_Z1_eta -> Fill(Z1.Eta()); h_Z1_phi -> Fill(Z1.Phi()); h_Z2_m -> Fill(Z2.M()); h_Z2_E -> Fill(Z2.E()); h_Z2_Pt -> Fill(Z2.Pt()); h_Z2_eta -> Fill(Z2.Eta()); h_Z2_phi -> Fill(Z2.Phi()); h_rec_H_m -> Fill(Hmass); h_rec_H_E -> Fill(rec_H.E()); h_rec_H_Pt -> Fill(rec_H.Pt()); h_rec_H_eta -> Fill(rec_H.Eta()); h_rec_H_phi -> Fill(rec_H.Phi()); h_lep_plus1_E -> Fill(lep_plus1.E()); h_lep_plus1_Pt -> Fill(ptlepp1); h_lep_plus1_eta -> Fill(lep_plus1.Eta()); h_lep_plus1_phi -> Fill(lep_plus1.Phi()); h_lep_min1_E -> Fill(lep_min1.E()); h_lep_min1_Pt -> Fill(ptlepm1); h_lep_min1_eta -> Fill(lep_min1.Eta()); h_lep_min1_phi -> Fill(lep_min1.Phi()); h_lep_plus2_E -> Fill(lep_plus2.E()); h_lep_plus2_Pt -> Fill(ptlepp2); h_lep_plus2_eta -> Fill(lep_plus2.Eta()); h_lep_plus2_phi -> Fill(lep_plus2.Phi()); h_lep_min2_E -> Fill(lep_min2.E()); h_lep_min2_Pt -> Fill(ptlepm2); h_lep_min2_eta -> Fill(lep_min2.Eta()); h_lep_min2_phi -> Fill(lep_min2.Phi()); //reconstructing the two lepton pairs Lorentz vectors lpair1 = lep_plus1 + lep_min1; lpair2 = lep_plus2 + lep_min2; //constructing 3-vectors in the lab frame lep_plus1_lab = lep_plus1.Vect(); lep_plus2_lab = lep_plus2.Vect(); //.Vect() gives 3 vector from 4vector lep_min1_lab = lep_min1.Vect(); lep_min2_lab = lep_min2.Vect(); lpair1_lab = lep_plus1_lab.Cross(lep_min1_lab); lpair2_lab = lep_plus2_lab.Cross(lep_min2_lab); // cout << " pt of lepton pair1 on rest frame is: "<< lpair1.Perp()<<endl; //Filling up Histograms with angles defined in the lab frame h_angle_lab_pair1 -> Fill(lep_plus1_lab.Angle(lep_min1_lab)); h_angle_lab_pair2 -> Fill(lep_plus2_lab.Angle(lep_min2_lab)); //Filling up histograms with variables from articles h_angle_lab_deleta1 -> Fill(fabs(lep_min1.Eta() - lep_plus1.Eta())); h_angle_lab_delphi1 -> Fill(fabs(lep_min1.DeltaPhi(lep_plus1))); h_angle_lab_deleta2 -> Fill(fabs(lep_min2.Eta() - lep_plus2.Eta())); h_angle_lab_delphi2 -> Fill(fabs(lep_min2.DeltaPhi(lep_plus2))); //Looking at the Higgs rest frame TVector3 boost_rH = -rec_H.BoostVector(); //NOTE the minus sign! WHY - sign??? TVector3 boost_rZ1 = -Z1.BoostVector(); TVector3 boost_rZ2 = -Z2.BoostVector(); Higgs_rest = rec_H; Z1_rH = Z1; Z2_rH = Z2; lep_p1_rH = lep_plus1; // lep_m1_rH = lep_min1; lep_p2_rH = lep_plus2; lep_m2_rH = lep_min2; lep_p1_rZ1 = lep_plus1; lep_m2_rZ2 = lep_min2; lep_p2_rZ2 = lep_plus2; lep_m1_rZ1 = lep_min1; //Boosting vectors to the Higgs rest frame Higgs_rest.Boost(boost_rH); Z1_rH.Boost(boost_rH); Z2_rH.Boost(boost_rH); lep_p1_rH.Boost(boost_rH); lep_m1_rH.Boost(boost_rH); lep_p2_rH.Boost(boost_rH); lep_m2_rH.Boost(boost_rH); //Boosting leptons to Z rest frames lep_p1_rZ1.Boost(boost_rZ1); lep_m1_rZ1.Boost(boost_rZ1); lep_p2_rZ2.Boost(boost_rZ2); lep_m2_rZ2.Boost(boost_rZ2); //Setting 3Vectors in Higgs rest frame Z3_1_rH = Z1_rH.Vect(); Z3_2_rH = Z2_rH.Vect(); lep3_plus1_rH = lep_p1_rH.Vect(); lep3_min1_rH = lep_m1_rH.Vect(); lep3_plus2_rH = lep_p2_rH.Vect(); lep3_min2_rH = lep_m2_rH.Vect(); TVector3 Z3_1plane_rH = lep3_plus1_rH.Cross(lep3_min1_rH); //wrong? TVector3 Z3_2plane_rH = lep3_plus2_rH.Cross(lep3_min2_rH); //Setting 3Vectors in Z1/Z2 rest frame lep3_plus1_rZ1 = lep_p1_rZ1.Vect(); lep3_plus2_rZ2 = lep_p2_rZ2.Vect(); lep3_min1_rZ1 = lep_m1_rZ1.Vect(); lep3_min2_rZ2 = lep_m2_rZ2.Vect(); //Filling up histogram for the phi angle distribution //pairnoume ta monadiaia dianysmata twn kathetwn pediwn, prwta ypologizoume to metro tous, meta eswteriko ginomeno, meta tokso tou costheta tous double metro1 = sqrt((pow(Z3_1plane_rH.X(),2))+(pow(Z3_1plane_rH.Y(),2))+(pow(Z3_1plane_rH.Z(),2))); double metro2 = sqrt((pow(Z3_2plane_rH.X(),2))+(pow(Z3_2plane_rH.Y(),2))+(pow(Z3_2plane_rH.Z(),2))); TVector3 Z3_1plane_rH_un = Z3_1plane_rH.Unit(); TVector3 Z3_2plane_rH_un = Z3_2plane_rH.Unit(); TVector3 drtPlane = Z3_1plane_rH_un.Cross(Z3_2plane_rH_un); double phi = acos(-Z3_1plane_rH_un.Dot(Z3_2plane_rH_un))*(Z3_1_rH.Dot(skata))/fabs(Z3_1_rH.Dot(skata)); h_angle_rH_phi -> Fill( phi ); tPhi = phi; //****Phi one angle , same procedure as before. Now the plane is the first Z boson vector with beam axis, so they form a plane, phi1 is angle between this plane and the Z1 plane (apo to decay twn 2 leptoniwn) TVector3 niScatter_un = (beamAxis.Cross(Z3_1_rH)).Unit(); TVector3 drtPlane2 = Z3_1plane_rH_un.Cross(niScatter_un); double phiOne = acos(Z3_1plane_rH_un.Dot(niScatter_un))*(Z3_1_rH.Dot(skata2))/fabs(Z3_1_rH.Dot(skata2)); h_angle_rH_phiOne -> Fill( phiOne ); tPhi1 = phiOne; //Filling up histogram for theta* angle: Z1/Z2 with Higgs boost vector h_angle_rH_thetaZ2 -> Fill(Z3_2_rH.CosTheta()); double cosThetaStar = Z3_1_rH.CosTheta(); h_angle_rH_thetaZ1 -> Fill(cosThetaStar); tcosthetaStar = cosThetaStar; // boosting the z to the other z frame TLorentzVector Z_1_rZ2 = Z1; Z_1_rZ2.Boost(boost_rZ2); TVector3 Z3_1_rZ2 = Z_1_rZ2.Vect(); TLorentzVector Z_2_rZ1 = Z2; Z_2_rZ1.Boost(boost_rZ1); TVector3 Z3_2_rZ1 = Z_2_rZ1.Vect(); double cosTheta1 = cos(lep3_min1_rZ1.Angle(-Z3_2_rZ1)); double cosTheta2 = cos(lep3_min2_rZ2.Angle(-Z3_1_rZ2)); h_angle_rZ1_lp1Z1 -> Fill(cos(lep3_plus1_rZ1.Angle(-Z3_2_rZ1))); h_angle_rZ1_lm1Z1 -> Fill(cosTheta1); // theta1 h_angle_rZ2_lp2Z2 -> Fill(cos(lep3_plus2_rZ2.Angle(-Z3_1_rZ2))); h_angle_rZ2_lm2Z2 -> Fill(cosTheta2); // theta2 tcostheta1 = cosTheta1; tcostheta2 = cosTheta2; h_angle_rH_delphi1 -> Fill(fabs(lep_p1_rH.DeltaPhi(lep_m1_rH))); h_angle_rH_delphi2 -> Fill(fabs(lep_p2_rH.DeltaPhi(lep_m2_rH))); h_mZ1mZ2 -> Fill(Z1.M(),Z2.M()); h_mVsPtZ1 -> Fill(Z1.M(),Z1.Pt()); h_delphi1VsPtZ1_lab -> Fill(Z1.Pt(),fabs(lep_min1.DeltaPhi(lep_plus1))); h_delphi2VsPtZ2_lab -> Fill(Z2.Pt(),fabs(lep_min2.DeltaPhi(lep_plus2))); if (eexx ==1){ttype = "eexx";} else if(xxee ==1){ttype = "xxee";} else if(eeee ==1){ttype = "eeee";} else if(xxxx ==1){ttype = "xxxx";} hists->Fill(); histCounter++; hists->Close(); } //end if fill ////////////// fill out the decay type // filling the TTree }//end entries loop (events) //some regular reports cout<<endl; cout<<" good events are "<<goodEventCounter<<endl; cout<<" we see % "<< (double) goodEventCounter/n <<endl; cout<<endl; cout<<" histogram fills are "<<histCounter<<endl; // cout<<" we see % "<< (double) goodEventCounter/n <<endl; }//end loop void