test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
VZeroProducer.cc
Go to the documentation of this file.
1 #include "VZeroProducer.h"
2 
4 
9 
13 
15 
16 using namespace std;
17 using namespace edm;
18 
19 /*****************************************************************************/
21  : pset_(pset)
22 {
23  LogInfo("VZeroProducer") << " constructor";
24  produces<reco::VZeroCollection>();
25 
26  // Get track level cuts
28  pset.getParameter<double>("minImpactPositiveDaughter");
30  pset.getParameter<double>("minImpactNegativeDaughter");
31 }
32 
33 /*****************************************************************************/
35 {
36  LogInfo("VZeroProducer") << " destructor";
37 }
38 
39 /*****************************************************************************/
41 {
42  // Get tracks
44  ev.getByLabel(pset_.getParameter<InputTag>("trackCollection"),
45  trackCollection);
46  const reco::TrackCollection tracks = *(trackCollection.product());
47 
48  // Get primary vertices
50  ev.getByLabel(pset_.getParameter<InputTag>("vertexCollection"),
51  vertexCollection);
52  const reco::VertexCollection* vertices = vertexCollection.product();
53 
54  // Find vzeros
55  VZeroFinder theFinder(es,pset_);
56 
57  // Selection based on track impact parameter
58  reco::TrackRefVector positives;
59  reco::TrackRefVector negatives;
60 
61  for(unsigned int i=0; i<tracks.size(); i++)
62  {
63  if(tracks[i].charge() > 0 &&
64  fabs(tracks[i].d0()) > minImpactPositiveDaughter)
65  positives.push_back(reco::TrackRef(trackCollection, i));
66 
67  if(tracks[i].charge() < 0 &&
68  fabs(tracks[i].d0()) > minImpactNegativeDaughter)
69  negatives.push_back(reco::TrackRef(trackCollection, i));
70  }
71 
72  LogTrace("MinBiasTracking") << "[VZeroProducer] using tracks :"
73  << " +" << positives.size()
74  << " -" << negatives.size();
75 
76  auto result = std::make_unique<reco::VZeroCollection>();
77 
78  // Check all combination of positives and negatives
79  if(positives.size() > 0 && negatives.size() > 0)
80  for(reco::track_iterator ipos = positives.begin();
81  ipos!= positives.end(); ipos++)
82  for(reco::track_iterator ineg = negatives.begin();
83  ineg!= negatives.end(); ineg++)
84  {
86 
87  if(theFinder.checkTrackPair(**ipos,**ineg, vertices, data) == true)
88  {
89  // Create vertex (creation point)
91  data.crossingPoint.y(),
92  data.crossingPoint.z()),
93  reco::Vertex::Error(), 0.,0.,0);
94 
95  // Add references to daughters
96  vertex.add(reco::TrackBaseRef(*ipos));
97  vertex.add(reco::TrackBaseRef(*ineg));
98 
99  // Store vzero
100  result->push_back(reco::VZero(vertex,data));
101  }
102  }
103 
104  LogTrace("MinBiasTracking")
105  << "[VZeroProducer] found candidates : " << result->size();
106 
107  // Put result back to the event
108  ev.put(std::move(result));
109 }
110 
virtual void produce(edm::Event &ev, const edm::EventSetup &es)
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
math::GlobalPoint crossingPoint
Definition: VZero.h:18
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
float minImpactNegativeDaughter
Definition: VZeroProducer.h:22
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:43
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
bool ev
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:253
tuple vertexCollection
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:248
tuple result
Definition: mps_fire.py:84
def move
Definition: eostools.py:510
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
VZeroProducer(const edm::ParameterSet &pset)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
#define LogTrace(id)
void add(const TrackBaseRef &r, float w=1.0)
add a reference to a Track
T const * product() const
Definition: Handle.h:81
tuple tracks
Definition: testEve_cfg.py:39
float minImpactPositiveDaughter
Definition: VZeroProducer.h:22
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:69
size_type size() const
Size of the RefVector.
Definition: RefVector.h:107
bool checkTrackPair(const reco::Track &posTrack, const reco::Track &negTrack, const reco::VertexCollection *vertices, reco::VZeroData &data)
Definition: VZeroFinder.cc:60
edm::ParameterSet pset_
Definition: VZeroProducer.h:20