Changeset 284 in svn
- Timestamp:
- Mar 1, 2009, 7:03:27 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/LHCOConverter.cc
r275 r284 75 75 } 76 76 77 78 77 79 void LHCOConverter::CopyRunLogFile() { 78 80 if(!valid_) {/*cout << "Nothing done\n";*/ return; } … … 98 100 } 99 101 102 103 100 104 void LHCOConverter::ConvertExRootAnalysisToLHCO() { 101 105 if(!valid_) {/*cout << "Nothing done\n";*/ return; } … … 105 109 //# typ eta phi pt jmas ntrk btag had/em dum1 dum2 106 110 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 dum1dum2" << endl;111 outfile << " # typ eta phi pt jmas ntrk btag had/em dum1 dum2" << endl; 108 112 109 113 // input files … … 130 134 analysisTree->ReadEntry(event); 131 135 triggerTree->ReadEntry(event); 132 //TRIGT->GetGlobalResult(branchElecTrig, branchMuonTrig,branchJetTrig, branchTauJetTrig,branchPhotonTrig, branchETmisTrig,branchTrigger);133 136 unsigned int triginfo = 0; 134 137 unsigned int line =0; 138 135 139 outfile << setw(3) << line++ << setw(4) << " " << setw(7) << event << setw(7) << triginfo << endl; 140 outfile.close(); 136 141 137 142 // 0 photon data 143 //outfile << BranchReader(branchPhoton,line,lhcoPhotonID); 138 144 BranchReader(branchPhoton,line,lhcoPhotonID); 139 145 … … 155 161 } // event loop 156 162 157 outfile.close();158 163 delete triggerTree; 159 164 delete analysisTree; … … 161 166 162 167 168 //ostringstream LHCOConverter::BranchReader(const TClonesArray* branch, unsigned int& line, unsigned short int lhcoID) const { 163 169 void 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); 166 172 unsigned int branch_size = branch->GetEntries(); 167 173 TRootParticle * particle = 0; 168 174 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(); 170 181 unsigned int ntrk = 0; 171 unsigned short int btag =0;182 float btag =0; 172 183 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 184 196 << 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 } 185 211 } 186 outfile.close(); 187 } 212 outfile.close(); 213 // return outfile; 214 }
Note:
See TracChangeset
for help on using the changeset viewer.