CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
tfwliteselectortest::ThingsTSelector Class Reference

#include <ThingsTSelector.h>

Inheritance diagram for tfwliteselectortest::ThingsTSelector:
TFWLiteSelectorBasic

Public Member Functions

void begin (TList *&)
 
void postProcessing (TList &)
 
void preProcessing (const TList *, TList &)
 
void process (const edm::Event &)
 
void terminate (TList &)
 
 ThingsTSelector ()
 
- Public Member Functions inherited from TFWLiteSelectorBasic
 TFWLiteSelectorBasic ()
 
virtual ~TFWLiteSelectorBasic ()
 

Private Member Functions

ThingsTSelector operator= (ThingsTSelector const &)
 
 ThingsTSelector (ThingsTSelector const &)
 

Private Attributes

TH1F * h_a
 histograms More...
 
TH1F * h_refA
 

Detailed Description

Definition at line 15 of file ThingsTSelector.h.

Constructor & Destructor Documentation

tfwliteselectortest::ThingsTSelector::ThingsTSelector ( )
inline

Definition at line 17 of file ThingsTSelector.h.

tfwliteselectortest::ThingsTSelector::ThingsTSelector ( ThingsTSelector const &  )
private

Member Function Documentation

void ThingsTSelector::begin ( TList *&  in)
virtual

Called each time the 'client' begins processing (remote 'slaves' do not see this message)

Parameters
inan assignable pointer to a list of objects you want passed to 'preProcessing'. This list is used to communicate with remote slaves. NOTE: you are responsible for deleting this TList and its content once you are done with it.

Implements TFWLiteSelectorBasic.

Definition at line 14 of file ThingsTSelector.cc.

15 {
16 }
ThingsTSelector tfwliteselectortest::ThingsTSelector::operator= ( ThingsTSelector const &  )
private
void ThingsTSelector::postProcessing ( TList &  out)
virtual

Called each time the 'slave' has seen all the events

Parameters
outthe list of objects that will be sent to 'terminate'. You can Add() additional objects to 'out' at this point as well.

Implements TFWLiteSelectorBasic.

Definition at line 76 of file ThingsTSelector.cc.

77 {
78 }
void ThingsTSelector::preProcessing ( const TList *  in,
TList &  out 
)
virtual

Called each time the 'slave' is about to start processing

Parameters
ina pointer to the list of objects created in 'begin()'. The pointer can be 0
outa list of objects that are the result of processing (e.g. histograms). You should call 'Add()' for each object you want sent to the 'terminate' method.

Implements TFWLiteSelectorBasic.

Definition at line 18 of file ThingsTSelector.cc.

References h_a, h_refA, kA, and kRefA.

18  {
19  if(0!=h_a) {
20  out.Remove(h_a);
21  delete h_a;
22  h_a=0;
23  }
24  h_a = new TH1F( kA , "a" , 100, 0, 20 );
25  out.Add(h_a);
26 
27  if(0!=h_refA) {
28  out.Remove(h_refA);
29  delete h_refA;
30  h_refA=0;
31  }
32  h_refA = new TH1F( kRefA , "refA" , 100, 0, 20 );
33  out.Add(h_refA);
34 }
static const char * kA
static const char * kRefA
tuple out
Definition: dbtoconf.py:99
void ThingsTSelector::process ( const edm::Event event)
virtual

Call each time the 'slave' gets a new Event

Parameters
eventa standard edm::Event which works just like it does in cmsRun

Implements TFWLiteSelectorBasic.

Definition at line 36 of file ThingsTSelector.cc.

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

Referenced by ConfigBuilder.ConfigBuilder::addExtraStream(), ConfigBuilder.ConfigBuilder::completeInputCommand(), ConfigBuilder.ConfigBuilder::doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), ConfigBuilder.ConfigBuilder::prepare_FASTSIM(), ConfigBuilder.ConfigBuilder::prepare_HLT(), ConfigBuilder.ConfigBuilder::prepare_LHE(), ConfigBuilder.ConfigBuilder::prepare_VALIDATION(), ConfigBuilder.ConfigBuilder::renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder::renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder::scheduleSequence().

36  {
37  std::cout << "processing event " << std::endl;
38  // chain->GetEntry( entry );
39  using namespace edmtest;
41 
42  try {
43  iEvent.getByLabel("OtherThing", "testUserTag", hOThings);
44  std::cout << ">> other things found:" << hOThings->size() << std::endl;
45 
46  for ( size_t i = 0; i < hOThings->size(); ++i ) {
47  const OtherThing & thing = (*hOThings)[ i ];
48  h_refA ->Fill( thing.ref->a );
49  std::cout << ">> ref->a: " << thing.ref->a << std::endl;
50  }
51 
53  iEvent.getByLabel("Thing",hThings);
54  const ThingCollection& things = *hThings;
55  std::cout << ">> things found:" << things.size() << std::endl;
56  for ( size_t i = 0; i < things.size(); ++i ) {
57  const Thing & thing = things[ i ];
58  h_a ->Fill( thing.a );
59  std::cout << ">> a: " << thing.a << std::endl;
60  }
61  } catch (cms::Exception& x) {
62  std::cout << std::endl << "Failed with cms::Exception: " << std::endl;
63  std::cout << x.what() << std::endl;
64  abort();
65  } catch (std::exception& x) {
66  std::cout << std::endl << "Failed with std::exception" << std::endl;
67  std::cout << x.what() << std::endl;
68  abort();
69  } catch (...) {
70  std::cout << std::endl << "Failed with unknown exception" << std::endl;
71  abort();
72  }
73 
74 }
virtual char const * what() const
Definition: Exception.cc:141
int i
Definition: DBlmapReader.cc:9
int iEvent
Definition: GenABIO.cc:243
tuple cout
Definition: gather_cfg.py:121
Definition: DDAxes.h:10
void ThingsTSelector::terminate ( TList &  out)
virtual

Called each time the 'client' has finished processing.

Parameters
outcontains the accumulated output of all slaves.

Implements TFWLiteSelectorBasic.

Definition at line 80 of file ThingsTSelector.cc.

References svgfig::canvas(), gather_cfg::cout, estimatePileup::hist, kA, and kRefA.

80  {
81  std::cout << "terminate" << std::endl;
82  TCanvas * canvas = new TCanvas( );
83  {
84  TObject* hist = out.FindObject(kA);
85  if(0 != hist) {
86  hist->Draw();
87  canvas->SaveAs( "a.jpg" );
88  } else {
89  std::cout <<"no '"<<kA<<"' histogram"<< std::endl;
90  }
91  }
92  {
93  TObject* hist = out.FindObject(kRefA);
94  if(0 != hist) {
95  hist->Draw();
96  canvas->SaveAs( "refA.jpg" );
97  } else {
98  std::cout <<"no '"<<kRefA<<"' histogram"<< std::endl;
99  }
100  }
101  delete canvas;
102 }
static const char * kA
static const char * kRefA
def canvas
Definition: svgfig.py:481
tuple out
Definition: dbtoconf.py:99
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

TH1F* tfwliteselectortest::ThingsTSelector::h_a
private

histograms

Definition at line 26 of file ThingsTSelector.h.

Referenced by preProcessing(), and process().

TH1F * tfwliteselectortest::ThingsTSelector::h_refA
private

Definition at line 26 of file ThingsTSelector.h.

Referenced by preProcessing(), and process().