Fork me on GitHub

Changeset 4170544 in git for modules


Ignore:
Timestamp:
Dec 7, 2017, 1:55:15 AM (7 years ago)
Author:
Michele Selvaggi (michele.selvaggi@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
0c5bf12
Parents:
fce5dd5
Message:

fixed missing last tower

Location:
modules
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • modules/DenseTrackFilter.cc

    rfce5dd5 r4170544  
    111111
    112112  // Eta x Phi smearing to be applied
    113   fEtaPhiRes = GetDouble("EtaPhiRes", 0.005);
    114 
    115   fTrackInputArray = ImportArray(GetString("TrackInputArray", "TrackMerger/tracks"));
     113  fEtaPhiRes = GetDouble("EtaPhiRes", 0.003);
     114
     115  fTrackInputArray = ImportArray(GetString("TrackInputArray", "TrackMergerProp/tracks"));
    116116  fItTrackInputArray = fTrackInputArray->MakeIterator();
    117117
     
    139139void DenseTrackFilter::Process()
    140140{
    141   Candidate *candidate, *track, *bestTrack, *mother, *trackRef, *bestTrackRef;
     141  Candidate *track;
    142142  TLorentzVector position, momentum;
    143143  Short_t etaBin, phiBin, flags;
    144   Int_t number, towerTrackHits;
     144  Int_t number;
    145145  Long64_t towerHit, towerEtaPhi, hitEtaPhi;
    146 
    147   Double_t pt, ptmax, eta, phi;
    148   Bool_t matched;
     146  Double_t ptmax;
    149147
    150148  vector< Double_t >::iterator itEtaBin;
     
    191189  // loop over all hits
    192190  towerEtaPhi = 0;
    193   bestTrack = 0;
    194   fTower = 0;
     191  fBestTrack = 0;
    195192  ptmax = 0.0;
    196   towerTrackHits = 0;
     193  fTowerTrackHits = 0;
    197194
    198195  for(itTowerHits = fTowerHits.begin(); itTowerHits != fTowerHits.end(); ++itTowerHits)
     
    202199    number = (towerHit) & 0x0000000000FFFFFFLL;
    203200    hitEtaPhi = towerHit >> 32;
     201
    204202    if(towerEtaPhi != hitEtaPhi)
    205203    {
    206204      // switch to next tower
    207205      towerEtaPhi = hitEtaPhi;
    208       
     206     
    209207      // saving track with highest pT that hit the tower
    210       if(towerTrackHits > 0)
    211       {
    212          bestTrackRef = static_cast<Candidate*>(bestTrack->GetCandidates()->At(0));
    213          
    214          // find corresponding track in properly propagated tracks
    215          
    216          
    217          fItTrackInputArray->Reset();
    218          matched = kFALSE;
    219          int ntrack = 0;
    220          while((track = static_cast<Candidate*>(fItTrackInputArray->Next())))
    221          {
    222            ntrack++;
    223            trackRef = static_cast<Candidate*>(track->GetCandidates()->At(0));
    224            if (trackRef->GetUniqueID() == bestTrackRef->GetUniqueID())
    225            {
    226              mother = track;
    227              candidate = static_cast<Candidate*>(track->Clone());
    228              pt = candidate->Momentum.Pt();
    229              eta = candidate->Momentum.Eta();
    230              phi = candidate->Momentum.Phi();
    231              eta = gRandom->Gaus(eta, fEtaPhiRes);
    232              phi = gRandom->Gaus(phi, fEtaPhiRes);
    233              candidate->Momentum.SetPtEtaPhiE(pt, eta, phi, pt*TMath::CosH(eta));
    234              candidate->AddCandidate(mother);
    235              fTrackOutputArray->Add(candidate);
    236              matched = kTRUE;
    237            }
    238            if (matched) break;
    239          }
    240          
    241          // find track
    242       }
     208      FillTrack();
    243209
    244210      ptmax = 0.0;
    245       towerTrackHits = 0;
    246       bestTrack = 0;
     211      fTowerTrackHits = 0;
     212      fBestTrack = 0;
    247213    }
    248214    // check for track hits
     
    250216    if(flags & 1)
    251217    {
    252       ++towerTrackHits;
     218      ++fTowerTrackHits;
    253219      track = static_cast<Candidate*>(fDenseChargedInputArray->At(number));
    254220      momentum = track->Momentum;
     
    256222      if (momentum.Pt() > ptmax)
    257223      {
    258         ptmax = momentum.Pt();
    259         bestTrack = track;
     224        ptmax = momentum.Pt();
     225        fBestTrack = track;
    260226      }
    261227      continue;
    262228    }
    263   }
    264  
    265 }
     229 
     230  }
     231 
     232  // here fill last tower
     233  FillTrack();
     234 
     235}
     236
     237
     238
     239//------------------------------------------------------------------------------
     240
     241void DenseTrackFilter::FillTrack()
     242{
     243 
     244  Candidate *candidate, *track, *mother, *trackRef, *bestTrackRef;
     245  Double_t pt, eta, phi;
     246  Bool_t matched;
     247 
     248  // 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}
  • modules/DenseTrackFilter.h

    rfce5dd5 r4170544  
    5353  typedef std::map< Double_t, std::set< Double_t > > TBinMap; //!
    5454
    55   Candidate *fTower;
     55  Candidate *fBestTrack;
     56
     57  Int_t fTowerTrackHits;
    5658
    5759  Double_t fEtaPhiRes;
     
    7375  const TObjArray *fDenseChargedInputArray;
    7476  TIterator *fItDenseChargedInputArray;
    75 
     77 
     78  void FillTrack();
    7679  ClassDef(DenseTrackFilter, 1)
    7780};
Note: See TracChangeset for help on using the changeset viewer.