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 LHCO_Only.cpp
|
---|
33 | /// \brief standalone executable for running the LHCO-converter
|
---|
34 |
|
---|
35 | #include "TChain.h"
|
---|
36 | #include "TFile.h"
|
---|
37 | #include "TApplication.h"
|
---|
38 | #include "LHCOConverter.h"
|
---|
39 |
|
---|
40 | #include "ExRootTreeReader.h"
|
---|
41 | #include "ExRootTreeWriter.h"
|
---|
42 | #include "ExRootTreeBranch.h"
|
---|
43 | #include "BlockClasses.h"
|
---|
44 |
|
---|
45 | #include <iostream>
|
---|
46 | #include <vector>
|
---|
47 | #include <fstream>
|
---|
48 | #include <iomanip>
|
---|
49 |
|
---|
50 |
|
---|
51 | using namespace std;
|
---|
52 |
|
---|
53 |
|
---|
54 | int main(int argc, char *argv[])
|
---|
55 | {
|
---|
56 | int appargc = 2;
|
---|
57 | char *appName= new char[20];
|
---|
58 | char *appOpt= new char[20];
|
---|
59 | sprintf(appName,"LHCO_Only");
|
---|
60 | sprintf(appOpt,"-b");
|
---|
61 | char *appargv[] = {appName,appOpt};
|
---|
62 | TApplication app(appName, &appargc, appargv);
|
---|
63 | delete [] appName;
|
---|
64 | delete [] appOpt;
|
---|
65 |
|
---|
66 | if(argc != 2 && argc !=3 ) {
|
---|
67 | cout << " Usage: " << argv[0] << " input_file [runlog_file] " << endl;
|
---|
68 | cout << " input_file - file in Delphes root format," << endl;
|
---|
69 | cout << " [runlog_file] - the corresponding log file (optional) "<<endl;
|
---|
70 | exit(1);
|
---|
71 | }
|
---|
72 |
|
---|
73 | string rootfile = argv[1];
|
---|
74 | TFile ftest(rootfile.c_str(),"READ");
|
---|
75 | if (!ftest.IsOpen()) { cout << "ERROR: file " << rootfile << " not found\n"; return -1;}
|
---|
76 | ftest.Close();
|
---|
77 |
|
---|
78 | string logfile;
|
---|
79 | if(argc ==3) logfile=argv[2];
|
---|
80 | LHCOConverter converter(rootfile,logfile);
|
---|
81 | converter.CopyRunLogFile();
|
---|
82 | /*
|
---|
83 | //read the input TROOT file
|
---|
84 | string inputFile(argv[1]);
|
---|
85 |
|
---|
86 | //create output log-file name
|
---|
87 | string forLog = inputFile;
|
---|
88 | string LogName = forLog.erase(forLog.find(".root"));
|
---|
89 | LogName = LogName+"_run.log";
|
---|
90 |
|
---|
91 | string line,buffer;
|
---|
92 | TChain chain("Analysis");
|
---|
93 | chain.Add(inputFile.c_str());
|
---|
94 | ExRootTreeReader *treeReaderT = new ExRootTreeReader(&chain);
|
---|
95 |
|
---|
96 | //read the datacard input file
|
---|
97 | string LogRunFile("");
|
---|
98 | if(argc==3) LogRunFile =argv[2];
|
---|
99 |
|
---|
100 | //Trigger information
|
---|
101 | TriggerTable *TRIGT = new TriggerTable();
|
---|
102 | TRIGT->TriggerCardReader(TrigDatacard.c_str());
|
---|
103 | TRIGT->PrintTriggerTable(LogName);
|
---|
104 |
|
---|
105 | TClonesArray *branchElecTrig = treeReaderT->UseBranch("Electron");
|
---|
106 | TClonesArray *branchMuonTrig = treeReaderT->UseBranch("Muon");
|
---|
107 | TClonesArray *branchJetTrig = treeReaderT->UseBranch("Jet");
|
---|
108 | TClonesArray *branchTauJetTrig = treeReaderT->UseBranch("TauJet");
|
---|
109 | TClonesArray *branchPhotonTrig = treeReaderT->UseBranch("Photon");
|
---|
110 | TClonesArray *branchETmisTrig = treeReaderT->UseBranch("ETmis");
|
---|
111 |
|
---|
112 | ExRootTreeWriter *treeWriterT = new ExRootTreeWriter(inputFile, "Trigger");
|
---|
113 | ExRootTreeBranch *branchTrigger = treeWriterT->NewBranch("TrigResult", TRootTrigger::Class());
|
---|
114 |
|
---|
115 | Long64_t entryT, allEntriesT = treeReaderT->GetEntries();
|
---|
116 | cout << "** Chain contains " << allEntriesT << " events" << endl;
|
---|
117 | for(entryT = 0; entryT < allEntriesT; ++entryT)
|
---|
118 | {
|
---|
119 | treeWriterT->Clear();
|
---|
120 | treeReaderT->ReadEntry(entryT);
|
---|
121 | TRIGT->GetGlobalResult(branchElecTrig, branchMuonTrig,branchJetTrig, branchTauJetTrig,branchPhotonTrig, branchETmisTrig,branchTrigger);
|
---|
122 | treeWriterT->Fill();
|
---|
123 | }
|
---|
124 |
|
---|
125 | treeWriterT->Write();
|
---|
126 | delete treeWriterT;
|
---|
127 | delete TRIGT;
|
---|
128 | */
|
---|
129 |
|
---|
130 | cout << "** Exiting..." << endl;
|
---|
131 |
|
---|
132 | }
|
---|
133 |
|
---|