Fork me on GitHub

Ignore:
Timestamp:
Jan 23, 2020, 8:59:46 PM (5 years ago)
Author:
Kaan Yüksel Oyulmaz <kaanyukseloyulmaz@…>
Branches:
Timing
Children:
4ac0049
Parents:
e70228d
Message:

New changes according to last meeting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/TrackPileUpSubtractor.cc

    re70228d r6049672  
    117117void TrackPileUpSubtractor::Process()
    118118{
    119   Candidate *candidate, *particle, *particleTest;
     119  Candidate *candidate, *particle;
    120120  map<TIterator *, TObjArray *>::iterator itInputMap;
    121121  TIterator *iterator;
     
    123123  Double_t z, zvtx = 0;
    124124  Double_t pt, eta, phi, e;
    125   Double_t sumPT2 = 0;
    126   Double_t sumSquare = 0;
    127   int counter = 0;
    128   Double_t tempPTSquare = 0;
    129   Double_t tempZVertex = 0;
     125
    130126  // find z position of primary vertex
    131127
    132   cout << " ---------- NEW EVENT --------- " << endl;
    133 
    134128  fItVertexInputArray->Reset();
    135   cout << " NUMBER OF VERTICES : " << fVertexInputArray->GetEntriesFast() << endl;
    136129  while((candidate = static_cast<Candidate *>(fItVertexInputArray->Next())))
    137130  {
    138       cout << " ---------- NEW VERTEX --------- " << candidate->IsPU << endl;
    139       tempZVertex = candidate->Position.Z();
    140       tempPTSquare = candidate->SumPT2;
    141       if(tempPTSquare > sumSquare)
    142       {
    143         sumSquare = tempPTSquare;
    144         zvtx = tempZVertex;
    145         cout << " Sum Square : " << sumSquare << " Z of Vertex : " << zvtx << "  Is PileUp : " << candidate->IsPU << endl;
    146       }
    147      
    148       /*
    149       for(int i = 0; i < candidate->GetCandidates()->GetEntriesFast(); i++)
    150       {
    151         particleTest = static_cast<Candidate *>(candidate->GetCandidates()->At(i));
    152         TLorentzVector &candidateMomentumNew = particleTest->Momentum;
    153         if(candidateMomentumNew.Pt() > 1.0)
    154           sumSquare += (candidateMomentumNew.Pt()*candidateMomentumNew.Pt());
    155         cout << candidateMomentumNew.Pt() << "  " << candidate->SumPT2 << " counter : " << candidate->GetCandidates()->GetEntriesFast() << endl;
    156       } 
    157       */
     131    if(!candidate->IsPU)
     132    {
     133      zvtx = candidate->Position.Z();
     134    }
    158135  }
    159136
     
    169146    {
    170147      particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0));
    171       const TLorentzVector &candidateMomentum = candidate->Momentum;
     148      const TLorentzVector &candidateMomentum = particle->Momentum;
    172149
    173150      eta = candidateMomentum.Eta();
     
    176153      e = candidateMomentum.E();
    177154
    178       z = candidate->Position.Z();
    179       counter ++;
    180       //sum = pt*pt;
    181       if(pt > 1.0)
    182         sumPT2 += pt*pt;
     155      z = particle->Position.Z();
    183156
    184157      // apply pile-up subtraction
    185158      // assume perfect pile-up subtraction for tracks outside fZVertexResolution
    186       // cout << particle->IsRecoPU << " ParticleSumSquare : " << sumPT2 << " VertexResult : " << sumSquare << " Added SumSquare : " << zvtx << endl;
    187       //cout << pt << "  " << candidate->IsPU << "  " <<  TMath::Abs(z - zvtx) << "   " << sumPT2 << "   " << sumPT2 << endl;
    188159
    189      
    190       if(particle->Charge != 0 && TMath::Abs(z - zvtx) > fFormula->Eval(pt, eta, phi, e) * 1.0e3)
     160      if(candidate->Charge != 0 && candidate->IsPU && TMath::Abs(z - zvtx) > fFormula->Eval(pt, eta, phi, e) * 1.0e3)
    191161      {
    192162        candidate->IsRecoPU = 1;
    193         //cout <<  TMath::Abs(z - zvtx) << "   " << fFormula->Eval(pt, eta, phi, e) * 1.0e3 << endl;
    194163      }
    195164      else
Note: See TracChangeset for help on using the changeset viewer.