source: trunk/Mars/macros/mergecamera.C@ 19852

Last change on this file since 19852 was 1869, checked in by moralejo, 22 years ago
*** empty log message ***
File size: 1.9 KB
Line 
1//
2// A. Moralejo, March 2003
3// This macro merges several MC camera files into one. The output files
4// are useful to run Mars over larger samples of triggered events than
5// those contained in a single file.
6//
7
8void mergecamera(Char_t *in="Proton*root", Char_t *out="all.root")
9{
10 cout << endl
11 << "WARNING: this macro merges camera output files, but the" << endl
12 << "Run headers of the resulting file are those of the first" <<endl
13 << "merged file, and so do not represent the whole of the" << endl
14 << "merged events. Be careful not to mix files with different" << endl
15 << "parameters (primary, theta...)." << endl << endl;
16
17 //
18 // Open output file:
19 //
20 TFile* f = new TFile(out,"recreate");
21
22 //
23 // First the Events tree:
24 //
25 MMcEvt* mmcevt = new MMcEvt();;
26 MMcTrig* mmctrig = new MMcTrig();
27 MRawEvtHeader* mrawhead = new MRawEvtHeader();
28 MRawEvtData* mrawdata = new MRawEvtData();
29
30 TChain c("Events");
31 c.SetBranchAddress("MMcEvt",&mmcevt);
32 c.SetBranchAddress("MMcTrig",&mmctrig);
33 c.SetBranchAddress("MRawEvtHeader",&mrawhead);
34 c.SetBranchAddress("MRawEvtData",&mrawdata);
35 c.Add(in);
36 c.Merge(f,1000);
37
38 //
39 // Now the RunHeaders tree:
40 //
41 MMcConfigRunHeader* mcconfig = new MMcConfigRunHeader();
42 MMcCorsikaRunHeader* mccorsi = new MMcCorsikaRunHeader();
43 MMcFadcHeader* mcfadc = new MMcFadcHeader();
44 MMcRunHeader* mcrunhead = new MMcRunHeader();
45 MMcTrigHeader* mctrighead = new MMcTrigHeader();
46 MRawRunHeader* mrawrunhead = new MRawRunHeader();
47 TChain d("RunHeaders");
48 d.SetBranchAddress("MMcConfigRunHeader",&mcconfig);
49 d.SetBranchAddress("MMcCorsikaRunHeader",&mccorsi);
50 d.SetBranchAddress("MMcFadcHeader",&mcfadc);
51 d.SetBranchAddress("MMcRunHeader",&mcrunhead);
52 d.SetBranchAddress("MMcTrigHeader",&mctrighead);
53 d.SetBranchAddress("MRawRunHeader",&mrawrunhead);
54 d.Add(in);
55 d.Merge(f,1000);
56
57 f->Close();
58
59 return;
60}
Note: See TracBrowser for help on using the repository browser.