CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
MixingWorker Class Reference

#include <MixingWorker.h>

Public Member Functions

template<>
void addPileups (const int bcr, EventPrincipal *ep, unsigned int eventNr, int vertexoffset)
 
template<>
void addPileups (const int bcr, EventPrincipal *ep, unsigned int eventNr, int vertexoffset)
 
template<>
void addPileups (const int bcr, EventPrincipal *ep, unsigned int eventNr, int vertexoffset)
 
template<>
void addPileups (const int bcr, EventPrincipal *ep, unsigned int eventNr, int vertexoffset)
 
template<>
void addPileups (const int bcr, EventPrincipal *ep, unsigned int eventNr, int vertexoffset)
 
template<>
void addPileups (const int bcr, EventPrincipal *ep, unsigned int eventNr, int vertexoffset)
 
template<>
void addPileups (const int bcr, EventPrincipal *ep, unsigned int eventNr, int vertexoffset)
 
template<>
void addPileups (const int bcr, EventPrincipal *ep, unsigned int eventNr, int vertexoffset)
 
template<>
void addSignals (const Event &e)
 
template<>
bool checkSignal (const Event &e)
 

Detailed Description

MixingWorker is an auxiliary class for the MixingModule

Author
Ursula Berthon, LLR Palaiseau
Version
1st Version JMarch 2008

Member Function Documentation

template<>
void MixingWorker< PSimHit >::addPileups ( const int  bcr,
EventPrincipal *  ep,
unsigned int  eventNr,
int  vertexoffset 
)

Definition at line 12 of file MixingWorker.cc.

References LogDebug.

13  {
14  if (!mixProdStep2_){
15  // default version changed for high/low treatment
16  boost::shared_ptr<Wrapper<std::vector<PSimHit> > const> shPtr = getProductByTag<std::vector<PSimHit> >(*ep, tag_);
17  if (shPtr) {
18  LogDebug("MixingModule") <<shPtr->product()->size()<<" pileup objects added, eventNr "<<eventNr;
19  crFrame_->setPileupPtr(shPtr);
20  crFrame_->addPileups(bcr,const_cast< std::vector<PSimHit> * > (shPtr->product()),eventNr);
21  }
22  } else{ // In case mixProdStep2_=true
23  boost::shared_ptr<Wrapper<PCrossingFrame<PSimHit> > const> shPtr = getProductByTag<PCrossingFrame<PSimHit> >(*ep, tag_);
24  if (shPtr) {
25  crFrame_->setPileupPtr(shPtr);
26  secSourceCF_ = const_cast<PCrossingFrame<PSimHit> * >(shPtr->product());
27  LogDebug("MixingModule") << "Add PCrossingFrame<PSimHit>, eventNr " << secSourceCF_->getEventID();
28  copyPCrossingFrame(secSourceCF_);
29  }
30  else
31  LogDebug("MixingModule") << "Could not get the PCrossingFrame<PSimHit>!";
32  }//else mixProd2
33  }
#define LogDebug(id)
template<>
void MixingWorker< SimTrack >::addPileups ( const int  bcr,
EventPrincipal *  ep,
unsigned int  eventNr,
int  vertexoffset 
)

Definition at line 37 of file MixingWorker.cc.

References LogDebug.

38  {
39  if (!mixProdStep2_){
40  // default version changed to transmit vertexoffset
41  boost::shared_ptr<Wrapper<std::vector<SimTrack> > const> shPtr = getProductByTag<std::vector<SimTrack> >(*ep, tag_);
42 
43  if (shPtr) {
44  LogDebug("MixingModule") <<shPtr->product()->size()<<" pileup objects added, eventNr "<<eventNr;
45  crFrame_->setPileupPtr(shPtr);
46  crFrame_->addPileups(bcr,const_cast< std::vector<SimTrack> * > (shPtr->product()),eventNr,vertexoffset);
47  }
48  }
49  else
50  { // In case mixProdStep2_=true
51  boost::shared_ptr<Wrapper<PCrossingFrame<SimTrack> > const> shPtr = getProductByTag<PCrossingFrame<SimTrack> >(*ep, tag_);
52 
53  if (shPtr){
54  crFrame_->setPileupPtr(shPtr);
55  secSourceCF_ = const_cast<PCrossingFrame<SimTrack> * >(shPtr->product());
56  LogDebug("MixingModule") << "Add PCrossingFrame<SimTrack>, eventNr " << secSourceCF_->getEventID();
57 
58  // Get PCrossingFrame data members values from the mixed secondary sources file
59  copyPCrossingFrame(secSourceCF_);
60  }
61  else
62  LogDebug("MixingModule") << "Could not get the PCrossingFrame<SimTrack>!";
63  }
64  }
#define LogDebug(id)
template<>
void MixingWorker< SimVertex >::addPileups ( const int  bcr,
EventPrincipal *  ep,
unsigned int  eventNr,
int  vertexoffset 
)

Definition at line 68 of file MixingWorker.cc.

References LogDebug.

69  {
70 
71  if (!mixProdStep2_){
72  // default version changed to take care of vertexoffset
73  boost::shared_ptr<Wrapper<std::vector<SimVertex> > const> shPtr = getProductByTag<std::vector<SimVertex> >(*ep, tag_);
74 
75  if (shPtr) {
76  LogDebug("MixingModule") <<shPtr->product()->size()<<" pileup objects added, eventNr "<<eventNr;
77  vertexoffset+=shPtr->product()->size();
78  crFrame_->setPileupPtr(shPtr);
79  crFrame_->addPileups(bcr,const_cast< std::vector<SimVertex> * > (shPtr->product()),eventNr);
80  }
81  }
82  else {
83 
84  boost::shared_ptr<Wrapper<PCrossingFrame<SimVertex> > const> shPtr = getProductByTag<PCrossingFrame<SimVertex> >(*ep, tag_);
85 
86  if (shPtr){
87  crFrame_->setPileupPtr(shPtr);
88  secSourceCF_ = const_cast<PCrossingFrame<SimVertex> * >(shPtr->product());
89  LogDebug("MixingModule") << "Add PCrossingFrame<SimVertex>, eventNr " << secSourceCF_->getEventID();
90 
91  copyPCrossingFrame(secSourceCF_);
92  }
93  else
94  LogDebug("MixingModule") << "Could not get the PCrossingFrame<SimVertex>!";
95  }
96  }
#define LogDebug(id)
template<>
void MixingWorker< HepMCProduct >::addPileups ( const int  bcr,
EventPrincipal *  ep,
unsigned int  eventNr,
int  vertexoffset 
)

Definition at line 99 of file MixingWorker.cc.

References LogDebug.

100  {
101  if (!mixProdStep2_){
102  // default version
103  // HepMCProduct does not come as a vector....
104  boost::shared_ptr<Wrapper<HepMCProduct> const> shPtr = getProductByTag<HepMCProduct>(*ep, tag_);
105  if (shPtr) {
106  LogDebug("MixingModule") <<"HepMC pileup objects added, eventNr "<<eventNr;
107  crFrame_->setPileupPtr(shPtr);
108  crFrame_->addPileups(bcr,const_cast<HepMCProduct*> (shPtr->product()),eventNr);
109  }
110  }
111  else {
112  // Mixproduction version: step2
113  boost::shared_ptr<Wrapper<PCrossingFrame<HepMCProduct> > const> shPtr = getProductByTag<PCrossingFrame<HepMCProduct> >(*ep, tag_);
114 
115  if (shPtr){
116  crFrame_->setPileupPtr(shPtr);
117  secSourceCF_ = const_cast<PCrossingFrame<HepMCProduct> * >(shPtr->product());
118  LogDebug("MixingModule") << "Add PCrossingFrame<HepMCProduct>, eventNr " << secSourceCF_->getEventID();
119 
120  copyPCrossingFrame(secSourceCF_);
121  }
122  else
123  LogDebug("MixingModule") << "Could not get the PCrossingFrame<HepMCProduct>!";
124  }
125  }
#define LogDebug(id)
template<>
void MixingWorker< PSimHit >::addPileups ( const int  bcr,
EventPrincipal *  ep,
unsigned int  eventNr,
int  vertexoffset 
)
template<>
void MixingWorker< SimTrack >::addPileups ( const int  bcr,
EventPrincipal *  ep,
unsigned int  eventNr,
int  vertexoffset 
)
template<>
void MixingWorker< SimVertex >::addPileups ( const int  bcr,
EventPrincipal *  ep,
unsigned int  eventNr,
int  vertexoffset 
)
template<>
void MixingWorker< HepMCProduct >::addPileups ( const int  bcr,
EventPrincipal *  ep,
unsigned int  eventNr,
int  vertexoffset 
)
template<>
void MixingWorker< HepMCProduct >::addSignals ( const Event e)

Definition at line 128 of file MixingWorker.cc.

References LogDebug.

129  {
130  if (mixProdStep2_){
131  //HepMC - here the interface is different!!!
132  Handle<HepMCProduct> result_t;
133  bool got = e.getByLabel(tagSignal_,result_t);
134  if (got) {
135  LogDebug("MixingModule") <<" adding HepMCProduct from signal event with "<<tagSignal_;
136  crFrame_->addSignals(result_t.product(),e.id());
137  }
138  else LogInfo("MixingModule") <<"!!!!!!! Did not get any signal data for HepMCProduct with "<<tagSignal_;
139  }
140  else{
141  //HepMC - here the interface is different!!!
142  Handle<HepMCProduct> result_t;
143  bool got = e.getByLabel(tag_,result_t);
144  if (got) {
145  LogDebug("MixingModule") <<" adding HepMCProduct from signal event with "<<tag_;
146  crFrame_->addSignals(result_t.product(),e.id());
147  }
148  else LogInfo("MixingModule") <<"!!!!!!! Did not get any signal data for HepMCProduct with "<<tag_;
149 
150  }
151 
152  }
#define LogDebug(id)
template<>
bool MixingWorker< HepMCProduct >::checkSignal ( const Event e)

Definition at line 155 of file MixingWorker.cc.

References matplotRender::t.

156  {
157  bool got;
158  InputTag t;
159 
160  Handle<HepMCProduct> result_t;
161  if (mixProdStep2_){
162  got = e.getByLabel(tagSignal_,result_t);
163  t = InputTag(tagSignal_.label(),tagSignal_.instance());
164  }
165  else{
166  got = e.getByLabel(tag_,result_t);
167  t = InputTag(tag_.label(),tag_.instance());
168  }
169 
170  if (got)
171  LogInfo("MixingModule") <<" Will create a CrossingFrame for HepMCProduct with "
172  << " with InputTag= "<< t.encode();
173 
174  return got;
175  }