7,7 → 7,6 |
#include <TTree.h> |
#include <TBranch.h> |
#include <TBufferJSON.h> |
#include <TMath.h> |
|
#include "BParticle.h" |
#include "BEvent.h" |
58,16 → 57,7 |
|
void Blab2::h1d(const char *varname, const char *name, int nbins, double min, double max, int id ){ |
TString svar(varname); |
TString axis[]={"mass (GeV/c2)", |
"momentum (GeV/c)", |
"energy (GeV)","charge", |
"identity", |
"momentum (GeV/c)", |
"momentum (GeV/c)", |
"momentum (GeV/c)", |
"momentum (GeV/c)", |
"angle (deg.)", |
"cos(theta)"}; |
TString axis[]={"mass (GeV/c2)","momentum (GeV/c)","energy (GeV)","charge","identity","momentum (GeV/c)","momentum (GeV/c)","momentum (GeV/c)","momentum (GeV/c)"}; |
fHtype[id] = 0; |
if (svar.Contains("GetMass" )) fHtype[id]=0; |
if (svar.Contains("GetMomentum")) fHtype[id]=1; |
78,8 → 68,6 |
if (svar.Contains("GetYMomentum")) fHtype[id]=6; |
if (svar.Contains("GetZMomentum")) fHtype[id]=7; |
if (svar.Contains("GetTranverseMomentum")) fHtype[id]=8; |
if (svar.Contains("GetTheta")) fHtype[id]=9; |
if (svar.Contains("GetCosTheta")) fHtype[id]=10; |
|
fH[id]= new TH1F(TString::Format("h%d",id), TString::Format("%s;%s;N",name,axis[fHtype[id]].Data()), nbins, min, max); |
|
94,22 → 82,20 |
} |
|
int Blab2::Fill(int hid, BParticle *p){ |
if (hid>=0 && fH[hid]) { |
double val; |
if (hid>=0 && fH[hid]) { |
float val; |
switch (fHtype[hid]){ |
case 0 : val = p->GetMass(); break; |
case 1 : val = p->GetMomentum(); break; |
case 2 : val = p->e(); break; |
case 3 : val = p->charge(); break; |
case 4 : val = p->pid(); break; |
case 5 : val = p->px(); break; |
case 6 : val = p->py(); break; |
case 7 : val = p->pz(); break; |
case 8 : val = p->GetTransverseMomentum(); break; |
case 9 : val = (p->GetMomentum()!=0) ? p->pz()/p->GetMomentum() : 0; val = 180*acos(val)/TMath::Pi(); break; |
case 10: val = (p->GetMomentum()!=0) ? p->pz()/p->GetMomentum() : 0; break; |
default: val = 0 ; break; |
} |
case 0: val = p->GetMass(); break; |
case 1: val = p->GetMomentum(); break; |
case 2: val = p->e(); break; |
case 3: val = p->charge(); break; |
case 4: val = p->pid(); break; |
case 5: val = p->px(); break; |
case 6: val = p->py(); break; |
case 7: val = p->pz(); break; |
case 8: val = sqrt(p->px()*p->px()+p->py()*p->py()); break; |
default : val = 0 ; break; |
} |
fH[hid]->Fill(val); |
} |
|
216,8 → 202,6 |
int nev = 0; |
int i =TMath::Min(fNfirst, (UInt_t) t-> GetEntries()); |
int cNeve=TMath::Min(fNfirst+fNeve, (UInt_t) t-> GetEntries()); |
int fPart = fPrint; |
int totaltracks = 0; |
while (i<cNeve){ |
t-> GetEntry(i); // Read the content of the event from the file |
fList[0]= mevent->GetParticleList(); |
234,8 → 218,7 |
nprt++; |
if (fPrint) sprintf(sList,"%s<tr><td>%d<td>%g<td>%g<td>%g<td>%g<td>%g<td>%1.0f<td>%s</tr>",sList,nprt, p->px(),p->py(),p->pz(),p->GetMomentum(),p->e(), p->charge(),names[p->pid()] ); |
} |
if (fPart) fHnprt->Fill(nprt); |
totaltracks += nprt; |
fHnprt->Fill(nprt); |
if (fPrint) { |
sprintf(sList,"%s</table>",sList); |
send_message(0, TString(sList),progress); |
245,12 → 228,12 |
for (int k=0;k<100;k++) if (fList[k]!=0) fList[k]->Clear(); |
i++; |
} |
double avgtracks=(i)?float(totaltracks)/i:0; |
send_message(0, TString::Format("Number of events processed: %d<br/>\nNumber of particles: %d<br/>\nAverage number of particles per event %f<br/>\n", i, totaltracks, avgtracks ),100); |
|
if (fPart) send_message(1,TBufferJSON::ConvertToJSON(fHnprt),100 ); |
send_message(2, TString::Format("Number of events processed %d\n", i ),100); |
|
send_message(1,TBufferJSON::ConvertToJSON(fHnprt),100 ); |
|
|
for (int i=0;i<100;i++) if (fH[i]!=0) send_message(1,TBufferJSON::ConvertToJSON(fH[i]),100 ); |
|
TDatime d; |