#include <SimGeneral/DataMixingModule/plugins/DataMixingSiStripWorker.h>
Public Member Functions | |
void | addSiStripPileups (const int bcr, edm::Event *, unsigned int EventId) |
void | addSiStripSignals (const edm::Event &e) |
DataMixingSiStripWorker (const edm::ParameterSet &ps) | |
standard constructor | |
DataMixingSiStripWorker () | |
void | putSiStrip (edm::Event &e) |
virtual | ~DataMixingSiStripWorker () |
Default destructor. | |
Private Types | |
typedef std::vector< SiStripDigi > | OneDetectorMap |
typedef std::map< uint32_t, OneDetectorMap > | SiGlobalIndex |
Private Attributes | |
std::string | label_ |
Selector * | sel_ |
SiGlobalIndex | SiHitStorage_ |
edm::InputTag | Sistripdigi_collection_ |
std::string | SiStripDigiCollectionDM_ |
edm::InputTag | SistripLabel_ |
Classes | |
class | StrictWeakOrdering |
Definition at line 35 of file DataMixingSiStripWorker.h.
typedef std::vector<SiStripDigi> edm::DataMixingSiStripWorker::OneDetectorMap [private] |
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.
DataMixingSiStripWorker::DataMixingSiStripWorker | ( | ) |
DataMixingSiStripWorker::DataMixingSiStripWorker | ( | const edm::ParameterSet & | ps | ) | [explicit] |
standard constructor
Definition at line 29 of file DataMixingSiStripWorker.cc.
References edm::ParameterSet::getParameter(), label_, sel_, SiHitStorage_, Sistripdigi_collection_, SiStripDigiCollectionDM_, and SistripLabel_.
00029 : 00030 label_(ps.getParameter<std::string>("Label")) 00031 00032 { 00033 00034 // get the subdetector names 00035 // this->getSubdetectorNames(); //something like this may be useful to check what we are supposed to do... 00036 00037 // create input selector 00038 if (label_.size()>0){ 00039 sel_=new Selector( ModuleLabelSelector(label_)); 00040 } 00041 else { 00042 sel_=new Selector( MatchAllSelector()); 00043 } 00044 00045 // declare the products to produce 00046 00047 Sistripdigi_collection_ = ps.getParameter<edm::InputTag>("SistripdigiCollection"); 00048 SistripLabel_ = ps.getParameter<edm::InputTag>("SistripLabel"); 00049 SiStripDigiCollectionDM_ = ps.getParameter<std::string>("SiStripDigiCollectionDM"); 00050 00051 // clear local storage for this event 00052 SiHitStorage_.clear(); 00053 00054 }
DataMixingSiStripWorker::~DataMixingSiStripWorker | ( | ) | [virtual] |
void DataMixingSiStripWorker::addSiStripPileups | ( | const int | bcr, | |
edm::Event * | e, | |||
unsigned int | EventId | |||
) |
Definition at line 93 of file DataMixingSiStripWorker.cc.
References begin, end, edm::DetSetVector< T >::find(), edm::Event::getByLabel(), edm::Event::id(), iggi_31X_cfg::input, and LogDebug.
00093 { 00094 LogDebug("DataMixingSiStripWorker") <<"\n===============> adding pileups from event "<<e->id()<<" for bunchcrossing "<<bcr; 00095 00096 // fill in maps of hits; same code as addSignals, except now applied to the pileup events 00097 00098 Handle< edm::DetSetVector<SiStripDigi> > input; 00099 00100 if( e->getByLabel(Sistripdigi_collection_.label(),SistripLabel_.label(),input) ) { 00101 00102 OneDetectorMap LocalMap; 00103 00104 //loop on all detsets (detectorIDs) inside the input collection 00105 edm::DetSetVector<SiStripDigi>::const_iterator DSViter=input->begin(); 00106 for (; DSViter!=input->end();DSViter++){ 00107 00108 #ifdef DEBUG 00109 LogDebug("DataMixingSiStripWorker") << "Pileups: Processing DetID " << DSViter->id; 00110 #endif 00111 00112 // find correct local map (or new one) for this detector ID 00113 00114 SiGlobalIndex::const_iterator itest; 00115 00116 itest = SiHitStorage_.find(DSViter->id); 00117 00118 if(itest!=SiHitStorage_.end()) { // this detID already has hits, add to existing map 00119 00120 LocalMap = itest->second; 00121 00122 // fill in local map with extra channels 00123 LocalMap.insert(LocalMap.end(),(DSViter->data).begin(),(DSViter->data).end()); 00124 std::stable_sort(LocalMap.begin(),LocalMap.end(),DataMixingSiStripWorker::StrictWeakOrdering()); 00125 SiHitStorage_[DSViter->id]=LocalMap; 00126 00127 } 00128 else{ // fill local storage with this information, put in global collection 00129 00130 LocalMap.clear(); 00131 LocalMap.reserve((DSViter->data).size()); 00132 LocalMap.insert(LocalMap.end(),(DSViter->data).begin(),(DSViter->data).end()); 00133 00134 SiHitStorage_.insert( SiGlobalIndex::value_type( DSViter->id, LocalMap ) ); 00135 } 00136 } 00137 } 00138 }
void DataMixingSiStripWorker::addSiStripSignals | ( | const edm::Event & | e | ) |
Definition at line 65 of file DataMixingSiStripWorker.cc.
References begin, end, edm::Event::getByLabel(), iggi_31X_cfg::input, edm::DetSetVector< T >::insert(), and LogDebug.
00065 { 00066 // fill in maps of hits 00067 00068 Handle< edm::DetSetVector<SiStripDigi> > input; 00069 00070 if( e.getByLabel(Sistripdigi_collection_.label(),SistripLabel_.label(),input) ) { 00071 OneDetectorMap LocalMap; 00072 00073 //loop on all detsets (detectorIDs) inside the input collection 00074 edm::DetSetVector<SiStripDigi>::const_iterator DSViter=input->begin(); 00075 for (; DSViter!=input->end();DSViter++){ 00076 00077 #ifdef DEBUG 00078 LogDebug("DataMixingSiStripWorker") << "Processing DetID " << DSViter->id; 00079 #endif 00080 00081 LocalMap.clear(); 00082 LocalMap.reserve((DSViter->data).size()); 00083 LocalMap.insert(LocalMap.end(),(DSViter->data).begin(),(DSViter->data).end()); 00084 00085 SiHitStorage_.insert( SiGlobalIndex::value_type( DSViter->id, LocalMap ) ); 00086 } 00087 00088 } 00089 } // end of addSiStripSignals
void DataMixingSiStripWorker::putSiStrip | ( | edm::Event & | e | ) |
Definition at line 142 of file DataMixingSiStripWorker.cc.
References edm::DetSet< T >::push_back(), and edm::Event::put().
00142 { 00143 00144 // collection of Digis to put in the event 00145 std::vector< edm::DetSet<SiStripDigi> > vSiStripDigi; 00146 00147 // loop through our collection of detectors, merging hits and putting new ones in the output 00148 00149 // big loop over Detector IDs: 00150 00151 for(SiGlobalIndex::const_iterator IDet = SiHitStorage_.begin(); 00152 IDet != SiHitStorage_.end(); IDet++) { 00153 00154 edm::DetSet<SiStripDigi> SSD(IDet->first); // Make empty collection with this detector ID 00155 00156 OneDetectorMap LocalMap = IDet->second; 00157 00158 //counter variables 00159 int formerStrip = -1; 00160 int currentStrip; 00161 int ADCSum = 0; 00162 00163 OneDetectorMap::const_iterator iLocalchk; 00164 OneDetectorMap::const_iterator iLocal = LocalMap.begin(); 00165 for(;iLocal != LocalMap.end(); ++iLocal) { 00166 00167 currentStrip = iLocal->strip(); 00168 00169 if (currentStrip == formerStrip) { // we have to add these digis together 00170 ADCSum+=iLocal->adc(); // on every element... 00171 } 00172 else{ 00173 if(formerStrip!=-1){ 00174 if (ADCSum > 511) ADCSum = 255; 00175 else if (ADCSum > 253 && ADCSum < 512) ADCSum = 254; 00176 SiStripDigi aHit(formerStrip, ADCSum); 00177 SSD.push_back( aHit ); 00178 } 00179 // save pointers for next iteration 00180 formerStrip = currentStrip; 00181 ADCSum = iLocal->adc(); 00182 } 00183 00184 iLocalchk = iLocal; 00185 if((++iLocalchk) == LocalMap.end()) { //make sure not to lose the last one 00186 if (ADCSum > 511) ADCSum = 255; 00187 else if (ADCSum > 253 && ADCSum < 512) ADCSum = 254; 00188 SSD.push_back( SiStripDigi(formerStrip, ADCSum) ); 00189 } // end of loop over one detector 00190 00191 } 00192 // stick this into the global vector of detector info 00193 vSiStripDigi.push_back(SSD); 00194 00195 } // end of big loop over all detector IDs 00196 00197 // put the collection of digis in the event 00198 LogInfo("DataMixingSiStripWorker") << "total # Merged strips: " << vSiStripDigi.size() ; 00199 00200 // make new digi collection 00201 00202 std::auto_ptr< edm::DetSetVector<SiStripDigi> > MySiStripDigis(new edm::DetSetVector<SiStripDigi>(vSiStripDigi) ); 00203 00204 // put collection 00205 00206 e.put( MySiStripDigis, SiStripDigiCollectionDM_ ); 00207 00208 // clear local storage for this event 00209 SiHitStorage_.clear(); 00210 }
std::string edm::DataMixingSiStripWorker::label_ [private] |
Selector* edm::DataMixingSiStripWorker::sel_ [private] |
std::string edm::DataMixingSiStripWorker::SiStripDigiCollectionDM_ [private] |