test
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, ModuleCallingContext const *)
 
void addSiStripSignals (const edm::Event &e)
 
 DataMixingSiStripRawWorker ()
 
 DataMixingSiStripRawWorker (const edm::ParameterSet &ps, edm::ConsumesCollector &&iC)
 
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_
 
SiGlobalIndex SiHitStorage_
 
edm::InputTag Sistripdigi_collectionSig_
 
std::string SiStripDigiCollectionDM_
 
edm::EDGetTokenT
< edm::DetSetVector
< SiStripDigi > > 
SiStripInputTok_
 
edm::InputTag SistripLabelSig_
 
edm::InputTag SiStripPileInputTag_
 
std::string SiStripRawDigiSource_
 
edm::InputTag SiStripRawInputTag_
 
edm::EDGetTokenT
< edm::DetSetVector
< SiStripRawDigi > > 
SiStripRawInputTok_
 

Detailed Description

Definition at line 39 of file DataMixingSiStripRawWorker.h.

Member Typedef Documentation

Definition at line 71 of file DataMixingSiStripRawWorker.h.

Definition at line 72 of file DataMixingSiStripRawWorker.h.

Constructor & Destructor Documentation

DataMixingSiStripRawWorker::DataMixingSiStripRawWorker ( )

Definition at line 27 of file DataMixingSiStripRawWorker.cc.

27 { }
DataMixingSiStripRawWorker::DataMixingSiStripRawWorker ( const edm::ParameterSet ps,
edm::ConsumesCollector &&  iC 
)
explicit

standard constructor

Definition at line 30 of file DataMixingSiStripRawWorker.cc.

References edm::ParameterSet::getParameter(), HLT_25ns10e33_v2_cff::InputTag, edm::InputTag::label(), SiHitStorage_, Sistripdigi_collectionSig_, SiStripDigiCollectionDM_, SiStripInputTok_, SistripLabelSig_, SiStripPileInputTag_, SiStripRawDigiSource_, SiStripRawInputTag_, SiStripRawInputTok_, AlCaHLTBitMon_QueryRunRegistry::string, and GlobalPosition_Frontier_DevDB_cff::tag.

30  :
31  label_(ps.getParameter<std::string>("Label"))
32 
33  {
34 
35  // get the subdetector names
36  // this->getSubdetectorNames(); //something like this may be useful to check what we are supposed to do...
37 
38  // declare the products to produce
39 
40  Sistripdigi_collectionSig_ = ps.getParameter<edm::InputTag>("SistripdigiCollectionSig");
41  SistripLabelSig_ = ps.getParameter<edm::InputTag>("SistripLabelSig");
42 
43  SiStripPileInputTag_ = ps.getParameter<edm::InputTag>("SiStripPileInputTag");
44  SiStripRawInputTag_ = ps.getParameter<edm::InputTag>("SiStripRawInputTag");
45 
46  SiStripDigiCollectionDM_ = ps.getParameter<std::string>("SiStripDigiCollectionDM");
47 
48  SiStripRawDigiSource_ = ps.getParameter<std::string>("SiStripRawDigiSource");
49 
50  // clear local storage for this event
51  SiHitStorage_.clear();
52 
54 
57 
58  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > SiStripInputTok_
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > SiStripRawInputTok_
std::string const & label() const
Definition: InputTag.h:36
DataMixingSiStripRawWorker::~DataMixingSiStripRawWorker ( )
virtual

Default destructor

Definition at line 62 of file DataMixingSiStripRawWorker.cc.

62  {
63  }

Member Function Documentation

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

Definition at line 88 of file DataMixingSiStripRawWorker.cc.

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

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

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

Definition at line 67 of file DataMixingSiStripRawWorker.cc.

References digicollection_, edm::Event::getByToken(), edm::Handle< T >::product(), rawdigicollection_, SiStripInputTok_, SiStripRawDigiSource_, and SiStripRawInputTok_.

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

67  {
68 
69 
72 
73  if (SiStripRawDigiSource_=="SIGNAL") {
75  rawdigicollection_ = hSSRD.product();
76  } else if (SiStripRawDigiSource_=="PILEUP") {
78  digicollection_ = hSSD.product();
79  } //else {
80  //std::cout << "you shouldn't be here" << std::endl;
81  //}
82 
83 
84  } // end of addSiStripSignals
const edm::DetSetVector< SiStripDigi > * digicollection_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > SiStripInputTok_
T const * product() const
Definition: Handle.h:81
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > SiStripRawInputTok_
const edm::DetSetVector< SiStripRawDigi > * rawdigicollection_
void DataMixingSiStripRawWorker::putSiStrip ( edm::Event e)

Definition at line 110 of file DataMixingSiStripRawWorker.cc.

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

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

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

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

SiGlobalIndex edm::DataMixingSiStripRawWorker::SiHitStorage_
private

Definition at line 74 of file DataMixingSiStripRawWorker.h.

Referenced by DataMixingSiStripRawWorker(), and putSiStrip().

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

Definition at line 60 of file DataMixingSiStripRawWorker.h.

Referenced by DataMixingSiStripRawWorker().

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

Definition at line 66 of file DataMixingSiStripRawWorker.h.

Referenced by DataMixingSiStripRawWorker(), and putSiStrip().

edm::EDGetTokenT<edm::DetSetVector<SiStripDigi> > edm::DataMixingSiStripRawWorker::SiStripInputTok_
private

Definition at line 64 of file DataMixingSiStripRawWorker.h.

Referenced by addSiStripSignals(), and DataMixingSiStripRawWorker().

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

Definition at line 61 of file DataMixingSiStripRawWorker.h.

Referenced by DataMixingSiStripRawWorker().

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

Definition at line 62 of file DataMixingSiStripRawWorker.h.

Referenced by addSiStripPileups(), and DataMixingSiStripRawWorker().

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

Definition at line 63 of file DataMixingSiStripRawWorker.h.

Referenced by addSiStripPileups(), and DataMixingSiStripRawWorker().

edm::EDGetTokenT<edm::DetSetVector<SiStripRawDigi> > edm::DataMixingSiStripRawWorker::SiStripRawInputTok_
private

Definition at line 65 of file DataMixingSiStripRawWorker.h.

Referenced by addSiStripSignals(), and DataMixingSiStripRawWorker().