CMS 3D CMS Logo

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, OneDetectorMapSiGlobalIndex
 

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 37 of file DataMixingSiStripRawWorker.h.

Member Typedef Documentation

◆ OneDetectorMap

Definition at line 71 of file DataMixingSiStripRawWorker.h.

◆ SiGlobalIndex

Definition at line 73 of file DataMixingSiStripRawWorker.h.

Constructor & Destructor Documentation

◆ DataMixingSiStripRawWorker() [1/2]

DataMixingSiStripRawWorker::DataMixingSiStripRawWorker ( )

Definition at line 21 of file DataMixingSiStripRawWorker.cc.

21 {}

◆ DataMixingSiStripRawWorker() [2/2]

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

standard constructor

Definition at line 24 of file DataMixingSiStripRawWorker.cc.

25  : label_(ps.getParameter<std::string>("Label"))
26 
27  {
28  // get the subdetector names
29  // this->getSubdetectorNames(); //something like this may be useful to
30  // check what we are supposed to do...
31 
32  // declare the products to produce
33 
34  Sistripdigi_collectionSig_ = ps.getParameter<edm::InputTag>("SistripdigiCollectionSig");
35  SistripLabelSig_ = ps.getParameter<edm::InputTag>("SistripLabelSig");
36 
37  SiStripPileInputTag_ = ps.getParameter<edm::InputTag>("SiStripPileInputTag");
38  SiStripRawInputTag_ = ps.getParameter<edm::InputTag>("SiStripRawInputTag");
39 
40  SiStripDigiCollectionDM_ = ps.getParameter<std::string>("SiStripDigiCollectionDM");
41 
42  SiStripRawDigiSource_ = ps.getParameter<std::string>("SiStripRawDigiSource");
43 
44  // clear local storage for this event
45  SiHitStorage_.clear();
46 
48 
51  }

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

◆ ~DataMixingSiStripRawWorker()

DataMixingSiStripRawWorker::~DataMixingSiStripRawWorker ( )
virtual

Default destructor

Definition at line 54 of file DataMixingSiStripRawWorker.cc.

54 {}

Member Function Documentation

◆ addSiStripPileups()

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

Definition at line 72 of file DataMixingSiStripRawWorker.cc.

75  {
76  LogDebug("DataMixingSiStripRawWorker")
77  << "\n===============> adding pileups from event " << ep->id() << " for bunchcrossing " << bcr;
78 
79  std::shared_ptr<Wrapper<edm::DetSetVector<SiStripDigi>> const> pSSD;
80  std::shared_ptr<Wrapper<edm::DetSetVector<SiStripRawDigi>> const> pSSRD;
81 
82  if (SiStripRawDigiSource_ == "SIGNAL") {
83  pSSD = getProductByTag<edm::DetSetVector<SiStripDigi>>(*ep, SiStripPileInputTag_, mcc);
84  digicollection_ = const_cast<edm::DetSetVector<SiStripDigi> *>(pSSD->product());
85  } else if (SiStripRawDigiSource_ == "PILEUP") {
86  pSSRD = getProductByTag<edm::DetSetVector<SiStripRawDigi>>(*ep, SiStripRawInputTag_, mcc);
87  rawdigicollection_ = const_cast<edm::DetSetVector<SiStripRawDigi> *>(pSSRD->product());
88  } else {
89  std::cout << "you shouldn't be here" << std::endl;
90  }
91 
92  } // end of addSiStripPileups

References gather_cfg::cout, digicollection_, SiStripBadComponentsDQMServiceTemplate_cfg::ep, LogDebug, rawdigicollection_, SiStripPileInputTag_, SiStripRawDigiSource_, and SiStripRawInputTag_.

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

◆ addSiStripSignals()

void DataMixingSiStripRawWorker::addSiStripSignals ( const edm::Event e)

Definition at line 56 of file DataMixingSiStripRawWorker.cc.

56  {
59 
60  if (SiStripRawDigiSource_ == "SIGNAL") {
61  e.getByToken(SiStripRawInputTok_, hSSRD);
62  rawdigicollection_ = hSSRD.product();
63  } else if (SiStripRawDigiSource_ == "PILEUP") {
64  e.getByToken(SiStripInputTok_, hSSD);
65  digicollection_ = hSSD.product();
66  } // else {
67  // std::cout << "you shouldn't be here" << std::endl;
68  //}
69 
70  } // end of addSiStripSignals

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

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

◆ putSiStrip()

void DataMixingSiStripRawWorker::putSiStrip ( edm::Event e)

Definition at line 94 of file DataMixingSiStripRawWorker.cc.

94  {
95  //------------------
96  // (1) Fill a map from the Digi collection
97  //
98 
99  // fill in maps of SiStripDigis
100  OneDetectorMap LocalMap;
101 
102  // loop on all detsets (detectorIDs) inside the input collection
104  for (; DSViter != digicollection_->end(); DSViter++) {
105 #ifdef DEBUG
106  LogDebug("DataMixingSiStripRawWorker") << "Processing DetID " << DSViter->id;
107 #endif
108 
109  LocalMap.clear();
110  LocalMap.reserve((DSViter->data).size());
111  LocalMap.insert(LocalMap.end(), (DSViter->data).begin(), (DSViter->data).end());
112 
113  SiHitStorage_.insert(SiGlobalIndex::value_type(DSViter->id, LocalMap));
114  }
115 
116  //------------------
117  // (2) Loop over the input RawDigi collection and add the Digis from the map
118  //
119 
120  // collection of RawDigis to put back in the event
121  std::vector<edm::DetSet<SiStripRawDigi>> vSiStripRawDigi;
122 
123  // loop on all detsets (detectorIDs) inside the SiStripRawDigis collection
125  for (; rawDSViter != rawdigicollection_->end(); rawDSViter++) {
126  // Make empty collection with this detID
127  edm::DetSet<SiStripRawDigi> SSRD(rawDSViter->id);
128 
129  // find local map (if it exists) for this detector ID
130  SiGlobalIndex::const_iterator itest;
131  itest = SiHitStorage_.find(rawDSViter->id);
132 
133  // if detID already has digis in existing map, add them to rawdigis
134  if (itest != SiHitStorage_.end()) {
135 #ifdef DEBUG
136  LogDebug("DataMixingSiStripRawWorker") << "Pileups: Processing DetID " << rawDSViter->id;
137 #endif
138 
139  // get the map from storage
140  LocalMap = itest->second;
141  OneDetectorMap::const_iterator iLocal = LocalMap.begin();
142 
143  // loop on all strips in rawdigi detset
144  int currentstrip = 0;
145  edm::DetSet<SiStripRawDigi>::const_iterator iRawDigi = rawDSViter->begin();
146  while (iRawDigi != rawDSViter->end()) {
147  int ADCSum = iRawDigi->adc();
148 
149  // if current strip exists in map, add ADC values
150  if (iLocal->strip() == currentstrip) {
151  ADCSum += iLocal->adc();
152  iLocal++;
153  }
154 
155  // put ADC sum in DetSet and go to next strip
156  SSRD.push_back(SiStripRawDigi(ADCSum));
157  iRawDigi++;
158  currentstrip++;
159  }
160 
161  // copy combined digi+rawdigi into rawdigi DetSetVector
162  vSiStripRawDigi.push_back(SSRD);
163 
164  // otherwise, just copy the rawdigis from the background event to the
165  // output
166  } else {
167  vSiStripRawDigi.push_back(*rawDSViter);
168  }
169  }
170 
171  //------------------
172  // (3) Put the new RawDigi collection back into the event
173  //
174 
175  // make new raw digi collection
176  std::unique_ptr<edm::DetSetVector<SiStripRawDigi>> MySiStripRawDigis(
177  new edm::DetSetVector<SiStripRawDigi>(vSiStripRawDigi));
178 
179  // put collection
180  e.put(std::move(MySiStripRawDigis), SiStripDigiCollectionDM_);
181 
182  // clear local storage for this event
183  SiHitStorage_.clear();
184  }

References edm::DetSetVector< T >::begin(), digicollection_, MillePedeFileConverter_cfg::e, edm::DetSetVector< T >::end(), mps_fire::end, LogDebug, eostools::move(), edm::DetSet< T >::push_back(), rawdigicollection_, edm::DetSetVector< T >::reserve(), SiHitStorage_, and SiStripDigiCollectionDM_.

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

Member Data Documentation

◆ digicollection_

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

Definition at line 78 of file DataMixingSiStripRawWorker.h.

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

◆ label_

std::string edm::DataMixingSiStripRawWorker::label_
private

◆ rawdigicollection_

const edm::DetSetVector<SiStripRawDigi>* edm::DataMixingSiStripRawWorker::rawdigicollection_
private

Definition at line 79 of file DataMixingSiStripRawWorker.h.

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

◆ SiHitStorage_

SiGlobalIndex edm::DataMixingSiStripRawWorker::SiHitStorage_
private

Definition at line 75 of file DataMixingSiStripRawWorker.h.

Referenced by DataMixingSiStripRawWorker(), and putSiStrip().

◆ Sistripdigi_collectionSig_

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

Definition at line 57 of file DataMixingSiStripRawWorker.h.

Referenced by DataMixingSiStripRawWorker().

◆ SiStripDigiCollectionDM_

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

Definition at line 64 of file DataMixingSiStripRawWorker.h.

Referenced by DataMixingSiStripRawWorker(), and putSiStrip().

◆ SiStripInputTok_

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

Definition at line 62 of file DataMixingSiStripRawWorker.h.

Referenced by addSiStripSignals(), and DataMixingSiStripRawWorker().

◆ SistripLabelSig_

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

Definition at line 59 of file DataMixingSiStripRawWorker.h.

Referenced by DataMixingSiStripRawWorker().

◆ SiStripPileInputTag_

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

Definition at line 60 of file DataMixingSiStripRawWorker.h.

Referenced by addSiStripPileups(), and DataMixingSiStripRawWorker().

◆ SiStripRawDigiSource_

std::string edm::DataMixingSiStripRawWorker::SiStripRawDigiSource_
private

◆ SiStripRawInputTag_

edm::InputTag edm::DataMixingSiStripRawWorker::SiStripRawInputTag_
private

Definition at line 61 of file DataMixingSiStripRawWorker.h.

Referenced by addSiStripPileups(), and DataMixingSiStripRawWorker().

◆ SiStripRawInputTok_

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

Definition at line 63 of file DataMixingSiStripRawWorker.h.

Referenced by addSiStripSignals(), and DataMixingSiStripRawWorker().

edm::DataMixingSiStripRawWorker::SiStripRawInputTok_
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > SiStripRawInputTok_
Definition: DataMixingSiStripRawWorker.h:63
edm::DetSet::push_back
void push_back(const T &t)
Definition: DetSet.h:66
edm::DetSetVector< SiStripDigi >
edm::DataMixingSiStripRawWorker::SiStripInputTok_
edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > SiStripInputTok_
Definition: DataMixingSiStripRawWorker.h:62
edm::DataMixingSiStripRawWorker::label_
std::string label_
Definition: DataMixingSiStripRawWorker.h:81
edm::Handle::product
T const * product() const
Definition: Handle.h:70
edm::DetSetVector::end
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
edm::DetSet
Definition: DetSet.h:23
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
edm::DetSetVector::reserve
void reserve(size_t s)
Definition: DetSetVector.h:147
edm::DetSetVector::begin
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:314
edm::DataMixingSiStripRawWorker::rawdigicollection_
const edm::DetSetVector< SiStripRawDigi > * rawdigicollection_
Definition: DataMixingSiStripRawWorker.h:79
edm::Handle
Definition: AssociativeIterator.h:50
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
SiStripRawDigi
A Digi for the silicon strip detector, containing only adc information, and suitable for storing raw ...
Definition: SiStripRawDigi.h:15
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
mps_fire.end
end
Definition: mps_fire.py:242
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::DetSetVector::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
edm::DataMixingSiStripRawWorker::Sistripdigi_collectionSig_
edm::InputTag Sistripdigi_collectionSig_
Definition: DataMixingSiStripRawWorker.h:57
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
edm::DataMixingSiStripRawWorker::digicollection_
const edm::DetSetVector< SiStripDigi > * digicollection_
Definition: DataMixingSiStripRawWorker.h:78
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::DataMixingSiStripRawWorker::OneDetectorMap
std::vector< SiStripDigi > OneDetectorMap
Definition: DataMixingSiStripRawWorker.h:71
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::DataMixingSiStripRawWorker::SiStripRawInputTag_
edm::InputTag SiStripRawInputTag_
Definition: DataMixingSiStripRawWorker.h:61
edm::DataMixingSiStripRawWorker::SiStripRawDigiSource_
std::string SiStripRawDigiSource_
Definition: DataMixingSiStripRawWorker.h:66
edm::DataMixingSiStripRawWorker::SiStripDigiCollectionDM_
std::string SiStripDigiCollectionDM_
Definition: DataMixingSiStripRawWorker.h:64
edm::DataMixingSiStripRawWorker::SistripLabelSig_
edm::InputTag SistripLabelSig_
Definition: DataMixingSiStripRawWorker.h:59
edm::DataMixingSiStripRawWorker::SiHitStorage_
SiGlobalIndex SiHitStorage_
Definition: DataMixingSiStripRawWorker.h:75
SiStripBadComponentsDQMServiceTemplate_cfg.ep
ep
Definition: SiStripBadComponentsDQMServiceTemplate_cfg.py:86
edm::InputTag
Definition: InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
edm::DataMixingSiStripRawWorker::SiStripPileInputTag_
edm::InputTag SiStripPileInputTag_
Definition: DataMixingSiStripRawWorker.h:60
edm::DetSet::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSet.h:31