ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/HbbAnalysis/plugins/HbbAnalyzer.hh
Revision: 1.11
Committed: Thu Mar 4 15:17:42 2010 UTC (15 years, 2 months ago) by amagnan
Content type: text/plain
Branch: MAIN
CVS Tags: HbbAnaFor35X, v00-04-02, v00-04-01, v00-04-00
Changes since 1.10: +1 -1 lines
Log Message:
update beginJob and TFileService from CommonTools

File Contents

# User Rev Content
1 amagnan 1.1 #ifndef HbbAnalysis_HbbAnalyzer_hh
2     #define HbbAnalysis_HbbAnalyzer_hh
3    
4     #include <fstream>
5     #include <string>
6     #include <iostream>
7     #include <vector>
8    
9 amagnan 1.5 #include "Math/VectorUtil.h"
10    
11 amagnan 1.1 #include "FWCore/Framework/interface/EDAnalyzer.h"
12     #include "FWCore/Framework/interface/ESHandle.h"
13     #include "FWCore/Framework/interface/Event.h"
14     #include "FWCore/Framework/interface/EventSetup.h"
15     #include "FWCore/Framework/interface/TriggerNames.h"
16     #include "FWCore/ParameterSet/interface/ParameterSet.h"
17 amagnan 1.5
18     #include "DataFormats/Common/interface/Handle.h"
19     #include "DataFormats/PatCandidates/interface/Lepton.h"
20     #include "DataFormats/PatCandidates/interface/Jet.h"
21     #include "DataFormats/PatCandidates/interface/Muon.h"
22     #include "DataFormats/PatCandidates/interface/Electron.h"
23     #include "DataFormats/PatCandidates/interface/Tau.h"
24 amagnan 1.1
25 amagnan 1.3 #include "UserCode/HbbAnalysis/interface/HistosElecs.hh"
26 amagnan 1.1 #include "UserCode/HbbAnalysis/interface/HistosMuons.hh"
27     #include "UserCode/HbbAnalysis/interface/HistosTaus.hh"
28     #include "UserCode/HbbAnalysis/interface/HistosJets.hh"
29 amagnan 1.3 #include "UserCode/HbbAnalysis/interface/HistosPairs.hh"
30     #include "UserCode/HbbAnalysis/interface/HistosMET.hh"
31 amagnan 1.4 #include "UserCode/HbbAnalysis/interface/JetFlavour.hh"
32 amagnan 1.1
33    
34     //#include "TFile.h"
35     #include "TH1F.h"
36    
37     class HbbAnalyzer : public edm::EDAnalyzer {//class
38    
39     public:
40    
41     HbbAnalyzer(const edm::ParameterSet & pset);
42     ~HbbAnalyzer();
43    
44 amagnan 1.11 void beginJob();
45 amagnan 1.5 void analyze(const edm::Event& ,
46     const edm::EventSetup&
47     );
48 amagnan 1.1 void endJob();
49 amagnan 1.5 void dumpContent(const edm::Event& aEvt,
50     std::string aName,
51     std::string aProcess
52     );
53    
54 amagnan 1.9
55 amagnan 1.1 private:
56    
57 amagnan 1.5 template <class T>
58     double deltaRwithLepton(const pat::Jet & aJet,
59     const edm::Handle<std::vector<T> > & aCol
60     );
61    
62 amagnan 1.1 //void processFirstEvent(const edm::Event& aEvt, std::string aName, std::vector<std::string> & aProcVec);
63     //void InitialiseHistograms();
64     //void FillHistograms(std::string aDirName, std::string aSubDirName, unsigned int aIndex, double apT, double aEta, double aPhi);
65     //void SaveHistograms();
66    
67     int debug_;
68 amagnan 1.4
69     //flavour of jets required :
70     // 3 = u,d,s,g, 21 = g
71     // 4=c, 5=b, 45=b or c
72     unsigned int flavour_;
73 amagnan 1.1 //TFile* file_;
74    
75 amagnan 1.5 double jetLeptonIsolation_;
76    
77 amagnan 1.8 bool doElectrons_;
78     bool doMuons_;
79     bool doTaus_;
80     bool doJets_;
81     bool doMETs_;
82 amagnan 1.9 bool doPairs_;
83     //bool doLepLepPairs_;
84 amagnan 1.8
85    
86 amagnan 1.4 HbbAnalysis::JetFlavour jetFlav_;
87    
88 amagnan 1.3 edm::InputTag genParticleSrc_;
89     edm::InputTag electronSrc_;
90 amagnan 1.1 edm::InputTag muonSrc_;
91 amagnan 1.9 edm::InputTag tauSrc_;
92     //edm::InputTag pfTauSrc_;
93 amagnan 1.1 edm::InputTag jetSrc_;
94 amagnan 1.9 //edm::InputTag jptjetSrc_;
95     //edm::InputTag pfjetSrc_;
96     edm::InputTag metSrc_;
97     //edm::InputTag tcMetSrc_;
98     //edm::InputTag pfMetSrc_;
99     edm::InputTag pairSrc_;
100     //edm::InputTag mmPairSrc_;
101     //edm::InputTag etPairSrc_;
102     //edm::InputTag mtPairSrc_;
103 amagnan 1.1 edm::InputTag vertexSrc_;
104     edm::InputTag triggerSrc_;
105 amagnan 1.3 std::vector<std::string> hltPaths_;
106 amagnan 1.1 //vector filled during processing with all existing collections
107     //std::vector<std::pair<std::string,std::string> > collections_;
108    
109     //list of processes to consider to find input collections
110     //std::vector<std::string> processVec_;
111    
112 amagnan 1.3 //HbbAnalysis::HistosGenParticles GenHist_;
113     HbbAnalysis::HistosElecs ElecHistLead_;
114     HbbAnalysis::HistosElecs ElecHistLeadGenMatched_;
115     HbbAnalysis::HistosElecs ElecHistNtoLead_;
116     HbbAnalysis::HistosElecs ElecHistNtoLeadGenMatched_;
117 amagnan 1.7 HbbAnalysis::HistosElecs ElecHistBarrelLead_;
118     HbbAnalysis::HistosElecs ElecHistBarrelLeadGenMatched_;
119     HbbAnalysis::HistosElecs ElecHistBarrelNtoLead_;
120     HbbAnalysis::HistosElecs ElecHistBarrelNtoLeadGenMatched_;
121     HbbAnalysis::HistosElecs ElecHistEndCapLead_;
122     HbbAnalysis::HistosElecs ElecHistEndCapLeadGenMatched_;
123     HbbAnalysis::HistosElecs ElecHistEndCapNtoLead_;
124     HbbAnalysis::HistosElecs ElecHistEndCapNtoLeadGenMatched_;
125 amagnan 1.3 HbbAnalysis::HistosMuons MuHistLead_;
126     HbbAnalysis::HistosMuons MuHistLeadGenMatched_;
127     HbbAnalysis::HistosMuons MuHistNtoLead_;
128     HbbAnalysis::HistosMuons MuHistNtoLeadGenMatched_;
129 amagnan 1.9 HbbAnalysis::HistosTaus TauHist_;
130     HbbAnalysis::HistosTaus TauHistGenMatched_;
131     //HbbAnalysis::HistosTaus PFTauHist_;
132     //HbbAnalysis::HistosTaus PFTauHistGenMatched_;
133 amagnan 1.5 HbbAnalysis::HistosJets JetHist_;
134 amagnan 1.9 // HbbAnalysis::HistosJets JPTJetHist_;
135     //HbbAnalysis::HistosJets PFJetHist_;
136 amagnan 1.4 HbbAnalysis::HistosJets JetHistLead_;
137 amagnan 1.10 //HbbAnalysis::HistosJets JetHistLeadGenMatched_;
138 amagnan 1.9 //HbbAnalysis::HistosJets JPTJetHistLead_;
139     //HbbAnalysis::HistosJets PFJetHistLead_;
140 amagnan 1.4 HbbAnalysis::HistosJets JetHistNtoLead_;
141 amagnan 1.10 //HbbAnalysis::HistosJets JetHistNtoLeadGenMatched_;
142 amagnan 1.9 //HbbAnalysis::HistosJets JPTJetHistNtoLead_;
143     //HbbAnalysis::HistosJets PFJetHistNtoLead_;
144     HbbAnalysis::HistosPairs PairHist_;
145     HbbAnalysis::HistosPairs PairHistLead_;
146     //HbbAnalysis::HistosPairs MMPairHist_;
147     //HbbAnalysis::HistosPairs ETPairHist_;
148     //HbbAnalysis::HistosPairs MTPairHist_;
149     HbbAnalysis::HistosMET MetHist_;
150     //HbbAnalysis::HistosMET TcMetHist_;
151     //HbbAnalysis::HistosMET PFMetHist_;
152 amagnan 1.3 //HbbAnalysis::HistosTrigs TrigHist_;
153 amagnan 1.1
154     //TH1F *p_muonpT;
155     //TH1F *p_muoneta;
156     //TH1F *p_muonphi;
157    
158    
159     };//class
160    
161    
162 amagnan 1.5
163     template <class T>
164     double HbbAnalyzer::deltaRwithLepton(const pat::Jet & aJet,
165     const edm::Handle<std::vector< T > > & aCol
166     )
167     {
168     double lMin = 1000;
169     bool lValid=(aCol->empty())?true:false;
170    
171     // pat::Lepton<LeptonType> lLep;
172 amagnan 1.6 typename std::vector< T >::const_iterator iLepton;
173 amagnan 1.5
174 amagnan 1.6 for (iLepton= aCol->begin();
175     iLepton != aCol->end();
176     iLepton++)
177     // for (unsigned int iLepton(0); iLepton< aCol->size(); iLepton++)
178 amagnan 1.5 {
179 amagnan 1.6 //double lDeltaR = ROOT::Math::VectorUtil::DeltaR(aJet.p4(),aCol->at(iLepton).p4());
180     double lDeltaR = ROOT::Math::VectorUtil::DeltaR(aJet.p4(),iLepton->p4());
181 amagnan 1.5 if (lDeltaR<lMin){
182     lMin=lDeltaR;
183     lValid=true;
184     }
185     }
186    
187     if(!lValid){
188     std::cerr<<__PRETTY_FUNCTION__<<" : Invalid Return value "
189     << lMin
190     << "... AAAAAAARRRRRRRRRRRRGGGGGGGGGHHHHH"
191     <<std::endl;
192     }
193     if (lMin > 100) return -1;
194    
195     return lMin;
196    
197     }
198    
199    
200    
201    
202    
203 amagnan 1.1 #endif //HbbAnalysis_HbbAnalyzer_hh