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 
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
JetTag.h
mps_fire.i
i
Definition: mps_fire.py:428
EDProducer.h
ESHandle.h
reco::Vertex::Error
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:44
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
ImpactParameter::usingVertex
bool usingVertex
Definition: ImpactParameter.cc:41
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
ImpactParameterAlgorithm::tag
std::pair< float, reco::TauImpactParameterInfo > tag(const reco::IsolatedTauTagInfoRef &, const reco::Vertex &)
Definition: ImpactParameterAlgorithm.cc:29
edm::Handle
Definition: AssociativeIterator.h:50
nanoDQM_cfi.PV
PV
Definition: nanoDQM_cfi.py:520
ImpactParameterAlgorithm
Definition: ImpactParameterAlgorithm.h:19
edm::Ref< IsolatedTauTagInfoCollection >
MakerMacros.h
Track.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ImpactParameter::vertexSrc
edm::InputTag vertexSrc
Definition: ImpactParameter.cc:40
dumpMFGeometry_cfg.prod
prod
Definition: dumpMFGeometry_cfg.py:24
TransientTrackRecord
Definition: TransientTrackRecord.h:11
edm::ESHandle< TransientTrackBuilder >
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Vertex.h
ImpactParameter::ImpactParameter
ImpactParameter(const edm::ParameterSet &)
Definition: ImpactParameter.cc:47
edm::ParameterSet
Definition: ParameterSet.h:47
ImpactParameter::~ImpactParameter
~ImpactParameter() override
Definition: ImpactParameter.cc:60
Event.h
edm::makeRefToBaseProdFrom
RefToBaseProd< T > makeRefToBaseProdFrom(RefToBase< T > const &iRef, Event const &iEvent)
Definition: makeRefToBaseProdFrom.h:34
ImpactParameterAlgorithm.h
iEvent
int iEvent
Definition: GenABIO.cc:224
ImpactParameter::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: ImpactParameter.cc:66
edm::EventSetup
Definition: EventSetup.h:57
makeRefToBaseProdFrom.h
TransientTrackRecord.h
get
#define get
VertexFwd.h
reco::Vertex::Point
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
eostools.move
def move(src, dest)
Definition: eostools.py:511
ImpactParameterAlgorithm::setTransientTrackBuilder
void setTransientTrackBuilder(const TransientTrackBuilder *)
Definition: ImpactParameterAlgorithm.cc:25
Frameworkfwd.h
ImpactParameter::algo
ImpactParameterAlgorithm * algo
Definition: ImpactParameter.cc:38
ImpactParameter
Definition: ImpactParameter.cc:30
ImpactParameter::jetTrackSrc
edm::InputTag jetTrackSrc
Definition: ImpactParameter.cc:39
EventSetup.h
edm::EDProducer
Definition: EDProducer.h:35
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ParameterSet.h
IsolatedTauTagInfo.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
reco::Vertex
Definition: Vertex.h:35
edm::RefToBaseProd
Definition: RefToBase.h:65
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37