CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Types | Private Attributes
edm::DataMixingSiStripWorker Class Reference

#include <DataMixingSiStripWorker.h>

Classes

class  StrictWeakOrdering
 

Public Member Functions

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

Private Types

typedef std::vector< SiStripDigiOneDetectorMap
 
typedef std::map< uint32_t, OneDetectorMapSiGlobalIndex
 

Private Attributes

std::string label_
 
SiGlobalIndex SiHitStorage_
 
std::string SiStripDigiCollectionDM_
 
edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > SiStripDigiPToken_
 
edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > SiStripDigiToken_
 
edm::InputTag SistripLabelSig_
 
edm::InputTag SiStripPileInputTag_
 

Detailed Description

Definition at line 36 of file DataMixingSiStripWorker.h.

Member Typedef Documentation

◆ OneDetectorMap

Definition at line 66 of file DataMixingSiStripWorker.h.

◆ SiGlobalIndex

typedef std::map<uint32_t, OneDetectorMap> edm::DataMixingSiStripWorker::SiGlobalIndex
private

Definition at line 68 of file DataMixingSiStripWorker.h.

Constructor & Destructor Documentation

◆ DataMixingSiStripWorker() [1/2]

DataMixingSiStripWorker::DataMixingSiStripWorker ( )

Definition at line 21 of file DataMixingSiStripWorker.cc.

21 {}

◆ DataMixingSiStripWorker() [2/2]

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

standard constructor

Definition at line 24 of file DataMixingSiStripWorker.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  SistripLabelSig_ = ps.getParameter<edm::InputTag>("SistripLabelSig");
35  SiStripPileInputTag_ = ps.getParameter<edm::InputTag>("SiStripPileInputTag");
36 
37  SiStripDigiCollectionDM_ = ps.getParameter<std::string>("SiStripDigiCollectionDM");
38 
41 
42  // clear local storage for this event
43  SiHitStorage_.clear();
44  }

References edm::ParameterSet::getParameter(), SiHitStorage_, SiStripDigiCollectionDM_, SiStripDigiPToken_, SiStripDigiToken_, SistripLabelSig_, SiStripPileInputTag_, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~DataMixingSiStripWorker()

DataMixingSiStripWorker::~DataMixingSiStripWorker ( )
virtual

Default destructor

Definition at line 47 of file DataMixingSiStripWorker.cc.

47 {}

Member Function Documentation

◆ addSiStripPileups()

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

Definition at line 73 of file DataMixingSiStripWorker.cc.

76  {
77  LogDebug("DataMixingSiStripWorker") << "\n===============> adding pileups from event " << ep->id()
78  << " for bunchcrossing " << bcr;
79 
80  // fill in maps of hits; same code as addSignals, except now applied to the
81  // pileup events
82 
83  std::shared_ptr<Wrapper<edm::DetSetVector<SiStripDigi>> const> inputPTR =
84  getProductByTag<edm::DetSetVector<SiStripDigi>>(*ep, SiStripPileInputTag_, mcc);
85 
86  if (inputPTR) {
87  const edm::DetSetVector<SiStripDigi> *input = const_cast<edm::DetSetVector<SiStripDigi> *>(inputPTR->product());
88 
89  // Handle< edm::DetSetVector<SiStripDigi> > input;
90 
91  // if(
92  // e->getByLabel(Sistripdigi_collectionPile_.label(),SistripLabelPile_.label(),input)
93  // ) {
94 
95  OneDetectorMap LocalMap;
96 
97  // loop on all detsets (detectorIDs) inside the input collection
99  for (; DSViter != input->end(); DSViter++) {
100 #ifdef DEBUG
101  LogDebug("DataMixingSiStripWorker") << "Pileups: Processing DetID " << DSViter->id;
102 #endif
103 
104  // find correct local map (or new one) for this detector ID
105 
106  SiGlobalIndex::const_iterator itest;
107 
108  itest = SiHitStorage_.find(DSViter->id);
109 
110  if (itest != SiHitStorage_.end()) { // this detID already has hits, add to existing map
111 
112  LocalMap = itest->second;
113 
114  // fill in local map with extra channels
115  LocalMap.insert(LocalMap.end(), (DSViter->data).begin(), (DSViter->data).end());
116  std::stable_sort(LocalMap.begin(), LocalMap.end(), DataMixingSiStripWorker::StrictWeakOrdering());
117  SiHitStorage_[DSViter->id] = LocalMap;
118 
119  } else { // fill local storage with this information, put in global
120  // collection
121 
122  LocalMap.clear();
123  LocalMap.reserve((DSViter->data).size());
124  LocalMap.insert(LocalMap.end(), (DSViter->data).begin(), (DSViter->data).end());
125 
126  SiHitStorage_.insert(SiGlobalIndex::value_type(DSViter->id, LocalMap));
127  }
128  }
129  }
130  }

References edm::DetSetVector< T >::begin(), edm::DetSetVector< T >::end(), mps_fire::end, SiStripBadComponentsDQMServiceTemplate_cfg::ep, input, edm::DetSetVector< T >::insert(), LogDebug, edm::DetSetVector< T >::reserve(), SiHitStorage_, and SiStripPileInputTag_.

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

◆ addSiStripSignals()

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

Definition at line 49 of file DataMixingSiStripWorker.cc.

49  {
50  // fill in maps of hits
51 
52  Handle<edm::DetSetVector<SiStripDigi>> input;
53 
54  if (e.getByToken(SiStripDigiToken_, input)) {
55  OneDetectorMap LocalMap;
56 
57  // loop on all detsets (detectorIDs) inside the input collection
59  for (; DSViter != input->end(); DSViter++) {
60 #ifdef DEBUG
61  LogDebug("DataMixingSiStripWorker") << "Processing DetID " << DSViter->id;
62 #endif
63 
64  LocalMap.clear();
65  LocalMap.reserve((DSViter->data).size());
66  LocalMap.insert(LocalMap.end(), (DSViter->data).begin(), (DSViter->data).end());
67 
68  SiHitStorage_.insert(SiGlobalIndex::value_type(DSViter->id, LocalMap));
69  }
70  }
71  } // end of addSiStripSignals

References MillePedeFileConverter_cfg::e, mps_fire::end, input, LogDebug, edm::DetSetVector< T >::reserve(), SiHitStorage_, and SiStripDigiToken_.

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

◆ putSiStrip()

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

Definition at line 132 of file DataMixingSiStripWorker.cc.

132  {
133  // collection of Digis to put in the event
134  std::vector<edm::DetSet<SiStripDigi>> vSiStripDigi;
135 
136  // loop through our collection of detectors, merging hits and putting new ones
137  // in the output
138 
139  // big loop over Detector IDs:
140 
141  for (SiGlobalIndex::const_iterator IDet = SiHitStorage_.begin(); IDet != SiHitStorage_.end(); IDet++) {
142  edm::DetSet<SiStripDigi> SSD(IDet->first); // Make empty collection with this detector ID
143 
144  OneDetectorMap LocalMap = IDet->second;
145 
146  // counter variables
147  int formerStrip = -1;
148  int currentStrip;
149  int ADCSum = 0;
150 
151  OneDetectorMap::const_iterator iLocalchk;
152  OneDetectorMap::const_iterator iLocal = LocalMap.begin();
153  for (; iLocal != LocalMap.end(); ++iLocal) {
154  currentStrip = iLocal->strip();
155 
156  if (currentStrip == formerStrip) { // we have to add these digis together
157  ADCSum += iLocal->adc(); // on every element...
158  } else {
159  if (formerStrip != -1) {
160  if (ADCSum > 511)
161  ADCSum = 255;
162  else if (ADCSum > 253 && ADCSum < 512)
163  ADCSum = 254;
164  SiStripDigi aHit(formerStrip, ADCSum);
165  SSD.push_back(aHit);
166  }
167  // save pointers for next iteration
168  formerStrip = currentStrip;
169  ADCSum = iLocal->adc();
170  }
171 
172  iLocalchk = iLocal;
173  if ((++iLocalchk) == LocalMap.end()) { // make sure not to lose the last one
174  if (ADCSum > 511)
175  ADCSum = 255;
176  else if (ADCSum > 253 && ADCSum < 512)
177  ADCSum = 254;
178  SSD.push_back(SiStripDigi(formerStrip, ADCSum));
179  } // end of loop over one detector
180  }
181  // stick this into the global vector of detector info
182  vSiStripDigi.push_back(SSD);
183 
184  } // end of big loop over all detector IDs
185 
186  // put the collection of digis in the event
187  LogInfo("DataMixingSiStripWorker") << "total # Merged strips: " << vSiStripDigi.size();
188 
189  // make new digi collection
190 
191  std::unique_ptr<edm::DetSetVector<SiStripDigi>> MySiStripDigis(new edm::DetSetVector<SiStripDigi>(vSiStripDigi));
192 
193  // put collection
194 
195  e.put(std::move(MySiStripDigis), SiStripDigiCollectionDM_);
196 
197  // clear local storage for this event
198  SiHitStorage_.clear();
199  }

References MillePedeFileConverter_cfg::e, eostools::move(), edm::DetSet< T >::push_back(), SiHitStorage_, and SiStripDigiCollectionDM_.

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

Member Data Documentation

◆ label_

std::string edm::DataMixingSiStripWorker::label_
private

◆ SiHitStorage_

SiGlobalIndex edm::DataMixingSiStripWorker::SiHitStorage_
private

◆ SiStripDigiCollectionDM_

std::string edm::DataMixingSiStripWorker::SiStripDigiCollectionDM_
private

Definition at line 58 of file DataMixingSiStripWorker.h.

Referenced by DataMixingSiStripWorker(), and putSiStrip().

◆ SiStripDigiPToken_

edm::EDGetTokenT<edm::DetSetVector<SiStripDigi> > edm::DataMixingSiStripWorker::SiStripDigiPToken_
private

Definition at line 62 of file DataMixingSiStripWorker.h.

Referenced by DataMixingSiStripWorker().

◆ SiStripDigiToken_

edm::EDGetTokenT<edm::DetSetVector<SiStripDigi> > edm::DataMixingSiStripWorker::SiStripDigiToken_
private

Definition at line 61 of file DataMixingSiStripWorker.h.

Referenced by addSiStripSignals(), and DataMixingSiStripWorker().

◆ SistripLabelSig_

edm::InputTag edm::DataMixingSiStripWorker::SistripLabelSig_
private

Definition at line 56 of file DataMixingSiStripWorker.h.

Referenced by DataMixingSiStripWorker().

◆ SiStripPileInputTag_

edm::InputTag edm::DataMixingSiStripWorker::SiStripPileInputTag_
private

Definition at line 57 of file DataMixingSiStripWorker.h.

Referenced by addSiStripPileups(), and DataMixingSiStripWorker().

edm::DetSetVector< SiStripDigi >
edm::DataMixingSiStripWorker::SiStripDigiToken_
edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > SiStripDigiToken_
Definition: DataMixingSiStripWorker.h:61
input
static const std::string input
Definition: EdmProvDump.cc:48
edm::DetSetVector::end
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
edm::DetSet< SiStripDigi >
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::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::DataMixingSiStripWorker::SiStripDigiPToken_
edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > SiStripDigiPToken_
Definition: DataMixingSiStripWorker.h:62
edm::DetSetVector::insert
void insert(detset const &s)
Insert the given DetSet.
Definition: DetSetVector.h:220
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
edm::DataMixingSiStripWorker::OneDetectorMap
std::vector< SiStripDigi > OneDetectorMap
Definition: DataMixingSiStripWorker.h:66
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::DataMixingSiStripWorker::SiHitStorage_
SiGlobalIndex SiHitStorage_
Definition: DataMixingSiStripWorker.h:70
edm::DetSetVector::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::DataMixingSiStripWorker::label_
std::string label_
Definition: DataMixingSiStripWorker.h:74
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::DataMixingSiStripWorker::SiStripPileInputTag_
edm::InputTag SiStripPileInputTag_
Definition: DataMixingSiStripWorker.h:57
SiStripDigi
A Digi for the silicon strip detector, containing both strip and adc information, and suitable for st...
Definition: SiStripDigi.h:12
edm::DataMixingSiStripWorker::SistripLabelSig_
edm::InputTag SistripLabelSig_
Definition: DataMixingSiStripWorker.h:56
SiStripBadComponentsDQMServiceTemplate_cfg.ep
ep
Definition: SiStripBadComponentsDQMServiceTemplate_cfg.py:86
edm::InputTag
Definition: InputTag.h:15
edm::DataMixingSiStripWorker::SiStripDigiCollectionDM_
std::string SiStripDigiCollectionDM_
Definition: DataMixingSiStripWorker.h:58
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37