Fork me on GitHub

Changeset 1349 in svn for trunk/modules/PileUpJetID.cc


Ignore:
Timestamp:
Jan 17, 2014, 2:29:22 PM (11 years ago)
Author:
Michele Selvaggi
Message:

JetId v2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/PileUpJetID.cc

    r1348 r1349  
    3636
    3737PileUpJetID::PileUpJetID() :
    38   fItJetInputArray(0),fTrackInputArray(0),fNeutralInputArray(0)
     38  fItJetInputArray(0),fTrackInputArray(0),fNeutralInputArray(0),fItVertexInputArray(0)
    3939{
    4040
     
    6868  fNeutralInputArray = ImportArray(GetString("NeutralInputArray", "Calorimeter/eflowTowers"));
    6969  fItNeutralInputArray = fNeutralInputArray->MakeIterator();
    70 
    71   // create output array(s)
     70 
     71  fVertexInputArray = ImportArray(GetString("VertexInputArray", "PileUpMerger/vertices"));
     72  fItVertexInputArray = fVertexInputArray->MakeIterator();
     73 
     74  fZVertexResolution  = GetDouble("ZVertexResolution", 0.005)*1.0E3;
     75// create output array(s)
    7276
    7377  fOutputArray = ExportArray(GetString("OutputArray", "jets"));
     
    8387  if(fItTrackInputArray) delete fItTrackInputArray;
    8488  if(fItNeutralInputArray) delete fItNeutralInputArray;
     89  if(fItVertexInputArray) delete fItVertexInputArray;
    8590
    8691}
     
    9297  Candidate *candidate, *constituent;
    9398  TLorentzVector momentum, area;
     99  Double_t zvtx=0;
    94100
    95101  Candidate *trk;
     102
     103 // find z position of primary vertex
     104   
     105  fItVertexInputArray->Reset();
     106  while((candidate = static_cast<Candidate*>(fItVertexInputArray->Next())))
     107  {
     108    if(!candidate->IsPU)
     109    {
     110    zvtx = candidate->Position.Z();
     111    break;
     112    }
     113  }
    96114
    97115  // loop over all input candidates
     
    129147        } else {
    130148          // charged
    131           if (constituent->IsPU) {
     149          if (constituent->IsPU && TMath::Abs(constituent->Position.Z()-zvtx) > fZVertexResolution) {
    132150            sumptchpu += pt;
    133151          } else {
     
    146164      // Not using constituents, using dr
    147165      fItTrackInputArray->Reset();
    148       while ((trk = static_cast<Candidate*>(fItTrackInputArray->Next()))) {
     166       while ((trk = static_cast<Candidate*>(fItTrackInputArray->Next()))) {
    149167        if (trk->Momentum.DeltaR(candidate->Momentum) < fParameterR) {
    150168          float pt = trk->Momentum.Pt();
    151169          sumpt += pt;
    152170          sumptch += pt;
    153           if (trk->IsPU) {
     171          if (trk->IsPU && TMath::Abs(trk->Position.Z()-zvtx) > fZVertexResolution) {
    154172            sumptchpu += pt;
    155173          } else {
Note: See TracChangeset for help on using the changeset viewer.