ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/ShallowTools/plugins/ShallowExampleProducer.cc
Revision: 1.2
Committed: Tue Sep 29 10:16:31 2009 UTC (15 years, 7 months ago) by bbetchar
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -0 lines
Log Message:
updates for CMSSW_3_3_X

File Contents

# User Rev Content
1 bbetchar 1.1 #include "UserCode/ShallowTools/interface/ShallowExampleProducer.h"
2 bbetchar 1.2 #include "FWCore/Framework/interface/Event.h"
3 bbetchar 1.1
4     ShallowExampleProducer::ShallowExampleProducer(const edm::ParameterSet& iConfig)
5     {
6     produces <bool> ( "booly" );
7     produces <short> ( "shorty" );
8     produces <int> ( "inty" );
9     produces <long> ( "longy" );
10     produces <float> ( "floaty" );
11     produces <double> ( "doubley" );
12     produces <unsigned short> ( "ushorty" );
13     produces <unsigned int> ( "uinty" );
14     produces <unsigned long> ( "ulongy" );
15     produces <std::vector <bool> >( "boolsy" );
16     produces <std::vector <short> >( "shortsy" );
17     produces <std::vector <int> >( "intsy" );
18     produces <std::vector <long> >( "longsy" );
19     produces <std::vector <float> >( "floatsy" );
20     produces <std::vector <double> >( "doublesy" );
21     produces <std::vector<unsigned short> >( "ushortsy" );
22     produces <std::vector<unsigned int> >( "uintsy" );
23     produces <std::vector<unsigned long> >( "ulongsy" );
24     produces < std::string> ( "stringy" );
25     }
26    
27     void ShallowExampleProducer::
28     produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
29     std::auto_ptr<bool> b ( new bool(true) );
30     std::auto_ptr<short> s ( new short(-3) );
31     std::auto_ptr<int> i ( new int(-3) );
32     std::auto_ptr<long> l ( new long(-3) );
33     std::auto_ptr<float> f ( new float(3.0) );
34     std::auto_ptr<double> d ( new double(3.0) );
35    
36     std::auto_ptr<unsigned short> us ( new unsigned short(3) );
37     std::auto_ptr<unsigned int> ui ( new unsigned int(3) );
38     std::auto_ptr<unsigned long> ul ( new unsigned long(3) );
39    
40     std::auto_ptr<std::vector<bool> > bv ( new std::vector<bool>() );
41     std::auto_ptr<std::vector<short> > sv ( new std::vector<short>() );
42     std::auto_ptr<std::vector<int> > iv ( new std::vector<int>() );
43     std::auto_ptr<std::vector<long> > lv ( new std::vector<long>() );
44     std::auto_ptr<std::vector<float> > fv ( new std::vector<float>() );
45     std::auto_ptr<std::vector<double> > dv ( new std::vector<double>() );
46    
47     std::auto_ptr <std::vector<unsigned short> > usv ( new std::vector<unsigned short>() );
48     std::auto_ptr <std::vector<unsigned int> > uiv ( new std::vector<unsigned int>() );
49     std::auto_ptr <std::vector<unsigned long> > ulv ( new std::vector<unsigned long>() );
50    
51     std::auto_ptr <std::string> S( new std::string("a string") );
52    
53    
54     for(int j=0; j<10; j++) {
55    
56     bv->push_back((j%2)==0);
57    
58     usv->push_back(j);
59     uiv->push_back(j);
60     ulv->push_back(j);
61    
62     sv->push_back(0-j);
63     iv->push_back(0-j);
64     lv->push_back(0-j);
65    
66     fv->push_back(j/2.);
67     dv->push_back(j/2.);
68     }
69    
70     iEvent.put( b, "booly" );
71     iEvent.put( s, "shorty" );
72     iEvent.put( i, "inty" );
73     iEvent.put( l, "longy" );
74     iEvent.put( f, "floaty" );
75     iEvent.put( d, "doubley" );
76    
77     iEvent.put( us, "ushorty" );
78     iEvent.put( ui, "uinty" );
79     iEvent.put( ul, "ulongy" );
80    
81     iEvent.put( bv, "boolsy" );
82     iEvent.put( sv, "shortsy" );
83     iEvent.put( iv, "intsy" );
84     iEvent.put( lv, "longsy" );
85     iEvent.put( fv, "floatsy" );
86     iEvent.put( dv, "doublesy");
87    
88     iEvent.put( usv,"ushortsy");
89     iEvent.put( uiv,"uintsy" );
90     iEvent.put( ulv,"ulongsy" );
91    
92     iEvent.put( S, "stringy" );
93    
94     }