CMS 3D CMS Logo

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