Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 23:31:14

0001 #ifndef CROSSING_FRAME_PLAYBACKINFONEW_H
0002 #define CROSSING_FRAME_PLAYBACKINFONEW_H
0003 
0004 /** \class CrossingFramePlaybackInfoNew
0005  *
0006  * CrossingFramePlaybackInfoNew is written by the Sim Mixing Module
0007  * it contains information to allow a 'playback' of the MixingModule
0008  * i.e to find again, on an event/event basis, exactly the same events to superpose
0009  *
0010  * \author Bill Tanenbaum
0011  *
0012  * \version   1st Version Feb 2015
0013  *
0014  ************************************************************/
0015 
0016 #include "DataFormats/Common/interface/SecondaryEventIDAndFileInfo.h"
0017 #include "DataFormats/Provenance/interface/EventID.h"
0018 #include <iterator>
0019 #include <vector>
0020 #include <utility>
0021 
0022 class CrossingFramePlaybackInfoNew {
0023 public:
0024   // con- and destructors
0025 
0026   CrossingFramePlaybackInfoNew() {}
0027   CrossingFramePlaybackInfoNew(int minBunch, int maxBunch, unsigned int maxNbSources);
0028 
0029   ~CrossingFramePlaybackInfoNew() {}
0030 
0031   typedef std::vector<edm::SecondaryEventIDAndFileInfo>::iterator iterator;
0032   typedef std::pair<iterator, iterator> range;
0033 
0034   // setter
0035   void setInfo(std::vector<edm::SecondaryEventIDAndFileInfo>& eventInfo, std::vector<size_t>& sizes) {
0036     sizes_.swap(sizes);
0037     eventInfo_.swap(eventInfo);
0038   }
0039 
0040   // getters
0041   std::vector<edm::SecondaryEventIDAndFileInfo>::const_iterator getEventId(size_t offset) const {
0042     std::vector<edm::SecondaryEventIDAndFileInfo>::const_iterator iter = eventInfo_.begin();
0043     std::advance(iter, offset);
0044     return iter;
0045   }
0046 
0047   size_t getNumberOfEvents(int bunchIdx, size_t sourceNumber) const {
0048     return sizes_[((bunchIdx - minBunch_) * maxNbSources_) + sourceNumber];
0049   }
0050 
0051   //private:
0052 
0053   // we need the same info for each bunchcrossing
0054   unsigned int maxNbSources_;
0055   int nBcrossings_;
0056   std::vector<size_t> sizes_;
0057   std::vector<edm::SecondaryEventIDAndFileInfo> eventInfo_;
0058   int minBunch_;
0059 };
0060 
0061 #endif