Index: trunk/utils/eTTreemaker.C =================================================================== --- trunk/utils/eTTreemaker.C (revision 0) +++ trunk/utils/eTTreemaker.C (revision 8) @@ -0,0 +1,206 @@ +// this very simple macro takes as input an Ascii eSTARlight output file, slight.out, and creates a standard TTree named ntuple.root +// S. Klein, June, 2018 +// Fixed Bjorken-x calc Jan. 2020 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void eTTreemaker(void) +{ +using namespace std; + using namespace std; + double me=0.000511; + double mfinal; +// create output TTree here + + double fspx,fspy,fspz,fse,fsrap,fspt,fsmass,p1x,p1y,p1z,p1e,p1prap; + double p2x,p2y,p2z,p2e,p2prap,p1pt,p2pt; + +// new variables for eSTARlight + double kphoton,kperp,qsquared,xbj,ttransfer; + +// ttransfer will be imlemented later + + TNtuple *esNTuple = new TNtuple("esNT","eslightNtuple","fspt:fspz:fsrap:fsmass:p1pt:p1z:p1prap:p2pt:p2z:p2prap:kg:qsq:xbj"); +// This is the electron, photon, final state (particle combination), particle 1 and particle 2 +// These are pseudorapidities, except for the final state, where it is rapidity +// For the photon there is the photon energy, Q^2 the bjorken x of the target (calculated with x = Q^2/(2km_p) and t, the momentum transfer from the target + + cout <<" Opening slight.out"<< endl; + + ifstream inFile; + inFile.open("slight.out"); + cout << "slight.out open"<>label); + //assert(label == "VERTEX:"); + + + if (!getline(inFile,line)) {cout <<" Error reading CONFIG_OPT line"<>label);// CONFIG_OPT + + if (!getline(inFile,line)) {cout <<" Error reading BEAM_1 line"<>label>>i1>>i2>>gamma_e); // BEAM_1 is the electron + cout<<"Electron Lorentz boost is "<>label>>i1>>i2>>gamma_ion); // BEAM_2 is the ion + cout<<"Ion Lorentz boost is "<>label>>eventNmb>>nmbTracks); + if (!(label =="EVENT:")) continue; + if (eventNmb < 5) {cout <<"Reached Event "<>label); + assert(label == "VERTEX:"); + + if (!getline(inFile,line)) {break;} + lineStream=stringstream(line); + assert(lineStream>>label>>kphoton>>qsquared); + assert(label == "GAMMA:"); + + if (!getline(inFile,line)) {break;} + lineStream=stringstream(line); + assert(lineStream>>label>>ttransfer); + assert(label == "t:"); + + if (!getline(inFile,line)) {break;} + lineStream=stringstream(line); + assert(lineStream>>label); + assert(label == "TARGET:"); + + if (!getline(inFile,line)) {break;} + lineStream=stringstream(line); + assert(lineStream>>label); + assert(label == "SOURCE:"); + +// two track cards + if (!getline(inFile,line)) {break;} + countLines++; + //lineStream.str(line); + lineStream=stringstream(line); + assert(lineStream>>label>>pcode>>p1x>>p1y>>p1z>>i1>>i2>>i3>>pdgpid1); + assert(label == "TRACK:"); + + + if (!getline(inFile,line)) {break;} + countLines++; + lineStream=stringstream(line); + //lineStream.str(line); + assert(lineStream>>label>>pcode>>p2x>>p2y>>p2z>>i1>>i2>>i3>>pdgpid2); + assert(label == "TRACK:"); + + // get the final state masses should be particle anti-particle, so pdgcodes should be opposite + if (pdgpid1 != -pdgpid2) + { cout<<"Error pdgpid codes don't match"<Write(); + NTfile->Close(); +} + + Property changes on: trunk/utils/eTTreemaker.C ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property