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