CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
InvariantMass.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: InvariantMass
4 // Class: InvariantMass
5 //
13 //
14 // Original Author: Suchandra Dutta
15 // Created: Thu Oct 19 09:02:32 CEST 2006
16 // $Id: InvariantMass.cc,v 1.13 2009/03/02 18:52:28 friis Exp $
17 //
18 //
19 
20 
21 // system include files
22 #include <memory>
23 #include <string>
24 #include <utility>
25 #include <boost/regex.hpp>
26 
27 // user include files
34 
42 
44 
45 using namespace std;
46 
47 //
48 // constructors and destructor
49 //
51 {
52  jetTrackSrc = iConfig.getParameter<string>("JetTrackSrc");
53  m_ecalBClSrc = iConfig.getParameter<string>("ecalbcl");
54 
55  m_algo = new InvariantMassAlgorithm(iConfig);
56 
57  produces<reco::JetTagCollection>();
58  produces<reco::TauMassTagInfoCollection>();
59 }
60 
61 
63 {
64  delete m_algo;
65 }
66 
67 //
68 // member functions
69 //
70 // ------------ method called to produce the data ------------
71 void
73 {
74  using namespace edm;
75  using namespace reco;
76 
78  iEvent.getByLabel(jetTrackSrc, isolatedTaus);
79 
80  std::auto_ptr<JetTagCollection> tagCollection;
81  std::auto_ptr<TauMassTagInfoCollection> extCollection( new TauMassTagInfoCollection() );
82 
83  // Island basic cluster collection
84  Handle<BasicClusterCollection> barrelBasicClusterHandle;
85  iEvent.getByLabel(m_ecalBClSrc, "islandBarrelBasicClusters", barrelBasicClusterHandle);
86 
87  Handle<BasicClusterCollection> endcapBasicClusterHandle;
88  iEvent.getByLabel(m_ecalBClSrc, "islandEndcapBasicClusters", endcapBasicClusterHandle);
89 
90  if (isolatedTaus->empty()) {
91  tagCollection.reset( new JetTagCollection() );
92  } else {
93  RefToBaseProd<reco::Jet> prod( isolatedTaus->begin()->jet() );
94  tagCollection.reset( new JetTagCollection(RefToBaseProd<reco::Jet>(prod)) );
95 
96  for (unsigned int i = 0; i < isolatedTaus->size(); ++i)
97  {
98  IsolatedTauTagInfoRef tauRef(isolatedTaus, i);
99  const Jet & jet = *(tauRef->jet());
100  math::XYZVector jetDir(jet.px(),jet.py(),jet.pz());
101  pair<double,TauMassTagInfo> jetTauPair;
102  if (jetDir.eta() < 1.2) // barrel
103  jetTauPair = m_algo->tag(iEvent, iSetup, tauRef, barrelBasicClusterHandle);
104  else // endcap
105  jetTauPair = m_algo->tag(iEvent, iSetup, tauRef, endcapBasicClusterHandle);
106  tagCollection->setValue( i, jetTauPair.first );
107  extCollection->push_back( jetTauPair.second );
108  }
109  }
110 
111  iEvent.put( tagCollection );
112  iEvent.put( extCollection );
113 }
114 
virtual void produce(edm::Event &, const edm::EventSetup &)
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
Base class for all types of Jets.
Definition: Jet.h:21
JetFloatAssociation::Container JetTagCollection
Definition: JetTag.h:18
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
virtual double px() const
x coordinate of momentum vector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
virtual double pz() const
z coordinate of momentum vector
virtual double py() const
y coordinate of momentum vector
InvariantMass(const edm::ParameterSet &)