CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IsTBH4Type.cc
Go to the documentation of this file.
1 //
2 // Original Author: Pietro Govoni
3 // Created: Thu Aug 10 16:21:22 CEST 2006
4 //
5 //
6 
7 
8 // system include files
9 #include <memory>
10 
11 // user include files
14 
19 
22 
23 //
24 // constants, enums and typedefs
25 //
26 
27 //
28 // static data member definitions
29 //
30 
31 //
32 // constructors and destructor
33 //
35 {
36  //now do what ever initialization is needed
37  eventHeaderCollection_ = iConfig.getParameter<std::string> ("eventHeaderCollection") ;
38  eventHeaderProducer_ = iConfig.getParameter<std::string> ("eventHeaderProducer") ;
39  typeToFlag_ = iConfig.getParameter<std::string> ("typeToFlag") ;
40  notFound_ = iConfig.getUntrackedParameter<bool> ("ifHeaderNotFound",false) ;
41 }
42 
43 
45 {
46  // do anything here that needs to be done at desctruction time
47  // (e.g. close files, deallocate resources etc.)
48 }
49 
50 
51 //
52 // member functions
53 //
54 
55 // ------------ method called to produce the data ------------
56 bool
58 {
59 
60  using namespace edm;
61 
62  Handle<EcalTBEventHeader> pEventHeader ;
63  const EcalTBEventHeader* evtHeader=0 ;
64  iEvent.getByLabel ( eventHeaderProducer_ , pEventHeader ) ;
65  if (!pEventHeader.isValid()) {
66  edm::LogError("IsTBH4Type") << "Event Header collection not found" ;
67  } else {
68  evtHeader = pEventHeader.product () ; // get a ptr to the product
69  }
70 
71  if (!evtHeader) return notFound_ ;
72 // std::cout << "PIETRO " << evtHeader->eventType () << std::endl ;
73 // std::cout << "PIETRO " << (evtHeader->eventType () != typeToFlag_) << std::endl ;
74  if (evtHeader->eventType () != typeToFlag_) return false ;
75 
76  return true;
77 }
78 
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string typeToFlag_
type of run to flag
Definition: IsTBH4Type.h:52
std::string eventHeaderCollection_
collection of the event header
Definition: IsTBH4Type.h:48
int iEvent
Definition: GenABIO.cc:230
bool notFound_
what to return in case no header is found
Definition: IsTBH4Type.h:54
virtual bool filter(edm::Event &, const edm::EventSetup &)
Definition: IsTBH4Type.cc:57
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:420
std::string eventHeaderProducer_
producer of the event header
Definition: IsTBH4Type.h:50
IsTBH4Type(const edm::ParameterSet &)
Definition: IsTBH4Type.cc:34