ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/mschen/SusyAnalysis/code/testloading.cc
Revision: 1.1
Committed: Mon Mar 28 09:23:54 2011 UTC (14 years, 1 month ago) by mschen
Content type: text/plain
Branch: MAIN
CVS Tags: V2010_data_analysis_effModelInPaper, V2010_data_analysis, HEAD
Error occurred while calculating annotation data.
Log Message:
2010 same sign analysis codeing

File Contents

# Content
1 //FIXME need configure cuts selection
2 #define susy_cxx
3 #include "analysis.h"
4 #include <TH2.h>
5 #include <TStyle.h>
6 #include <TCanvas.h>
7
8 #include <iostream>
9 #include <fstream>
10 #include <math.h>
11 #include <cmath>
12 #include <time.h>
13
14 #include "TLorentzVector.h"
15
16 #include "init.h"
17 #include "utils.h"
18 #include "mcParticle.h"
19 #include "muon.h"
20 #include "electron.h"
21 #include "jet.h"
22 #include "simpleLepton.h"
23 #include "dimuon.h"
24
25 //#include "FakeMuonGenerator.h"
26 #include "ConfigFile.h"
27
28 //#include "GoodRunLumi.C"
29
30 #include "inputbins.h"
31 #include "TRandom3.h"
32
33 using namespace std;
34
35 // already defined in analysis.cc,
36 void analysis::susy()
37 {
38 int SUSYAnalysiType = 2; // 1 for UF, 2 for Imperical C, 3 for UC & FNAL, 4 for MIT, 5 for Aachen, 0 for all paths to get all variables
39 ofstream fout;
40 bool isMontreCarlo;
41 int nEventsToRun=-1;
42 int firstEventToRun=0;
43 int debug = 0;
44 bool bCheckPromptNonPromptLeptons = true;
45 bool bPrepareGarconInput = true;
46 bool bPrepareGarconInThreeChannels = true;
47 int intSplitAnalysis = 0;
48
49 ConfigFile config(sconfigfile.c_str());
50 if(soutputfile==""){
51 config.readInto(soutputfile, "soutputfile", string("test"));
52 }
53 config.readInto(debug, "debug");
54 config.readInto(nEventsToRun, "nEventsToRun", -1);
55 config.readInto(firstEventToRun, "firstEventToRun", 0);
56 config.readInto(bCheckPromptNonPromptLeptons, "bCheckPromptNonPromptLeptons", true);
57 config.readInto(bPrepareGarconInput, "bPrepareGarconInput", true);
58 config.readInto(bPrepareGarconInThreeChannels, "bPrepareGarconInThreeChannels", true);
59 config.readInto(SUSYAnalysiType, "SUSYAnalysiType", 1);
60 config.readInto(intSplitAnalysis, "intSplitAnalysis", 0);
61
62 TString ts;
63
64 if (fChain == 0) return;
65 MySetBranchStatus();
66
67
68 Long64_t nentries = fChain->GetEntriesFast();
69
70 // DEFINITIONS:
71 if (nEventsToRun==-1 || nEventsToRun > nentries )
72 nEventsToRun = nentries;
73 Long64_t nbytes = 0, nb = 0;
74 long nAllEv = nEventsToRun;
75
76 double eventWeight = 1;
77
78 nbytes = 0, nb = 0;
79 cout<<" "<<nEventsToRun<<" to be run"<<endl;
80 long runned = 0;
81 for (Long64_t jentry=0; jentry<nEventsToRun;jentry++) {
82 Long64_t ientry = LoadTree(jentry);if (ientry < 0) break; nb = fChain->GetEntry(jentry); nbytes += nb;
83 if (jentry%10000 == 0)
84 cout << "N events through: " << jentry << endl;
85 runned +=1;
86 isMontreCarlo = !EventAuxiliarly_isRealData;
87
88 vector<Electron*> allEles;
89 vector<Jet*> allJets;
90 vector<Muon*> allMus;
91 vector<mcParticle*> genMus;
92 vector<mcParticle*> genEles;
93 vector<mcParticle*> genParts;
94 vector<Track*> allTracks;
95
96 if(isMontreCarlo){
97 InitGenMuons(genMus);
98 InitGenElectrons(genEles);
99 InitGenParticles(genParts);
100 }
101
102 InitRecoMuons(allMus);
103 InitRecoJets(allJets, 1); // 1 for PFAk5, 2 for AK5Calo
104 InitRecoElectrons(allEles);
105
106 //===================delete object you just newed =============otherwise you will get memory overhead
107 for(int i=0; i<(int)allTracks.size(); i++){
108 if(allTracks[i]) delete allTracks[i];
109 }
110 for(int i=0; i<(int)allJets.size(); i++){
111 if(allJets[i]) delete allJets[i];
112 }
113 for(int i=0; i<(int)allEles.size(); i++){
114 if(allEles[i]) delete allEles[i];
115 }
116 for(int i=0; i<(int)allMus.size(); i++){
117 if(allMus[i]) delete allMus[i];
118 }
119 for(int i=0; i<(int)genMus.size(); i++){
120 if(genMus[i]) delete genMus[i];
121 }
122 for(int i=0; i<(int)genEles.size(); i++){
123 if(genEles[i]) delete genEles[i];
124 }
125 for(int i=0; i<(int)genParts.size(); i++){
126 if(genParts[i]) delete genParts[i];
127 }
128
129 }//for (Long64_t jentry=0; jentry<nEventsToRun;jentry++)
130 cout<<"Total Events Have Been Run = "<<runned<<endl;
131 }//Loop
132