![]() |
![]() |
Functions | |
void | addPileups (const int bcr, Event *e, unsigned int eventNr, unsigned int worker) |
void | addSignals (const edm::Event &e) |
void | beginJob (edm::EventSetup const &iSetup) |
void | createnewEDProduct () |
def | customise |
void | doPileUp (edm::Event &e) |
void | getEventStartInfo (edm::Event &e, const unsigned int s) |
MixingModule (const edm::ParameterSet &ps_mix) | |
void | put (edm::Event &e) |
void | setEventStartInfo (const unsigned int s) |
bool | verifyRegistry (std::string object, std::string subdet, InputTag &tag, std::string &label) |
~MixingModule () |
void MixingModule::addPileups | ( | const int | bcr, | |
Event * | e, | |||
unsigned int | eventNr, | |||
unsigned int | worker | |||
) |
Definition at line 229 of file MixingModule.cc.
References LogDebug.
Referenced by edm::BMixingModule::merge().
00229 { // fill in pileup part of CrossingFrame 00230 00231 00232 LogDebug("MixingModule") <<"\n===============> adding objects from event "<<e->id()<<" for bunchcrossing "<<bcr; 00233 00234 workers_[worker]->addPileups(bcr,e,eventNr,vertexoffset); 00235 }
void MixingModule::addSignals | ( | const edm::Event & | e | ) |
Definition at line 198 of file MixingModule.cc.
References edm::Event::id(), and LogDebug.
Referenced by edm::BMixingModule::produce().
00198 { 00199 // fill in signal part of CrossingFrame 00200 00201 LogDebug("MixingModule")<<"===============> adding signals for "<<e.id(); 00202 for (unsigned int ii=0;ii<workers_.size();ii++){ 00203 workers_[ii]->addSignals(e); 00204 } 00205 00206 }
void MixingModule::beginJob | ( | edm::EventSetup const & | iSetup | ) |
void MixingModule::createnewEDProduct | ( | ) |
Definition at line 182 of file MixingModule.cc.
Referenced by edm::BMixingModule::produce().
00182 { 00183 //create playback info 00184 playbackInfo_=new CrossingFramePlaybackInfo(minBunch_,maxBunch_,maxNbSources_); 00185 00186 //and CrossingFrames 00187 for (unsigned int ii=0;ii<workers_.size();ii++) 00188 workers_[ii]->createnewEDProduct(); 00189 }
def MixingModule::customise | ( | process | ) |
Definition at line 11 of file MixingModule.py.
00011 : 00012 #Renaming the process 00013 process.__dict__['_Process__name']=process.__dict__['_Process__name']+'-PILEUP' 00014 #Adding SimpleMemoryCheck service: 00015 process.SimpleMemoryCheck=cms.Service("SimpleMemoryCheck", 00016 ignoreTotal=cms.untracked.int32(1), 00017 oncePerEventMode=cms.untracked.bool(True)) 00018 #Adding Timing service: 00019 process.Timing=cms.Service("Timing") 00020 00021 #Add these 3 lines to put back the summary for timing information at the end of the logfile 00022 #(needed for TimeReport report) 00023 process.options = cms.untracked.PSet( 00024 wantSummary = cms.untracked.bool(True) 00025 ) 00026 00027 #Overwriting the fileNames to be used by the MixingModule 00028 #when invoking cmsDriver.py with the --PU option 00029 process.mix.input.fileNames = cms.untracked.vstring('file:../INPUT_PILEUP_EVENTS.root') 00030 00031 return(process) return(process)
void MixingModule::doPileUp | ( | edm::Event & | e | ) |
Definition at line 208 of file MixingModule.cc.
References merge().
Referenced by edm::BMixingModule::produce().
00209 {// we first loop over workers 00210 // in order not to keep all CrossingFrames in memory simultaneously 00211 // 00212 00213 for (unsigned int ii=0;ii<workers_.size();ii++) { 00214 // we have to loop over bunchcrossings first since added objects are all stored in one vector, 00215 // ordered by bunchcrossing 00216 for (int bunchCrossing=minBunch_;bunchCrossing<=maxBunch_;++bunchCrossing) { 00217 workers_[ii]->setBcrOffset(); 00218 for (unsigned int isource=0;isource<maxNbSources_;++isource) { 00219 workers_[ii]->setSourceOffset(isource); 00220 if (doit_[isource]) { 00221 merge(bunchCrossing, (pileup_[isource])[bunchCrossing-minBunch_],ii); 00222 } 00223 } 00224 } 00225 workers_[ii]->put(e); 00226 } 00227 }
void MixingModule::getEventStartInfo | ( | edm::Event & | e, | |
const unsigned int | s | |||
) |
Definition at line 248 of file MixingModule.cc.
References edm::Event::get().
Referenced by edm::BMixingModule::produce().
00248 { 00249 if (playback_) { 00250 00251 edm::Handle<CrossingFramePlaybackInfo> playbackInfo_H; 00252 bool got=e.get((*sel_), playbackInfo_H); 00253 if (got) { 00254 playbackInfo_H->getEventStartInfo(eventIDs_,fileSeqNrs_,nrEvents_,s); 00255 }else{ 00256 LogWarning("MixingModule")<<"\n\nAttention: No CrossingFramePlaybackInfo on the input file, but playback option set!!!!!!!\nAttention: Job is executed without playback, please change the input file if you really want playback!!!!!!!"; 00257 //FIXME: defaults 00258 } 00259 } 00260 }
MixingModule::MixingModule | ( | const edm::ParameterSet & | ps_mix | ) |
Definition at line 26 of file MixingModule.cc.
References find(), edm::ParameterSet::getParameter(), it, label, LogDebug, names, python::EventAnalyzer_cfg::pset, size, edm::sort_all(), ecalRecalibSequence_cff::tag, and verifyRegistry().
00026 : BMixingModule(ps_mix),labelPlayback_(ps_mix.getParameter<std::string>("LabelPlayback")) 00027 00028 { 00029 if (labelPlayback_.size()>0){ 00030 sel_=new Selector( ModuleLabelSelector(labelPlayback_)); 00031 } 00032 else { 00033 sel_=new Selector( MatchAllSelector()); 00034 } 00035 00036 ParameterSet ps=ps_mix.getParameter<ParameterSet>("mixObjects"); 00037 std::vector<std::string> names = ps.getParameterNames(); 00038 for (std::vector<string>::iterator it=names.begin();it!= names.end();++it) 00039 { 00040 ParameterSet pset=ps.getParameter<ParameterSet>((*it)); 00041 if (!pset.exists("type")) continue; //to allow replacement by empty pset 00042 std::string object = pset.getParameter<std::string>("type"); 00043 std::vector<InputTag> tags=pset.getParameter<std::vector<InputTag> >("input"); 00044 00045 //SimTracks 00046 if (object=="SimTrack") { 00047 InputTag tag; 00048 if (tags.size()>0) tag=tags[0]; 00049 std::string label; 00050 if (verifyRegistry(object,std::string(""),tag,label)); 00051 { 00052 workers_.push_back(new MixingWorker<SimTrack>(minBunch_,maxBunch_,bunchSpace_,std::string(""),label,maxNbSources_,tag)); 00053 produces<CrossingFrame<SimTrack> >(label); 00054 LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label; 00055 } 00056 00057 }else if (object=="SimVertex") { 00058 InputTag tag; 00059 if (tags.size()>0) tag=tags[0]; 00060 std::string label; 00061 if (verifyRegistry(object,std::string(""),tag,label)) 00062 { 00063 workers_.push_back(new MixingWorker<SimVertex>(minBunch_,maxBunch_,bunchSpace_,std::string(""),label,maxNbSources_,tag)); 00064 produces<CrossingFrame<SimVertex> >(label); 00065 LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag "<<tag.encode()<<", label will be "<<label; 00066 } 00067 } 00068 00069 else if (object=="HepMCProduct") { 00070 InputTag tag; 00071 if (tags.size()>0) tag=tags[0]; 00072 std::string label; 00073 if (verifyRegistry(object,std::string(""),tag,label)){ 00074 workers_.push_back(new MixingWorker<HepMCProduct>(minBunch_,maxBunch_,bunchSpace_,std::string(""),label,maxNbSources_,tag)); 00075 produces<CrossingFrame<HepMCProduct> >(label); 00076 LogInfo("MixingModule") <<"Will mix"<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label; 00077 } 00078 00079 }else if (object=="PCaloHit") { 00080 std::vector<std::string> subdets=pset.getParameter<std::vector<std::string> >("subdets"); 00081 for (unsigned int ii=0;ii<subdets.size();ii++) { 00082 InputTag tag; 00083 if (tags.size()==1) tag=tags[0]; 00084 else if(tags.size()>1) tag=tags[ii]; //FIXME: verify sizes 00085 std::string label; 00086 if (verifyRegistry(object,subdets[ii],tag,label)){ 00087 workers_.push_back(new MixingWorker<PCaloHit>(minBunch_,maxBunch_,bunchSpace_,subdets[ii],label,maxNbSources_,tag)); 00088 produces<CrossingFrame<PCaloHit> > (label); 00089 LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label; 00090 } 00091 } 00092 00093 }else if (object=="PSimHit") { 00094 std::vector<std::string> subdets=pset.getParameter<std::vector<std::string> >("subdets"); 00095 for (unsigned int ii=0;ii<subdets.size();ii++) { 00096 InputTag tag; 00097 if (tags.size()==1) tag=tags[0]; 00098 else if(tags.size()>1) tag=tags[ii]; //FIXME: verify sizes 00099 std::string label; 00100 if (!verifyRegistry(object,subdets[ii],tag,label)) continue; 00101 if ((subdets[ii].find("HighTof")==std::string::npos) && (subdets[ii].find("LowTof")==std::string::npos)) { 00102 workers_.push_back(new MixingWorker<PSimHit>(minBunch_,maxBunch_,bunchSpace_,subdets[ii],label,maxNbSources_,tag)); 00103 LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label; 00104 }else { 00105 workers_.push_back(new MixingWorker<PSimHit>(minBunch_,maxBunch_,bunchSpace_,subdets[ii],label,maxNbSources_,tag,true)); 00106 // here we have to give the opposite selector too (low for high, high for low) 00107 int slow=(subdets[ii]).find("LowTof");//FIXME: to be done before when creating trackerPids 00108 int iend=(subdets[ii]).size(); 00109 std::string productInstanceNameOpp; 00110 if (slow>0) { 00111 productInstanceNameOpp=tag.instance().substr(0,iend-6)+"HighTof"; 00112 }else{ 00113 productInstanceNameOpp=tag.instance().substr(0,iend-7)+"LowTof"; 00114 } 00115 InputTag tagOpp(tag.label(),productInstanceNameOpp,tag.process()); 00116 workers_[workers_.size()-1]->setOppositeTag(tagOpp); 00117 workers_[workers_.size()-1]->setCheckTof(ps.getUntrackedParameter<bool>("checktof",true)); 00118 LogInfo("MixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label; 00119 } 00120 produces<CrossingFrame<PSimHit> > (label); 00121 } 00122 00123 }else LogWarning("MixingModule") <<"You have asked to mix an unknown type of object("<<object<<").\n If you want to include it in mixing, please contact the authors of the MixingModule!"; 00124 } 00125 00126 sort_all(wantedBranches_); 00127 for (unsigned int branch=0;branch<wantedBranches_.size();++branch) LogDebug("MixingModule")<<"Will keep branch "<<wantedBranches_[branch]; 00128 00129 dropUnwantedBranches(wantedBranches_); 00130 produces<CrossingFramePlaybackInfo>(); 00131 }
void MixingModule::put | ( | edm::Event & | e | ) |
Definition at line 240 of file MixingModule.cc.
References edm::Event::put().
Referenced by IgCollectionItem::operator,(), IgCollectionItem::operator=(), and edm::BMixingModule::produce().
00240 { 00241 00242 if (playbackInfo_) { 00243 std::auto_ptr<CrossingFramePlaybackInfo> pOut(playbackInfo_); 00244 e.put(pOut); 00245 } 00246 }
Definition at line 236 of file MixingModule.cc.
Referenced by edm::BMixingModule::produce().
00236 { 00237 playbackInfo_->setEventStartInfo(eventIDs_,fileSeqNrs_,nrEvents_,s); 00238 }
bool MixingModule::verifyRegistry | ( | std::string | object, | |
std::string | subdet, | |||
InputTag & | tag, | |||
std::string & | label | |||
) |
Definition at line 133 of file MixingModule.cc.
References edm::BranchDescription::className(), edm::BranchDescription::friendlyClassName(), it, edm::BranchDescription::moduleLabel(), and edm::BranchDescription::productInstanceName().
Referenced by MixingModule().
00133 { 00134 // verify that the given product exists in the product registry 00135 // and create the label to be given to the CrossingFrame 00136 00137 edm::Service<edm::ConstProductRegistry> reg; 00138 // Loop over provenance of products in registry. 00139 std::string lookfor; 00140 if (object=="HepMCProduct") lookfor="edm::"+object;//exception for HepMCProduct 00141 else if (object=="edm::HepMCProduct") lookfor=object; 00142 else lookfor="std::vector<"+object+">"; 00143 bool found=false; 00144 for (edm::ProductRegistry::ProductList::const_iterator it = reg->productList().begin(); 00145 it != reg->productList().end(); ++it) { 00146 // See FWCore/Framework/interface/BranchDescription.h 00147 // BranchDescription contains all the information for the product. 00148 edm::BranchDescription desc = it->second; 00149 if (desc.className()==lookfor && desc.moduleLabel()==tag.label() && desc.productInstanceName()==tag.instance()) { 00150 label=desc.moduleLabel()+desc.productInstanceName(); 00151 found=true; 00152 wantedBranches_.push_back(desc.friendlyClassName() + '_' + 00153 desc.moduleLabel() + '_' + 00154 desc.productInstanceName()); 00155 break; 00156 } 00157 } 00158 if (!found) { 00159 LogWarning("MixingModule")<<"!!!!!!!!!Could not find in registry requested object: "<<object<<" with "<<tag<<".\nWill NOT be considered for mixing!!!!!!!!!"; 00160 return false; 00161 } 00162 00163 return true; 00164 }
MixingModule::~MixingModule | ( | ) |