ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitHzz4l/Selection/src/applySelection.cc
(Generate patch)

Comparing UserCode/MitHzz4l/Selection/src/applySelection.cc (file contents):
Revision 1.2 by dkralph, Wed Sep 14 12:11:57 2011 UTC vs.
Revision 1.8 by khahn, Fri Oct 14 11:20:25 2011 UTC

# Line 37 | Line 37 | using namespace std;
37   #include "TElectron.hh"
38   #include "TMuon.hh"
39   #include "TJet.hh"
40 + #include "SiMVAElectronSelection.h"
41   #include "RunLumiRangeMap.h"
42  
43   //
# Line 46 | Line 47 | using namespace std;
47   #include "SampleWeight.h"
48   #include "Selection.h"
49   #include "HZZCiCElectronSelection.h"
50 + #include "HZZLikelihoodElectronSelection.h"
51 + #include "HZZBDTElectronSelection.h"
52   #include "SampleWeight.h"
53  
54 + //#define BDTFAIL_THEIR_EVENTS
55   //#define THEIR_EVENTS
56  
57   //=== MAIN =================================================================================================
# Line 72 | Line 76 | int main(int argc, char** argv)
76    }
77    ctrl.dump();
78  
79 +  map<string,double> entrymap; // number of unskimmed entries in each file
80 +
81    //
82    // File I/O
83    //--------------------------------------------------------------------------------------------------------------
# Line 79 | Line 85 | int main(int argc, char** argv)
85    ifstream f(ctrl.inputfile.c_str());
86    string fname;
87    while (f >> fname) {
88 <    if( !(strncmp( fname.c_str(), "#", 1 ) ) ) continue; // skip commented lines  
88 >    if( !(strncmp( fname.c_str(), "#", 1 ) ) ) continue; // skip commented lines
89      cout << "adding inputfile : " << fname.c_str() << endl;
90 +    entrymap[string(fname.c_str())] = unskimmedEntries(fname.c_str());
91      chain->AddFile(fname.c_str());
92    }
93  
# Line 91 | Line 98 | int main(int argc, char** argv)
98    // Setup
99    //--------------------------------------------------------------------------------------------------------------
100    TH1F * h_evt = new TH1F("hevt", "hevt", 2, 0, 2 );
101 <  TH1F * h_evtfail = new TH1F("hevtfail", "hevtfail", 100, 0, 100 );
102 <  TNtuple * passtuple = new TNtuple( "passtuple", "passtuple", "run:evt:lumi:channel:mZ1:mZ2:m4l:pt4l:w" );
101 >  TH1F * h_evtfail = new TH1F("hevtfail", "hevtfail", 1024, 0, 1024 );
102 >  //  TNtuple * passtuple = new TNtuple( "passtuple", "passtuple", "run:evt:lumi:channel:mZ1:mZ2:m4l:pt4l:w" );
103 >  TTree * passtuple = new TTree("passtuple", "passtuple" );
104 >  unsigned run, evt, lumi, channel;
105 >  float mZ1, mZ2, m4l, pt4l;
106 >  double w;
107 >  passtuple->Branch("run", &run);
108 >  passtuple->Branch("evt", &evt);
109 >  passtuple->Branch("lumi", &lumi);
110 >  passtuple->Branch("mZ1", &mZ1);
111 >  passtuple->Branch("mZ2", &mZ2);
112 >  passtuple->Branch("m4l", &m4l);
113 >  passtuple->Branch("pt4l", &pt4l);
114 >  passtuple->Branch("w", &w);
115    initCiCSelection();
116 +  if(ctrl.eleSele=="lik") initLikSelection();
117 +  if(ctrl.eleSele=="bdt") initBDTSelection();
118 +  if(ctrl.eleSele=="si" ) initSiMVAElectronSelection();
119    initRunLumiRangeMap();
120  
99
121    //
122    // Loop
123    //--------------------------------------------------------------------------------------------------------------
# Line 128 | Line 149 | int main(int argc, char** argv)
149  
150  
151    cout << "nEntries: " << chain->GetEntries() << endl;
152 <  for(UInt_t ientry=0; ientry<chain->GetEntries(); ientry++) {          
153 <    
152 >  for(UInt_t ientry=0; ientry<chain->GetEntries(); ientry++) {
153 >
154      chain->GetEntry(ientry);
155 +    if(!(ientry%100000)) cout << "entry: " << ientry << endl;
156  
157      // get event weight for this file                                                    
158 <    double xs=1,eventweight=1;                                                            
159 <    if(ctrl.mc) eventweight = xstab.Get(getname(chain).c_str()) / chain->GetEntries();    
158 >    double eventweight=1;
159 >    if(ctrl.mc) eventweight = getWeight(xstab,entrymap,chain);
160  
161   #ifdef THEIR_EVENTS
162      if( !( info->evtNum == 504867308  ||
# Line 160 | Line 182 | int main(int argc, char** argv)
182             info->evtNum == 10347106   ||
183             info->evtNum == 107360878  ) ) continue;
184   #endif
185 +
186  
187 <    unsigned evtfail = fails_HZZ4L_selection(ctrl, info, electronArr, muonArr, eventweight, passtuple );    
187 > #ifdef BDTFAIL_THEIR_EVENTS
188 >    if( !( info->evtNum == 78213037   ||
189 >           info->evtNum == 876658967  ) ) continue;
190 >          
191 > #endif
192 >
193 >    unsigned evtfail = fails_HZZ4L_selection(ctrl, info, electronArr, muonArr, eventweight, passtuple);    
194      h_evtfail->Fill( evtfail, eventweight );
195 <    cout << endl << endl;  
195 >
196            
197    } //end loop over data    
198  
# Line 192 | Line 221 | int main(int argc, char** argv)
221    file->Close();
222    delete file;
223  
224 +  // map<TString,TMVA::Reader*>::iterator it;
225 +  // for(it=readers.begin(); it!=readers.end(); it++) delete (*it).second;
226 +
227    cerr << "done!" << endl;
228   }
229  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines