CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/RecoJets/JetAnalyzers/src/myJetAna.cc

Go to the documentation of this file.
00001 // myJetAna.cc
00002 // Description:  Access Cruzet Data
00003 // Author: Frank Chlebana
00004 // Date:  24 - July - 2008
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 "RecoLocalCalo/HcalRecAlgos/interface/HcalCaloFlagLabels.h"
00016 
00017 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
00018 #include "DataFormats/HcalRecHit/interface/HcalSourcePositionData.h"
00019 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
00020 
00021 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
00022 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00023 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00024 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00025 
00026 #include "FWCore/Framework/interface/ESHandle.h"
00027 #include "Geometry/Records/interface/CaloGeometryRecord.h"
00028 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00029 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
00030 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
00031 #include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
00032 
00033 #include "DataFormats/TrackReco/interface/Track.h"
00034 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00035 #include "DataFormats/TrackReco/interface/Track.h"
00036 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
00037 
00038 #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h"
00039 
00040 #include "DataFormats/MuonReco/interface/Muon.h"
00041 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00042 
00043 #include "DataFormats/VertexReco/interface/Vertex.h"
00044 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00045 
00046 // #include "DataFormats/PhotonReco/interface/PhotonFwd.h"
00047 // #include "DataFormats/PhotonReco/interface/Photon.h"
00048 
00049 
00050 #include "DataFormats/Math/interface/deltaR.h"
00051 #include "DataFormats/Math/interface/deltaPhi.h"
00052 // #include "DataFormats/HepMCCandidate/interface/GenParticleCandidate.h"
00053 #include "DataFormats/Candidate/interface/Candidate.h"
00054 // #include "FWCore/Framework/interface/Handle.h"
00055 #include "FWCore/Framework/interface/Event.h"
00056 // #include "FWCore/Framework/interface/EventSetup.h"
00057 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00058 
00059 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
00060 
00061 #include "DataFormats/HLTReco/interface/TriggerObject.h"
00062 // #include "FWCore/Common/interface/TriggerNames.h"
00063 #include "DataFormats/Common/interface/TriggerResults.h"
00064 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
00065 #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
00066 
00067 // #include "DataFormats/Scalers/interface/DcsStatus.h"
00068 
00069 // include files
00070 #include "CommonTools/RecoAlgos/interface/HBHENoiseFilter.h"
00071 #include "DataFormats/METReco/interface/HcalNoiseSummary.h"
00072 
00073 #include "RecoLocalCalo/HcalRecAlgos/interface/HcalCaloFlagLabels.h"  
00074 
00075 
00076 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00077 #include "JetMETCorrections/Objects/interface/JetCorrector.h"
00078 #include <TROOT.h>
00079 #include <TSystem.h>
00080 #include <TFile.h>
00081 #include <TCanvas.h>
00082 #include <cmath>
00083 
00084 using namespace edm;
00085 using namespace reco;
00086 using namespace std;
00087 
00088 
00089 #define INVALID 9999.
00090 #define DEBUG false
00091 #define MAXJETS 100
00092 
00093 typedef struct RBX_struct {
00094   double et;
00095   double hadEnergy;
00096   double emEnergy;
00097   float  hcalTime;
00098   float  ecalTime;
00099   int    nTowers;
00100 } RBX ;
00101 
00102 typedef struct HPD_struct {
00103   double et;
00104   double hadEnergy;
00105   double emEnergy;
00106   double time;
00107   float  hcalTime;
00108   float  ecalTime;
00109   int    nTowers;
00110 } HPD ;
00111 
00112 
00113 
00114 float totBNC, nBNC[4000];
00115 
00116 RBX RBXColl[36];
00117 HPD HPDColl[144];
00118 
00119 // ************************
00120 // ************************
00121 
00122 // Get the algorithm of the jet collections we will read from the .cfg file 
00123 // which defines the value of the strings CaloJetAlgorithm and GenJetAlgorithm.
00124 
00125 myJetAna::myJetAna( const ParameterSet & cfg ) :
00126   CaloJetAlgorithm( cfg.getParameter<string>( "CaloJetAlgorithm" ) ), 
00127   GenJetAlgorithm( cfg.getParameter<string>( "GenJetAlgorithm" ) ),
00128   hcalNoiseSummaryTag_(cfg.getParameter<edm::InputTag>("hcalNoiseSummaryTag"))
00129 {
00130   theTriggerResultsLabel = cfg.getParameter<edm::InputTag>("TriggerResultsLabel");
00131 }
00132 
00133 
00134 // ************************
00135 // ************************
00136 
00137 void myJetAna::beginJob( ) {
00138 
00139 
00140 
00141   edm::Service<TFileService> fs;
00142 
00143   // --- passed selection cuts 
00144   h_pt     = fs->make<TH1F>( "pt",  "Jet p_{T}", 100, 0, 50 );
00145   h_ptRBX  = fs->make<TH1F>( "ptRBX",  "RBX: Jet p_{T}", 100, 0, 50 );
00146   h_ptHPD  = fs->make<TH1F>( "ptHPD",  "HPD: Jet p_{T}", 100, 0, 50 );
00147   h_ptTower  = fs->make<TH1F>( "ptTower",  "Jet p_{T}", 100, 0, 50 );
00148   h_et     = fs->make<TH1F>( "et",  "Jet E_{T}", 100, 0, 50 );
00149   h_eta    = fs->make<TH1F>( "eta", "Jet #eta", 100, -5, 5 );
00150   h_phi    = fs->make<TH1F>( "phi", "Jet #phi", 50, -M_PI, M_PI );
00151   // ---
00152 
00153   hitEtaEt  = fs->make<TH1F>( "hitEtaEt", "RecHit #eta", 90, -45, 45 );
00154   hitEta    = fs->make<TH1F>( "hitEta", "RecHit #eta", 90, -45, 45 );
00155   hitPhi    = fs->make<TH1F>( "hitPhi", "RecHit #phi", 73, 0, 73 );
00156 
00157   caloEtaEt  = fs->make<TH1F>( "caloEtaEt", "CaloTower #eta", 100, -4, 4 );
00158   caloEta    = fs->make<TH1F>( "caloEta", "CaloTower #eta", 100, -4, 4 );
00159   caloPhi    = fs->make<TH1F>( "caloPhi", "CaloTower #phi", 50, -M_PI, M_PI );
00160 
00161   dijetMass  =  fs->make<TH1F>("dijetMass","DiJet Mass",100,0,100);
00162 
00163   totEneLeadJetEta1 = fs->make<TH1F>("totEneLeadJetEta1","Total Energy Lead Jet Eta1 1",100,0,100);
00164   totEneLeadJetEta2 = fs->make<TH1F>("totEneLeadJetEta2","Total Energy Lead Jet Eta2 1",150,0,150);
00165   totEneLeadJetEta3 = fs->make<TH1F>("totEneLeadJetEta3","Total Energy Lead Jet Eta3 1",150,0,150);
00166 
00167   hadEneLeadJetEta1 = fs->make<TH1F>("hadEneLeadJetEta1","Hadronic Energy Lead Jet Eta1 1",50,0,50);
00168   hadEneLeadJetEta2 = fs->make<TH1F>("hadEneLeadJetEta2","Hadronic Energy Lead Jet Eta2 1",100,0,100);
00169   hadEneLeadJetEta3 = fs->make<TH1F>("hadEneLeadJetEta3","Hadronic Energy Lead Jet Eta3 1",100,0,100);
00170   emEneLeadJetEta1  = fs->make<TH1F>("emEneLeadJetEta1","EM Energy Lead Jet Eta1 1",50,0,50);
00171   emEneLeadJetEta2  = fs->make<TH1F>("emEneLeadJetEta2","EM Energy Lead Jet Eta2 1",100,0,100);
00172   emEneLeadJetEta3  = fs->make<TH1F>("emEneLeadJetEta3","EM Energy Lead Jet Eta3 1",100,0,100);
00173 
00174 
00175   hadFracEta1 = fs->make<TH1F>("hadFracEta11","Hadronic Fraction Eta1 Jet 1",100,0,1);
00176   hadFracEta2 = fs->make<TH1F>("hadFracEta21","Hadronic Fraction Eta2 Jet 1",100,0,1);
00177   hadFracEta3 = fs->make<TH1F>("hadFracEta31","Hadronic Fraction Eta3 Jet 1",100,0,1);
00178 
00179   HFSumEt  = fs->make<TH1F>("HFSumEt","HFSumEt",100,0,100);
00180   HFMET    = fs->make<TH1F>("HFMET",  "HFMET",120,0,120);
00181 
00182   SumEt  = fs->make<TH1F>("SumEt","SumEt",100,0,100);
00183   MET    = fs->make<TH1F>("MET",  "MET",120,0,120);
00184   OERMET    = fs->make<TH1F>("OERMET",  "OERMET",120,0,120);
00185   METSig = fs->make<TH1F>("METSig",  "METSig",100,0,50);
00186   MEx    = fs->make<TH1F>("MEx",  "MEx",100,-20,20);
00187   MEy    = fs->make<TH1F>("MEy",  "MEy",100,-20,20);
00188   METPhi = fs->make<TH1F>("METPhi",  "METPhi",315,0,3.15);
00189   MET_RBX    = fs->make<TH1F>("MET_RBX",  "MET",100,0,1000);
00190   MET_HPD    = fs->make<TH1F>("MET_HPD",  "MET",100,0,1000);
00191   MET_Tower  = fs->make<TH1F>("MET_Tower",  "MET",100,0,1000);
00192 
00193   SiClusters = fs->make<TH1F>("SiClusters",  "SiClusters",150,0,1500);
00194 
00195   h_Vx     = fs->make<TH1F>("Vx",  "Vx",100,-0.5,0.5);
00196   h_Vy     = fs->make<TH1F>("Vy",  "Vy",100,-0.5,0.5);
00197   h_Vz     = fs->make<TH1F>("Vz",  "Vz",100,-20,20);
00198   h_VNTrks = fs->make<TH1F>("VNTrks",  "VNTrks",10,1,100);
00199 
00200   h_Trk_pt   = fs->make<TH1F>("Trk_pt",  "Trk_pt",100,0,20);
00201   h_Trk_NTrk = fs->make<TH1F>("Trk_NTrk",  "Trk_NTrk",150,0,150);
00202 
00203   hf_sumTowerAllEx = fs->make<TH1F>("sumTowerAllEx","Tower Ex",100,-1000,1000);
00204   hf_sumTowerAllEy = fs->make<TH1F>("sumTowerAllEy","Tower Ey",100,-1000,1000);
00205 
00206   hf_TowerJetEt   = fs->make<TH1F>("TowerJetEt","Tower/Jet Et 1",50,0,1);
00207 
00208   ETime = fs->make<TH1F>("ETime","Ecal Time",200,-200,200);
00209   HTime = fs->make<TH1F>("HTime","Hcal Time",200,-200,200);
00210 
00211   towerHadEnHB    = fs->make<TH1F>("towerHadEnHB" ,"HB: Calo Tower HAD Energy",210,-1,20);
00212   towerHadEnHE    = fs->make<TH1F>("towerHadEnHE" ,"HE: Calo Tower HAD Energy",510,-1,50);
00213   towerHadEnHF    = fs->make<TH1F>("towerHadEnHF" ,"HF: Calo Tower HAD Energy",510,-1,50);
00214 
00215   towerEmEnHB    = fs->make<TH1F>("towerEmEnHB" ,"HB: Calo Tower EM Energy",210,-1,20);
00216   towerEmEnHE    = fs->make<TH1F>("towerEmEnHE" ,"HE: Calo Tower EM Energy",510,-1,50);
00217   towerEmEnHF    = fs->make<TH1F>("towerEmEnHF" ,"HF: Calo Tower EM Energy",510,-1,50);
00218 
00219   towerHadEn    = fs->make<TH1F>("towerHadEn" ,"Hadronic Energy in Calo Tower",2000,-100,100);
00220   towerEmEn     = fs->make<TH1F>("towerEmEn"  ,"EM Energy in Calo Tower",2000,-100,100);
00221   towerOuterEn  = fs->make<TH1F>("towerOuterEn"  ,"HO Energy in Calo Tower",2000,-100,100);
00222 
00223   towerEmFrac   = fs->make<TH1F>("towerEmFrac","EM Fraction of Energy in Calo Tower",100,-1.,1.);
00224 
00225   RBX_et        = fs->make<TH1F>("RBX_et","ET in RBX",1000,-20,100);
00226   RBX_hadEnergy = fs->make<TH1F>("RBX_hadEnergy","Hcal Energy in RBX",1000,-20,100);
00227   RBX_hcalTime  = fs->make<TH1F>("RBX_hcalTime","Hcal Time in RBX",200,-200,200);
00228   RBX_nTowers   = fs->make<TH1F>("RBX_nTowers","Number of Towers in RBX",75,0,75);
00229   RBX_N         = fs->make<TH1F>("RBX_N","Number of RBX",10,0,10);
00230 
00231   HPD_et        = fs->make<TH1F>("HPD_et","ET in HPD",1000,-20,100);
00232   HPD_hadEnergy = fs->make<TH1F>("HPD_hadEnergy","Hcal Energy in HPD",1000,-20,100);
00233   HPD_hcalTime  = fs->make<TH1F>("HPD_hcalTime","Hcal Time in HPD",200,-200,200);
00234   HPD_nTowers   = fs->make<TH1F>("HPD_nTowers","Number of Towers in HPD",20,0,20);
00235   HPD_N         = fs->make<TH1F>("HPD_N","Number of HPD",10,0,10);
00236   
00237   nTowers1  = fs->make<TH1F>("nTowers1","Number of Towers pt 0.5",100,0,200);
00238   nTowers2  = fs->make<TH1F>("nTowers2","Number of Towers pt 1.0",100,0,200);
00239   nTowers3  = fs->make<TH1F>("nTowers3","Number of Towers pt 1.5",100,0,200);
00240   nTowers4  = fs->make<TH1F>("nTowers4","Number of Towers pt 2.0",100,0,200);
00241 
00242   nTowersLeadJetPt1  = fs->make<TH1F>("nTowersLeadJetPt1","Number of Towers in Lead Jet pt 0.5",100,0,100);
00243   nTowersLeadJetPt2  = fs->make<TH1F>("nTowersLeadJetPt2","Number of Towers in Lead Jet pt 1.0",100,0,100);
00244   nTowersLeadJetPt3  = fs->make<TH1F>("nTowersLeadJetPt3","Number of Towers in Lead Jet pt 1.5",100,0,100);
00245   nTowersLeadJetPt4  = fs->make<TH1F>("nTowersLeadJetPt4","Number of Towers in Lead Jet pt 2.0",100,0,100);
00246 
00247   h_nCalJets  =  fs->make<TH1F>( "nCalJets",  "Number of CalJets", 20, 0, 20 );
00248 
00249   HBEneOOT  = fs->make<TH1F>( "HBEneOOT",  "HBEneOOT", 200, -5, 10 );
00250   HEEneOOT  = fs->make<TH1F>( "HEEneOOT",  "HEEneOOT", 200, -5, 10 );
00251   HFEneOOT  = fs->make<TH1F>( "HFEneOOT",  "HFEneOOT", 200, -5, 10 );
00252   HOEneOOT  = fs->make<TH1F>( "HOEneOOT",  "HOEneOOT", 200, -5, 10 );
00253 
00254   HBEneOOTTh  = fs->make<TH1F>( "HBEneOOTTh",  "HBEneOOTTh", 200, -5, 10 );
00255   HEEneOOTTh  = fs->make<TH1F>( "HEEneOOTTh",  "HEEneOOTTh", 200, -5, 10 );
00256   HFEneOOTTh  = fs->make<TH1F>( "HFEneOOTTh",  "HFEneOOTTh", 200, -5, 10 );
00257   HOEneOOTTh  = fs->make<TH1F>( "HOEneOOTTh",  "HOEneOOTTh", 200, -5, 10 );
00258 
00259   HBEneOOTTh1  = fs->make<TH1F>( "HBEneOOTTh1",  "HBEneOOT", 200, -5, 10 );
00260   HEEneOOTTh1  = fs->make<TH1F>( "HEEneOOTTh1",  "HEEneOOT", 200, -5, 10 );
00261   HFEneOOTTh1  = fs->make<TH1F>( "HFEneOOTTh1",  "HFEneOOT", 200, -5, 10 );
00262   HOEneOOTTh1  = fs->make<TH1F>( "HOEneOOTTh1",  "HOEneOOT", 200, -5, 10 );
00263 
00264   HBEneTThr     = fs->make<TH1F>( "HBEneTThr",  "HBEneTThr", 105, -5, 100 );
00265   HEEneTThr     = fs->make<TH1F>( "HEEneTThr",  "HEEneTThr", 105, -5, 100 );
00266   HFEneTThr     = fs->make<TH1F>( "HFEneTThr",  "HFEneTThr", 105, -5, 100 );
00267 
00268 
00269   HBEne     = fs->make<TH1F>( "HBEne",  "HBEne", 205, -5, 200 );
00270   HBEneTh   = fs->make<TH1F>( "HBEneTh",  "HBEneTh", 205, -5, 200 );
00271   HBEneTh1  = fs->make<TH1F>( "HBEneTh1",  "HBEneTh1", 205, -5, 200 );
00272   HBEneX    = fs->make<TH1F>( "HBEneX",  "HBEneX", 200, -5, 10 );
00273   HBEneY    = fs->make<TH1F>( "HBEneY",  "HBEnedY", 200, -5, 10 );
00274   HBTime    = fs->make<TH1F>( "HBTime", "HBTime", 200, -100, 100 );
00275   HBTimeTh  = fs->make<TH1F>( "HBTimeTh", "HBTimeTh", 200, -100, 100 );
00276   HBTimeTh1  = fs->make<TH1F>( "HBTimeTh1", "HBTimeTh1", 200, -100, 100 );
00277   HBTimeTh2  = fs->make<TH1F>( "HBTimeTh2", "HBTimeTh2", 200, -100, 100 );
00278   HBTimeTh3  = fs->make<TH1F>( "HBTimeTh3", "HBTimeTh3", 200, -100, 100 );
00279   HBTimeThR  = fs->make<TH1F>( "HBTimeThR", "HBTimeThR", 200, -100, 100 );
00280   HBTimeTh1R  = fs->make<TH1F>( "HBTimeTh1R", "HBTimeTh1R", 200, -100, 100 );
00281   HBTimeTh2R  = fs->make<TH1F>( "HBTimeTh2R", "HBTimeTh2R", 200, -100, 100 );
00282   HBTimeTh3R  = fs->make<TH1F>( "HBTimeTh3R", "HBTimeTh3R", 200, -100, 100 );
00283 
00284   HBTimeFlagged    = fs->make<TH1F>( "HBTimeFlagged", "HBTimeFlagged", 200, -100, 100 );
00285   HBTimeThFlagged    = fs->make<TH1F>( "HBTimeThFlagged", "HBTimeThFlagged", 200, -100, 100 );
00286   HBTimeTh1Flagged    = fs->make<TH1F>( "HBTimeTh1Flagged", "HBTimeTh1Flagged", 200, -100, 100 );
00287   HBTimeTh2Flagged    = fs->make<TH1F>( "HBTimeTh2Flagged", "HBTimeTh2Flagged", 200, -100, 100 );
00288 
00289   HBTimeFlagged2    = fs->make<TH1F>( "HBTimeFlagged2", "HBTimeFlagged2", 200, -100, 100 );
00290   HBTimeThFlagged2    = fs->make<TH1F>( "HBTimeThFlagged2", "HBTimeThFlagged2", 200, -100, 100 );
00291   HBTimeTh1Flagged2    = fs->make<TH1F>( "HBTimeTh1Flagged2", "HBTimeTh1Flagged2", 200, -100, 100 );
00292   HBTimeTh2Flagged2    = fs->make<TH1F>( "HBTimeTh2Flagged2", "HBTimeTh2Flagged2", 200, -100, 100 );
00293 
00294   HBTimeX   = fs->make<TH1F>( "HBTimeX", "HBTimeX", 200, -100, 100 );
00295   HBTimeY   = fs->make<TH1F>( "HBTimeY", "HBTimeY", 200, -100, 100 );
00296   HEEne     = fs->make<TH1F>( "HEEne",  "HEEne", 205, -5, 200 );
00297   HEEneTh   = fs->make<TH1F>( "HEEneTh",  "HEEneTh", 205, -5, 200 );
00298   HEEneTh1  = fs->make<TH1F>( "HEEneTh1",  "HEEneTh1", 205, -5, 200 );
00299   HEEneX    = fs->make<TH1F>( "HEEneX",  "HEEneX", 200, -5, 10 );
00300   HEEneY    = fs->make<TH1F>( "HEEneY",  "HEEneY", 200, -5, 10 );
00301   HEposEne  = fs->make<TH1F>( "HEposEne",  "HEposEne", 200, -5, 10 );
00302   HEnegEne  = fs->make<TH1F>( "HEnegEne",  "HEnegEne", 200, -5, 10 );
00303   HETime    = fs->make<TH1F>( "HETime", "HETime", 200, -100, 100 );
00304   HETimeTh  = fs->make<TH1F>( "HETimeTh", "HETimeTh", 200, -100, 100 );
00305   HETimeTh1  = fs->make<TH1F>( "HETimeTh1", "HETimeTh1", 200, -100, 100 );
00306   HETimeTh2  = fs->make<TH1F>( "HETimeTh2", "HETimeTh2", 200, -100, 100 );
00307   HETimeTh3  = fs->make<TH1F>( "HETimeTh3", "HETimeTh3", 200, -100, 100 );
00308   HETimeThR  = fs->make<TH1F>( "HETimeThR", "HETimeThR", 200, -100, 100 );
00309   HETimeTh1R  = fs->make<TH1F>( "HETimeTh1R", "HETimeTh1R", 200, -100, 100 );
00310   HETimeTh2R  = fs->make<TH1F>( "HETimeTh2R", "HETimeTh2R", 200, -100, 100 );
00311   HETimeTh3R  = fs->make<TH1F>( "HETimeTh3R", "HETimeTh3R", 200, -100, 100 );
00312 
00313   HETimeFlagged    = fs->make<TH1F>( "HETimeFlagged", "HETimeFlagged", 200, -100, 100 );
00314   HETimeThFlagged    = fs->make<TH1F>( "HETimeThFlagged", "HETimeThFlagged", 200, -100, 100 );
00315   HETimeTh1Flagged    = fs->make<TH1F>( "HETimeTh1Flagged", "HETimeTh1Flagged", 200, -100, 100 );
00316   HETimeTh2Flagged    = fs->make<TH1F>( "HETimeTh2Flagged", "HETimeTh2Flagged", 200, -100, 100 );
00317 
00318   HETimeFlagged2    = fs->make<TH1F>( "HETimeFlagged2", "HETimeFlagged2", 200, -100, 100 );
00319   HETimeThFlagged2    = fs->make<TH1F>( "HETimeThFlagged2", "HETimeThFlagged2", 200, -100, 100 );
00320   HETimeTh1Flagged2    = fs->make<TH1F>( "HETimeTh1Flagged2", "HETimeTh1Flagged2", 200, -100, 100 );
00321   HETimeTh2Flagged2    = fs->make<TH1F>( "HETimeTh2Flagged2", "HETimeTh2Flagged2", 200, -100, 100 );
00322 
00323   HETimeX   = fs->make<TH1F>( "HETimeX", "HETimeX", 200, -100, 100 );
00324   HETimeY   = fs->make<TH1F>( "HETimeY", "HETimeY", 200, -100, 100 );
00325   HEposTime = fs->make<TH1F>( "HEposTime",  "HEposTime", 200, -100, 100 );
00326   HEnegTime = fs->make<TH1F>( "HEnegTime",  "HEnegTime", 200, -100, 100 );
00327   HOEne     = fs->make<TH1F>( "HOEne",  "HOEne", 200, -5, 10 );
00328   HOEneTh   = fs->make<TH1F>( "HOEneTh",  "HOEneTh", 200, -5, 10 );
00329   HOEneTh1  = fs->make<TH1F>( "HOEneTh1",  "HOEneTh1", 200, -5, 10 );
00330   HOTime    = fs->make<TH1F>( "HOTime", "HOTime", 200, -100, 100 );
00331   HOTimeTh  = fs->make<TH1F>( "HOTimeTh", "HOTimeTh", 200, -100, 100 );
00332 
00333   // Histos for separating SiPMs and HPDs in HO:
00334   HOSEne     = fs->make<TH1F>( "HOSEne",  "HOSEne", 12000, -20, 100 );
00335   HOSTime    = fs->make<TH1F>( "HOSTime", "HOSTime", 200, -100, 100 );
00336   HOHEne     = fs->make<TH1F>( "HOHEne",  "HOHEne", 12000, -20, 100 );
00337   HOHTime    = fs->make<TH1F>( "HOHTime", "HOHTime", 200, -100, 100 );
00338 
00339   HOHr0Ene      = fs->make<TH1F>( "HOHr0Ene"  ,   "HOHr0Ene", 12000, -20 , 100 );
00340   HOHr0Time     = fs->make<TH1F>( "HOHr0Time" ,  "HOHr0Time",   200, -200, 200 );
00341   HOHrm1Ene     = fs->make<TH1F>( "HOHrm1Ene" ,  "HOHrm1Ene", 12000, -20 , 100 );
00342   HOHrm1Time    = fs->make<TH1F>( "HOHrm1Time", "HOHrm1Time",   200, -200, 200 );
00343   HOHrm2Ene     = fs->make<TH1F>( "HOHrm2Ene" ,  "HOHrm2Ene", 12000, -20 , 100 );
00344   HOHrm2Time    = fs->make<TH1F>( "HOHrm2Time", "HOHrm2Time",   200, -200, 200 );
00345   HOHrp1Ene     = fs->make<TH1F>( "HOHrp1Ene" ,  "HOHrp1Ene", 12000, -20 , 100 );
00346   HOHrp1Time    = fs->make<TH1F>( "HOHrp1Time", "HOHrp1Time",   200, -200, 200 );
00347   HOHrp2Ene     = fs->make<TH1F>( "HOHrp2Ene" ,  "HOHrp2Ene", 12000, -20 , 100 );
00348   HOHrp2Time    = fs->make<TH1F>( "HOHrp2Time", "HOHrp2Time",   200, -200, 200 );
00349 
00350   HBTvsE    = fs->make<TH2F>( "HBTvsE", "HBTvsE",305, -5, 300, 100, -100, 100);
00351   HETvsE    = fs->make<TH2F>( "HETvsE", "HETvsE",305, -5, 300, 100, -100, 100);
00352 
00353   HFTvsE            = fs->make<TH2F>( "HFTvsE", "HFTvsE",305, -5, 300, 100, -100, 100);
00354   HFTvsEFlagged     = fs->make<TH2F>( "HFTvsEFlagged", "HFTvsEFlagged",305, -5, 300, 100, -100, 100);  
00355   HFTvsEFlagged2    = fs->make<TH2F>( "HFTvsEFlagged2", "HFTvsEFlagged2",305, -5, 300, 100, -100, 100);
00356 
00357   HFTvsEThr    = fs->make<TH2F>( "HFTvsEThr", "HFTvsEThr",305, -5, 300, 100, -100, 100);
00358   HFTvsEFlaggedThr    = fs->make<TH2F>( "HFTvsEFlaggedThr", "HFTvsEFlaggedThr",305, -5, 300, 100, -100, 100);  
00359   HFTvsEFlagged2Thr    = fs->make<TH2F>( "HFTvsEFlagged2Thr", "HFTvsEFlagged2Thr",305, -5, 300, 100, -100, 100);
00360 
00361   HOTvsE    = fs->make<TH2F>( "HOTvsE", "HOTvsE",305, -5, 300, 100, -100, 100);
00362 
00363   HFvsZ    = fs->make<TH2F>( "HFvsZ", "HFvsZ",100,-50,50,100,-50,50);
00364 
00365 
00366 
00367   HOocc    = fs->make<TH2F>( "HOocc", "HOocc",85,-42.5,42.5,70,0.5,70.5);
00368   HBocc    = fs->make<TH2F>( "HBocc", "HBocc",85,-42.5,42.5,70,0.5,70.5);
00369   HEocc    = fs->make<TH2F>( "HEocc", "HEocc",85,-42.5,42.5,70,0.5,70.5);
00370   HFocc    = fs->make<TH2F>( "HFocc", "HFocc",85,-42.5,42.5,70,0.5,70.5);
00371   HFoccTime    = fs->make<TH2F>( "HFoccTime", "HFoccTime",85,-42.5,42.5,70,0.5,70.5);
00372   HFoccFlagged    = fs->make<TH2F>( "HFoccFlagged", "HFoccFlagged",85,-42.5,42.5,70,0.5,70.5);
00373   HFoccFlagged2    = fs->make<TH2F>( "HFoccFlagged2", "HFoccFlagged2",85,-42.5,42.5,70,0.5,70.5);
00374 
00375   HFEtaPhiNFlagged    = fs->make<TH2F>( "HFEtaPhiNFlagged", "HFEtaPhiNFlagged",85,-42.5,42.5,70,0.5,70.5);
00376 
00377   //  HFEtaFlagged    = fs->make<TProfile>( "HFEtaFlagged", "HFEtaFlagged",85,-42.5,42.5,0, 10000);
00378   HFEtaFlagged     = fs->make<TH1F>( "HFEtaFlagged", "HFEtaFlagged",85,-42.5,42.5);
00379   HFEtaFlaggedL    = fs->make<TH1F>( "HFEtaFlaggedL", "HFEtaFlaggedL",85,-42.5,42.5);
00380   HFEtaFlaggedLN    = fs->make<TH1F>( "HFEtaFlaggedLN", "HFEtaFlaggedLN",85,-42.5,42.5);
00381   HFEtaFlaggedS    = fs->make<TH1F>( "HFEtaFlaggedS", "HFEtaFlaggedS",85,-42.5,42.5);
00382   HFEtaFlaggedSN    = fs->make<TH1F>( "HFEtaFlaggedSN", "HFEtaFlaggedSN",85,-42.5,42.5);
00383 
00384   HFEtaNFlagged    = fs->make<TProfile>( "HFEtaNFlagged", "HFEtaNFlagged",85,-42.5,42.5,0, 10000);
00385 
00386   HOoccOOT    = fs->make<TH2F>( "HOoccOOT", "HOoccOOT",85,-42.5,42.5,70,0.5,70.5);
00387   HBoccOOT    = fs->make<TH2F>( "HBoccOOT", "HBoccOOT",85,-42.5,42.5,70,0.5,70.5);
00388   HEoccOOT    = fs->make<TH2F>( "HEoccOOT", "HEoccOOT",85,-42.5,42.5,70,0.5,70.5);
00389   HFoccOOT    = fs->make<TH2F>( "HFoccOOT", "HFoccOOT",85,-42.5,42.5,70,0.5,70.5);
00390 
00391   HFEnePMT0     = fs->make<TH1F>( "HFEnePMT0",  "HFEnePMT0", 210, -10, 200 );
00392   HFEnePMT1     = fs->make<TH1F>( "HFEnePMT1",  "HFEnePMT1", 210, -10, 200 );
00393   HFEnePMT2     = fs->make<TH1F>( "HFEnePMT2",  "HFEnePMT2", 210, -10, 200 );
00394   HFTimePMT0    = fs->make<TH1F>( "HFTimePMT0", "HFTimePMT0", 200, -100, 100 );
00395   HFTimePMT1    = fs->make<TH1F>( "HFTimePMT1", "HFTimePMT1", 200, -100, 100 );
00396   HFTimePMT2    = fs->make<TH1F>( "HFTimePMT2", "HFTimePMT2", 200, -100, 100 );
00397 
00398   HFEne     = fs->make<TH1F>( "HFEne",  "HFEne", 210, -10, 200 );
00399   HFEneFlagged     = fs->make<TH1F>( "HFEneFlagged",  "HFEneFlagged", 210, -10, 200 );
00400   HFEneFlagged2     = fs->make<TH1F>( "HFEneFlagged2",  "HFEneFlagged2", 210, -10, 200 );
00401   HFEneTh   = fs->make<TH1F>( "HFEneTh",  "HFEneTh", 210, -10, 200 );
00402   HFEneTh1  = fs->make<TH1F>( "HFEneTh1",  "HFEneTh1", 210, -10, 200 );
00403   HFEneP    = fs->make<TH1F>( "HFEneP",  "HFEneP", 200, -5, 10 );
00404   HFEneM    = fs->make<TH1F>( "HFEneM",  "HFEneM", 200, -5, 10 );
00405   HFTime    = fs->make<TH1F>( "HFTime", "HFTime", 200, -100, 100 );
00406   PMTHits   = fs->make<TH1F>( "PMTHits", "PMTHits", 10, 0, 10 );
00407   HFTimeFlagged  = fs->make<TH1F>( "HFTimeFlagged", "HFTimeFlagged", 200, -100, 100 );
00408 
00409   HFTimeFlagged2  = fs->make<TH1F>( "HFTimeFlagged2", "HFTimeFlagged2", 200, -100, 100 );
00410   HFTimeThFlagged2  = fs->make<TH1F>( "HFTimeThFlagged2", "HFTimeThFlagged2", 200, -100, 100 );
00411   HFTimeTh1Flagged2  = fs->make<TH1F>( "HFTimeTh1Flagged2", "HFTimeTh1Flagged2", 200, -100, 100 );
00412   HFTimeTh2Flagged2  = fs->make<TH1F>( "HFTimeTh2Flagged2", "HFTimeTh2Flagged2", 200, -100, 100 );
00413   HFTimeTh3Flagged2  = fs->make<TH1F>( "HFTimeTh3Flagged2", "HFTimeTh3Flagged2", 200, -100, 100 );
00414 
00415   HFTimeFlagged3  = fs->make<TH1F>( "HFTimeFlagged3", "HFTimeFlagged3", 200, -100, 100 );
00416   HFTimeThFlagged3  = fs->make<TH1F>( "HFTimeThFlagged3", "HFTimeThFlagged3", 200, -100, 100 );
00417   HFTimeTh1Flagged3  = fs->make<TH1F>( "HFTimeTh1Flagged3", "HFTimeTh1Flagged3", 200, -100, 100 );
00418   HFTimeTh2Flagged3  = fs->make<TH1F>( "HFTimeTh2Flagged3", "HFTimeTh2Flagged3", 200, -100, 100 );
00419   HFTimeTh3Flagged3  = fs->make<TH1F>( "HFTimeTh3Flagged3", "HFTimeTh3Flagged3", 200, -100, 100 );
00420 
00421   HFTimeThFlagged  = fs->make<TH1F>( "HFTimeThFlagged", "HFTimeThFlagged", 200, -100, 100 );
00422   HFTimeTh2Flagged  = fs->make<TH1F>( "HFTimeTh2Flagged", "HFTimeTh2Flagged", 200, -100, 100 );
00423   HFTimeTh3Flagged  = fs->make<TH1F>( "HFTimeTh3Flagged", "HFTimeTh3Flagged", 200, -100, 100 );
00424 
00425   HFTimeThFlaggedR  = fs->make<TH1F>( "HFTimeThFlaggedR", "HFTimeThFlaggedR", 200, -100, 100 );
00426   HFTimeThFlaggedR1  = fs->make<TH1F>( "HFTimeThFlaggedR1", "HFTimeThFlaggedR1", 200, -100, 100 );
00427   HFTimeThFlaggedR2  = fs->make<TH1F>( "HFTimeThFlaggedR2", "HFTimeThFlaggedR2", 200, -100, 100 );
00428   HFTimeThFlaggedR3  = fs->make<TH1F>( "HFTimeThFlaggedR3", "HFTimeThFlaggedR3", 200, -100, 100 );
00429   HFTimeThFlaggedR4  = fs->make<TH1F>( "HFTimeThFlaggedR4", "HFTimeThFlaggedR4", 200, -100, 100 );
00430   HFTimeThFlaggedRM  = fs->make<TH1F>( "HFTimeThFlaggedRM", "HFTimeThFlaggedRM", 200, -100, 100 );
00431   TrkMultFlagged0  = fs->make<TH1F>( "TrkMultFlagged0", "TrkMultFlagged0", 100, 0, 100 );
00432   TrkMultFlagged1  = fs->make<TH1F>( "TrkMultFlagged1", "TrkMultFlagged1", 100, 0, 100 );
00433   TrkMultFlagged2  = fs->make<TH1F>( "TrkMultFlagged2", "TrkMultFlagged2", 100, 0, 100 );
00434   TrkMultFlagged3  = fs->make<TH1F>( "TrkMultFlagged3", "TrkMultFlagged3", 100, 0, 100 );
00435   TrkMultFlagged4  = fs->make<TH1F>( "TrkMultFlagged4", "TrkMultFlagged4", 100, 0, 100 );
00436   TrkMultFlaggedM  = fs->make<TH1F>( "TrkMultFlaggedM", "TrkMultFlaggedM", 100, 0, 100 );
00437   HFTimeTh  = fs->make<TH1F>( "HFTimeTh", "HFTimeTh", 200, -100, 100 );
00438   HFTimeTh1  = fs->make<TH1F>( "HFTimeTh1", "HFTimeTh1", 200, -100, 100 );
00439   HFTimeTh2  = fs->make<TH1F>( "HFTimeTh2", "HFTimeTh2", 200, -100, 100 );
00440   HFTimeTh3  = fs->make<TH1F>( "HFTimeTh3", "HFTimeTh3", 200, -100, 100 );
00441   HFTimeThR  = fs->make<TH1F>( "HFTimeThR", "HFTimeThR", 200, -100, 100 );
00442   HFTimeTh1R  = fs->make<TH1F>( "HFTimeTh1R", "HFTimeTh1R", 200, -100, 100 );
00443   HFTimeTh2R  = fs->make<TH1F>( "HFTimeTh2R", "HFTimeTh2R", 200, -100, 100 );
00444   HFTimeTh3R  = fs->make<TH1F>( "HFTimeTh3R", "HFTimeTh3R", 200, -100, 100 );
00445   HFTimeP   = fs->make<TH1F>( "HFTimeP", "HFTimeP", 100, -100, 50 );
00446   HFTimeM   = fs->make<TH1F>( "HFTimeM", "HFTimeM", 100, -100, 50 );
00447   HFTimePMa = fs->make<TH1F>( "HFTimePMa", "HFTimePMa", 100, -100, 100 );
00448   HFTimePM  = fs->make<TH1F>( "HFTimePM", "HFTimePM", 100, -100, 100 );
00449 
00450   // Histos for separating HF long/short fibers:
00451   HFLEneAll  = fs->make<TH1F>( "HFLEneAll",  "HFLEneAll", 210, -10, 200 );
00452   HFLEneAllF = fs->make<TH1F>( "HFLEneAllF",  "HFLEneAllF", 210, -10, 200 );
00453   HFSEneAll  = fs->make<TH1F>( "HFSEneAll",  "HFSEneAll", 210, -10, 200 );
00454   HFSEneAllF = fs->make<TH1F>( "HFSEneAllF",  "HFSEneAllF", 210, -10, 200 );
00455   HFLEne     = fs->make<TH1F>( "HFLEne",  "HFLEne", 200, -5, 10 );
00456   HFLTime    = fs->make<TH1F>( "HFLTime", "HFLTime", 200, -100, 100 );
00457   HFSEne     = fs->make<TH1F>( "HFSEne",  "HFSEne", 200, -5, 10 );
00458   HFSTime    = fs->make<TH1F>( "HFSTime", "HFSTime", 200, -100, 100 );
00459   HFLSRatio  = fs->make<TH1F>( "HFLSRatio",  "HFLSRatio", 220, -1.1, 1.1 );
00460 
00461   HFOERatio  = fs->make<TH1F>( "HFOERatio",  "HFOERatio", 2200, -1.1, 1.1 );
00462 
00463   HFLvsS     = fs->make<TH2F>( "HFLvsS", "HFLvsS",220,-20,200,220,-20,200);
00464   HFLEneNoS  = fs->make<TH1F>( "HFLEneNoS",  "HFLEneNoS", 205, -5, 200 );
00465   HFSEneNoL  = fs->make<TH1F>( "HFSEneNoL",  "HFSEneNoL", 205, -5, 200 );
00466   HFLEneNoSFlagged  = fs->make<TH1F>( "HFLEneNoSFlagged",  "HFLEneNoSFlagged", 205, -5, 200 );
00467   HFSEneNoLFlagged  = fs->make<TH1F>( "HFSEneNoLFlagged",  "HFSEneNoLFlagged", 205, -5, 200 );
00468   HFLEneNoSFlaggedN  = fs->make<TH1F>( "HFLEneNoSFlaggedN",  "HFLEneNoSFlaggedN", 205, -5, 200 );
00469   HFSEneNoLFlaggedN  = fs->make<TH1F>( "HFSEneNoLFlaggedN",  "HFSEneNoLFlaggedN", 205, -5, 200 );
00470 
00471 
00472   EBEne     = fs->make<TH1F>( "EBEne",  "EBEne", 200, -5, 10 );
00473   EBEneTh   = fs->make<TH1F>( "EBEneTh",  "EBEneTh", 200, -5, 10 );
00474   EBEneX    = fs->make<TH1F>( "EBEneX",  "EBEneX", 200, -5, 10 );
00475   EBEneY    = fs->make<TH1F>( "EBEneY",  "EBEneY", 200, -5, 10 );
00476   EBTime    = fs->make<TH1F>( "EBTime", "EBTime", 200, -100, 100 );
00477   EBTimeTh  = fs->make<TH1F>( "EBTimeTh", "EBTimeTh", 200, -100, 100 );
00478   EBTimeX   = fs->make<TH1F>( "EBTimeX", "EBTimeX", 200, -100, 100 );
00479   EBTimeY   = fs->make<TH1F>( "EBTimeY", "EBTimeY", 200, -100, 100 );
00480   EEEne     = fs->make<TH1F>( "EEEne",  "EEEne", 200, -5, 10 );
00481   EEEneTh   = fs->make<TH1F>( "EEEneTh",  "EEEneTh", 200, -5, 10 );
00482   EEEneX    = fs->make<TH1F>( "EEEneX",  "EEEneX", 200, -5, 10 );
00483   EEEneY    = fs->make<TH1F>( "EEEneY",  "EEEneY", 200, -5, 10 );
00484   EEnegEne  = fs->make<TH1F>( "EEnegEne",  "EEnegEne", 200, -5, 10 );
00485   EEposEne  = fs->make<TH1F>( "EEposEne",  "EEposEne", 200, -5, 10 );
00486   EETime    = fs->make<TH1F>( "EETime", "EETime", 200, -100, 100 );
00487   EETimeTh  = fs->make<TH1F>( "EETimeTh", "EETimeTh", 200, -100, 100 );
00488   EETimeX   = fs->make<TH1F>( "EETimeX", "EETimeX", 200, -100, 100 );
00489   EETimeY   = fs->make<TH1F>( "EETimeY", "EETimeY", 200, -100, 100 );
00490   EEnegTime = fs->make<TH1F>( "EEnegTime", "EEnegTime", 200, -100, 100 );
00491   EEposTime = fs->make<TH1F>( "EEposTime", "EEposTime", 200, -100, 100 );
00492 
00493   h_nTowersCal = fs->make<TH1F>( "nTowersCal",  "N Towers in Jet", 100, 0, 50 );
00494   h_EMFracCal  = fs->make<TH1F>( "EMFracCal",  "EM Fraction in Jet", 100, -1.1, 1.1 );
00495   h_ptCal      = fs->make<TH1F>( "ptCal",  "p_{T} of CalJet", 100, 0, 50 );
00496   h_etaCal     = fs->make<TH1F>( "etaCal", "#eta of  CalJet", 100, -4, 4 );
00497   h_phiCal     = fs->make<TH1F>( "phiCal", "#phi of  CalJet", 50, -M_PI, M_PI );
00498 
00499   h_nGenJets  =  fs->make<TH1F>( "nGenJets",  "Number of GenJets", 20, 0, 20 );
00500 
00501   h_ptGen     =  fs->make<TH1F>( "ptGen",  "p_{T} of GenJet", 100, 0, 50 );
00502   h_etaGen    =  fs->make<TH1F>( "etaGen", "#eta of GenJet", 100, -4, 4 );
00503   h_phiGen    =  fs->make<TH1F>( "phiGen", "#phi of GenJet", 50, -M_PI, M_PI );
00504 
00505   h_ptGenL    =  fs->make<TH1F>( "ptGenL",  "p_{T} of GenJetL", 100, 0, 50 );
00506   h_etaGenL   =  fs->make<TH1F>( "etaGenL", "#eta of GenJetL", 100, -4, 4 );
00507   h_phiGenL   =  fs->make<TH1F>( "phiGenL", "#phi of GenJetL", 50, -M_PI, M_PI );
00508 
00509   h_jetEt      = fs->make<TH1F>( "jetEt", "Total Jet Et", 100, 0, 3000 );
00510 
00511   h_jet1Pt       = fs->make<TH1F>( "jet1Pt", "Jet1 Pt", 100, 0, 1000 );
00512   h_jet2Pt       = fs->make<TH1F>( "jet2Pt", "Jet2 Pt", 100, 0, 1000 );
00513   h_jet1Eta       = fs->make<TH1F>( "jet1Eta", "Jet1 Eta", 50, -5, 5 );
00514   h_jet2Eta       = fs->make<TH1F>( "jet2Eta", "Jet2 Eta", 50, -5, 5 );
00515   h_jet1PtHLT    = fs->make<TH1F>( "jet1PtHLT", "Jet1 Pt HLT", 100, 0, 1000 );
00516 
00517   h_TotalUnclusteredEt = fs->make<TH1F>( "TotalUnclusteredEt", "Total Unclustered Et", 100, 0, 500 );
00518   h_UnclusteredEt      = fs->make<TH1F>( "UnclusteredEt", "Unclustered Et", 100, 0, 50 );
00519   h_UnclusteredEts     = fs->make<TH1F>( "UnclusteredEts", "Unclustered Et", 100, 0, 2 );
00520 
00521   h_ClusteredE         = fs->make<TH1F>( "ClusteredE", "Clustered E", 200, 0, 20 );
00522   h_TotalClusteredE    = fs->make<TH1F>( "TotalClusteredE", "Total Clustered E", 200, 0, 100 );
00523   h_UnclusteredE       = fs->make<TH1F>( "UnclusteredE", "Unclustered E", 200, 0, 20 );
00524   h_TotalUnclusteredE  = fs->make<TH1F>( "TotalUnclusteredE", "Total Unclustered E", 200, 0, 100 );
00525 
00526   jetHOEne              = fs->make<TH1F>("jetHOEne" ,"HO Energy in Jet",100, 0,100);
00527   jetEMFraction         = fs->make<TH1F>( "jetEMFraction", "Jet EM Fraction", 100, -1.1, 1.1 );
00528   NTowers              = fs->make<TH1F>( "NTowers", "Number of Towers", 100, 0, 100 );
00529 
00530 
00531   h_EmEnergy   = fs->make<TH2F>( "EmEnergy",  "Em Energy",  90, -45, 45, 73, 0, 73 );
00532   h_HadEnergy  = fs->make<TH2F>( "HadEnergy", "Had Energy", 90, -45, 45, 73, 0, 73 );
00533 
00534   st_Pt            = fs->make<TH1F>( "st_Pt", "Pt", 200, 0, 200 );
00535   st_Constituents  = fs->make<TH1F>( "st_Constituents", "Constituents", 200, 0, 200 );
00536   st_Energy        = fs->make<TH1F>( "st_Energy", "Tower Energy", 200, 0, 200 );
00537   st_EmEnergy      = fs->make<TH1F>( "st_EmEnergy", "Tower EmEnergy", 200, 0, 200 );
00538   st_HadEnergy     = fs->make<TH1F>( "st_HadEnergy", "Tower HadEnergy", 200, 0, 200 );
00539   st_OuterEnergy   = fs->make<TH1F>( "st_OuterEnergy", "Tower OuterEnergy", 200, 0, 200 );
00540   st_Eta           = fs->make<TH1F>( "st_Eta", "Eta", 100, -4, 4 );
00541   st_Phi           = fs->make<TH1F>( "st_Phi", "Phi", 50, -M_PI, M_PI );
00542   st_iEta          = fs->make<TH1F>( "st_iEta", "iEta", 60, -30, 30 );
00543   st_iPhi          = fs->make<TH1F>( "st_iPhi", "iPhi", 80, 0, 80 );
00544   st_Frac          = fs->make<TH1F>( "st_Frac", "Frac", 100, 0, 1 );
00545 
00546 
00547   EBvHB           = fs->make<TH2F>( "EBvHB", "EB vs HB",1000,0,4500000.,1000,0,1000000.);
00548   EEvHE           = fs->make<TH2F>( "EEvHE", "EE vs HE",1000,0,4500000.,1000,0,200000.);
00549 
00550   ECALvHCAL       = fs->make<TH2F>( "ECALvHCAL", "ECAL vs HCAL",100,0,20000000.,100,-500000,500000.);
00551   ECALvHCALEta1   = fs->make<TH2F>( "ECALvHCALEta1", "ECAL vs HCALEta1",100,0,20000000.,100,-500000,500000.);
00552   ECALvHCALEta2   = fs->make<TH2F>( "ECALvHCALEta2", "ECAL vs HCALEta2",100,0,20000000.,100,-500000,500000.);
00553   ECALvHCALEta3   = fs->make<TH2F>( "ECALvHCALEta3", "ECAL vs HCALEta3",100,0,20000000.,100,-500000,500000.);
00554 
00555   EMF_Eta   = fs->make<TProfile>("EMF_Eta","EMF Eta", 100, -50, 50, 0, 10);
00556   EMF_Phi   = fs->make<TProfile>("EMF_Phi","EMF Phi", 100, 0, 100, 0, 10);
00557   EMF_EtaX  = fs->make<TProfile>("EMF_EtaX","EMF EtaX", 100, -50, 50, 0, 10);
00558   EMF_PhiX  = fs->make<TProfile>("EMF_PhiX","EMF PhiX", 100, 0, 100, 0, 10);
00559 
00560   HFTimeVsiEtaP  = fs->make<TProfile>("HFTimeVsiEtaP","HFTimeVsiEtaP", 13, 28.5, 41.5, -100, 100);
00561   HFTimeVsiEtaM  = fs->make<TProfile>("HFTimeVsiEtaM","HFTimeVsiEtaM", 13, -41.5, -28.5, -100, 100);
00562 
00563   HFTimeVsiEtaP5  = fs->make<TProfile>("HFTimeVsiEtaP5","HFTimeVsiEtaP5", 13, 28.5, 41.5, -100, 100);
00564   HFTimeVsiEtaM5  = fs->make<TProfile>("HFTimeVsiEtaM5","HFTimeVsiEtaM5", 13, -41.5, -28.5, -100, 100);
00565 
00566   HFTimeVsiEtaP20  = fs->make<TProfile>("HFTimeVsiEtaP20","HFTimeVsiEtaP20", 13, 28.5, 41.5, -100, 100);
00567   HFTimeVsiEtaM20  = fs->make<TProfile>("HFTimeVsiEtaM20","HFTimeVsiEtaM20", 13, -41.5, -28.5, -100, 100);
00568 
00569   NPass          = fs->make<TH1F>( "NPass", "NPass", 3, -1, 1 );
00570   NTotal         = fs->make<TH1F>( "NTotal", "NTotal", 3, -1, 1 );
00571   NTime         = fs->make<TH1F>( "NTime", "NTime", 10, 0, 10 );
00572 
00573 
00574   HFRecHitEne   = fs->make<TH1F>( "HFRecHitEne", "HFRecHitEne", 300, 0, 3000 );
00575   HFRecHitEneClean   = fs->make<TH1F>( "HFRecHitEneClean", "HFRecHitEneClean", 300, 0, 3000 );
00576   HFRecHitTime  = fs->make<TH1F>( "HFRecHitTime", "HFRecHitTime", 120, -60, 60 );
00577 
00578 
00579   HFLongShortPhi  = fs->make<TH1F>( "HFLongShortPhi", "HFLongShortPhi", 73, 0, 73 );
00580   HFLongShortEta  = fs->make<TH1F>( "HFLongShortEta", "HFLongShortEta", 90, -45, 45 );
00581   HFLongShortEne  = fs->make<TH1F>( "HFLongShortEne", "HFLongShortEne", 300, 0, 3000 );
00582   HFLongShortTime = fs->make<TH1F>( "HFLongShortTime", "HFLongShortTime", 120, -60, 60 );
00583   HFLongShortNHits = fs->make<TH1F>( "HFLongShortNHits", "HFLongShortNHits", 30, 0, 30 );
00584 
00585   HFDigiTimePhi  = fs->make<TH1F>( "HFDigiTimePhi", "HFDigiTimePhi", 73, 0, 73 );
00586   HFDigiTimeEta  = fs->make<TH1F>( "HFDigiTimeEta", "HFDigiTimeEta", 90, -45, 45 );
00587   HFDigiTimeEne  = fs->make<TH1F>( "HFDigiTimeEne", "HFDigiTimeEne", 300, 0, 3000 );
00588   HFDigiTimeTime = fs->make<TH1F>( "HFDigiTimeTime", "HFDigiTimeTime", 120, -60, 60 );
00589   HFDigiTimeNHits = fs->make<TH1F>( "HFDigiTimeNHits", "HFDigiTimeNHits", 30, 0, 30 );
00590 
00591 
00592   totBNC = 0;
00593   for (int i=0; i<4000; i++)  nBNC[i] = 0;
00594 
00595 }
00596 
00597 // ************************
00598 // ************************
00599 void myJetAna::analyze( const edm::Event& evt, const edm::EventSetup& es ) {
00600 
00601   using namespace edm;
00602 
00603   bool Pass, Pass_HFTime, Pass_DiJet, Pass_BunchCrossing, Pass_Vertex;
00604 
00605   int EtaOk10, EtaOk13, EtaOk40;
00606 
00607   double LeadMass;
00608 
00609   double HFRecHit[100][100][2];
00610   int HFRecHitFlag[100][100][2];
00611 
00612   double towerEtCut, towerECut, towerE;
00613 
00614   towerEtCut = 1.0;
00615   towerECut  = 1.0;
00616 
00617   unsigned int StableRun = 123732;
00618 
00619   double HBHEThreshold = 2.0;
00620   double HFThreshold   = 2.0;
00621   double HOThreshold   = 2.0;
00622   double EBEEThreshold = 2.0;
00623 
00624   double HBHEThreshold1 = 4.0;
00625   double HFThreshold1   = 4.0;
00626   double HOThreshold1   = 4.0;
00627   //double EBEEThreshold1 = 4.0;
00628 
00629   double HBHEThreshold2 = 10.0;
00630   double HFThreshold2   = 10.0;
00631   //double HOThreshold2   = 10.0;
00632   //double EBEEThreshold2 = 10.0;
00633 
00634   double HBHEThreshold3 = 40.0;
00635   double HFThreshold3   = 40.0;
00636   //double HOThreshold3   = 40.0;
00637   //double EBEEThreshold3 = 40.0;
00638 
00639   float minJetPt = 20.;
00640   float minJetPt10 = 10.;
00641   int jetInd, allJetInd;
00642   LeadMass = -1;
00643 
00644   //  Handle<DcsStatusCollection> dcsStatus;
00645   //  evt.getByLabel("scalersRawToDigi", dcsStatus);
00646   //  std::cout << dcsStatus << std::endl;
00647   //  if (dcsStatus.isValid()) {
00648   //  }
00649 
00650   //  DcsStatus dcsStatus;
00651   //  Handle<DcsStatus> dcsStatus;
00652   //  evt.getByLabel("dcsStatus", dcsStatus);
00653 
00654 
00655   math::XYZTLorentzVector p4tmp[2], p4cortmp[2];
00656 
00657   // --------------------------------------------------------------
00658   // --------------------------------------------------------------
00659 
00660   /***
00661   std::cout << ">>>> ANA: Run = "    << evt.id().run() 
00662             << " Event = " << evt.id().event()
00663             << " Bunch Crossing = " << evt.bunchCrossing() 
00664             << " Orbit Number = "   << evt.orbitNumber()
00665             << " Luminosity Block = "  << evt.luminosityBlock()
00666             <<  std::endl;
00667   ***/
00668 
00669   // *********************
00670   // *** Filter Event
00671   // *********************
00672   Pass = false;
00673 
00674   /***
00675   if (evt.bunchCrossing()== 100) {
00676     Pass = true;
00677   } else {
00678     Pass = false;
00679   }
00680   ***/
00681 
00682   // ***********************
00683   // ***  Pass Trigger
00684   // ***********************
00685 
00686 
00687   // **** Get the TriggerResults container
00688   Handle<TriggerResults> triggerResults;
00689   evt.getByLabel(theTriggerResultsLabel, triggerResults);
00690   //  evt.getByLabel("TriggerResults::HLT", triggerResults);
00691 
00692   if (triggerResults.isValid()) {
00693     if (DEBUG) std::cout << "trigger valid " << std::endl;
00694     //    edm::TriggerNames triggerNames;    // TriggerNames class
00695     //    triggerNames.init(*triggerResults);
00696     unsigned int n = triggerResults->size();
00697     for (unsigned int i=0; i!=n; i++) {
00698 
00699       /***
00700       std::cout << ">>> Trigger Name (" <<  i << ") = " << triggerNames.triggerName(i)
00701                 << " Accept = " << triggerResults->accept(i)
00702                 << std::endl;
00703       ***/
00704       /****
00705       if (triggerResults->accept(i) == 1) {
00706         std::cout << "+++ Trigger Name (" <<  i << ") = " << triggerNames.triggerName(i)
00707                   << " Accept = " << triggerResults->accept(i)
00708                   << std::endl;
00709       }
00710       ****/
00711 
00712       //      if (DEBUG) std::cout <<  triggerNames.triggerName(i) << std::endl;
00713 
00714       //      if ( (triggerNames.triggerName(i) == "HLT_ZeroBias")  || 
00715       //           (triggerNames.triggerName(i) == "HLT_MinBias")   || 
00716       //           (triggerNames.triggerName(i) == "HLT_MinBiasHcal") )  {
00717 
00718     }
00719       
00720   } else {
00721 
00722     edm::Handle<TriggerResults> *tr = new edm::Handle<TriggerResults>;
00723     triggerResults = (*tr);
00724 
00725     //     std::cout << "triggerResults is not valid" << std::endl;
00726     //     std::cout << triggerResults << std::endl;
00727     //     std::cout << triggerResults.isValid() << std::endl;
00728     
00729     if (DEBUG) std::cout << "trigger not valid " << std::endl;
00730     edm::LogInfo("myJetAna") << "TriggerResults::HLT not found, "
00731       "automatically select events";
00732 
00733     //return;
00734   }
00735 
00736 
00737   
00738   /***
00739   Handle<L1GlobalTriggerReadoutRecord> gtRecord;
00740   evt.getByLabel("gtDigis",gtRecord);
00741   const TechnicalTriggerWord tWord = gtRecord->technicalTriggerWord();
00742 
00743   ***/
00744 
00745 
00746   // *************************
00747   // ***  Pass Bunch Crossing
00748   // *************************
00749 
00750   // *** Check Luminosity Section
00751   if (evt.id().run() == 122294)
00752     if ( (evt.luminosityBlock() >= 37) && (evt.luminosityBlock() <= 43) ) 
00753       Pass = true;
00754   if (evt.id().run() == 122314)
00755     if ( (evt.luminosityBlock() >= 24) && (evt.luminosityBlock() <= 37) ) 
00756       Pass = true;
00757   if (evt.id().run() == 123575)
00758       Pass = true;
00759   if (evt.id().run() == 123596)
00760       Pass = true;
00761 
00762   // ***********
00763   if (evt.id().run() == 124009) {
00764     if ( (evt.bunchCrossing() == 51) ||
00765          (evt.bunchCrossing() == 151) ||
00766          (evt.bunchCrossing() == 2824) ) {
00767       Pass = true;
00768     }
00769   }
00770 
00771   if (evt.id().run() == 124020) {
00772     if ( (evt.bunchCrossing() == 51) ||
00773          (evt.bunchCrossing() == 151) ||
00774          (evt.bunchCrossing() == 2824) ) {
00775       Pass = true;
00776     }
00777   }
00778 
00779   if (evt.id().run() == 124024) {
00780     if ( (evt.bunchCrossing() == 51) ||
00781          (evt.bunchCrossing() == 151) ||
00782          (evt.bunchCrossing() == 2824) ) {
00783       Pass = true;
00784     }
00785   }
00786 
00787   if ( (evt.bunchCrossing() == 51)   ||
00788        (evt.bunchCrossing() == 151)  ||
00789        (evt.bunchCrossing() == 2596) || 
00790        (evt.bunchCrossing() == 2724) || 
00791        (evt.bunchCrossing() == 2824) ||
00792        (evt.bunchCrossing() == 3487) ) {
00793     Pass_BunchCrossing = true;
00794   } else {
00795     Pass_BunchCrossing = false;
00796   }
00797   
00798 
00799   // ***********************
00800   // ***  Pass HF Timing 
00801   // ***********************
00802 
00803   double HFM_ETime, HFP_ETime;
00804   double HFM_E, HFP_E;
00805   double HF_PMM;
00806 
00807   HFM_ETime = 0.;
00808   HFM_E = 0.;
00809   HFP_ETime = 0.;
00810   HFP_E = 0.;
00811 
00812   for (int i=0; i<100; i++) {
00813     for (int j=0; j<100; j++) {
00814       HFRecHit[i][j][0] = -10.;
00815       HFRecHit[i][j][1] = -10.;
00816       HFRecHitFlag[i][j][0]  = 0;
00817       HFRecHitFlag[i][j][1]  = 0;
00818     }
00819   }
00820 
00821 
00822   int nTime = 0;
00823   int NHFLongShortHits;
00824   int NHFDigiTimeHits;
00825   NHFLongShortHits = 0;
00826   NHFDigiTimeHits = 0;
00827 
00828   //  edm::Handle<reco::VertexCollection> vertexCollection;
00829 
00830   try {
00831     std::vector<edm::Handle<HFRecHitCollection> > colls;
00832     evt.getManyByType(colls);
00833 
00834     std::vector<edm::Handle<HFRecHitCollection> >::iterator i;
00835     for (i=colls.begin(); i!=colls.end(); i++) {
00836       
00837       for (HFRecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
00838         if (j->id().subdet() == HcalForward) {
00839 
00840           HFRecHitEne->Fill(j->energy());
00841           if ( (j->flagField(HcalCaloFlagLabels::HFLongShort) == 0) && 
00842                (j->flagField(HcalCaloFlagLabels::HFDigiTime)  == 0) ) {
00843             HFRecHitEneClean->Fill(j->energy());
00844           }
00845  
00846           HFRecHitTime->Fill(j->time());
00847 
00848           int myFlag;
00849           myFlag= j->flagField(HcalCaloFlagLabels::HFLongShort);
00850           if (myFlag==1) {
00851             NHFLongShortHits++;
00852             HFLongShortPhi->Fill(j->id().iphi());
00853             HFLongShortEta->Fill(j->id().ieta());
00854             HFLongShortEne->Fill(j->energy());
00855             HFLongShortTime->Fill(j->time());
00856           }
00857 
00858           myFlag= j->flagField(HcalCaloFlagLabels::HFDigiTime);
00859           if (myFlag==1) {
00860             NHFDigiTimeHits++;
00861             HFDigiTimePhi->Fill(j->id().iphi());
00862             HFDigiTimeEta->Fill(j->id().ieta());
00863             HFDigiTimeEne->Fill(j->energy());
00864             HFDigiTimeTime->Fill(j->time());
00865           }
00866 
00867           
00868           float en = j->energy();
00869           float time = j->time();
00870           if ((en > 20.) && (time>20.)) {
00871             HFoccTime->Fill(j->id().ieta(),j->id().iphi());
00872             nTime++;
00873           }
00874           HcalDetId id(j->detid().rawId());
00875           int ieta = id.ieta();
00876           int iphi = id.iphi();
00877           int depth = id.depth();
00878 
00879 
00880           // Long:  depth = 1
00881           // Short: depth = 2
00882           HFRecHit[ieta+41][iphi][depth-1] = en;
00883           HFRecHitFlag[ieta+41][iphi][depth-1] = j->flagField(0);
00884 
00885           /****
00886           std::cout << "RecHit Flag = " 
00887                     << j->flagField(0)a
00888                     << std::endl;
00889           ***/
00890 
00891           if (j->id().ieta()<0) {
00892             if (j->energy() > HFThreshold) {
00893               HFM_ETime += j->energy()*j->time(); 
00894               HFM_E     += j->energy();
00895             }
00896           } else {
00897             if (j->energy() > HFThreshold) {
00898               HFP_ETime += j->energy()*j->time(); 
00899               HFP_E     += j->energy();
00900             }
00901           }
00902 
00903         }
00904       }
00905       break;
00906     }
00907   } catch (...) {
00908     cout << "No HF RecHits." << endl;
00909   }
00910 
00911   cout << "N HF Hits" << NHFLongShortHits << " " << NHFDigiTimeHits << endl;
00912   HFLongShortNHits->Fill(NHFLongShortHits);
00913   HFDigiTimeNHits->Fill(NHFDigiTimeHits);
00914 
00915   NTime->Fill(nTime);
00916 
00917   double OER = 0, OddEne, EvenEne;
00918   int nOdd, nEven;
00919 
00920   for (int iphi=0; iphi<100; iphi++) {
00921     OddEne = EvenEne = 0.;
00922     nOdd  = 0;
00923     nEven = 0;
00924     for (int ieta=0; ieta<100; ieta++) {
00925       if (HFRecHit[ieta][iphi][0] > 1.0) {
00926         if (ieta%2 == 0) {
00927           EvenEne += HFRecHit[ieta][iphi][0]; 
00928           nEven++;
00929         } else {
00930           OddEne  += HFRecHit[ieta][iphi][0];
00931           nOdd++;
00932         }
00933       }
00934       if (HFRecHit[ieta][iphi][1] > 1.0) {
00935         if (ieta%2 == 0) {
00936           EvenEne += HFRecHit[ieta][iphi][1]; 
00937           nEven++;
00938         } else {
00939           OddEne  += HFRecHit[ieta][iphi][1]; 
00940           nOdd++;
00941         }
00942       }
00943     }
00944     if (((OddEne + EvenEne) > 10.) && (nOdd > 1) && (nEven > 1)) {
00945       OER = (OddEne - EvenEne) / (OddEne + EvenEne);
00946       HFOERatio->Fill(OER);
00947     }
00948   }
00949 
00950   if ((HFP_E > 0.) && (HFM_E > 0.)) {
00951     HF_PMM = (HFP_ETime / HFP_E) - (HFM_ETime / HFM_E);
00952     HFTimePMa->Fill(HF_PMM); 
00953   } else {
00954     HF_PMM = INVALID;
00955   }
00956 
00957   
00958   if (fabs(HF_PMM) < 10.)  {
00959     Pass_HFTime = true;
00960   } else {
00961     Pass_HFTime = false;
00962   }
00963 
00964 
00965   // **************************
00966   // ***  Pass DiJet Criteria
00967   // **************************
00968   double highestPt;
00969   double nextPt;
00970   // double dphi;
00971   int    nDiJet, nJet;
00972 
00973   nJet      = 0;
00974   nDiJet    = 0;
00975   highestPt = 0.0;
00976   nextPt    = 0.0;
00977 
00978   allJetInd = 0;
00979   Handle<CaloJetCollection> caloJets;
00980   evt.getByLabel( CaloJetAlgorithm, caloJets );
00981   for( CaloJetCollection::const_iterator cal = caloJets->begin(); cal != caloJets->end(); ++ cal ) {
00982 
00983     // TODO: verify first two jets are the leading jets
00984     if (nJet == 0) p4tmp[0] = cal->p4();
00985     if (nJet == 1) p4tmp[1] = cal->p4();
00986 
00987     if ( (cal->pt() > 3.) && 
00988          (fabs(cal->eta()) < 3.0) ) { 
00989       nDiJet++;
00990     }
00991     nJet++;
00992 
00993   }  
00994   
00995 
00996   if (nDiJet > 1) {
00997     //dphi = deltaPhi(p4tmp[0].phi(), p4tmp[1].phi());
00998     Pass_DiJet = true;
00999   } else {
01000     // dphi = INVALID;
01001     Pass_DiJet = false;
01002   }
01003       
01004 
01005   // **************************
01006   // ***  Pass Vertex
01007   // **************************
01008   double VTX;
01009   int nVTX;
01010 
01011   edm::Handle<reco::VertexCollection> vertexCollection;
01012   evt.getByLabel("offlinePrimaryVertices", vertexCollection);
01013   const reco::VertexCollection vC = *(vertexCollection.product());
01014 
01015   //  std::cout << "Reconstructed "<< vC.size() << " vertices" << std::endl ;
01016 
01017   nVTX = vC.size();
01018   for (reco::VertexCollection::const_iterator vertex=vC.begin(); vertex!=vC.end(); vertex++){
01019     VTX  = vertex->z();
01020   }
01021 
01022   if ( (fabs(VTX) < 20.) && (nVTX > 0) ){
01023     Pass_Vertex = true;
01024   } else {
01025     Pass_Vertex = false;
01026   }
01027 
01028   // ***********************
01029   // ***********************
01030 
01031 
01032   nBNC[evt.bunchCrossing()]++;
01033   totBNC++;
01034     
01035   //  Pass = true;
01036 
01037   // *** Check for tracks
01038   //  edm::Handle<reco::TrackCollection> trackCollection;
01039   //  evt.getByLabel("generalTracks", trackCollection);
01040   //  const reco::TrackCollection tC = *(trackCollection.product());
01041   //  if ((Pass) && (tC.size()>1)) {
01042   //  } else {
01043   //    Pass = false;
01044   //  } 
01045 
01046 
01047   // ********************************
01048   // *** Pixel Clusters
01049   // ********************************
01050   edm::Handle< edmNew::DetSetVector<SiPixelCluster> > hClusterColl;
01051   evt.getByLabel("siPixelClusters", hClusterColl);
01052   const edmNew::DetSetVector<SiPixelCluster> clustColl = *(hClusterColl.product());
01053 
01054   edm::Handle<reco::TrackCollection> trackCollection;
01055   evt.getByLabel("generalTracks", trackCollection);
01056   const reco::TrackCollection tC = *(trackCollection.product());
01057 
01058 
01059   // **************************
01060   // *** Event Passed Selection
01061   // **************************
01062 
01063 
01064   if (evt.id().run() == 1) {
01065     if ( (Pass_DiJet)         &&
01066          (Pass_Vertex) ) {
01067       Pass = true;
01068     } else {
01069       Pass = false;
01070     }
01071     Pass = true;
01072 
01073   } else {
01074     if ( (Pass_BunchCrossing) && 
01075          (Pass_HFTime)        &&
01076          (Pass_Vertex) ) {
01077       Pass = true;
01078     } else {
01079       Pass = false;
01080     }
01081   }
01082 
01083   /***
01084   std::cout << "+++ Result " 
01085             << " Event = " 
01086             << evt.id().run()
01087             << " LS = "
01088             << evt.luminosityBlock()
01089             << " dphi = "
01090             << dphi
01091             << " Pass = " 
01092             << Pass
01093             << std::endl;
01094   ***/
01095 
01096   NTotal->Fill(0);
01097   
01098   Pass = false;
01099   if ((tC.size() > 100) && (clustColl.size() > 1000)) Pass = true;
01100   Pass = true;
01101 
01102   /****
01103   if (Pass_HFTime) {
01104     Pass = true;
01105   } else {
01106     Pass = false;
01107   }
01108   ****/
01109 
01110   // **************************
01111   // *** Noise Summary Object
01112   // **************************
01113 
01114   edm::Handle<HcalNoiseSummary> summary_h;
01115   evt.getByLabel(hcalNoiseSummaryTag_, summary_h);
01116   if(!summary_h.isValid()) {
01117     throw edm::Exception(edm::errors::ProductNotFound) << " could not find HcalNoiseSummary.\n";
01118     //    return true;
01119   }
01120 
01121   const HcalNoiseSummary summary = *summary_h;
01122 
01123   bool Pass_NoiseSummary;
01124   Pass_NoiseSummary = true;
01125   if(summary.minE2Over10TS()<0.7) {
01126     Pass_NoiseSummary = false;
01127   }
01128   if(summary.maxE2Over10TS()>0.96) {
01129     Pass_NoiseSummary = false;
01130   }
01131   if(summary.maxHPDHits()>=17) {
01132     Pass_NoiseSummary = false;
01133   }
01134   if(summary.maxRBXHits()>=999) {
01135     Pass_NoiseSummary = false;
01136   }
01137   if(summary.maxHPDNoOtherHits()>=10) {
01138     Pass_NoiseSummary = false;
01139   }
01140   if(summary.maxZeros()>=10) {
01141     Pass_NoiseSummary = false;
01142   }
01143   if(summary.min25GeVHitTime()<-9999.0) {
01144     Pass_NoiseSummary = false;
01145   }
01146   if(summary.max25GeVHitTime()>9999.0) {
01147     Pass_NoiseSummary = false;
01148   }
01149   if(summary.minRBXEMF()<0.01) {
01150   }
01151 
01152   if (Pass_NoiseSummary) {
01153     Pass = false;
01154   } else {
01155     Pass = true;
01156   }
01157 
01158 
01159   Pass = true;
01160   if (Pass) {
01161 
01162     NPass->Fill(0);
01163 
01164   // *********************
01165   // *** Classify Event
01166   // *********************
01167   int evtType = 0;
01168 
01169   Handle<CaloTowerCollection> caloTowers;
01170   evt.getByLabel( "towerMaker", caloTowers );
01171 
01172   for (int i=0;i<36;i++) {
01173     RBXColl[i].et        = 0;
01174     RBXColl[i].hadEnergy = 0;
01175     RBXColl[i].emEnergy  = 0;
01176     RBXColl[i].hcalTime  = 0;
01177     RBXColl[i].ecalTime  = 0;
01178     RBXColl[i].nTowers   = 0;
01179   }  
01180   for (int i=0;i<144;i++) {
01181     HPDColl[i].et        = 0;
01182     HPDColl[i].hadEnergy = 0;
01183     HPDColl[i].emEnergy  = 0;
01184     HPDColl[i].hcalTime  = 0;
01185     HPDColl[i].ecalTime  = 0;
01186     HPDColl[i].nTowers   = 0;
01187   }  
01188 
01189   double ETotal, emFrac;
01190   double HCALTotalCaloTowerE, ECALTotalCaloTowerE;
01191   double HCALTotalCaloTowerE_Eta1, ECALTotalCaloTowerE_Eta1;
01192   double HCALTotalCaloTowerE_Eta2, ECALTotalCaloTowerE_Eta2;
01193   double HCALTotalCaloTowerE_Eta3, ECALTotalCaloTowerE_Eta3;
01194 
01195   ETotal = 0.;
01196   emFrac = 0.;
01197     
01198   HCALTotalCaloTowerE = 0;
01199   ECALTotalCaloTowerE = 0;
01200   HCALTotalCaloTowerE_Eta1 = 0.;
01201   ECALTotalCaloTowerE_Eta1 = 0.;
01202   HCALTotalCaloTowerE_Eta2 = 0.; 
01203   ECALTotalCaloTowerE_Eta2 = 0.;
01204   HCALTotalCaloTowerE_Eta3 = 0.;
01205   ECALTotalCaloTowerE_Eta3 = 0.;
01206 
01207   for (CaloTowerCollection::const_iterator tower = caloTowers->begin();
01208        tower != caloTowers->end(); tower++) {
01209     ETotal += tower->hadEnergy();
01210     ETotal += tower->emEnergy();
01211   }
01212 
01213   for (CaloTowerCollection::const_iterator tower = caloTowers->begin();
01214        tower != caloTowers->end(); tower++) {
01215 
01216     // Raw tower energy without grouping or thresholds
01217     if (abs(tower->ieta()) < 100) EMF_Eta->Fill(tower->ieta(), emFrac);
01218 
01219     if (abs(tower->ieta()) < 15) {
01220       towerHadEnHB->Fill(tower->hadEnergy());
01221       towerEmEnHB->Fill(tower->emEnergy());
01222     }
01223     if ( (abs(tower->ieta()) > 17) && ((abs(tower->ieta()) < 30)) ){
01224       towerHadEnHE->Fill(tower->hadEnergy());
01225       towerEmEnHE->Fill(tower->emEnergy());
01226     }
01227     if (abs(tower->ieta()) > 29) {
01228       towerHadEnHF->Fill(tower->hadEnergy());
01229       towerEmEnHF->Fill(tower->emEnergy());
01230     }
01231 
01232     towerHadEn->Fill(tower->hadEnergy());
01233     towerEmEn->Fill(tower->emEnergy());
01234     towerOuterEn->Fill(tower->outerEnergy());
01235 
01236     //    towerHadEt->Fill(tower->hadEt());
01237     //    towerEmEt->Fill(tower->emEt());
01238     //    towerOuterEt->Fill(tower->outerEt());
01239 
01240     if ((tower->emEnergy()+tower->hadEnergy()) != 0) {
01241       emFrac = tower->emEnergy()/(tower->emEnergy()+tower->hadEnergy());
01242       towerEmFrac->Fill(emFrac);
01243     } else {
01244       emFrac = 0.;
01245     }
01246 
01247     /***
01248       std::cout << "ETotal = " << ETotal 
01249                 << " EMF = " << emFrac
01250                 << " EM = " << tower->emEnergy()
01251                 << " Tot = " << tower->emEnergy()+tower->hadEnergy()
01252                 << " ieta/iphi = " <<  tower->ieta() << " / "  << tower->iphi() 
01253                 << std::endl;
01254     ***/
01255 
01256     if (abs(tower->iphi()) < 100) EMF_Phi->Fill(tower->iphi(), emFrac);
01257     if (abs(tower->ieta()) < 100) EMF_Eta->Fill(tower->ieta(), emFrac);
01258     if ( (evt.id().run() == 120020) && (evt.id().event() == 453) ) {
01259       std::cout << "Bunch Crossing = " << evt.bunchCrossing() 
01260                 << " Orbit Number = "  << evt.orbitNumber()
01261                 <<  std::endl;
01262 
01263       if (abs(tower->iphi()) < 100) EMF_PhiX->Fill(tower->iphi(), emFrac);
01264       if (abs(tower->ieta()) < 100) EMF_EtaX->Fill(tower->ieta(), emFrac);
01265     }
01266     
01267     HCALTotalCaloTowerE += tower->hadEnergy();
01268     ECALTotalCaloTowerE += tower->emEnergy();
01269 
01270     towerE = tower->hadEnergy() + tower->emEnergy();
01271     if (tower->et() > towerEtCut) caloEtaEt->Fill(tower->eta());
01272     if (towerE      > towerECut)  caloEta->Fill(tower->eta());
01273     caloPhi->Fill(tower->phi());
01274 
01275     if (fabs(tower->eta()) < 1.3) {
01276       HCALTotalCaloTowerE_Eta1 += tower->hadEnergy();
01277       ECALTotalCaloTowerE_Eta1 += tower->emEnergy();
01278     }
01279     if ((fabs(tower->eta()) >= 1.3) && (fabs(tower->eta()) < 2.5)) {
01280       HCALTotalCaloTowerE_Eta2 += tower->hadEnergy();
01281       ECALTotalCaloTowerE_Eta2 += tower->emEnergy();
01282     }
01283     if (fabs(tower->eta()) > 2.5) {
01284       HCALTotalCaloTowerE_Eta3 += tower->hadEnergy();
01285       ECALTotalCaloTowerE_Eta3 += tower->emEnergy();
01286     }
01287 
01288     /***
01289     std::cout << "had = "  << tower->hadEnergy()
01290               << " em = "  << tower->emEnergy()
01291               << " fabs(eta) = " << fabs(tower->eta())
01292               << " ieta/iphi = " <<  tower->ieta() << " / "  << tower->iphi() 
01293               << std::endl;
01294     ***/
01295 
01296     if ((tower->hadEnergy() + tower->emEnergy()) > 2.0) {
01297 
01298       int iRBX = tower->iphi();
01299       iRBX = iRBX-2;
01300       if (iRBX == 0)  iRBX = 17;
01301       if (iRBX == -1) iRBX = 18;
01302       iRBX = (iRBX-1)/4;
01303 
01304       if (tower->ieta() < 0) iRBX += 18;
01305       if (iRBX < 36) {
01306         RBXColl[iRBX].et        += tower->et(); 
01307         RBXColl[iRBX].hadEnergy += tower->hadEnergy(); 
01308         RBXColl[iRBX].emEnergy  += tower->emEnergy(); 
01309         RBXColl[iRBX].hcalTime  += tower->hcalTime(); 
01310         RBXColl[iRBX].ecalTime  += tower->ecalTime(); 
01311         RBXColl[iRBX].nTowers++;
01312       }
01313       /***
01314       std::cout << "iRBX = " << iRBX << " "     
01315                 << "ieta/iphi = " <<  tower->ieta() << " / "  << tower->iphi() 
01316                 << " et = " << tower->et()
01317                 << std::endl;
01318       ***/
01319       int iHPD = tower->iphi();
01320       if (tower->ieta() < 0) iHPD = iHPD + 72;
01321       if (iHPD < 144) {
01322         HPDColl[iHPD].et        += tower->et(); 
01323         HPDColl[iHPD].hadEnergy += tower->hadEnergy(); 
01324         HPDColl[iHPD].emEnergy  += tower->emEnergy(); 
01325         HPDColl[iHPD].hcalTime  += tower->hcalTime(); 
01326         HPDColl[iHPD].ecalTime  += tower->ecalTime(); 
01327         HPDColl[iHPD].nTowers++;
01328       }
01329       /***
01330       std::cout << "iHPD = " << iHPD << " "     
01331                 << "ieta/iphi = " <<  tower->ieta() << " / "  << tower->iphi() 
01332                 << " et = " << tower->et()
01333                 << std::endl;
01334       ***/
01335 
01336     }
01337 
01338   }
01339 
01340   ECALvHCAL->Fill(HCALTotalCaloTowerE, ECALTotalCaloTowerE);
01341   ECALvHCALEta1->Fill(HCALTotalCaloTowerE_Eta1, ECALTotalCaloTowerE_Eta1);
01342   ECALvHCALEta2->Fill(HCALTotalCaloTowerE_Eta2, ECALTotalCaloTowerE_Eta2);
01343   ECALvHCALEta3->Fill(HCALTotalCaloTowerE_Eta3, ECALTotalCaloTowerE_Eta3);
01344 
01345   /***
01346   std::cout << " Total CaloTower Energy :  "
01347             << " ETotal= " << ETotal 
01348             << " HCAL= " << HCALTotalCaloTowerE 
01349             << " ECAL= " << ECALTotalCaloTowerE
01350             << std::endl;
01351   ***/
01352 
01353   /***
01354             << " HCAL Eta1 = "  << HCALTotalCaloTowerE_Eta1
01355             << " ECAL= " << ECALTotalCaloTowerE_Eta1
01356             << " HCAL Eta2 = " << HCALTotalCaloTowerE_Eta2
01357             << " ECAL= " << ECALTotalCaloTowerE_Eta2
01358             << " HCAL Eta3 = " << HCALTotalCaloTowerE_Eta3
01359             << " ECAL= " << ECALTotalCaloTowerE_Eta3
01360             << std::endl;
01361   ***/
01362 
01363 
01364   // Loop over the RBX Collection
01365   int nRBX = 0;
01366   int nTowers = 0;
01367   for (int i=0;i<36;i++) {
01368     RBX_et->Fill(RBXColl[i].et);
01369     RBX_hadEnergy->Fill(RBXColl[i].hadEnergy);
01370     RBX_hcalTime->Fill(RBXColl[i].hcalTime / RBXColl[i].nTowers);
01371     RBX_nTowers->Fill(RBXColl[i].nTowers);
01372     if (RBXColl[i].hadEnergy > 3.0) {
01373       nRBX++;
01374       nTowers = RBXColl[i].nTowers;
01375     }
01376   }
01377   RBX_N->Fill(nRBX);
01378   if ( (nRBX == 1) && (nTowers > 24) ) {
01379     evtType = 1;
01380   }
01381 
01382   // Loop over the HPD Collection
01383   int nHPD = 0;
01384   for (int i=0;i<144;i++) {
01385     HPD_et->Fill(HPDColl[i].et);
01386     HPD_hadEnergy->Fill(HPDColl[i].hadEnergy);
01387     HPD_hcalTime->Fill(HPDColl[i].hcalTime / HPDColl[i].nTowers);
01388     HPD_nTowers->Fill(HPDColl[i].nTowers);
01389     if (HPDColl[i].hadEnergy > 3.0) {
01390       nHPD++;
01391       nTowers = HPDColl[i].nTowers;
01392     }
01393   }
01394   HPD_N->Fill(nHPD);
01395   if ( (nHPD == 1) && (nTowers > 6) ) {
01396     evtType = 2;
01397     cout << " nHPD = "   << nHPD 
01398          << " Towers = " << nTowers
01399          << " Type = "   << evtType 
01400          << endl; 
01401   }
01402  
01403   // **************************************************************
01404   // ** Access Trigger Information
01405   // **************************************************************
01406 
01407   // **** Get the TriggerResults container
01408   Handle<TriggerResults> triggerResults;
01409   evt.getByLabel(theTriggerResultsLabel, triggerResults);
01410 
01411   Int_t JetLoPass = 0;
01412   
01413   if (triggerResults.isValid()) {
01414     if (DEBUG) std::cout << "trigger valid " << std::endl;
01415     //    edm::TriggerNames triggerNames;    // TriggerNames class
01416     //    triggerNames.init(*triggerResults);
01417     unsigned int n = triggerResults->size();
01418     for (unsigned int i=0; i!=n; i++) {
01419 
01420       /***
01421       std::cout << "   Trigger Name = " << triggerNames.triggerName(i)
01422                 << " Accept = " << triggerResults->accept(i)
01423                 << std::endl;
01424       ***/
01425 
01426       //      if (DEBUG) std::cout <<  triggerNames.triggerName(i) << std::endl;
01427 
01428       /***
01429       if ( triggerNames.triggerName(i) == "HLT_Jet30" ) {
01430         JetLoPass =  triggerResults->accept(i);
01431         if (DEBUG) std::cout << "Found  HLT_Jet30 " 
01432                              << JetLoPass
01433                              << std::endl;
01434       }
01435       ***/
01436 
01437     }
01438       
01439   } else {
01440 
01441     edm::Handle<TriggerResults> *tr = new edm::Handle<TriggerResults>;
01442     triggerResults = (*tr);
01443 
01444     //     std::cout << "triggerResults is not valid" << std::endl;
01445     //     std::cout << triggerResults << std::endl;
01446     //     std::cout << triggerResults.isValid() << std::endl;
01447     
01448     if (DEBUG) std::cout << "trigger not valid " << std::endl;
01449     edm::LogInfo("myJetAna") << "TriggerResults::HLT not found, "
01450       "automatically select events";
01451     //return;
01452   }
01453 
01454   /****
01455   Handle <L1GlobalTriggerReadoutRecord> gtRecord_h;
01456   evt.getByType (gtRecord_h); // assume only one L1 trigger record here
01457   const L1GlobalTriggerReadoutRecord* gtRecord = gtRecord_h.failedToGet () ? 0 : &*gtRecord_h;
01458   
01459   if (gtRecord) { // object is available
01460     for (int l1bit = 0; l1bit < 128; ++l1bit) {
01461       if (gtRecord->decisionWord() [l1bit]) h_L1TrigBit->Fill (l1bit);
01462     }
01463   }
01464   ****/
01465 
01466 
01467 
01468 
01469   // **************************************************************
01470   // ** Loop over the two leading CaloJets and fill some histograms
01471   // **************************************************************
01472   Handle<CaloJetCollection> caloJets;
01473   evt.getByLabel( CaloJetAlgorithm, caloJets );
01474 
01475 
01476   jetInd    = 0;
01477   allJetInd = 0;
01478 
01479   EtaOk10 = 0;
01480   EtaOk13 = 0;
01481   EtaOk40 = 0;
01482 
01483   //  const JetCorrector* corrector = 
01484   //    JetCorrector::getJetCorrector (JetCorrectionService, es);
01485 
01486 
01487   highestPt = 0.0;
01488   nextPt    = 0.0;
01489   
01490   for( CaloJetCollection::const_iterator cal = caloJets->begin(); cal != caloJets->end(); ++ cal ) {
01491     
01492     //    double scale = corrector->correction (*cal);
01493     double scale = 1.0;
01494     double corPt = scale*cal->pt();
01495     //    double corPt = cal->pt();
01496     //    cout << "Pt = " << cal->pt() << endl;
01497     
01498     if (corPt>highestPt) {
01499       nextPt      = highestPt;
01500       p4cortmp[1] = p4cortmp[0]; 
01501       highestPt   = corPt;
01502       p4cortmp[0] = scale*cal->p4();
01503     } else if (corPt>nextPt) {
01504       nextPt      = corPt;
01505       p4cortmp[1] = scale*cal->p4();
01506     }
01507 
01508     allJetInd++;
01509     if (allJetInd == 1) {
01510       h_jet1Pt->Fill( cal->pt() );
01511       h_jet1Eta->Fill( cal->eta() );
01512       if (JetLoPass != 0) h_jet1PtHLT->Fill( cal->pt() );
01513       p4tmp[0] = cal->p4();
01514       if ( fabs(cal->eta()) < 1.0) EtaOk10++;
01515       if ( fabs(cal->eta()) < 1.3) EtaOk13++;
01516       if ( fabs(cal->eta()) < 4.0) EtaOk40++;            
01517     }
01518     if (allJetInd == 2) {
01519       h_jet2Pt->Fill( cal->pt() );
01520       h_jet2Eta->Fill( cal->eta() );
01521       p4tmp[1] = cal->p4();
01522       if ( fabs(cal->eta()) < 1.0) EtaOk10++;
01523       if ( fabs(cal->eta()) < 1.3) EtaOk13++;
01524       if ( fabs(cal->eta()) < 4.0) EtaOk40++;
01525     }
01526 
01527     if ( cal->pt() > minJetPt) {
01528       const std::vector<CaloTowerPtr> jetCaloRefs = cal->getCaloConstituents();
01529       int nConstituents = jetCaloRefs.size();
01530       h_nTowersCal->Fill(nConstituents);
01531       h_EMFracCal->Fill(cal->emEnergyFraction());    
01532       h_ptCal->Fill( cal->pt() );         
01533       h_etaCal->Fill( cal->eta() );
01534       h_phiCal->Fill( cal->phi() );
01535       jetInd++;
01536     }
01537   }
01538 
01539   h_nCalJets->Fill( jetInd ); 
01540 
01541   if (jetInd > 1) {
01542     LeadMass = (p4tmp[0]+p4tmp[1]).mass();
01543     dijetMass->Fill( LeadMass );    
01544   }
01545 
01546 
01547   // ******************
01548   // *** Jet Properties
01549   // ******************
01550 
01551   int nTow1, nTow2, nTow3, nTow4;
01552   //  Handle<CaloJetCollection> jets;
01553   //  evt.getByLabel( CaloJetAlgorithm, jets );
01554 
01555   // *********************************************************
01556   // --- Loop over jets and make a list of all the used towers
01557   int jjet = 0;
01558   for ( CaloJetCollection::const_iterator ijet=caloJets->begin(); ijet!=caloJets->end(); ijet++) {
01559     jjet++;
01560 
01561     float hadEne  = ijet->hadEnergyInHB() + ijet->hadEnergyInHO() + 
01562                     ijet->hadEnergyInHE() + ijet->hadEnergyInHF();                   
01563     float emEne   = ijet->emEnergyInEB() + ijet->emEnergyInEE() + ijet->emEnergyInHF();
01564     float had     = ijet->energyFractionHadronic();    
01565     float j_et = ijet->et();
01566 
01567     // *** Barrel
01568     if (fabs(ijet->eta()) < 1.3) {
01569       totEneLeadJetEta1->Fill(hadEne+emEne); 
01570       hadEneLeadJetEta1->Fill(ijet->hadEnergyInHB()); 
01571       emEneLeadJetEta1->Fill(ijet->emEnergyInEB());       
01572       if (ijet->pt() > minJetPt10) hadFracEta1->Fill(had);
01573     }
01574 
01575     // *** EndCap
01576     if ((fabs(ijet->eta()) > 1.3) && (fabs(ijet->eta()) < 3.) ) {
01577       totEneLeadJetEta2->Fill(hadEne+emEne); 
01578       hadEneLeadJetEta2->Fill(ijet->hadEnergyInHE()); 
01579       emEneLeadJetEta2->Fill(ijet->emEnergyInEE());       
01580       if (ijet->pt() > minJetPt10) hadFracEta2->Fill(had);
01581     }
01582 
01583     // *** Forward
01584     if (fabs(ijet->eta()) > 3.) {
01585       totEneLeadJetEta3->Fill(hadEne+emEne); 
01586       hadEneLeadJetEta3->Fill(hadEne); 
01587       emEneLeadJetEta3->Fill(emEne); 
01588       if (ijet->pt() > minJetPt10) hadFracEta3->Fill(had);
01589     }
01590 
01591     // *** CaloTowers in Jet
01592     const std::vector<CaloTowerPtr> jetCaloRefs = ijet->getCaloConstituents();
01593     int nConstituents = jetCaloRefs.size();
01594     NTowers->Fill(nConstituents);
01595 
01596     if (jjet == 1) {
01597 
01598       nTow1 = nTow2 = nTow3 = nTow4 = 0;
01599       for (int i = 0; i <nConstituents ; i++){
01600 
01601         float et  = jetCaloRefs[i]->et();
01602 
01603         if (et > 0.5) nTow1++;
01604         if (et > 1.0) nTow2++;
01605         if (et > 1.5) nTow3++;
01606         if (et > 2.0) nTow4++;
01607         
01608         hf_TowerJetEt->Fill(et/j_et);
01609 
01610       }
01611 
01612       nTowersLeadJetPt1->Fill(nTow1);
01613       nTowersLeadJetPt2->Fill(nTow2);
01614       nTowersLeadJetPt3->Fill(nTow3);
01615       nTowersLeadJetPt4->Fill(nTow4);
01616 
01617     }
01618 
01619   }
01620 
01621 
01622   // **********************
01623   // *** Unclustered Energy
01624   // **********************
01625 
01626   double SumPtJet(0);
01627 
01628   double SumEtNotJets(0);
01629   double SumEtJets(0);
01630   double SumEtTowers(0);
01631   double TotalClusteredE(0);
01632   double TotalUnclusteredE(0);
01633 
01634   double sumJetPx(0);
01635   double sumJetPy(0);
01636 
01637   double sumTowerAllPx(0);
01638   double sumTowerAllPy(0);
01639 
01640   double sumTowerAllEx(0);
01641   double sumTowerAllEy(0);
01642 
01643   // double HCALTotalE;
01644   double HBTotalE, HETotalE, HOTotalE, HFTotalE;
01645   // double ECALTotalE;
01646   double EBTotalE, EETotalE;
01647 
01648   std::vector<CaloTowerPtr>   UsedTowerList;
01649   std::vector<CaloTower>      TowerUsedInJets;
01650   std::vector<CaloTower>      TowerNotUsedInJets;
01651 
01652   // *********************
01653   // *** Hcal recHits
01654   // *********************
01655 
01656   edm::Handle<HcalSourcePositionData> spd;
01657 
01658   // HCALTotalE = 0.;
01659   HBTotalE = HETotalE = HOTotalE = HFTotalE = 0.;
01660   try {
01661     std::vector<edm::Handle<HBHERecHitCollection> > colls;
01662     evt.getManyByType(colls);
01663     std::vector<edm::Handle<HBHERecHitCollection> >::iterator i;
01664     for (i=colls.begin(); i!=colls.end(); i++) {
01665 
01666 
01667       for (HBHERecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
01668         //      std::cout << *j << std::endl;
01669         if (j->id().subdet() == HcalBarrel) {
01670           HBEne->Fill(j->energy()); 
01671           HBTime->Fill(j->time()); 
01672           if (!Pass_NoiseSummary) HBTimeFlagged2->Fill(j->time()); 
01673           if (j->flagField(HcalCaloFlagLabels::HBHETimingShapedCutsBits) != 0) HBTimeFlagged->Fill(j->time()); 
01674           HBTvsE->Fill(j->energy(), j->time());
01675 
01676           if (j->time() > 20.) HBEneTThr->Fill(j->energy()); 
01677           
01678           if ((j->time()<-25.) || (j->time()>75.)) {
01679             HBEneOOT->Fill(j->energy()); 
01680             if (j->energy() > HBHEThreshold)  HBEneOOTTh->Fill(j->energy()); 
01681             if (j->energy() > HBHEThreshold1) HBEneOOTTh1->Fill(j->energy()); 
01682           }
01683           if (j->energy() > HBHEThreshold) {
01684             HBEneTh->Fill(j->energy()); 
01685             HBTimeTh->Fill(j->time()); 
01686             if (!Pass_NoiseSummary) HBTimeThFlagged2->Fill(j->time()); 
01687             if (j->flagField(HcalCaloFlagLabels::HBHETimingShapedCutsBits) != 0) HBTimeThFlagged->Fill(j->time()); 
01688 
01689             if (evt.id().run() >= StableRun) HBTimeThR->Fill(j->time()); 
01690             HBTotalE += j->energy();
01691             HBocc->Fill(j->id().ieta(),j->id().iphi());
01692             hitEta->Fill(j->id().ieta());
01693             hitPhi->Fill(j->id().iphi());
01694           }
01695           if (j->energy() > HBHEThreshold1) {
01696             HBEneTh1->Fill(j->energy()); 
01697             HBTimeTh1->Fill(j->time()); 
01698             if (!Pass_NoiseSummary) HBTimeTh1Flagged2->Fill(j->time()); 
01699             if (j->flagField(HcalCaloFlagLabels::HBHETimingShapedCutsBits) != 0) HBTimeTh1Flagged->Fill(j->time()); 
01700 
01701             if (evt.id().run() >= StableRun) HBTimeTh1R->Fill(j->time()); 
01702             if ((j->time()<-25.) || (j->time()>75.)) {
01703               HBoccOOT->Fill(j->id().ieta(),j->id().iphi());
01704             }
01705           }
01706           if (j->energy() > HBHEThreshold2) {
01707             HBTimeTh2->Fill(j->time()); 
01708             if (!Pass_NoiseSummary) HBTimeTh2Flagged2->Fill(j->time()); 
01709             if (j->flagField(HcalCaloFlagLabels::HBHETimingShapedCutsBits) != 0) HBTimeTh2Flagged->Fill(j->time()); 
01710 
01711             if (evt.id().run() >= StableRun) HBTimeTh2R->Fill(j->time()); 
01712           }
01713           if (j->energy() > HBHEThreshold3) {
01714             HBTimeTh3->Fill(j->time()); 
01715             if (evt.id().run() >= StableRun) HBTimeTh3R->Fill(j->time()); 
01716           }
01717           if ( (evt.id().run() == 120020) && (evt.id().event() == 453) ) {
01718             HBEneX->Fill(j->energy()); 
01719             if (j->energy() > HBHEThreshold) HBTimeX->Fill(j->time()); 
01720           }
01721           if ( (evt.id().run() == 120020) && (evt.id().event() == 457) ) {
01722             HBEneY->Fill(j->energy()); 
01723             if (j->energy() > HBHEThreshold) HBTimeY->Fill(j->time()); 
01724           }
01725         }
01726         if (j->id().subdet() == HcalEndcap) {
01727           HEEne->Fill(j->energy()); 
01728           HETime->Fill(j->time()); 
01729           if (!Pass_NoiseSummary) HETimeFlagged2->Fill(j->time()); 
01730           if (j->flagField(HcalCaloFlagLabels::HBHETimingShapedCutsBits) != 0) HETimeFlagged->Fill(j->time()); 
01731           HETvsE->Fill(j->energy(), j->time());
01732 
01733           if (j->time() > 20.) HEEneTThr->Fill(j->energy()); 
01734 
01735           if ((j->time()<-25.) || (j->time()>75.)) {
01736             HEEneOOT->Fill(j->energy()); 
01737             if (j->energy() > HBHEThreshold)  HEEneOOTTh->Fill(j->energy());  
01738             if (j->energy() > HBHEThreshold1) HEEneOOTTh1->Fill(j->energy());  
01739           }
01740 
01741           if (j->energy() > HBHEThreshold) {
01742             HEEneTh->Fill(j->energy()); 
01743             HETimeTh->Fill(j->time()); 
01744             if (!Pass_NoiseSummary) HETimeThFlagged2->Fill(j->time()); 
01745             if (j->flagField(HcalCaloFlagLabels::HBHETimingShapedCutsBits) != 0)  HETimeThFlagged->Fill(j->time()); 
01746 
01747             if (evt.id().run() >= StableRun) HETimeThR->Fill(j->time()); 
01748             HETotalE += j->energy();
01749             HEocc->Fill(j->id().ieta(),j->id().iphi());
01750             hitEta->Fill(j->id().ieta());
01751             hitPhi->Fill(j->id().iphi());
01752           }
01753           if (j->energy() > HBHEThreshold1) {
01754             HEEneTh1->Fill(j->energy()); 
01755             HETimeTh1->Fill(j->time()); 
01756             if (!Pass_NoiseSummary) HETimeTh1Flagged2->Fill(j->time()); 
01757             if (j->flagField(HcalCaloFlagLabels::HBHETimingShapedCutsBits) != 0) HETimeTh1Flagged->Fill(j->time()); 
01758             if (evt.id().run() >= StableRun) HETimeTh1R->Fill(j->time()); 
01759             if ((j->time()<-25.) || (j->time()>75.)) {
01760               HEoccOOT->Fill(j->id().ieta(),j->id().iphi());
01761             }
01762           }
01763           if (j->energy() > HBHEThreshold2) {
01764             HETimeTh2->Fill(j->time()); 
01765             if (!Pass_NoiseSummary) HETimeTh2Flagged2->Fill(j->time()); 
01766             if (j->flagField(HcalCaloFlagLabels::HBHETimingShapedCutsBits) != 0) HETimeTh2Flagged->Fill(j->time()); 
01767             if (evt.id().run() >= StableRun) HETimeTh2R->Fill(j->time()); 
01768           }
01769           if (j->energy() > HBHEThreshold3) {
01770             HETimeTh3->Fill(j->time()); 
01771             if (evt.id().run() >= StableRun) HETimeTh3R->Fill(j->time()); 
01772           }
01773 
01774           if ( (evt.id().run() == 120020) && (evt.id().event() == 453) ) {
01775             HEEneX->Fill(j->energy()); 
01776             if (j->energy() > HBHEThreshold) HETimeX->Fill(j->time()); 
01777           }
01778           if ( (evt.id().run() == 120020) && (evt.id().event() == 457) ) {
01779             HEEneY->Fill(j->energy()); 
01780             if (j->energy() > HBHEThreshold) HETimeY->Fill(j->time()); 
01781           }
01782 
01783           // Fill +-HE separately
01784           if (j->id().ieta()<0) {
01785             HEnegEne->Fill(j->energy()); 
01786             if (j->energy() > HBHEThreshold) {
01787               HEnegTime->Fill(j->time()); 
01788             }
01789           } else {
01790             HEposEne->Fill(j->energy()); 
01791             if (j->energy() > HBHEThreshold) {
01792               HEposTime->Fill(j->time()); 
01793             }
01794           }
01795           
01796         }
01797 
01798         /***
01799         std::cout << j->id()     << " "
01800                   << j->id().subdet() << " "
01801                   << j->id().ieta()   << " "
01802                   << j->id().iphi()   << " "
01803                   << j->id().depth()  << " "
01804                   << j->energy() << " "
01805                   << j->time()   << std::endl;
01806         ****/
01807       }
01808     }
01809   } catch (...) {
01810     cout << "No HB/HE RecHits." << endl;
01811   }
01812 
01813 
01814   HFM_ETime = 0.;
01815   HFM_E = 0.;
01816   HFP_ETime = 0.;
01817   HFP_E = 0.;
01818 
01819   int NPMTHits;
01820   NPMTHits = 0;
01821   try {
01822     std::vector<edm::Handle<HFRecHitCollection> > colls;
01823     evt.getManyByType(colls);
01824     std::vector<edm::Handle<HFRecHitCollection> >::iterator i;
01825     for (i=colls.begin(); i!=colls.end(); i++) {
01826       for (HFRecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
01827         if ( (j->flagField(HcalCaloFlagLabels::HFLongShort) == 1) ||
01828              (j->flagField(HcalCaloFlagLabels::HFDigiTime)  == 1) ) {
01829              NPMTHits++;
01830         }
01831       }
01832       break;
01833     }
01834   } catch (...) {
01835     cout << "No HF RecHits." << endl;
01836   }
01837 
01838 
01839   PMTHits->Fill(NPMTHits); 
01840 
01841   try {
01842     std::vector<edm::Handle<HFRecHitCollection> > colls;
01843     evt.getManyByType(colls);
01844     std::vector<edm::Handle<HFRecHitCollection> >::iterator i;
01845     for (i=colls.begin(); i!=colls.end(); i++) {
01846       for (HFRecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
01847 
01848         /****
01849         float en = j->energy();
01850         HcalDetId id(j->detid().rawId());
01851         int ieta = id.ieta();
01852         int iphi = id.iphi();
01853         int depth = id.depth();
01854         *****/
01855 
01856         //  std::cout << *j << std::endl;
01857 
01858         if (j->id().subdet() == HcalForward) {
01859 
01860           if (NPMTHits == 1) {
01861             if ( (j->flagField(HcalCaloFlagLabels::HFLongShort) == 1) ||
01862                  (j->flagField(HcalCaloFlagLabels::HFDigiTime)  == 1) ) {
01863               HFEtaFlagged->Fill(j->id().ieta());
01864               if (j->id().depth() == 1) HFEtaFlaggedL->Fill(j->id().ieta());
01865               if (j->id().depth() == 2) HFEtaFlaggedS->Fill(j->id().ieta());
01866             } else {
01867               HFEtaNFlagged->Fill(j->id().ieta(), j->energy());
01868               HFEtaPhiNFlagged->Fill(j->id().ieta(),j->id().iphi(),j->energy());
01869             }
01870           }
01871           if (j->energy() > 20.) {
01872             if (NPMTHits == 0) {
01873               HFEnePMT0->Fill(j->energy()); 
01874               HFTimePMT0->Fill(j->time()); 
01875             }
01876             if (NPMTHits == 1) {
01877               if ( (j->flagField(HcalCaloFlagLabels::HFLongShort) == 1) ||
01878                    (j->flagField(HcalCaloFlagLabels::HFDigiTime)  == 1) ) {
01879                 HFEnePMT1->Fill(j->energy()); 
01880                 HFTimePMT1->Fill(j->time()); 
01881               }
01882             }
01883             if (NPMTHits > 1) {
01884               if ( (j->flagField(HcalCaloFlagLabels::HFLongShort) == 1) ||
01885                    (j->flagField(HcalCaloFlagLabels::HFDigiTime)  == 1) ) {
01886                 HFEnePMT2->Fill(j->energy()); 
01887                 HFTimePMT2->Fill(j->time()); 
01888               }
01889             }
01890           }
01891 
01892           HFTimeVsiEtaP->Fill(j->id().ieta(), j->time());
01893           HFTimeVsiEtaM->Fill(j->id().ieta(), j->time());
01894 
01895           if (j->energy() > 5.) { 
01896             HFTimeVsiEtaP5->Fill(j->id().ieta(), j->time());
01897             HFTimeVsiEtaM5->Fill(j->id().ieta(), j->time());
01898           }       
01899 
01900           if (j->energy() > 20.) { 
01901             HFTimeVsiEtaP20->Fill(j->id().ieta(), j->time());
01902             HFTimeVsiEtaM20->Fill(j->id().ieta(), j->time());
01903           }       
01904 
01905           HFEne->Fill(j->energy()); 
01906           HFTime->Fill(j->time()); 
01907           HFTvsE->Fill(j->energy(), j->time());
01908 
01909           if (j->time() > 20.) HFEneTThr->Fill(j->energy()); 
01910          
01911           if (j->energy() > 10.) HFTvsEThr->Fill(j->energy(), j->time());
01912 
01913           if ( (j->flagField(HcalCaloFlagLabels::HFLongShort) == 1)|| 
01914                (j->flagField(HcalCaloFlagLabels::HFDigiTime)  == 1) ) {
01915             HFEneFlagged->Fill(j->energy());
01916             HFoccFlagged->Fill(j->id().ieta(),j->id().iphi());
01917             HFTimeFlagged->Fill(j->time()); 
01918             HFTvsEFlagged->Fill(j->energy(), j->time());
01919 
01920             //      std::cout << "Flagged:  " << j->energy() << " "
01921             //                << j->time()
01922             //                << std::endl;
01923           }
01924 
01925 
01926           if (j->flagField(HcalCaloFlagLabels::HFLongShort) == 1) {
01927             HFEneFlagged2->Fill(j->energy());
01928             HFoccFlagged2->Fill(j->id().ieta(),j->id().iphi());
01929             HFTimeFlagged2->Fill(j->time()); 
01930             HFTvsEFlagged2->Fill(j->energy(), j->time());
01931             if (j->energy() > 10.) HFTvsEFlagged2Thr->Fill(j->energy(), j->time());
01932           }
01933 
01934           if (j->flagField(HcalCaloFlagLabels::HFDigiTime) == 1) {
01935             HFTimeFlagged3->Fill(j->time()); 
01936           }
01937 
01938           if (j->energy() > HFThreshold) {
01939             HFEneTh->Fill(j->energy()); 
01940             HFTimeTh->Fill(j->time()); 
01941             if (j->flagField(HcalCaloFlagLabels::HFLongShort) == 1) HFTimeThFlagged2->Fill(j->time()); 
01942             if (j->flagField(HcalCaloFlagLabels::HFDigiTime)  == 1) HFTimeThFlagged3->Fill(j->time()); 
01943 
01944             if (evt.id().run() >= StableRun) HFTimeThR->Fill(j->time()); 
01945             if ( (j->flagField(HcalCaloFlagLabels::HFLongShort) == 1)|| 
01946                  (j->flagField(HcalCaloFlagLabels::HFDigiTime)  == 1) ) {
01947 
01948               HFTimeThFlagged->Fill(j->time()); 
01949 
01950               if (j->energy() > HFThreshold2) HFTimeTh2Flagged->Fill(j->time()); 
01951               if (j->energy() > HFThreshold3) HFTimeTh3Flagged->Fill(j->time()); 
01952 
01953               if (evt.id().run() >= StableRun) {
01954                 HFTimeThFlaggedR->Fill(j->time()); 
01955                 if (NPMTHits == 1) HFTimeThFlaggedR1->Fill(j->time()); 
01956                 if (NPMTHits == 2) HFTimeThFlaggedR2->Fill(j->time()); 
01957                 if (NPMTHits == 3) HFTimeThFlaggedR3->Fill(j->time()); 
01958                 if (NPMTHits == 4) HFTimeThFlaggedR4->Fill(j->time()); 
01959                 if (NPMTHits > 1) HFTimeThFlaggedRM->Fill(j->time()); 
01960               }
01961             }
01962             HFTotalE += j->energy();
01963             HFocc->Fill(j->id().ieta(),j->id().iphi());
01964             hitEta->Fill(j->id().ieta());
01965             hitPhi->Fill(j->id().iphi());
01966           }
01967 
01968           if (j->energy() > HFThreshold1) {
01969             HFEneTh1->Fill(j->energy());
01970             HFTimeTh1->Fill(j->time()); 
01971             if (j->flagField(HcalCaloFlagLabels::HFLongShort) == 1) HFTimeTh1Flagged2->Fill(j->time()); 
01972             if (j->flagField(HcalCaloFlagLabels::HFDigiTime)  == 1) HFTimeTh1Flagged3->Fill(j->time()); 
01973             if (evt.id().run() >= StableRun) HFTimeTh1R->Fill(j->time()); 
01974             if ((j->time()<-20.) || (j->time()>20.)) {
01975               HFoccOOT->Fill(j->id().ieta(),j->id().iphi());
01976             }
01977           } 
01978           if (j->energy() > HFThreshold2) {
01979             HFTimeTh2->Fill(j->time()); 
01980             if (j->flagField(HcalCaloFlagLabels::HFLongShort) == 1) HFTimeTh2Flagged2->Fill(j->time()); 
01981             if (j->flagField(HcalCaloFlagLabels::HFDigiTime)  == 1) HFTimeTh2Flagged3->Fill(j->time()); 
01982             if (evt.id().run() >= StableRun) HFTimeTh2R->Fill(j->time()); 
01983           }
01984           if (j->energy() > HFThreshold3) {
01985             HFTimeTh3->Fill(j->time()); 
01986             if (j->flagField(HcalCaloFlagLabels::HFLongShort) == 1) HFTimeTh3Flagged2->Fill(j->time()); 
01987             if (j->flagField(HcalCaloFlagLabels::HFDigiTime)  == 1) HFTimeTh3Flagged3->Fill(j->time()); 
01988             if (evt.id().run() >= StableRun) HFTimeTh3R->Fill(j->time()); 
01989           }
01990 
01991           if (j->id().ieta()<0) {
01992             if (j->energy() > HFThreshold) {
01993               //              HFTimeM->Fill(j->time()); 
01994               HFEneM->Fill(j->energy()); 
01995               HFM_ETime += j->energy()*j->time(); 
01996               HFM_E     += j->energy();
01997             }
01998           } else {
01999             if (j->energy() > HFThreshold) {
02000               //              HFTimeP->Fill(j->time()); 
02001               HFEneP->Fill(j->energy()); 
02002               HFP_ETime += j->energy()*j->time(); 
02003               HFP_E     += j->energy();
02004             }
02005           }
02006 
02007           // Long and short fibers
02008           if (j->id().depth() == 1){
02009             HFLEne->Fill(j->energy()); 
02010             if (j->energy() > HFThreshold) HFLTime->Fill(j->time());
02011           } else {
02012             HFSEne->Fill(j->energy()); 
02013             if (j->energy() > HFThreshold) HFSTime->Fill(j->time());
02014           }
02015         }
02016       }
02017       break;
02018 
02019     }
02020 
02021   } catch (...) {
02022     cout << "No HF RecHits." << endl;
02023   }
02024 
02025 
02026 
02027   for (int ieta=0; ieta<100; ieta++) {
02028      for (int iphi=0; iphi<100; iphi++) {
02029        double longF, shortF;
02030        if (HFRecHit[ieta][iphi][0] == -10.) {
02031          longF = 0.;
02032        } else {
02033          longF = HFRecHit[ieta][iphi][0];
02034        }
02035        if (HFRecHit[ieta][iphi][1] == -10.) {
02036          shortF = 0.;
02037        } else {
02038          shortF = HFRecHit[ieta][iphi][1];
02039        }
02040        //       if ((longF > HFThreshold) || (shortF > HFThreshold)) HFLSRatio->Fill((longF-shortF)/(longF+shortF));
02041 
02042        if (longF > 0.) HFLEneAll->Fill(longF);
02043        if (shortF > 0.) HFSEneAll->Fill(shortF);
02044 
02045 
02046        if ((longF > 20.) || (shortF > 20.)) {
02047          double R = (longF-shortF)/(longF+shortF);
02048          HFLSRatio->Fill(R);
02049          if (fabs(R) > 0.995) {    
02050 
02051            //      if (longF > 110.)  {
02052            //      if (longF > 50.)  {
02053            if (longF > (162.4-10.19*abs(ieta-41)+.21*abs(ieta-41)*abs(ieta-41)) )  {
02054              HFEtaFlaggedLN->Fill(ieta-41);
02055 
02056              HFLEneAllF->Fill(longF);
02057 
02058              if (shortF == 0.) HFLEneNoSFlaggedN->Fill(longF);
02059            }
02060            //      if (shortF > 70.)  {
02061            //      if (shortF > 50.)  {
02062            if (shortF > (129.9-6.61*abs(ieta-41)+0.1153*abs(ieta-41)*abs(ieta-41)) ) {
02063              HFEtaFlaggedSN->Fill(ieta-41);
02064 
02065              HFSEneAllF->Fill(shortF);
02066 
02067              if (longF == 0.) HFSEneNoLFlaggedN->Fill(shortF);
02068            }
02069          }
02070        }
02071        /***
02072        cout << "HF LS Ratio long= " 
02073             << longF
02074             << " short= "
02075             << shortF
02076             << endl;
02077        ***/
02078 
02079        HFLvsS->Fill(HFRecHit[ieta][iphi][1], HFRecHit[ieta][iphi][0]);         
02080        if ( (HFRecHit[ieta][iphi][1] == -10.) && (HFRecHit[ieta][iphi][0] != -10.) ) {
02081          HFLEneNoS->Fill(HFRecHit[ieta][iphi][0]);
02082          if (HFRecHitFlag[ieta][iphi][0] !=0 ) HFLEneNoSFlagged->Fill(HFRecHit[ieta][iphi][0]);
02083        }
02084        if ( (HFRecHit[ieta][iphi][0] == -10.) && (HFRecHit[ieta][iphi][1] != -10.) ) {
02085          HFSEneNoL->Fill(HFRecHit[ieta][iphi][1]);
02086          if (HFRecHitFlag[ieta][iphi][1] !=0 ) HFSEneNoLFlagged->Fill(HFRecHit[ieta][iphi][1]);
02087        }
02088 
02089      }
02090   }
02091 
02092   if (HFP_E > 0.) HFTimeP->Fill(HFP_ETime / HFP_E);
02093   if (HFM_E > 0.) HFTimeM->Fill(HFM_ETime / HFM_E);
02094 
02095   if ((HFP_E > 0.) && (HFM_E > 0.)) {
02096     HF_PMM = (HFP_ETime / HFP_E) - (HFM_ETime / HFM_E);
02097     HFTimePM->Fill(HF_PMM); 
02098   } else {
02099     HF_PMM = INVALID;
02100   }
02101 
02102 
02103 
02104   try {
02105     std::vector<edm::Handle<HORecHitCollection> > colls;
02106     evt.getManyByType(colls);
02107     std::vector<edm::Handle<HORecHitCollection> >::iterator i;
02108     for (i=colls.begin(); i!=colls.end(); i++) {
02109       for (HORecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
02110         if (j->id().subdet() == HcalOuter) {
02111           HOEne->Fill(j->energy()); 
02112           HOTime->Fill(j->time());
02113           HOTvsE->Fill(j->energy(), j->time());
02114           if (j->energy() > HOThreshold1) {
02115             HOEneTh1->Fill(j->energy()); 
02116           }
02117           if (j->energy() > HOThreshold) {
02118             HOEneTh->Fill(j->energy()); 
02119             HOTimeTh->Fill(j->time());
02120             HOTotalE += j->energy();
02121             HOocc->Fill(j->id().ieta(),j->id().iphi());
02122           }
02123 
02124           // Separate SiPMs and HPDs:
02125           if (((j->id().iphi()>=59 && j->id().iphi()<=70 && 
02126                 j->id().ieta()>=11 && j->id().ieta()<=15) || 
02127                (j->id().iphi()>=47 && j->id().iphi()<=58 && 
02128                 j->id().ieta()>=5 && j->id().ieta()<=10)))
02129           {  
02130             HOSEne->Fill(j->energy());
02131             if (j->energy() > HOThreshold) HOSTime->Fill(j->time());
02132           } else if ((j->id().iphi()<59 || j->id().iphi()>70 || 
02133                       j->id().ieta()<11 || j->id().ieta()>15) && 
02134                      (j->id().iphi()<47 || j->id().iphi()>58 ||
02135                       j->id().ieta()<5  || j->id().ieta()>10))
02136           {
02137             HOHEne->Fill(j->energy());
02138             if (j->energy() > HOThreshold) HOHTime->Fill(j->time());
02139             // Separate rings -1,-2,0,1,2 in HPDs:
02140             if (j->id().ieta()<= -11){
02141               HOHrm2Ene->Fill(j->energy());
02142               if (j->energy() > HOThreshold) HOHrm2Time->Fill(j->time());
02143             } else if (j->id().ieta()>= -10 && j->id().ieta() <= -5) {
02144               HOHrm1Ene->Fill(j->energy());
02145               if (j->energy() > HOThreshold) HOHrm1Time->Fill(j->time());
02146             } else if (j->id().ieta()>= -4 && j->id().ieta() <= 4) {
02147               HOHr0Ene->Fill(j->energy());
02148               if (j->energy() > HOThreshold) HOHr0Time->Fill(j->time());
02149             } else if (j->id().ieta()>= 5 && j->id().ieta() <= 10) {
02150               HOHrp1Ene->Fill(j->energy());
02151               if (j->energy() > HOThreshold) HOHrp1Time->Fill(j->time());
02152             } else if (j->id().ieta()>= 11) {
02153               HOHrp2Ene->Fill(j->energy());
02154               if (j->energy() > HOThreshold) HOHrp2Time->Fill(j->time());
02155             } else {
02156               std::cout << "Finding events that are in no ring !?!" << std::endl;
02157               std::cout << "eta = " << j->id().ieta() << std::endl;
02158               
02159             }
02160           } else {
02161             std::cout << "Finding events that are neither SiPM nor HPD!?" << std::endl;     
02162           }
02163 
02164           
02165 
02166         }
02167         //      std::cout << *j << std::endl;
02168       }
02169     }
02170   } catch (...) {
02171     cout << "No HO RecHits." << endl;
02172   }
02173 
02174   // HCALTotalE = HBTotalE + HETotalE + HFTotalE + HOTotalE;
02175   // ECALTotalE = 0.;
02176   EBTotalE = EETotalE = 0.;
02177 
02178 
02179   try {
02180     std::vector<edm::Handle<EcalRecHitCollection> > colls;
02181     evt.getManyByType(colls);
02182     std::vector<edm::Handle<EcalRecHitCollection> >::iterator i;
02183     for (i=colls.begin(); i!=colls.end(); i++) {
02184       for (EcalRecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
02185         if (j->id().subdetId() == EcalBarrel) {
02186           EBEne->Fill(j->energy()); 
02187           EBTime->Fill(j->time()); 
02188           if (j->energy() > EBEEThreshold) {
02189             EBEneTh->Fill(j->energy()); 
02190             EBTimeTh->Fill(j->time()); 
02191           }
02192           if ( (evt.id().run() == 120020) && (evt.id().event() == 453) ) {
02193             EBEneX->Fill(j->energy()); 
02194             EBTimeX->Fill(j->time()); 
02195           }
02196           if ( (evt.id().run() == 120020) && (evt.id().event() == 457) ) {
02197             EBEneY->Fill(j->energy()); 
02198             EBTimeY->Fill(j->time()); 
02199           }
02200           EBTotalE += j->energy();
02201         }
02202         if (j->id().subdetId() == EcalEndcap) {
02203           EEEne->Fill(j->energy()); 
02204           EETime->Fill(j->time());
02205           if (j->energy() > EBEEThreshold) {
02206             EEEneTh->Fill(j->energy()); 
02207             EETimeTh->Fill(j->time()); 
02208           }
02209           if ( (evt.id().run() == 120020) && (evt.id().event() == 453) ) {
02210             EEEneX->Fill(j->energy()); 
02211             EETimeX->Fill(j->time()); 
02212           }
02213           if ( (evt.id().run() == 120020) && (evt.id().event() == 457 ) ) {
02214             EEEneY->Fill(j->energy()); 
02215             EETimeY->Fill(j->time()); 
02216           }
02217           EETotalE += j->energy();
02218         }
02219         //      std::cout << *j << std::endl;
02220         //      std::cout << "EB ID = " << j->id().subdetId() << "/" << EcalBarrel << std::endl;
02221       }
02222     }
02223   } catch (...) {
02224     cout << "No ECAL RecHits." << endl;
02225   }
02226 
02227   EBvHB->Fill(HBTotalE, EBTotalE);
02228   EEvHE->Fill(HETotalE, EETotalE);
02229 
02230   /*****
02231   try {
02232     std::vector<edm::Handle<EBRecHitCollection> > colls;
02233     evt.getManyByType(colls);
02234     std::vector<edm::Handle<EBRecHitCollection> >::iterator i;
02235 
02236     for (i=colls.begin(); i!=colls.end(); i++) {
02237       for (EBRecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
02238         //      if (j->id().subdetId() == EcalBarrel) {
02239           EBEne->Fill(j->energy()); 
02240           EBTime->Fill(j->time()); 
02241           //      EBTotalE = j->energy();
02242           //    }
02243           //    std::cout << *j << std::endl;
02244           //    std::cout << "EB ID = " << j->id().subdetId() << "/" << EcalBarrel << std::endl;
02245       }
02246     }
02247   } catch (...) {
02248     cout << "No EB RecHits." << endl;
02249   }
02250 
02251   try {
02252     std::vector<edm::Handle<EERecHitCollection> > colls;
02253     evt.getManyByType(colls);
02254     std::vector<edm::Handle<EERecHitCollection> >::iterator i;
02255     for (i=colls.begin(); i!=colls.end(); i++) {
02256       for (EERecHitCollection::const_iterator j=(*i)->begin(); j!=(*i)->end(); j++) {
02257         //      if (j->id().subdetId() == EcalEndcap) {
02258           EEEne->Fill(j->energy()); 
02259           EETime->Fill(j->time());
02260           //      EETotalE = j->energy();
02261           // Separate +-EE;
02262           EEDetId EEid = EEDetId(j->id());
02263           if (!EEid.positiveZ()) 
02264           {
02265             EEnegEne->Fill(j->energy()); 
02266             EEnegTime->Fill(j->time()); 
02267           }else{
02268             EEposEne->Fill(j->energy()); 
02269             EEposTime->Fill(j->time()); 
02270           }
02271           //    }
02272         //      std::cout << *j << std::endl;
02273       }
02274     }
02275   } catch (...) {
02276     cout << "No EE RecHits." << endl;
02277   }
02278   ******/
02279 
02280   // ECALTotalE = EBTotalE + EETotalE;
02281 
02282   if ( (EBTotalE > 320000)  && (EBTotalE < 330000) && 
02283        (HBTotalE > 2700000) && (HBTotalE < 2800000) ) {
02284 
02285     std::cout << ">>> Off Axis! " 
02286               << std::endl;
02287     
02288   }
02289 
02290   /***
02291   std::cout << " Rechits: Total Energy :  " 
02292             << " HCAL= " << HCALTotalE 
02293             << " ECAL= " << ECALTotalE
02294             << " HB = " << HBTotalE
02295             << " EB = " << EBTotalE
02296             << std::endl;
02297   ***/
02298 
02299 
02300   // *********************
02301   // *** CaloTowers
02302   // *********************
02303   //  Handle<CaloTowerCollection> caloTowers;
02304   //  evt.getByLabel( "towerMaker", caloTowers );
02305 
02306   nTow1 = nTow2 = nTow3 = nTow4 = 0;
02307 
02308   double sum_et = 0.0;
02309   double sum_ex = 0.0;
02310   double sum_ey = 0.0;
02311 
02312   double HFsum_et = 0.0;
02313   double HFsum_ex = 0.0;
02314   double HFsum_ey = 0.0;
02315   //  double sum_ez = 0.0;
02316 
02317 
02318   //  std::cout<<">>>> Run " << evt.id().run() << " Event " << evt.id().event() << std::endl;
02319   // --- Loop over towers and make a lists of used and unused towers
02320   for (CaloTowerCollection::const_iterator tower = caloTowers->begin();
02321        tower != caloTowers->end(); tower++) {
02322 
02323     Double_t  et   = tower->et();
02324     Double_t  phix = tower->phi();
02325     
02326     if (et > 0.5) nTow1++;
02327     if (et > 1.0) nTow2++;
02328     if (et > 1.5) nTow3++;
02329     if (et > 2.0) nTow4++;
02330 
02331     //    if ( (fabs(tower->ieta() > 42)) ||  (fabs(tower->iphi()) > 72) ) {
02332     //      std::cout << "ieta/iphi = " <<  tower->ieta() << " / "  << tower->iphi() << std::endl;
02333     //    }
02334 
02335     if (tower->emEnergy() > 2.0) {
02336       h_EmEnergy->Fill (tower->ieta(), tower->iphi(), tower->emEnergy());
02337     }
02338     if (tower->hadEnergy() > 2.0) {
02339       h_HadEnergy->Fill (tower->ieta(), tower->iphi(), tower->hadEnergy());
02340     }
02341 
02342     if (fabs(tower->ieta()) > 29) {
02343       HFsum_et += et;
02344       HFsum_ex += et*cos(phix);
02345       HFsum_ey += et*sin(phix);
02346     }
02347 
02348 
02349     if (et>0.5) {
02350 
02351       ETime->Fill(tower->ecalTime());
02352       HTime->Fill(tower->hcalTime());
02353 
02354       // ********
02355       //      double theta = tower->theta();
02356       //      double e     = tower->energy();
02357       //      double et    = e*sin(theta);
02358       //      double et    = tower->emEt() + tower->hadEt();
02359       //      sum_ez += e*cos(theta);
02360       sum_et += et;
02361       sum_ex += et*cos(phix);
02362       sum_ey += et*sin(phix);
02363       // ********
02364 
02365       Double_t phi = tower->phi();
02366       SumEtTowers += tower->et();
02367 
02368       sumTowerAllEx += et*cos(phi);
02369       sumTowerAllEy += et*sin(phi);
02370 
02371     }
02372 
02373   }
02374 
02375   //  SumEt->Fill(sum_et);
02376   //  MET->Fill(sqrt( sum_ex*sum_ex + sum_ey*sum_ey));
02377 
02378   HFSumEt->Fill(HFsum_et);
02379   HFMET->Fill(sqrt( HFsum_ex*HFsum_ex + HFsum_ey*HFsum_ey));
02380 
02381   hf_sumTowerAllEx->Fill(sumTowerAllEx);
02382   hf_sumTowerAllEy->Fill(sumTowerAllEy);
02383 
02384   nTowers1->Fill(nTow1);
02385   nTowers2->Fill(nTow2);
02386   nTowers3->Fill(nTow3);
02387   nTowers4->Fill(nTow4);
02388 
02389 
02390   // *********************
02391   // *********************
02392 
02393   UsedTowerList.clear();
02394   TowerUsedInJets.clear();
02395   TowerNotUsedInJets.clear();
02396 
02397   // --- Loop over jets and make a list of all the used towers
02398   //  evt.getByLabel( CaloJetAlgorithm, jets );
02399   for ( CaloJetCollection::const_iterator ijet=caloJets->begin(); ijet!=caloJets->end(); ijet++) {
02400 
02401     Double_t jetPt  = ijet->pt();
02402     Double_t jetEta = ijet->eta();
02403     Double_t jetPhi = ijet->phi();
02404 
02405     //    if (jetPt>5.0) {
02406 
02407       Double_t jetPx = jetPt*cos(jetPhi);
02408       Double_t jetPy = jetPt*sin(jetPhi);
02409 
02410       sumJetPx +=jetPx;
02411       sumJetPy +=jetPy;
02412 
02413       const std::vector<CaloTowerPtr> jetCaloRefs = ijet->getCaloConstituents();
02414       int nConstituents = jetCaloRefs.size();
02415       for (int i = 0; i <nConstituents ; i++){
02416         
02417         UsedTowerList.push_back(jetCaloRefs[i]);
02418       }
02419       
02420       SumPtJet +=jetPt;
02421 
02422     //    }
02423 
02424       if ( (jetPt>80.0) && (fabs(jetEta) < 1.3) ){
02425         st_Pt->Fill( jetPt );
02426         int nConstituents = ijet->getCaloConstituents().size();
02427         st_Constituents->Fill( nConstituents );
02428         
02429         float maxEne = 0.;
02430         float totEne = 0.;
02431           
02432         for(unsigned twr=0; twr<ijet->getCaloConstituents().size(); ++twr){
02433           CaloTowerPtr tower = (ijet->getCaloConstituents())[twr];
02434           //      CaloTowerDetId id = tower->id();     
02435           if( tower->et()>0. ){
02436 
02437             if (tower->energy() > maxEne) maxEne = tower->energy();
02438             totEne += tower->energy();
02439 
02440             st_Energy->Fill( tower->energy() );
02441             st_EmEnergy->Fill( tower->emEnergy() );
02442             st_HadEnergy->Fill( tower->hadEnergy() );
02443             st_OuterEnergy->Fill( tower->outerEnergy() );
02444 
02445             st_Eta->Fill( tower->eta() );
02446             st_Phi->Fill( tower->phi() );
02447 
02448             st_iEta->Fill( tower->ieta() );
02449             st_iPhi->Fill( tower->iphi() );
02450 
02451             /****
02452             std::cout << ">>> Towers :  " 
02453                       << " " << tower->energy() 
02454                       << " " << tower->emEnergy()
02455                       << " " << tower->hadEnergy()
02456                       << " " << tower->outerEnergy()
02457                       << " " << tower->et()
02458                       << " " << tower->emEt() 
02459                       << " " << tower->hadEt() 
02460                       << " " << tower->outerEt() 
02461                       << " " << tower->eta() 
02462                       << " " << tower->phi()        
02463                       << std::endl;
02464             ****/
02465           }
02466         }
02467         st_Frac->Fill( maxEne / totEne );
02468 
02469       }
02470 
02471   }
02472 
02473   int NTowersUsed = UsedTowerList.size();
02474 
02475   // --- Loop over towers and make a lists of used and unused towers
02476   for (CaloTowerCollection::const_iterator tower = caloTowers->begin();
02477        tower != caloTowers->end(); tower++) {
02478 
02479     CaloTower  t = *tower;
02480     Double_t  et = tower->et();
02481 
02482     if(et>0) {
02483 
02484       Double_t phi = tower->phi();
02485       SumEtTowers += tower->et();
02486 
02487       sumTowerAllPx += et*cos(phi);
02488       sumTowerAllPy += et*sin(phi);
02489 
02490       bool used = false;
02491 
02492       for(int i=0; i<NTowersUsed; i++){
02493         if(tower->id() == UsedTowerList[i]->id()){
02494           used=true;
02495           break;
02496         }
02497       }
02498 
02499       if (used) {
02500         TowerUsedInJets.push_back(t);
02501       } else {
02502         TowerNotUsedInJets.push_back(t);
02503       }
02504     }
02505   }
02506 
02507   int nUsed    = TowerUsedInJets.size();
02508   int nNotUsed = TowerNotUsedInJets.size();
02509 
02510   SumEtJets    = 0;
02511   SumEtNotJets = 0;
02512   TotalClusteredE   = 0;
02513   TotalUnclusteredE = 0;
02514 
02515   for(int i=0;i<nUsed;i++){
02516     SumEtJets += TowerUsedInJets[i].et();
02517     h_ClusteredE->Fill(TowerUsedInJets[i].energy());
02518     if (TowerUsedInJets[i].energy() > 1.0) 
02519       TotalClusteredE += TowerUsedInJets[i].energy();
02520   }
02521   h_jetEt->Fill(SumEtJets);
02522 
02523   for(int i=0;i<nNotUsed;i++){
02524     if (TowerNotUsedInJets[i].et() > 0.5)
02525       SumEtNotJets += TowerNotUsedInJets[i].et();
02526     h_UnclusteredEt->Fill(TowerNotUsedInJets[i].et());
02527     h_UnclusteredEts->Fill(TowerNotUsedInJets[i].et());
02528     h_UnclusteredE->Fill(TowerNotUsedInJets[i].energy());
02529     if (TowerNotUsedInJets[i].energy() > 1.0)  
02530       TotalUnclusteredE += TowerNotUsedInJets[i].energy();
02531   }
02532 
02533   h_TotalClusteredE->Fill(TotalClusteredE);
02534   h_TotalUnclusteredE->Fill(TotalUnclusteredE);
02535   h_TotalUnclusteredEt->Fill(SumEtNotJets);
02536 
02537   // ********************************
02538   // *** CaloMET
02539   // ********************************
02540 
02541   edm::Handle<reco::CaloMETCollection> calometcoll;
02542   evt.getByLabel("met", calometcoll);
02543   if (calometcoll.isValid()) {
02544     const CaloMETCollection *calometcol = calometcoll.product();
02545     const CaloMET *calomet;
02546     calomet = &(calometcol->front());
02547 
02548     double caloSumET  = calomet->sumEt();
02549     double caloMET    = calomet->pt();
02550     double caloMETSig = calomet->mEtSig();
02551     double caloMEx    = calomet->px();
02552     double caloMEy    = calomet->py();
02553     double caloMETPhi = calomet->phi();
02554 
02555     SumEt->Fill(caloSumET);
02556     MET->Fill(caloMET);
02557     if (std::abs(OER) > 0.8) OERMET->Fill(caloMET);
02558 
02559     if (evtType == 0) MET_Tower->Fill(caloMET);
02560     if (evtType == 1) MET_RBX->Fill(caloMET);
02561     if (evtType == 2) MET_HPD->Fill(caloMET);
02562     METSig->Fill(caloMETSig);
02563     MEx->Fill(caloMEx);
02564     MEy->Fill(caloMEy);
02565     METPhi->Fill(caloMETPhi);
02566 
02567     /***
02568     double caloEz     = calomet->e_longitudinal();
02569 
02570     double caloMaxEtInEMTowers    = calomet->maxEtInEmTowers();
02571     double caloMaxEtInHadTowers   = calomet->maxEtInHadTowers();
02572     double caloEtFractionHadronic = calomet->etFractionHadronic();
02573     double caloEmEtFraction       = calomet->emEtFraction();
02574 
02575     double caloHadEtInHB = calomet->hadEtInHB();
02576     double caloHadEtInHO = calomet->hadEtInHO();
02577     double caloHadEtInHE = calomet->hadEtInHE();
02578     double caloHadEtInHF = calomet->hadEtInHF();
02579     double caloEmEtInEB  = calomet->emEtInEB();
02580     double caloEmEtInEE  = calomet->emEtInEE();
02581     double caloEmEtInHF  = calomet->emEtInHF();
02582     ****/
02583   }
02584 
02585   // ********************************
02586   // *** Vertex
02587   // ********************************
02588   VTX  = INVALID;
02589   nVTX = 0;
02590 
02591   edm::Handle<reco::VertexCollection> vertexCollection;
02592   evt.getByLabel("offlinePrimaryVertices", vertexCollection);
02593   const reco::VertexCollection vC = *(vertexCollection.product());
02594 
02595   //  std::cout << "Reconstructed "<< vC.size() << " vertices" << std::endl ;
02596   nVTX = vC.size();
02597   //double vertex_numTrks;
02598   for (reco::VertexCollection::const_iterator vertex=vC.begin(); vertex!=vC.end(); vertex++){
02599 
02600     h_Vx->Fill(vertex->x());
02601     h_Vy->Fill(vertex->y());
02602     h_Vz->Fill(vertex->z());
02603     VTX  = vertex->z();
02604     //    vertex_numTrks = vertex->tracksSize();
02605     //    h_VNTrks->Fill(vertex_numTrks);
02606 
02607   }
02608 
02609   if ((HF_PMM != INVALID) || (nVTX > 0)) {
02610     HFvsZ->Fill(HF_PMM,VTX);
02611   }
02612 
02613   // ********************************
02614   // *** Pixel Clusters
02615   // ********************************
02616   //  edm::Handle< edmNew::DetSetVector<SiPixelCluster> > hClusterColl;
02617   //  evt.getByLabel("siPixelClusters", hClusterColl);
02618   //  const edmNew::DetSetVector<SiPixelCluster> clustColl = *(hClusterColl.product());
02619 
02620   SiClusters->Fill(clustColl.size());
02621 
02622   // ********************************
02623   // *** Tracks
02624   // ********************************
02625   //  edm::Handle<reco::TrackCollection> trackCollection;
02626   //  evt.getByLabel("ctfWithMaterialTracks", trackCollection);
02627   //  evt.getByLabel("generalTracks", trackCollection);
02628   //  const reco::TrackCollection tC = *(trackCollection.product());
02629 
02630   //  std::cout << "ANA: Reconstructed "<< tC.size() << " tracks" << std::endl ;
02631 
02632   // *************************************
02633   /*****
02634   //Get the Vertex Collection
02635   edm::Handle<std::vector<reco::Vertex> > verticies;  evt.getByLabel("offlinePrimaryVertices", verticies);
02636 
02637   //Fill the variables
02638   int _ntracksw5 = 0;
02639   for (std::vector<reco::Vertex>::const_iterator it = verticies->begin(); it != verticies->end(); ++it) {
02640 
02641     //    ntracks->push_back(int(it->tracksSize())); //all tracks considered for vertexing
02642     //    isvalid->push_back(int(it->isValid()));
02643     //    isfake->push_back(int(it->isFake()));
02644 
02645     if(it->tracksSize() > 0) {
02646       std::vector<TrackBaseRef>::const_iterator trackIt;
02647       for( trackIt = it->tracks_begin(); trackIt != it->tracks_end(); trackIt++) {
02648         if(fabs((**trackIt).charge()) <= 1.)  { 
02649           //tracks that contribute with more than 0.5 weight in vertex reconstruction
02650           if (it->trackWeight(*trackIt) >= 0.5 ) 
02651             _ntracksw5++;
02652         }
02653       }
02654     }
02655   }
02656   *****/
02657   // *************************************
02658   
02659 
02660   h_Trk_NTrk->Fill(tC.size());
02661   if (NPMTHits == 0) TrkMultFlagged0->Fill(tC.size());
02662   if (NPMTHits == 1) TrkMultFlagged1->Fill(tC.size());
02663   if (NPMTHits == 2) TrkMultFlagged2->Fill(tC.size());
02664   if (NPMTHits == 3) TrkMultFlagged3->Fill(tC.size());
02665   if (NPMTHits == 4) TrkMultFlagged4->Fill(tC.size());
02666   if (NPMTHits > 1) TrkMultFlaggedM->Fill(tC.size());
02667   for (reco::TrackCollection::const_iterator track=tC.begin(); track!=tC.end(); track++){
02668     h_Trk_pt->Fill(track->pt());
02669   }
02670 
02671 
02672     /****
02673     std::cout << "Track number "<< i << std::endl ;
02674     std::cout << "\tmomentum: " << track->momentum()<< std::endl;
02675     std::cout << "\tPT: " << track->pt()<< std::endl;
02676     std::cout << "\tvertex: " << track->vertex()<< std::endl;
02677     std::cout << "\timpact parameter: " << track->d0()<< std::endl;
02678     std::cout << "\tcharge: " << track->charge()<< std::endl;
02679     std::cout << "\tnormalizedChi2: " << track->normalizedChi2()<< std::endl;
02680 
02681     cout<<"\tFrom EXTRA : "<<endl;
02682     cout<<"\t\touter PT "<< track->outerPt()<<endl;
02683     std::cout << "\t direction: " << track->seedDirection() << std::endl;
02684     ****/
02685 
02686   // ********************************
02687   // *** Photons
02688   // ********************************
02689   /***
02690   edm::Handle<reco::PhotonCollection> photonCollection;
02691   evt.getByLabel("photons", photonCollection);
02692   const reco::PhotonCollection pC = *(photonCollection.product());
02693 
02694   std::cout << "Reconstructed "<< pC.size() << " photons" << std::endl ;
02695   for (reco::PhotonCollection::const_iterator photon=pC.begin(); photon!=pC.end(); photon++){
02696   }
02697   ***/
02698 
02699   // ********************************
02700   // *** Muons
02701   // ********************************
02702   /***
02703   edm::Handle<reco::MuonCollection> muonCollection;
02704   evt.getByLabel("muons", muonCollection);
02705 
02706   const reco::MuonCollection mC = *(muonCollection.product());
02707 
02708   std::cout << "Reconstructed "<< mC.size() << " muons" << std::endl ;
02709   for (reco::MuonCollection::const_iterator muon=mC.begin(); muon!=mC.end(); muon++){
02710   }
02711   ***/
02712 
02713 
02714 
02715 
02716   // ********************************
02717   // *** Events passing seletion cuts
02718   // ********************************
02719 
02720   // --- Cosmic Cleanup
02721   // --- Vertex
02722   // --- Eta 
02723 
02724   int iJet; 
02725   iJet = 0;
02726   for( CaloJetCollection::const_iterator ijet = caloJets->begin(); ijet != caloJets->end(); ++ ijet ) {
02727     
02728     //    if ( (fabs(ijet->eta()) < 1.3) && 
02729     //   (fabs(ijet->pt())  > 20.) ) {
02730 
02731          //      (ijet->emEnergyFraction() > 0.01) &&
02732          //      (ijet->emEnergyFraction() > 0.99) ) {
02733 
02734     iJet++; 
02735     //    if (iJet == 1) {
02736     //      cout << " CaloJet: Event Type = "   << evtType 
02737     //     << " pt = " << ijet->pt()
02738     //     << endl; 
02739     //    }
02740     h_pt->Fill(ijet->pt());
02741     if (evtType == 0) h_ptTower->Fill(ijet->pt());
02742     if (evtType == 1) h_ptRBX->Fill(ijet->pt());
02743     if (evtType == 2) h_ptHPD->Fill(ijet->pt());
02744     h_et->Fill(ijet->et());
02745     h_eta->Fill(ijet->eta());
02746     h_phi->Fill(ijet->phi());
02747 
02748     jetHOEne->Fill(ijet->hadEnergyInHO());    
02749     jetEMFraction->Fill(ijet->emEnergyFraction());    
02750       
02751     //    }    
02752   }
02753 
02754 
02755 
02756   //*****************************
02757   //*** Get the GenJet collection
02758   //*****************************
02759 
02760       /**************
02761   Handle<GenJetCollection> genJets;
02762   evt.getByLabel( GenJetAlgorithm, genJets );
02763 
02764   //Loop over the two leading GenJets and fill some histograms
02765   jetInd    = 0;
02766   allJetInd = 0;
02767   for( GenJetCollection::const_iterator gen = genJets->begin(); gen != genJets->end(); ++ gen ) {
02768     allJetInd++;
02769     if (allJetInd == 1) {
02770       p4tmp[0] = gen->p4();
02771     }
02772     if (allJetInd == 2) {
02773       p4tmp[1] = gen->p4();
02774     }
02775 
02776     if ( (allJetInd == 1) || (allJetInd == 2) ) {
02777       h_ptGenL->Fill( gen->pt() );
02778       h_etaGenL->Fill( gen->eta() );
02779       h_phiGenL->Fill( gen->phi() );
02780     }
02781 
02782     if ( gen->pt() > minJetPt) {
02783       // std::cout << "GEN JET1 #" << jetInd << std::endl << gen->print() << std::endl;
02784       h_ptGen->Fill( gen->pt() );
02785       h_etaGen->Fill( gen->eta() );
02786       h_phiGen->Fill( gen->phi() );
02787       jetInd++;
02788     }
02789   }
02790 
02791   h_nGenJets->Fill( jetInd );
02792       *******/
02793   }
02794 
02795 }
02796 
02797 // ***********************************
02798 // ***********************************
02799 void myJetAna::endJob() {
02800 
02801   for (int i=0; i<4000; i++) {
02802     if ((nBNC[i]/totBNC) > 0.05) {
02803       std::cout << "+++ " << i << " " 
02804                 << (nBNC[i]/totBNC) << " "
02805                 << nBNC[i]          << " " 
02806                 << totBNC           << " " 
02807                 << std::endl;      
02808     }
02809   }
02810 
02811 
02812 }
02813 #include "FWCore/Framework/interface/MakerMacros.h"
02814 DEFINE_FWK_MODULE(myJetAna);