CMS 3D CMS Logo

InvariantMass.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    InvariantMass
00004 // Class:      InvariantMass
00005 // 
00013 //
00014 // Original Author:  Suchandra Dutta
00015 //      Created:  Thu Oct 19 09:02:32 CEST 2006
00016 // $Id: InvariantMass.cc,v 1.11 2007/10/07 13:05:27 fwyzard Exp $
00017 //
00018 //
00019 
00020 
00021 // system include files
00022 #include <memory>
00023 #include <string>
00024 #include <utility>
00025 #include <boost/regex.hpp>
00026 
00027 // user include files
00028 #include "FWCore/Framework/interface/Frameworkfwd.h"
00029 #include "FWCore/Framework/interface/Event.h"
00030 #include "FWCore/Framework/interface/EventSetup.h"
00031 #include "FWCore/Framework/interface/MakerMacros.h"
00032 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00033 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00034 
00035 #include "DataFormats/Common/interface/Handle.h"
00036 #include "DataFormats/VertexReco/interface/Vertex.h"
00037 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
00038 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
00039 #include "DataFormats/TrackReco/interface/Track.h"
00040 #include "DataFormats/BTauReco/interface/JetTag.h"
00041 #include "DataFormats/BTauReco/interface/IsolatedTauTagInfo.h"
00042 
00043 #include "RecoTauTag/InvariantMass/interface/InvariantMass.h"
00044 
00045 using namespace std;
00046 
00047 //
00048 // constructors and destructor
00049 //
00050 InvariantMass::InvariantMass(const edm::ParameterSet& iConfig)
00051 {
00052   jetTrackSrc = iConfig.getParameter<string>("JetTrackSrc");
00053   m_ecalBClSrc = iConfig.getParameter<string>("ecalbcl");
00054 
00055   m_algo = new InvariantMassAlgorithm(iConfig);
00056   
00057   produces<reco::JetTagCollection>();  //Several producer so I put a label
00058   produces<reco::TauMassTagInfoCollection>();   //Only one producer
00059 
00060 
00061 }
00062 
00063 
00064 InvariantMass::~InvariantMass()
00065 {
00066   delete m_algo;
00067 }
00068 
00069 //
00070 // member functions
00071 //
00072 // ------------ method called to produce the data  ------------
00073 void
00074 InvariantMass::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00075 {
00076    using namespace edm;
00077    using namespace reco;
00078 
00079    Handle<IsolatedTauTagInfoCollection> isolatedTaus;
00080    iEvent.getByLabel(jetTrackSrc, isolatedTaus);
00081    
00082    std::auto_ptr<JetTagCollection>         tagCollection;
00083    std::auto_ptr<TauMassTagInfoCollection> extCollection( new TauMassTagInfoCollection() );
00084 
00085    // Island basic cluster collection
00086    Handle<BasicClusterCollection> barrelBasicClusterHandle;
00087    iEvent.getByLabel(m_ecalBClSrc, "islandBarrelBasicClusters", barrelBasicClusterHandle);
00088    const reco::BasicClusterCollection & barrelClusters = *(barrelBasicClusterHandle.product());
00089 
00090    Handle<BasicClusterCollection> endcapBasicClusterHandle;
00091    iEvent.getByLabel(m_ecalBClSrc, "islandEndcapBasicClusters", endcapBasicClusterHandle);
00092    const reco::BasicClusterCollection & endcapClusters = *(endcapBasicClusterHandle.product());
00093 
00094    if (isolatedTaus->empty()) {
00095      tagCollection.reset( new JetTagCollection() );
00096    } else {
00097      RefToBaseProd<reco::Jet> prod( isolatedTaus->begin()->jet() );
00098      tagCollection.reset( new JetTagCollection(RefToBaseProd<reco::Jet>(prod)) );
00099 
00100      for (unsigned int i = 0; i < isolatedTaus->size(); ++i)
00101      {
00102        IsolatedTauTagInfoRef tauRef(isolatedTaus, i);
00103        const Jet & jet = *(tauRef->jet()); 
00104        math::XYZVector jetDir(jet.px(),jet.py(),jet.pz());  
00105        pair<double,TauMassTagInfo> jetTauPair;
00106        if (jetDir.eta() < 1.2)      // barrel  
00107          jetTauPair = m_algo->tag(iEvent, iSetup, tauRef, barrelBasicClusterHandle);
00108        else                         // endcap
00109          jetTauPair = m_algo->tag(iEvent, iSetup, tauRef, endcapBasicClusterHandle);
00110        tagCollection->setValue( i, jetTauPair.first );
00111        extCollection->push_back( jetTauPair.second );
00112      }
00113    }
00114 
00115    iEvent.put( tagCollection );
00116    iEvent.put( extCollection );
00117 }
00118 
00119 #include "FWCore/PluginManager/interface/ModuleDef.h"
00120 #include "FWCore/Framework/interface/MakerMacros.h"
00121 DEFINE_FWK_MODULE(InvariantMass);

Generated on Tue Jun 9 17:45:00 2009 for CMSSW by  doxygen 1.5.4