CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/HLTrigger/HLTanalyzers/src/HLTAnalyzer.cc

Go to the documentation of this file.
00001 // File: HLTAnalyzer.cc
00002 // Description:  Example of Analysis driver originally from Jeremy Mans, 
00003 // Date:  13-October-2006
00004 
00005 #include <boost/foreach.hpp>
00006 
00007 #include "HLTrigger/HLTanalyzers/interface/HLTAnalyzer.h"
00008 #include "HLTMessages.h"
00009 
00010 typedef std::pair<const char *, const edm::InputTag *> MissingCollectionInfo;
00011 
00012 template <class T>
00013 static inline
00014 bool getCollection(const edm::Event & event, std::vector<MissingCollectionInfo> & missing, edm::Handle<T> & handle, const edm::InputTag & name, const char * description) 
00015 {
00016     event.getByLabel(name, handle);
00017     bool valid = handle.isValid();
00018     if (not valid) {
00019         missing.push_back( std::make_pair(description, & name) );
00020         handle.clear();
00021     }
00022     return valid;
00023 }
00024 
00025 // Boiler-plate constructor definition of an analyzer module:
00026 HLTAnalyzer::HLTAnalyzer(edm::ParameterSet const& conf) {
00027     
00028     // If your module takes parameters, here is where you would define
00029     // their names and types, and access them to initialize internal
00030     // variables. Example as follows:
00031     std::cout << " Beginning HLTAnalyzer Analysis " << std::endl;
00032 
00033     hltjets_          = conf.getParameter<edm::InputTag> ("hltjets");
00034     hltcorjets_       = conf.getParameter<edm::InputTag> ("hltcorjets");    
00035     hltcorL1L2L3jets_ = conf.getParameter<edm::InputTag> ("hltcorL1L2L3jets");    
00036     recjets_          = conf.getParameter<edm::InputTag> ("recjets");
00037     reccorjets_       = conf.getParameter<edm::InputTag> ("reccorjets");
00038     genjets_          = conf.getParameter<edm::InputTag> ("genjets");
00039     recmet_           = conf.getParameter<edm::InputTag> ("recmet");
00040     recoPFMet_        = conf.getParameter<edm::InputTag> ("pfmet"); 
00041     genmet_           = conf.getParameter<edm::InputTag> ("genmet");
00042     ht_               = conf.getParameter<edm::InputTag> ("ht");
00043     recoPFJets_       = conf.getParameter<edm::InputTag> ("recoPFJets"); 
00044     calotowers_       = conf.getParameter<edm::InputTag> ("calotowers");
00045     muon_             = conf.getParameter<edm::InputTag> ("muon");
00046     pfmuon_           = conf.getParameter<edm::InputTag> ("pfmuon");
00047     mctruth_          = conf.getParameter<edm::InputTag> ("mctruth");
00048     genEventInfo_     = conf.getParameter<edm::InputTag> ("genEventInfo");
00049     simhits_          = conf.getParameter<edm::InputTag> ("simhits");
00050     xSection_         = conf.getUntrackedParameter<double> ("xSection",1.);
00051     filterEff_        = conf.getUntrackedParameter<double> ("filterEff",1.);
00052     firstLumi_        = conf.getUntrackedParameter<int> ("firstLumi",0);
00053     lastLumi_         = conf.getUntrackedParameter<int> ("lastLumi",-1);
00054     towerThreshold_   = conf.getParameter<double>("caloTowerThreshold");
00055        
00056     // keep this separate from l1extramc_ as needed by FastSim:
00057     //    This is purposefully done this way to allow FastSim to run with OpenHLT: 
00058     //    The {FastSim+OpenHLT} package runs on the head of HLTrigger/HLTanalyzers 
00059     //    where there is purposefully this duplication because FastSim does the 
00060     //    simulation of muons seperately, and needs the same collection. 
00061     l1extramu_        = conf.getParameter<std::string>   ("l1extramu");
00062     m_l1extramu       = edm::InputTag(l1extramu_, "");
00063     
00064     // read the L1Extra collection name, and add the instance names as needed
00065     l1extramc_        = conf.getParameter<std::string>   ("l1extramc");
00066     m_l1extraemi      = edm::InputTag(l1extramc_, "Isolated");
00067     m_l1extraemn      = edm::InputTag(l1extramc_, "NonIsolated");
00068     m_l1extrajetc     = edm::InputTag(l1extramc_, "Central");
00069     m_l1extrajetf     = edm::InputTag(l1extramc_, "Forward");
00070     m_l1extrataujet   = edm::InputTag(l1extramc_, "Tau");
00071     m_l1extramet      = edm::InputTag(l1extramc_, "MET");
00072     m_l1extramht      = edm::InputTag(l1extramc_, "MHT");
00073     
00074     hltresults_       = conf.getParameter<edm::InputTag> ("hltresults");
00075     gtReadoutRecord_  = conf.getParameter<edm::InputTag> ("l1GtReadoutRecord");
00076     
00077     gctBitCounts_        = edm::InputTag( conf.getParameter<edm::InputTag>("l1GctHFBitCounts").label(), "" );
00078     gctRingSums_         = edm::InputTag( conf.getParameter<edm::InputTag>("l1GctHFRingSums").label(), "" );
00079     
00080     MuCandTag2_          = conf.getParameter<edm::InputTag> ("MuCandTag2");
00081     MuIsolTag2_          = conf.getParameter<edm::InputTag> ("MuIsolTag2");
00082     MuNoVtxCandTag2_     = conf.getParameter<edm::InputTag> ("MuNoVtxCandTag2");
00083     MuCandTag3_          = conf.getParameter<edm::InputTag> ("MuCandTag3");
00084     MuIsolTag3_          = conf.getParameter<edm::InputTag> ("MuIsolTag3");
00085     MuTrkIsolTag3_       = conf.getParameter<edm::InputTag> ("MuTrkIsolTag3");
00086     TrackerMuonTag_      = conf.getParameter<edm::InputTag> ("TrackerMuonTag");
00087     oniaPixelTag_        = conf.getParameter<edm::InputTag> ("OniaPixelTag");
00088     oniaTrackTag_        = conf.getParameter<edm::InputTag> ("OniaTrackTag");
00089     DiMuVtx_             = conf.getParameter<edm::InputTag> ("DiMuVtx");
00090     HLTTau_              = conf.getParameter<edm::InputTag> ("HLTTau");
00091     PFTau_               = conf.getParameter<edm::InputTag> ("HLTPFTau");
00092     PFTauTightCone_      = conf.getParameter<edm::InputTag> ("HLTPFTauTightCone");
00093     _MinPtChargedHadrons = conf.getParameter<double>("minPtChargedHadronsForTaus");
00094     _MinPtGammas         = conf.getParameter<double>("minPtGammassForTaus");
00095 
00096     PFJets_          = conf.getParameter<edm::InputTag> ("HLTPFJet");
00097     
00098     // offline reco tau collection and discriminators
00099     RecoPFTau_                          = conf.getParameter<edm::InputTag> ("RecoPFTau");
00100     RecoPFTauDiscrByTanCOnePercent_     = conf.getParameter<edm::InputTag> ("RecoPFTauDiscrByTanCOnePercent"); 
00101     RecoPFTauDiscrByTanCHalfPercent_    = conf.getParameter<edm::InputTag> ("RecoPFTauDiscrByTanCHalfPercent");  
00102     RecoPFTauDiscrByTanCQuarterPercent_ = conf.getParameter<edm::InputTag> ("RecoPFTauDiscrByTanCQuarterPercent");
00103     RecoPFTauDiscrByTanCTenthPercent_   = conf.getParameter<edm::InputTag> ("RecoPFTauDiscrByTanCTenthPercent");
00104     RecoPFTauDiscrByIso_                = conf.getParameter<edm::InputTag> ("RecoPFTauDiscrByIso");  
00105     RecoPFTauAgainstMuon_               = conf.getParameter<edm::InputTag> ("RecoPFTauAgainstMuon");  
00106     RecoPFTauAgainstElec_               = conf.getParameter<edm::InputTag> ("RecoPFTauAgainstElec");  
00107    
00108     
00109     // btag OpenHLT input collections
00110     m_rawBJets                = conf.getParameter<edm::InputTag>("CommonBJetsL2");
00111     m_correctedBJets          = conf.getParameter<edm::InputTag>("CorrectedBJetsL2");
00112     m_lifetimeBJetsL25        = conf.getParameter<edm::InputTag>("LifetimeBJetsL25");
00113     m_lifetimeBJetsL3         = conf.getParameter<edm::InputTag>("LifetimeBJetsL3");
00114     m_lifetimeBJetsL25SingleTrack = conf.getParameter<edm::InputTag>("LifetimeBJetsL25SingleTrack");
00115     m_lifetimeBJetsL3SingleTrack  = conf.getParameter<edm::InputTag>("LifetimeBJetsL3SingleTrack");
00116     m_performanceBJetsL25     = conf.getParameter<edm::InputTag>("PerformanceBJetsL25");
00117     m_performanceBJetsL3      = conf.getParameter<edm::InputTag>("PerformanceBJetsL3");
00118     
00119     // egamma OpenHLT input collections
00120     Electron_                 = conf.getParameter<edm::InputTag> ("Electron");
00121     Photon_                   = conf.getParameter<edm::InputTag> ("Photon");
00122     CandIso_                  = conf.getParameter<edm::InputTag> ("CandIso");
00123     CandNonIso_               = conf.getParameter<edm::InputTag> ("CandNonIso");
00124     EcalIso_                  = conf.getParameter<edm::InputTag> ("EcalIso");
00125     EcalNonIso_               = conf.getParameter<edm::InputTag> ("EcalNonIso");
00126     HcalIsoPho_               = conf.getParameter<edm::InputTag> ("HcalIsoPho");
00127     HcalNonIsoPho_            = conf.getParameter<edm::InputTag> ("HcalNonIsoPho");
00128     IsoPhoTrackIsol_          = conf.getParameter<edm::InputTag> ("IsoPhoTrackIsol");
00129     NonIsoPhoTrackIsol_       = conf.getParameter<edm::InputTag> ("NonIsoPhoTrackIsol");
00130     IsoElectron_              = conf.getParameter<edm::InputTag> ("IsoElectrons");
00131     NonIsoElectron_           = conf.getParameter<edm::InputTag> ("NonIsoElectrons");
00132     IsoEleHcal_               = conf.getParameter<edm::InputTag> ("HcalIsoEle");
00133     NonIsoEleHcal_            = conf.getParameter<edm::InputTag> ("HcalNonIsoEle");
00134     IsoEleTrackIsol_          = conf.getParameter<edm::InputTag> ("IsoEleTrackIsol");
00135     NonIsoEleTrackIsol_       = conf.getParameter<edm::InputTag> ("NonIsoEleTrackIsol");
00136     L1IsoPixelSeeds_          = conf.getParameter<edm::InputTag> ("PixelSeedL1Iso");
00137     L1NonIsoPixelSeeds_       = conf.getParameter<edm::InputTag> ("PixelSeedL1NonIso");
00138     IsoR9_                    = conf.getParameter<edm::InputTag> ("SpikeCleaningIsol");  
00139     NonIsoR9_                 = conf.getParameter<edm::InputTag> ("SpikeCleaningNonIsol");   
00140     IsoHoverEH_               = conf.getParameter<edm::InputTag> ("HcalForHoverEIsol");
00141     NonIsoHoverEH_            = conf.getParameter<edm::InputTag> ("HcalForHoverENonIsol"); 
00142     IsoR9ID_                  = conf.getParameter<edm::InputTag> ("R9IDIsol");
00143     NonIsoR9ID_               = conf.getParameter<edm::InputTag> ("R9IDNonIsol");
00144     HFECALClusters_           = conf.getParameter<edm::InputTag> ("HFECALClusters"); 
00145     HFElectrons_              = conf.getParameter<edm::InputTag> ("HFElectrons"); 
00146 
00147    // Add ECAL Activity
00148    ECALActivity_                    = conf.getParameter<edm::InputTag> ("ECALActivity");
00149    ActivityEcalIso_                 = conf.getParameter<edm::InputTag> ("ActivityEcalIso");
00150    ActivityHcalIso_                 = conf.getParameter<edm::InputTag> ("ActivityHcalIso");
00151    ActivityTrackIso_                = conf.getParameter<edm::InputTag> ("ActivityTrackIso");
00152    ActivityR9_                    = conf.getParameter<edm::InputTag> ("ActivityR9"); // spike cleaning
00153    ActivityR9ID_                    = conf.getParameter<edm::InputTag> ("ActivityR9ID");
00154    ActivityHoverEH_           = conf.getParameter<edm::InputTag> ("ActivityHcalForHoverE");
00155 
00156 
00157    // AlCa OpenHLT input collections  
00158    /*
00159     EERecHitTag_              = conf.getParameter<edm::InputTag> ("EERecHits"); 
00160     EBRecHitTag_              = conf.getParameter<edm::InputTag> ("EBRecHits"); 
00161     pi0EBRecHitTag_           = conf.getParameter<edm::InputTag> ("pi0EBRecHits");  
00162     pi0EERecHitTag_           = conf.getParameter<edm::InputTag> ("pi0EERecHits");  
00163     HBHERecHitTag_            = conf.getParameter<edm::InputTag> ("HBHERecHits");  
00164     HORecHitTag_              = conf.getParameter<edm::InputTag> ("HORecHits");  
00165     HFRecHitTag_              = conf.getParameter<edm::InputTag> ("HFRecHits");  
00166     IsoPixelTrackTagL3_       = conf.getParameter<edm::InputTag> ("IsoPixelTracksL3"); 
00167     IsoPixelTrackTagL2_       = conf.getParameter<edm::InputTag> ("IsoPixelTracksL2");
00168     IsoPixelTrackVerticesTag_       = conf.getParameter<edm::InputTag> ("IsoPixelTrackVertices");
00169    */
00170  
00171    // Track OpenHLT input collections
00172    PixelTracksTagL3_         = conf.getParameter<edm::InputTag> ("PixelTracksL3"); 
00173    PixelFEDSizeTag_          = conf.getParameter<edm::InputTag> ("PixelFEDSize");
00174    PixelClustersTag_         = conf.getParameter<edm::InputTag> ("PixelClusters");
00175 
00176     // Reco Vertex collection
00177     VertexTagHLT_                = conf.getParameter<edm::InputTag> ("PrimaryVertices");  
00178     VertexTagOffline0_           = conf.getParameter<edm::InputTag> ("OfflinePrimaryVertices0");
00179 
00180     m_file = 0;   // set to null
00181     errCnt = 0;
00182     
00183     // read run parameters with a default value 
00184     edm::ParameterSet runParameters = conf.getParameter<edm::ParameterSet>("RunParameters");
00185     _HistName = runParameters.getUntrackedParameter<std::string>("HistogramFile", "test.root");
00186     _EtaMin   = runParameters.getUntrackedParameter<double>("EtaMin", -5.2);
00187     _EtaMax   = runParameters.getUntrackedParameter<double>("EtaMax",  5.2);
00188     
00189     
00190     
00191     // open the tree file
00192     m_file = new TFile(_HistName.c_str(), "RECREATE");
00193     if (m_file)
00194         m_file->cd();
00195     
00196     // Initialize the tree
00197     HltTree = new TTree("HltTree", "");
00198     
00199     treeWeight=xSection_*filterEff_;
00200     std::cout << "\n Setting HltTree weight to " << treeWeight << " = " << xSection_ << "*" << filterEff_ << " (cross section * gen filter efficiency)\n" << std::endl;
00201     
00202     // Setup the different analysis
00203     jet_analysis_.setup(conf, HltTree);
00204     bjet_analysis_.setup(conf, HltTree);
00205     elm_analysis_.setup(conf, HltTree);
00206     muon_analysis_.setup(conf, HltTree);
00207     track_analysis_.setup(conf, HltTree);
00208     mct_analysis_.setup(conf, HltTree);
00209     hlt_analysis_.setup(conf, HltTree);
00210     vrt_analysisHLT_.setup(conf, HltTree, "HLT");
00211     vrt_analysisOffline0_.setup(conf, HltTree, "Offline0");
00212     evt_header_.setup(HltTree);
00213 }
00214 
00215 void HLTAnalyzer::beginRun(const edm::Run& run, const edm::EventSetup& c){ 
00216     
00217     hlt_analysis_.beginRun(run, c);
00218 }
00219 
00220 // Boiler-plate "analyze" method declaration for an analyzer module.
00221 void HLTAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) {
00222     
00223     // To get information from the event setup, you must request the "Record"
00224     // which contains it and then extract the object you need
00225     //edm::ESHandle<CaloGeometry> geometry;
00226     //iSetup.get<IdealGeometryRecord>().get(geometry);
00227     
00228     int iLumi = iEvent.luminosityBlock();
00229     if (iLumi<firstLumi_) return;
00230     if (lastLumi_ != -1 && iLumi>lastLumi_) return;
00231     
00232     // These declarations create handles to the types of records that you want
00233     // to retrieve from event "iEvent".
00234     edm::Handle<reco::CaloJetCollection>              hltjets;
00235     edm::Handle<reco::CaloJetCollection>              hltcorjets;
00236     edm::Handle<reco::CaloJetCollection>              hltcorL1L2L3jets;
00237     edm::Handle<reco::CaloJetCollection>              recjets;
00238     edm::Handle<reco::CaloJetCollection>              reccorjets;
00239     edm::Handle<reco::GenJetCollection>               genjets;
00240     edm::Handle<CaloTowerCollection>                  caloTowers;
00241     edm::Handle<reco::CaloMETCollection>              recmet;
00242     edm::Handle<reco::PFMETCollection>                recoPFMet;
00243     edm::Handle<reco::GenMETCollection>               genmet;
00244     edm::Handle<reco::METCollection>                  ht;
00245     edm::Handle<reco::PFJetCollection>                recoPFJets; 
00246     edm::Handle<reco::CandidateView>                  mctruth;
00247     edm::Handle<GenEventInfoProduct>                  genEventInfo;
00248     edm::Handle<std::vector<SimTrack> >               simTracks;
00249     edm::Handle<std::vector<SimVertex> >              simVertices;
00250     edm::Handle<reco::MuonCollection>                 muon;
00251     edm::Handle<reco::PFCandidateCollection>          pfmuon;
00252     edm::Handle<edm::TriggerResults>                  hltresults;
00253     edm::Handle<l1extra::L1EmParticleCollection>      l1extemi, l1extemn;
00254     edm::Handle<l1extra::L1MuonParticleCollection>    l1extmu;
00255     edm::Handle<l1extra::L1JetParticleCollection>     l1extjetc, l1extjetf, l1exttaujet;
00256     edm::Handle<l1extra::L1EtMissParticleCollection>  l1extmet,l1extmht;
00257     edm::Handle<L1GlobalTriggerReadoutRecord>         l1GtRR;
00258     edm::Handle< L1GctHFBitCountsCollection >         gctBitCounts ;
00259     edm::Handle< L1GctHFRingEtSumsCollection >        gctRingSums ;
00260     
00261     edm::Handle<reco::RecoChargedCandidateCollection> mucands2, mucands3, munovtxcands2;
00262     edm::Handle<reco::RecoChargedCandidateCollection> oniaPixelCands, oniaTrackCands;
00263     edm::Handle<reco::VertexCollection>               dimuvtxcands3;
00264     edm::Handle<reco::MuonCollection>                 trkmucands;
00265     edm::Handle<edm::ValueMap<bool> >                 isoMap2,  isoMap3, isoTrk10Map3;
00266     edm::Handle<reco::HLTTauCollection>               taus;
00267     edm::Handle<reco::PFTauCollection>                pftaus;
00268     edm::Handle<reco::PFTauCollection>                pftausTightCone;
00269     edm::Handle<reco::PFJetCollection>                pfjets;
00270     
00271     // offline reco tau collection and discriminators
00272     edm::Handle<reco::PFTauCollection>  recoPftaus;
00273     edm::Handle<reco::PFTauDiscriminator> theRecoPFTauDiscrByTanCOnePercent;
00274     edm::Handle<reco::PFTauDiscriminator> theRecoPFTauDiscrByTanCHalfPercent; 
00275     edm::Handle<reco::PFTauDiscriminator> theRecoPFTauDiscrByTanCQuarterPercent;
00276     edm::Handle<reco::PFTauDiscriminator> theRecoPFTauDiscrByTanCTenthPercent;
00277     edm::Handle<reco::PFTauDiscriminator> theRecoPFTauDiscrByIsolation;
00278     edm::Handle<reco::PFTauDiscriminator> theRecoPFTauDiscrAgainstMuon;
00279     edm::Handle<reco::PFTauDiscriminator> theRecoPFTauDiscrAgainstElec;
00280    
00281     
00282     // btag OpenHLT input collections
00283     edm::Handle<edm::View<reco::Jet> >                hRawBJets;
00284     edm::Handle<edm::View<reco::Jet> >                hCorrectedBJets;
00285     edm::Handle<reco::JetTagCollection>               hLifetimeBJetsL25;
00286     edm::Handle<reco::JetTagCollection>               hLifetimeBJetsL3;
00287     edm::Handle<reco::JetTagCollection>               hLifetimeBJetsL25SingleTrack;
00288     edm::Handle<reco::JetTagCollection>               hLifetimeBJetsL3SingleTrack;
00289     edm::Handle<reco::JetTagCollection>               hPerformanceBJetsL25;
00290     edm::Handle<reco::JetTagCollection>               hPerformanceBJetsL3;
00291     
00292     // egamma OpenHLT input collections
00293     edm::Handle<reco::GsfElectronCollection>          electrons;
00294     edm::Handle<reco::PhotonCollection>               photons;
00295     edm::Handle<reco::RecoEcalCandidateIsolationMap>    photonR9IsoHandle; 
00296     edm::Handle<reco::RecoEcalCandidateIsolationMap>    photonR9NonIsoHandle;
00297     edm::Handle<reco::RecoEcalCandidateIsolationMap>    photonR9IDIsoHandle;
00298     edm::Handle<reco::RecoEcalCandidateIsolationMap>    photonR9IDNonIsoHandle;
00299     edm::Handle<reco::RecoEcalCandidateIsolationMap>  photonHoverEHIsoHandle;   
00300     edm::Handle<reco::RecoEcalCandidateIsolationMap>  photonHoverEHNonIsoHandle;    
00301     edm::Handle<reco::ElectronCollection>             electronIsoHandle;
00302     edm::Handle<reco::ElectronCollection>             electronNonIsoHandle;
00303     edm::Handle<reco::RecoEcalCandidateIsolationMap>    electronR9IsoHandle; 
00304     edm::Handle<reco::RecoEcalCandidateIsolationMap>    electronR9NonIsoHandle;  
00305     edm::Handle<reco::RecoEcalCandidateIsolationMap>    electronR9IDIsoHandle;
00306     edm::Handle<reco::RecoEcalCandidateIsolationMap>    electronR9IDNonIsoHandle;
00307     edm::Handle<reco::ElectronIsolationMap>           NonIsoTrackEleIsolMap;
00308     edm::Handle<reco::ElectronIsolationMap>           TrackEleIsolMap;
00309     edm::Handle<reco::ElectronSeedCollection>         L1IsoPixelSeedsMap;
00310     edm::Handle<reco::ElectronSeedCollection>         L1NonIsoPixelSeedsMap;
00311     edm::Handle<reco::RecoEcalCandidateCollection>    recoIsolecalcands;
00312     edm::Handle<reco::RecoEcalCandidateCollection>    recoNonIsolecalcands;
00313     edm::Handle<reco::RecoEcalCandidateIsolationMap>  EcalIsolMap;
00314     edm::Handle<reco::RecoEcalCandidateIsolationMap>  EcalNonIsolMap;
00315     edm::Handle<reco::RecoEcalCandidateIsolationMap>  HcalEleIsolMap;
00316     edm::Handle<reco::RecoEcalCandidateIsolationMap>  HcalEleNonIsolMap;
00317     edm::Handle<reco::RecoEcalCandidateIsolationMap>  HcalIsolMap;
00318     edm::Handle<reco::RecoEcalCandidateIsolationMap>  HcalNonIsolMap;
00319     edm::Handle<reco::RecoEcalCandidateIsolationMap>  TrackIsolMap;
00320     edm::Handle<reco::RecoEcalCandidateIsolationMap>  TrackNonIsolMap;
00321     edm::Handle<reco::SuperClusterCollection>         electronHFClusterHandle; 
00322     edm::Handle<reco::RecoEcalCandidateCollection>    electronHFElectronHandle;  
00323     // ECAL Activity
00324     edm::Handle<reco::RecoEcalCandidateCollection>    ActivityCandsHandle;  
00325     edm::Handle<reco::RecoEcalCandidateIsolationMap>  ActivityEcalIsoHandle;
00326     edm::Handle<reco::RecoEcalCandidateIsolationMap>  ActivityHcalIsoHandle;
00327     edm::Handle<reco::RecoEcalCandidateIsolationMap>  ActivityTrackIsoHandle;
00328     edm::Handle<reco::RecoEcalCandidateIsolationMap>  ActivityR9Handle;
00329     edm::Handle<reco::RecoEcalCandidateIsolationMap>  ActivityR9IDHandle;
00330     edm::Handle<reco::RecoEcalCandidateIsolationMap>  ActivityHoverEHHandle;
00331  
00332     
00333     // AlCa OpenHLT input collections   
00334     /*
00335     edm::Handle<EBRecHitCollection>             ebrechits;  
00336     edm::Handle<EERecHitCollection>             eerechits;   
00337     edm::Handle<EBRecHitCollection>             pi0ebrechits;   
00338     edm::Handle<EERecHitCollection>             pi0eerechits;    
00339     edm::Handle<HBHERecHitCollection>           hbherechits;   
00340     edm::Handle<HORecHitCollection>             horechits;   
00341     edm::Handle<HFRecHitCollection>             hfrechits;   
00342     */
00343 
00344     edm::Handle<reco::IsolatedPixelTrackCandidateCollection> isopixeltracksL3; 
00345     edm::Handle<reco::IsolatedPixelTrackCandidateCollection> isopixeltracksL2;  
00346     edm::Handle<reco::VertexCollection>         isopixeltrackPixVertices;
00347     edm::Handle<reco::RecoChargedCandidateCollection> pixeltracksL3; 
00348     edm::Handle<FEDRawDataCollection> pixelfedsize;
00349     edm::Handle<edmNew::DetSetVector<SiPixelCluster> > pixelclusters;
00350     
00351     // Reco vertex collection
00352     edm::Handle<reco::VertexCollection> recoVertexsHLT;
00353     edm::Handle<reco::VertexCollection> recoVertexsOffline0;
00354 
00355     // new stuff for the egamma EleId
00356     edm::InputTag ecalRechitEBTag (std::string("hltEcalRegionalEgammaRecHit:EcalRecHitsEB"));
00357     edm::InputTag ecalRechitEETag (std::string("hltEcalRegionalEgammaRecHit:EcalRecHitsEE"));
00358     EcalClusterLazyTools lazyTools( iEvent, iSetup, ecalRechitEBTag, ecalRechitEETag);
00359     
00360     edm::Handle<reco::HFEMClusterShapeAssociationCollection> electronHFClusterAssociation;   
00361     iEvent.getByLabel(edm::InputTag("hltHFEMClusters"),electronHFClusterAssociation);
00362 
00363     edm::ESHandle<MagneticField>                theMagField;
00364     iSetup.get<IdealMagneticFieldRecord>().get(theMagField);
00365     
00366     edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
00367     edm::InputTag BSProducer_(std::string("hltOnlineBeamSpot"));
00368     
00369     // get EventSetup stuff needed for the AlCa pi0 path
00370     edm::ESHandle< EcalElectronicsMapping > ecalmapping;
00371     iSetup.get< EcalMappingRcd >().get(ecalmapping);
00372     
00373     edm::ESHandle<CaloGeometry> geoHandle;
00374     iSetup.get<CaloGeometryRecord>().get(geoHandle); 
00375     
00376     edm::ESHandle<CaloTopology> pTopology;
00377     iSetup.get<CaloTopologyRecord>().get(pTopology);
00378     
00379     edm::ESHandle<L1CaloGeometry> l1CaloGeom ;
00380     iSetup.get<L1CaloGeometryRecord>().get(l1CaloGeom) ;
00381     
00382     
00383     // extract the collections from the event, check their validity and log which are missing
00384     std::vector<MissingCollectionInfo> missing;
00385     
00386     //get the BeamSpot
00387     getCollection( iEvent, missing, recoBeamSpotHandle,       BSProducer_ ,          "Beam Spot handle");
00388     // gets its position
00389     reco::BeamSpot::Point BSPosition(0,0,0);
00390     BSPosition = recoBeamSpotHandle->position();
00391     
00392     getCollection( iEvent, missing, hltjets,         hltjets_,           kHLTjets );
00393     getCollection( iEvent, missing, hltcorjets,      hltcorjets_,        kHLTCorjets );
00394     getCollection( iEvent, missing, hltcorL1L2L3jets,hltcorL1L2L3jets_,  kHLTCorL1L2L3jets );
00395     getCollection( iEvent, missing, recjets,         recjets_,           kRecjets );
00396     getCollection( iEvent, missing, reccorjets,      reccorjets_,        kRecCorjets );
00397     getCollection( iEvent, missing, genjets,         genjets_,           kGenjets );
00398     getCollection( iEvent, missing, recmet,          recmet_,            kRecmet );
00399     getCollection( iEvent, missing, recoPFMet,       recoPFMet_,         kPFMet );
00400     getCollection( iEvent, missing, genmet,          genmet_,            kGenmet );
00401     getCollection( iEvent, missing, caloTowers,      calotowers_,        kCaloTowers );
00402     getCollection( iEvent, missing, ht,              ht_,                kHt );
00403     getCollection( iEvent, missing, recoPFJets,      recoPFJets_,        kRecoPFJets );   
00404     getCollection( iEvent, missing, muon,            muon_,              kMuon );
00405     getCollection( iEvent, missing, pfmuon,          pfmuon_,            kpfMuon );
00406     getCollection( iEvent, missing, taus,            HLTTau_,            kTaus );
00407     getCollection( iEvent, missing, pftaus,          PFTau_,             kPFTaus );
00408     getCollection( iEvent, missing, pftausTightCone, PFTauTightCone_,    kPFTausTightCone );
00409     getCollection( iEvent, missing, pfjets,          PFJets_,            kPFJets );  
00410     getCollection( iEvent, missing, recoPftaus,                            RecoPFTau_,                          kRecoPFTaus );
00411     getCollection( iEvent, missing, theRecoPFTauDiscrByTanCOnePercent,     RecoPFTauDiscrByTanCOnePercent_,     ktheRecoPFTauDiscrByTanCOnePercent); 
00412     getCollection( iEvent, missing, theRecoPFTauDiscrByTanCHalfPercent,    RecoPFTauDiscrByTanCHalfPercent_,    ktheRecoPFTauDiscrByTanCHalfPercent); 
00413     getCollection( iEvent, missing, theRecoPFTauDiscrByTanCQuarterPercent, RecoPFTauDiscrByTanCQuarterPercent_, ktheRecoPFTauDiscrByTanCQuarterPercent); 
00414     getCollection( iEvent, missing, theRecoPFTauDiscrByTanCTenthPercent,   RecoPFTauDiscrByTanCTenthPercent_,   ktheRecoPFTauDiscrByTanCTenthPercent);     
00415     getCollection( iEvent, missing, theRecoPFTauDiscrByIsolation,          RecoPFTauDiscrByIso_,                ktheRecoPFTauDiscrByIsolation); 
00416     getCollection( iEvent, missing, theRecoPFTauDiscrAgainstMuon,          RecoPFTauAgainstMuon_,               ktheRecoPFTauDiscrAgainstMuon); 
00417     getCollection( iEvent, missing, theRecoPFTauDiscrAgainstElec,          RecoPFTauAgainstElec_,               ktheRecoPFTauDiscrAgainstElec); 
00418     getCollection( iEvent, missing, hltresults,      hltresults_,        kHltresults );
00419     getCollection( iEvent, missing, l1extemi,        m_l1extraemi,       kL1extemi );
00420     getCollection( iEvent, missing, l1extemn,        m_l1extraemn,       kL1extemn );
00421     getCollection( iEvent, missing, l1extmu,         m_l1extramu,        kL1extmu );
00422     getCollection( iEvent, missing, l1extjetc,       m_l1extrajetc,      kL1extjetc );
00423     getCollection( iEvent, missing, l1extjetf,       m_l1extrajetf,      kL1extjetf );
00424     getCollection( iEvent, missing, l1exttaujet,     m_l1extrataujet,    kL1exttaujet );
00425     getCollection( iEvent, missing, l1extmet,        m_l1extramet,       kL1extmet );
00426     getCollection( iEvent, missing, l1extmht,        m_l1extramht,       kL1extmht );
00427     getCollection( iEvent, missing, l1GtRR,          gtReadoutRecord_,   kL1GtRR );
00428     getCollection( iEvent, missing, gctBitCounts,     gctBitCounts_,      kL1GctBitCounts );
00429     getCollection( iEvent, missing, gctRingSums,      gctRingSums_,       kL1GctRingSums );
00430     getCollection( iEvent, missing, mctruth,         mctruth_,           kMctruth );
00431     getCollection( iEvent, missing, simTracks,       simhits_,           kSimhit );
00432     getCollection( iEvent, missing, simVertices,     simhits_,           kSimhit );
00433     getCollection( iEvent, missing, genEventInfo,    genEventInfo_,      kGenEventInfo );
00434     getCollection( iEvent, missing, mucands2,        MuCandTag2_,        kMucands2 );
00435     getCollection( iEvent, missing, munovtxcands2,   MuNoVtxCandTag2_,   kMunovtxcands2 ); 
00436     getCollection( iEvent, missing, mucands3,        MuCandTag3_,        kMucands3 );
00437     getCollection( iEvent, missing, oniaPixelCands,  oniaPixelTag_,      kOniaPixelCands );
00438     getCollection( iEvent, missing, oniaTrackCands,  oniaTrackTag_,      kOniaTrackCands );
00439     getCollection( iEvent, missing, trkmucands,      TrackerMuonTag_,    kTrkMucands );
00440     getCollection( iEvent, missing, dimuvtxcands3,   DiMuVtx_,           kDimuvtxcands3 );
00441     getCollection( iEvent, missing, isoMap2,         MuIsolTag2_,        kIsoMap2 );
00442     getCollection( iEvent, missing, isoMap3,         MuIsolTag3_,        kIsoMap3 );
00443     getCollection( iEvent, missing, isoTrk10Map3,    MuTrkIsolTag3_,     kIsoTrk10Map3 ); 
00444     getCollection( iEvent, missing, hRawBJets,                m_rawBJets,                 kBTagJets );
00445     getCollection( iEvent, missing, hCorrectedBJets,          m_correctedBJets,           kBTagCorrectedJets );
00446     getCollection( iEvent, missing, hLifetimeBJetsL25,        m_lifetimeBJetsL25,         kBTagLifetimeBJetsL25 );
00447     getCollection( iEvent, missing, hLifetimeBJetsL3,         m_lifetimeBJetsL3,          kBTagLifetimeBJetsL3 );
00448     getCollection( iEvent, missing, hLifetimeBJetsL25SingleTrack,        m_lifetimeBJetsL25SingleTrack,         kBTagLifetimeBJetsL25SingleTrack );
00449     getCollection( iEvent, missing, hLifetimeBJetsL3SingleTrack,         m_lifetimeBJetsL3SingleTrack,          kBTagLifetimeBJetsL3SingleTrack );
00450     getCollection( iEvent, missing, hPerformanceBJetsL25,     m_performanceBJetsL25,      kBTagPerformanceBJetsL25 );
00451     getCollection( iEvent, missing, hPerformanceBJetsL3,      m_performanceBJetsL3,       kBTagPerformanceBJetsL3 );
00452     getCollection( iEvent, missing, electrons,                Electron_,                  kElectrons );
00453     getCollection( iEvent, missing, photons,                  Photon_,                    kPhotons );
00454     getCollection( iEvent, missing, ActivityCandsHandle, ECALActivity_,                    kECALActivity);       
00455     getCollection( iEvent, missing, ActivityEcalIsoHandle, ActivityEcalIso_,               kECALActivityEcalIso); 
00456     getCollection( iEvent, missing, ActivityHcalIsoHandle, ActivityHcalIso_,               kECALActivityHcalIso); 
00457     getCollection( iEvent, missing, ActivityTrackIsoHandle, ActivityTrackIso_,             kECALActivityTrackIso); 
00458     getCollection( iEvent, missing, ActivityR9Handle, ActivityR9_,                     kECALActivityR9); 
00459     getCollection( iEvent, missing, ActivityR9IDHandle, ActivityR9ID_,                     kECALActivityR9ID); 
00460     getCollection( iEvent, missing, ActivityHoverEHHandle, ActivityHoverEH_,               kECALActivityHoverEH);
00461     
00462     //Read offline eleID results
00463     std::vector<edm::Handle<edm::ValueMap<float> > > eIDValueMap(4); 
00464     //   edm::InputTag electronLabelRobustTight_(std::string("eidRobustTight"));
00465     //   edm::InputTag electronLabelTight_(std::string("eidTight"));
00466     //   edm::InputTag electronLabelRobustLoose_(std::string("eidRobustLoose"));
00467     //   edm::InputTag electronLabelLoose_(std::string("eidLoose"));
00468     //   getCollection( iEvent, missing, eIDValueMap[0],   electronLabelRobustLoose_      ,       "EleId Robust-Loose");
00469     //   getCollection( iEvent, missing, eIDValueMap[1],   electronLabelRobustTight_      ,       "EleId Robust-Tight");
00470     //   getCollection( iEvent, missing, eIDValueMap[2],   electronLabelLoose_      ,       "EleId Loose");
00471     //   getCollection( iEvent, missing, eIDValueMap[3],   electronLabelTight_      ,       "EleId Tight");
00472     
00473     //read all the OpenHLT egamma collections
00474     getCollection( iEvent, missing, recoIsolecalcands,        CandIso_,                   kCandIso);
00475     getCollection( iEvent, missing, recoNonIsolecalcands,     CandNonIso_,                kCandNonIso);
00476     getCollection( iEvent, missing, EcalIsolMap,              EcalIso_,                   kEcalIso);
00477     getCollection( iEvent, missing, EcalNonIsolMap,           EcalNonIso_,                kEcalNonIso);
00478     getCollection( iEvent, missing, HcalIsolMap,              HcalIsoPho_,                kHcalIsoPho);
00479     getCollection( iEvent, missing, HcalNonIsolMap,           HcalNonIsoPho_,             kHcalNonIsoPho);
00480     getCollection( iEvent, missing, photonR9IsoHandle,        IsoR9_,                     kIsoR9); 
00481     getCollection( iEvent, missing, photonR9NonIsoHandle,     NonIsoR9_,                  kNonIsoR9);  
00482     getCollection( iEvent, missing, photonR9IDIsoHandle,      IsoR9ID_,                   kIsoR9ID);
00483     getCollection( iEvent, missing, photonR9IDNonIsoHandle,   NonIsoR9ID_,                kNonIsoR9ID);
00484     getCollection( iEvent, missing, photonHoverEHIsoHandle,   IsoHoverEH_,                kIsoHoverEH);    
00485     getCollection( iEvent, missing, photonHoverEHNonIsoHandle,NonIsoHoverEH_,             kNonIsoHoverEH);   
00486     getCollection( iEvent, missing, electronIsoHandle,        IsoElectron_,               kIsoElectron);
00487     getCollection( iEvent, missing, HcalEleIsolMap,           IsoEleHcal_,                kIsoEleHcal);
00488     getCollection( iEvent, missing, TrackEleIsolMap,          IsoEleTrackIsol_,           kIsoEleTrackIsol);
00489     getCollection( iEvent, missing, L1IsoPixelSeedsMap,       L1IsoPixelSeeds_,           kL1IsoPixelSeeds);
00490     getCollection( iEvent, missing, L1NonIsoPixelSeedsMap,    L1NonIsoPixelSeeds_,        kL1NonIsoPixelSeeds);
00491     getCollection( iEvent, missing, electronNonIsoHandle,     NonIsoElectron_,            kNonIsoElectron);
00492     getCollection( iEvent, missing, HcalEleNonIsolMap,        NonIsoEleHcal_,             kIsoEleHcal);
00493     getCollection( iEvent, missing, NonIsoTrackEleIsolMap,    NonIsoEleTrackIsol_,        kNonIsoEleTrackIsol);
00494     getCollection( iEvent, missing, TrackNonIsolMap,          NonIsoPhoTrackIsol_,        kNonIsoPhoTrackIsol);
00495     getCollection( iEvent, missing, TrackIsolMap,             IsoPhoTrackIsol_,           kIsoPhoTrackIsol);
00496     getCollection( iEvent, missing, electronR9IsoHandle,      IsoR9_,                     kIsoR9);  
00497     getCollection( iEvent, missing, electronR9NonIsoHandle,   NonIsoR9_,                  kNonIsoR9);   
00498     getCollection( iEvent, missing, electronR9IDIsoHandle,    IsoR9ID_,                   kIsoR9ID);
00499     getCollection( iEvent, missing, electronR9IDNonIsoHandle, NonIsoR9ID_,                kNonIsoR9ID);
00500     getCollection( iEvent, missing, electronHFClusterHandle,  HFECALClusters_,            kHFECALClusters); 
00501     getCollection( iEvent, missing, electronHFElectronHandle, HFElectrons_,               kHFElectrons); 
00502     /*
00503     getCollection( iEvent, missing, eerechits,                EERecHitTag_,               kEErechits ); 
00504     getCollection( iEvent, missing, ebrechits,                EBRecHitTag_,               kEBrechits );  
00505     getCollection( iEvent, missing, pi0eerechits,             pi0EERecHitTag_,            kpi0EErechits );  
00506     getCollection( iEvent, missing, pi0ebrechits,             pi0EBRecHitTag_,            kpi0EBrechits );   
00507     getCollection( iEvent, missing, hbherechits,              HBHERecHitTag_,             kHBHErechits );   
00508     getCollection( iEvent, missing, horechits,                HORecHitTag_,               kHOrechits );   
00509     getCollection( iEvent, missing, hfrechits,                HFRecHitTag_,               kHFrechits );   
00510     */
00511     getCollection( iEvent, missing, isopixeltracksL3,         IsoPixelTrackTagL3_,        kIsoPixelTracksL3 ); 
00512     getCollection( iEvent, missing, isopixeltracksL2,         IsoPixelTrackTagL2_,        kIsoPixelTracksL2 );
00513     getCollection( iEvent, missing, isopixeltrackPixVertices, IsoPixelTrackVerticesTag_,  kIsoPixelTrackVertices );
00514     getCollection( iEvent, missing, pixeltracksL3,            PixelTracksTagL3_,          kPixelTracksL3 ); 
00515     getCollection( iEvent, missing, pixelfedsize,             PixelFEDSizeTag_,           kPixelFEDSize );
00516     getCollection( iEvent, missing, pixelclusters,            PixelClustersTag_,          kPixelClusters );  
00517     getCollection( iEvent, missing, recoVertexsHLT,           VertexTagHLT_,              kRecoVerticesHLT ); 
00518     getCollection( iEvent, missing, recoVertexsOffline0,      VertexTagOffline0_,         kRecoVerticesOffline0 );
00519     
00520     double ptHat=-1.;
00521     if (genEventInfo.isValid()) {ptHat=genEventInfo->qScale();}
00522     
00523     
00524     // print missing collections
00525     if (not missing.empty() and (errCnt < errMax())) {
00526         errCnt++;
00527         std::stringstream out;       
00528         out <<  "OpenHLT analyser - missing collections:";
00529         BOOST_FOREACH(const MissingCollectionInfo & entry, missing)
00530         out << "\n\t" << entry.first << ": " << entry.second->encode();
00531         edm::LogPrint("OpenHLT") << out.str() << std::endl; 
00532         if (errCnt == errMax())
00533             edm::LogWarning("OpenHLT") << "Maximum error count reached -- No more messages will be printed.";
00534     }
00535     
00536     // run the analysis, passing required event fragments
00537     jet_analysis_.analyze(iEvent,
00538                           hltjets,
00539                           hltcorjets,
00540                           hltcorL1L2L3jets,
00541                           recjets,
00542                           reccorjets,
00543                           genjets,
00544                           recmet,
00545                           genmet,
00546                           ht,
00547                           taus,
00548                           pftaus,
00549                           pftausTightCone,
00550                           pfjets,
00551                           recoPftaus,
00552                           theRecoPFTauDiscrByTanCOnePercent,
00553                           theRecoPFTauDiscrByTanCHalfPercent,
00554                           theRecoPFTauDiscrByTanCQuarterPercent,
00555                           theRecoPFTauDiscrByTanCTenthPercent,
00556                           theRecoPFTauDiscrByIsolation,
00557                           theRecoPFTauDiscrAgainstMuon,
00558                           theRecoPFTauDiscrAgainstElec,
00559                           recoPFJets, 
00560                           caloTowers,
00561                           recoPFMet,
00562                           towerThreshold_,
00563                           _MinPtGammas,
00564                           _MinPtChargedHadrons,
00565                           HltTree);
00566     
00567     muon_analysis_.analyze(
00568                            muon,
00569                            pfmuon,
00570                            l1extmu,
00571                            mucands2,
00572                            isoMap2,
00573                            mucands3,
00574                            isoMap3,
00575                            isoTrk10Map3,
00576                            oniaPixelCands,
00577                            oniaTrackCands,
00578                            dimuvtxcands3,
00579                            munovtxcands2,
00580                            trkmucands,
00581                            theMagField,
00582                            recoBeamSpotHandle,
00583                            // BSPosition,
00584                            HltTree);
00585     
00586     elm_analysis_.analyze(
00587                           electrons,
00588                           photons,
00589                           electronIsoHandle,
00590                           electronNonIsoHandle,
00591                           NonIsoTrackEleIsolMap,
00592                           TrackEleIsolMap,
00593                           L1IsoPixelSeedsMap,
00594                           L1NonIsoPixelSeedsMap,
00595                           recoIsolecalcands,
00596                           recoNonIsolecalcands,
00597                           EcalIsolMap,
00598                           EcalNonIsolMap,
00599                           HcalEleIsolMap,
00600                           HcalEleNonIsolMap,
00601                           HcalIsolMap,
00602                           HcalNonIsolMap,
00603                           TrackIsolMap,
00604                           TrackNonIsolMap,
00605                           lazyTools,
00606                           theMagField,
00607                           BSPosition,
00608                           eIDValueMap,
00609                           photonR9IsoHandle, 
00610                           photonR9NonIsoHandle, 
00611                           electronR9IsoHandle, 
00612                           electronR9NonIsoHandle, 
00613                           photonHoverEHIsoHandle,  
00614                           photonHoverEHNonIsoHandle,  
00615                           photonR9IDIsoHandle,
00616                           photonR9IDNonIsoHandle,
00617                           electronR9IDIsoHandle,
00618                           electronR9IDNonIsoHandle,
00619                           electronHFClusterHandle,
00620                           electronHFElectronHandle,
00621                           electronHFClusterAssociation,  
00622                           ActivityCandsHandle,
00623                           ActivityEcalIsoHandle,
00624                           ActivityHcalIsoHandle,
00625                           ActivityTrackIsoHandle,
00626                           ActivityR9Handle,
00627                           ActivityR9IDHandle,
00628                           ActivityHoverEHHandle,
00629                           HltTree);
00630     
00631     mct_analysis_.analyze(
00632                           mctruth,
00633                           ptHat,
00634                           simTracks,
00635                           simVertices,
00636                           HltTree);
00637     track_analysis_.analyze( 
00638                             isopixeltracksL3, 
00639                             isopixeltracksL2,
00640                             isopixeltrackPixVertices,                     
00641                             pixeltracksL3, 
00642                             pixelfedsize,
00643                             pixelclusters,
00644                             HltTree); 
00645 
00646     hlt_analysis_.analyze(
00647                           hltresults,
00648                           l1extemi,
00649                           l1extemn,
00650                           l1extmu,
00651                           l1extjetc,
00652                           l1extjetf,
00653                           l1exttaujet,
00654                           l1extmet,
00655                           l1extmht,
00656                           l1GtRR,
00657                           gctBitCounts,
00658                           gctRingSums,
00659                           iSetup,
00660                           iEvent,
00661                           HltTree);
00662 
00663     bjet_analysis_.analyze(
00664                            hRawBJets, 
00665                            hCorrectedBJets,
00666                            hLifetimeBJetsL25,
00667                            hLifetimeBJetsL3,
00668                            hLifetimeBJetsL25SingleTrack,
00669                            hLifetimeBJetsL3SingleTrack,
00670                            hPerformanceBJetsL25,
00671                            hPerformanceBJetsL3,
00672                            HltTree);
00673 
00674     vrt_analysisHLT_.analyze(
00675                              recoVertexsHLT,
00676                              HltTree);
00677 
00678     vrt_analysisOffline0_.analyze(
00679                              recoVertexsOffline0,
00680                              HltTree);
00681 
00682     evt_header_.analyze(iEvent, HltTree);
00683     
00684     
00685     // std::cout << " Ending Event Analysis" << std::endl;
00686     // After analysis, fill the variables tree
00687     if (m_file)
00688         m_file->cd();
00689     HltTree->Fill();
00690 }
00691 
00692 // "endJob" is an inherited method that you may implement to do post-EOF processing and produce final output.
00693 void HLTAnalyzer::endJob() {
00694     
00695     if (m_file)
00696         m_file->cd();
00697     
00698     const edm::ParameterSet &thepset = edm::getProcessParameterSet();   
00699     TList *list = HltTree->GetUserInfo();   
00700     list->Add(new TObjString(thepset.dump().c_str()));   
00701     
00702     HltTree->SetWeight(treeWeight);
00703     HltTree->Write();
00704     delete HltTree;
00705     HltTree = 0;
00706     
00707     if (m_file) {         // if there was a tree file...
00708         m_file->Write();    // write out the branches
00709         delete m_file;      // close and delete the file
00710         m_file = 0;         // set to zero to clean up
00711     }
00712     
00713 }