Fork me on GitHub

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

Last change on this file since 441 was 415, checked in by Xavier Rouby, 16 years ago

faute d'orthographe

File size: 11.0 KB
Line 
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
62using namespace std;
63
64//------------------------------------------------------------------------------
65
66int 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
90cout << endl << endl;
91
92cout <<"*********************************************************************"<< endl;
93cout <<"*********************************************************************"<< endl;
94cout <<"** **"<< endl;
95cout <<"** Welcome to **"<< endl;
96cout <<"** **"<< endl;
97cout <<"** **"<< endl;
98cout <<"** .ddddddd- lL hH **"<< endl;
99cout <<"** -Dd` `dD: Ll hH` **"<< endl;
100cout <<"** dDd dDd eeee. lL .pp+pp Hh+hhh` -eeee- `sssss **"<< endl;
101cout <<"** -Dd `DD ee. ee Ll .Pp. PP Hh. HH. ee. ee sSs **"<< endl;
102cout <<"** dD` dDd eEeee: lL. pP. pP hH hH` eEeee:` -sSSSs. **"<< endl;
103cout <<"** .Dd :dd eE. LlL PpppPP Hh Hh eE sSS **"<< endl;
104cout <<"** dddddd:. eee+: lL. pp. hh. hh eee+ sssssS **"<< endl;
105cout <<"** Pp **"<< endl;
106cout <<"** **"<< endl;
107cout <<"** Delphes, a framework for the fast simulation **"<< endl;
108cout <<"** of a generic collider experiment **"<< endl;
109cout <<"** **"<< endl;
110cout <<"** --- Version 1.4beta of Delphes --- **"<< endl;
111cout <<"** Last date of change: 9 February 2009 **"<< endl;
112cout <<"** **"<< endl;
113cout <<"** **"<< endl;
114cout <<"** This package uses: **"<< endl;
115cout <<"** ------------------ **"<< endl;
116cout <<"** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] **"<< endl;
117cout <<"** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] **"<< endl;
118cout <<"** FROG: [hep-ex/0901.2718v1] **"<< endl;
119cout <<"** **"<< endl;
120cout <<"**-----------------------------------------------------------------**"<< endl;
121cout <<"** **"<< endl;
122cout <<"** Main authors: **"<< endl;
123cout <<"** ------------- **"<< endl;
124cout <<"** **"<< endl;
125cout <<"** Séverine Ovyn Xavier Rouby **"<< endl;
126cout <<"** severine.ovyn@uclouvain.be xavier.rouby@cern **"<< endl;
127cout <<"** Center for Particle Physics and Phenomenology (CP3) **"<< endl;
128cout <<"** Universite Catholique de Louvain (UCL) **"<< endl;
129cout <<"** Louvain-la-Neuve, Belgium **"<< endl;
130cout <<"** **"<< endl;
131cout <<"**-----------------------------------------------------------------**"<< endl;
132cout <<"** **"<< endl;
133cout <<"** Former Delphes versions and documentation can be found on : **"<< endl;
134cout <<"** http://www.fynu.ucl.ac.be/delphes.html **"<< endl;
135cout <<"** **"<< endl;
136cout <<"** **"<< endl;
137cout <<"** Disclaimer: this program is a beta version of Delphes and **"<< endl;
138cout <<"** therefore comes without guarantees. Beware of errors and please **"<< endl;
139cout <<"** give us your feedbacks about potential bugs **"<< endl;
140cout <<"** **"<< endl;
141cout <<"*********************************************************************"<< endl;
142cout <<"*********************************************************************"<< 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 conversion 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}
Note: See TracBrowser for help on using the repository browser.