CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Adjuster.h
Go to the documentation of this file.
1 #ifndef SimGeneral_MixingModule_Adjuster_h
2 #define SimGeneral_MixingModule_Adjuster_h
3 
12 
13 #include "boost/shared_ptr.hpp"
14 
15 #include <vector>
16 
17 namespace edm {
18  class ModuleCallingContext;
19 
20  class AdjusterBase {
21  public:
22  virtual ~AdjusterBase() {}
23  virtual void doOffset(int bunchspace, int bcr, const edm::EventPrincipal&, ModuleCallingContext const*, unsigned int EventNr, int vertexOffset) = 0;
24  virtual bool checkSignal(edm::Event const& event) = 0;
25  };
26 
27  template<typename T>
28  class Adjuster : public AdjusterBase {
29 
30  public:
31  Adjuster(InputTag const& tag);
32 
33  virtual ~Adjuster() {}
34 
35  virtual void doOffset(int bunchspace, int bcr, const edm::EventPrincipal&, ModuleCallingContext const*, unsigned int EventNr, int vertexOffset);
36 
37  virtual bool checkSignal(edm::Event const& event) {
38  bool got = false;
39  edm::Handle<std::vector<T> > result_t;
40  got = event.getByLabel(tag_, result_t);
41  return got;
42  }
43 
44  private:
46  };
47 
48  //==============================================================================
49  // implementations
50  //==============================================================================
51 
52  namespace detail {
53  void doTheOffset(int bunchspace, int bcr, std::vector<SimTrack>& product, unsigned int eventNr, int vertexOffset);
54  void doTheOffset(int bunchspace, int bcr, std::vector<SimVertex>& product, unsigned int eventNr, int vertexOffset);
55  void doTheOffset(int bunchspace, int bcr, std::vector<PCaloHit>& product, unsigned int eventNr, int vertexOffset);
56  void doTheOffset(int bunchspace, int bcr, std::vector<PSimHit>& product, unsigned int eventNr, int vertexOffset);
57  }
58 
59  template<typename T>
60  void Adjuster<T>::doOffset(int bunchspace, int bcr, const EventPrincipal &ep, ModuleCallingContext const* mcc, unsigned int eventNr, int vertexOffset) {
61  boost::shared_ptr<Wrapper<std::vector<T> > const> shPtr = getProductByTag<std::vector<T> >(ep, tag_, mcc);
62  if (shPtr) {
63  std::vector<T>& product = const_cast<std::vector<T>&>(*shPtr->product());
64  detail::doTheOffset(bunchspace, bcr, product, eventNr, vertexOffset);
65  }
66  }
67 
68  template<typename T>
69  Adjuster<T>::Adjuster(InputTag const& tag) : tag_(tag) {
70  }
71 }
72 
73 #endif
virtual ~Adjuster()
Definition: Adjuster.h:33
void doTheOffset(int bunchSpace, int bcr, std::vector< SimTrack > &simtracks, unsigned int evtNr, int vertexOffset)
Definition: Adjuster.cc:6
virtual void doOffset(int bunchspace, int bcr, const edm::EventPrincipal &, ModuleCallingContext const *, unsigned int EventNr, int vertexOffset)=0
virtual ~AdjusterBase()
Definition: Adjuster.h:22
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
virtual void doOffset(int bunchspace, int bcr, const edm::EventPrincipal &, ModuleCallingContext const *, unsigned int EventNr, int vertexOffset)
Definition: Adjuster.h:60
virtual bool checkSignal(edm::Event const &event)
Definition: Adjuster.h:37
Adjuster(InputTag const &tag)
Definition: Adjuster.h:69
virtual bool checkSignal(edm::Event const &event)=0
InputTag tag_
Definition: Adjuster.h:45