1 | /***********************************************************************
|
---|
2 | ** **
|
---|
3 | ** /----------------------------------------------\ **
|
---|
4 | ** | Delphes, a framework for the fast simulation | **
|
---|
5 | ** | of a generic collider experiment | **
|
---|
6 | ** \------------- arXiv:0903.2225v1 ------------/ **
|
---|
7 | ** **
|
---|
8 | ** **
|
---|
9 | ** This package uses: **
|
---|
10 | ** ------------------ **
|
---|
11 | ** ROOT: Nucl. Inst. & Meth. in Phys. Res. A389 (1997) 81-86 **
|
---|
12 | ** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] **
|
---|
13 | ** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] **
|
---|
14 | ** FROG: [hep-ex/0901.2718v1] **
|
---|
15 | ** HepMC: Comput. Phys. Commun.134 (2001) 41 **
|
---|
16 | ** **
|
---|
17 | ** ------------------------------------------------------------------ **
|
---|
18 | ** **
|
---|
19 | ** Main authors: **
|
---|
20 | ** ------------- **
|
---|
21 | ** **
|
---|
22 | ** Severine Ovyn Xavier Rouby **
|
---|
23 | ** severine.ovyn@uclouvain.be xavier.rouby@cern **
|
---|
24 | ** **
|
---|
25 | ** Center for Particle Physics and Phenomenology (CP3) **
|
---|
26 | ** Universite catholique de Louvain (UCL) **
|
---|
27 | ** Louvain-la-Neuve, Belgium **
|
---|
28 | ** **
|
---|
29 | ** Copyright (C) 2008-2009, **
|
---|
30 | ** All rights reserved. **
|
---|
31 | ** **
|
---|
32 | ***********************************************************************/
|
---|
33 |
|
---|
34 | #include <iostream>
|
---|
35 | #include <fstream>
|
---|
36 |
|
---|
37 | #include "TString.h"
|
---|
38 | #include "TApplication.h"
|
---|
39 | #include "TChain.h"
|
---|
40 | #include "TFile.h"
|
---|
41 | #include <string>
|
---|
42 |
|
---|
43 | #include "ExRootTreeReader.h"
|
---|
44 | #include "ExRootTreeWriter.h"
|
---|
45 | #include "ExRootTreeBranch.h"
|
---|
46 | #include "BlockClasses.h"
|
---|
47 | #include "TSimpleArray.h"
|
---|
48 |
|
---|
49 | #include "Examples/interface/Analysis_Ex.h"
|
---|
50 | using namespace std;
|
---|
51 |
|
---|
52 | //------------------------------------------------------------------------------
|
---|
53 |
|
---|
54 | int main(int argc, char *argv[])
|
---|
55 | {
|
---|
56 | int appargc = 2;
|
---|
57 | char *appName= new char[20];
|
---|
58 | char *appOpt= new char[20];
|
---|
59 | sprintf(appName,"Analysis_Ex");
|
---|
60 | sprintf(appOpt,"-b");
|
---|
61 | char *appargv[] = {appName,appOpt};
|
---|
62 | TApplication app(appName, &appargc, appargv);
|
---|
63 | delete [] appName;
|
---|
64 | delete [] appOpt;
|
---|
65 |
|
---|
66 | if(argc !=3)
|
---|
67 | {
|
---|
68 | cout << " Usage: " << argv[0] << " input_file" << " [runs_list]" << endl;
|
---|
69 | cout << " input_list - list of files in Delphe ROOT format ('GEN, Analysis and Trigger ' trees )," << endl;
|
---|
70 | cout << " output file - name of the output analysis root file." << endl;
|
---|
71 | exit(1);
|
---|
72 | }
|
---|
73 |
|
---|
74 | //*****************************************************************************
|
---|
75 | //************************Input files to the analysis**************************
|
---|
76 | //*****************************************************************************
|
---|
77 | TString inputFileList(argv[1]);
|
---|
78 | string buffer;
|
---|
79 | TChain chainGen("GEN");//generator level information
|
---|
80 | TChain chainRec("Analysis");//reconstructed level infomration
|
---|
81 | TChain chainTrig("Trigger");//trigger information
|
---|
82 |
|
---|
83 | //run on the input file list of Delphe ROOT files
|
---|
84 | ifstream infile(inputFileList);
|
---|
85 | if(!infile.is_open())
|
---|
86 | {
|
---|
87 | cerr << "** ERROR: Can't open '" << inputFileList << "' for input" << endl;
|
---|
88 | exit(1);
|
---|
89 | }
|
---|
90 | while(1)
|
---|
91 | {
|
---|
92 | if(!infile.good()) break;
|
---|
93 | infile >> buffer;
|
---|
94 | chainGen.Add(buffer.c_str());
|
---|
95 | chainRec.Add(buffer.c_str());
|
---|
96 | chainTrig.Add(buffer.c_str());
|
---|
97 | }
|
---|
98 |
|
---|
99 |
|
---|
100 | //*****************************************************************************
|
---|
101 | //*********************Output root file of the analysis************************
|
---|
102 | //*****************************************************************************
|
---|
103 | ExRootTreeReader *treeReaderGen = new ExRootTreeReader(&chainGen);
|
---|
104 | ExRootTreeReader *treeReaderRec = new ExRootTreeReader(&chainRec);
|
---|
105 | ExRootTreeReader *treeReaderTrig = new ExRootTreeReader(&chainTrig);
|
---|
106 |
|
---|
107 | //create output file containing selection information
|
---|
108 | string forLog = argv[2];
|
---|
109 | string LogName = forLog.erase(forLog.find(".root"));
|
---|
110 | LogName = LogName+"_cut.txt";
|
---|
111 | ofstream f_out(LogName.c_str(),ofstream::app);
|
---|
112 |
|
---|
113 | //create the output tree
|
---|
114 | string outputfilename = argv[2];
|
---|
115 | TFile *outputFile = TFile::Open(outputfilename.c_str(), "RECREATE"); // Creates the file, but should be closed just after
|
---|
116 | outputFile->Close();
|
---|
117 |
|
---|
118 | ExRootTreeWriter *treeWriter = new ExRootTreeWriter(outputfilename, "Analysis");
|
---|
119 |
|
---|
120 | //*****************************************************************************
|
---|
121 | //***************************Run the analysis**********************************
|
---|
122 | //*****************************************************************************
|
---|
123 |
|
---|
124 | Analysis_Ex *DefaultOne = new Analysis_Ex("Examples/Datacard_Analysis_Ex.dat",LogName);
|
---|
125 | DefaultOne->Run(treeReaderGen,treeReaderRec,treeReaderTrig,treeWriter);
|
---|
126 | DefaultOne->WriteOutput(LogName);
|
---|
127 | delete DefaultOne;
|
---|
128 |
|
---|
129 | cout << "** Exiting..." << endl;
|
---|
130 | delete treeReaderGen;
|
---|
131 | delete treeReaderRec;
|
---|
132 | delete treeReaderTrig;
|
---|
133 | }
|
---|
134 |
|
---|