Skip to content
Snippets Groups Projects
Commit 44159e9f authored by Chad Lantz's avatar Chad Lantz
Browse files

Cleared vectors because I forgot to do that

parent 7e17d9b2
No related branches found
No related tags found
No related merge requests found
#include "TFile.h"
#include "TH1F.h"
#include "TH2F.h"
#include "TF1.h"
#include "TRandom.h"
#include <TTree.h>
#include <vector>
......@@ -81,11 +81,13 @@ void cutZDCoutput(string fileName, string rod, double xOffset, double zOffset){
for(int bin = 0; bin < nBins; bin++){
hTrans->SetBinContent( bin, transData[bin] );
}
if(rod == "fusedQuartz"){
TF1* bLine = new TF1("baseline","0.0883*log(0.013087*(x-156.8) ) + 0.802",197,1028);
hTrans->Multiply(bLine);
}
//Get the number of events in the file
int nEvents = inTree->GetEntries();
//Find out how many events contain photons
float wl;
int realNevents = 0;
......@@ -113,7 +115,7 @@ void cutZDCoutput(string fileName, string rod, double xOffset, double zOffset){
// get the data from the appropriate bin.
wl = 1240./energy;
if(wl < 197.2888){
hTrans->GetBinContent(1);
trans = hTrans->GetBinContent(1);
}else{
trans = hTrans->GetBinContent( hTrans->GetBin( wl ) );
}
......@@ -127,7 +129,7 @@ void cutZDCoutput(string fileName, string rod, double xOffset, double zOffset){
x->push_back( X );
z->push_back( Z );
//We only want momentum direction, not magnitude
//We want momentum direction, not magnitude
Px/=energy;
Py/=energy;
Pz/=energy;
......@@ -149,6 +151,14 @@ void cutZDCoutput(string fileName, string rod, double xOffset, double zOffset){
outTree->Fill();
totalCut += nCut;
totalPhotons += nPhotons;
//Clear vectors
x->clear();
z->clear();
px->clear();
py->clear();
pz->clear();
Energy->clear();
}//end loop over events
cout << Form("%5d of %5d photons cut %3.0f%%",totalCut,totalPhotons,100.*(float)totalCut/(float)totalPhotons ) << endl;
inFile->Close();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment