CMS 3D CMS Logo

ImpactParameter.cc
Go to the documentation of this file.
1 /* class ImpactParameter
2  * EDProducer for TauImpactParameterInfoCollection
3  * author: Andrea Rizzi
4  */
5 
6 // system include files
7 #include <memory>
8 
9 // user include files
17 
19 
25 
27 
29 
31 public:
32  explicit ImpactParameter(const edm::ParameterSet&);
33  ~ImpactParameter() override;
34 
35  void produce(edm::Event&, const edm::EventSetup&) override;
36 
37 private:
42 };
43 
44 //
45 // constructors and destructor
46 //
48  jetTrackSrc = iConfig.getParameter<edm::InputTag>("JetTagProd");
49  vertexSrc = iConfig.getParameter<edm::InputTag>("vertexSrc");
50  usingVertex = iConfig.getParameter<bool>("useVertex");
51 
52  algo = new ImpactParameterAlgorithm(iConfig);
53 
54  std::string modulname = iConfig.getParameter<std::string>("@module_label");
55  produces<reco::JetTagCollection>().setBranchAlias(modulname);
56  std::string infoBranchName = modulname + "Info";
57  produces<reco::TauImpactParameterInfoCollection>().setBranchAlias(infoBranchName);
58 }
59 
61 
62 //
63 // member functions
64 //
65 // ------------ method called to produce the data ------------
67  using namespace reco;
68 
70  iEvent.getByLabel(jetTrackSrc, isolatedTaus);
71 
72  std::unique_ptr<JetTagCollection> tagCollection;
73  auto extCollection = std::make_unique<TauImpactParameterInfoCollection>();
74  if (not isolatedTaus->empty()) {
76  tagCollection = std::make_unique<JetTagCollection>(prod);
77  } else {
78  tagCollection = std::make_unique<JetTagCollection>();
79  }
80 
82  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", builder);
84 
85  Vertex PV;
86  if (usingVertex) {
88  iEvent.getByLabel(vertexSrc, vertices);
89 
90  const reco::VertexCollection vertCollection = *(vertices.product());
91  reco::VertexCollection::const_iterator iVertex;
92 
93  for (iVertex = vertCollection.begin(); iVertex != vertCollection.end(); iVertex++) {
94  PV = *iVertex;
95  }
96 
97  } else {
99  e(0, 0) = 0;
100  e(1, 1) = 0;
101  e(2, 2) = 0;
102  Vertex::Point p(0, 0, 0);
103 
104  Vertex dummyPV(p, e, 1, 1, 1);
105  PV = dummyPV;
106  }
107 
108  for (unsigned int i = 0; i < isolatedTaus->size(); ++i) {
109  IsolatedTauTagInfoRef tauRef(isolatedTaus, i);
110  std::pair<float, TauImpactParameterInfo> ipInfo = algo->tag(tauRef, PV);
111  tagCollection->setValue(i, ipInfo.first);
112  extCollection->push_back(ipInfo.second);
113  }
114 
115  iEvent.put(std::move(extCollection));
116  iEvent.put(std::move(tagCollection));
117 }
118 
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:44
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
int iEvent
Definition: GenABIO.cc:224
T const * product() const
Definition: ESHandle.h:86
void setTransientTrackBuilder(const TransientTrackBuilder *)
T get() const
Definition: EventSetup.h:82
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
ImpactParameter(const edm::ParameterSet &)
edm::InputTag jetTrackSrc
ImpactParameterAlgorithm * algo
edm::InputTag vertexSrc
RefToBaseProd< T > makeRefToBaseProdFrom(RefToBase< T > const &iRef, Event const &iEvent)
fixed size matrix
~ImpactParameter() override
std::pair< float, reco::TauImpactParameterInfo > tag(const reco::IsolatedTauTagInfoRef &, const reco::Vertex &)
def move(src, dest)
Definition: eostools.py:511
void produce(edm::Event &, const edm::EventSetup &) override