Fork me on GitHub

Changeset a26a130 in git for classes


Ignore:
Timestamp:
Jun 1, 2021, 11:39:05 PM (3 years ago)
Author:
Pavel Demin <pavel.demin@…>
Branches:
master
Children:
90132e0
Parents:
90345e5
Message:

move arrays to FinalizeParticles in DelphesHepMC3Reader

Location:
classes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • classes/DelphesHepMC3Reader.cc

    r90345e5 ra26a130  
    326326    }
    327327
    328     AnalyzeParticle(factory, allParticleOutputArray,
    329       stableParticleOutputArray, partonOutputArray);
     328    AnalyzeParticle(factory);
    330329  }
    331330
    332331  if(EventReady())
    333332  {
    334     FinalizeParticles(allParticleOutputArray);
     333    FinalizeParticles(allParticleOutputArray, stableParticleOutputArray, partonOutputArray);
    335334  }
    336335
     
    374373{
    375374  Weight *element;
    376   vector<double>::const_iterator itWeight;
    377 
    378   for(itWeight = fWeights.begin(); itWeight != fWeights.end(); ++itWeight)
     375  vector<double>::const_iterator itWeights;
     376
     377  for(itWeights = fWeights.begin(); itWeights != fWeights.end(); ++itWeights)
    379378  {
    380379    element = static_cast<Weight *>(branch->NewEntry());
    381380
    382     element->Weight = *itWeight;
     381    element->Weight = *itWeights;
    383382  }
    384383}
     
    406405    array = factory->NewArray();
    407406    position->SetXYZT(0.0, 0.0, 0.0, 0.0);
    408     array->Clear();
    409407    fVertices.push_back(make_pair(position, array));
    410408  }
     
    432430//---------------------------------------------------------------------------
    433431
    434 void DelphesHepMC3Reader::AnalyzeParticle(DelphesFactory *factory,
    435   TObjArray *allParticleOutputArray,
     432void DelphesHepMC3Reader::AnalyzeParticle(DelphesFactory *factory)
     433{
     434  Candidate *candidate;
     435
     436  candidate = factory->NewCandidate();
     437
     438  candidate->PID = fPID;
     439
     440  candidate->Status = fParticleStatus;
     441
     442  candidate->Mass = fMass;
     443
     444  candidate->Momentum.SetPxPyPzE(fPx, fPy, fPz, fE);
     445
     446  candidate->D1 = fParticleCode;
     447
     448  AnalyzeVertex(factory, fOutVertexCode, candidate);
     449}
     450
     451//---------------------------------------------------------------------------
     452
     453void DelphesHepMC3Reader::FinalizeParticles(TObjArray *allParticleOutputArray,
    436454  TObjArray *stableParticleOutputArray,
    437455  TObjArray *partonOutputArray)
    438456{
     457  TLorentzVector *position;
     458  TObjArray *array;
    439459  Candidate *candidate;
    440460  TParticlePDG *pdgParticle;
    441461  int pdgCode;
    442 
    443   candidate = factory->NewCandidate();
    444 
    445   candidate->PID = fPID;
    446   pdgCode = TMath::Abs(candidate->PID);
    447 
    448   candidate->Status = fParticleStatus;
    449 
    450   pdgParticle = fPDG->GetParticle(fPID);
    451   candidate->Charge = pdgParticle ? int(pdgParticle->Charge() / 3.0) : -999;
    452   candidate->Mass = fMass;
    453 
    454   candidate->Momentum.SetPxPyPzE(fPx, fPy, fPz, fE);
    455   if(fMomentumCoefficient != 1.0)
    456   {
    457     candidate->Momentum *= fMomentumCoefficient;
    458   }
    459 
    460   candidate->D1 = fParticleCode;
    461 
    462   AnalyzeVertex(factory, fOutVertexCode, candidate);
    463 
    464   if(!pdgParticle) return;
    465 
    466   if(fParticleStatus == 1)
    467   {
    468     stableParticleOutputArray->Add(candidate);
    469   }
    470   else if(pdgCode <= 5 || pdgCode == 21 || pdgCode == 15)
    471   {
    472     partonOutputArray->Add(candidate);
    473   }
    474 }
    475 
    476 //---------------------------------------------------------------------------
    477 
    478 void DelphesHepMC3Reader::FinalizeParticles(TObjArray *allParticleOutputArray)
    479 {
    480   TLorentzVector *position;
    481   TObjArray *array;
    482   Candidate *candidate;
    483462  map<int, int >::iterator itVertexMap;
    484463  map<int, pair<int, int> >::iterator itMotherMap;
     
    500479      {
    501480        candidate->Position *= fPositionCoefficient;
     481      }
     482
     483      if(fMomentumCoefficient != 1.0)
     484      {
     485        candidate->Momentum *= fMomentumCoefficient;
    502486      }
    503487
     
    541525
    542526      ++counter;
     527
     528      pdgParticle = fPDG->GetParticle(candidate->PID);
     529
     530      candidate->Charge = pdgParticle ? int(pdgParticle->Charge() / 3.0) : -999;
     531
     532      if(!pdgParticle) continue;
     533
     534      pdgCode = TMath::Abs(candidate->PID);
     535
     536      if(candidate->Status == 1)
     537      {
     538        stableParticleOutputArray->Add(candidate);
     539      }
     540      else if(pdgCode <= 5 || pdgCode == 21 || pdgCode == 15)
     541      {
     542        partonOutputArray->Add(candidate);
     543      }
    543544    }
    544545  }
  • classes/DelphesHepMC3Reader.h

    r90345e5 ra26a130  
    6565  void AnalyzeVertex(DelphesFactory *factory, int code, Candidate *candidate = 0);
    6666
    67   void AnalyzeParticle(DelphesFactory *factory,
    68     TObjArray *allParticleOutputArray,
     67  void AnalyzeParticle(DelphesFactory *factory);
     68
     69  void FinalizeParticles(TObjArray *allParticleOutputArray,
    6970    TObjArray *stableParticleOutputArray,
    7071    TObjArray *partonOutputArray);
    71 
    72   void FinalizeParticles(TObjArray *allParticleOutputArray);
    7372
    7473  FILE *fInputFile;
Note: See TracChangeset for help on using the changeset viewer.