ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/PhotonTreeWriter.cc
(Generate patch)

Comparing UserCode/MitPhysics/Mods/src/PhotonTreeWriter.cc (file contents):
Revision 1.55 by veverka, Mon Oct 7 12:47:49 2013 UTC vs.
Revision 1.56 by veverka, Thu Nov 7 17:15:46 2013 UTC

# Line 1519 | Line 1519 | PhotonTreeWriterPhoton<NClus>::SetVars(c
1519      combiso2 = -99.;
1520    }
1521  
1522 <  scindex = PhotonTreeWriter::IndexOfElementInCollection(s, scs);
1522 >  // TODO: fix the bug with supercluster index
1523 >  scindex = PhotonTreeWriter::IndexOfNearestSuperClusterInCollection(s, scs);
1524    /// DEBUG
1525 <  cout << "JV: s, scs, index: " << s << ", " << scs << ", " << scindex << endl;
1525 >  // cout << "JV: s, scs, index: " << s << ", " << scs << ", " << scindex << endl;
1526    sce = s->Energy();
1527    scrawe = s->RawEnergy();
1528    scpse = s->PreshowerEnergy();
# Line 2507 | Line 2508 | bool PhotonTreeWriter::VHLepHasDielectro
2508      goodElectrons.push_back(iele);
2509    }
2510    
2511 <  // Loop over electron pairs.
2512 <  for (UInt_t iele1 = 0; iele1 < goodElectrons.size() - 1; ++iele1) {
2511 >  // Loop over pairs of selected electrons.
2512 >  for (UInt_t iiele1 = 0; iiele1 < goodElectrons.size() - 1; ++iiele1) {
2513 >    UInt_t iele1 = goodElectrons[iiele1];
2514      const Electron *ele1 = fLeptonTagSoftElectrons->At(iele1);
2515 <    for (UInt_t iele2 = iele1; iele2 < goodElectrons.size(); ++iele2) {
2515 >    for (UInt_t iiele2 = iiele1 + 1; iiele2 < goodElectrons.size(); ++iiele2) {
2516 >      UInt_t iele2 = goodElectrons[iiele2];
2517        const Electron *ele2 = fLeptonTagSoftElectrons->At(iele2);
2518        Double_t mass12 = (ele1->Mom() + ele2->Mom()).M();
2519        if (mass12 < 70. || 110. < mass12) continue;
# Line 2542 | Line 2545 | bool PhotonTreeWriter::VHLepHasDimuon(co
2545      goodMuons.push_back(imu);
2546    }
2547    
2548 <  // Loop over muon pairs and apply the cut 70 < mass(mu1, mu2) < 110.
2549 <  for (UInt_t imu1 = 0; imu1 < goodMuons.size() - 1; ++imu1) {
2548 >  // Loop over muon pairs of selected muons and apply the cut 70 < mass(mu1, mu2) < 110.
2549 >  for (UInt_t iimu1 = 0; iimu1 < goodMuons.size() - 1; ++iimu1) {
2550 >    UInt_t imu1 = goodMuons[iimu1];
2551      const Muon *mu1 = fLeptonTagSoftMuons->At(imu1);
2552 <    for (UInt_t imu2 = imu1; imu2 < goodMuons.size(); ++imu2) {
2552 >    for (UInt_t iimu2 = iimu1 + 1; iimu2 < goodMuons.size(); ++iimu2) {
2553 >      UInt_t imu2 = goodMuons[iimu2];
2554        const Muon *mu2 = fLeptonTagSoftMuons->At(imu2);
2555        Double_t mass12 = (mu1->Mom() + mu2->Mom()).M();
2556        if (mass12 < 70. || 110. < mass12) continue;
# Line 2814 | Line 2819 | UInt_t PhotonTreeWriter::IndexOfElementI
2819    return index;
2820   }
2821  
2822 + //_____________________________________________________________________________
2823 + UInt_t PhotonTreeWriter::IndexOfNearestSuperClusterInCollection(
2824 +          const SuperCluster    *element,
2825 +          const SuperClusterCol *collection
2826 +          )
2827 + {
2828 +  double minMass = 999.;
2829 +  UInt_t minIndex = 0;
2830 +  if (collection->GetEntries() > 0) {
2831 +    minMass = SuperClusterPairMass(element, collection->At(0));
2832 +  }
2833 +  for (UInt_t index = 1;
2834 +       index < collection->GetEntries() && index < (UInt_t) -1; ++index) {
2835 +    double mass = SuperClusterPairMass(element, collection->At(index));
2836 +    if (mass < minMass) {
2837 +      minMass = mass;
2838 +      minIndex = index;
2839 +    }
2840 +  }
2841 +  return minIndex;
2842 + }
2843 +
2844 +
2845 + //_____________________________________________________________________________
2846 + double PhotonTreeWriter::SuperClusterPairMass(const SuperCluster *sc1,
2847 +                                              const SuperCluster *sc2)
2848 + {
2849 +  FourVectorM p1 = SuperClusterFourVectorM(sc1);
2850 +  FourVectorM p2 = SuperClusterFourVectorM(sc2);
2851 +  return (p1 + p2).M();
2852 + }
2853 +
2854 +
2855 + //_____________________________________________________________________________
2856 + FourVectorM PhotonTreeWriter::SuperClusterFourVectorM(const SuperCluster *sc)
2857 + {
2858 +  double e   = sc->Energy();
2859 +  double eta = sc->Eta();
2860 +  double phi = sc->Phi();
2861 +  double pt  = e / TMath::CosH(eta);
2862 +  return FourVectorM(pt, eta, phi, 0.);
2863 + }
2864 +
2865  
2866   //_____________________________________________________________________________
2867   void PhotonTreeWriter::Terminate()

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines