Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:32:23

0001 // -*- C++ -*-
0002 
0003 #include <iostream>
0004 
0005 // CMS includes
0006 #include "PhysicsTools/FWLite/interface/TH1Store.h"
0007 
0008 // Root includes
0009 #include "TROOT.h"
0010 
0011 using namespace std;
0012 
0013 ///////////////////////////
0014 // ///////////////////// //
0015 // // Main Subroutine // //
0016 // ///////////////////// //
0017 ///////////////////////////
0018 
0019 int main(int argc, char* argv[]) {
0020   cout << "creating store" << endl;
0021   TH1Store store;
0022 
0023   cout << "adding histograms" << endl;
0024   store.add(new TH1F("aaa", "aaa", 10, 0.5, 10.5));
0025   store.add(new TH1F("bbb", "bbb", 10, 0.5, 10.5), "one/two");
0026   store.add(new TH1F("ccc", "ccc", 10, 0.5, 10.5), "three");
0027   store.add(new TH1F("ddd", "ddd", 10, 0.5, 10.5), "one");
0028   store.add(new TH1F("eee", "eee", 10, 0.5, 10.5), "three/four");
0029 
0030   cout << "filling" << endl;
0031   store.hist("aaa")->Fill(1);
0032   store.hist("bbb")->Fill(2);
0033   store.hist("ccc")->Fill(3);
0034   store.hist("ddd")->Fill(4);
0035   store.hist("eee")->Fill(5);
0036 
0037   cout << "saving" << endl;
0038   store.write("test.root");
0039   cout << "done!" << endl;
0040   // All done!  Bye bye.
0041   return 0;
0042 }