CMS 3D CMS Logo

edm::BMixingModule Class Reference

#include <Mixing/Base/interface/BMixingModule.h>

Inheritance diagram for edm::BMixingModule:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper edm::DataMixingModule edm::MixingModule

List of all members.

Public Types

typedef
PileUp::EventPrincipalVector 
EventPrincipalVector

Public Member Functions

virtual void addPileups (const int bcr, edm::Event *, unsigned int eventId, unsigned int worker)
virtual void addSignals (const edm::Event &e)
double averageNumber () const
 BMixingModule (const edm::ParameterSet &ps)
 standard constructor
virtual void createnewEDProduct ()
virtual void doPileUp (edm::Event &e)
virtual void getEventStartInfo (edm::Event &e, const unsigned int source)
void merge (const int bcr, const EventPrincipalVector &vec, unsigned int worker)
bool poisson () const
virtual void produce (edm::Event &e1, const edm::EventSetup &c)
 Cumulates the pileup events onto this event.
virtual void put (edm::Event &e)
virtual void setBcrOffset ()
virtual void setEventStartInfo (const unsigned int s)
virtual void setSourceOffset (const unsigned int s)
virtual ~BMixingModule ()
 Default destructor.

Protected Member Functions

void dropUnwantedBranches (std::vector< std::string > const &wantedBranches)
virtual void endJob ()

Protected Attributes

int bunchSpace_
bool checktof_
bool doit_ [5]
std::vector< edm::EventIDeventIDs_
std::vector< intfileSeqNrs_
int const maxBunch_
int const minBunch_
std::vector< unsigned intnrEvents_
std::vector< EventPrincipalVectorpileup_ [5]
bool playback_

Static Protected Attributes

static const unsigned int maxNbSources_ = 5
static int vertexoffset = 0

Private Attributes

boost::shared_ptr< PileUpbeamHalo_m_
boost::shared_ptr< PileUpbeamHalo_p_
boost::shared_ptr< PileUpcosmics_
unsigned int eventId_
boost::shared_ptr< PileUpfwdDet_
boost::shared_ptr< PileUpinput_
ModuleDescription md_


Detailed Description

Definition at line 28 of file BMixingModule.h.


Member Typedef Documentation

typedef PileUp::EventPrincipalVector edm::BMixingModule::EventPrincipalVector

Definition at line 30 of file BMixingModule.h.


Constructor & Destructor Documentation

BMixingModule::BMixingModule ( const edm::ParameterSet ps  )  [explicit]

standard constructor

Definition at line 71 of file BMixingModule.cc.

References beamHalo_m_, beamHalo_p_, cosmics_, eventIDs_, fileSeqNrs_, find(), fwdDet_, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), edm::getPassID(), edm::getReleaseVersion(), edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::id(), input_, maxBunch_, maybeMakePileUp(), md_, minBunch_, edm::ModuleDescription::moduleLabel_, edm::ModuleDescription::moduleName_, names, nrEvents_, edm::ModuleDescription::parameterSetID_, playback_, and edm::ModuleDescription::processConfiguration_.

00071                                                           :
00072     bunchSpace_(pset.getParameter<int>("bunchspace")),
00073     checktof_(pset.getUntrackedParameter<bool>("checktof",true)),
00074     minBunch_((pset.getParameter<int>("minBunch")*25)/pset.getParameter<int>("bunchspace")),
00075     maxBunch_((pset.getParameter<int>("maxBunch")*25)/pset.getParameter<int>("bunchspace")),
00076 //     input_(maybeMakePileUp(pset,"input",minBunch_,maxBunch_)),
00077 //     cosmics_(maybeMakePileUp(pset,"cosmics",minBunch_,maxBunch_)),
00078 //     beamHalo_p_(maybeMakePileUp(pset,"beamhalo_plus",minBunch_,maxBunch_)),
00079 //     beamHalo_m_(maybeMakePileUp(pset,"beamhalo_minus",minBunch_,maxBunch_)),
00080     md_()
00081   {
00082     md_.parameterSetID_ = pset.id();
00083     md_.moduleName_ = pset.getParameter<std::string>("@module_type");
00084     md_.moduleLabel_ = pset.getParameter<std::string>("@module_label");
00085     //#warning process name is hard coded, for now.  Fix this.
00086     //#warning the parameter set ID passed should be the one for the full process.  Fix this.
00087     md_.processConfiguration_ = ProcessConfiguration("PILEUP", pset.id(), getReleaseVersion(), getPassID());
00088     // FIXME: temporary to keep bwds compatibility for cfg files
00089     vector<string> names = pset.getParameterNames();
00090     if (find(names.begin(), names.end(),"playback")
00091         != names.end()) {
00092       playback_=pset.getUntrackedParameter<bool>("playback");
00093       if (playback_) LogInfo("MixingModule") <<" Mixing will be done in playback mode!";
00094     } else
00095       playback_=false;
00096 
00097     input_=     maybeMakePileUp(pset,"input",minBunch_,maxBunch_,playback_);
00098     cosmics_=   maybeMakePileUp(pset,"cosmics",minBunch_,maxBunch_,playback_);
00099     beamHalo_p_=maybeMakePileUp(pset,"beamhalo_plus",minBunch_,maxBunch_,playback_);
00100     beamHalo_m_=maybeMakePileUp(pset,"beamhalo_minus",minBunch_,maxBunch_,playback_);
00101     fwdDet_=maybeMakePileUp(pset,"forwardDetectors",minBunch_,maxBunch_,playback_);
00102 
00103     //prepare playback info structures
00104     fileSeqNrs_.resize(maxBunch_-minBunch_+1);
00105     eventIDs_.resize(maxBunch_-minBunch_+1);
00106     nrEvents_.resize(maxBunch_-minBunch_+1);
00107   }

BMixingModule::~BMixingModule (  )  [virtual]

Default destructor.

Definition at line 110 of file BMixingModule.cc.

00110 {;}


Member Function Documentation

virtual void edm::BMixingModule::addPileups ( const int  bcr,
edm::Event ,
unsigned int  eventId,
unsigned int  worker 
) [inline, virtual]

Reimplemented in edm::DataMixingModule, and edm::MixingModule.

Definition at line 52 of file BMixingModule.h.

00052 {;}

virtual void edm::BMixingModule::addSignals ( const edm::Event e  )  [inline, virtual]

Reimplemented in edm::DataMixingModule, and edm::MixingModule.

Definition at line 51 of file BMixingModule.h.

00051 {;}

double edm::BMixingModule::averageNumber (  )  const [inline]

Definition at line 44 of file BMixingModule.h.

References input_.

00044 {return input_ ? input_->averageNumber() : 0.0;}

virtual void edm::BMixingModule::createnewEDProduct (  )  [inline, virtual]

Reimplemented in edm::DataMixingModule, and edm::MixingModule.

Definition at line 49 of file BMixingModule.h.

References GenMuonPlsPt100GeV_cfg::cout, and lat::endl().

00049 {std::cout << "BMixingModule::createnewEDProduct must be overwritten!" << std::endl;}

virtual void edm::BMixingModule::doPileUp ( edm::Event e  )  [inline, virtual]

Reimplemented in edm::DataMixingModule, and edm::MixingModule.

Definition at line 56 of file BMixingModule.h.

References GenMuonPlsPt100GeV_cfg::cout, and lat::endl().

00056 {std::cout << "BMixingModule::doPileUp must be overwritten!" << std::endl;}

void BMixingModule::dropUnwantedBranches ( std::vector< std::string > const &  wantedBranches  )  [protected]

Definition at line 220 of file BMixingModule.cc.

00220                                                                                      {
00221       if (input_) input_->dropUnwantedBranches(wantedBranches);
00222       if (cosmics_) cosmics_->dropUnwantedBranches(wantedBranches);
00223       if (beamHalo_p_) beamHalo_p_->dropUnwantedBranches(wantedBranches);
00224       if (beamHalo_m_) beamHalo_m_->dropUnwantedBranches(wantedBranches);
00225       if (fwdDet_) fwdDet_->dropUnwantedBranches(wantedBranches);
00226   }

void BMixingModule::endJob ( void   )  [protected, virtual]

Reimplemented from edm::EDProducer.

Definition at line 228 of file BMixingModule.cc.

00228                              {
00229       if (input_) input_->endJob();
00230       if (cosmics_) cosmics_->endJob();
00231       if (beamHalo_p_) beamHalo_p_->endJob();
00232       if (beamHalo_m_) beamHalo_m_->endJob();
00233       if (fwdDet_) fwdDet_->endJob();
00234   }

virtual void edm::BMixingModule::getEventStartInfo ( edm::Event e,
const unsigned int  source 
) [inline, virtual]

Reimplemented in edm::MixingModule.

Definition at line 58 of file BMixingModule.h.

00058 {;} //to be set locally

void BMixingModule::merge ( const int  bcr,
const EventPrincipalVector vec,
unsigned int  worker 
)

Definition at line 206 of file BMixingModule.cc.

References MixingModule::addPileups(), e, edm::Event::id(), it, LogDebug, and md_.

00206                                                                                                {
00207     //
00208     // main loop: loop over events and merge 
00209     //
00210     eventId_=0;
00211     LogDebug("MixingModule") <<"For bunchcrossing "<<bcr<<", "<<vec.size()<< " events will be merged";
00212     vertexoffset=0;
00213     for (EventPrincipalVector::const_iterator it = vec.begin(); it != vec.end(); ++it) {
00214       Event e(**it, md_);
00215       LogDebug("MixingModule") <<" merging Event:  id " << e.id();
00216       addPileups(bcr, &e, ++eventId_,worker);
00217     }// end main loop
00218   }

bool edm::BMixingModule::poisson (  )  const [inline]

Definition at line 47 of file BMixingModule.h.

References input_.

00047 {return input_ ? input_->poisson() : 0.0 ;}

void BMixingModule::produce ( edm::Event e1,
const edm::EventSetup c 
) [virtual]

Cumulates the pileup events onto this event.

Implements edm::EDProducer.

Definition at line 113 of file BMixingModule.cc.

References MixingModule::addSignals(), MixingModule::createnewEDProduct(), MixingModule::doPileUp(), MixingModule::getEventStartInfo(), edm::Event::id(), LogDebug, MixingModule::put(), and MixingModule::setEventStartInfo().

00113                                                                { 
00114 
00115     // Create EDProduct
00116     createnewEDProduct();
00117 
00118     // Add signals 
00119     addSignals(e);
00120 
00121     // Read the PileUp 
00122     //    std::vector<EventPrincipalVector> pileup[maxNbSources_];
00123     //    bool doit[maxNbSources_];
00124     for (unsigned int is=0;is< maxNbSources_;++is) {
00125       doit_[is]=false;
00126       pileup_[is].clear();
00127     }
00128 
00129     if ( input_)  {  
00130       if (playback_) {
00131         getEventStartInfo(e,0);
00132         input_->readPileUp(pileup_[0],eventIDs_, fileSeqNrs_, nrEvents_);
00133       } else {
00134         input_->readPileUp(pileup_[0],eventIDs_, fileSeqNrs_, nrEvents_); 
00135         setEventStartInfo(0);
00136       }
00137       if (input_->doPileup()) {  
00138         LogDebug("MixingModule") <<"\n\n==============================>Adding pileup to signal event "<<e.id(); 
00139         doit_[0]=true;
00140       } 
00141     }
00142     if (cosmics_) {
00143       if (playback_) {
00144         getEventStartInfo(e,1);
00145         cosmics_->readPileUp(pileup_[1],eventIDs_, fileSeqNrs_, nrEvents_); 
00146       } else {
00147         cosmics_->readPileUp(pileup_[1],eventIDs_, fileSeqNrs_, nrEvents_); 
00148         setEventStartInfo(1);
00149       }
00150       if (cosmics_->doPileup()) {  
00151         LogDebug("MixingModule") <<"\n\n==============================>Adding cosmics to signal event "<<e.id(); 
00152         doit_[1]=true;
00153       } 
00154     }
00155 
00156     if (beamHalo_p_) {
00157       if (playback_) {
00158         getEventStartInfo(e,2);
00159         beamHalo_p_->readPileUp(pileup_[2],eventIDs_, fileSeqNrs_, nrEvents_);
00160       } else {
00161         beamHalo_p_->readPileUp(pileup_[2],eventIDs_, fileSeqNrs_, nrEvents_);
00162         setEventStartInfo(2);
00163       }
00164       if (beamHalo_p_->doPileup()) {  
00165         LogDebug("MixingModule") <<"\n\n==============================>Adding beam halo+ to signal event "<<e.id();
00166         doit_[2]=true;
00167       } 
00168     }
00169 
00170     if (beamHalo_m_) {
00171       if (playback_) {
00172         getEventStartInfo(e,3);
00173         beamHalo_m_->readPileUp(pileup_[3],eventIDs_, fileSeqNrs_, nrEvents_);
00174       } else {
00175         beamHalo_m_->readPileUp(pileup_[3],eventIDs_, fileSeqNrs_, nrEvents_);
00176         setEventStartInfo(3);
00177       }
00178       if (beamHalo_m_->doPileup()) {  
00179         LogDebug("MixingModule") <<"\n\n==============================>Adding beam halo- to signal event "<<e.id();
00180         doit_[3]=true;
00181       }
00182     }
00183 
00184     if (fwdDet_) {
00185       if (playback_) {
00186         getEventStartInfo(e,4);
00187         fwdDet_->readPileUp(pileup_[4],eventIDs_, fileSeqNrs_, nrEvents_);
00188       } else {
00189         fwdDet_->readPileUp(pileup_[4],eventIDs_, fileSeqNrs_, nrEvents_);
00190         setEventStartInfo(4);
00191       }
00192 
00193       if (fwdDet_->doPileup()) {  
00194         LogDebug("MixingModule") <<"\n\n==============================>Adding fwd detector source  to signal event "<<e.id();
00195         doit_[4]=true;
00196       }  
00197     }
00198 
00199     doPileUp(e);
00200 
00201     // Put output into event (here only playback info)
00202     put(e);
00203   }

virtual void edm::BMixingModule::put ( edm::Event e  )  [inline, virtual]

Reimplemented in edm::DataMixingModule, and edm::MixingModule.

Definition at line 55 of file BMixingModule.h.

00055 {;}

virtual void edm::BMixingModule::setBcrOffset (  )  [inline, virtual]

Reimplemented in edm::DataMixingModule.

Definition at line 53 of file BMixingModule.h.

References GenMuonPlsPt100GeV_cfg::cout, and lat::endl().

00053 {std::cout << "BMixingModule::setBcrOffset must be overwritten!" << std::endl;} //FIXME: LogWarning

virtual void edm::BMixingModule::setEventStartInfo ( const unsigned int  s  )  [inline, virtual]

Reimplemented in edm::MixingModule.

Definition at line 57 of file BMixingModule.h.

00057 {;} //to be set in CF

virtual void edm::BMixingModule::setSourceOffset ( const unsigned int  s  )  [inline, virtual]

Reimplemented in edm::DataMixingModule.

Definition at line 54 of file BMixingModule.h.

References GenMuonPlsPt100GeV_cfg::cout, and lat::endl().

00054 {std::cout << "BMixingModule::setSourceOffset must be overwritten!" << std::endl;}


Member Data Documentation

boost::shared_ptr<PileUp> edm::BMixingModule::beamHalo_m_ [private]

Definition at line 83 of file BMixingModule.h.

Referenced by BMixingModule().

boost::shared_ptr<PileUp> edm::BMixingModule::beamHalo_p_ [private]

Definition at line 82 of file BMixingModule.h.

Referenced by BMixingModule().

int edm::BMixingModule::bunchSpace_ [protected]

Definition at line 63 of file BMixingModule.h.

bool edm::BMixingModule::checktof_ [protected]

Definition at line 65 of file BMixingModule.h.

boost::shared_ptr<PileUp> edm::BMixingModule::cosmics_ [private]

Definition at line 81 of file BMixingModule.h.

Referenced by BMixingModule().

bool edm::BMixingModule::doit_[5] [protected]

Definition at line 75 of file BMixingModule.h.

unsigned int edm::BMixingModule::eventId_ [private]

Definition at line 87 of file BMixingModule.h.

std::vector<edm::EventID> edm::BMixingModule::eventIDs_ [protected]

Definition at line 71 of file BMixingModule.h.

Referenced by BMixingModule().

std::vector<int> edm::BMixingModule::fileSeqNrs_ [protected]

Definition at line 72 of file BMixingModule.h.

Referenced by BMixingModule().

boost::shared_ptr<PileUp> edm::BMixingModule::fwdDet_ [private]

Definition at line 84 of file BMixingModule.h.

Referenced by BMixingModule().

boost::shared_ptr<PileUp> edm::BMixingModule::input_ [private]

Definition at line 80 of file BMixingModule.h.

Referenced by averageNumber(), BMixingModule(), and poisson().

int const edm::BMixingModule::maxBunch_ [protected]

Definition at line 67 of file BMixingModule.h.

Referenced by BMixingModule().

const unsigned int BMixingModule::maxNbSources_ = 5 [static, protected]

Definition at line 74 of file BMixingModule.h.

ModuleDescription edm::BMixingModule::md_ [private]

Definition at line 85 of file BMixingModule.h.

Referenced by BMixingModule().

int const edm::BMixingModule::minBunch_ [protected]

Definition at line 66 of file BMixingModule.h.

Referenced by BMixingModule().

std::vector<unsigned int> edm::BMixingModule::nrEvents_ [protected]

Definition at line 73 of file BMixingModule.h.

Referenced by BMixingModule().

std::vector<EventPrincipalVector> edm::BMixingModule::pileup_[5] [protected]

Definition at line 76 of file BMixingModule.h.

bool edm::BMixingModule::playback_ [protected]

Definition at line 70 of file BMixingModule.h.

Referenced by BMixingModule().

int BMixingModule::vertexoffset = 0 [static, protected]

Definition at line 64 of file BMixingModule.h.


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:39:39 2009 for CMSSW by  doxygen 1.5.4