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 
15 
16 #include <memory>
17 #include <vector>
18 
19 class FastTrackerRecHit;
20 
21 namespace edm {
22  class ModuleCallingContext;
23 
24  class AdjusterBase {
25  public:
26  virtual ~AdjusterBase() {}
27  virtual void doOffset(int bunchspace, int bcr, const edm::EventPrincipal&, ModuleCallingContext const*, unsigned int EventNr, int vertexOffset) = 0;
28  virtual bool checkSignal(edm::Event const& event) = 0;
29  };
30 
31  template<typename T>
32  class Adjuster : public AdjusterBase {
33 
34  public:
36 
37  virtual ~Adjuster() {}
38 
39  virtual void doOffset(int bunchspace, int bcr, const edm::EventPrincipal&, ModuleCallingContext const*, unsigned int EventNr, int vertexOffset);
40 
41  virtual bool checkSignal(edm::Event const& event) {
42  bool got = false;
43  edm::Handle<T> result_t;
44  got = event.getByToken(token_, result_t);
45  return got;
46  }
47 
48  private:
51  };
52 
53  //==============================================================================
54  // implementations
55  //==============================================================================
56 
57  namespace detail {
58  void doTheOffset(int bunchspace, int bcr, std::vector<SimTrack>& product, unsigned int eventNr, int vertexOffset);
59  void doTheOffset(int bunchspace, int bcr, std::vector<SimVertex>& product, unsigned int eventNr, int vertexOffset);
60  void doTheOffset(int bunchspace, int bcr, std::vector<PCaloHit>& product, unsigned int eventNr, int vertexOffset);
61  void doTheOffset(int bunchspace, int bcr, std::vector<PSimHit>& product, unsigned int eventNr, int vertexOffset);
62  void doTheOffset(int bunchspace, int bcr, TrackingRecHitCollection & product, unsigned int eventNr, int vertexOffset);
63  }
64 
65  template<typename T>
66  void Adjuster<T>::doOffset(int bunchspace, int bcr, const EventPrincipal &ep, ModuleCallingContext const* mcc, unsigned int eventNr, int vertexOffset) {
67  std::shared_ptr<Wrapper<T> const> shPtr = getProductByTag<T>(ep, tag_, mcc);
68  if (shPtr) {
69  T& product = const_cast<T&>(*shPtr->product());
70  detail::doTheOffset(bunchspace, bcr, product, eventNr, vertexOffset);
71  }
72  }
73 
74  template<typename T>
75  Adjuster<T>::Adjuster(InputTag const& tag, ConsumesCollector&& iC) : tag_(tag), token_(iC.consumes<T>(tag)) {
76  }
77 }
78 
79 #endif
virtual ~Adjuster()
Definition: Adjuster.h:37
void doTheOffset(int bunchSpace, int bcr, std::vector< SimTrack > &simtracks, unsigned int evtNr, int vertexOffset)
Definition: Adjuster.cc:7
virtual void doOffset(int bunchspace, int bcr, const edm::EventPrincipal &, ModuleCallingContext const *, unsigned int EventNr, int vertexOffset)=0
virtual ~AdjusterBase()
Definition: Adjuster.h:26
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:66
virtual bool checkSignal(edm::Event const &event)
Definition: Adjuster.h:41
EDGetTokenT< T > token_
Definition: Adjuster.h:50
virtual bool checkSignal(edm::Event const &event)=0
long double T
Adjuster(InputTag const &tag, edm::ConsumesCollector &&iC)
Definition: Adjuster.h:75
InputTag tag_
Definition: Adjuster.h:49