| 8,7 → 8,7 |
| #include <TBranch.h> |
| #include <TBufferJSON.h> |
| #include <TMath.h> |
| |
| #include <vector> |
| #include "BParticle.h" |
| #include "BEvent.h" |
| |
| 19,7 → 19,20 |
| int progress; |
| }; |
| |
| std::vector<int> histogram(int n, ...){ |
| std::vector<int> result; |
| int val = 0; |
| va_list ap; |
| int i; |
| |
| va_start(ap, n); |
| for(i = 0; i < n; i++) { |
| result.push_back( va_arg(ap, int) ); |
| } |
| va_end(ap); |
| return result; |
| } |
| |
| class Blab2 { |
| public: |
| const char *names[11]={"photon", "electron", "pion", "muon", "kaon", "proton", "J/Psi", "D", "D*", "B", "Phi"}; |
| 39,9 → 52,11 |
| void Process(); |
| void h1d(const char *varname, const char *name, int nbins, double min, double max, int id ); |
| int selector(int pin, int charge, SIMPLEPID particlename, int hid, int pout ); |
| int selector(int pin, int charge, SIMPLEPID particlename, std::vector<int> hid, int pout ); |
| int combiner(int id0 ,int id1 , int same, SIMPLEPID particlename, double min, double max, int hid, int id ); |
| int combiner(int id0 ,int id1 , int same, SIMPLEPID particlename, double min, double max, std::vector<int>hid, int id ); |
| int fix_mass(int id); |
| int Fill(int hid, BParticle *p); |
| int Fill(std::vector<int> hid, BParticle *p); |
| void plist(int i); |
| |
| |
| 81,8 → 96,7 |
| 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); |
| |
| //fH[id]= new TH1F(TString::Format("h%d",id), TString::Format("%s;%s;N",name,axis[fHtype[id]].Data()), nbins, min, max); |
| if (fHtype[id]==4) { |
| fH[id]= new TH1F(TString::Format("h%d",id), TString::Format("%s;%s;N",name,axis[fHtype[id]].Data()), 11, 0, 11); |
| for (int i=0;i<11;i++) fH[id]->GetXaxis()->SetBinLabel(i+1,names[i]); |
| 93,7 → 107,11 |
| |
| } |
| |
| int Blab2::Fill(int hid, BParticle *p){ |
| |
| |
| int Blab2::Fill(std::vector<int> id, BParticle *p){ |
| for (int i=0; i< id.size(); i++){ |
| int hid = id[i]; |
| if (hid>=0 && fH[hid]) { |
| double val; |
| switch (fHtype[hid]){ |
| 112,11 → 130,17 |
| } |
| fH[hid]->Fill(val); |
| } |
| |
| } |
| |
| return 0; |
| } |
| int Blab2::combiner(int _p0, int _p1,int same, SIMPLEPID pid, double min, double max, int hid, int _p2 ){ |
| std::vector<int> a; |
| return combiner(_p0,_p1,same,pid,min,max,a,_p2); |
| } |
| |
| int Blab2::combiner(int _p0, int _p1,int same, SIMPLEPID pid, double min, double max, int hid, int _p2 ){ |
| int Blab2::combiner(int _p0, int _p1,int same, SIMPLEPID pid, double min, double max, std::vector<int> hid, int _p2 ){ |
| // Loop over all the particles in both lists. |
| if (_p0 < 0 ) _p0 =0; |
| if (_p1 < 0 ) _p1 =0; |
| 147,7 → 171,11 |
| } |
| |
| |
| int Blab2::selector(int pin, int charge, SIMPLEPID type , int hid, int pout ){ |
| int Blab2::selector(int pin, int charge, SIMPLEPID type , int hid, int pout ){ |
| std::vector<int> a; |
| return selector(pin,charge,type,a,pout); |
| } |
| int Blab2::selector(int pin, int charge, SIMPLEPID type , std::vector<int> hid, int pout ){ |
| if (pin < 0 ) pin =0; |
| |
| fList[pout]->Clear(); |