CMS 3D CMS Logo

Public Member Functions | Public Attributes

tfwliteselectortest::ThingsWorker Struct Reference

#include <ThingsTSelector2.h>

List of all members.

Public Member Functions

void postProcess (TList &)
void process (const edm::Event &iEvent)
 ThingsWorker (const TList *, TList &)

Public Attributes

TH1F * h_a
TH1F * h_refA

Detailed Description

Definition at line 16 of file ThingsTSelector2.h.


Constructor & Destructor Documentation

ThingsWorker::ThingsWorker ( const TList *  ,
TList &  out 
)

Definition at line 18 of file ThingsTSelector2.cc.

References gather_cfg::cout, h_a, h_refA, kA, and kRefA.

                                                    {
    std::cout << "begin" << std::endl;
    h_a  = new TH1F( kA , "a"  , 100,  0, 20 );
    out.Add(h_a);
    
    h_refA  = new TH1F( kRefA , "refA"  , 100,  0, 20 );
    out.Add(h_refA);
}

Member Function Documentation

void ThingsWorker::postProcess ( TList &  )

Definition at line 69 of file ThingsTSelector2.cc.

{
}
void ThingsWorker::process ( const edm::Event iEvent)

Definition at line 30 of file ThingsTSelector2.cc.

References gather_cfg::cout, exception, edm::Event::getByLabel(), h_a, h_refA, i, cms::Exception::what(), and x.

                                              {
  std::cout << "processing event " << std::endl;
  //  chain->GetEntry( entry );
  using namespace edmtest;
  edm::Handle<OtherThingCollection> hOThings;
  try {
    iEvent.getByLabel("OtherThing", "testUserTag", hOThings);
    
    std::cout << ">> other things found:" << hOThings->size() << std::endl;
    for ( size_t i = 0; i < hOThings->size(); ++i ) {
      const OtherThing & thing = (*hOThings)[ i ];
      h_refA ->Fill( thing.ref->a );
      std::cout << ">> ref->a:  " << thing.ref->a << std::endl;
    }
    
    edm::Handle<ThingCollection> hThings;
    iEvent.getByLabel("Thing",hThings);
    const ThingCollection& things = *hThings;
    std::cout << ">> things found:" << things.size() << std::endl;
    for ( size_t i = 0; i < things.size(); ++i ) {
      const Thing & thing = things[ i ];
      h_a ->Fill( thing.a );
      std::cout << ">> a:  " << thing.a << std::endl;
    }
  } catch (cms::Exception& x) {
    std::cout << std::endl << "Failed with cms::Exception: " << std::endl;
    std::cout << x.what() << std::endl;
    abort();
  } catch (std::exception& x) {
    std::cout << std::endl << "Failed with std::exception" << std::endl;
    std::cout << x.what() << std::endl;
    abort();
  } catch (...) {
    std::cout << std::endl << "Failed with unknown exception" << std::endl;
    abort();
  }
}

Member Data Documentation

Definition at line 20 of file ThingsTSelector2.h.

Referenced by process(), and ThingsWorker().

Definition at line 21 of file ThingsTSelector2.h.

Referenced by process(), and ThingsWorker().