1 | /***********************************************************************
|
---|
2 | ** **
|
---|
3 | ** /----------------------------------------------\ **
|
---|
4 | ** | Delphes, a framework for the fast simulation | **
|
---|
5 | ** | of a generic collider experiment | **
|
---|
6 | ** \----------------------------------------------/ **
|
---|
7 | ** **
|
---|
8 | ** **
|
---|
9 | ** This package uses: **
|
---|
10 | ** ------------------ **
|
---|
11 | ** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] **
|
---|
12 | ** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] **
|
---|
13 | ** FROG: [hep-ex/0901.2718v1] **
|
---|
14 | ** **
|
---|
15 | ** ------------------------------------------------------------------ **
|
---|
16 | ** **
|
---|
17 | ** Main authors: **
|
---|
18 | ** ------------- **
|
---|
19 | ** **
|
---|
20 | ** Severine Ovyn Xavier Rouby **
|
---|
21 | ** severine.ovyn@uclouvain.be xavier.rouby@cern **
|
---|
22 | ** **
|
---|
23 | ** Center for Particle Physics and Phenomenology (CP3) **
|
---|
24 | ** Universite catholique de Louvain (UCL) **
|
---|
25 | ** Louvain-la-Neuve, Belgium **
|
---|
26 | ** **
|
---|
27 | ** Copyright (C) 2008-2009, **
|
---|
28 | ** All rights reserved. **
|
---|
29 | ** **
|
---|
30 | ***********************************************************************/
|
---|
31 |
|
---|
32 | /// \file Convertors_Only.cpp
|
---|
33 | /// \brief Executable for Convertors
|
---|
34 |
|
---|
35 | #include "TChain.h"
|
---|
36 | #include "TApplication.h"
|
---|
37 | #include "TStopwatch.h"
|
---|
38 | #include "TFile.h"
|
---|
39 |
|
---|
40 | #include "ExRootTreeReader.h"
|
---|
41 | #include "ExRootTreeWriter.h"
|
---|
42 | #include "ExRootTreeBranch.h"
|
---|
43 | #include "ExRootProgressBar.h"
|
---|
44 |
|
---|
45 | #include "DataConverter.h"
|
---|
46 | #include "HEPEVTConverter.h"
|
---|
47 | #include "LHEFConverter.h"
|
---|
48 | #include "STDHEPConverter.h"
|
---|
49 |
|
---|
50 | #include "SmearUtil.h"
|
---|
51 | #include "CaloUtil.h"
|
---|
52 | #include "BFieldProp.h"
|
---|
53 | #include "TriggerUtil.h"
|
---|
54 | #include "VeryForward.h"
|
---|
55 | #include "JetsUtil.h"
|
---|
56 | #include "FrogUtil.h"
|
---|
57 |
|
---|
58 | #include <vector>
|
---|
59 | #include <iostream>
|
---|
60 |
|
---|
61 | using namespace std;
|
---|
62 |
|
---|
63 | //------------------------------------------------------------------------------
|
---|
64 | void todo(string filename) {
|
---|
65 | ifstream infile(filename.c_str());
|
---|
66 | cout << "** TODO list ..." << endl;
|
---|
67 | while(infile.good()) {
|
---|
68 | string temp;
|
---|
69 | getline(infile,temp);
|
---|
70 | cout << "*" << temp << endl;
|
---|
71 | }
|
---|
72 | cout << "** done...\n";
|
---|
73 | }
|
---|
74 |
|
---|
75 | //------------------------------------------------------------------------------
|
---|
76 |
|
---|
77 | int main(int argc, char *argv[])
|
---|
78 | {
|
---|
79 |
|
---|
80 | int appargc = 2;
|
---|
81 | char *appName= new char[20];
|
---|
82 | char *appOpt= new char[20];
|
---|
83 | sprintf(appName,"Convertors");
|
---|
84 | sprintf(appOpt,"-b");
|
---|
85 | char *appargv[] = {appName,appOpt};
|
---|
86 | TApplication app(appName, &appargc, appargv);
|
---|
87 | delete [] appName;
|
---|
88 | delete [] appOpt;
|
---|
89 |
|
---|
90 | if(argc != 3) {
|
---|
91 | cout << " Usage: " << argv[0] << " input_file output_file " << endl;
|
---|
92 | cout << " input_list - list of files in Ntpl, StdHep of LHEF format," << endl;
|
---|
93 | cout << " output_file - output file." << endl;
|
---|
94 | exit(1);
|
---|
95 | }
|
---|
96 |
|
---|
97 |
|
---|
98 |
|
---|
99 |
|
---|
100 | cout << endl << endl;
|
---|
101 |
|
---|
102 | cout <<"*********************************************************************"<< endl;
|
---|
103 | cout <<"*********************************************************************"<< endl;
|
---|
104 | cout <<"** **"<< endl;
|
---|
105 | cout <<"** Welcome to **"<< endl;
|
---|
106 | cout <<"** **"<< endl;
|
---|
107 | cout <<"** **"<< endl;
|
---|
108 | cout <<"** .ddddddd- lL hH **"<< endl;
|
---|
109 | cout <<"** -Dd` `dD: Ll hH` **"<< endl;
|
---|
110 | cout <<"** dDd dDd eeee. lL .pp+pp Hh+hhh` -eeee- `sssss **"<< endl;
|
---|
111 | cout <<"** -Dd `DD ee. ee Ll .Pp. PP Hh. HH. ee. ee sSs **"<< endl;
|
---|
112 | cout <<"** dD` dDd eEeee: lL. pP. pP hH hH` eEeee:` -sSSSs. **"<< endl;
|
---|
113 | cout <<"** .Dd :dd eE. LlL PpppPP Hh Hh eE sSS **"<< endl;
|
---|
114 | cout <<"** dddddd:. eee+: lL. pp. hh. hh eee+ sssssS **"<< endl;
|
---|
115 | cout <<"** Pp **"<< endl;
|
---|
116 | cout <<"** **"<< endl;
|
---|
117 | cout <<"** Delphes, a framework for the fast simulation **"<< endl;
|
---|
118 | cout <<"** of a generic collider experiment **"<< endl;
|
---|
119 | cout <<"** **"<< endl;
|
---|
120 | cout <<"** --- Version 1.4beta of Delphes --- **"<< endl;
|
---|
121 | cout <<"** Last date of change: 9 February 2009 **"<< endl;
|
---|
122 | cout <<"** **"<< endl;
|
---|
123 | cout <<"** **"<< endl;
|
---|
124 | cout <<"** This package uses: **"<< endl;
|
---|
125 | cout <<"** ------------------ **"<< endl;
|
---|
126 | cout <<"** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] **"<< endl;
|
---|
127 | cout <<"** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] **"<< endl;
|
---|
128 | cout <<"** FROG: [hep-ex/0901.2718v1] **"<< endl;
|
---|
129 | cout <<"** **"<< endl;
|
---|
130 | cout <<"**-----------------------------------------------------------------**"<< endl;
|
---|
131 | cout <<"** **"<< endl;
|
---|
132 | cout <<"** Main authors: **"<< endl;
|
---|
133 | cout <<"** ------------- **"<< endl;
|
---|
134 | cout <<"** **"<< endl;
|
---|
135 | cout <<"** Séverine Ovyn Xavier Rouby **"<< endl;
|
---|
136 | cout <<"** severine.ovyn@uclouvain.be xavier.rouby@cern **"<< endl;
|
---|
137 | cout <<"** Center for Particle Physics and Phenomenology (CP3) **"<< endl;
|
---|
138 | cout <<"** Universite Catholique de Louvain (UCL) **"<< endl;
|
---|
139 | cout <<"** Louvain-la-Neuve, Belgium **"<< endl;
|
---|
140 | cout <<"** **"<< endl;
|
---|
141 | cout <<"**-----------------------------------------------------------------**"<< endl;
|
---|
142 | cout <<"** **"<< endl;
|
---|
143 | cout <<"** Former Delphes versions and documentation can be found on : **"<< endl;
|
---|
144 | cout <<"** http://www.fynu.ucl.ac.be/delphes.html **"<< endl;
|
---|
145 | cout <<"** **"<< endl;
|
---|
146 | cout <<"** **"<< endl;
|
---|
147 | cout <<"** Disclaimer: this program is a beta version of Delphes and **"<< endl;
|
---|
148 | cout <<"** therefore comes without guarantees. Beware of errors and please **"<< endl;
|
---|
149 | cout <<"** give us your feedbacks about potential bugs **"<< endl;
|
---|
150 | cout <<"** **"<< endl;
|
---|
151 | cout <<"*********************************************************************"<< endl;
|
---|
152 | cout <<"*********************************************************************"<< endl;
|
---|
153 |
|
---|
154 | // 1. ********** initialisation ***********
|
---|
155 |
|
---|
156 | srand (time (NULL)); /* Initialisation du générateur */
|
---|
157 | TStopwatch globalwatch, loopwatch, triggerwatch, frogwatch;
|
---|
158 | globalwatch.Start();
|
---|
159 |
|
---|
160 |
|
---|
161 | //read the output TROOT file
|
---|
162 | string inputFileList(argv[1]), outputfilename(argv[2]);
|
---|
163 | if(outputfilename.find(".root") > outputfilename.length()) {
|
---|
164 | cout <<"** ERROR: 'output_file' should be a .root file. Exiting... **"<< endl;
|
---|
165 | exit(1);
|
---|
166 | }
|
---|
167 |
|
---|
168 | TFile *outputFile = TFile::Open(outputfilename.c_str(), "RECREATE"); // Creates the file, but should be closed just after
|
---|
169 | outputFile->Close();
|
---|
170 |
|
---|
171 | string line;
|
---|
172 | ifstream infile(inputFileList.c_str());
|
---|
173 | infile >> line; // the first line determines the type of input files
|
---|
174 |
|
---|
175 | // data converters
|
---|
176 | DataConverter *converter=NULL;
|
---|
177 | cout <<"** **"<<endl;
|
---|
178 | cout <<"** ####### Start convertion to TRoot format ######## **"<< endl;
|
---|
179 |
|
---|
180 | if(strstr(line.c_str(),".hep"))
|
---|
181 | {
|
---|
182 | cout <<"** StdHEP file format detected **"<<endl;
|
---|
183 | cout <<"** This can take several minutes **"<< endl;
|
---|
184 | converter = new STDHEPConverter(inputFileList,outputfilename);//case ntpl file in input list
|
---|
185 | }
|
---|
186 | else if(strstr(line.c_str(),".lhe"))
|
---|
187 | {
|
---|
188 | cout <<"** LHEF file format detected **"<<endl;
|
---|
189 | cout <<"** This can take several minutes **"<< endl;
|
---|
190 | converter = new LHEFConverter(inputFileList,outputfilename);//case ntpl file in input list
|
---|
191 | }
|
---|
192 | else if(strstr(line.c_str(),".root"))
|
---|
193 | {
|
---|
194 | cout <<"** h2root file format detected **"<<endl;
|
---|
195 | cout <<"** This can take several minutes **"<< endl;
|
---|
196 | converter = new HEPEVTConverter(inputFileList,outputfilename);//case ntpl file in input list
|
---|
197 | }
|
---|
198 | else {
|
---|
199 | cerr << left << setw(4) <<"** "<<""
|
---|
200 | << left << setw(63) << line.c_str() <<""
|
---|
201 | << right << setw(2) <<"**"<<endl;
|
---|
202 | cerr <<"** ERROR: File format not identified -- Exiting... **"<< endl;
|
---|
203 | cout <<"** **"<< endl;
|
---|
204 | cout <<"*********************************************************************"<< endl;
|
---|
205 | return -1;};
|
---|
206 | cout <<"** Exiting conversion... **"<< endl;
|
---|
207 | cout <<"*********************************************************************"<< endl;
|
---|
208 | cout <<"*********************************************************************"<< endl;
|
---|
209 |
|
---|
210 |
|
---|
211 | delete converter;
|
---|
212 |
|
---|
213 | }
|
---|