CMS 3D CMS Logo

prodname Class Reference

Description: <one line="" class="" summary>="">. More...

Inheritance diagram for prodname:

edm::ESProducer edm::EDProducer edm::ESProxyFactoryProducer edm::ProducerBase edm::eventsetup::DataProxyProvider edm::ProductRegistryHelper

List of all members.

Public Member Functions

typedef perl if (1 eq scalar(@::datatypes))
 prodname (const edm::ParameterSet &)
 prodname (const edm::ParameterSet &)
ReturnType produce (const recordname &)
 ~prodname ()
 ~prodname ()

Private Member Functions

virtual void beginJob (const edm::EventSetup &)
virtual void endJob ()
virtual void produce (edm::Event &, const edm::EventSetup &)

Private Attributes

example_myparticle edm::InputTag electronTags_
example_myparticle edm::InputTag muonTags_


Detailed Description

Description: <one line="" class="" summary>="">.

Implementation: <Notes on="" implementation>="">

Definition at line 43 of file edproducer.cc.


Constructor & Destructor Documentation

prodname::prodname ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 72 of file edproducer.cc.

00073                     :
00074 @example_myparticle   muonTags_( iConfig.getUntrackedParameter<edm::InputTag>( "muons" )),
00075 @example_myparticle   electronTags_( iConfig.getUntrackedParameter<edm::InputTag>( "electrons" ))
00076 {
00077    //register your products
00078 /* Examples
00079    produces<ExampleData2>();
00080 
00081    //if do put with a label
00082    produces<ExampleData2>("label");
00083 */
00084 @example_myparticle   produces<MyParticleCollection>( "particles" );
00085    //now do what ever other initialization is needed
00086   
00087 }

prodname::~prodname (  ) 

Definition at line 90 of file edproducer.cc.

00091 {
00092  
00093    // do anything here that needs to be done at desctruction time
00094    // (e.g. close files, deallocate resources etc.)
00095 
00096 }

prodname::prodname ( const edm::ParameterSet  ) 

prodname::~prodname (  ) 


Member Function Documentation

void prodname::beginJob ( const edm::EventSetup  )  [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 169 of file edproducer.cc.

00170 {
00171 }

void prodname::endJob ( void   )  [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 175 of file edproducer.cc.

00175                  {
00176 }

typedef perl prodname::if ( 1 eq   scalar(@::datatypes)  )  [inline]

Definition at line 43 of file esproducer.cc.

00043 { $result="boost::shared_ptr<$::datatypes[0]>"; } else { $result="edm::ESProducts<"; $line = 0; foreach $type ( @::datatypes ) { if ($line) { $result = "$result, "; } $result= "$result boost::shared_ptr<$type> ";  $line =1;} $result="$result>"; }  @\perl ReturnType;

prodname::ReturnType prodname::produce ( const recordname &  iRecord  ) 

Definition at line 86 of file esproducer.cc.

References edm::eq().

00087 {
00088    using namespace edm::es;
00089 @perl $result=""; foreach $type (@::datatypes) {$result ="$result   boost::shared_ptr<$type> p$type ;\n";} @\perl
00090 
00091    return @perl if( 1 eq scalar( @::datatypes ) ) { $result="p$::datatypes[0]" } else { $result="products("; $line = 0; foreach $type ( @::datatypes ) { if ($line) { $result = "$result,"; } $result= "$result p$type"; $line +=1; } $result="$result)"; }  @\perl ;
00092 }

void prodname::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 105 of file edproducer.cc.

References metsig::electron, electronTags_, edm::Event::getByLabel(), h, metsig::muon, muons_cfi::muons, muonTags_, MyParticleCollection, edm::Event::put(), HcalSimpleRecAlgoImpl::reco(), and std.

00106 {
00107    using namespace edm;
00108 @example_myparticle    using namespace reco;
00109 @example_myparticle    using namespace std;
00110 /* This is an event example
00111    //Read 'ExampleData' from the Event
00112    Handle<ExampleData> pIn;
00113    iEvent.getByLabel("example",pIn);
00114 
00115    //Use the ExampleData to create an ExampleData2 which 
00116    // is put into the Event
00117    std::auto_ptr<ExampleData2> pOut(new ExampleData2(*pIn));
00118    iEvent.put(pOut);
00119 */
00120 
00121 /* this is an EventSetup example
00122    //Read SetupData from the SetupRecord in the EventSetup
00123    ESHandle<SetupData> pSetup;
00124    iSetup.get<SetupRecord>().get(pSetup);
00125 */
00126  
00127 @example_myparticle    Handle<MuonCollection> muons;
00128 @example_myparticle    iEvent.getByLabel( muonTags_, muons );
00129 @example_myparticle    
00130 @example_myparticle    Handle<PixelMatchGsfElectronCollection> electrons;
00131 @example_myparticle    iEvent.getByLabel( electronTags_, electrons );
00132 @example_myparticle    
00133 @example_myparticle    // create a new collection of Particle objects
00134 @example_myparticle    auto_ptr<MyParticleCollection> newParticles( new MyParticleCollection );      
00135 @example_myparticle 
00136 @example_myparticle    // if the number of electrons or muons is 4 (or 2 and 2), costruct a new particle
00137 @example_myparticle    if( muons->size() == 4 || electrons->size() == 4 || ( muons->size() == 2 && electrons->size() == 2 ) ) {
00138 @example_myparticle       
00139 @example_myparticle       // sums of momenta and charges will be calculated
00140 @example_myparticle       Particle::LorentzVector totalP4( 0, 0, 0, 0 );
00141 @example_myparticle       Particle::Charge charge( 0 );
00142 @example_myparticle       
00143 @example_myparticle       // loop over muons, sum over p4s and charges. Later same for electrons
00144 @example_myparticle       for( MuonCollection::const_iterator muon = muons->begin(); muon != muons->end(); ++muon ) {
00145 @example_myparticle          totalP4 += muon->p4();
00146 @example_myparticle          charge += muon->charge();
00147 @example_myparticle       }
00148 @example_myparticle       
00149 @example_myparticle       for( PixelMatchGsfElectronCollection::const_iterator electron = electrons->begin(); electron != electrons->end(); ++electron ) {
00150 @example_myparticle          totalP4 += electron->p4(); 
00151 @example_myparticle          charge += electron->charge(); 
00152 @example_myparticle       }
00153 @example_myparticle       
00154 @example_myparticle       // create a particle with momentum and charge from muons and electrons
00155 @example_myparticle       Particle h;
00156 @example_myparticle       h.setP4(totalP4);
00157 @example_myparticle       h.setCharge(charge);
00158 @example_myparticle 
00159 @example_myparticle       // fill the particles into the vector
00160 @example_myparticle       newParticles->push_back( h );      
00161 @example_myparticle    }
00162 @example_myparticle    
00163 @example_myparticle    // save the vector
00164 @example_myparticle    iEvent.put( newParticles, "particles" );
00165 }


Member Data Documentation

example_myparticle edm::InputTag prodname::electronTags_ [private]

Definition at line 55 of file edproducer.cc.

Referenced by produce().

example_myparticle edm::InputTag prodname::muonTags_ [private]

Definition at line 54 of file edproducer.cc.

Referenced by produce().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:30:19 2009 for CMSSW by  doxygen 1.5.4