Public Types | |
typedef perl | if (1 eq scalar(@::datatypes)) |
Public Member Functions | |
prodname (const edm::ParameterSet &) | |
prodname (const edm::ParameterSet &) | |
ReturnType | produce (const recordname &) |
~prodname () | |
~prodname () | |
Static Public Member Functions | |
static void | fillDescriptions (edm::ConfigurationDescriptions &descriptions) |
Private Member Functions | |
virtual void | beginJob () |
virtual void | endJob () |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
example_myparticle edm::InputTag | electronTags_ |
example_myparticle edm::InputTag | muonTags_ |
Description: [one line class summary]
Implementation: [Notes on implementation]
Definition at line 43 of file edproducer.cc.
typedef perl prodname::if(1 eq scalar(@::datatypes)) [inline] |
Definition at line 43 of file esproducer.cc.
{ $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::prodname | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 79 of file edproducer.cc.
: @example_myparticle muonTags_( iConfig.getParameter<edm::InputTag>( "muons" )), @example_myparticle electronTags_( iConfig.getParameter<edm::InputTag>( "electrons" )) { //register your products /* Examples produces<ExampleData2>(); //if do put with a label produces<ExampleData2>("label"); //if you want to put into the Run produces<ExampleData2,InRun>(); */ @example_myparticle produces<MyParticleCollection>( "particles" ); //now do what ever other initialization is needed }
prodname::~prodname | ( | ) |
Definition at line 100 of file edproducer.cc.
{ // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) }
prodname::prodname | ( | const edm::ParameterSet & | ) |
prodname::~prodname | ( | ) |
void prodname::beginJob | ( | void | ) | [private, virtual] |
void prodname::endJob | ( | void | ) | [private, virtual] |
void prodname::fillDescriptions | ( | edm::ConfigurationDescriptions & | descriptions | ) | [static] |
Reimplemented from edm::EDProducer.
Definition at line 222 of file edproducer.cc.
References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().
{ //The following says we do not know what parameters are allowed so do no validation // Please change this to state exactly what you do use, even if it is no parameters edm::ParameterSetDescription desc; desc.setUnknown(); descriptions.addDefault(desc); @example_myparticle @example_myparticle //Specify that only 'muons' and 'electrons' are allowed @example_myparticle //To use, remove the default given above and uncomment below @example_myparticle //ParameterSetDescription desc; @example_myparticle //desc.add<edm::InputTag>("muons","muons"); @example_myparticle //desc.add<edm::InputTag>("electrons","pixelMatchGsfElectrons"); @example_myparticle //descriptions.addDefault(desc); }
void prodname::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 115 of file edproducer.cc.
References DeDxDiscriminatorTools::charge(), metsig::electron, HI_PhotonSkim_cff::electrons, electronTags_, edm::Event::getByLabel(), h, metsig::muon, patZpeak::muons, muonTags_, MyParticleCollection, edm::Event::put(), and dt_dqm_sourceclient_common_cff::reco.
{ using namespace edm; @example_myparticle using namespace reco; @example_myparticle using namespace std; /* This is an event example //Read 'ExampleData' from the Event Handle<ExampleData> pIn; iEvent.getByLabel("example",pIn); //Use the ExampleData to create an ExampleData2 which // is put into the Event std::auto_ptr<ExampleData2> pOut(new ExampleData2(*pIn)); iEvent.put(pOut); */ /* this is an EventSetup example //Read SetupData from the SetupRecord in the EventSetup ESHandle<SetupData> pSetup; iSetup.get<SetupRecord>().get(pSetup); */ @example_myparticle Handle<MuonCollection> muons; @example_myparticle iEvent.getByLabel( muonTags_, muons ); @example_myparticle @example_myparticle Handle<PixelMatchGsfElectronCollection> electrons; @example_myparticle iEvent.getByLabel( electronTags_, electrons ); @example_myparticle @example_myparticle // create a new collection of Particle objects @example_myparticle auto_ptr<MyParticleCollection> newParticles( new MyParticleCollection ); @example_myparticle @example_myparticle // if the number of electrons or muons is 4 (or 2 and 2), costruct a new particle @example_myparticle if( muons->size() == 4 || electrons->size() == 4 || ( muons->size() == 2 && electrons->size() == 2 ) ) { @example_myparticle @example_myparticle // sums of momenta and charges will be calculated @example_myparticle Particle::LorentzVector totalP4( 0, 0, 0, 0 ); @example_myparticle Particle::Charge charge( 0 ); @example_myparticle @example_myparticle // loop over muons, sum over p4s and charges. Later same for electrons @example_myparticle for( MuonCollection::const_iterator muon = muons->begin(); muon != muons->end(); ++muon ) { @example_myparticle totalP4 += muon->p4(); @example_myparticle charge += muon->charge(); @example_myparticle } @example_myparticle @example_myparticle for( PixelMatchGsfElectronCollection::const_iterator electron = electrons->begin(); electron != electrons->end(); ++electron ) { @example_myparticle totalP4 += electron->p4(); @example_myparticle charge += electron->charge(); @example_myparticle } @example_myparticle @example_myparticle // create a particle with momentum and charge from muons and electrons @example_myparticle Particle h; @example_myparticle h.setP4(totalP4); @example_myparticle h.setCharge(charge); @example_myparticle @example_myparticle // fill the particles into the vector @example_myparticle newParticles->push_back( h ); @example_myparticle } @example_myparticle @example_myparticle // save the vector @example_myparticle iEvent.put( newParticles, "particles" ); }
prodname::ReturnType prodname::produce | ( | const recordname & | iRecord | ) |
Definition at line 86 of file esproducer.cc.
References Vispa::Plugins::EdmBrowser::EdmDataAccessor::eq(), and hitfit::scalar().
{ using namespace edm::es; @perl $result=""; foreach $type (@::datatypes) {$result ="$result boost::shared_ptr<$type> p$type ;\n";} @\perl 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 ; }
example_myparticle edm::InputTag prodname::electronTags_ [private] |
Definition at line 62 of file edproducer.cc.
Referenced by produce().
example_myparticle edm::InputTag prodname::muonTags_ [private] |
Definition at line 61 of file edproducer.cc.
Referenced by produce().