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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines