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.3 by khahn, Wed Sep 14 21:43:21 2011 UTC vs.
Revision 1.5 by dkralph, Wed Oct 12 17:25:15 2011 UTC

# Line 46 | Line 46 | using namespace std;
46   #include "SampleWeight.h"
47   #include "Selection.h"
48   #include "HZZCiCElectronSelection.h"
49 + #include "HZZLikelihoodElectronSelection.h"
50 + #include "HZZBDTElectronSelection.h"
51   #include "SampleWeight.h"
52  
53   //#define THEIR_EVENTS
# Line 72 | Line 74 | int main(int argc, char** argv)
74    }
75    ctrl.dump();
76  
77 +  map<string,double> entrymap; // number of unskimmed entries in each file
78 +
79    //
80    // File I/O
81    //--------------------------------------------------------------------------------------------------------------
# Line 79 | Line 83 | int main(int argc, char** argv)
83    ifstream f(ctrl.inputfile.c_str());
84    string fname;
85    while (f >> fname) {
86 <    if( !(strncmp( fname.c_str(), "#", 1 ) ) ) continue; // skip commented lines  
86 >    if( !(strncmp( fname.c_str(), "#", 1 ) ) ) continue; // skip commented lines
87      cout << "adding inputfile : " << fname.c_str() << endl;
88 +    entrymap[string(fname.c_str())] = unskimmedEntries(fname.c_str());
89      chain->AddFile(fname.c_str());
90    }
91  
# Line 91 | Line 96 | int main(int argc, char** argv)
96    // Setup
97    //--------------------------------------------------------------------------------------------------------------
98    TH1F * h_evt = new TH1F("hevt", "hevt", 2, 0, 2 );
99 <  TH1F * h_evtfail = new TH1F("hevtfail", "hevtfail", 1024, 0, 1024 );
99 >  TH1F * h_evtfail = new TH1F("hevtfail", "hevtfail", 1024, 0, 1024 );
100    TNtuple * passtuple = new TNtuple( "passtuple", "passtuple", "run:evt:lumi:channel:mZ1:mZ2:m4l:pt4l:w" );
101    initCiCSelection();
102 +  if(ctrl.eleSele=="lik") initLikSelection();
103 +  if(ctrl.eleSele=="bdt") initBDTSelection();
104    initRunLumiRangeMap();
105  
99
106    //
107    // Loop
108    //--------------------------------------------------------------------------------------------------------------
# Line 128 | Line 134 | int main(int argc, char** argv)
134  
135  
136    cout << "nEntries: " << chain->GetEntries() << endl;
137 <  for(UInt_t ientry=0; ientry<chain->GetEntries(); ientry++) {          
138 <    
137 >  for(UInt_t ientry=0; ientry<chain->GetEntries(); ientry++) {
138 >
139      chain->GetEntry(ientry);
140 +    if(!(ientry%100000)) cout << "entry: " << ientry << endl;
141  
142      // get event weight for this file                                                    
143 <    double xs=1,eventweight=1;                                                            
144 <    if(ctrl.mc) eventweight = xstab.Get(getname(chain).c_str()) / chain->GetEntries();    
143 >    double eventweight=1;
144 >    if(ctrl.mc) eventweight = getWeight(xstab,entrymap,chain);
145  
146   #ifdef THEIR_EVENTS
147      if( !( info->evtNum == 504867308  ||
# Line 161 | Line 168 | int main(int argc, char** argv)
168             info->evtNum == 107360878  ) ) continue;
169   #endif
170  
171 <    unsigned evtfail = fails_HZZ4L_selection(ctrl, info, electronArr, muonArr, eventweight, passtuple );    
171 >    unsigned evtfail = fails_HZZ4L_selection(ctrl, info, electronArr, muonArr, eventweight, passtuple);    
172      h_evtfail->Fill( evtfail, eventweight );
173 <    cout << endl << endl;  
173 >    if( ctrl.debug ) cout << endl << endl;  
174            
175    } //end loop over data    
176  
# Line 192 | Line 199 | int main(int argc, char** argv)
199    file->Close();
200    delete file;
201  
202 +  // map<TString,TMVA::Reader*>::iterator it;
203 +  // for(it=readers.begin(); it!=readers.end(); it++) delete (*it).second;
204 +
205    cerr << "done!" << endl;
206   }
207  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines