ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbb/plugins/Cuts/CutsGeneral.h
Revision: 1.1
Committed: Mon Oct 29 16:25:02 2012 UTC (12 years, 6 months ago) by bortigno
Content type: text/plain
Branch: MAIN
CVS Tags: lhcp_UnblindFix, hcp_Unblind, lhcp_11April, LHCP_PreAppFixAfterFreeze, LHCP_PreAppFreeze, workingVersionAfterHCP, HEAD
Log Message:
Quality cuts and general cut utilities

File Contents

# User Rev Content
1 bortigno 1.1 #ifndef CUTSGENERAL_H
2     #define CUTSGENERAL_H
3     #include "../../interface/CutsAndHistos.h"
4     #include "../../interface/ntupleReader.hpp"
5     #include <TH1F.h>
6     #include <sstream>
7     #include "../../interface/samples.hpp"
8     #include "TKey.h"
9    
10     #define CSVM 0.679
11     #define CSVC 0.5 //custom btag
12     #define CSVL 0.244
13     #define CSVT 0.898
14     #define fA 0.46502
15     #define fB 0.53498
16    
17     // New implementations of the control region
18     // The signal regions must be implemented incrementally since cutflow is needed
19    
20     //cuts that has to be applied globally
21     bool qualityCuts( ntupleReader & p ){
22     return ( p. hJet_puJetIdL[0] > 0.
23     && p. hJet_puJetIdL[1] > 0.
24     && TMath::Abs(p.hJet_eta[0]) < 2.4
25     && TMath::Abs(p.hJet_eta[1]) < 2.4
26     && p.hbhe == true );
27     };
28    
29     //if you want to do a sample-dependent cut.
30     bool sCut( ntupleReader & p , Sample & sample ){
31     /* if( sample.data ) */
32     /* return ( p.EVENT_json == true ); */
33     /* else */
34     return 1;
35     };
36    
37     //channel dependent cuts
38     Bool_t channel(ntupleReader & p, int ch , Sample & sample){
39     bool trigger[2];
40    
41     if(sample.data){
42     //muons
43     trigger[0] = ( ( p.triggerFlags[14] || p.triggerFlags[21] || p.triggerFlags[22] || p.triggerFlags[23] ) );
44     //electrons
45     trigger[1] = ( ( p.triggerFlags[5] || p.triggerFlags[6] ) );
46     }
47     else{
48     trigger[0] = 1;
49     trigger[1] = 1;
50     }
51    
52     if(ch == -1) return (( p.Vtype == 0 && trigger[0] ) || ( p.Vtype == 1 && trigger[1] ));
53     else return ( p.Vtype == ch && trigger[ch] );
54     };
55    
56     //here if you want to apply a sample depepndent weight.
57     double w(ntupleReader &p, Sample &sample){
58     // return 1;
59     std::string DY("DY");
60     if(sample.name == DY) return (p.lheWeight);
61     else return 1;
62     };
63    
64     //naming conventions
65     std::string generateName( std::string & baseName, int ch = -1, int btag = 0, int jec = 0 ) {
66     std::string channel;
67     if(ch == -1)
68     channel = "HZcomb";
69     else if(ch == 0)
70     channel = "HZmm";
71     else if(ch == 1)
72     channel = "HZee";
73     if( jec == 1 )
74     return ( "SystJecUP"+baseName+channel );
75     else if( jec == -1 )
76     return ( "SystJecDOWN"+baseName+channel );
77     else if( jec == 2 )
78     return ( "SystJerUP"+baseName+channel );
79     else if( jec == -2 )
80     return ( "SystJerDOWN"+baseName+channel );
81     if( btag == 1)
82     return ( "SystBtagUP"+baseName+channel );
83     else if( btag == -1 )
84     return ( "SystBtagDOWN"+baseName+channel );
85     else if( btag == 2 )
86     return ( "SystBtagFUP"+baseName+channel );
87     else if( btag == -2 )
88     return ( "SystBtagFDOWN"+baseName+channel );
89     else if( btag == 0 && jec == 0)
90     return baseName+channel;
91     };
92    
93    
94     #endif