Difference between revisions of "Evio2root transitions.C"
Jump to navigation
Jump to search
(Created page with "<pre> #include <math.h> void evio2rootAnalysis_transitions() { double theta,phi,PhiLimit; double thetaWire,phiWire,vector; double length; int gpart; int...") |
(No difference)
|
Latest revision as of 22:32, 2 November 2017
#include <math.h>
void evio2rootAnalysis_transitions()
{
double theta,phi,PhiLimit;
double thetaWire,phiWire,vector;
double length;
int gpart;
int gpid[20];
double gpx[20];
double gpy[20];
double gpz[20];
double gx[20],gy[20],gz[20];
Float_t theoryLeft;
Float_t theoryRight;
int nhits = 0;
int dpid[105000];
int mpid[105000];
int mtid[105000];
int otid[105000];
double X[105000];
double Y[105000];
double Z[105000];
int procID[105000];
int sector[105000];
//int superlayer[500];
int layer[105000];
int wire[105000];
int dnhits[105000];
TFile *f = new TFile("LH2_0Sol_0Tor_11GeV_0Phi_ShieldOut.root");
TTree *T = (TTree*) f->Get("clas12");
T->GetBranch("GenPart")->GetLeaf("gpart")->SetAddress(&gpart);
T->GetBranch("GenPart")->GetLeaf("pid")->SetAddress(gpid);
T->GetBranch("GenPart")->GetLeaf("px")->SetAddress(gpx);
T->GetBranch("GenPart")->GetLeaf("py")->SetAddress(gpy);
T->GetBranch("GenPart")->GetLeaf("pz")->SetAddress(gpz);
T->GetBranch("GenPart")->GetLeaf("x")->SetAddress(gx);
T->GetBranch("GenPart")->GetLeaf("y")->SetAddress(gy);
T->GetBranch("GenPart")->GetLeaf("z")->SetAddress(gz);
T->Notify();
T->GetLeaf("theoryLeft")->SetAddress(&theoryLeft);
T->GetLeaf("theoryRight")->SetAddress(&theoryRight);
T->Notify();
T->GetBranch("Detector")->GetLeaf("nhits")->SetAddress(&nhits);
T->GetBranch("Detector")->GetLeaf("dpid")->SetAddress(dpid);
T->GetBranch("Detector")->GetLeaf("mpid")->SetAddress(mpid);
T->GetBranch("Detector")->GetLeaf("mtid")->SetAddress(mtid);
T->GetBranch("Detector")->GetLeaf("otid")->SetAddress(otid);
T->GetBranch("Detector")->GetLeaf("X")->SetAddress(X);
T->GetBranch("Detector")->GetLeaf("Y")->SetAddress(Y);
T->GetBranch("Detector")->GetLeaf("Z")->SetAddress(Z);
T->GetBranch("Detector")->GetLeaf("procID")->SetAddress(procID);
T->GetBranch("Detector")->GetLeaf("sector")->SetAddress(sector);
//T->GetBranch("Detector")->GetLeaf("superlayer")->SetAddress(superlayer);
T->GetBranch("Detector")->GetLeaf("layer")->SetAddress(layer);
T->GetBranch("Detector")->GetLeaf("wire")->SetAddress(wire);
T->Notify();
wire_test=1;
for(int i = 0; i < 33400; i++)
{
T->GetEntry(i);
theta=(i*.001)+5;
phi=0.0;
if(wire[0]>wire_test)
{
wire_test=wire_test+1;
length=X[0]*X[0]+Y[0]*Y[0]+Z[0]*Z[0];
length=sqrt(length);
theta=acos(Z[0]/length)*180/3.14159265359;
vector=X[0]*X[0]+Y[0]*Y[0];
vector=sqrt(vector);
phi=acos(X[0]/vector)*180/3.14159265359;
printf("{%.4f , %.4f},",X[0],Z[0]);
}
}
}