Fork me on GitHub

Changeset 3f8df25 in git for modules


Ignore:
Timestamp:
Jun 4, 2016, 8:07:59 PM (8 years ago)
Author:
Michele Selvaggi <michele.selvaggi@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
3c46e17
Parents:
50edcdbf
Message:

clean module

Location:
modules
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • modules/VertexFinder4D.cc

    r50edcdbf r3f8df25  
    33 *  Cluster vertices from tracks using deterministic annealing and timing information
    44 *
    5  *  \authors M. Selvaggi, L. Grey
     5 *  \authors M. Selvaggi, L. Gray
    66 *
    77 */
     
    3636
    3737namespace {
    38   constexpr double dtCutOff = 4.0;
    39 
    4038  bool recTrackLessZ1(const VertexFinder4D::track_t & tk1,
    4139                      const VertexFinder4D::track_t & tk2)
     
    4947
    5048VertexFinder4D::VertexFinder4D() :
    51   fSigma(0), fMinPT(0), fMaxEta(0), fSeedMinPT(0), fMinNDF(0), fGrowSeeds(0)
     49  fVerbose(0), fMinPT(0), fVertexSpaceSize(0), fVertexTimeSize(0),
     50  fUseTc(0), fBetaMax(0), fBetaStop(0), fCoolingFactor(0),
     51  fMaxIterations(0), fDzCutOff(0), fD0CutOff(0), fDtCutOff(0)
    5252{
    5353}
     
    6565 
    6666  fVerbose = GetBool("Verbose", 1);
    67   fSigma = GetDouble("Sigma", 3.0);
    6867  fMinPT = GetDouble("MinPT", 0.1);
    69   fMaxEta = GetDouble("MaxEta", 10.0);
    70   fSeedMinPT = GetDouble("SeedMinPT", 5.0);
    71   fMinNDF = GetInt("MinNDF", 4);
    72   fGrowSeeds = GetInt("GrowSeeds", 1);
    73 
    74   // setting everything in cm to be able to compare easily with Lindsey code
    75   useTc_=true;
    76   betamax_=0.1;
    77   betastop_  =1.0;
    78   coolingFactor_=0.8;
    79   maxIterations_=100;
    80   vertexSize_=0.05;  // 0.5 mm
    81   dzCutOff_=4.0;   // Adaptive Fitter uses 3.0 but that appears to be a bit tight here sometimes
    82   d0CutOff_=3.0;
    83  
     68  fVertexSpaceSize = GetDouble("VertexSpaceSize", 0.5); //in mm
     69  fVertexTimeSize = GetDouble("VertexTimeSize", 10E-12); //in s
     70  fUseTc         = GetBool("UseTc", 1);
     71  fBetaMax       = GetDouble("BetaMax ", 0.1);
     72  fBetaStop      = GetDouble("BetaStop", 1.0);
     73  fCoolingFactor = GetDouble("CoolingFactor", 0.8);
     74  fMaxIterations = GetInt("MaxIterations", 100);
     75  fDzCutOff      = GetDouble("DzCutOff", 40);  // Adaptive Fitter uses 30 mm but that appears to be a bit tight here sometimes
     76  fD0CutOff      = GetDouble("D0CutOff", 30);
     77  fDtCutOff      = GetDouble("DtCutOff", 100E-12);  // dummy
     78 
     79  // convert stuff in cm, ns
     80  fVertexSpaceSize /= 10.0; 
     81  fVertexTimeSize *= 1E9; 
     82  fDzCutOff       /= 10.0;   // Adaptive Fitter uses 3.0 but that appears to be a bit tight here sometimes
     83  fD0CutOff       /= 10.0;
     84 
    8485  fInputArray = ImportArray(GetString("InputArray", "TrackSmearing/tracks"));
    8586  fItInputArray = fInputArray->MakeIterator();
     
    105106  TIterator *ItClusterArray;
    106107  Int_t ivtx = 0;
    107 
     108 
     109  fInputArray->Sort();
     110 
     111  TLorentzVector pos, mom;
     112  if (fVerbose)
     113  {
     114     cout<<" start processing vertices ..."<<endl;
     115     cout<<" Found "<<fInputArray->GetEntriesFast()<<" input tracks"<<endl;
     116     //loop over input tracks
     117     fItInputArray->Reset();
     118     while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
     119     { 
     120        pos = candidate->InitialPosition;
     121        mom = candidate->Momentum;
     122       
     123        cout<<"pt: "<<mom.Pt()<<", eta: "<<mom.Eta()<<", phi: "<<mom.Phi()<<", z: "<<candidate->DZ/10<<endl;
     124     }
     125  }   
     126     
    108127  // clusterize tracks in Z
    109128  clusterize(*fInputArray, *ClusterArray);
    110129 
    111130  if (fVerbose){std::cout <<  " clustering returned  "<< ClusterArray->GetEntriesFast() << " clusters  from " << fInputArray->GetEntriesFast() << " selected tracks" <<std::endl;}
    112 
    113  
     131 
    114132  //loop over vertex candidates
    115133  ItClusterArray = ClusterArray->MakeIterator();
     
    117135  while((candidate = static_cast<Candidate*>(ItClusterArray->Next())))
    118136  {
     137 
    119138     double meantime = 0.;
    120139     double expv_x2 = 0.;
     
    131150     int itr = 0;
    132151     
     152     if(fVerbose)cout<<"this vertex has: "<<candidate->GetCandidates()->GetEntriesFast()<<" tracks"<<endl;
     153     
    133154     // loop over tracks belonging to this vertex
    134155     TIter it1(candidate->GetCandidates());
    135156     it1.Reset();
     157     
    136158     while((track = static_cast<Candidate*>(it1.Next())))
    137159     {
     
    139161        itr++;
    140162        // TBC: the time is in ns for now TBC
    141         double t = track->Position.T()/c_light;
    142         double l = track->L/c_light;
     163        double t = track->InitialPosition.T()/c_light;
    143164        double dt = track->ErrorT/c_light;
    144        
    145         const double time = t-l;
     165        const double time = t;
    146166        const double inverr = 1.0/dt;
    147167        meantime += time*inverr;
     
    151171        // compute error position TBC
    152172        const double pt = track->Momentum.Pt();
    153         const double z = track->DZ;
     173        const double z = track->DZ/10.0;
    154174        const double err_pt = track->ErrorPT;
    155175        const double err_z = track->ErrorDZ;
     
    163183     
    164184        // while we are here store cluster index in tracks
    165         track->ClusterIndex = ivtx;
    166      
     185        track->ClusterIndex = ivtx; 
    167186     }
    168      
    169187     
    170188     meantime = meantime/normw;
     
    182200     candidate->ClusterIndex = ivtx;
    183201
     202     fVertexOutputArray->Add(candidate);
     203     
    184204     ivtx++;
    185205 
     
    189209       std::cout << "=" << candidate->Position.X()/10.0 <<" " << candidate->Position.Y()/10.0 << " " <<  candidate->Position.Z()/10.0;
    190210       std::cout << " " << candidate->Position.T()/c_light;
     211       
    191212       std::cout << std::endl;
     213       std::cout << "sumpt2 " << candidate->SumPT2<<endl;
    192214     }
    193215   }// end of cluster loop
     
    195217   
    196218    if(fVerbose){
    197       std::cout << "PrimaryVertexProducerAlgorithm::vertices  candidates =" << ClusterArray->GetEntriesFast() << std::endl;
     219      std::cout << "PrimaryVertexProducerAlgorithm::vertices candidates =" << ClusterArray->GetEntriesFast() << std::endl;
    198220    }
    199221
     
    219241    cout << "###################################################" << endl;
    220242  }
    221 
    222   Candidate *candidate;
    223  
    224   vector< Candidate > pv=vertices(tracks);
    225 
    226   cout<<"test"<<endl;
     243 
     244  vector< Candidate* > pv = vertices();
     245
    227246  if(fVerbose){ cout << "# VertexFinder4D::clusterize   pv.size="<<pv.size() << endl;  }
    228247  if (pv.size()==0){ return;  }
     
    231250  //TObjArray *ClusterArray = pv.begin()->GetCandidates();
    232251  //Candidate *aCluster = static_cast<Candidate*>(&(pv.at(0)));
    233    Candidate *aCluster = &(pv.at(0));
     252   Candidate *aCluster = pv.at(0);
    234253   
    235254  // fill into clusters and merge
     
    238257  if( fVerbose ) {
    239258      std::cout << '\t' << 0;
    240       std::cout << ' ' << pv.begin()->Position.Z()/10.0 << ' ' << pv.begin()->Position.T()/c_light << std::endl;
    241     }
    242 
    243   for(vector<Candidate>::iterator k=pv.begin()+1; k!=pv.end(); k++){
     259      std::cout << ' ' << (*pv.begin())->Position.Z()/10.0 << ' ' << (*pv.begin())->Position.T()/c_light << std::endl;
     260    }
     261
     262  for(vector<Candidate*>::iterator k=pv.begin()+1; k!=pv.end(); k++){
    244263    if( fVerbose ) {
    245264      std::cout << '\t' << std::distance(pv.begin(),k);
    246       std::cout << ' ' << k->Position.Z() << ' ' << k->Position.T() << std::endl;
     265      std::cout << ' ' << (*k)->Position.Z() << ' ' << (*k)->Position.T() << std::endl;
    247266    }
    248267   
    249268   
    250269    // TBC - check units here
    251     if ( std::abs(k->Position.Z() - (k-1)->Position.Z())/10.0 > (2*vertexSize_) ||
    252          std::abs(k->Position.T() - (k-1)->Position.Z())/c_light > 2*0.010 ) {
     270    if ( std::abs((*k)->Position.Z() - (*(k-1))->Position.Z())/10.0 > (2*fVertexSpaceSize) ||
     271         std::abs((*k)->Position.T() - (*(k-1))->Position.Z())/c_light > 2*0.010 ) {
    253272      // close a cluster
    254273      clusters.Add(aCluster);
     
    256275    }
    257276    //for(unsigned int i=0; i<k->GetCandidates().GetEntriesFast(); i++){
    258       aCluster = &*k;
     277      aCluster = *k;
    259278    //}
    260279   
     
    269288//------------------------------------------------------------------------------
    270289
    271 vector< Candidate >
    272 VertexFinder4D::vertices(const TObjArray & tracks, const int verbosity)
     290vector< Candidate* > VertexFinder4D::vertices()
    273291{
    274292  Candidate *candidate;
    275293  UInt_t clusterIndex = 0;
    276   vector< Candidate > clusters;
    277  
    278   vector<track_t> tks=fill(tracks);
     294  vector< Candidate* > clusters;
     295 
     296  vector<track_t> tks = fill();
     297   
     298  //print out input tracks
     299   
     300  if(fVerbose)
     301  {
     302    std::cout<<" start processing vertices ..."<<std::endl;
     303    std::cout<<" Found "<<tks.size()<<" input tracks"<<std::endl;
     304    //loop over input tracks
     305 
     306   
     307   for(std::vector<track_t>::const_iterator it=tks.begin(); it!=tks.end(); it++){
     308     double z = it->z;
     309     double pt=it->pt;
     310     double eta=it->eta;
     311     double phi=it->phi;
     312     double t = it->t;
     313
     314     std::cout<<"pt: "<<pt<<", eta: "<<eta<<", phi: "<<phi<<", z: "<<z<<", t: "<<t<<std::endl;
     315   }
     316  }
    279317   
    280318  unsigned int nt=tks.size();
     
    294332 
    295333  // estimate first critical temperature
    296   double beta=beta0(betamax_, tks, y);
    297   niter=0; while((update(beta, tks,y)>1.e-6)  && (niter++ < maxIterations_)){ }
     334  double beta=beta0(fBetaMax, tks, y);
     335  niter=0; while((update(beta, tks,y)>1.e-6)  && (niter++ < fMaxIterations)){ }
    298336
    299337  // annealing loop, stop when T<Tmin  (i.e. beta>1/Tmin)
    300   while(beta<betamax_){
    301 
    302     if(useTc_){
     338  while(beta<fBetaMax){
     339
     340    if(fUseTc){
    303341      update(beta, tks,y);
    304342      while(merge(y,beta)){update(beta, tks,y);}
    305       split(beta, tks,y, 1.);
    306       beta=beta/coolingFactor_;
     343      split(beta, tks,y);
     344      beta=beta/fCoolingFactor;
    307345    }else{
    308       beta=beta/coolingFactor_;
     346      beta=beta/fCoolingFactor;
    309347      splitAll(y);
    310348    }
    311349
    312 
    313350   // make sure we are not too far from equilibrium before cooling further
    314    niter=0; while((update(beta, tks,y)>1.e-6)  && (niter++ < maxIterations_)){ }
    315 
    316   }
    317 
    318   if(useTc_){
     351   niter=0; while((update(beta, tks,y)>1.e-6)  && (niter++ < fMaxIterations)){ }
     352
     353  }
     354
     355  if(fUseTc){
    319356    // last round of splitting, make sure no critical clusters are left
    320357    update(beta, tks,y);
    321358    while(merge(y,beta)){update(beta, tks,y);}
    322359    unsigned int ntry=0;
    323     while( split(beta, tks,y,1.) && (ntry++<10) ){
     360    while( split(beta, tks,y) && (ntry++<10) ){
    324361      niter=0;
    325       while((update(beta, tks,y)>1.e-6)  && (niter++ < maxIterations_)){}
     362      while((update(beta, tks,y)>1.e-6)  && (niter++ < fMaxIterations)){}
    326363      merge(y,beta);
    327364      update(beta, tks,y);
     
    330367    // merge collapsed clusters
    331368    while(merge(y,beta)){update(beta, tks,y);} 
    332     if(fVerbose ){ cout << "dump after 1st merging " << endl;  dump(beta,y,tks,2);}
     369    if(fVerbose ){ cout << "dump after 1st merging " << endl;  dump(beta,y,tks);}
    333370  }
    334371 
    335372  // switch on outlier rejection
    336373  rho0=1./nt; for(vector<vertex_t>::iterator k=y.begin(); k!=y.end(); k++){ k->pk =1.; }  // democratic
    337   niter=0; while((update(beta, tks,y,rho0) > 1.e-8)  && (niter++ < maxIterations_)){  }
    338   if(fVerbose  ){ cout << "rho0=" << rho0 <<   " niter=" << niter <<  endl; dump(beta,y,tks,2);}
     374  niter=0; while((update(beta, tks,y,rho0) > 1.e-8)  && (niter++ < fMaxIterations)){  }
     375  if(fVerbose  ){ cout << "rho0=" << rho0 <<   " niter=" << niter <<  endl; dump(beta,y,tks);}
    339376
    340377 
    341378  // merge again  (some cluster split by outliers collapse here)
    342   while(merge(y,tks.size())){} 
    343   if(fVerbose  ){ cout << "dump after 2nd merging " << endl;  dump(beta,y,tks,2);}
     379  while(merge(y)){} 
     380  if(fVerbose  ){ cout << "dump after 2nd merging " << endl;  dump(beta,y,tks);}
    344381
    345382
    346383  // continue from freeze-out to Tstop (=1) without splitting, eliminate insignificant vertices
    347   while(beta<=betastop_){
     384  while(beta<=fBetaStop){
    348385    while(purge(y,tks,rho0, beta)){
    349       niter=0; while((update(beta, tks, y, rho0) > 1.e-6)  && (niter++ < maxIterations_)){  }
     386      niter=0; while((update(beta, tks, y, rho0) > 1.e-6)  && (niter++ < fMaxIterations)){  }
    350387    }
    351     beta/=coolingFactor_;
    352     niter=0; while((update(beta, tks, y, rho0) > 1.e-6)  && (niter++ < maxIterations_)){  }
     388    beta/=fCoolingFactor;
     389    niter=0; while((update(beta, tks, y, rho0) > 1.e-6)  && (niter++ < fMaxIterations)){  }
    353390  }
    354391
     
    356393//   // new, one last round of cleaning at T=Tstop
    357394//   while(purge(y,tks,rho0, beta)){
    358 //     niter=0; while((update(beta, tks,y,rho0) > 1.e-6)  && (niter++ < maxIterations_)){  }
     395//     niter=0; while((update(beta, tks,y,rho0) > 1.e-6)  && (niter++ < fMaxIterations)){  }
    359396//   }
    360397
     
    362399  if(fVerbose){
    363400   cout << "Final result, rho0=" << rho0 << endl;
    364    dump(beta,y,tks,2);
     401   dump(beta,y,tks);
    365402  }
    366403
     
    371408  // ensure correct normalization of probabilities, should make double assginment reasonably impossible
    372409  for(unsigned int i=0; i<nt; i++){ 
    373     tks[i].Z=rho0*exp(-beta*( dzCutOff_*dzCutOff_));
     410    tks[i].Z=rho0*exp(-beta*( fDzCutOff*fDzCutOff));
    374411    for(vector<vertex_t>::iterator k=y.begin(); k!=y.end(); k++){
    375412      tks[i].Z += k->pk * exp(-beta*Eik(tks[i],*k));
     
    420457   
    421458    candidate->ClusterIndex = clusterIndex++;;
    422     //candidate->ClusterNDF = 5;
    423     //candidate->ClusterSigma = fSigma;
    424     //candidate->SumPT2 = cluster->second;
    425    
    426     // TBC units - set everything back in mm
    427    
    428     //cout<<z<<","<<time<<endl;
    429    
    430459    candidate->Position.SetXYZT(0.0, 0.0, z*10.0 , time*c_light);
    431460   
     
    433462    candidate->PositionError.SetXYZT(0.0, 0.0, 0.0 , crappy_error_guess*c_light);
    434463
    435     //fVertexOutputArray->Add(candidate);
    436 
    437464    clusterIndex++;   
    438     clusters.push_back(*candidate);
     465    clusters.push_back(candidate);
    439466  }
    440467 
     
    447474
    448475vector<VertexFinder4D::track_t>
    449 VertexFinder4D::fill( const TObjArray & tracks )const{
     476VertexFinder4D::fill()const{
    450477 
    451478  Candidate *candidate;
     
    453480  Double_t z, dz, t, l, dt, d0, d0error;
    454481 
    455  
    456482  // prepare track data for clustering
    457483  vector< track_t > tks;
     
    459485  // loop over input tracks
    460486  fItInputArray->Reset();
    461   cout<<"new fill"<<endl;
    462487  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
    463488  {
    464      cout<<"new track"<<endl;
    465489     //TBC everything in cm
    466490     z = candidate->DZ/10;
     
    470494   // TBC: beamspot size induced error, take 0 for now.       
    471495   //   + (std::pow(beamspot.BeamWidthX()*cos(phi),2.)+std::pow(beamspot.BeamWidthY()*sin(phi),2.))/std::pow(tantheta,2.) // beam-width induced
    472       + vertexSize_*vertexSize_;                     // intrinsic vertex size, safer for outliers and short lived decays
    473    
    474     // TBC: the time is in ns for now TBC
    475      t = candidate->Position.T()/c_light;
     496      + fVertexSpaceSize*fVertexSpaceSize;                     // intrinsic vertex size, safer for outliers and short lived decays
     497   
     498     // TBC: the time is in ns for now TBC
     499     //t = candidate->Position.T()/c_light;
     500     t = candidate->InitialPosition.T()/c_light;
    476501     l = candidate->L/c_light;
    477502     
    478      tr.t = (t-l); //
     503     double pt = candidate->Momentum.Pt();
     504     double eta = candidate->Momentum.Eta();
     505     double phi = candidate->Momentum.Phi();
     506
     507     tr.pt = pt;
     508     tr.eta = eta;
     509     tr.phi = phi;
     510     tr.t = t; //
    479511     tr.dtz = 0.;
    480512     dt = candidate->ErrorT/c_light;
    481      tr.dt2 = dt*dt + 0.010*0.010;   // the ~injected~ timing error, need to add a small minimum vertex size in time
    482      //cout<<"t error: "<<dt<<endl;
    483     if (d0CutOff_>0){
    484    
    485       d0 = TMath::Abs(candidate->D0)/10.0;
    486       d0error = candidate->ErrorD0/10.0;
     513     tr.dt2 = dt*dt + fVertexTimeSize*fVertexTimeSize;   // the ~injected~ timing error plus a small minimum vertex size in time
     514     if (fD0CutOff>0){
     515   
     516     d0 = TMath::Abs(candidate->D0)/10.0;
     517     d0error = candidate->ErrorD0/10.0;
    487518     
    488       tr.pi=1./(1.+exp((d0*d0)/(d0error*d0error) - d0CutOff_*d0CutOff_));  // reduce weight for high ip tracks 
    489      // cout<<"IP: "<<d0<<endl;
    490      // cout<<"IP error: "<<d0error<<endl;
    491    
    492     }else{
     519     tr.pi=1./(1.+exp((d0*d0)/(d0error*d0error) - fD0CutOff*fD0CutOff));  // reduce weight for high ip tracks 
     520     
     521    }
     522    else{
    493523      tr.pi=1.;
    494524    }
    495525    tr.tt=&(*candidate);   
    496526    tr.Z=1.;
    497     if( tr.pi > 1e-3 ) {
     527 
     528    // TBC now putting track selection here (> fPTMin)
     529    if( tr.pi > 1e-3 && tr.pt > fMinPT) {
    498530      tks.push_back(tr);
    499531    }
    500  
    501    cout<<"dz2: "<<tr.dz2<<endl;
    502    cout<<"t: "<<tr.t<<endl;
    503    cout<<"z: "<<tr.z<<endl;
    504    cout<<"dt2: "<<tr.dt2<<endl;
    505    cout<<"pi: "<<tr.pi<<endl;
    506 
    507  
    508532 
    509533  }
     
    523547//-------------------------------------------------------------------------------- 
    524548
    525 void VertexFinder4D::dump(const double beta, const vector<vertex_t> & y, const vector<track_t> & tks0, int verbosity)const{
     549void VertexFinder4D::dump(const double beta, const vector<vertex_t> & y, const vector<track_t> & tks0)const{
    526550
    527551  // copy and sort for nicer printout
     
    531555
    532556  cout << "-----DAClusterizerInZT::dump ----" << endl;
    533   cout << " beta=" << beta << "   betamax= " << betamax_ << endl;
     557  cout << " beta=" << beta << "   betamax= " << fBetaMax << endl;
    534558  cout << "                                                               z= ";
    535559  cout.precision(4);
     
    554578  cout  << endl;
    555579
    556   if(verbosity>0){
     580  if(fVerbose){
    557581    double E=0, F=0;
    558582    cout << endl;
     
    566590           << setw(8) << fixed << setprecision(4) << tt << " +/-" << setw(6) << std::sqrt(tks[i].dt2)  ;
    567591     
    568      
    569       // TBC - see later if we want to keep these print outs
    570       /*
    571       if(tks[i].tt->track().quality(reco::TrackBase::highPurity)){ cout << " *";}else{cout <<"  ";}
    572       if(tks[i].tt->track().hitPattern().hasValidHitInFirstPixelBarrel()){cout <<"+";}else{cout << "-";}
    573      
    574       cout << setw(1) << tks[i].tt->track().hitPattern().pixelBarrelLayersWithMeasurement(); // see DataFormats/TrackReco/interface/HitPattern.h
    575       cout << setw(1) << tks[i].tt->track().hitPattern().pixelEndcapLayersWithMeasurement();
    576       cout << setw(1) << hex << tks[i].tt->track().hitPattern().trackerLayersWithMeasurement()-tks[i].tt->track().hitPattern().pixelLayersWithMeasurement() <<dec;
    577       cout << "=" << setw(1)<<hex <<tks[i].tt->track().trackerExpectedHitsOuter().numberOfHits() << dec;
    578 
    579       Measurement1D IP=tks[i].tt->stateAtBeamLine().transverseImpactParameter();
    580       cout << setw (8) << IP.value() << "+/-" << setw (6) << IP.error();
    581       cout << " " << setw(6) << setprecision(2)  << tks[i].tt->track().pt()*tks[i].tt->track().charge();
    582       cout << " " << setw(5) << setprecision(2) << tks[i].tt->track().phi()
    583            << " "  << setw(5)  << setprecision(2)   << tks[i].tt->track().eta() ;
    584       */
    585592      double sump=0.;
    586593      for(vector<vertex_t>::const_iterator k=y.begin(); k!=y.end(); k++){
     
    704711
    705712    // update pik and Zi and Ti
    706     double Zi = rho0*std::exp(-beta*(dzCutOff_*dzCutOff_));// cut-off (eventually add finite size in time)
    707     //double Ti = 0.; // dt0*std::exp(-beta*dtCutOff_);
     713    double Zi = rho0*std::exp(-beta*(fDzCutOff*fDzCutOff));// cut-off (eventually add finite size in time)
     714    //double Ti = 0.; // dt0*std::exp(-beta*fDtCutOff);
    708715    for(vector<vertex_t>::iterator k=y.begin(); k!=y.end(); k++){
    709716      k->ei = std::exp(-beta*Eik(tks[i],*k));// cache exponential for one track at a time
     
    725732    }
    726733
    727 
    728734  } // end of track loop
    729 
    730735
    731736  // now update z
     
    752757//------------------------------------------------------------------------------
    753758
    754 bool VertexFinder4D::merge(vector<vertex_t> & y, int nt)const{
     759bool VertexFinder4D::merge(vector<vertex_t> & y)const{
    755760  // merge clusters that collapsed or never separated, return true if vertices were merged, false otherwise
    756761 
     
    827832    int nUnique=0;
    828833    double sump=0;
    829     double pmax=k->pk/(k->pk+rho0*exp(-beta*dzCutOff_*dzCutOff_));
     834    double pmax=k->pk/(k->pk+rho0*exp(-beta*fDzCutOff*fDzCutOff));
    830835    for(unsigned int i=0; i<nt; i++){
    831836      if(tks[i].Z > 0){
     
    892897 
    893898  if (T0>1./betamax){
    894     return betamax/pow(coolingFactor_, int(std::log(T0*betamax)/std::log(coolingFactor_))-1 );
     899    return betamax/pow(fCoolingFactor, int(std::log(T0*betamax)/std::log(fCoolingFactor))-1 );
    895900  }else{
    896901    // ensure at least one annealing step
    897     return betamax/coolingFactor_;
     902    return betamax/fCoolingFactor;
    898903  }
    899904}
     
    903908bool VertexFinder4D::split( double beta,
    904909                               vector<track_t> & tks,
    905                                vector<vertex_t> & y,
    906                                double threshold ) const {
     910                               vector<vertex_t> & y) const {
    907911  // split only critical vertices (Tc >~ T=1/beta   <==>   beta*Tc>~1)
    908912  // an update must have been made just before doing this (same beta, no merging)
  • modules/VertexFinder4D.h

    r50edcdbf r3f8df25  
    66 *  Cluster vertices from tracks using deterministic annealing and timing information
    77 *
    8  *  \authors M. Selvaggi
     8 *  \authors M. Selvaggi, L. Gray
    99 *
    1010 */
     
    4848  double Z;              // Z[i]   for DA clustering
    4949  double pi;             // track weight
     50  double pt;
     51  double eta;
     52  double phi;
     53
    5054};
    5155
     
    7074  void clusterize(const TObjArray & tracks, TObjArray & clusters);
    7175
    72   std::vector< Candidate >
    73     vertices(const TObjArray & tracks, const int verbosity=0);
     76  std::vector< Candidate* > vertices();
    7477
    75   std::vector<track_t> fill(const TObjArray & tracks)const;
     78  std::vector<track_t> fill() const;
    7679
    7780  bool split( double beta,
    7881             std::vector<track_t> & tks,
    79              std::vector<vertex_t> & y,
    80              double threshold ) const;
     82             std::vector<vertex_t> & y) const;
    8183
    8284  double update( double beta,
     
    8991               double & )const;
    9092
    91   void dump(const double beta, const std::vector<vertex_t> & y, const std::vector<track_t> & tks, const int verbosity=0) const;
    92   bool merge(std::vector<vertex_t> &,int ) const;
     93  void dump(const double beta, const std::vector<vertex_t> & y, const std::vector<track_t> & tks) const;
     94  bool merge(std::vector<vertex_t> &) const;
    9395  bool merge(std::vector<vertex_t> &,double & ) const;
    9496  bool purge(std::vector<vertex_t> &, std::vector<track_t> & , double &, const double ) const;
     
    105107private:
    106108
    107   Double_t fSigma;
     109  Bool_t fVerbose;
    108110  Double_t fMinPT;
    109   Double_t fMaxEta;
    110   Double_t fSeedMinPT;
    111   Int_t fMinNDF;
    112   Int_t fGrowSeeds;
    113   Bool_t fVerbose;
    114 
    115   bool useTc_;
    116   float vertexSize_;
    117   int maxIterations_;
    118   double coolingFactor_;
    119   float betamax_;
    120   float betastop_;
    121   double dzCutOff_;
    122   double d0CutOff_;
    123   double dtCutOff_; // for when the beamspot has time
     111 
     112  Float_t fVertexSpaceSize;
     113  Float_t fVertexTimeSize;
     114  Bool_t fUseTc;
     115  Float_t fBetaMax;
     116  Float_t fBetaStop;
     117  Double_t fCoolingFactor;
     118  Int_t fMaxIterations;
     119  Double_t fDzCutOff;
     120  Double_t fD0CutOff;
     121  Double_t fDtCutOff; // for when the beamspot has time
    124122
    125123  TObjArray *fInputArray;
Note: See TracChangeset for help on using the changeset viewer.