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