CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Attributes
edm::DataMixingSiStripRawWorker Class Reference

#include <DataMixingSiStripRawWorker.h>

Public Member Functions

void addSiStripPileups (const int bcr, const edm::EventPrincipal *, unsigned int EventId)
 
void addSiStripSignals (const edm::Event &e)
 
 DataMixingSiStripRawWorker ()
 
 DataMixingSiStripRawWorker (const edm::ParameterSet &ps)
 
void putSiStrip (edm::Event &e)
 
virtual ~DataMixingSiStripRawWorker ()
 

Private Types

typedef std::vector< SiStripDigiOneDetectorMap
 
typedef std::map< uint32_t,
OneDetectorMap
SiGlobalIndex
 

Private Attributes

const edm::DetSetVector
< SiStripDigi > * 
digicollection_
 
std::string label_
 
const edm::DetSetVector
< SiStripRawDigi > * 
rawdigicollection_
 
Selectorsel_
 
SiGlobalIndex SiHitStorage_
 
edm::InputTag Sistripdigi_collectionSig_
 
std::string SiStripDigiCollectionDM_
 
edm::InputTag SistripLabelSig_
 
edm::InputTag SiStripPileInputTag_
 
std::string SiStripRawDigiSource_
 
edm::InputTag SiStripRawInputTag_
 

Detailed Description

Definition at line 37 of file DataMixingSiStripRawWorker.h.

Member Typedef Documentation

Definition at line 66 of file DataMixingSiStripRawWorker.h.

Definition at line 67 of file DataMixingSiStripRawWorker.h.

Constructor & Destructor Documentation

DataMixingSiStripRawWorker::DataMixingSiStripRawWorker ( )

Definition at line 26 of file DataMixingSiStripRawWorker.cc.

DataMixingSiStripRawWorker::DataMixingSiStripRawWorker ( const edm::ParameterSet ps)
explicit

standard constructor

Definition at line 29 of file DataMixingSiStripRawWorker.cc.

References edm::ParameterSet::getParameter(), label_, sel_, SiHitStorage_, Sistripdigi_collectionSig_, SiStripDigiCollectionDM_, SistripLabelSig_, SiStripPileInputTag_, SiStripRawDigiSource_, and SiStripRawInputTag_.

29  :
30  label_(ps.getParameter<std::string>("Label"))
31 
32  {
33 
34  // get the subdetector names
35  // this->getSubdetectorNames(); //something like this may be useful to check what we are supposed to do...
36 
37  // create input selector
38  if (label_.size()>0){
39  sel_=new Selector( ModuleLabelSelector(label_));
40  }
41  else {
42  sel_=new Selector( MatchAllSelector());
43  }
44 
45  // declare the products to produce
46 
47  Sistripdigi_collectionSig_ = ps.getParameter<edm::InputTag>("SistripdigiCollectionSig");
48  SistripLabelSig_ = ps.getParameter<edm::InputTag>("SistripLabelSig");
49 
50  SiStripPileInputTag_ = ps.getParameter<edm::InputTag>("SiStripPileInputTag");
51  SiStripRawInputTag_ = ps.getParameter<edm::InputTag>("SiStripRawInputTag");
52 
53  SiStripDigiCollectionDM_ = ps.getParameter<std::string>("SiStripDigiCollectionDM");
54 
55  SiStripRawDigiSource_ = ps.getParameter<std::string>("SiStripRawDigiSource");
56 
57  // clear local storage for this event
58  SiHitStorage_.clear();
59 
60  }
T getParameter(std::string const &) const
Functor that operates on &lt;T&gt;
Definition: Selector.h:25
DataMixingSiStripRawWorker::~DataMixingSiStripRawWorker ( )
virtual

Default destructor

Definition at line 64 of file DataMixingSiStripRawWorker.cc.

References sel_.

64  {
65  delete sel_;
66  sel_=0;
67  }

Member Function Documentation

void DataMixingSiStripRawWorker::addSiStripPileups ( const int  bcr,
const edm::EventPrincipal ep,
unsigned int  EventId 
)

Definition at line 92 of file DataMixingSiStripRawWorker.cc.

References gather_cfg::cout, digicollection_, edm::EventPrincipal::id(), LogDebug, rawdigicollection_, SiStripPileInputTag_, SiStripRawDigiSource_, and SiStripRawInputTag_.

Referenced by edm::DataMixingModule::pileWorker().

92  {
93 
94  LogDebug("DataMixingSiStripRawWorker") << "\n===============> adding pileups from event "
95  << ep->id() << " for bunchcrossing " << bcr;
96 
97  boost::shared_ptr<Wrapper<edm::DetSetVector<SiStripDigi> > const> pSSD;
98  boost::shared_ptr<Wrapper<edm::DetSetVector<SiStripRawDigi> > const> pSSRD;
99 
100  if (SiStripRawDigiSource_=="SIGNAL") {
101  pSSD = getProductByTag<edm::DetSetVector<SiStripDigi> >(*ep, SiStripPileInputTag_);
102  digicollection_ = const_cast< edm::DetSetVector<SiStripDigi> * >(pSSD->product());
103  } else if (SiStripRawDigiSource_=="PILEUP") {
104  pSSRD = getProductByTag<edm::DetSetVector<SiStripRawDigi> >(*ep, SiStripRawInputTag_ );
105  rawdigicollection_ = const_cast< edm::DetSetVector<SiStripRawDigi> * >(pSSRD->product());
106  } else {
107  std::cout << "you shouldn't be here" << std::endl;
108  }
109 
110  } // end of addSiStripPileups
#define LogDebug(id)
const edm::DetSetVector< SiStripDigi > * digicollection_
EventID const & id() const
tuple cout
Definition: gather_cfg.py:121
const edm::DetSetVector< SiStripRawDigi > * rawdigicollection_
void DataMixingSiStripRawWorker::addSiStripSignals ( const edm::Event e)

Definition at line 71 of file DataMixingSiStripRawWorker.cc.

References gather_cfg::cout, digicollection_, edm::Event::getByLabel(), edm::InputTag::label(), edm::Handle< T >::product(), rawdigicollection_, Sistripdigi_collectionSig_, SistripLabelSig_, SiStripRawDigiSource_, and SiStripRawInputTag_.

Referenced by edm::DataMixingModule::addSignals().

71  {
72 
73 
76 
77  if (SiStripRawDigiSource_=="SIGNAL") {
79  rawdigicollection_ = hSSRD.product();
80  } else if (SiStripRawDigiSource_=="PILEUP") {
82  digicollection_ = hSSD.product();
83  } else {
84  std::cout << "you shouldn't be here" << std::endl;
85  }
86 
87 
88  } // end of addSiStripSignals
const edm::DetSetVector< SiStripDigi > * digicollection_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
T const * product() const
Definition: Handle.h:74
std::string const & label() const
Definition: InputTag.h:25
tuple cout
Definition: gather_cfg.py:121
const edm::DetSetVector< SiStripRawDigi > * rawdigicollection_
void DataMixingSiStripRawWorker::putSiStrip ( edm::Event e)

Definition at line 113 of file DataMixingSiStripRawWorker.cc.

References begin, edm::DetSetVector< T >::begin(), digicollection_, end, edm::DetSetVector< T >::end(), edm::DetSetVector< T >::insert(), LogDebug, edm::DetSet< T >::push_back(), edm::Event::put(), rawdigicollection_, SiHitStorage_, and SiStripDigiCollectionDM_.

Referenced by edm::DataMixingModule::put().

113  {
114 
115 
116  //------------------
117  // (1) Fill a map from the Digi collection
118  //
119 
120  // fill in maps of SiStripDigis
121  OneDetectorMap LocalMap;
122 
123  //loop on all detsets (detectorIDs) inside the input collection
125  for (; DSViter!=digicollection_->end();DSViter++){
126 
127 #ifdef DEBUG
128  LogDebug("DataMixingSiStripRawWorker") << "Processing DetID " << DSViter->id;
129 #endif
130 
131  LocalMap.clear();
132  LocalMap.reserve((DSViter->data).size());
133  LocalMap.insert(LocalMap.end(),(DSViter->data).begin(),(DSViter->data).end());
134 
135  SiHitStorage_.insert( SiGlobalIndex::value_type( DSViter->id, LocalMap ) );
136  }
137 
138 
139  //------------------
140  // (2) Loop over the input RawDigi collection and add the Digis from the map
141  //
142 
143  // collection of RawDigis to put back in the event
144  std::vector< edm::DetSet<SiStripRawDigi> > vSiStripRawDigi;
145 
146  //loop on all detsets (detectorIDs) inside the SiStripRawDigis collection
148  for (; rawDSViter!=rawdigicollection_->end();rawDSViter++){
149 
150  // Make empty collection with this detID
151  edm::DetSet<SiStripRawDigi> SSRD(rawDSViter->id);
152 
153  // find local map (if it exists) for this detector ID
154  SiGlobalIndex::const_iterator itest;
155  itest = SiHitStorage_.find(rawDSViter->id);
156 
157  // if detID already has digis in existing map, add them to rawdigis
158  if(itest!=SiHitStorage_.end()) {
159 
160 #ifdef DEBUG
161  LogDebug("DataMixingSiStripRawWorker") << "Pileups: Processing DetID " << rawDSViter->id;
162 #endif
163 
164  // get the map from storage
165  LocalMap = itest->second;
166  OneDetectorMap::const_iterator iLocal = LocalMap.begin();
167 
168  // loop on all strips in rawdigi detset
169  int currentstrip=0;
170  edm::DetSet<SiStripRawDigi>::const_iterator iRawDigi = rawDSViter->begin();
171  while( iRawDigi != rawDSViter->end() ) {
172 
173  int ADCSum = iRawDigi->adc();
174 
175  // if current strip exists in map, add ADC values
176  if(iLocal->strip() == currentstrip) {
177  ADCSum += iLocal->adc();
178  iLocal++;
179  }
180 
181  // put ADC sum in DetSet and go to next strip
182  SSRD.push_back( SiStripRawDigi(ADCSum) );
183  iRawDigi++;
184  currentstrip++;
185 
186  }
187 
188  // copy combined digi+rawdigi into rawdigi DetSetVector
189  vSiStripRawDigi.push_back(SSRD);
190 
191  // otherwise, just copy the rawdigis from the background event to the output
192  } else {
193  vSiStripRawDigi.push_back(*rawDSViter);
194  }
195 
196  }
197 
198 
199  //------------------
200  // (3) Put the new RawDigi collection back into the event
201  //
202 
203  // make new raw digi collection
204  std::auto_ptr< edm::DetSetVector<SiStripRawDigi> > MySiStripRawDigis(new edm::DetSetVector<SiStripRawDigi>(vSiStripRawDigi) );
205 
206  // put collection
207  e.put( MySiStripRawDigis, SiStripDigiCollectionDM_ );
208 
209  // clear local storage for this event
210  SiHitStorage_.clear();
211  }
#define LogDebug(id)
const edm::DetSetVector< SiStripDigi > * digicollection_
void push_back(const T &t)
Definition: DetSet.h:69
std::vector< SiStripDigi > OneDetectorMap
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
#define end
Definition: vmac.h:38
Container::value_type value_type
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:356
void insert(detset const &s)
Insert the given DetSet.
Definition: DetSetVector.h:234
#define begin
Definition: vmac.h:31
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:341
collection_type::const_iterator const_iterator
Definition: DetSet.h:34
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:106
const edm::DetSetVector< SiStripRawDigi > * rawdigicollection_
A Digi for the silicon strip detector, containing only adc information, and suitable for storing raw ...

Member Data Documentation

const edm::DetSetVector<SiStripDigi>* edm::DataMixingSiStripRawWorker::digicollection_
private

Definition at line 72 of file DataMixingSiStripRawWorker.h.

Referenced by addSiStripPileups(), addSiStripSignals(), and putSiStrip().

std::string edm::DataMixingSiStripRawWorker::label_
private
const edm::DetSetVector<SiStripRawDigi>* edm::DataMixingSiStripRawWorker::rawdigicollection_
private

Definition at line 73 of file DataMixingSiStripRawWorker.h.

Referenced by addSiStripPileups(), addSiStripSignals(), and putSiStrip().

Selector* edm::DataMixingSiStripRawWorker::sel_
private
SiGlobalIndex edm::DataMixingSiStripRawWorker::SiHitStorage_
private

Definition at line 69 of file DataMixingSiStripRawWorker.h.

Referenced by DataMixingSiStripRawWorker(), and putSiStrip().

edm::InputTag edm::DataMixingSiStripRawWorker::Sistripdigi_collectionSig_
private

Definition at line 57 of file DataMixingSiStripRawWorker.h.

Referenced by addSiStripSignals(), and DataMixingSiStripRawWorker().

std::string edm::DataMixingSiStripRawWorker::SiStripDigiCollectionDM_
private

Definition at line 61 of file DataMixingSiStripRawWorker.h.

Referenced by DataMixingSiStripRawWorker(), and putSiStrip().

edm::InputTag edm::DataMixingSiStripRawWorker::SistripLabelSig_
private

Definition at line 58 of file DataMixingSiStripRawWorker.h.

Referenced by addSiStripSignals(), and DataMixingSiStripRawWorker().

edm::InputTag edm::DataMixingSiStripRawWorker::SiStripPileInputTag_
private

Definition at line 59 of file DataMixingSiStripRawWorker.h.

Referenced by addSiStripPileups(), and DataMixingSiStripRawWorker().

std::string edm::DataMixingSiStripRawWorker::SiStripRawDigiSource_
private
edm::InputTag edm::DataMixingSiStripRawWorker::SiStripRawInputTag_
private