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.4 by dkralph, Thu Sep 22 18:01:19 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 "SampleWeight.h"
51  
52   //#define THEIR_EVENTS
# Line 72 | Line 73 | int main(int argc, char** argv)
73    }
74    ctrl.dump();
75  
76 +  map<string,double> entrymap; // number of unskimmed entries in each file
77 +
78    //
79    // File I/O
80    //--------------------------------------------------------------------------------------------------------------
# Line 79 | Line 82 | int main(int argc, char** argv)
82    ifstream f(ctrl.inputfile.c_str());
83    string fname;
84    while (f >> fname) {
85 <    if( !(strncmp( fname.c_str(), "#", 1 ) ) ) continue; // skip commented lines  
85 >    if( !(strncmp( fname.c_str(), "#", 1 ) ) ) continue; // skip commented lines
86      cout << "adding inputfile : " << fname.c_str() << endl;
87 +    entrymap[string(fname.c_str())] = unskimmedEntries(fname.c_str());
88      chain->AddFile(fname.c_str());
89    }
90  
# Line 91 | Line 95 | int main(int argc, char** argv)
95    // Setup
96    //--------------------------------------------------------------------------------------------------------------
97    TH1F * h_evt = new TH1F("hevt", "hevt", 2, 0, 2 );
98 <  TH1F * h_evtfail = new TH1F("hevtfail", "hevtfail", 1024, 0, 1024 );
98 >  TH1F * h_evtfail = new TH1F("hevtfail", "hevtfail", 1024, 0, 1024 );
99    TNtuple * passtuple = new TNtuple( "passtuple", "passtuple", "run:evt:lumi:channel:mZ1:mZ2:m4l:pt4l:w" );
100    initCiCSelection();
101 +  initLikSelection();
102    initRunLumiRangeMap();
103  
99
104    //
105    // Loop
106    //--------------------------------------------------------------------------------------------------------------
# Line 129 | Line 133 | int main(int argc, char** argv)
133  
134    cout << "nEntries: " << chain->GetEntries() << endl;
135    for(UInt_t ientry=0; ientry<chain->GetEntries(); ientry++) {          
136 <    
136 >
137      chain->GetEntry(ientry);
138 +    if(!(ientry%100000)) cout << "entry: " << ientry << endl;
139  
140      // get event weight for this file                                                    
141 <    double xs=1,eventweight=1;                                                            
142 <    if(ctrl.mc) eventweight = xstab.Get(getname(chain).c_str()) / chain->GetEntries();    
141 >    double eventweight=1;
142 >    if(ctrl.mc) eventweight = getWeight(xstab,entrymap,chain);
143  
144   #ifdef THEIR_EVENTS
145      if( !( info->evtNum == 504867308  ||
# Line 161 | Line 166 | int main(int argc, char** argv)
166             info->evtNum == 107360878  ) ) continue;
167   #endif
168  
169 <    unsigned evtfail = fails_HZZ4L_selection(ctrl, info, electronArr, muonArr, eventweight, passtuple );    
169 >    unsigned evtfail = fails_HZZ4L_selection(ctrl, info, electronArr, muonArr, eventweight, passtuple);    
170      h_evtfail->Fill( evtfail, eventweight );
171 <    cout << endl << endl;  
171 >    if( ctrl.debug ) cout << endl << endl;  
172            
173    } //end loop over data    
174  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines