Revision: | 1.6 |
Committed: | Mon Dec 1 17:25:58 2008 UTC (16 years, 5 months ago) by bendavid |
Content type: | text/plain |
Branch: | MAIN |
CVS Tags: | Mit_032, Mit_031, Mit_025c_branch2, Mit_025c_branch1, Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_025c_branch0, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b, Mit_020a, Mit_020, Mit_020pre1, Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, V07-05-00, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e, Mit_014d, Mit_014c, Mit_014b, ConvRejection-10-06-09, Mit_014a, Mit_014, Mit_014pre3, Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, Mit_013pre1, Mit_012i, Mit_012h, Mit_012g, Mit_012f, Mit_012e, Mit_012d, Mit_012c, Mit_012b, Mit_012a, Mit_012, Mit_011a, Mit_011, Mit_010a, Mit_010, Mit_009c, Mit_009b, Mit_009a, Mit_009, Mit_008, Mit_008pre2, Mit_008pre1, Mit_006b, Mit_006a, HEAD |
Branch point for: | Mit_025c_branch |
Changes since 1.5: | +6 -6 lines |
Log Message: | Use edm::Ptr<reco::Track> for mitedm::StablePart |
# | User | Rev | Content |
---|---|---|---|
1 | bendavid | 1.6 | // $Id: ProducerStable.cc,v 1.5 2008/11/02 13:56:14 bendavid Exp $ |
2 | loizides | 1.4 | |
3 | #include "MitEdm/Producers/interface/ProducerStable.h" | ||
4 | bendavid | 1.1 | #include "DataFormats/Common/interface/Handle.h" |
5 | #include "DataFormats/TrackReco/interface/Track.h" | ||
6 | #include "DataFormats/TrackReco/interface/TrackFwd.h" | ||
7 | loizides | 1.4 | #include "MitEdm/DataFormats/interface/Collections.h" |
8 | bendavid | 1.1 | #include "MitEdm/DataFormats/interface/StablePart.h" |
9 | |||
10 | using namespace std; | ||
11 | using namespace edm; | ||
12 | using namespace reco; | ||
13 | using namespace mitedm; | ||
14 | |||
15 | //-------------------------------------------------------------------------------------------------- | ||
16 | ProducerStable::ProducerStable(const ParameterSet& cfg) : | ||
17 | loizides | 1.4 | BaseCandProducer(cfg), |
18 | iTracks_(cfg.getUntrackedParameter<string>("iTracks","")) | ||
19 | bendavid | 1.1 | { |
20 | loizides | 1.4 | // Constructor. |
21 | |||
22 | produces<StablePartCol>(); | ||
23 | bendavid | 1.1 | } |
24 | |||
25 | //-------------------------------------------------------------------------------------------------- | ||
26 | ProducerStable::~ProducerStable() | ||
27 | { | ||
28 | loizides | 1.4 | // Destructor. |
29 | bendavid | 1.1 | } |
30 | |||
31 | //-------------------------------------------------------------------------------------------------- | ||
32 | void ProducerStable::produce(Event &evt, const EventSetup &setup) | ||
33 | { | ||
34 | loizides | 1.4 | // Produce our StablePartCol. |
35 | |||
36 | bendavid | 1.1 | // Get the track input collection |
37 | bendavid | 1.6 | Handle<View<reco::Track> > hTrks; |
38 | bendavid | 1.5 | if (!GetProduct(iTracks_, hTrks, evt)) { |
39 | printf("Track Collection not found in ProducerStable\n"); | ||
40 | bendavid | 1.1 | return; |
41 | bendavid | 1.5 | } |
42 | bendavid | 1.6 | const View<reco::Track> iTrks = *(hTrks.product()); |
43 | bendavid | 1.1 | |
44 | // Create the output collection | ||
45 | auto_ptr<StablePartCol> pS(new StablePartCol()); | ||
46 | |||
47 | // Simple conversion of tracks to stable particles | ||
48 | bendavid | 1.6 | for (View<reco::Track>::const_iterator it = iTrks.begin(); it != iTrks.end(); ++it) { |
49 | const mitedm::TrackPtr thePtr = iTrks.ptrAt(it - iTrks.begin()); | ||
50 | StablePart *s = new StablePart(oPid_,thePtr); | ||
51 | loizides | 1.4 | if (0) |
52 | printf(" Track: %14.8f, %14.8f, %14.8f\n",it->pt(),it->phi(),it->eta()); | ||
53 | bendavid | 1.1 | pS->push_back(*s); |
54 | delete s; | ||
55 | } | ||
56 | |||
57 | // Write the collection even if it is empty | ||
58 | loizides | 1.4 | if (0) { |
59 | cout << " Stable::produce - " << pS->size() << " entries collection created -" | ||
60 | << " (Pid: " << oPid_ << ")\n"; | ||
61 | } | ||
62 | bendavid | 1.1 | evt.put(pS); |
63 | } | ||
64 | |||
65 | //define this as a plug-in | ||
66 | DEFINE_FWK_MODULE(ProducerStable); |