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