Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:14:40

0001 #include <vector>
0002 
0003 #include "TROOT.h"
0004 #include "TFile.h"
0005 #include "TDirectory.h"
0006 #include "TChain.h"
0007 #include "TObject.h"
0008 #include "TCanvas.h"
0009 #include "TMath.h"
0010 #include "TLegend.h"
0011 #include "TGraph.h"
0012 #include "TH1.h"
0013 #include "TH2.h"
0014 #include "TH3.h"
0015 #include "TTree.h"
0016 #include "TF1.h"
0017 #include "TPaveText.h"
0018 
0019 
0020 void KeepOnlyGain()
0021 {
0022    TChain* tree = new TChain("SiStripCalib/APVGain");
0023    tree->Add("Gains_Tree.root");
0024 
0025 
0026    TFile* out_file = new TFile("Gains.root","recreate");
0027    TDirectory* out_dir = out_file->mkdir("SiStripCalib","SiStripCalib");
0028    out_dir->cd();
0029 
0030 
0031    TTree* out_tree = tree->CloneTree(0);
0032    out_tree->SetName("APVGain");
0033    out_tree->Write();
0034 
0035    int TreeStep = tree->GetEntries()/50;if(TreeStep==0)TreeStep=1;
0036    for (unsigned int ientry = 0; ientry < tree->GetEntries(); ientry++) {
0037       if(ientry%TreeStep==0){printf(".");fflush(stdout);}
0038       tree->GetEntry(ientry);
0039       out_tree->Fill();
0040    }printf("\n");
0041 
0042    out_file->Write();
0043    out_file->Close();
0044 
0045 }
0046 
0047 
0048 
0049 
0050 
0051