#include <TTree.h>
#include <TFile.h>
#include <map>
#include "./CRTPreProcessTree.h"
#include "./CRTTiming.h"
Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
#define CRTMergePreProcessTrees_CXX |
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 22 of file CRTMergePreProcessTrees.cxx.
24 cout <<
"Opening file for reading with name, '" << argv[1] <<
"'" << endl;
26 cout <<
"Opening new file for writing with name, '" << argv[2] <<
"'" << endl;
43 TTree* fAnaTree =
new TTree(
"anaTree",
"calibrated charge, trigger 'flag', and time ordered entries");
45 fAnaTree->Branch(
"mac5", &fMac5,
"mac5/b");
46 fAnaTree->Branch(
"pe", fPE,
"pe[32]/F");
47 fAnaTree->Branch(
"active", fActive,
"active[32]/O");
48 fAnaTree->Branch(
"maxChan", &fMaxChan,
"maxChan/b");
49 fAnaTree->Branch(
"maxPE", &fMaxPE,
"maxPE/F");
50 fAnaTree->Branch(
"totPE", &fTotPE,
"totPE/F");
51 fAnaTree->Branch(
"nAbove", &fNChanAbove,
"nAbove/b");
52 fAnaTree->Branch(
"above", fAbove,
"above[32]/O");
53 fAnaTree->Branch(
"isNoise", &fIsNoise,
"isNoise/O");
54 fAnaTree->Branch(
"region", &fRegion,
"region/I");
55 fAnaTree->Branch(
"layer", &fLayer,
"layer/I");
56 fAnaTree->Branch(
"t0", &fT0,
"t0/l");
57 fAnaTree->Branch(
"pollRate", &fPollRate,
"pollRate/F");
58 fAnaTree->Branch(
"instRate", &fInstRate,
"instRate/F");
60 TFile fin(argv[1],
"READ");
61 TTree* intree = (TTree*)fin.FindObjectAny(
"anaTree");
65 const map<size_t,size_t>* sortedToRaw = ct.GetOrderedToRawMap();
66 std::cout <<
"done sorting " << sortedToRaw->size() <<
" entries" << std::endl;
69 TFile
fout(argv[2],
"RECREATE");
71 std::cout <<
"filling new, sorted tree..." << std::endl;
72 const size_t nentries = cpt.GetNEntries();
73 for(
size_t i=0; i<nentries; i++) {
76 std::cout << 100.0*i/nentries <<
" % complete" << std::endl;
78 cpt.Load(sortedToRaw->at(i));
81 fIsNoise = cpt.IsNoise();
82 fMaxChan = cpt.MaxChan();
85 fNChanAbove = cpt.NChanAbove();
87 fRegion = cpt.Region();
89 fPollRate = cpt.PollRate();
90 fInstRate = cpt.InstRate();
92 for(
size_t ch=0; ch<32; ch++){
94 fAbove[ch] = cpt.Above(ch);
95 fActive[ch] = cpt.Active(ch);
BEGIN_PROLOG could also be cout