CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
void addSiStripSignals (const edm::Event &e)
 
 DataMixingSiStripWorker ()
 
 DataMixingSiStripWorker (const edm::ParameterSet &ps)
 
void putSiStrip (edm::Event &e)
 
virtual ~DataMixingSiStripWorker ()
 

Private Types

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

Private Attributes

std::string label_
 
SiGlobalIndex SiHitStorage_
 
std::string SiStripDigiCollectionDM_
 
edm::InputTag SistripLabelSig_
 
edm::InputTag SiStripPileInputTag_
 

Detailed Description

Definition at line 35 of file DataMixingSiStripWorker.h.

Member Typedef Documentation

Definition at line 61 of file DataMixingSiStripWorker.h.

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

Definition at line 62 of file DataMixingSiStripWorker.h.

Constructor & Destructor Documentation

DataMixingSiStripWorker::DataMixingSiStripWorker ( )

Definition at line 26 of file DataMixingSiStripWorker.cc.

26 { }
DataMixingSiStripWorker::DataMixingSiStripWorker ( const edm::ParameterSet ps)
explicit

standard constructor

Definition at line 29 of file DataMixingSiStripWorker.cc.

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

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  // declare the products to produce
38 
39  SistripLabelSig_ = ps.getParameter<edm::InputTag>("SistripLabelSig");
40  SiStripPileInputTag_ = ps.getParameter<edm::InputTag>("SiStripPileInputTag");
41 
42  SiStripDigiCollectionDM_ = ps.getParameter<std::string>("SiStripDigiCollectionDM");
43 
44  // clear local storage for this event
45  SiHitStorage_.clear();
46 
47  }
T getParameter(std::string const &) const
DataMixingSiStripWorker::~DataMixingSiStripWorker ( )
virtual

Default destructor

Definition at line 51 of file DataMixingSiStripWorker.cc.

51  {
52  }

Member Function Documentation

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

Definition at line 84 of file DataMixingSiStripWorker.cc.

References begin, edm::DetSetVector< T >::begin(), end, edm::DetSetVector< T >::end(), edm::EventPrincipal::id(), LaserDQM_cfg::input, edm::DetSetVector< T >::insert(), LogDebug, SiHitStorage_, and SiStripPileInputTag_.

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

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

Definition at line 56 of file DataMixingSiStripWorker.cc.

References begin, end, edm::Event::getByLabel(), LaserDQM_cfg::input, edm::DetSetVector< T >::insert(), LogDebug, SiHitStorage_, and SistripLabelSig_.

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

56  {
57  // fill in maps of hits
58 
59  Handle< edm::DetSetVector<SiStripDigi> > input;
60 
61  if( e.getByLabel(SistripLabelSig_,input) ) {
62  OneDetectorMap LocalMap;
63 
64  //loop on all detsets (detectorIDs) inside the input collection
66  for (; DSViter!=input->end();DSViter++){
67 
68 #ifdef DEBUG
69  LogDebug("DataMixingSiStripWorker") << "Processing DetID " << DSViter->id;
70 #endif
71 
72  LocalMap.clear();
73  LocalMap.reserve((DSViter->data).size());
74  LocalMap.insert(LocalMap.end(),(DSViter->data).begin(),(DSViter->data).end());
75 
76  SiHitStorage_.insert( SiGlobalIndex::value_type( DSViter->id, LocalMap ) );
77  }
78 
79  }
80  } // end of addSiStripSignals
#define LogDebug(id)
std::vector< SiStripDigi > OneDetectorMap
#define end
Definition: vmac.h:38
Container::value_type value_type
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
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
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:106
void DataMixingSiStripWorker::putSiStrip ( edm::Event e)

Definition at line 140 of file DataMixingSiStripWorker.cc.

References edm::DetSet< T >::push_back(), edm::Event::put(), SiHitStorage_, and SiStripDigiCollectionDM_.

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

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

Member Data Documentation

std::string edm::DataMixingSiStripWorker::label_
private
SiGlobalIndex edm::DataMixingSiStripWorker::SiHitStorage_
private
std::string edm::DataMixingSiStripWorker::SiStripDigiCollectionDM_
private

Definition at line 57 of file DataMixingSiStripWorker.h.

Referenced by DataMixingSiStripWorker(), and putSiStrip().

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

Definition at line 55 of file DataMixingSiStripWorker.h.

Referenced by addSiStripSignals(), and DataMixingSiStripWorker().

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

Definition at line 56 of file DataMixingSiStripWorker.h.

Referenced by addSiStripPileups(), and DataMixingSiStripWorker().