Fork me on GitHub

Changeset 284 in svn for trunk/src


Ignore:
Timestamp:
Mar 1, 2009, 7:03:27 PM (15 years ago)
Author:
Xavier Rouby
Message:

not yet finished

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/LHCOConverter.cc

    r275 r284  
    7575}
    7676
     77
     78
    7779void LHCOConverter::CopyRunLogFile() {
    7880  if(!valid_) {/*cout << "Nothing done\n";*/ return; }
     
    98100}
    99101
     102
     103
    100104void LHCOConverter::ConvertExRootAnalysisToLHCO() {
    101105  if(!valid_) {/*cout << "Nothing done\n";*/ return; }
     
    105109  //#  typ      eta    phi      pt    jmas  ntrk  btag   had/em  dum1  dum2
    106110  outfile << " ## More info on LHCO files: http://cp3wks05.fynu.ucl.ac.be/Manual/lhco.html\n  #" << endl;
    107   outfile << "  #  typ    eta    phi      pt    jmas  ntrk  btag   had/em  dum1  dum2" << endl;
     111  outfile << "  #  typ   eta     phi     pt     jmas    ntrk    btag   had/em    dum1   dum2" << endl;
    108112
    109113  // input files
     
    130134    analysisTree->ReadEntry(event);
    131135    triggerTree->ReadEntry(event);
    132  //TRIGT->GetGlobalResult(branchElecTrig, branchMuonTrig,branchJetTrig, branchTauJetTrig,branchPhotonTrig, branchETmisTrig,branchTrigger);
    133136    unsigned int triginfo = 0;
    134137    unsigned int line =0;
     138
    135139    outfile << setw(3) << line++  << setw(4) << " " << setw(7) << event << setw(7) << triginfo << endl;
     140    outfile.close();
    136141
    137142    // 0 photon data
     143    //outfile << BranchReader(branchPhoton,line,lhcoPhotonID);
    138144    BranchReader(branchPhoton,line,lhcoPhotonID);
    139145
     
    155161  } // event loop
    156162
    157   outfile.close();
    158163  delete triggerTree;
    159164  delete analysisTree;
     
    161166
    162167
     168//ostringstream LHCOConverter::BranchReader(const TClonesArray* branch, unsigned int& line, unsigned short int lhcoID) const {
    163169void LHCOConverter::BranchReader(const TClonesArray* branch, unsigned int& line, unsigned short int lhcoID) const {
    164   ofstream outfile( outputfilename_.c_str(),ios_base::app);
    165    
     170    //ostringstream outfile;
     171    ofstream outfile( outputfilename_.c_str(),ios_base::app);
    166172    unsigned int branch_size = branch->GetEntries();
    167173    TRootParticle * particle = 0;
    168174    for (unsigned int i=0; i< branch_size; i++) {
    169         double jmass =0;
     175        particle = (TRootParticle*) branch->At(i);
     176        double temp =  sqrt(particle->PT*particle->PT + particle->Pz * particle->Pz);
     177        double jmass = (particle->E - temp) * (particle->E + temp); // prevents some numerical sensitivity
     178        TLorentzVector pmu;
     179        pmu.SetPtEtaPhiE(particle->PT, particle->Eta, particle->Phi, particle->E);
     180        jmass = pmu.M();
    170181        unsigned int ntrk = 0;
    171         unsigned short int btag =0;
     182        float btag =0;
    172183        double ratioE = 0;
    173         particle = (TRootParticle*) branch->At(i);
    174         outfile << setw(3) << line++    // line counter
    175                 << setw(4) << lhcoID    // object ID in lhco format
    176                 << setw(7) << particle->Eta
    177 //                << setw(7) << fixed(3) << particle->Eta
    178                 << setw(7) << particle->Phi
    179                 << setw(7) << particle->PT
    180                 << setw(7) << jmass     // invariant mass
    181                 << setw(7) << ntrk      // number of tracks
    182                 << setw(7) << btag     
    183                 << setw(7) << ratioE    // E_had/E_em
     184        if(lhcoID != lhcoETmisID) {
     185        outfile << fixed << setprecision(3)
     186                << setw(3) << line++    // line counter
     187                << setw(4) << lhcoID << " "   // object ID in lhco format
     188                << setw(7) << particle->Eta <<" "
     189                << setw(7) << particle->Phi <<" "
     190                << setw(7) << particle->PT  <<" "
     191                << setw(7) << jmass <<" "       // invariant mass
     192                << setw(7) << ntrk  <<" "       // number of tracks
     193                << setw(7) << btag  <<" "       
     194                << setw(7) << ratioE <<" "      // E_had/E_em
     195                << setw(7) << 0.0 << setw(7) << 0.0  // dummy/dummy
    184196                << endl;
     197        } else {
     198        outfile << fixed << setprecision(3)
     199                << setw(3) << line++    // line counter
     200                << setw(4) << lhcoID << " "   // object ID in lhco format
     201                << setw(7) << 0.000 <<" "
     202                << setw(7) << particle->Phi <<" "
     203                << setw(7) << particle->PT  <<" "
     204                << setw(7) << 0. <<" "       // invariant mass
     205                << setw(7) << 0  <<" "       // number of tracks
     206                << setw(7) << 0.  <<" "
     207                << setw(7) << 0. <<" "      // E_had/E_em
     208                << setw(7) << 0.0 << setw(7) << 0.0  // dummy/dummy
     209                << endl;
     210        }
    185211    }
    186   outfile.close();
    187 }
     212    outfile.close();
     213    // return outfile;
     214}
Note: See TracChangeset for help on using the changeset viewer.