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.7 by khahn, Thu Oct 13 14:27:53 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", 100, 0, 100 );
100 <  TNtuple * passtuple = new TNtuple( "passtuple", "passtuple", "run:evt:lumi:channel:mZ1:mZ2:m4l:pt4l:w" );
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 >  TTree * passtuple = new TTree("passtuple", "passtuple" );
102 >  unsigned run, evt, lumi, channel;
103 >  float mZ1, mZ2, m4l, pt4l;
104 >  double w;
105 >  passtuple->Branch("run", &run);
106 >  passtuple->Branch("evt", &evt);
107 >  passtuple->Branch("lumi", &lumi);
108 >  passtuple->Branch("mZ1", &mZ1);
109 >  passtuple->Branch("mZ2", &mZ2);
110 >  passtuple->Branch("m4l", &m4l);
111 >  passtuple->Branch("pt4l", &pt4l);
112 >  passtuple->Branch("w", &w);
113    initCiCSelection();
114 +  if(ctrl.eleSele=="lik") initLikSelection();
115 +  if(ctrl.eleSele=="bdt") initBDTSelection();
116    initRunLumiRangeMap();
117  
99
118    //
119    // Loop
120    //--------------------------------------------------------------------------------------------------------------
# Line 128 | Line 146 | int main(int argc, char** argv)
146  
147  
148    cout << "nEntries: " << chain->GetEntries() << endl;
149 <  for(UInt_t ientry=0; ientry<chain->GetEntries(); ientry++) {          
150 <    
149 >  for(UInt_t ientry=0; ientry<chain->GetEntries(); ientry++) {
150 >
151      chain->GetEntry(ientry);
152 +    if(!(ientry%100000)) cout << "entry: " << ientry << endl;
153  
154      // get event weight for this file                                                    
155 <    double xs=1,eventweight=1;                                                            
156 <    if(ctrl.mc) eventweight = xstab.Get(getname(chain).c_str()) / chain->GetEntries();    
155 >    double eventweight=1;
156 >    if(ctrl.mc) eventweight = getWeight(xstab,entrymap,chain);
157  
158   #ifdef THEIR_EVENTS
159      if( !( info->evtNum == 504867308  ||
# Line 161 | Line 180 | int main(int argc, char** argv)
180             info->evtNum == 107360878  ) ) continue;
181   #endif
182  
183 <    unsigned evtfail = fails_HZZ4L_selection(ctrl, info, electronArr, muonArr, eventweight, passtuple );    
183 >    unsigned evtfail = fails_HZZ4L_selection(ctrl, info, electronArr, muonArr, eventweight, passtuple);    
184      h_evtfail->Fill( evtfail, eventweight );
185 <    cout << endl << endl;  
185 >    if( ctrl.debug ) cout << endl << endl;  
186            
187    } //end loop over data    
188  
# Line 192 | Line 211 | int main(int argc, char** argv)
211    file->Close();
212    delete file;
213  
214 +  // map<TString,TMVA::Reader*>::iterator it;
215 +  // for(it=readers.begin(); it!=readers.end(); it++) delete (*it).second;
216 +
217    cerr << "done!" << endl;
218   }
219  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines