CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/HLTrigger/HLTanalyzers/src/HLTBJet.cc

Go to the documentation of this file.
00001 #include <cmath>
00002 #include <algorithm>
00003 #include <utility>
00004 #include <cstring>
00005 #include <boost/foreach.hpp>
00006 
00007 #include <TTree.h>
00008 
00009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00010 #include "FWCore/Framework/interface/ESHandle.h" 
00011 #include "FWCore/Framework/interface/EventSetup.h"
00012 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00013 
00014 #include "DataFormats/Common/interface/View.h"
00015 #include "DataFormats/JetReco/interface/Jet.h"
00016 #include "DataFormats/BTauReco/interface/JetTag.h"
00017 
00018 #include "HLTrigger/HLTanalyzers/interface/HLTBJet.h"
00019 
00020 static const size_t kMaxBJets = 10;
00021 
00022 #include "HLTMessages.h"
00023 
00024 HLTBJet::HLTBJet() 
00025 {
00026   // set of variables for uncorrected L2 jets
00027   NohBJetL2                 = 0;
00028   ohBJetL2Energy            = new float[kMaxBJets];
00029   ohBJetL2Et                = new float[kMaxBJets];
00030   ohBJetL2Pt                = new float[kMaxBJets];
00031   ohBJetL2Eta               = new float[kMaxBJets];
00032   ohBJetL2Phi               = new float[kMaxBJets];
00033               
00034   // set of variables for corrected L2 jets
00035   NohBJetL2Corrected        = 0;
00036   ohBJetL2CorrectedEnergy   = new float[kMaxBJets];
00037   ohBJetL2CorrectedEt       = new float[kMaxBJets];
00038   ohBJetL2CorrectedPt       = new float[kMaxBJets];
00039   ohBJetL2CorrectedEta      = new float[kMaxBJets];
00040   ohBJetL2CorrectedPhi      = new float[kMaxBJets];
00041   
00042   // set of variables for corrected L2 jets L1FastJet
00043   NohBJetL2CorrectedL1FastJet        = 0;
00044   ohBJetL2CorrectedEnergyL1FastJet   = new float[kMaxBJets];
00045   ohBJetL2CorrectedEtL1FastJet       = new float[kMaxBJets];
00046   ohBJetL2CorrectedPtL1FastJet       = new float[kMaxBJets];
00047   ohBJetL2CorrectedEtaL1FastJet      = new float[kMaxBJets];
00048   ohBJetL2CorrectedPhiL1FastJet      = new float[kMaxBJets];
00049   
00050   // set of variables for uncorrected L2 jets
00051   NohpfBJetL2                 = 0;
00052   ohpfBJetL2Energy            = new float[kMaxBJets];
00053   ohpfBJetL2Et                = new float[kMaxBJets];
00054   ohpfBJetL2Pt                = new float[kMaxBJets];
00055   ohpfBJetL2Eta               = new float[kMaxBJets];
00056   ohpfBJetL2Phi               = new float[kMaxBJets];
00057               
00058   // set of variables for lifetime-based b-tag
00059   ohBJetIPL25Tag            = new float[kMaxBJets];
00060   ohBJetIPL3Tag             = new float[kMaxBJets];
00061 
00062   // set of variables for lifetime-based b-tag L1FastJet
00063   ohBJetIPL25TagL1FastJet           = new float[kMaxBJets];
00064   ohBJetIPL3TagL1FastJet             = new float[kMaxBJets];
00065 
00066   // set of variables for lifetime-based b-tag PF jets
00067   ohpfBJetIPL3Tag             = new float[kMaxBJets];
00068 
00069   // set of variables for lifetime-based b-tag Single Track
00070   ohBJetIPL25TagSingleTrack = new float[kMaxBJets];
00071   ohBJetIPL3TagSingleTrack  = new float[kMaxBJets];
00072   ohBJetIPL25TagSingleTrackL1FastJet = new float[kMaxBJets];
00073   ohBJetIPL3TagSingleTrackL1FastJet  = new float[kMaxBJets];
00074   
00075   // set of variables for b-tagging performance measurements
00076   // SoftMuonbyDR
00077   ohBJetPerfL25Tag          = new int[kMaxBJets];          // do not optimize 
00078   ohBJetPerfL3Tag           = new int[kMaxBJets];          // do not optimize
00079   // set of variables for b-tagging performance measurements L1FastJet
00080   // SoftMuonbyDR
00081   ohBJetPerfL25TagL1FastJet          = new int[kMaxBJets];          // do not optimize 
00082   ohBJetPerfL3TagL1FastJet           = new int[kMaxBJets];          // do not optimize
00083 }
00084 
00085 void HLTBJet::clear() 
00086 {
00087   NohBJetL2          = 0;
00088   NohBJetL2Corrected = 0;
00089   std::memset(ohBJetL2Energy,            '\0', kMaxBJets * sizeof(float));
00090   std::memset(ohBJetL2Et,                '\0', kMaxBJets * sizeof(float));
00091   std::memset(ohBJetL2Et,                '\0', kMaxBJets * sizeof(float));
00092   std::memset(ohBJetL2Pt,                '\0', kMaxBJets * sizeof(float));
00093   std::memset(ohBJetL2Eta,               '\0', kMaxBJets * sizeof(float));
00094   std::memset(ohBJetL2Phi,               '\0', kMaxBJets * sizeof(float));
00095   std::memset(ohBJetL2CorrectedEnergy,   '\0', kMaxBJets * sizeof(float));
00096   std::memset(ohBJetL2CorrectedEt,       '\0', kMaxBJets * sizeof(float));
00097   std::memset(ohBJetL2CorrectedPt,       '\0', kMaxBJets * sizeof(float));
00098   std::memset(ohBJetL2CorrectedEta,      '\0', kMaxBJets * sizeof(float));
00099   std::memset(ohBJetL2CorrectedPhi,      '\0', kMaxBJets * sizeof(float));
00100   std::memset(ohBJetL2CorrectedEnergyL1FastJet, '\0', kMaxBJets * sizeof(float));
00101   std::memset(ohBJetL2CorrectedEtL1FastJet,     '\0', kMaxBJets * sizeof(float));
00102   std::memset(ohBJetL2CorrectedPtL1FastJet,     '\0', kMaxBJets * sizeof(float));
00103   std::memset(ohBJetL2CorrectedEtaL1FastJet,    '\0', kMaxBJets * sizeof(float));
00104   std::memset(ohBJetL2CorrectedPhiL1FastJet,    '\0', kMaxBJets * sizeof(float));
00105   std::memset(ohpfBJetL2Energy,            '\0', kMaxBJets * sizeof(float));
00106   std::memset(ohpfBJetL2Et,                '\0', kMaxBJets * sizeof(float));
00107   std::memset(ohpfBJetL2Et,                '\0', kMaxBJets * sizeof(float));
00108   std::memset(ohpfBJetL2Pt,                '\0', kMaxBJets * sizeof(float));
00109   std::memset(ohpfBJetL2Eta,               '\0', kMaxBJets * sizeof(float));
00110   std::memset(ohpfBJetL2Phi,               '\0', kMaxBJets * sizeof(float));
00111 
00112   std::memset(ohBJetIPL25Tag,            '\0', kMaxBJets * sizeof(float));
00113   std::memset(ohBJetIPL3Tag,             '\0', kMaxBJets * sizeof(float));
00114   std::memset(ohBJetIPL25TagL1FastJet,   '\0', kMaxBJets * sizeof(float));
00115   std::memset(ohBJetIPL3TagL1FastJet,    '\0', kMaxBJets * sizeof(float));
00116   std::memset(ohpfBJetIPL3Tag,           '\0', kMaxBJets * sizeof(float));
00117 
00118   std::memset(ohBJetIPL25TagSingleTrack, '\0', kMaxBJets * sizeof(float));
00119   std::memset(ohBJetIPL3TagSingleTrack,  '\0', kMaxBJets * sizeof(float));
00120   std::memset(ohBJetIPL25TagSingleTrackL1FastJet, '\0', kMaxBJets * sizeof(float));
00121   std::memset(ohBJetIPL3TagSingleTrackL1FastJet,  '\0', kMaxBJets * sizeof(float));
00122 
00123   std::memset(ohBJetPerfL25Tag,          '\0', kMaxBJets * sizeof(int));
00124   std::memset(ohBJetPerfL3Tag,           '\0', kMaxBJets * sizeof(int));
00125   std::memset(ohBJetPerfL25TagL1FastJet, '\0', kMaxBJets * sizeof(int));
00126   std::memset(ohBJetPerfL3TagL1FastJet,  '\0', kMaxBJets * sizeof(int));
00127 }
00128 
00129 HLTBJet::~HLTBJet() 
00130 { 
00131   delete[] ohBJetL2Energy;
00132   delete[] ohBJetL2Et;
00133   delete[] ohBJetL2Pt;
00134   delete[] ohBJetL2Eta;
00135   delete[] ohBJetL2Phi;
00136   delete[] ohBJetL2CorrectedEnergy;
00137   delete[] ohBJetL2CorrectedEt;
00138   delete[] ohBJetL2CorrectedPt;
00139   delete[] ohBJetL2CorrectedEta;
00140   delete[] ohBJetL2CorrectedPhi;
00141   delete[] ohBJetL2CorrectedEnergyL1FastJet;
00142   delete[] ohBJetL2CorrectedEtL1FastJet;
00143   delete[] ohBJetL2CorrectedPtL1FastJet;
00144   delete[] ohBJetL2CorrectedEtaL1FastJet;
00145   delete[] ohBJetL2CorrectedPhiL1FastJet;
00146   delete[] ohpfBJetL2Energy;
00147   delete[] ohpfBJetL2Et;
00148   delete[] ohpfBJetL2Pt;
00149   delete[] ohpfBJetL2Eta;
00150   delete[] ohpfBJetL2Phi;
00151   delete[] ohBJetIPL25Tag;
00152   delete[] ohBJetIPL3Tag;
00153   delete[] ohBJetIPL25TagL1FastJet;
00154   delete[] ohBJetIPL3TagL1FastJet;
00155   delete[] ohpfBJetIPL3Tag;
00156   delete[] ohBJetIPL25TagSingleTrack;
00157   delete[] ohBJetIPL3TagSingleTrack;
00158   delete[] ohBJetIPL25TagSingleTrackL1FastJet;
00159   delete[] ohBJetIPL3TagSingleTrackL1FastJet;
00160   delete[] ohBJetPerfL25Tag;
00161   delete[] ohBJetPerfL3Tag;
00162   delete[] ohBJetPerfL25TagL1FastJet;
00163   delete[] ohBJetPerfL3TagL1FastJet;
00164 }
00165 
00166 void HLTBJet::setup(const edm::ParameterSet & config, TTree * tree)
00167 {
00168   // create the TTree branches
00169   if (tree) {
00170     tree->Branch("NohBJetL2",               & NohBJetL2,             "NohBJetL2/I");
00171     tree->Branch("ohBJetL2Energy",          ohBJetL2Energy,          "ohBJetL2Energy[NohBJetL2]/F");
00172     tree->Branch("ohBJetL2Et",              ohBJetL2Et,              "ohBJetL2Et[NohBJetL2]/F");
00173     tree->Branch("ohBJetL2Pt",              ohBJetL2Pt,              "ohBJetL2Pt[NohBJetL2]/F");
00174     tree->Branch("ohBJetL2Eta",             ohBJetL2Eta,             "ohBJetL2Eta[NohBJetL2]/F");
00175     tree->Branch("ohBJetL2Phi",             ohBJetL2Phi,             "ohBJetL2Phi[NohBJetL2]/F");
00176                 
00177     tree->Branch("NohBJetL2Corrected",      & NohBJetL2Corrected,    "NohBJetL2Corrected/I");
00178     tree->Branch("ohBJetL2CorrectedEnergy", ohBJetL2CorrectedEnergy, "ohBJetL2CorrectedEnergy[NohBJetL2Corrected]/F");
00179     tree->Branch("ohBJetL2CorrectedEt",     ohBJetL2CorrectedEt,     "ohBJetL2CorrectedEt[NohBJetL2Corrected]/F");
00180     tree->Branch("ohBJetL2CorrectedPt",     ohBJetL2CorrectedPt,     "ohBJetL2CorrectedPt[NohBJetL2Corrected]/F");
00181     tree->Branch("ohBJetL2CorrectedEta",    ohBJetL2CorrectedEta,    "ohBJetL2CorrectedEta[NohBJetL2Corrected]/F");
00182     tree->Branch("ohBJetL2CorrectedPhi",    ohBJetL2CorrectedPhi,    "ohBJetL2CorrectedPhi[NohBJetL2Corrected]/F");
00183     
00184     tree->Branch("NohBJetL2CorrectedL1FastJet",      & NohBJetL2CorrectedL1FastJet,    "NohBJetL2CorrectedL1FastJet/I");
00185     tree->Branch("ohBJetL2CorrectedEnergyL1FastJet", ohBJetL2CorrectedEnergyL1FastJet, "ohBJetL2CorrectedEnergyL1FastJet[NohBJetL2CorrectedL1FastJet]/F");
00186     tree->Branch("ohBJetL2CorrectedEtL1FastJet",     ohBJetL2CorrectedEtL1FastJet,     "ohBJetL2CorrectedEtL1FastJet[NohBJetL2CorrectedL1FastJet]/F");
00187     tree->Branch("ohBJetL2CorrectedPtL1FastJet",     ohBJetL2CorrectedPtL1FastJet,     "ohBJetL2CorrectedPtL1FastJet[NohBJetL2CorrectedL1FastJet]/F");
00188     tree->Branch("ohBJetL2CorrectedEtaL1FastJet",    ohBJetL2CorrectedEtaL1FastJet,    "ohBJetL2CorrectedEtaL1FastJet[NohBJetL2CorrectedL1FastJet]/F");
00189     tree->Branch("ohBJetL2CorrectedPhiL1FastJet",    ohBJetL2CorrectedPhiL1FastJet,    "ohBJetL2CorrectedPhiL1FastJet[NohBJetL2CorrectedL1FastJet]/F");
00190     
00191     tree->Branch("NohpfBJetL2",      & NohpfBJetL2,    "NohpfBJetL2/I");
00192     tree->Branch("ohpfBJetL2Energy", ohpfBJetL2Energy, "ohpfBJetL2Energy[NohpfBJetL2]/F");
00193     tree->Branch("ohpfBJetL2Et",     ohpfBJetL2Et,     "ohpfBJetL2Et[NohpfBJetL2]/F");
00194     tree->Branch("ohpfBJetL2Pt",     ohpfBJetL2Pt,     "ohpfBJetL2Pt[NohpfBJetL2]/F");
00195     tree->Branch("ohpfBJetL2Eta",    ohpfBJetL2Eta,    "ohpfBJetL2Eta[NohpfBJetL2]/F");
00196     tree->Branch("ohpfBJetL2Phi",    ohpfBJetL2Phi,    "ohpfBJetL2Phi[NohpfBJetL2]/F");
00197                 
00198     tree->Branch("ohBJetIPL25Tag",          ohBJetIPL25Tag,          "ohBJetIPL25Tag[NohBJetL2Corrected]/F");
00199     tree->Branch("ohBJetIPL3Tag",           ohBJetIPL3Tag,           "ohBJetIPL3Tag[NohBJetL2Corrected]/F");
00200     tree->Branch("ohBJetIPL25TagL1FastJet", ohBJetIPL25TagL1FastJet, "ohBJetIPL25TagL1FastJet[NohBJetL2CorrectedL1FastJet]/F");
00201     tree->Branch("ohBJetIPL3TagL1FastJet",  ohBJetIPL3TagL1FastJet,  "ohBJetIPL3TagL1FastJet[NohBJetL2CorrectedL1FastJet]/F");
00202     tree->Branch("ohpfBJetIPL3Tag",         ohpfBJetIPL3Tag,         "ohpfBJetIPL3Tag[NohpfBJetL2]/F");
00203 
00204     tree->Branch("ohBJetIPL25TagSingleTrack", ohBJetIPL25TagSingleTrack,      "ohBJetIPL25TagSingleTrack[NohBJetL2Corrected]/F");
00205     tree->Branch("ohBJetIPL3TagSingleTrack",  ohBJetIPL3TagSingleTrack,       "ohBJetIPL3TagSingleTrack[NohBJetL2Corrected]/F");
00206     tree->Branch("ohBJetIPL25TagSingleTrackL1FastJet", ohBJetIPL25TagSingleTrackL1FastJet,      "ohBJetIPL25TagSingleTrackL1FastJet[NohBJetL2CorrectedL1FastJet]/F");
00207     tree->Branch("ohBJetIPL3TagSingleTrackL1FastJet",  ohBJetIPL3TagSingleTrackL1FastJet,       "ohBJetIPL3TagSingleTrackL1FastJet[NohBJetL2CorrectedL1FastJet]/F");
00208 
00209     tree->Branch("ohBJetPerfL25Tag",        ohBJetPerfL25Tag,        "ohBJetPerfL25Tag[NohBJetL2Corrected]/I");
00210     tree->Branch("ohBJetPerfL3Tag",         ohBJetPerfL3Tag,         "ohBJetPerfL3Tag[NohBJetL2Corrected]/I");
00211     tree->Branch("ohBJetPerfL25TagL1FastJet", ohBJetPerfL25TagL1FastJet, "ohBJetPerfL25TagL1FastJet[NohBJetL2CorrectedL1FastJet]/I");
00212     tree->Branch("ohBJetPerfL3TagL1FastJet",  ohBJetPerfL3TagL1FastJet,  "ohBJetPerfL3TagL1FastJet[NohBJetL2CorrectedL1FastJet]/I");
00213   }
00214 }
00215 
00216 void HLTBJet::analyze(
00217         const edm::Handle<edm::View<reco::Jet> >  & rawBJets,
00218         const edm::Handle<edm::View<reco::Jet> >  & correctedBJets,
00219         const edm::Handle<edm::View<reco::Jet> >  & correctedBJetsL1FastJet,
00220         const edm::Handle<edm::View<reco::Jet> >  & pfBJets,
00221         const edm::Handle<reco::JetTagCollection> & lifetimeBJetsL25,
00222         const edm::Handle<reco::JetTagCollection> & lifetimeBJetsL3,
00223         const edm::Handle<reco::JetTagCollection> & lifetimeBJetsL25L1FastJet,
00224         const edm::Handle<reco::JetTagCollection> & lifetimeBJetsL3L1FastJet,
00225         const edm::Handle<reco::JetTagCollection> & lifetimePFBJetsL3,
00226         const edm::Handle<reco::JetTagCollection> & lifetimeBJetsL25SingleTrack,
00227         const edm::Handle<reco::JetTagCollection> & lifetimeBJetsL3SingleTrack,
00228         const edm::Handle<reco::JetTagCollection> & lifetimeBJetsL25SingleTrackL1FastJet,
00229         const edm::Handle<reco::JetTagCollection> & lifetimeBJetsL3SingleTrackL1FastJet,
00230         const edm::Handle<reco::JetTagCollection> & performanceBJetsL25,
00231         const edm::Handle<reco::JetTagCollection> & performanceBJetsL3,
00232         const edm::Handle<reco::JetTagCollection> & performanceBJetsL25L1FastJet,
00233         const edm::Handle<reco::JetTagCollection> & performanceBJetsL3L1FastJet,
00234         TTree * tree) 
00235 {
00236   // reset the tree variables
00237   clear();
00238   
00239   // if the required collections are available, fill the corresponding tree branches
00240   if (rawBJets.isValid())
00241     analyseJets(* rawBJets);
00242 
00243   if (correctedBJets.isValid())
00244     analyseCorrectedJets(* correctedBJets);
00245  
00246   if (correctedBJetsL1FastJet.isValid())
00247     analyseCorrectedJetsL1FastJet(* correctedBJetsL1FastJet);
00248  
00249   if (pfBJets.isValid())
00250     analysePFJets(* pfBJets);
00251 
00252   if (correctedBJets.isValid() and lifetimeBJetsL25.isValid() and lifetimeBJetsL3.isValid())
00253     analyseLifetime(* correctedBJets, * lifetimeBJetsL25, * lifetimeBJetsL3);
00254 
00255   if (correctedBJetsL1FastJet.isValid() and lifetimeBJetsL25L1FastJet.isValid() and lifetimeBJetsL3L1FastJet.isValid())
00256     analyseLifetimeL1FastJet(* correctedBJetsL1FastJet, * lifetimeBJetsL25L1FastJet, * lifetimeBJetsL3L1FastJet);
00257 
00258   if (pfBJets.isValid() and lifetimePFBJetsL3.isValid())
00259     analyseLifetimePF(* pfBJets, * lifetimePFBJetsL3);
00260 
00261   if (correctedBJets.isValid() and lifetimeBJetsL25SingleTrack.isValid() and lifetimeBJetsL3SingleTrack.isValid())
00262     analyseLifetimeSingleTrack(* correctedBJets, * lifetimeBJetsL25SingleTrack, * lifetimeBJetsL3SingleTrack);
00263 
00264   if (correctedBJetsL1FastJet.isValid() and lifetimeBJetsL25SingleTrackL1FastJet.isValid() and lifetimeBJetsL3SingleTrackL1FastJet.isValid())
00265     analyseLifetimeSingleTrackL1FastJet(* correctedBJetsL1FastJet, * lifetimeBJetsL25SingleTrackL1FastJet, * lifetimeBJetsL3SingleTrackL1FastJet);
00266 
00267   if (correctedBJets.isValid() and performanceBJetsL25.isValid() and performanceBJetsL3.isValid())
00268     analysePerformance(* correctedBJets, * performanceBJetsL25, * performanceBJetsL3);
00269 
00270   if (correctedBJetsL1FastJet.isValid() and performanceBJetsL25L1FastJet.isValid() and performanceBJetsL3L1FastJet.isValid())
00271     analysePerformanceL1FastJet(* correctedBJetsL1FastJet, * performanceBJetsL25L1FastJet, * performanceBJetsL3L1FastJet);
00272 
00273 }
00274 
00275 void HLTBJet::analyseJets(const edm::View<reco::Jet> & jets)
00276 {
00277   // the jets need to be persistable, so .size() returns an 'unsigned int' to be stable across the architectures
00278   // so, for the comparison, we cast back to size_t
00279   size_t size = std::min(kMaxBJets, size_t(jets.size()) ); 
00280   NohBJetL2 = size;
00281   for (size_t i = 0; i < size; ++i) {
00282     ohBJetL2Energy[i] = jets[i].energy();
00283     ohBJetL2Et[i]     = jets[i].et();
00284     ohBJetL2Pt[i]     = jets[i].pt();
00285     ohBJetL2Eta[i]    = jets[i].eta();
00286     ohBJetL2Phi[i]    = jets[i].phi();
00287   }
00288 }
00289 
00290 void HLTBJet::analyseCorrectedJets(const edm::View<reco::Jet> & jets)
00291 {
00292   // the jets need to be persistable, so .size() returns an 'unsigned int' to be stable across the architectures
00293   // so, for the comparison, we cast back to size_t
00294   size_t size = std::min(kMaxBJets, size_t(jets.size()) );
00295   NohBJetL2Corrected = size;
00296   for (size_t i = 0; i < size; ++i) {
00297     ohBJetL2CorrectedEnergy[i] = jets[i].energy();
00298     ohBJetL2CorrectedEt[i]     = jets[i].et();
00299     ohBJetL2CorrectedPt[i]     = jets[i].pt();
00300     ohBJetL2CorrectedEta[i]    = jets[i].eta();
00301     ohBJetL2CorrectedPhi[i]    = jets[i].phi();
00302   }
00303 }
00304 
00305 void HLTBJet::analyseCorrectedJetsL1FastJet(const edm::View<reco::Jet> & jets)
00306 {
00307   // the jets need to be persistable, so .size() returns an 'unsigned int' to be stable across the architectures
00308   // so, for the comparison, we cast back to size_t
00309   size_t size = std::min(kMaxBJets, size_t(jets.size()) );
00310   NohBJetL2CorrectedL1FastJet = size;
00311   for (size_t i = 0; i < size; ++i) {
00312     ohBJetL2CorrectedEnergyL1FastJet[i] = jets[i].energy();
00313     ohBJetL2CorrectedEtL1FastJet[i]     = jets[i].et();
00314     ohBJetL2CorrectedPtL1FastJet[i]     = jets[i].pt();
00315     ohBJetL2CorrectedEtaL1FastJet[i]    = jets[i].eta();
00316     ohBJetL2CorrectedPhiL1FastJet[i]    = jets[i].phi();
00317   }
00318 }
00319 
00320 void HLTBJet::analysePFJets(const edm::View<reco::Jet> & jets)
00321 {
00322   // the jets need to be persistable, so .size() returns an 'unsigned int' to be stable across the architectures
00323   // so, for the comparison, we cast back to size_t
00324   size_t size = std::min(kMaxBJets, size_t(jets.size()) ); 
00325   NohpfBJetL2 = size;
00326   for (size_t i = 0; i < size; ++i) {
00327     ohpfBJetL2Energy[i] = jets[i].energy();
00328     ohpfBJetL2Et[i]     = jets[i].et();
00329     ohpfBJetL2Pt[i]     = jets[i].pt();
00330     ohpfBJetL2Eta[i]    = jets[i].eta();
00331     ohpfBJetL2Phi[i]    = jets[i].phi();
00332   }
00333 }
00334 
00335 void HLTBJet::analyseLifetime(
00336     const edm::View<reco::Jet>   & jets, 
00337     const reco::JetTagCollection & tagsL25, 
00338     const reco::JetTagCollection & tagsL3)
00339 {
00340   if (tagsL25.size() != jets.size()) {
00341     edm::LogWarning("OpenHLT") << kBTagLifetimeBJetsL25 << " collection has " << tagsL25.size() << " elements, but " << jets.size() << " where expected from L2" << std::endl;
00342     return;
00343   }
00344   if (tagsL3.size() != jets.size()) {
00345     edm::LogWarning("OpenHLT") << kBTagLifetimeBJetsL3 << " collection has " << tagsL3.size() << " elements, but " << jets.size() << " where expected from L2" << std::endl;
00346     return;
00347   }
00348   // the jets need to be persistable, so .size() returns an 'unsigned int' to be stable across the architectures
00349   // so, for the comparison, we cast back to size_t
00350   size_t size = std::min(kMaxBJets, size_t(jets.size()) );
00351   for (size_t i = 0; i < size; i++) {
00352     ohBJetIPL25Tag[i] = tagsL25[i].second;
00353     ohBJetIPL3Tag[i]  = tagsL3[i].second;
00354   }
00355 }
00356 
00357 void HLTBJet::analyseLifetimeL1FastJet(
00358     const edm::View<reco::Jet>   & jets, 
00359     const reco::JetTagCollection & tagsL25, 
00360     const reco::JetTagCollection & tagsL3)
00361 {
00362   if (tagsL25.size() != jets.size()) {
00363     edm::LogWarning("OpenHLT") << kBTagLifetimeBJetsL25L1FastJet << " collection has " << tagsL25.size() << " elements, but " << jets.size() << " where expected from L2" << std::endl;
00364     return;
00365   }
00366   if (tagsL3.size() != jets.size()) {
00367     edm::LogWarning("OpenHLT") << kBTagLifetimeBJetsL3L1FastJet << " collection has " << tagsL3.size() << " elements, but " << jets.size() << " where expected from L2" << std::endl;
00368     return;
00369   }
00370   // the jets need to be persistable, so .size() returns an 'unsigned int' to be stable across the architectures
00371   // so, for the comparison, we cast back to size_t
00372   size_t size = std::min(kMaxBJets, size_t(jets.size()) );
00373   for (size_t i = 0; i < size; i++) {
00374     ohBJetIPL25TagL1FastJet[i] = tagsL25[i].second;
00375     ohBJetIPL3TagL1FastJet[i]  = tagsL3[i].second;
00376   }
00377 }
00378 
00379 void HLTBJet::analyseLifetimePF(
00380     const edm::View<reco::Jet>   & jets, 
00381     const reco::JetTagCollection & tagsL3)
00382 {
00383   if (tagsL3.size() != jets.size()) {
00384     edm::LogWarning("OpenHLT") << kBTagLifetimePFBJetsL3 << " collection has " << tagsL3.size() << " elements, but " << jets.size() << " where expected from L2" << std::endl;
00385     return;
00386   }
00387   // the jets need to be persistable, so .size() returns an 'unsigned int' to be stable across the architectures
00388   // so, for the comparison, we cast back to size_t
00389   size_t size = std::min(kMaxBJets, size_t(jets.size()) );
00390   for (size_t i = 0; i < size; i++) {
00391     ohpfBJetIPL3Tag[i]  = tagsL3[i].second;
00392   }
00393 }
00394 
00395 void HLTBJet::analyseLifetimeSingleTrack(
00396     const edm::View<reco::Jet>   & jets, 
00397     const reco::JetTagCollection & tagsL25, 
00398     const reco::JetTagCollection & tagsL3)
00399 {
00400   if (tagsL25.size() != jets.size()) {
00401     edm::LogWarning("OpenHLT") << kBTagLifetimeBJetsL25SingleTrack << " collection has " << tagsL25.size() << " elements, but " << jets.size() << " where expected from L2" << std::endl;
00402     return;
00403   }
00404   if (tagsL3.size() != jets.size()) {
00405     edm::LogWarning("OpenHLT") << kBTagLifetimeBJetsL3SingleTrack << " collection has " << tagsL3.size() << " elements, but " << jets.size() << " where expected from L2" << std::endl;
00406     return;
00407   }
00408   // the jets need to be persistable, so .size() returns an 'unsigned int' to be stable across the architectures
00409   // so, for the comparison, we cast back to size_t
00410   size_t size = std::min(kMaxBJets, size_t(jets.size()) );
00411   for (size_t i = 0; i < size; i++) {
00412     ohBJetIPL25TagSingleTrack[i] = tagsL25[i].second;
00413     ohBJetIPL3TagSingleTrack[i]  = tagsL3[i].second;
00414   }
00415 }
00416 
00417 void HLTBJet::analyseLifetimeSingleTrackL1FastJet(
00418     const edm::View<reco::Jet>   & jets, 
00419     const reco::JetTagCollection & tagsL25, 
00420     const reco::JetTagCollection & tagsL3)
00421 {
00422   if (tagsL25.size() != jets.size()) {
00423     edm::LogWarning("OpenHLT") << kBTagLifetimeBJetsL25SingleTrackL1FastJet << " collection has " << tagsL25.size() << " elements, but " << jets.size() << " where expected from L2" << std::endl;
00424     return;
00425   }
00426   if (tagsL3.size() != jets.size()) {
00427     edm::LogWarning("OpenHLT") << kBTagLifetimeBJetsL3SingleTrackL1FastJet << " collection has " << tagsL3.size() << " elements, but " << jets.size() << " where expected from L2" << std::endl;
00428     return;
00429   }
00430   // the jets need to be persistable, so .size() returns an 'unsigned int' to be stable across the architectures
00431   // so, for the comparison, we cast back to size_t
00432   size_t size = std::min(kMaxBJets, size_t(jets.size()) );
00433   for (size_t i = 0; i < size; i++) {
00434     ohBJetIPL25TagSingleTrackL1FastJet[i] = tagsL25[i].second;
00435     ohBJetIPL3TagSingleTrackL1FastJet[i]  = tagsL3[i].second;
00436   }
00437 }
00438 
00439 void HLTBJet::analysePerformance(
00440     const edm::View<reco::Jet>   & jets, 
00441     const reco::JetTagCollection & tagsL25, 
00442     const reco::JetTagCollection & tagsL3)
00443 {
00444   if (tagsL25.size() != jets.size()) {
00445     edm::LogWarning("OpenHLT") << kBTagPerformanceBJetsL25 << " collection has " << tagsL25.size() << " elements, but " << jets.size() << " where expected from L2" << std::endl;
00446     return;
00447   }
00448   if (tagsL3.size() != jets.size()) {
00449     edm::LogWarning("OpenHLT") << kBTagPerformanceBJetsL3 << " collection has " << tagsL3.size() << " elements, but " << jets.size() << " where expected from L2" << std::endl;
00450     return;
00451   }
00452   // the jets need to be persistable, so .size() returns an 'unsigned int' to be stable across the architectures
00453   // so, for the comparison, we cast back to size_t
00454   size_t size = std::min(kMaxBJets, size_t(jets.size()) );
00455   for (size_t i = 0; i < size; i++) {
00456     ohBJetPerfL25Tag[i] = (tagsL25[i].second > 0.) ? 1 : 0;
00457     ohBJetPerfL3Tag[i]  = (tagsL3[i].second  > 0.) ? 1 : 0;
00458   }
00459 }
00460 
00461 void HLTBJet::analysePerformanceL1FastJet(
00462     const edm::View<reco::Jet>   & jets, 
00463     const reco::JetTagCollection & tagsL25, 
00464     const reco::JetTagCollection & tagsL3)
00465 {
00466   if (tagsL25.size() != jets.size()) {
00467     edm::LogWarning("OpenHLT") << kBTagPerformanceBJetsL25L1FastJet << " collection has " << tagsL25.size() << " elements, but " << jets.size() << " where expected from L2" << std::endl;
00468     return;
00469   }
00470   if (tagsL3.size() != jets.size()) {
00471     edm::LogWarning("OpenHLT") << kBTagPerformanceBJetsL3L1FastJet << " collection has " << tagsL3.size() << " elements, but " << jets.size() << " where expected from L2" << std::endl;
00472     return;
00473   }
00474   // the jets need to be persistable, so .size() returns an 'unsigned int' to be stable across the architectures
00475   // so, for the comparison, we cast back to size_t
00476   size_t size = std::min(kMaxBJets, size_t(jets.size()) );
00477   for (size_t i = 0; i < size; i++) {
00478      
00479     ohBJetPerfL25TagL1FastJet[i] = (tagsL25[i].second > 0.) ? 1 : 0;
00480     ohBJetPerfL3TagL1FastJet[i]  = (tagsL3[i].second  > 0.) ? 1 : 0;
00481   }
00482 }