CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SecondaryVertexTagInfoProxy.cc
Go to the documentation of this file.
1 
2 // system include files
3 #include <memory>
4 
5 // user include files
10 
15 
17 
18 
19 //
20 // class decleration
21 //
22 
24 {
25 public:
26 
28 
29 private:
30 
31  virtual void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
32 
34 };
35 
36 
38 {
39  // Get the cfg parameter
40  svTagInfoCollection_ = consumes<reco::SecondaryVertexTagInfoCollection>(config.getUntrackedParameter<edm::InputTag> ( "svTagInfoProducer" ));
41 
42  // Declare the type of objects to be produced.
43  produces<reco::VertexCollection>();
44  produces<edm::AssociationMap<edm::OneToMany<reco::SecondaryVertexTagInfoCollection, reco::VertexCollection> > >();
45 }
46 
47 
49 {
50  // Vertex collection
52  event.getByToken(svTagInfoCollection_, svTagInfoCollection);
53 
54  // Auto pointers to the collection to be added to the event
55  std::auto_ptr<reco::VertexCollection> proxy (new reco::VertexCollection);
56  std::auto_ptr<edm::AssociationMap<edm::OneToMany<reco::SecondaryVertexTagInfoCollection, reco::VertexCollection> > >
58 
59  // Get a reference before to put in the event
60  reco::VertexRefProd vertexRefProd = event.getRefBeforePut<reco::VertexCollection>();
61 
62  // General index
63  std::size_t index = 0;
64 
65  // Loop over SecondaryVertexTagInfo collection
66  for (std::size_t svIndex = 0; svIndex < svTagInfoCollection->size(); ++svIndex)
67  {
68  // Reference to svTagInfo
69  reco::SecondaryVertexTagInfoRef svTagInfo(svTagInfoCollection, svIndex);
70 
71  // Loop over the vertexes and add them to the new collection
72  for (unsigned int vIndex = 0; vIndex < svTagInfo->nVertices(); ++vIndex)
73  {
74  proxy->push_back(svTagInfo->secondaryVertex(vIndex));
75  assoc->insert(svTagInfo, reco::VertexRef(vertexRefProd, index));
76  ++index;
77  }
78  }
79 
80  // Adding the collection to the event
81  event.put(proxy);
82  event.put(assoc);
83 }
84 
85 
86 //define this as a plug-in
virtual void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::SecondaryVertexTagInfoCollection > svTagInfoCollection_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
SecondaryVertexTagInfoProxy(const edm::ParameterSet &)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")