Fork me on GitHub

source: svn/trunk/Examples/Convertors_Only.cpp@ 766

Last change on this file since 766 was 464, checked in by Xavier Rouby, 15 years ago

minor change : cout of the output

File size: 11.2 KB
Line 
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
64using namespace std;
65
66//------------------------------------------------------------------------------
67
68int 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
92cout << endl << endl;
93
94cout <<"*********************************************************************"<< endl;
95cout <<"*********************************************************************"<< endl;
96cout <<"** **"<< endl;
97cout <<"** Welcome to **"<< endl;
98cout <<"** **"<< endl;
99cout <<"** **"<< endl;
100cout <<"** .ddddddd- lL hH **"<< endl;
101cout <<"** -Dd` `dD: Ll hH` **"<< endl;
102cout <<"** dDd dDd eeee. lL .pp+pp Hh+hhh` -eeee- `sssss **"<< endl;
103cout <<"** -Dd `DD ee. ee Ll .Pp. PP Hh. HH. ee. ee sSs **"<< endl;
104cout <<"** dD` dDd eEeee: lL. pP. pP hH hH` eEeee:` -sSSSs. **"<< endl;
105cout <<"** .Dd :dd eE. LlL PpppPP Hh Hh eE sSS **"<< endl;
106cout <<"** dddddd:. eee+: lL. pp. hh. hh eee+ sssssS **"<< endl;
107cout <<"** Pp **"<< endl;
108cout <<"** **"<< endl;
109cout <<"** Delphes, a framework for the fast simulation **"<< endl;
110cout <<"** of a generic collider experiment **"<< endl;
111cout <<"** **"<< endl;
112cout <<"** --- Version 1.4beta of Delphes --- **"<< endl;
113cout <<"** Last date of change: 9 February 2009 **"<< endl;
114cout <<"** **"<< endl;
115cout <<"** **"<< endl;
116cout <<"** This package uses: **"<< endl;
117cout <<"** ------------------ **"<< endl;
118cout <<"** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] **"<< endl;
119cout <<"** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] **"<< endl;
120cout <<"** FROG: [hep-ex/0901.2718v1] **"<< endl;
121cout <<"** **"<< endl;
122cout <<"**-----------------------------------------------------------------**"<< endl;
123cout <<"** **"<< endl;
124cout <<"** Main authors: **"<< endl;
125cout <<"** ------------- **"<< endl;
126cout <<"** **"<< endl;
127cout <<"** Séverine Ovyn Xavier Rouby **"<< endl;
128cout <<"** severine.ovyn@uclouvain.be xavier.rouby@cern **"<< endl;
129cout <<"** Center for Particle Physics and Phenomenology (CP3) **"<< endl;
130cout <<"** Universite Catholique de Louvain (UCL) **"<< endl;
131cout <<"** Louvain-la-Neuve, Belgium **"<< endl;
132cout <<"** **"<< endl;
133cout <<"**-----------------------------------------------------------------**"<< endl;
134cout <<"** **"<< endl;
135cout <<"** Former Delphes versions and documentation can be found on : **"<< endl;
136cout <<"** http://www.fynu.ucl.ac.be/delphes.html **"<< endl;
137cout <<"** **"<< endl;
138cout <<"** **"<< endl;
139cout <<"** Disclaimer: this program is a beta version of Delphes and **"<< endl;
140cout <<"** therefore comes without guarantees. Beware of errors and please **"<< endl;
141cout <<"** give us your feedbacks about potential bugs **"<< endl;
142cout <<"** **"<< endl;
143cout <<"*********************************************************************"<< endl;
144cout <<"*********************************************************************"<< 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.rfind(".hepmc") < line.length())
176 {
177 cout <<"** HepMC ASCII file format detected **"<<endl;
178 cout <<"** This can take several minutes **"<< endl;
179 HepMCConverter converter(inputFileList,outputfilename,DET.PDGtable,DET.NEvents);
180 }
181 else if(line.rfind(".hep") < line.length())
182 {
183 cout <<"** StdHEP file format detected **"<<endl;
184 cout <<"** This can take several minutes **"<< endl;
185 STDHEPConverter converter(inputFileList,outputfilename,DET.PDGtable,DET.NEvents);
186 }
187 else if(line.rfind(".lhe") < line.length())
188 {
189 cout <<"** LHEF file format detected **"<<endl;
190 cout <<"** This can take several minutes **"<< endl;
191 LHEFConverter converter(inputFileList,outputfilename,DET.PDGtable,DET.NEvents);
192 }
193 else if(line.rfind(".root") < line.length())
194 {
195 cout <<"** h2root file format detected **"<<endl;
196 cout <<"** This can take several minutes **"<< endl;
197 HEPEVTConverter converter(inputFileList,outputfilename,DET.PDGtable,DET.NEvents);
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 string temp = outputfilename + " has been created ";
209 cout << left << setw(20) << "** " <<"" << left << setw(30) << temp << ""
210 << right << setw(19) << "**" << endl;
211 cout <<"** Exiting conversion... **"<< endl;
212 cout <<"*********************************************************************"<< endl;
213 cout <<"*********************************************************************"<< endl;
214
215
216
217}
Note: See TracBrowser for help on using the repository browser.