Fork me on GitHub

Changeset 667a02a in git for modules


Ignore:
Timestamp:
Jun 8, 2018, 3:23:13 PM (7 years ago)
Author:
Michele Selvaggi <michele.selvaggi@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
e57c062
Parents:
001ee95 (diff), 17d0ab8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of github.com:delphes/delphes

Location:
modules
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • modules/DenseTrackFilter.cc

    r001ee95 r667a02a  
    5454
    5555DenseTrackFilter::DenseTrackFilter() :
    56   fItTrackInputArray(0),   fItDenseChargedInputArray(0)
     56  fItTrackInputArray(0)
    5757{
    5858}
     
    116116  fItTrackInputArray = fTrackInputArray->MakeIterator();
    117117
    118   fDenseChargedInputArray = ImportArray(GetString("DenseChargedInputArray", "DenseMergeTracks/tracks"));
    119   fItDenseChargedInputArray = fDenseChargedInputArray->MakeIterator();
    120 
    121118  fTrackOutputArray = ExportArray(GetString("TrackOutputArray", "tracks"));
     119  fChargedHadronOutputArray = ExportArray(GetString("ChargedHadronOutputArray", "chargedHadrons"));
     120  fElectronOutputArray = ExportArray(GetString("ElectronOutputArray", "electrons"));
     121  fMuonOutputArray = ExportArray(GetString("MuonOutputArray", "muons"));
    122122}
    123123
     
    128128  vector< vector< Double_t >* >::iterator itPhiBin;
    129129  if(fItTrackInputArray) delete fItTrackInputArray;
    130   if(fItDenseChargedInputArray) delete fItDenseChargedInputArray;
    131130  for(itPhiBin = fPhiBins.begin(); itPhiBin != fPhiBins.end(); ++itPhiBin)
    132131  {
     
    155154
    156155  // loop over all tracks
    157   fItDenseChargedInputArray->Reset();
     156  fItTrackInputArray->Reset();
    158157  number = -1;
    159   while((track = static_cast<Candidate*>(fItDenseChargedInputArray->Next())))
     158  while((track = static_cast<Candidate*>(fItTrackInputArray->Next())))
    160159  {
    161160    const TLorentzVector &trackPosition = track->Position;
     
    204203      // switch to next tower
    205204      towerEtaPhi = hitEtaPhi;
    206      
     205
    207206      // saving track with highest pT that hit the tower
    208207      FillTrack();
     
    213212    }
    214213    // check for track hits
    215    
     214
    216215    if(flags & 1)
    217216    {
    218217      ++fTowerTrackHits;
    219       track = static_cast<Candidate*>(fDenseChargedInputArray->At(number));
     218      track = static_cast<Candidate*>(fTrackInputArray->At(number));
    220219      momentum = track->Momentum;
    221220
    222       if (momentum.Pt() > ptmax)
     221      if(momentum.Pt() > ptmax)
    223222      {
    224         ptmax = momentum.Pt();
     223        ptmax = momentum.Pt();
    225224        fBestTrack = track;
    226225      }
    227226      continue;
    228227    }
    229  
    230   }
    231  
     228
     229  }
     230
    232231  // here fill last tower
    233232  FillTrack();
    234  
    235 }
    236 
    237 
     233
     234}
    238235
    239236//------------------------------------------------------------------------------
     
    241238void DenseTrackFilter::FillTrack()
    242239{
    243  
    244   Candidate *candidate, *track, *mother, *trackRef, *bestTrackRef;
     240
     241  Candidate *candidate, *track;
    245242  Double_t pt, eta, phi;
    246   Bool_t matched;
    247  
     243  Int_t numberOfCandidates;
     244
    248245  // saving track with highest pT that hit the tower
    249   if(fTowerTrackHits > 0)
    250   {
    251      bestTrackRef = static_cast<Candidate*>(fBestTrack->GetCandidates()->At(0));
    252 
    253      // find corresponding track in properly propagated tracks
    254      fItTrackInputArray->Reset();
    255      matched = kFALSE;
    256      int ntrack = 0;
    257      while((track = static_cast<Candidate*>(fItTrackInputArray->Next())))
    258      {
    259        ntrack++;
    260        trackRef = static_cast<Candidate*>(track->GetCandidates()->At(0));
    261 
    262        if (trackRef->GetUniqueID() == bestTrackRef->GetUniqueID())
    263        {
    264          mother = track;
    265          candidate = static_cast<Candidate*>(track->Clone());
    266          pt = candidate->Momentum.Pt();
    267          eta = candidate->Momentum.Eta();
    268          phi = candidate->Momentum.Phi();
    269          eta = gRandom->Gaus(eta, fEtaPhiRes);
    270          phi = gRandom->Gaus(phi, fEtaPhiRes);
    271          candidate->Momentum.SetPtEtaPhiE(pt, eta, phi, pt*TMath::CosH(eta));
    272          candidate->AddCandidate(mother);
    273          fTrackOutputArray->Add(candidate);
    274          matched = kTRUE;
    275        }
    276        if (matched) break;
    277      }
    278   }
    279 
    280 
    281 }
     246  if(fTowerTrackHits < 1) return;
     247   
     248  numberOfCandidates = fBestTrack->GetCandidates()->GetEntriesFast();
     249  if(numberOfCandidates < 1) return;
     250
     251  track = static_cast<Candidate*>(fBestTrack->GetCandidates()->At(numberOfCandidates - 1));
     252  candidate = static_cast<Candidate*>(track->Clone());
     253  pt = candidate->Momentum.Pt();
     254  eta = candidate->Momentum.Eta();
     255  phi = candidate->Momentum.Phi();
     256  eta = gRandom->Gaus(eta, fEtaPhiRes);
     257  phi = gRandom->Gaus(phi, fEtaPhiRes);
     258  candidate->Momentum.SetPtEtaPhiE(pt, eta, phi, pt*TMath::CosH(eta));
     259  candidate->AddCandidate(track);
     260
     261  fTrackOutputArray->Add(candidate);
     262  switch(TMath::Abs(candidate->PID))
     263  {
     264    case 11:
     265      fElectronOutputArray->Add(candidate);
     266      break;
     267    case 13:
     268      fMuonOutputArray->Add(candidate);
     269      break;
     270    default:
     271      fChargedHadronOutputArray->Add(candidate);
     272  }
     273}
  • modules/DenseTrackFilter.h

    r001ee95 r667a02a  
    6969
    7070  const TObjArray *fTrackInputArray; //!
    71 
    7271  TObjArray *fTrackOutputArray; //!
    7372
     73  TObjArray *fChargedHadronOutputArray; //!
     74  TObjArray *fElectronOutputArray; //!
     75  TObjArray *fMuonOutputArray; //!
    7476
    75   const TObjArray *fDenseChargedInputArray;
    76   TIterator *fItDenseChargedInputArray;
    77  
    7877  void FillTrack();
    7978  ClassDef(DenseTrackFilter, 1)
  • modules/ParticlePropagator.cc

    r001ee95 r667a02a  
    124124void ParticlePropagator::Process()
    125125{
    126   Candidate *candidate, *mother;
    127   TLorentzVector candidatePosition, candidateMomentum, beamSpotPosition;
     126  Candidate *candidate, *mother, *particle;
     127  TLorentzVector particlePosition, particleMomentum, beamSpotPosition;
    128128  Double_t px, py, pz, pt, pt2, e, q;
    129129  Double_t x, y, z, t, r, phi;
     
    151151  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
    152152  {
    153     candidatePosition = candidate->Position;
    154     candidateMomentum = candidate->Momentum;
    155     x = candidatePosition.X()*1.0E-3;
    156     y = candidatePosition.Y()*1.0E-3;
    157     z = candidatePosition.Z()*1.0E-3;
     153    if(candidate->GetCandidates()->GetEntriesFast() == 0)
     154    {
     155      particle = candidate;
     156    }
     157    else
     158    {
     159      particle = static_cast<Candidate*>(candidate->GetCandidates()->At(0));
     160    }
     161
     162    particlePosition = particle->Position;
     163    particleMomentum = particle->Momentum;
     164    x = particlePosition.X()*1.0E-3;
     165    y = particlePosition.Y()*1.0E-3;
     166    z = particlePosition.Z()*1.0E-3;
    158167
    159168    bsx = beamSpotPosition.X()*1.0E-3;
     
    161170    bsz = beamSpotPosition.Z()*1.0E-3;
    162171
    163     q = candidate->Charge;
     172    q = particle->Charge;
    164173
    165174    // check that particle position is inside the cylinder
     
    169178    }
    170179
    171     px = candidateMomentum.Px();
    172     py = candidateMomentum.Py();
    173     pz = candidateMomentum.Pz();
    174     pt = candidateMomentum.Pt();
    175     pt2 = candidateMomentum.Perp2();
    176     e = candidateMomentum.E();
     180    px = particleMomentum.Px();
     181    py = particleMomentum.Py();
     182    pz = particleMomentum.Pz();
     183    pt = particleMomentum.Pt();
     184    pt2 = particleMomentum.Perp2();
     185    e = particleMomentum.E();
    177186
    178187    if(pt2 < 1.0E-9)
     
    186195      candidate = static_cast<Candidate*>(candidate->Clone());
    187196
    188       candidate->InitialPosition = candidatePosition;
    189       candidate->Position = candidatePosition;
     197      candidate->InitialPosition = particlePosition;
     198      candidate->Position = particlePosition;
    190199      candidate->L = 0.0;
    191200
    192       candidate->Momentum = candidateMomentum;
     201      candidate->Momentum = particleMomentum;
    193202      candidate->AddCandidate(mother);
    194203
     
    230239      candidate = static_cast<Candidate*>(candidate->Clone());
    231240
    232       candidate->InitialPosition = candidatePosition;
    233       candidate->Position.SetXYZT(x_t*1.0E3, y_t*1.0E3, z_t*1.0E3, candidatePosition.T() + t*e*1.0E3);
     241      candidate->InitialPosition = particlePosition;
     242      candidate->Position.SetXYZT(x_t*1.0E3, y_t*1.0E3, z_t*1.0E3, particlePosition.T() + t*e*1.0E3);
    234243      candidate->L = l*1.0E3;
    235244
    236       candidate->Momentum = candidateMomentum;
     245      candidate->Momentum = particleMomentum;
    237246      candidate->AddCandidate(mother);
    238247
     
    295304      px = TMath::Sign(1.0, r) * pt * (-y_c / r_c);
    296305      py = TMath::Sign(1.0, r) * pt * (x_c / r_c);
    297       etap = candidateMomentum.Eta();
     306      etap = particleMomentum.Eta();
    298307      phip = TMath::ATan2(py, px);
    299308
    300       candidateMomentum.SetPtEtaPhiE(pt, etap, phip, candidateMomentum.E());
     309      particleMomentum.SetPtEtaPhiE(pt, etap, phip, particleMomentum.E());
    301310
    302311      // calculate additional track parameters (correct for beamspot position)
     
    304313      d0        = ((x - bsx) * py - (y - bsy) * px) / pt;
    305314      dz        = z - ((x - bsx) * px + (y - bsy) * py) / pt * (pz / pt);
    306       p         = candidateMomentum.P();
    307       ctgTheta  = 1.0 / TMath::Tan (candidateMomentum.Theta());
     315      p         = particleMomentum.P();
     316      ctgTheta  = 1.0 / TMath::Tan (particleMomentum.Theta());
    308317
    309318
     
    363372
    364373        // store these variables before cloning
    365         candidate->D0 = d0*1.0E3;
    366         candidate->DZ = dz*1.0E3;
    367         candidate->P  = p;
    368         candidate->PT = pt;
    369         candidate->CtgTheta = ctgTheta;
    370         candidate->Phi = phip;
     374        if(particle == candidate)
     375        {
     376          particle->D0 = d0*1.0E3;
     377          particle->DZ = dz*1.0E3;
     378          particle->P = p;
     379          particle->PT = pt;
     380          particle->CtgTheta = ctgTheta;
     381          particle->Phi = phip;
     382        }
    371383
    372384        mother = candidate;
    373385        candidate = static_cast<Candidate*>(candidate->Clone());
    374386
    375         candidate->InitialPosition = candidatePosition;
    376         candidate->Position.SetXYZT(x_t*1.0E3, y_t*1.0E3, z_t*1.0E3, candidatePosition.T() + t*c_light*1.0E3);
    377 
    378         candidate->Momentum = candidateMomentum;
     387        candidate->InitialPosition = particlePosition;
     388        candidate->Position.SetXYZT(x_t*1.0E3, y_t*1.0E3, z_t*1.0E3, particlePosition.T() + t*c_light*1.0E3);
     389
     390        candidate->Momentum = particleMomentum;
    379391
    380392        candidate->L = l*1.0E3;
Note: See TracChangeset for help on using the changeset viewer.