00001
00002
00003
00004
00005
00006 #include "RecoJets/JetAnalyzers/interface/myJetAna.h"
00007 #include "RecoJets/JetAlgorithms/interface/JetAlgoHelper.h"
00008 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
00009 #include "DataFormats/JetReco/interface/CaloJet.h"
00010 #include "DataFormats/JetReco/interface/GenJet.h"
00011 #include "DataFormats/METReco/interface/CaloMETCollection.h"
00012 #include "DataFormats/METReco/interface/CaloMET.h"
00013
00014 #include "DataFormats/Common/interface/Handle.h"
00015 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
00016 #include "DataFormats/HcalRecHit/interface/HcalSourcePositionData.h"
00017 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
00018
00019 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
00020 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00021 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00022 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00023
00024
00025 #include "FWCore/Framework/interface/ESHandle.h"
00026 #include "Geometry/Records/interface/CaloGeometryRecord.h"
00027 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00028 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
00029 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
00030 #include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
00031
00032 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00033 #include "DataFormats/TrackReco/interface/Track.h"
00034 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
00035
00036 #include "DataFormats/MuonReco/interface/Muon.h"
00037 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00038
00039 #include "DataFormats/VertexReco/interface/Vertex.h"
00040 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00041
00042
00043
00044
00045
00046 #include "DataFormats/Math/interface/deltaR.h"
00047 #include "DataFormats/Math/interface/deltaPhi.h"
00048
00049 #include "DataFormats/Candidate/interface/Candidate.h"
00050
00051 #include "FWCore/Framework/interface/Event.h"
00052
00053 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00054
00055 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
00056
00057 #include "DataFormats/HLTReco/interface/TriggerObject.h"
00058 #include "FWCore/Common/interface/TriggerNames.h"
00059 #include "DataFormats/Common/interface/TriggerResults.h"
00060 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
00061 #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
00062
00063
00064
00065
00066 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00067 #include "JetMETCorrections/Objects/interface/JetCorrector.h"
00068 #include <TROOT.h>
00069 #include <TSystem.h>
00070 #include <TFile.h>
00071 #include <TCanvas.h>
00072 #include <cmath>
00073
00074 using namespace edm;
00075 using namespace reco;
00076 using namespace std;
00077
00078
00079 #define INVALID 9999.
00080 #define DEBUG false
00081 #define MAXJETS 100
00082
00083 typedef struct RBX_struct {
00084 double et;
00085 double hadEnergy;
00086 double emEnergy;
00087 float hcalTime;
00088 float ecalTime;
00089 int nTowers;
00090 } RBX ;
00091
00092 typedef struct HPD_struct {
00093 double et;
00094 double hadEnergy;
00095 double emEnergy;
00096 double time;
00097 float hcalTime;
00098 float ecalTime;
00099 int nTowers;
00100 } HPD ;
00101
00102
00103
00104 float totBNC, nBNC[4000];
00105
00106 RBX RBXColl[36];
00107 HPD HPDColl[144];
00108
00109
00110
00111
00112
00113
00114
00115 myJetAna::myJetAna( const ParameterSet & cfg ) :
00116 CaloJetAlgorithm( cfg.getParameter<string>( "CaloJetAlgorithm" ) ),
00117 GenJetAlgorithm( cfg.getParameter<string>( "GenJetAlgorithm" ) )
00118 {
00119 theTriggerResultsLabel = cfg.getParameter<edm::InputTag>("TriggerResultsLabel");
00120 }
00121
00122
00123
00124
00125
00126 void myJetAna::beginJob( ) {
00127
00128
00129
00130 edm::Service<TFileService> fs;
00131
00132
00133 h_pt = fs->make<TH1F>( "pt", "Jet p_{T}", 100, 0, 50 );
00134 h_ptRBX = fs->make<TH1F>( "ptRBX", "RBX: Jet p_{T}", 100, 0, 50 );
00135 h_ptHPD = fs->make<TH1F>( "ptHPD", "HPD: Jet p_{T}", 100, 0, 50 );
00136 h_ptTower = fs->make<TH1F>( "ptTower", "Jet p_{T}", 100, 0, 50 );
00137 h_et = fs->make<TH1F>( "et", "Jet E_{T}", 100, 0, 50 );
00138 h_eta = fs->make<TH1F>( "eta", "Jet #eta", 100, -4, 4 );
00139 h_phi = fs->make<TH1F>( "phi", "Jet #phi", 50, -M_PI, M_PI );
00140
00141
00142 hitEtaEt = fs->make<TH1F>( "hitEtaEt", "RecHit #eta", 90, -45, 45 );
00143 hitEta = fs->make<TH1F>( "hitEta", "RecHit #eta", 90, -45, 45 );
00144 hitPhi = fs->make<TH1F>( "hitPhi", "RecHit #phi", 73, 0, 73 );
00145
00146 caloEtaEt = fs->make<TH1F>( "caloEtaEt", "CaloTower #eta", 100, -4, 4 );
00147 caloEta = fs->make<TH1F>( "caloEta", "CaloTower #eta", 100, -4, 4 );
00148 caloPhi = fs->make<TH1F>( "caloPhi", "CaloTower #phi", 50, -M_PI, M_PI );
00149
00150 dijetMass = fs->make<TH1F>("dijetMass","DiJet Mass",100,0,100);
00151
00152 totEneLeadJetEta1 = fs->make<TH1F>("totEneLeadJetEta1","Total Energy Lead Jet Eta1 1",100,0,1500);
00153 totEneLeadJetEta2 = fs->make<TH1F>("totEneLeadJetEta2","Total Energy Lead Jet Eta2 1",100,0,1500);
00154 totEneLeadJetEta3 = fs->make<TH1F>("totEneLeadJetEta3","Total Energy Lead Jet Eta3 1",100,0,1500);
00155 hadEneLeadJetEta1 = fs->make<TH1F>("hadEneLeadJetEta1","Hadronic Energy Lead Jet Eta1 1",100,0,1500);
00156 hadEneLeadJetEta2 = fs->make<TH1F>("hadEneLeadJetEta2","Hadronic Energy Lead Jet Eta2 1",100,0,1500);
00157 hadEneLeadJetEta3 = fs->make<TH1F>("hadEneLeadJetEta3","Hadronic Energy Lead Jet Eta3 1",100,0,1500);
00158 emEneLeadJetEta1 = fs->make<TH1F>("emEneLeadJetEta1","EM Energy Lead Jet Eta1 1",100,0,1500);
00159 emEneLeadJetEta2 = fs->make<TH1F>("emEneLeadJetEta2","EM Energy Lead Jet Eta2 1",100,0,1500);
00160 emEneLeadJetEta3 = fs->make<TH1F>("emEneLeadJetEta3","EM Energy Lead Jet Eta3 1",100,0,1500);
00161
00162
00163 hadFracEta1 = fs->make<TH1F>("hadFracEta11","Hadronic Fraction Eta1 Jet 1",100,0,1);
00164 hadFracEta2 = fs->make<TH1F>("hadFracEta21","Hadronic Fraction Eta2 Jet 1",100,0,1);
00165 hadFracEta3 = fs->make<TH1F>("hadFracEta31","Hadronic Fraction Eta3 Jet 1",100,0,1);
00166
00167 SumEt = fs->make<TH1F>("SumEt","SumEt",100,0,100);
00168 MET = fs->make<TH1F>("MET", "MET",100,0,50);
00169 METSig = fs->make<TH1F>("METSig", "METSig",100,0,50);
00170 MEx = fs->make<TH1F>("MEx", "MEx",100,-20,20);
00171 MEy = fs->make<TH1F>("MEy", "MEy",100,-20,20);
00172 METPhi = fs->make<TH1F>("METPhi", "METPhi",315,0,3.15);
00173 MET_RBX = fs->make<TH1F>("MET_RBX", "MET",100,0,1000);
00174 MET_HPD = fs->make<TH1F>("MET_HPD", "MET",100,0,1000);
00175 MET_Tower = fs->make<TH1F>("MET_Tower", "MET",100,0,1000);
00176
00177
00178 h_Vx = fs->make<TH1F>("Vx", "Vx",100,-0.5,0.5);
00179 h_Vy = fs->make<TH1F>("Vy", "Vy",100,-0.5,0.5);
00180 h_Vz = fs->make<TH1F>("Vz", "Vz",100,-20,20);
00181 h_VNTrks = fs->make<TH1F>("VNTrks", "VNTrks",10,1,100);
00182
00183 h_Trk_pt = fs->make<TH1F>("Trk_pt", "Trk_pt",100,0,20);
00184 h_Trk_NTrk = fs->make<TH1F>("Trk_NTrk", "Trk_NTrk",20,0,20);
00185
00186 hf_sumTowerAllEx = fs->make<TH1F>("sumTowerAllEx","Tower Ex",100,-1000,1000);
00187 hf_sumTowerAllEy = fs->make<TH1F>("sumTowerAllEy","Tower Ey",100,-1000,1000);
00188
00189 hf_TowerJetEt = fs->make<TH1F>("TowerJetEt","Tower/Jet Et 1",50,0,1);
00190
00191 ETime = fs->make<TH1F>("ETime","Ecal Time",200,-200,200);
00192 HTime = fs->make<TH1F>("HTime","Hcal Time",200,-200,200);
00193
00194 towerHadEn = fs->make<TH1F>("towerHadEn" ,"Hadronic Energy in Calo Tower",2000,-100,100);
00195 towerEmEn = fs->make<TH1F>("towerEmEn" ,"EM Energy in Calo Tower",2000,-100,100);
00196 towerOuterEn = fs->make<TH1F>("towerOuterEn" ,"HO Energy in Calo Tower",2000,-100,100);
00197
00198 towerEmFrac = fs->make<TH1F>("towerEmFrac","EM Fraction of Energy in Calo Tower",100,-1.,1.);
00199
00200 RBX_et = fs->make<TH1F>("RBX_et","ET in RBX",1000,-20,100);
00201 RBX_hadEnergy = fs->make<TH1F>("RBX_hadEnergy","Hcal Energy in RBX",1000,-20,100);
00202 RBX_hcalTime = fs->make<TH1F>("RBX_hcalTime","Hcal Time in RBX",200,-200,200);
00203 RBX_nTowers = fs->make<TH1F>("RBX_nTowers","Number of Towers in RBX",75,0,75);
00204 RBX_N = fs->make<TH1F>("RBX_N","Number of RBX",10,0,10);
00205
00206 HPD_et = fs->make<TH1F>("HPD_et","ET in HPD",1000,-20,100);
00207 HPD_hadEnergy = fs->make<TH1F>("HPD_hadEnergy","Hcal Energy in HPD",1000,-20,100);
00208 HPD_hcalTime = fs->make<TH1F>("HPD_hcalTime","Hcal Time in HPD",200,-200,200);
00209 HPD_nTowers = fs->make<TH1F>("HPD_nTowers","Number of Towers in HPD",20,0,20);
00210 HPD_N = fs->make<TH1F>("HPD_N","Number of HPD",10,0,10);
00211
00212 nTowers1 = fs->make<TH1F>("nTowers1","Number of Towers pt 0.5",100,0,200);
00213 nTowers2 = fs->make<TH1F>("nTowers2","Number of Towers pt 1.0",100,0,200);
00214 nTowers3 = fs->make<TH1F>("nTowers3","Number of Towers pt 1.5",100,0,200);
00215 nTowers4 = fs->make<TH1F>("nTowers4","Number of Towers pt 2.0",100,0,200);
00216
00217 nTowersLeadJetPt1 = fs->make<TH1F>("nTowersLeadJetPt1","Number of Towers in Lead Jet pt 0.5",100,0,100);
00218 nTowersLeadJetPt2 = fs->make<TH1F>("nTowersLeadJetPt2","Number of Towers in Lead Jet pt 1.0",100,0,100);
00219 nTowersLeadJetPt3 = fs->make<TH1F>("nTowersLeadJetPt3","Number of Towers in Lead Jet pt 1.5",100,0,100);
00220 nTowersLeadJetPt4 = fs->make<TH1F>("nTowersLeadJetPt4","Number of Towers in Lead Jet pt 2.0",100,0,100);
00221
00222 h_nCalJets = fs->make<TH1F>( "nCalJets", "Number of CalJets", 20, 0, 20 );
00223
00224 HBEneOOT = fs->make<TH1F>( "HBEneOOT", "HBEneOOT", 200, -5, 10 );
00225 HEEneOOT = fs->make<TH1F>( "HEEneOOT", "HEEneOOT", 200, -5, 10 );
00226 HFEneOOT = fs->make<TH1F>( "HFEneOOT", "HFEneOOT", 200, -5, 10 );
00227 HOEneOOT = fs->make<TH1F>( "HOEneOOT", "HOEneOOT", 200, -5, 10 );
00228
00229 HBEne = fs->make<TH1F>( "HBEne", "HBEne", 200, -5, 10 );
00230 HBEneTh = fs->make<TH1F>( "HBEneTh", "HBEneTh", 200, -5, 10 );
00231 HBEneX = fs->make<TH1F>( "HBEneX", "HBEneX", 200, -5, 10 );
00232 HBEneY = fs->make<TH1F>( "HBEneY", "HBEnedY", 200, -5, 10 );
00233 HBTime = fs->make<TH1F>( "HBTime", "HBTime", 200, -100, 100 );
00234 HBTimeTh = fs->make<TH1F>( "HBTimeTh", "HBTimeTh", 200, -100, 100 );
00235 HBTimeX = fs->make<TH1F>( "HBTimeX", "HBTimeX", 200, -100, 100 );
00236 HBTimeY = fs->make<TH1F>( "HBTimeY", "HBTimeY", 200, -100, 100 );
00237 HEEne = fs->make<TH1F>( "HEEne", "HEEne", 200, -5, 10 );
00238 HEEneTh = fs->make<TH1F>( "HEEneTh", "HEEneTh", 200, -5, 10 );
00239 HEEneX = fs->make<TH1F>( "HEEneX", "HEEneX", 200, -5, 10 );
00240 HEEneY = fs->make<TH1F>( "HEEneY", "HEEneY", 200, -5, 10 );
00241 HEposEne = fs->make<TH1F>( "HEposEne", "HEposEne", 200, -5, 10 );
00242 HEnegEne = fs->make<TH1F>( "HEnegEne", "HEnegEne", 200, -5, 10 );
00243 HETime = fs->make<TH1F>( "HETime", "HETime", 200, -100, 100 );
00244 HETimeTh = fs->make<TH1F>( "HETimeTh", "HETimeTh", 200, -100, 100 );
00245 HETimeX = fs->make<TH1F>( "HETimeX", "HETimeX", 200, -100, 100 );
00246 HETimeY = fs->make<TH1F>( "HETimeY", "HETimeY", 200, -100, 100 );
00247 HEposTime = fs->make<TH1F>( "HEposTime", "HEposTime", 200, -100, 100 );
00248 HEnegTime = fs->make<TH1F>( "HEnegTime", "HEnegTime", 200, -100, 100 );
00249 HOEne = fs->make<TH1F>( "HOEne", "HOEne", 200, -5, 10 );
00250 HOEneTh = fs->make<TH1F>( "HOEneTh", "HOEneTh", 200, -5, 10 );
00251 HOTime = fs->make<TH1F>( "HOTime", "HOTime", 200, -100, 100 );
00252 HOTimeTh = fs->make<TH1F>( "HOTimeTh", "HOTimeTh", 200, -100, 100 );
00253
00254
00255 HOSEne = fs->make<TH1F>( "HOSEne", "HOSEne", 12000, -20, 100 );
00256 HOSTime = fs->make<TH1F>( "HOSTime", "HOSTime", 200, -100, 100 );
00257 HOHEne = fs->make<TH1F>( "HOHEne", "HOHEne", 12000, -20, 100 );
00258 HOHTime = fs->make<TH1F>( "HOHTime", "HOHTime", 200, -100, 100 );
00259
00260 HOHr0Ene = fs->make<TH1F>( "HOHr0Ene" , "HOHr0Ene", 12000, -20 , 100 );
00261 HOHr0Time = fs->make<TH1F>( "HOHr0Time" , "HOHr0Time", 200, -200, 200 );
00262 HOHrm1Ene = fs->make<TH1F>( "HOHrm1Ene" , "HOHrm1Ene", 12000, -20 , 100 );
00263 HOHrm1Time = fs->make<TH1F>( "HOHrm1Time", "HOHrm1Time", 200, -200, 200 );
00264 HOHrm2Ene = fs->make<TH1F>( "HOHrm2Ene" , "HOHrm2Ene", 12000, -20 , 100 );
00265 HOHrm2Time = fs->make<TH1F>( "HOHrm2Time", "HOHrm2Time", 200, -200, 200 );
00266 HOHrp1Ene = fs->make<TH1F>( "HOHrp1Ene" , "HOHrp1Ene", 12000, -20 , 100 );
00267 HOHrp1Time = fs->make<TH1F>( "HOHrp1Time", "HOHrp1Time", 200, -200, 200 );
00268 HOHrp2Ene = fs->make<TH1F>( "HOHrp2Ene" , "HOHrp2Ene", 12000, -20 , 100 );
00269 HOHrp2Time = fs->make<TH1F>( "HOHrp2Time", "HOHrp2Time", 200, -200, 200 );
00270
00271 HBTvsE = fs->make<TH2F>( "HBTvsE", "HBTvsE",100, -5, 50, 100, -100, 100);
00272 HETvsE = fs->make<TH2F>( "HETvsE", "HETvsE",100, -5, 50, 100, -100, 100);
00273 HFTvsE = fs->make<TH2F>( "HFTvsE", "HFTvsE",100, -5, 50, 100, -100, 100);
00274 HOTvsE = fs->make<TH2F>( "HOTvsE", "HOTvsE",100, -5, 50, 100, -100, 100);
00275
00276 HFvsZ = fs->make<TH2F>( "HFvsZ", "HFvsZ",100,-50,50,100,-50,50);
00277
00278 HOocc = fs->make<TH2F>( "HOocc", "HOocc",81,-40.5,40.5,70,0.5,70.5);
00279 HBocc = fs->make<TH2F>( "HBocc", "HBocc",81,-40.5,40.5,70,0.5,70.5);
00280 HEocc = fs->make<TH2F>( "HEocc", "HEocc",81,-40.5,40.5,70,0.5,70.5);
00281 HFocc = fs->make<TH2F>( "HFocc", "HFocc",81,-40.5,40.5,70,0.5,70.5);
00282
00283 HFEne = fs->make<TH1F>( "HFEne", "HFEne", 210, -10, 200 );
00284 HFEneTh = fs->make<TH1F>( "HFEneTh", "HFEneTh", 210, -10, 200 );
00285 HFEneP = fs->make<TH1F>( "HFEneP", "HFEneP", 200, -5, 10 );
00286 HFEneM = fs->make<TH1F>( "HFEneM", "HFEneM", 200, -5, 10 );
00287 HFTime = fs->make<TH1F>( "HFTime", "HFTime", 200, -100, 100 );
00288 HFTimeTh = fs->make<TH1F>( "HFTimeTh", "HFTimeTh", 200, -100, 100 );
00289 HFTimeP = fs->make<TH1F>( "HFTimeP", "HFTimeP", 100, -100, 50 );
00290 HFTimeM = fs->make<TH1F>( "HFTimeM", "HFTimeM", 100, -100, 50 );
00291 HFTimePMa = fs->make<TH1F>( "HFTimePMa", "HFTimePMa", 100, -100, 100 );
00292 HFTimePM = fs->make<TH1F>( "HFTimePM", "HFTimePM", 100, -100, 100 );
00293
00294
00295 HFLEne = fs->make<TH1F>( "HFLEne", "HFLEne", 200, -5, 10 );
00296 HFLTime = fs->make<TH1F>( "HFLTime", "HFLTime", 200, -100, 100 );
00297 HFSEne = fs->make<TH1F>( "HFSEne", "HFSEne", 200, -5, 10 );
00298 HFSTime = fs->make<TH1F>( "HFSTime", "HFSTime", 200, -100, 100 );
00299
00300 HFLvsS = fs->make<TH2F>( "HFLvsS", "HFLvsS",220,-20,200,220,-20,200);
00301
00302
00303 EBEne = fs->make<TH1F>( "EBEne", "EBEne", 200, -5, 10 );
00304 EBEneTh = fs->make<TH1F>( "EBEneTh", "EBEneTh", 200, -5, 10 );
00305 EBEneX = fs->make<TH1F>( "EBEneX", "EBEneX", 200, -5, 10 );
00306 EBEneY = fs->make<TH1F>( "EBEneY", "EBEneY", 200, -5, 10 );
00307 EBTime = fs->make<TH1F>( "EBTime", "EBTime", 200, -100, 100 );
00308 EBTimeTh = fs->make<TH1F>( "EBTimeTh", "EBTimeTh", 200, -100, 100 );
00309 EBTimeX = fs->make<TH1F>( "EBTimeX", "EBTimeX", 200, -100, 100 );
00310 EBTimeY = fs->make<TH1F>( "EBTimeY", "EBTimeY", 200, -100, 100 );
00311 EEEne = fs->make<TH1F>( "EEEne", "EEEne", 200, -5, 10 );
00312 EEEneTh = fs->make<TH1F>( "EEEneTh", "EEEneTh", 200, -5, 10 );
00313 EEEneX = fs->make<TH1F>( "EEEneX", "EEEneX", 200, -5, 10 );
00314 EEEneY = fs->make<TH1F>( "EEEneY", "EEEneY", 200, -5, 10 );
00315 EEnegEne = fs->make<TH1F>( "EEnegEne", "EEnegEne", 200, -5, 10 );
00316 EEposEne = fs->make<TH1F>( "EEposEne", "EEposEne", 200, -5, 10 );
00317 EETime = fs->make<TH1F>( "EETime", "EETime", 200, -100, 100 );
00318 EETimeTh = fs->make<TH1F>( "EETimeTh", "EETimeTh", 200, -100, 100 );
00319 EETimeX = fs->make<TH1F>( "EETimeX", "EETimeX", 200, -100, 100 );
00320 EETimeY = fs->make<TH1F>( "EETimeY", "EETimeY", 200, -100, 100 );
00321 EEnegTime = fs->make<TH1F>( "EEnegTime", "EEnegTime", 200, -100, 100 );
00322 EEposTime = fs->make<TH1F>( "EEposTime", "EEposTime", 200, -100, 100 );
00323
00324 h_ptCal = fs->make<TH1F>( "ptCal", "p_{T} of CalJet", 100, 0, 50 );
00325 h_etaCal = fs->make<TH1F>( "etaCal", "#eta of CalJet", 100, -4, 4 );
00326 h_phiCal = fs->make<TH1F>( "phiCal", "#phi of CalJet", 50, -M_PI, M_PI );
00327
00328 h_nGenJets = fs->make<TH1F>( "nGenJets", "Number of GenJets", 20, 0, 20 );
00329
00330 h_ptGen = fs->make<TH1F>( "ptGen", "p_{T} of GenJet", 100, 0, 50 );
00331 h_etaGen = fs->make<TH1F>( "etaGen", "#eta of GenJet", 100, -4, 4 );
00332 h_phiGen = fs->make<TH1F>( "phiGen", "#phi of GenJet", 50, -M_PI, M_PI );
00333
00334 h_ptGenL = fs->make<TH1F>( "ptGenL", "p_{T} of GenJetL", 100, 0, 50 );
00335 h_etaGenL = fs->make<TH1F>( "etaGenL", "#eta of GenJetL", 100, -4, 4 );
00336 h_phiGenL = fs->make<TH1F>( "phiGenL", "#phi of GenJetL", 50, -M_PI, M_PI );
00337
00338 h_jetEt = fs->make<TH1F>( "jetEt", "Total Jet Et", 100, 0, 3000 );
00339
00340 h_jet1Pt = fs->make<TH1F>( "jet1Pt", "Jet1 Pt", 100, 0, 1000 );
00341 h_jet2Pt = fs->make<TH1F>( "jet2Pt", "Jet2 Pt", 100, 0, 1000 );
00342 h_jet1PtHLT = fs->make<TH1F>( "jet1PtHLT", "Jet1 Pt HLT", 100, 0, 1000 );
00343
00344 h_TotalUnclusteredEt = fs->make<TH1F>( "TotalUnclusteredEt", "Total Unclustered Et", 100, 0, 500 );
00345 h_UnclusteredEt = fs->make<TH1F>( "UnclusteredEt", "Unclustered Et", 100, 0, 50 );
00346 h_UnclusteredEts = fs->make<TH1F>( "UnclusteredEts", "Unclustered Et", 100, 0, 2 );
00347
00348 h_ClusteredE = fs->make<TH1F>( "ClusteredE", "Clustered E", 200, 0, 20 );
00349 h_TotalClusteredE = fs->make<TH1F>( "TotalClusteredE", "Total Clustered E", 200, 0, 100 );
00350 h_UnclusteredE = fs->make<TH1F>( "UnclusteredE", "Unclustered E", 200, 0, 20 );
00351 h_TotalUnclusteredE = fs->make<TH1F>( "TotalUnclusteredE", "Total Unclustered E", 200, 0, 100 );
00352
00353 jetHOEne = fs->make<TH1F>("jetHOEne" ,"HO Energy in Jet",100, 0,100);
00354 jetEMFraction = fs->make<TH1F>( "jetEMFraction", "Jet EM Fraction", 100, -1.1, 1.1 );
00355 NTowers = fs->make<TH1F>( "NTowers", "Number of Towers", 100, 0, 100 );
00356
00357
00358 h_EmEnergy = fs->make<TH2F>( "EmEnergy", "Em Energy", 90, -45, 45, 73, 0, 73 );
00359 h_HadEnergy = fs->make<TH2F>( "HadEnergy", "Had Energy", 90, -45, 45, 73, 0, 73 );
00360
00361 st_Pt = fs->make<TH1F>( "st_Pt", "Pt", 200, 0, 200 );
00362 st_Constituents = fs->make<TH1F>( "st_Constituents", "Constituents", 200, 0, 200 );
00363 st_Energy = fs->make<TH1F>( "st_Energy", "Tower Energy", 200, 0, 200 );
00364 st_EmEnergy = fs->make<TH1F>( "st_EmEnergy", "Tower EmEnergy", 200, 0, 200 );
00365 st_HadEnergy = fs->make<TH1F>( "st_HadEnergy", "Tower HadEnergy", 200, 0, 200 );
00366 st_OuterEnergy = fs->make<TH1F>( "st_OuterEnergy", "Tower OuterEnergy", 200, 0, 200 );
00367 st_Eta = fs->make<TH1F>( "st_Eta", "Eta", 100, -4, 4 );
00368 st_Phi = fs->make<TH1F>( "st_Phi", "Phi", 50, -M_PI, M_PI );
00369 st_iEta = fs->make<TH1F>( "st_iEta", "iEta", 60, -30, 30 );
00370 st_iPhi = fs->make<TH1F>( "st_iPhi", "iPhi", 80, 0, 80 );
00371 st_Frac = fs->make<TH1F>( "st_Frac", "Frac", 100, 0, 1 );
00372
00373
00374 EBvHB = fs->make<TH2F>( "EBvHB", "EB vs HB",1000,0,4500000.,1000,0,1000000.);
00375 EEvHE = fs->make<TH2F>( "EEvHE", "EE vs HE",1000,0,4500000.,1000,0,200000.);
00376
00377 ECALvHCAL = fs->make<TH2F>( "ECALvHCAL", "ECAL vs HCAL",100,0,20000000.,100,-500000,500000.);
00378 ECALvHCALEta1 = fs->make<TH2F>( "ECALvHCALEta1", "ECAL vs HCALEta1",100,0,20000000.,100,-500000,500000.);
00379 ECALvHCALEta2 = fs->make<TH2F>( "ECALvHCALEta2", "ECAL vs HCALEta2",100,0,20000000.,100,-500000,500000.);
00380 ECALvHCALEta3 = fs->make<TH2F>( "ECALvHCALEta3", "ECAL vs HCALEta3",100,0,20000000.,100,-500000,500000.);
00381
00382 EMF_Eta = fs->make<TProfile>("EMF_Eta","EMF Eta", 100, -50, 50, 0, 10);
00383 EMF_Phi = fs->make<TProfile>("EMF_Phi","EMF Phi", 100, 0, 100, 0, 10);
00384 EMF_EtaX = fs->make<TProfile>("EMF_EtaX","EMF EtaX", 100, -50, 50, 0, 10);
00385 EMF_PhiX = fs->make<TProfile>("EMF_PhiX","EMF PhiX", 100, 0, 100, 0, 10);
00386
00387
00388 totBNC = 0;
00389 for (int i=0; i<4000; i++) nBNC[i] = 0;
00390
00391 }
00392
00393
00394
00395 void myJetAna::analyze( const edm::Event& evt, const edm::EventSetup& es ) {
00396
00397 using namespace edm;
00398
00399 bool Pass, Pass_HFTime, Pass_DiJet, Pass_BunchCrossing, Pass_Trigger, Pass_Vertex;
00400
00401 int EtaOk10, EtaOk13, EtaOk40;
00402
00403 double LeadMass;
00404
00405 double HFRecHit[100][100][2];
00406
00407 double towerEtCut, towerECut, towerE;
00408
00409 towerEtCut = 1.0;
00410 towerECut = 1.0;
00411
00412 double HBHEThreshold = 2.0;
00413 double HFThreshold = 2.0;
00414 double HOThreshold = 2.0;
00415 double EBEEThreshold = 2.0;
00416
00417 float pt1;
00418
00419 float minJetPt = 5.;
00420 float minJetPt10 = 10.;
00421 int jetInd, allJetInd;
00422 LeadMass = -1;
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435 math::XYZTLorentzVector p4tmp[2], p4cortmp[2];
00436
00437
00438
00439
00440 std::cout << ">>>> ANA: Run = " << evt.id().run()
00441 << " Event = " << evt.id().event()
00442 << " Bunch Crossing = " << evt.bunchCrossing()
00443 << " Orbit Number = " << evt.orbitNumber()
00444 << " Luminosity Block = " << evt.luminosityBlock()
00445 << std::endl;
00446
00447
00448
00449
00450 Pass = false;
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466 Handle<TriggerResults> triggerResults;
00467 evt.getByLabel(theTriggerResultsLabel, triggerResults);
00468
00469
00470 if (triggerResults.isValid()) {
00471 if (DEBUG) std::cout << "trigger valid " << std::endl;
00472 const edm::TriggerNames & triggerNames = evt.triggerNames(*triggerResults);
00473 unsigned int n = triggerResults->size();
00474 for (unsigned int i=0; i!=n; i++) {
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489 if (DEBUG) std::cout << triggerNames.triggerName(i) << std::endl;
00490
00491
00492
00493
00494
00495 if (triggerNames.triggerName(i) == "HLT_MinBiasBSC") {
00496 Pass_Trigger = true;
00497 } else {
00498 Pass_Trigger = false;
00499 }
00500
00501 }
00502
00503 } else {
00504
00505 edm::Handle<TriggerResults> *tr = new edm::Handle<TriggerResults>;
00506 triggerResults = (*tr);
00507
00508
00509
00510
00511
00512 if (DEBUG) std::cout << "trigger not valid " << std::endl;
00513 edm::LogInfo("myJetAna") << "TriggerResults::HLT not found, "
00514 "automatically select events";
00515
00516 Pass_Trigger = true;
00517
00518
00519 }
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544 if (evt.id().run() == 122294)
00545 if ( (evt.luminosityBlock() >= 37) && (evt.luminosityBlock() <= 43) )
00546 Pass = true;
00547 if (evt.id().run() == 122314)
00548 if ( (evt.luminosityBlock() >= 24) && (evt.luminosityBlock() <= 37) )
00549 Pass = true;
00550 if (evt.id().run() == 123575)
00551 Pass = true;
00552 if (evt.id().run() == 123596)
00553 Pass = true;
00554
00555
00556 if (evt.id().run() == 124009) {
00557 if ( (evt.bunchCrossing() == 51) ||
00558 (evt.bunchCrossing() == 151) ||
00559 (evt.bunchCrossing() == 2824) ) {
00560 Pass = true;
00561 }
00562 }
00563
00564 if (evt.id().run() == 124020) {
00565 if ( (evt.bunchCrossing() == 51) ||
00566 (evt.bunchCrossing() == 151) ||
00567 (evt.bunchCrossing() == 2824) ) {
00568 Pass = true;
00569 }
00570 }
00571
00572 if (evt.id().run() == 124024) {
00573 if ( (evt.bunchCrossing() == 51) ||
00574 (evt.bunchCrossing() == 151) ||
00575 (evt.bunchCrossing() == 2824) ) {
00576 Pass = true;
00577 }
00578 }
00579
00580 if ( (evt.bunchCrossing() == 51) ||
00581 (evt.bunchCrossing() == 151) ||
00582 (evt.bunchCrossing() == 2596) ||
00583 (evt.bunchCrossing() == 2724) ||
00584 (evt.bunchCrossing() == 2824) ||
00585 (evt.bunchCrossing() == 3487) ) {
00586 Pass_BunchCrossing = true;
00587 } else {
00588 Pass_BunchCrossing = false;
00589 }
00590
00591
00592
00593
00594
00595
00596 double HFM_ETime, HFP_ETime;
00597 double HFM_E, HFP_E;
00598 double HF_PMM;
00599
00600 HFM_ETime = 0.;
00601 HFM_E = 0.;
00602 HFP_ETime = 0.;
00603 HFP_E = 0.;
00604
00605 for (int i=0; i<100; i++) {
00606 for (int j=0; j<100; j++) {
00607 HFRecHit[i][j][0] = -10.;
00608 HFRecHit[i][j][1] = -10.;
00609 }
00610 }
00611
00612
00613 try {
00614 std::vector<edm::Handle<HFRecHitCollection> > colls;
00615 evt.getManyByType(colls);
00616 std::vector<edm::Handle<HFRecHitCollection> >::iterator i;
00617 for (i=colls.begin(); i!=colls.end(); i++) {
00618 for (HFRecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
00619 if (j->id().subdet() == HcalForward) {
00620
00621 float en = j->energy();
00622 HcalDetId id(j->detid().rawId());
00623 int ieta = id.ieta();
00624 int iphi = id.iphi();
00625 int depth = id.depth();
00626
00627 HFRecHit[ieta+41][iphi][depth-1] = en;
00628
00629 if (j->id().ieta()<0) {
00630 if (j->energy() > HFThreshold) {
00631 HFM_ETime += j->energy()*j->time();
00632 HFM_E += j->energy();
00633 }
00634 } else {
00635 if (j->energy() > HFThreshold) {
00636 HFP_ETime += j->energy()*j->time();
00637 HFP_E += j->energy();
00638 }
00639 }
00640
00641 }
00642 }
00643 }
00644 } catch (...) {
00645 cout << "No HF RecHits." << endl;
00646 }
00647
00648 if ((HFP_E > 0.) && (HFM_E > 0.)) {
00649 HF_PMM = (HFP_ETime / HFP_E) - (HFM_ETime / HFM_E);
00650 HFTimePMa->Fill(HF_PMM);
00651 } else {
00652 HF_PMM = INVALID;
00653 }
00654
00655
00656 if (fabs(HF_PMM) < 10.) {
00657 Pass_HFTime = true;
00658 } else {
00659 Pass_HFTime = false;
00660 }
00661
00662
00663
00664
00665
00666 double highestPt;
00667 double nextPt;
00668 double dphi;
00669 int nDiJet, nJet;
00670
00671 nJet = 0;
00672 nDiJet = 0;
00673 highestPt = 0.0;
00674 nextPt = 0.0;
00675
00676 allJetInd = 0;
00677 Handle<CaloJetCollection> caloJets;
00678 evt.getByLabel( CaloJetAlgorithm, caloJets );
00679 for( CaloJetCollection::const_iterator cal = caloJets->begin(); cal != caloJets->end(); ++ cal ) {
00680
00681
00682 if (nJet == 0) p4tmp[0] = cal->p4();
00683 if (nJet == 1) p4tmp[1] = cal->p4();
00684
00685 if ( (cal->pt() > 3.) &&
00686 (fabs(cal->eta()) < 3.0) ) {
00687 nDiJet++;
00688 }
00689 nJet++;
00690
00691 }
00692
00693
00694 if (nDiJet > 1) {
00695 dphi = deltaPhi(p4tmp[0].phi(), p4tmp[1].phi());
00696 Pass_DiJet = true;
00697 } else {
00698 dphi = INVALID;
00699 Pass_DiJet = false;
00700 }
00701
00702
00703
00704
00705
00706 double VTX = 0.;
00707 int nVTX = 0;
00708
00709 edm::Handle<reco::VertexCollection> vertexCollection;
00710 evt.getByLabel("offlinePrimaryVertices", vertexCollection);
00711 const reco::VertexCollection vC = *(vertexCollection.product());
00712
00713 std::cout << "Reconstructed "<< vC.size() << " vertices" << std::endl ;
00714
00715 nVTX = vC.size();
00716 for (reco::VertexCollection::const_iterator vertex=vC.begin(); vertex!=vC.end(); vertex++){
00717 VTX = vertex->z();
00718 }
00719
00720 if ( (fabs(VTX) < 20.) && (nVTX > 0) ){
00721 Pass_Vertex = true;
00722 } else {
00723 Pass_Vertex = false;
00724 }
00725
00726
00727
00728
00729
00730 nBNC[evt.bunchCrossing()]++;
00731 totBNC++;
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750 if (evt.id().run() == 1) {
00751 if ( (Pass_DiJet) &&
00752 (Pass_Vertex) ) {
00753 Pass = true;
00754 } else {
00755 Pass = false;
00756 }
00757 } else {
00758 if ( (Pass_BunchCrossing) &&
00759 (Pass_HFTime) &&
00760 (Pass_Vertex) ) {
00761 Pass = true;
00762 } else {
00763 Pass = false;
00764 }
00765 }
00766
00767 std::cout << "+++ Result "
00768 << " Event = "
00769 << evt.id().run()
00770 << " LS = "
00771 << evt.luminosityBlock()
00772 << " dphi = "
00773 << dphi
00774 << " Pass = "
00775 << Pass
00776 << std::endl;
00777
00778 if (Pass) {
00779
00780
00781
00782
00783
00784 int evtType = 0;
00785
00786 Handle<CaloTowerCollection> caloTowers;
00787 evt.getByLabel( "towerMaker", caloTowers );
00788
00789 for (int i=0;i<36;i++) {
00790 RBXColl[i].et = 0;
00791 RBXColl[i].hadEnergy = 0;
00792 RBXColl[i].emEnergy = 0;
00793 RBXColl[i].hcalTime = 0;
00794 RBXColl[i].ecalTime = 0;
00795 RBXColl[i].nTowers = 0;
00796 }
00797 for (int i=0;i<144;i++) {
00798 HPDColl[i].et = 0;
00799 HPDColl[i].hadEnergy = 0;
00800 HPDColl[i].emEnergy = 0;
00801 HPDColl[i].hcalTime = 0;
00802 HPDColl[i].ecalTime = 0;
00803 HPDColl[i].nTowers = 0;
00804 }
00805
00806 double ETotal, emFrac;
00807 double HCALTotalCaloTowerE, ECALTotalCaloTowerE;
00808 double HCALTotalCaloTowerE_Eta1, ECALTotalCaloTowerE_Eta1;
00809 double HCALTotalCaloTowerE_Eta2, ECALTotalCaloTowerE_Eta2;
00810 double HCALTotalCaloTowerE_Eta3, ECALTotalCaloTowerE_Eta3;
00811
00812 ETotal = 0.;
00813 emFrac = 0.;
00814
00815 HCALTotalCaloTowerE = 0;
00816 ECALTotalCaloTowerE = 0;
00817 HCALTotalCaloTowerE_Eta1 = 0.;
00818 ECALTotalCaloTowerE_Eta1 = 0.;
00819 HCALTotalCaloTowerE_Eta2 = 0.;
00820 ECALTotalCaloTowerE_Eta2 = 0.;
00821 HCALTotalCaloTowerE_Eta3 = 0.;
00822 ECALTotalCaloTowerE_Eta3 = 0.;
00823
00824 for (CaloTowerCollection::const_iterator tower = caloTowers->begin();
00825 tower != caloTowers->end(); tower++) {
00826 ETotal += tower->hadEnergy();
00827 ETotal += tower->emEnergy();
00828 }
00829
00830 for (CaloTowerCollection::const_iterator tower = caloTowers->begin();
00831 tower != caloTowers->end(); tower++) {
00832
00833
00834
00835 towerHadEn->Fill(tower->hadEnergy());
00836 towerEmEn->Fill(tower->emEnergy());
00837 towerOuterEn->Fill(tower->outerEnergy());
00838
00839
00840
00841
00842
00843 if ((tower->emEnergy()+tower->hadEnergy()) != 0) {
00844 emFrac = tower->emEnergy()/(tower->emEnergy()+tower->hadEnergy());
00845 towerEmFrac->Fill(emFrac);
00846 } else {
00847 emFrac = 0.;
00848 }
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859 if (abs(tower->iphi()) < 100) EMF_Phi->Fill(tower->iphi(), emFrac);
00860 if (abs(tower->ieta()) < 100) EMF_Eta->Fill(tower->ieta(), emFrac);
00861 if ( (evt.id().run() == 120020) && (evt.id().event() == 453) ) {
00862 std::cout << "Bunch Crossing = " << evt.bunchCrossing()
00863 << " Orbit Number = " << evt.orbitNumber()
00864 << std::endl;
00865
00866 if (abs(tower->iphi()) < 100) EMF_PhiX->Fill(tower->iphi(), emFrac);
00867 if (abs(tower->ieta()) < 100) EMF_EtaX->Fill(tower->ieta(), emFrac);
00868 }
00869
00870 HCALTotalCaloTowerE += tower->hadEnergy();
00871 ECALTotalCaloTowerE += tower->emEnergy();
00872
00873 towerE = tower->hadEnergy() + tower->emEnergy();
00874 if (tower->et() > towerEtCut) caloEtaEt->Fill(tower->eta());
00875 if (towerE > towerECut) caloEta->Fill(tower->eta());
00876 caloPhi->Fill(tower->phi());
00877
00878 if (fabs(tower->eta()) < 1.3) {
00879 HCALTotalCaloTowerE_Eta1 += tower->hadEnergy();
00880 ECALTotalCaloTowerE_Eta1 += tower->emEnergy();
00881 }
00882 if ((fabs(tower->eta()) >= 1.3) && (fabs(tower->eta()) < 2.5)) {
00883 HCALTotalCaloTowerE_Eta2 += tower->hadEnergy();
00884 ECALTotalCaloTowerE_Eta2 += tower->emEnergy();
00885 }
00886 if (fabs(tower->eta()) > 2.5) {
00887 HCALTotalCaloTowerE_Eta3 += tower->hadEnergy();
00888 ECALTotalCaloTowerE_Eta3 += tower->emEnergy();
00889 }
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899 if ((tower->hadEnergy() + tower->emEnergy()) > 2.0) {
00900
00901 int iRBX = tower->iphi();
00902 iRBX = iRBX-2;
00903 if (iRBX == 0) iRBX = 17;
00904 if (iRBX == -1) iRBX = 18;
00905 iRBX = (iRBX-1)/4;
00906
00907 if (tower->ieta() < 0) iRBX += 18;
00908 if (iRBX < 36) {
00909 RBXColl[iRBX].et += tower->et();
00910 RBXColl[iRBX].hadEnergy += tower->hadEnergy();
00911 RBXColl[iRBX].emEnergy += tower->emEnergy();
00912 RBXColl[iRBX].hcalTime += tower->hcalTime();
00913 RBXColl[iRBX].ecalTime += tower->ecalTime();
00914 RBXColl[iRBX].nTowers++;
00915 }
00916
00917
00918
00919
00920
00921
00922 int iHPD = tower->iphi();
00923 if (tower->ieta() < 0) iHPD = iHPD + 72;
00924 if (iHPD < 144) {
00925 HPDColl[iHPD].et += tower->et();
00926 HPDColl[iHPD].hadEnergy += tower->hadEnergy();
00927 HPDColl[iHPD].emEnergy += tower->emEnergy();
00928 HPDColl[iHPD].hcalTime += tower->hcalTime();
00929 HPDColl[iHPD].ecalTime += tower->ecalTime();
00930 HPDColl[iHPD].nTowers++;
00931 }
00932
00933
00934
00935
00936
00937
00938
00939 }
00940
00941 }
00942
00943 ECALvHCAL->Fill(HCALTotalCaloTowerE, ECALTotalCaloTowerE);
00944 ECALvHCALEta1->Fill(HCALTotalCaloTowerE_Eta1, ECALTotalCaloTowerE_Eta1);
00945 ECALvHCALEta2->Fill(HCALTotalCaloTowerE_Eta2, ECALTotalCaloTowerE_Eta2);
00946 ECALvHCALEta3->Fill(HCALTotalCaloTowerE_Eta3, ECALTotalCaloTowerE_Eta3);
00947
00948 std::cout << " Total CaloTower Energy : "
00949 << " ETotal= " << ETotal
00950 << " HCAL= " << HCALTotalCaloTowerE
00951 << " ECAL= " << ECALTotalCaloTowerE
00952 << std::endl;
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966 int nRBX = 0;
00967 int nTowers = 0;
00968 for (int i=0;i<36;i++) {
00969 RBX_et->Fill(RBXColl[i].et);
00970 RBX_hadEnergy->Fill(RBXColl[i].hadEnergy);
00971 RBX_hcalTime->Fill(RBXColl[i].hcalTime / RBXColl[i].nTowers);
00972 RBX_nTowers->Fill(RBXColl[i].nTowers);
00973 if (RBXColl[i].hadEnergy > 3.0) {
00974 nRBX++;
00975 nTowers = RBXColl[i].nTowers;
00976 }
00977 }
00978 RBX_N->Fill(nRBX);
00979 if ( (nRBX == 1) && (nTowers > 24) ) {
00980 evtType = 1;
00981 }
00982
00983
00984 int nHPD = 0;
00985 for (int i=0;i<144;i++) {
00986 HPD_et->Fill(HPDColl[i].et);
00987 HPD_hadEnergy->Fill(HPDColl[i].hadEnergy);
00988 HPD_hcalTime->Fill(HPDColl[i].hcalTime / HPDColl[i].nTowers);
00989 HPD_nTowers->Fill(HPDColl[i].nTowers);
00990 if (HPDColl[i].hadEnergy > 3.0) {
00991 nHPD++;
00992 nTowers = HPDColl[i].nTowers;
00993 }
00994 }
00995 HPD_N->Fill(nHPD);
00996 if ( (nHPD == 1) && (nTowers > 6) ) {
00997 evtType = 2;
00998 cout << " nHPD = " << nHPD
00999 << " Towers = " << nTowers
01000 << " Type = " << evtType
01001 << endl;
01002 }
01003
01004
01005
01006
01007
01008
01009 Handle<TriggerResults> triggerResults;
01010 evt.getByLabel(theTriggerResultsLabel, triggerResults);
01011
01012 Int_t JetLoPass = 0;
01013
01014 if (triggerResults.isValid()) {
01015 if (DEBUG) std::cout << "trigger valid " << std::endl;
01016 const edm::TriggerNames & triggerNames = evt.triggerNames(*triggerResults);
01017 unsigned int n = triggerResults->size();
01018 for (unsigned int i=0; i!=n; i++) {
01019
01020
01021
01022
01023
01024
01025
01026 if (DEBUG) std::cout << triggerNames.triggerName(i) << std::endl;
01027
01028 if ( triggerNames.triggerName(i) == "HLT_Jet30" ) {
01029 JetLoPass = triggerResults->accept(i);
01030 if (DEBUG) std::cout << "Found HLT_Jet30 "
01031 << JetLoPass
01032 << std::endl;
01033 }
01034
01035 }
01036
01037 } else {
01038
01039 edm::Handle<TriggerResults> *tr = new edm::Handle<TriggerResults>;
01040 triggerResults = (*tr);
01041
01042
01043
01044
01045
01046 if (DEBUG) std::cout << "trigger not valid " << std::endl;
01047 edm::LogInfo("myJetAna") << "TriggerResults::HLT not found, "
01048 "automatically select events";
01049
01050 }
01051
01052
01053
01054
01055
01056
01057
01058
01059
01060
01061
01062
01063
01064
01065
01066
01067
01068
01069
01070 Handle<CaloJetCollection> caloJets;
01071 evt.getByLabel( CaloJetAlgorithm, caloJets );
01072
01073
01074 jetInd = 0;
01075 allJetInd = 0;
01076
01077 EtaOk10 = 0;
01078 EtaOk13 = 0;
01079 EtaOk40 = 0;
01080
01081
01082
01083
01084
01085 highestPt = 0.0;
01086 nextPt = 0.0;
01087
01088 for( CaloJetCollection::const_iterator cal = caloJets->begin(); cal != caloJets->end(); ++ cal ) {
01089
01090
01091 double scale = 1.0;
01092 double corPt = scale*cal->pt();
01093
01094
01095
01096 if (corPt>highestPt) {
01097 nextPt = highestPt;
01098 p4cortmp[1] = p4cortmp[0];
01099 highestPt = corPt;
01100 p4cortmp[0] = scale*cal->p4();
01101 } else if (corPt>nextPt) {
01102 nextPt = corPt;
01103 p4cortmp[1] = scale*cal->p4();
01104 }
01105
01106 allJetInd++;
01107 if (allJetInd == 1) {
01108 h_jet1Pt->Fill( cal->pt() );
01109 if (JetLoPass != 0) h_jet1PtHLT->Fill( cal->pt() );
01110 pt1 = cal->pt();
01111 p4tmp[0] = cal->p4();
01112 if ( fabs(cal->eta()) < 1.0) EtaOk10++;
01113 if ( fabs(cal->eta()) < 1.3) EtaOk13++;
01114 if ( fabs(cal->eta()) < 4.0) EtaOk40++;
01115 }
01116 if (allJetInd == 2) {
01117 h_jet2Pt->Fill( cal->pt() );
01118 p4tmp[1] = cal->p4();
01119 if ( fabs(cal->eta()) < 1.0) EtaOk10++;
01120 if ( fabs(cal->eta()) < 1.3) EtaOk13++;
01121 if ( fabs(cal->eta()) < 4.0) EtaOk40++;
01122 }
01123
01124 if ( cal->pt() > minJetPt) {
01125 h_ptCal->Fill( cal->pt() );
01126 h_etaCal->Fill( cal->eta() );
01127 h_phiCal->Fill( cal->phi() );
01128 jetInd++;
01129 }
01130 }
01131
01132 h_nCalJets->Fill( jetInd );
01133
01134 if (jetInd > 1) {
01135 LeadMass = (p4tmp[0]+p4tmp[1]).mass();
01136 dijetMass->Fill( LeadMass );
01137 }
01138
01139
01140
01141
01142
01143
01144 int nTow1, nTow2, nTow3, nTow4;
01145
01146
01147
01148
01149
01150 int jjet = 0;
01151 for ( CaloJetCollection::const_iterator ijet=caloJets->begin(); ijet!=caloJets->end(); ijet++) {
01152 jjet++;
01153
01154 float hadEne = ijet->hadEnergyInHB() + ijet->hadEnergyInHO() +
01155 ijet->hadEnergyInHE() + ijet->hadEnergyInHF();
01156 float emEne = ijet->emEnergyInEB() + ijet->emEnergyInEE() + ijet->emEnergyInHF();
01157 float had = ijet->energyFractionHadronic();
01158
01159 float j_et = ijet->et();
01160
01161
01162 if (fabs(ijet->eta()) < 1.3) {
01163 totEneLeadJetEta1->Fill(hadEne+emEne);
01164 hadEneLeadJetEta1->Fill(hadEne);
01165 emEneLeadJetEta1->Fill(emEne);
01166
01167 if (ijet->pt() > minJetPt10)
01168 hadFracEta1->Fill(had);
01169 }
01170
01171
01172 if ((fabs(ijet->eta()) > 1.3) && (fabs(ijet->eta()) < 3.) ) {
01173
01174 totEneLeadJetEta2->Fill(hadEne+emEne);
01175 hadEneLeadJetEta2->Fill(hadEne);
01176 emEneLeadJetEta2->Fill(emEne);
01177
01178 if (ijet->pt() > minJetPt10)
01179 hadFracEta2->Fill(had);
01180 }
01181
01182
01183 if (fabs(ijet->eta()) > 3.) {
01184
01185 totEneLeadJetEta3->Fill(hadEne+emEne);
01186 hadEneLeadJetEta3->Fill(hadEne);
01187 emEneLeadJetEta3->Fill(emEne);
01188
01189 if (ijet->pt() > minJetPt10)
01190 hadFracEta3->Fill(had);
01191 }
01192
01193
01194 const std::vector<CaloTowerPtr> jetCaloRefs = ijet->getCaloConstituents();
01195 int nConstituents = jetCaloRefs.size();
01196 NTowers->Fill(nConstituents);
01197
01198 if (jjet == 1) {
01199
01200 nTow1 = nTow2 = nTow3 = nTow4 = 0;
01201 for (int i = 0; i <nConstituents ; i++){
01202
01203 float et = jetCaloRefs[i]->et();
01204
01205 if (et > 0.5) nTow1++;
01206 if (et > 1.0) nTow2++;
01207 if (et > 1.5) nTow3++;
01208 if (et > 2.0) nTow4++;
01209
01210 hf_TowerJetEt->Fill(et/j_et);
01211
01212 }
01213
01214 nTowersLeadJetPt1->Fill(nTow1);
01215 nTowersLeadJetPt2->Fill(nTow2);
01216 nTowersLeadJetPt3->Fill(nTow3);
01217 nTowersLeadJetPt4->Fill(nTow4);
01218
01219 }
01220
01221 }
01222
01223
01224
01225
01226
01227
01228 double SumPtJet(0);
01229
01230 double SumEtNotJets(0);
01231 double SumEtJets(0);
01232 double SumEtTowers(0);
01233 double TotalClusteredE(0);
01234 double TotalUnclusteredE(0);
01235
01236 double sumJetPx(0);
01237 double sumJetPy(0);
01238
01239 double sumTowerAllPx(0);
01240 double sumTowerAllPy(0);
01241
01242 double sumTowerAllEx(0);
01243 double sumTowerAllEy(0);
01244
01245 double HCALTotalE, HBTotalE, HETotalE, HOTotalE, HFTotalE;
01246 double ECALTotalE, EBTotalE, EETotalE;
01247
01248 std::vector<CaloTowerPtr> UsedTowerList;
01249 std::vector<CaloTower> TowerUsedInJets;
01250 std::vector<CaloTower> TowerNotUsedInJets;
01251
01252
01253
01254
01255
01256 edm::Handle<HcalSourcePositionData> spd;
01257
01258 HCALTotalE = HBTotalE = HETotalE = HOTotalE = HFTotalE = 0.;
01259 try {
01260 std::vector<edm::Handle<HBHERecHitCollection> > colls;
01261 evt.getManyByType(colls);
01262 std::vector<edm::Handle<HBHERecHitCollection> >::iterator i;
01263 for (i=colls.begin(); i!=colls.end(); i++) {
01264 for (HBHERecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
01265
01266 if (j->id().subdet() == HcalBarrel) {
01267 HBEne->Fill(j->energy());
01268 HBTime->Fill(j->time());
01269 HBTvsE->Fill(j->energy(), j->time());
01270
01271 if ((j->time()<25.) || (j->time()>75.)) {
01272 HBEneOOT->Fill(j->energy());
01273 }
01274
01275 if (j->energy() > HBHEThreshold) {
01276 HBEneTh->Fill(j->energy());
01277 HBTimeTh->Fill(j->time());
01278 HBTotalE += j->energy();
01279 HBocc->Fill(j->id().ieta(),j->id().iphi());
01280 hitEta->Fill(j->id().ieta());
01281 hitPhi->Fill(j->id().iphi());
01282 }
01283 if ( (evt.id().run() == 120020) && (evt.id().event() == 453) ) {
01284 HBEneX->Fill(j->energy());
01285 if (j->energy() > HBHEThreshold) HBTimeX->Fill(j->time());
01286 }
01287 if ( (evt.id().run() == 120020) && (evt.id().event() == 457) ) {
01288 HBEneY->Fill(j->energy());
01289 if (j->energy() > HBHEThreshold) HBTimeY->Fill(j->time());
01290 }
01291 }
01292 if (j->id().subdet() == HcalEndcap) {
01293 HEEne->Fill(j->energy());
01294 HETime->Fill(j->time());
01295 HETvsE->Fill(j->energy(), j->time());
01296
01297 if ((j->time()<25.) || (j->time()>75.)) {
01298 HEEneOOT->Fill(j->energy());
01299 }
01300
01301 if (j->energy() > HBHEThreshold) {
01302 HEEneTh->Fill(j->energy());
01303 HETimeTh->Fill(j->time());
01304 HETotalE += j->energy();
01305 HEocc->Fill(j->id().ieta(),j->id().iphi());
01306 hitEta->Fill(j->id().ieta());
01307 hitPhi->Fill(j->id().iphi());
01308 }
01309
01310 if ( (evt.id().run() == 120020) && (evt.id().event() == 453) ) {
01311 HEEneX->Fill(j->energy());
01312 if (j->energy() > HBHEThreshold) HETimeX->Fill(j->time());
01313 }
01314 if ( (evt.id().run() == 120020) && (evt.id().event() == 457) ) {
01315 HEEneY->Fill(j->energy());
01316 if (j->energy() > HBHEThreshold) HETimeY->Fill(j->time());
01317 }
01318
01319
01320 if (j->id().ieta()<0) {
01321 HEnegEne->Fill(j->energy());
01322 if (j->energy() > HBHEThreshold) {
01323 HEnegTime->Fill(j->time());
01324 }
01325 } else {
01326 HEposEne->Fill(j->energy());
01327 if (j->energy() > HBHEThreshold) {
01328 HEposTime->Fill(j->time());
01329 }
01330 }
01331
01332 }
01333
01334
01335
01336
01337
01338
01339
01340
01341
01342
01343 }
01344 }
01345 } catch (...) {
01346 cout << "No HB/HE RecHits." << endl;
01347 }
01348
01349
01350 HFM_ETime = 0.;
01351 HFM_E = 0.;
01352 HFP_ETime = 0.;
01353 HFP_E = 0.;
01354
01355 try {
01356 std::vector<edm::Handle<HFRecHitCollection> > colls;
01357 evt.getManyByType(colls);
01358 std::vector<edm::Handle<HFRecHitCollection> >::iterator i;
01359 for (i=colls.begin(); i!=colls.end(); i++) {
01360 for (HFRecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
01361
01362
01363
01364
01365
01366
01367
01368
01369
01370
01371
01372 if (j->id().subdet() == HcalForward) {
01373 HFEne->Fill(j->energy());
01374 HFTime->Fill(j->time());
01375 HFTvsE->Fill(j->energy(), j->time());
01376 if (j->energy() > HFThreshold) {
01377 HFEneTh->Fill(j->energy());
01378 HFTimeTh->Fill(j->time());
01379 HFTotalE += j->energy();
01380 HFocc->Fill(j->id().ieta(),j->id().iphi());
01381 hitEta->Fill(j->id().ieta());
01382 hitPhi->Fill(j->id().iphi());
01383 }
01384
01385 if (j->id().ieta()<0) {
01386 if (j->energy() > HFThreshold) {
01387
01388 HFEneM->Fill(j->energy());
01389 HFM_ETime += j->energy()*j->time();
01390 HFM_E += j->energy();
01391 }
01392 } else {
01393 if (j->energy() > HFThreshold) {
01394
01395 HFEneP->Fill(j->energy());
01396 HFP_ETime += j->energy()*j->time();
01397 HFP_E += j->energy();
01398 }
01399 }
01400
01401
01402 if (j->id().depth() == 1){
01403 HFLEne->Fill(j->energy());
01404 if (j->energy() > HFThreshold) HFLTime->Fill(j->time());
01405 } else {
01406 HFSEne->Fill(j->energy());
01407 if (j->energy() > HFThreshold) HFSTime->Fill(j->time());
01408 }
01409 }
01410 }
01411 }
01412 } catch (...) {
01413 cout << "No HF RecHits." << endl;
01414 }
01415
01416 for (int i=0; i<100; i++) {
01417 for (int j=0; j<100; j++) {
01418 HFLvsS->Fill(HFRecHit[i][j][1], HFRecHit[i][j][0]);
01419 }
01420 }
01421
01422 if (HFP_E > 0.) HFTimeP->Fill(HFP_ETime / HFP_E);
01423 if (HFM_E > 0.) HFTimeM->Fill(HFM_ETime / HFM_E);
01424
01425 if ((HFP_E > 0.) && (HFM_E > 0.)) {
01426 HF_PMM = (HFP_ETime / HFP_E) - (HFM_ETime / HFM_E);
01427 HFTimePM->Fill(HF_PMM);
01428 } else {
01429 HF_PMM = INVALID;
01430 }
01431
01432
01433
01434 try {
01435 std::vector<edm::Handle<HORecHitCollection> > colls;
01436 evt.getManyByType(colls);
01437 std::vector<edm::Handle<HORecHitCollection> >::iterator i;
01438 for (i=colls.begin(); i!=colls.end(); i++) {
01439 for (HORecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
01440 if (j->id().subdet() == HcalOuter) {
01441 HOEne->Fill(j->energy());
01442 HOTime->Fill(j->time());
01443 HOTvsE->Fill(j->energy(), j->time());
01444 if (j->energy() > HOThreshold) {
01445 HOEneTh->Fill(j->energy());
01446 HOTimeTh->Fill(j->time());
01447 HOTotalE += j->energy();
01448 HOocc->Fill(j->id().ieta(),j->id().iphi());
01449 }
01450
01451
01452 if (((j->id().iphi()>=59 && j->id().iphi()<=70 &&
01453 j->id().ieta()>=11 && j->id().ieta()<=15) ||
01454 (j->id().iphi()>=47 && j->id().iphi()<=58 &&
01455 j->id().ieta()>=5 && j->id().ieta()<=10)))
01456 {
01457 HOSEne->Fill(j->energy());
01458 if (j->energy() > HOThreshold) HOSTime->Fill(j->time());
01459 } else if ((j->id().iphi()<59 || j->id().iphi()>70 ||
01460 j->id().ieta()<11 || j->id().ieta()>15) &&
01461 (j->id().iphi()<47 || j->id().iphi()>58 ||
01462 j->id().ieta()<5 || j->id().ieta()>10))
01463 {
01464 HOHEne->Fill(j->energy());
01465 if (j->energy() > HOThreshold) HOHTime->Fill(j->time());
01466
01467 if (j->id().ieta()<= -11){
01468 HOHrm2Ene->Fill(j->energy());
01469 if (j->energy() > HOThreshold) HOHrm2Time->Fill(j->time());
01470 } else if (j->id().ieta()>= -10 && j->id().ieta() <= -5) {
01471 HOHrm1Ene->Fill(j->energy());
01472 if (j->energy() > HOThreshold) HOHrm1Time->Fill(j->time());
01473 } else if (j->id().ieta()>= -4 && j->id().ieta() <= 4) {
01474 HOHr0Ene->Fill(j->energy());
01475 if (j->energy() > HOThreshold) HOHr0Time->Fill(j->time());
01476 } else if (j->id().ieta()>= 5 && j->id().ieta() <= 10) {
01477 HOHrp1Ene->Fill(j->energy());
01478 if (j->energy() > HOThreshold) HOHrp1Time->Fill(j->time());
01479 } else if (j->id().ieta()>= 11) {
01480 HOHrp2Ene->Fill(j->energy());
01481 if (j->energy() > HOThreshold) HOHrp2Time->Fill(j->time());
01482 } else {
01483 std::cout << "Finding events that are in no ring !?!" << std::endl;
01484 std::cout << "eta = " << j->id().ieta() << std::endl;
01485
01486 }
01487 } else {
01488 std::cout << "Finding events that are neither SiPM nor HPD!?" << std::endl;
01489 }
01490
01491
01492
01493 }
01494
01495 }
01496 }
01497 } catch (...) {
01498 cout << "No HO RecHits." << endl;
01499 }
01500
01501 HCALTotalE = HBTotalE + HETotalE + HFTotalE + HOTotalE;
01502 ECALTotalE = EBTotalE = EETotalE = 0.;
01503
01504
01505 try {
01506 std::vector<edm::Handle<EcalRecHitCollection> > colls;
01507 evt.getManyByType(colls);
01508 std::vector<edm::Handle<EcalRecHitCollection> >::iterator i;
01509 for (i=colls.begin(); i!=colls.end(); i++) {
01510 for (EcalRecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
01511 if (j->id().subdetId() == EcalBarrel) {
01512 EBEne->Fill(j->energy());
01513 EBTime->Fill(j->time());
01514 if (j->energy() > EBEEThreshold) {
01515 EBEneTh->Fill(j->energy());
01516 EBTimeTh->Fill(j->time());
01517 }
01518 if ( (evt.id().run() == 120020) && (evt.id().event() == 453) ) {
01519 EBEneX->Fill(j->energy());
01520 EBTimeX->Fill(j->time());
01521 }
01522 if ( (evt.id().run() == 120020) && (evt.id().event() == 457) ) {
01523 EBEneY->Fill(j->energy());
01524 EBTimeY->Fill(j->time());
01525 }
01526 EBTotalE += j->energy();
01527 }
01528 if (j->id().subdetId() == EcalEndcap) {
01529 EEEne->Fill(j->energy());
01530 EETime->Fill(j->time());
01531 if (j->energy() > EBEEThreshold) {
01532 EEEneTh->Fill(j->energy());
01533 EETimeTh->Fill(j->time());
01534 }
01535 if ( (evt.id().run() == 120020) && (evt.id().event() == 453) ) {
01536 EEEneX->Fill(j->energy());
01537 EETimeX->Fill(j->time());
01538 }
01539 if ( (evt.id().run() == 120020) && (evt.id().event() == 457 ) ) {
01540 EEEneY->Fill(j->energy());
01541 EETimeY->Fill(j->time());
01542 }
01543 EETotalE += j->energy();
01544 }
01545
01546
01547 }
01548 }
01549 } catch (...) {
01550 cout << "No ECAL RecHits." << endl;
01551 }
01552
01553 EBvHB->Fill(HBTotalE, EBTotalE);
01554 EEvHE->Fill(HETotalE, EETotalE);
01555
01556
01557
01558
01559
01560
01561
01562
01563
01564
01565
01566
01567
01568
01569
01570
01571
01572
01573
01574
01575
01576
01577
01578
01579
01580
01581
01582
01583
01584
01585
01586
01587
01588
01589
01590
01591
01592
01593
01594
01595
01596
01597
01598
01599
01600
01601
01602
01603
01604
01605
01606 ECALTotalE = EBTotalE + EETotalE;
01607
01608 if ( (EBTotalE > 320000) && (EBTotalE < 330000) &&
01609 (HBTotalE > 2700000) && (HBTotalE < 2800000) ) {
01610
01611 std::cout << ">>> Off Axis! "
01612 << std::endl;
01613
01614 }
01615
01616 std::cout << " Rechits: Total Energy : "
01617 << " HCAL= " << HCALTotalE
01618 << " ECAL= " << ECALTotalE
01619 << " HB = " << HBTotalE
01620 << " EB = " << EBTotalE
01621 << std::endl;
01622
01623
01624
01625
01626
01627
01628
01629
01630 nTow1 = nTow2 = nTow3 = nTow4 = 0;
01631
01632 double sum_et = 0.0;
01633 double sum_ex = 0.0;
01634 double sum_ey = 0.0;
01635
01636
01637
01638
01639
01640 for (CaloTowerCollection::const_iterator tower = caloTowers->begin();
01641 tower != caloTowers->end(); tower++) {
01642
01643 Double_t et = tower->et();
01644
01645 if (et > 0.5) nTow1++;
01646 if (et > 1.0) nTow2++;
01647 if (et > 1.5) nTow3++;
01648 if (et > 2.0) nTow4++;
01649
01650
01651
01652
01653
01654 if (tower->emEnergy() > 2.0) {
01655 h_EmEnergy->Fill (tower->ieta(), tower->iphi(), tower->emEnergy());
01656 }
01657 if (tower->hadEnergy() > 2.0) {
01658 h_HadEnergy->Fill (tower->ieta(), tower->iphi(), tower->hadEnergy());
01659 }
01660
01661 if (et>0.5) {
01662
01663 ETime->Fill(tower->ecalTime());
01664 HTime->Fill(tower->hcalTime());
01665
01666
01667 double phix = tower->phi();
01668
01669
01670
01671
01672 double et = tower->et();
01673
01674
01675 sum_et += et;
01676 sum_ex += et*cos(phix);
01677 sum_ey += et*sin(phix);
01678
01679
01680 Double_t phi = tower->phi();
01681 SumEtTowers += tower->et();
01682
01683 sumTowerAllEx += et*cos(phi);
01684 sumTowerAllEy += et*sin(phi);
01685
01686 }
01687
01688 }
01689
01690
01691
01692
01693 hf_sumTowerAllEx->Fill(sumTowerAllEx);
01694 hf_sumTowerAllEy->Fill(sumTowerAllEy);
01695
01696 nTowers1->Fill(nTow1);
01697 nTowers2->Fill(nTow2);
01698 nTowers3->Fill(nTow3);
01699 nTowers4->Fill(nTow4);
01700
01701
01702
01703
01704
01705 UsedTowerList.clear();
01706 TowerUsedInJets.clear();
01707 TowerNotUsedInJets.clear();
01708
01709
01710
01711 for ( CaloJetCollection::const_iterator ijet=caloJets->begin(); ijet!=caloJets->end(); ijet++) {
01712
01713 Double_t jetPt = ijet->pt();
01714 Double_t jetEta = ijet->eta();
01715 Double_t jetPhi = ijet->phi();
01716
01717
01718
01719 Double_t jetPx = jetPt*cos(jetPhi);
01720 Double_t jetPy = jetPt*sin(jetPhi);
01721
01722 sumJetPx +=jetPx;
01723 sumJetPy +=jetPy;
01724
01725 const std::vector<CaloTowerPtr> jetCaloRefs = ijet->getCaloConstituents();
01726 int nConstituents = jetCaloRefs.size();
01727 for (int i = 0; i <nConstituents ; i++){
01728
01729 UsedTowerList.push_back(jetCaloRefs[i]);
01730 }
01731
01732 SumPtJet +=jetPt;
01733
01734
01735
01736 if ( (jetPt>80.0) && (fabs(jetEta) < 1.3) ){
01737 st_Pt->Fill( jetPt );
01738 int nConstituents = ijet->getCaloConstituents().size();
01739 st_Constituents->Fill( nConstituents );
01740
01741 float maxEne = 0.;
01742 float totEne = 0.;
01743
01744 for(unsigned twr=0; twr<ijet->getCaloConstituents().size(); ++twr){
01745 CaloTowerPtr tower = (ijet->getCaloConstituents())[twr];
01746
01747 if( tower->et()>0. ){
01748
01749 if (tower->energy() > maxEne) maxEne = tower->energy();
01750 totEne += tower->energy();
01751
01752 st_Energy->Fill( tower->energy() );
01753 st_EmEnergy->Fill( tower->emEnergy() );
01754 st_HadEnergy->Fill( tower->hadEnergy() );
01755 st_OuterEnergy->Fill( tower->outerEnergy() );
01756
01757 st_Eta->Fill( tower->eta() );
01758 st_Phi->Fill( tower->phi() );
01759
01760 st_iEta->Fill( tower->ieta() );
01761 st_iPhi->Fill( tower->iphi() );
01762
01763
01764
01765
01766
01767
01768
01769
01770
01771
01772
01773
01774
01775
01776
01777 }
01778 }
01779 st_Frac->Fill( maxEne / totEne );
01780
01781 }
01782
01783 }
01784
01785 int NTowersUsed = UsedTowerList.size();
01786
01787
01788 for (CaloTowerCollection::const_iterator tower = caloTowers->begin();
01789 tower != caloTowers->end(); tower++) {
01790
01791 CaloTower t = *tower;
01792 Double_t et = tower->et();
01793
01794 if(et>0) {
01795
01796 Double_t phi = tower->phi();
01797 SumEtTowers += tower->et();
01798
01799 sumTowerAllPx += et*cos(phi);
01800 sumTowerAllPy += et*sin(phi);
01801
01802 bool used = false;
01803
01804 for(int i=0; i<NTowersUsed; i++){
01805 if(tower->id() == UsedTowerList[i]->id()){
01806 used=true;
01807 break;
01808 }
01809 }
01810
01811 if (used) {
01812 TowerUsedInJets.push_back(t);
01813 } else {
01814 TowerNotUsedInJets.push_back(t);
01815 }
01816 }
01817 }
01818
01819 int nUsed = TowerUsedInJets.size();
01820 int nNotUsed = TowerNotUsedInJets.size();
01821
01822 SumEtJets = 0;
01823 SumEtNotJets = 0;
01824 TotalClusteredE = 0;
01825 TotalUnclusteredE = 0;
01826
01827 for(int i=0;i<nUsed;i++){
01828 SumEtJets += TowerUsedInJets[i].et();
01829 h_ClusteredE->Fill(TowerUsedInJets[i].energy());
01830 if (TowerUsedInJets[i].energy() > 1.0)
01831 TotalClusteredE += TowerUsedInJets[i].energy();
01832 }
01833 h_jetEt->Fill(SumEtJets);
01834
01835 for(int i=0;i<nNotUsed;i++){
01836 if (TowerNotUsedInJets[i].et() > 0.5)
01837 SumEtNotJets += TowerNotUsedInJets[i].et();
01838 h_UnclusteredEt->Fill(TowerNotUsedInJets[i].et());
01839 h_UnclusteredEts->Fill(TowerNotUsedInJets[i].et());
01840 h_UnclusteredE->Fill(TowerNotUsedInJets[i].energy());
01841 if (TowerNotUsedInJets[i].energy() > 1.0)
01842 TotalUnclusteredE += TowerNotUsedInJets[i].energy();
01843 }
01844
01845 h_TotalClusteredE->Fill(TotalClusteredE);
01846 h_TotalUnclusteredE->Fill(TotalUnclusteredE);
01847 h_TotalUnclusteredEt->Fill(SumEtNotJets);
01848
01849
01850
01851
01852
01853 edm::Handle<reco::CaloMETCollection> calometcoll;
01854 evt.getByLabel("met", calometcoll);
01855 if (calometcoll.isValid()) {
01856 const CaloMETCollection *calometcol = calometcoll.product();
01857 const CaloMET *calomet;
01858 calomet = &(calometcol->front());
01859
01860 double caloSumET = calomet->sumEt();
01861 double caloMET = calomet->pt();
01862 double caloMETSig = calomet->mEtSig();
01863 double caloMEx = calomet->px();
01864 double caloMEy = calomet->py();
01865 double caloMETPhi = calomet->phi();
01866
01867 SumEt->Fill(caloSumET);
01868 MET->Fill(caloMET);
01869 if (evtType == 0) MET_Tower->Fill(caloMET);
01870 if (evtType == 1) MET_RBX->Fill(caloMET);
01871 if (evtType == 2) MET_HPD->Fill(caloMET);
01872 METSig->Fill(caloMETSig);
01873 MEx->Fill(caloMEx);
01874 MEy->Fill(caloMEy);
01875 METPhi->Fill(caloMETPhi);
01876
01877
01878
01879
01880
01881
01882
01883
01884
01885
01886
01887
01888
01889
01890
01891
01892
01893 }
01894
01895
01896
01897
01898 VTX = INVALID;
01899 nVTX = 0;
01900
01901 edm::Handle<reco::VertexCollection> vertexCollection;
01902 evt.getByLabel("offlinePrimaryVertices", vertexCollection);
01903 const reco::VertexCollection vC = *(vertexCollection.product());
01904
01905 std::cout << "Reconstructed "<< vC.size() << " vertices" << std::endl ;
01906 nVTX = vC.size();
01907 for (reco::VertexCollection::const_iterator vertex=vC.begin(); vertex!=vC.end(); vertex++){
01908
01909 h_Vx->Fill(vertex->x());
01910 h_Vy->Fill(vertex->y());
01911 h_Vz->Fill(vertex->z());
01912 VTX = vertex->z();
01913
01914
01915 }
01916
01917 if ((HF_PMM != INVALID) || (nVTX > 0)) {
01918 HFvsZ->Fill(HF_PMM,VTX);
01919 }
01920
01921
01922
01923
01924 edm::Handle<reco::TrackCollection> trackCollection;
01925
01926 evt.getByLabel("generalTracks", trackCollection);
01927
01928 const reco::TrackCollection tC = *(trackCollection.product());
01929
01930 std::cout << "ANA: Reconstructed "<< tC.size() << " tracks" << std::endl ;
01931
01932 h_Trk_NTrk->Fill(tC.size());
01933 for (reco::TrackCollection::const_iterator track=tC.begin(); track!=tC.end(); track++){
01934
01935 h_Trk_pt->Fill(track->pt());
01936
01937 }
01938
01939
01940
01941
01942
01943
01944
01945
01946
01947
01948
01949
01950
01951
01952
01953
01954
01955
01956
01957
01958
01959
01960
01961
01962
01963
01964
01965
01966
01967
01968
01969
01970
01971
01972
01973
01974
01975
01976
01977
01978
01979
01980
01981
01982
01983
01984
01985
01986
01987
01988
01989
01990
01991
01992 int iJet;
01993 iJet = 0;
01994 for( CaloJetCollection::const_iterator ijet = caloJets->begin(); ijet != caloJets->end(); ++ ijet ) {
01995
01996
01997
01998
01999
02000
02001
02002 iJet++;
02003 if (iJet == 1) {
02004 cout << " CaloJet: Event Type = " << evtType
02005 << " pt = " << ijet->pt()
02006 << endl;
02007 }
02008 h_pt->Fill(ijet->pt());
02009 if (evtType == 0) h_ptTower->Fill(ijet->pt());
02010 if (evtType == 1) h_ptRBX->Fill(ijet->pt());
02011 if (evtType == 2) h_ptHPD->Fill(ijet->pt());
02012 h_et->Fill(ijet->et());
02013 h_eta->Fill(ijet->eta());
02014 h_phi->Fill(ijet->phi());
02015
02016 jetHOEne->Fill(ijet->hadEnergyInHO());
02017 jetEMFraction->Fill(ijet->emEnergyFraction());
02018
02019
02020 }
02021
02022
02023
02024
02025
02026
02027
02028
02029
02030
02031
02032
02033
02034
02035
02036
02037
02038
02039
02040
02041
02042
02043
02044
02045
02046
02047
02048
02049
02050
02051
02052
02053
02054
02055
02056
02057
02058
02059
02060
02061 }
02062
02063 }
02064
02065
02066
02067 void myJetAna::endJob() {
02068
02069 for (int i=0; i<4000; i++) {
02070 if ((nBNC[i]/totBNC) > 0.05) {
02071 std::cout << "+++ " << i << " "
02072 << (nBNC[i]/totBNC) << " "
02073 << nBNC[i] << " "
02074 << totBNC << " "
02075 << std::endl;
02076 }
02077 }
02078
02079
02080 }
02081 #include "FWCore/Framework/interface/MakerMacros.h"
02082 DEFINE_FWK_MODULE(myJetAna);