Fork me on GitHub

Changeset 341014c in git for converters


Ignore:
Timestamp:
Feb 12, 2019, 9:29:17 PM (6 years ago)
Author:
Pavel Demin <pavel-demin@…>
Branches:
ImprovedOutputFile, Timing, llp, master
Children:
6455202
Parents:
45e58be
Message:

apply .clang-format to all .h, .cc and .cpp files

Location:
converters
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • converters/hepmc2pileup.cpp

    r45e58be r341014c  
    1717 */
    1818
    19 #include <stdexcept>
    2019#include <iostream>
    2120#include <sstream>
     21#include <stdexcept>
    2222
    2323#include <signal.h>
    2424
     25#include "TApplication.h"
    2526#include "TROOT.h"
    26 #include "TApplication.h"
    2727
     28#include "TDatabasePDG.h"
    2829#include "TFile.h"
     30#include "TLorentzVector.h"
    2931#include "TObjArray.h"
     32#include "TParticlePDG.h"
    3033#include "TStopwatch.h"
    31 #include "TDatabasePDG.h"
    32 #include "TParticlePDG.h"
    33 #include "TLorentzVector.h"
    3434
    3535#include "classes/DelphesClasses.h"
     
    3838#include "classes/DelphesPileUpWriter.h"
    3939
     40#include "ExRootAnalysis/ExRootProgressBar.h"
     41#include "ExRootAnalysis/ExRootTreeBranch.h"
    4042#include "ExRootAnalysis/ExRootTreeWriter.h"
    41 #include "ExRootAnalysis/ExRootTreeBranch.h"
    42 #include "ExRootAnalysis/ExRootProgressBar.h"
    4343
    4444using namespace std;
     
    7171  if(argc < 2)
    7272  {
    73     cout << " Usage: " << appName << " output_file" << " [input_file(s)]" << endl;
     73    cout << " Usage: " << appName << " output_file"
     74         << " [input_file(s)]" << endl;
    7475    cout << " output_file - output binary pile-up file," << endl;
    7576    cout << " input_file(s) - input file(s) in HepMC format," << endl;
     
    142143      reader->Clear();
    143144      while(reader->ReadBlock(factory, allParticleOutputArray,
    144         stableParticleOutputArray, partonOutputArray) && !interrupted)
     145              stableParticleOutputArray, partonOutputArray)
     146        && !interrupted)
    145147      {
    146148        if(reader->EventReady())
     
    149151
    150152          itParticle->Reset();
    151           while((candidate = static_cast<Candidate*>(itParticle->Next())))
     153          while((candidate = static_cast<Candidate *>(itParticle->Next())))
    152154          {
    153155            const TLorentzVector &position = candidate->Position;
     
    173175
    174176      ++i;
    175     }
    176     while(i < argc);
     177    } while(i < argc);
    177178
    178179    writer->WriteIndex();
  • converters/lhco2root.cpp

    r45e58be r341014c  
    1717 */
    1818
    19 #include <stdexcept>
    2019#include <iostream>
    2120#include <sstream>
    22 
    23 #include <stdlib.h>
     21#include <stdexcept>
     22
    2423#include <signal.h>
    2524#include <stdio.h>
    26 
     25#include <stdlib.h>
     26
     27#include "TApplication.h"
    2728#include "TROOT.h"
    28 #include "TApplication.h"
    29 
     29
     30#include "TDatabasePDG.h"
    3031#include "TFile.h"
     32#include "TLorentzVector.h"
    3133#include "TObjArray.h"
     34#include "TParticlePDG.h"
    3235#include "TStopwatch.h"
    33 #include "TDatabasePDG.h"
    34 #include "TParticlePDG.h"
    35 #include "TLorentzVector.h"
    36 
    37 #include "modules/Delphes.h"
    38 #include "classes/DelphesStream.h"
     36
    3937#include "classes/DelphesClasses.h"
    4038#include "classes/DelphesFactory.h"
    41 
     39#include "classes/DelphesStream.h"
     40#include "modules/Delphes.h"
     41
     42#include "ExRootAnalysis/ExRootProgressBar.h"
     43#include "ExRootAnalysis/ExRootTreeBranch.h"
    4244#include "ExRootAnalysis/ExRootTreeWriter.h"
    43 #include "ExRootAnalysis/ExRootTreeBranch.h"
    44 #include "ExRootAnalysis/ExRootProgressBar.h"
    4545
    4646using namespace std;
    4747
    48 static const int kBufferSize  = 1024;
     48static const int kBufferSize = 1024;
    4949
    5050/*
     
    7474
    7575private:
    76 
    7776  void AddMissingEvents();
    7877
     
    8685  void AnalyseMissingET(ExRootTreeBranch *branch);
    8786
    88   enum {kIntParamSize = 2, kDblParamSize = 7};
     87  enum
     88  {
     89    kIntParamSize = 2,
     90    kDblParamSize = 7
     91  };
    8992  Int_t fIntParam[kIntParamSize];
    9093  Double_t fDblParam[kDblParamSize];
     
    106109  ExRootTreeBranch *fBranchJet;
    107110  ExRootTreeBranch *fBranchMissingET;
    108 
    109111};
    110112
     
    169171    if(!rc)
    170172    {
    171       cerr << "** ERROR: " << "invalid event format" << endl;
     173      cerr << "** ERROR: "
     174           << "invalid event format" << endl;
    172175      return kFALSE;
    173176    }
     
    195198    if(!rc)
    196199    {
    197       cerr << "** ERROR: " << "invalid object format" << endl;
     200      cerr << "** ERROR: "
     201           << "invalid object format" << endl;
    198202      return kFALSE;
    199203    }
     
    201205    switch(fIntParam[1])
    202206    {
    203       case 0: AnalysePhoton(fBranchPhoton); break;
    204       case 1: AnalyseElectron(fBranchElectron); break;
    205       case 2: AnalyseMuon(fBranchMuon); break;
    206       case 3: AnalyseTau(fBranchJet); break;
    207       case 4: AnalyseJet(fBranchJet); break;
    208       case 6: AnalyseMissingET(fBranchMissingET); break;
     207    case 0: AnalysePhoton(fBranchPhoton); break;
     208    case 1: AnalyseElectron(fBranchElectron); break;
     209    case 2: AnalyseMuon(fBranchMuon); break;
     210    case 3: AnalyseTau(fBranchJet); break;
     211    case 4: AnalyseJet(fBranchJet); break;
     212    case 6: AnalyseMissingET(fBranchMissingET); break;
    209213    }
    210214  }
     
    228232  LHCOEvent *element;
    229233
    230   element = static_cast<LHCOEvent*>(branch->NewEntry());
     234  element = static_cast<LHCOEvent *>(branch->NewEntry());
    231235
    232236  element->Number = fEventNumber;
     
    240244  Photon *element;
    241245
    242   element = static_cast<Photon*>(branch->NewEntry());
     246  element = static_cast<Photon *>(branch->NewEntry());
    243247
    244248  element->Eta = fDblParam[0];
     
    254258  Electron *element;
    255259
    256   element = static_cast<Electron*>(branch->NewEntry());
     260  element = static_cast<Electron *>(branch->NewEntry());
    257261
    258262  element->Eta = fDblParam[0];
     
    261265
    262266  element->Charge = fDblParam[4] < 0.0 ? -1 : 1;
    263 /*
     267  /*
    264268  element->Ntrk = TMath::Abs(fDblParam[4]);
    265269*/
     
    273277  Muon *element;
    274278
    275   element = static_cast<Muon*>(branch->NewEntry());
     279  element = static_cast<Muon *>(branch->NewEntry());
    276280
    277281  element->Eta = fDblParam[0];
     
    280284
    281285  element->Charge = fDblParam[4] < 0.0 ? -1 : 1;
    282 /*
     286  /*
    283287  element->Ntrk = TMath::Abs(fDblParam[4]);
    284288
     
    296300  Jet *element;
    297301
    298   element = static_cast<Jet*>(branch->NewEntry());
     302  element = static_cast<Jet *>(branch->NewEntry());
    299303
    300304  element->Eta = fDblParam[0];
     
    308312
    309313  element->Charge = fDblParam[4] < 0 ? -1 : 1;
    310 /*
     314  /*
    311315  element->Ntrk = TMath::Abs(fDblParam[4]);
    312316*/
     
    320324  Jet *element;
    321325
    322   element = static_cast<Jet*>(branch->NewEntry());
     326  element = static_cast<Jet *>(branch->NewEntry());
    323327
    324328  element->Eta = fDblParam[0];
     
    327331
    328332  element->Mass = fDblParam[3];
    329 /*
     333  /*
    330334  element->Ntrk = TMath::Abs(Int_t(fDblParam[4]));
    331335*/
     
    336340
    337341  element->EhadOverEem = fDblParam[6];
    338 /*
     342  /*
    339343  element->Index = fIntParam[0];
    340344*/
     
    347351  MissingET *element;
    348352
    349   element = static_cast<MissingET*>(branch->NewEntry());
     353  element = static_cast<MissingET *>(branch->NewEntry());
    350354
    351355  element->Phi = fDblParam[1];
     
    376380  if(argc < 2)
    377381  {
    378     cout << " Usage: " << appName << " output_file" << " [input_file(s)]" << endl;
     382    cout << " Usage: " << appName << " output_file"
     383         << " [input_file(s)]" << endl;
    379384    cout << " output_file - output file in ROOT format," << endl;
    380385    cout << " input_file(s) - input file(s) in LHCO format," << endl;
     
    456461
    457462      ++i;
    458     }
    459     while(i < argc);
     463    } while(i < argc);
    460464
    461465    cout << "** Exiting..." << endl;
     
    474478  }
    475479}
    476 
    477 
  • converters/pileup2root.cpp

    r45e58be r341014c  
    1717 */
    1818
    19 
    20 #include <stdexcept>
    2119#include <iostream>
    2220#include <sstream>
    23 
    24 #include <stdlib.h>
     21#include <stdexcept>
     22
    2523#include <signal.h>
    2624#include <stdio.h>
    27 
     25#include <stdlib.h>
     26
     27#include "TApplication.h"
    2828#include "TROOT.h"
    29 #include "TApplication.h"
    30 
     29
     30#include "TDatabasePDG.h"
    3131#include "TFile.h"
     32#include "TLorentzVector.h"
    3233#include "TObjArray.h"
     34#include "TParticlePDG.h"
    3335#include "TStopwatch.h"
    34 #include "TDatabasePDG.h"
    35 #include "TParticlePDG.h"
    36 #include "TLorentzVector.h"
    37 
    38 #include "classes/DelphesStream.h"
     36
    3937#include "classes/DelphesClasses.h"
    4038#include "classes/DelphesFactory.h"
    4139#include "classes/DelphesPileUpReader.h"
    42 
     40#include "classes/DelphesStream.h"
     41
     42#include "ExRootAnalysis/ExRootProgressBar.h"
     43#include "ExRootAnalysis/ExRootTreeBranch.h"
    4344#include "ExRootAnalysis/ExRootTreeWriter.h"
    44 #include "ExRootAnalysis/ExRootTreeBranch.h"
    45 #include "ExRootAnalysis/ExRootProgressBar.h"
    4645
    4746using namespace std;
     
    6261  while(reader->ReadParticle(pid, x, y, z, t, px, py, pz, e))
    6362  {
    64     particle = static_cast<GenParticle*>(branch->NewEntry());
     63    particle = static_cast<GenParticle *>(branch->NewEntry());
    6564
    6665    particle->PID = pid;
     
    8483
    8584    pdgParticle = pdg->GetParticle(pid);
    86     particle->Charge = pdgParticle ? Int_t(pdgParticle->Charge()/3.0) : -999;
     85    particle->Charge = pdgParticle ? Int_t(pdgParticle->Charge() / 3.0) : -999;
    8786
    8887    particle->Mass = pdgParticle ? pdgParticle->Mass() : -999.9;
     
    9291    cosTheta = TMath::Abs(momentum.CosTheta());
    9392    signPz = (momentum.Pz() >= 0.0) ? 1.0 : -1.0;
    94     eta = (cosTheta == 1.0 ? signPz*999.9 : momentum.Eta());
    95     rapidity = (cosTheta == 1.0 ? signPz*999.9 : momentum.Rapidity());
     93    eta = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Eta());
     94    rapidity = (cosTheta == 1.0 ? signPz * 999.9 : momentum.Rapidity());
    9695
    9796    particle->Eta = eta;
     
    126125  if(argc != 3)
    127126  {
    128     cout << " Usage: " << appName << " output_file" << " input_file" << endl;
     127    cout << " Usage: " << appName << " output_file"
     128         << " input_file" << endl;
    129129    cout << " output_file - output file in ROOT format," << endl;
    130130    cout << " input_file - input binary pile-up file." << endl;
     
    199199  }
    200200}
    201 
    202 
  • converters/root2lhco.cpp

    r45e58be r341014c  
    1717 */
    1818
     19#include <fstream>
     20#include <iostream>
     21#include <sstream>
    1922#include <stdexcept>
    20 #include <iostream>
    21 #include <fstream>
    22 #include <sstream>
    2323#include <string>
    2424
    25 #include <stdlib.h>
    2625#include <signal.h>
    2726#include <stdio.h>
    28 
     27#include <stdlib.h>
     28
     29#include "TApplication.h"
    2930#include "TROOT.h"
    30 #include "TApplication.h"
    31 
     31
     32#include "TClonesArray.h"
    3233#include "TFile.h"
    33 #include "TClonesArray.h"
    3434
    3535#include "classes/DelphesClasses.h"
    3636
     37#include "ExRootAnalysis/ExRootProgressBar.h"
    3738#include "ExRootAnalysis/ExRootTreeReader.h"
    38 #include "ExRootAnalysis/ExRootProgressBar.h"
    3939
    4040using namespace std;
     
    6262
    6363private:
    64 
    6564  void Reset();
    6665  void Write();
     
    7675  void AnalyseMissingET();
    7776
    78   enum {kIntParamSize = 2, kDblParamSize = 9};
     77  enum
     78  {
     79    kIntParamSize = 2,
     80    kDblParamSize = 9
     81  };
    7982  Int_t fIntParam[kIntParamSize];
    8083  Double_t fDblParam[kDblParamSize];
     
    132135  fBranchMissingET = fTreeReader->UseBranch("MissingET");
    133136
    134   if(!fBranchEvent || !fBranchTrack || !fBranchTower || !fBranchPhoton ||
    135      !fBranchElectron || !fBranchMuon || !fBranchJet || !fBranchMissingET)
     137  if(!fBranchEvent || !fBranchTrack || !fBranchTower || !fBranchPhoton || !fBranchElectron || !fBranchMuon || !fBranchJet || !fBranchMissingET)
    136138  {
    137139    throw runtime_error("ROOT file doesn't contain all required branches");
     
    202204  Event *element;
    203205
    204   element = static_cast<Event*>(fBranchEvent->At(0));
     206  element = static_cast<Event *>(fBranchEvent->At(0));
    205207
    206208  fprintf(fOutputFile, "%4d %13lld %8d\n", 0, element->Number, 0);
     
    216218
    217219  fItPhoton->Reset();
    218   while((element = static_cast<Photon*>(fItPhoton->Next())))
     220  while((element = static_cast<Photon *>(fItPhoton->Next())))
    219221  {
    220222    Reset();
     
    239241
    240242  fItElectron->Reset();
    241   while((element = static_cast<Electron*>(fItElectron->Next())))
     243  while((element = static_cast<Electron *>(fItElectron->Next())))
    242244  {
    243245    Reset();
     
    270272  muonCounter = 0;
    271273  fItMuon->Reset();
    272   while((element = static_cast<Muon*>(fItMuon->Next())))
     274  while((element = static_cast<Muon *>(fItMuon->Next())))
    273275  {
    274276    Reset();
     
    276278    sumPT = 0.0;
    277279    fItTrack->Reset();
    278     while((track = static_cast<Track*>(fItTrack->Next())))
     280    while((track = static_cast<Track *>(fItTrack->Next())))
    279281    {
    280282      if(element->P4().DeltaR(track->P4()) < 0.5) sumPT += track->PT;
     
    283285    sumET = 0.0;
    284286    fItTower->Reset();
    285     while((tower = static_cast<Tower*>(fItTower->Next())))
     287    while((tower = static_cast<Tower *>(fItTower->Next())))
    286288    {
    287289      if(element->P4().DeltaR(tower->P4()) < 0.5) sumET += tower->ET;
     
    293295    minDR = 1.0E9;
    294296    fItJet->Reset();
    295     while((jet = static_cast<Jet*>(fItJet->Next())))
     297    while((jet = static_cast<Jet *>(fItJet->Next())))
    296298    {
    297299      if(jet->TauTag != 0)
     
    325327    }
    326328
    327     ratET = sumET/element->PT;
     329    ratET = sumET / element->PT;
    328330    fDblParam[6] = Float_t(TMath::Nint(sumPT)) + (ratET < 1.0 ? ratET : 0.99);
    329331
     
    342344
    343345  fItJet->Reset();
    344   while((element = static_cast<Jet*>(fItJet->Next())))
     346  while((element = static_cast<Jet *>(fItJet->Next())))
    345347  {
    346348    if(element->TauTag == 0) continue;
     
    350352    counter = 1;
    351353
    352    /*
     354    /*
    353355    fItTrack->Reset();
    354356    while((track = static_cast<Track*>(fItTrack->Next())))
     
    380382
    381383  fItJet->Reset();
    382   while((element = static_cast<Jet*>(fItJet->Next())))
     384  while((element = static_cast<Jet *>(fItJet->Next())))
    383385  {
    384386    if(element->TauTag != 0) continue;
     
    388390    counter = 0;
    389391    fItTrack->Reset();
    390     while((track = static_cast<Track*>(fItTrack->Next())))
     392    while((track = static_cast<Track *>(fItTrack->Next())))
    391393    {
    392394      if(element->P4().DeltaR(track->P4()) < 0.5) ++counter;
     
    413415  MissingET *element;
    414416
    415   element = static_cast<MissingET*>(fBranchMissingET->At(0));
     417  element = static_cast<MissingET *>(fBranchMissingET->At(0));
    416418
    417419  Reset();
     
    471473  if(argc < 2 || argc > 4)
    472474  {
    473     cerr << " Usage: " << appName << " input_file" << " [output_file] [--jet-branch=Jet]" << endl;
     475    cerr << " Usage: " << appName << " input_file"
     476         << " [output_file] [--jet-branch=Jet]" << endl;
    474477    cerr << " input_file - input file in ROOT format," << endl;
    475478    cerr << " output_file - output file in LHCO format," << endl;
  • converters/root2pileup.cpp

    r45e58be r341014c  
    1717 */
    1818
    19 #include <stdexcept>
    2019#include <iostream>
    2120#include <sstream>
     21#include <stdexcept>
    2222#include <string>
    2323
    2424#include <signal.h>
    2525
     26#include "TApplication.h"
    2627#include "TROOT.h"
    27 #include "TApplication.h"
    2828
     29#include "TClonesArray.h"
    2930#include "TFile.h"
    30 #include "TClonesArray.h"
    3131
    3232#include "classes/DelphesClasses.h"
    3333#include "classes/DelphesPileUpWriter.h"
    3434
     35#include "ExRootAnalysis/ExRootProgressBar.h"
    3536#include "ExRootAnalysis/ExRootTreeReader.h"
    36 #include "ExRootAnalysis/ExRootProgressBar.h"
    3737
    3838using namespace std;
     
    6464  if(argc < 3)
    6565  {
    66     cout << " Usage: " << appName << " output_file" << " input_file(s)" << endl;
     66    cout << " Usage: " << appName << " output_file"
     67         << " input_file(s)" << endl;
    6768    cout << " output_file - output binary pile-up file," << endl;
    6869    cout << " input_file(s) - input file(s) in ROOT format." << endl;
     
    108109
    109110        itParticle->Reset();
    110         while((particle = static_cast<GenParticle*>(itParticle->Next())))
     111        while((particle = static_cast<GenParticle *>(itParticle->Next())))
    111112        {
    112113          writer->WriteParticle(particle->PID,
     
    114115            particle->Px, particle->Py, particle->Pz, particle->E);
    115116        }
    116        
     117
    117118        writer->WriteEntry();
    118119
  • converters/stdhep2pileup.cpp

    r45e58be r341014c  
    1717 */
    1818
    19 #include <stdexcept>
    2019#include <iostream>
    2120#include <sstream>
     21#include <stdexcept>
    2222
    2323#include <signal.h>
    2424
     25#include "TApplication.h"
    2526#include "TROOT.h"
    26 #include "TApplication.h"
    2727
     28#include "TDatabasePDG.h"
    2829#include "TFile.h"
     30#include "TLorentzVector.h"
    2931#include "TObjArray.h"
     32#include "TParticlePDG.h"
    3033#include "TStopwatch.h"
    31 #include "TDatabasePDG.h"
    32 #include "TParticlePDG.h"
    33 #include "TLorentzVector.h"
    3434
    3535#include "classes/DelphesClasses.h"
    3636#include "classes/DelphesFactory.h"
     37#include "classes/DelphesPileUpWriter.h"
    3738#include "classes/DelphesSTDHEPReader.h"
    38 #include "classes/DelphesPileUpWriter.h"
    3939
     40#include "ExRootAnalysis/ExRootProgressBar.h"
     41#include "ExRootAnalysis/ExRootTreeBranch.h"
    4042#include "ExRootAnalysis/ExRootTreeWriter.h"
    41 #include "ExRootAnalysis/ExRootTreeBranch.h"
    42 #include "ExRootAnalysis/ExRootProgressBar.h"
    4343
    4444using namespace std;
     
    7171  if(argc < 2)
    7272  {
    73     cout << " Usage: " << appName << " output_file" << " [input_file(s)]" << endl;
     73    cout << " Usage: " << appName << " output_file"
     74         << " [input_file(s)]" << endl;
    7475    cout << " output_file - output binary pile-up file," << endl;
    7576    cout << " input_file(s) - input file(s) in STDHEP format," << endl;
     
    142143      reader->Clear();
    143144      while(reader->ReadBlock(factory, allParticleOutputArray,
    144         stableParticleOutputArray, partonOutputArray) && !interrupted)
     145              stableParticleOutputArray, partonOutputArray)
     146        && !interrupted)
    145147      {
    146148        if(reader->EventReady())
     
    149151
    150152          itParticle->Reset();
    151           while((candidate = static_cast<Candidate*>(itParticle->Next())))
     153          while((candidate = static_cast<Candidate *>(itParticle->Next())))
    152154          {
    153155            const TLorentzVector &position = candidate->Position;
     
    173175
    174176      ++i;
    175     }
    176     while(i < argc);
     177    } while(i < argc);
    177178
    178179    writer->WriteIndex();
Note: See TracChangeset for help on using the changeset viewer.