#include <CaloOnlineTools/EcalTools/plugins/EcalDigiDisplay.h>
Public Member Functions | |
EcalDigiDisplay (const edm::ParameterSet &ps) | |
~EcalDigiDisplay () | |
Protected Member Functions | |
void | readEBDigis (edm::Handle< EBDigiCollection > digis, int Mode) |
void | readEEDigis (edm::Handle< EEDigiCollection > digis, int Mode) |
void | readPNDigis (edm::Handle< EcalPnDiodeDigiCollection > PNs, int Mode) |
Protected Attributes | |
bool | cryDigi |
std::string | digiProducer_ |
std::string | ebDigiCollection_ |
const EcalElectronicsMapping * | ecalElectronicsMap_ |
std::string | eeDigiCollection_ |
EcalFedMap * | fedMap |
bool | inputIsOk |
std::vector< int > | listChannels |
std::vector< int > | listPns |
std::vector< int > | listTowers |
int | mode |
bool | pnDigi |
std::vector< std::string > | requestedEbs_ |
std::vector< int > | requestedFeds_ |
bool | ttDigi |
Private Member Functions | |
virtual void | analyze (const edm::Event &e, const edm::EventSetup &c) |
virtual void | beginJob (const edm::EventSetup &c) |
virtual void | endJob () |
Definition at line 20 of file EcalDigiDisplay.h.
EcalDigiDisplay::EcalDigiDisplay | ( | const edm::ParameterSet & | ps | ) |
Definition at line 35 of file EcalDigiDisplay.cc.
References cryDigi, digiProducer_, ebDigiCollection_, eeDigiCollection_, fedMap, EcalFedMap::getFedFromSlice(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, inputIsOk, listChannels, listPns, listTowers, mode, pnDigi, requestedEbs_, requestedFeds_, and ttDigi.
00035 { 00036 //========================================================================= 00037 00038 ebDigiCollection_ = ps.getParameter<std::string>("ebDigiCollection"); 00039 eeDigiCollection_ = ps.getParameter<std::string>("eeDigiCollection"); 00040 digiProducer_ = ps.getParameter<std::string>("digiProducer"); 00041 00042 requestedFeds_ = ps.getUntrackedParameter<std::vector<int> >("requestedFeds"); 00043 requestedEbs_ = ps.getUntrackedParameter<std::vector<std::string> >("requestedEbs"); 00044 00045 cryDigi = ps.getUntrackedParameter<bool>("cryDigi"); 00046 ttDigi = ps.getUntrackedParameter<bool>("ttDigi"); 00047 pnDigi = ps.getUntrackedParameter<bool>("pnDigi"); 00048 00049 mode = ps.getUntrackedParameter<int>("mode"); 00050 listChannels = ps.getUntrackedParameter<std::vector<int> >("listChannels"); 00051 listTowers = ps.getUntrackedParameter<std::vector<int> >("listTowers"); 00052 listPns = ps.getUntrackedParameter<std::vector<int> >("listPns"); 00053 00054 std::vector<int> listDefaults; 00055 listDefaults.push_back(-1); 00056 requestedFeds_ = ps.getUntrackedParameter<std::vector<int> >("requestedFeds",listDefaults); 00057 bool fedIsGiven = false; 00058 00059 std::vector<std::string> ebDefaults; 00060 ebDefaults.push_back("none"); 00061 requestedEbs_ = ps.getUntrackedParameter<std::vector<std::string> >("requestedEbs",ebDefaults); 00062 bool ebIsGiven = false; 00063 // FEDs and EBs 00064 if ( requestedFeds_[0] != -1 ) { 00065 edm::LogInfo("EcalDigiDisplay") << "FED id is given! Goining to beginJob! "; 00066 fedIsGiven = true; 00067 }else { 00068 if ( requestedEbs_[0] !="none" ) { 00069 ebIsGiven = true; 00070 //EB id is given and convert to FED id 00071 requestedFeds_.clear(); 00072 fedMap = new EcalFedMap(); 00073 for (std::vector<std::string>::const_iterator ebItr = requestedEbs_.begin(); 00074 ebItr!= requestedEbs_.end(); ++ebItr) { 00075 requestedFeds_.push_back(fedMap->getFedFromSlice(*ebItr)); 00076 } 00077 delete fedMap; 00078 } else { 00079 //Select all FEDs in the Event 00080 for ( int i=601; i<655; ++i){ 00081 requestedFeds_.push_back(i); 00082 } 00083 } 00084 } 00085 00086 //Channel list 00087 listChannels = ps.getUntrackedParameter<std::vector<int> >("listChannels",listDefaults); 00088 //Tower list 00089 listTowers = ps.getUntrackedParameter<std::vector<int> >("listTowers", listDefaults); 00090 00091 //Consistancy checks: 00092 std::vector<int>::iterator fedIter; 00093 std::vector<int>::iterator intIter; 00094 inputIsOk = true; 00095 00096 if ( fedIsGiven ) { 00097 for ( fedIter = requestedFeds_.begin(); fedIter!=requestedFeds_.end(); ++fedIter) { 00098 if ( (*fedIter) < 601 || (*fedIter) > 655 ) { 00099 edm::LogError("EcalDigiDisplay") << " FED value: " << (*fedIter) << " found in requetsedFeds. " 00100 << " Valid range is 601-654. Returning."; 00101 inputIsOk = false; 00102 return; 00103 }//Loop over requetsed FEDS 00104 } 00105 } 00106 bool barrelSM = false; 00107 //Loop over and Check if Barrel SM is picked up 00108 for (fedIter = requestedFeds_.begin(); fedIter!=requestedFeds_.end(); ++fedIter) { 00109 if ( (*fedIter) > 609 && (*fedIter) < 646 && inputIsOk ) // if EB SM is being picked up 00110 barrelSM = true; 00111 } 00112 00113 if ( barrelSM ) { 00114 if ( cryDigi ) { 00115 // Check with channels in Barrel 00116 for (intIter = listChannels.begin(); intIter != listChannels.end(); intIter++) { 00117 if ( ((*intIter) < 1) || (1700 < (*intIter)) ) { 00118 edm::LogError("EcalDigiDisplay") << " ic value: " << (*intIter) << " found in listChannels. " 00119 << " Valid range is 1-1700. Returning."; 00120 inputIsOk = false; 00121 return; 00122 } 00123 } 00124 } 00125 //Check with Towers in Barrel 00126 if ( ttDigi ) { 00127 for (intIter = listTowers.begin(); intIter != listTowers.end(); intIter++) { 00128 00129 if ( ((*intIter) < 1) || (70 < (*intIter)) ) { 00130 edm::LogError("EcalDigiDisplay") << " TT value: " << (*intIter) << " found in listTowers. " 00131 << " Valid range for EB SM is 1-70. Returning."; 00132 inputIsOk = false; 00133 return; 00134 } 00135 } 00136 } 00137 }else //if EE DCC is being picked up 00138 if (ttDigi) { 00139 //Check with Towers in Endcap 00140 for (intIter = listTowers.begin(); intIter != listTowers.end(); intIter++) { 00141 if ( (*intIter) > 34 ) { 00142 edm::LogError("EcalDigiDisplay") << " TT value: " << (*intIter) << " found in listTowers. " 00143 << " Valid range for EE DCC is 1-34. Returning."; 00144 inputIsOk = false; 00145 return; 00146 } 00147 } 00148 } 00149 00150 //PNs 00151 listPns = ps.getUntrackedParameter<std::vector<int> >("listPns",listDefaults); 00152 /* 00153 if ( listPns[0] != -1 ) pnDigi = true; 00154 else { 00155 listPns.clear(); 00156 for ( int i=1; i < 11; ++i ) { 00157 listPns.push_back(i); 00158 } 00159 } 00160 */ 00161 if ( pnDigi ) { 00162 for (intIter = listPns.begin(); intIter != listPns.end(); intIter++) { 00163 if ( ((*intIter) < 1) || (10 < (*intIter)) ) { 00164 edm::LogError("EcalDigiDisplay") << " Pn number : " << (*intIter) << " found in listPns. " 00165 << " Valid range is 1-10. Returning."; 00166 inputIsOk = false; 00167 return; 00168 } 00169 } 00170 } 00171 }
EcalDigiDisplay::~EcalDigiDisplay | ( | ) |
Definition at line 173 of file EcalDigiDisplay.cc.
00173 { 00174 //========================================================================= 00175 //delete *; 00176 }
void EcalDigiDisplay::analyze | ( | const edm::Event & | e, | |
const edm::EventSetup & | c | |||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 189 of file EcalDigiDisplay.cc.
References cryDigi, digiProducer_, ebDigiCollection_, eeDigiCollection_, edm::Event::getByLabel(), inputIsOk, mode, pnDigi, readEBDigis(), readEEDigis(), readPNDigis(), and ttDigi.
00189 { 00190 //======================================================================== 00191 00192 if (!inputIsOk) return; 00193 00194 //Get DCC headers 00195 edm::Handle<EcalRawDataCollection> dccHeader; 00196 try { 00197 e.getByLabel(digiProducer_,dccHeader); 00198 } catch (cms::Exception& ex) { 00199 edm::LogError("EcalDigiUnpackerModule") << "Can't get DCC Headers!"; 00200 } 00201 00202 // 00203 bool ebDigisFound = false; 00204 bool eeDigisFound = false; 00205 bool pnDigisFound = false; 00206 // retrieving crystal data from Event 00207 edm::Handle<EBDigiCollection> eb_digis; 00208 try { 00209 e.getByLabel(digiProducer_,ebDigiCollection_, eb_digis); 00210 if ( eb_digis->size() != 0 ) 00211 ebDigisFound = true; 00212 } catch (cms::Exception& ex) { 00213 edm::LogError("EcalDigiUnpackerModule") << "EB Digis were not found!"; 00214 } 00215 00216 // 00217 edm::Handle<EEDigiCollection> ee_digis; 00218 try { 00219 e.getByLabel(digiProducer_,eeDigiCollection_, ee_digis); 00220 if ( ee_digis->size() != 0 ) 00221 eeDigisFound = true; 00222 } catch (cms::Exception& ex) { 00223 edm::LogError("EcalDigiUnpackerModule") << "EE Digis were not found!"; 00224 } 00225 00226 // retrieving crystal PN diodes from Event 00227 edm::Handle<EcalPnDiodeDigiCollection> pn_digis; 00228 try { 00229 e.getByLabel(digiProducer_, pn_digis); 00230 if ( pn_digis->size() != 0) 00231 pnDigisFound = true; 00232 } catch (cms::Exception& ex) { 00233 edm::LogError("EcalDigiUnpackerModule") << "PNs were not found!"; 00234 } 00235 00236 //============================= 00237 //Call for funcitons 00238 //============================= 00239 if ( cryDigi || ttDigi ) { 00240 if ( ebDigisFound ) 00241 readEBDigis(eb_digis, mode); 00242 if ( eeDigisFound ) 00243 readEEDigis(ee_digis, mode); 00244 if ( !(ebDigisFound || eeDigisFound) ) { 00245 edm::LogWarning("EcalDigiUnpackerModule") << "No Digis were found! Returning.."; 00246 return; 00247 } 00248 } 00249 if ( pnDigi ) { 00250 if (pnDigisFound ) 00251 readPNDigis(pn_digis, mode); 00252 } 00253 }
void EcalDigiDisplay::beginJob | ( | const edm::EventSetup & | c | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 179 of file EcalDigiDisplay.cc.
References ecalElectronicsMap_, edm::EventSetup::get(), and edm::ESHandle< T >::product().
00179 { 00180 //======================================================================== 00181 edm::LogInfo("EcalDigiDisplay") << "entering beginJob! "; 00182 00183 edm::ESHandle<EcalElectronicsMapping> elecHandle; 00184 c.get<EcalMappingRcd>().get(elecHandle); 00185 ecalElectronicsMap_ = elecHandle.product(); 00186 }
Reimplemented from edm::EDAnalyzer.
Definition at line 402 of file EcalDigiDisplay.cc.
00402 { 00403 //================================================== 00404 edm::LogInfo("EcalDigiDisplay") << "DONE!.... " ; 00405 }
void EcalDigiDisplay::readEBDigis | ( | edm::Handle< EBDigiCollection > | digis, | |
int | Mode | |||
) | [protected] |
Definition at line 259 of file EcalDigiDisplay.cc.
References GenMuonPlsPt100GeV_cfg::cout, detId, ecalElectronicsMap_, lat::endl(), L1Comparator_cfi::FEDid, find(), EcalElectronicsMapping::getElectronicsId(), i, inputIsOk, listChannels, listTowers, requestedFeds_, EcalDataFrame::sample(), and tt.
Referenced by analyze().
00259 { 00260 00261 for ( EBDigiCollection::const_iterator digiItr= digis->begin();digiItr != digis->end(); 00262 ++digiItr ) { 00263 00264 EBDetId detId = EBDetId((*digiItr).id()); 00265 EcalElectronicsId elecId = ecalElectronicsMap_->getElectronicsId(detId); 00266 00267 int FEDid = elecId.dccId() + 600; 00268 std::vector<int>::iterator fedIter = find(requestedFeds_.begin(), requestedFeds_.end(), FEDid); 00269 if (fedIter == requestedFeds_.end()) continue; 00270 00271 int ic = EBDetId((*digiItr).id()).ic(); 00272 int tt = EBDetId((*digiItr).id()).tower().iTT(); 00273 00274 //Check if Mode is set 1 or 2 00275 if ( Mode ==1 ) { 00276 edm::LogInfo("EcalDigiDisplay") << "\n\n^^^^^^^^^^^^^^^^^^ [EcalDigiDisplay] digi cry collection size " << digis->size(); 00277 edm::LogInfo("EcalDigiDisplay") << " [EcalDigiDisplay] dumping first " << listChannels[0] << " crystals\n"; 00278 //It will break if all required digis are dumpped 00279 if( ic > listChannels[0]) continue; 00280 } else if ( Mode==2 ) { 00281 00282 std::vector<int>::iterator icIterCh; 00283 std::vector<int>::iterator icIterTt; 00284 icIterCh = find(listChannels.begin(), listChannels.end(), ic); 00285 icIterTt = find(listTowers.begin(), listTowers.end(), tt); 00286 if (icIterCh == listChannels.end() && icIterTt == listTowers.end() ) continue; 00287 edm::LogInfo("EcalDigiDisplay") << "\n\n^^^^^^^^^^^^^^^^^^ [EcalDigiDisplay] digi cry collection size " << digis->size(); 00288 } else { 00289 edm::LogInfo("EcalDigiDisplay") << "[EcalDigiDisplay] parameter mode set to: " << Mode 00290 << ". Only mode 1 and 2 are allowed. Returning..."; 00291 inputIsOk = false; 00292 return; 00293 } 00294 std::cout << "FEDID: " << FEDid << std::endl; 00295 std::cout << "Tower: " << EBDetId((*digiItr).id()).tower().iTT() 00296 <<" ic-cry: " 00297 << EBDetId((*digiItr).id()).ic() << " i-phi: " 00298 << EBDetId((*digiItr).id()).iphi() << " j-eta: " 00299 << EBDetId((*digiItr).id()).ieta() << std::endl; 00300 //Get Samples 00301 for ( unsigned int i=0; i< (*digiItr).size() ; ++i ) { 00302 EBDataFrame df( *digiItr ); 00303 if (!(i%3) ) std::cout << "\n\t"; 00304 std::cout << "sId: " << (i+1) << " " << df.sample(i) << "\t"; 00305 } 00306 std::cout << " " << std::endl; 00307 } 00308 }
void EcalDigiDisplay::readEEDigis | ( | edm::Handle< EEDigiCollection > | digis, | |
int | Mode | |||
) | [protected] |
Definition at line 311 of file EcalDigiDisplay.cc.
References GenMuonPlsPt100GeV_cfg::cout, detId, ecalElectronicsMap_, lat::endl(), L1Comparator_cfi::FEDid, find(), EcalElectronicsMapping::getElectronicsId(), i, listChannels, listTowers, requestedFeds_, and EcalDataFrame::sample().
Referenced by analyze().
00311 { 00312 00313 //For Endcap so far works only Mode 2 00314 if ( Mode!=2 ) { 00315 std::cout << "For Endcap mode needs to be set to 2" << std::endl; 00316 return; 00317 } 00318 00319 for ( EEDigiCollection::const_iterator digiItr= digis->begin();digiItr != digis->end(); 00320 ++digiItr ) { 00321 00322 //Make sure that digis are form requested place 00323 EEDetId detId = EEDetId((*digiItr).id()); 00324 EcalElectronicsId elecId = ecalElectronicsMap_->getElectronicsId(detId); 00325 00326 int FEDid = elecId.dccId() + 600; 00327 std::vector<int>::iterator fedIter = find(requestedFeds_.begin(), requestedFeds_.end(), FEDid); 00328 if (fedIter == requestedFeds_.end()) continue; 00329 00330 edm::LogInfo("EcalDigiDisplay") << "\n\n^^^^^^^^^^^^^^^^^^ [EcalDigiDisplay] digi cry collection size " << digis->size(); 00331 00332 int crystalId = 10000 * FEDid + 100 * elecId.towerId() + 5 * (elecId.stripId()-1)+elecId.xtalId(); 00333 int chId = elecId.towerId(); // this is a channel in Endcap DCC, sometimes also called as Super Crystal 00334 00335 std::vector<int>::iterator icIterCh; 00336 std::vector<int>::iterator icIterTt; 00337 icIterCh = find(listChannels.begin(), listChannels.end(), crystalId); 00338 icIterTt = find(listTowers.begin(), listTowers.end(), chId); 00339 if ( icIterCh == listChannels.end() && icIterTt == listTowers.end() ) continue; 00340 00341 std::cout << "FEDID: " << FEDid << std::endl; 00342 std::cout << "Tower: " << elecId.towerId() 00343 << "crystalId: " 00344 << crystalId << " i-x: " 00345 << EEDetId((*digiItr).id()).ix() << " j-y: " 00346 << EEDetId((*digiItr).id()).iy() << std::endl; 00347 00348 //Get samples 00349 for ( unsigned int i=0; i< (*digiItr).size() ; ++i ) { 00350 EEDataFrame df( *digiItr ); 00351 if (!(i%3) ) std::cout << "\n\t"; 00352 std::cout << "sId: " << (i+1) << " " << df.sample(i) << "\t"; 00353 } 00354 std::cout << " " << std::endl; 00355 } 00356 }
void EcalDigiDisplay::readPNDigis | ( | edm::Handle< EcalPnDiodeDigiCollection > | PNs, | |
int | Mode | |||
) | [protected] |
Definition at line 358 of file EcalDigiDisplay.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), L1Comparator_cfi::FEDid, find(), EcalPnDiodeDetId::iDCCId(), inputIsOk, listPns, and requestedFeds_.
Referenced by analyze().
00358 { 00359 00360 int pnDigiCounter = 0; 00361 00362 //Loop over PN digis 00363 for ( EcalPnDiodeDigiCollection::const_iterator pnItr = PNs->begin(); pnItr != PNs->end(); ++pnItr ) { 00364 EcalPnDiodeDetId pnDetId = EcalPnDiodeDetId((*pnItr).id()); 00365 //Make sure that we look at the requested place 00366 int FEDid = pnDetId.iDCCId() + 600; 00367 std::vector<int>::iterator fedIter = find(requestedFeds_.begin(), requestedFeds_.end(), FEDid); 00368 if (fedIter == requestedFeds_.end()) continue; 00369 int pnNum = (*pnItr).id().iPnId(); 00370 00371 if ( Mode == 1) { 00372 edm::LogInfo("EcalDigiDisplay") << "\n\n^^^^^^^^^^^^^^^^^^ EcalDigiDisplay digi PN collection. Size: " << PNs->size(); 00373 edm::LogInfo("EcalDigiDisplay") << " [EcalDigiDisplay] dumping first " << listPns[0] << " PNs "; 00374 00375 if ( (pnDigiCounter++) >= listPns[0] ) break; 00376 } else if ( Mode == 2) { 00377 edm::LogInfo("EcalDigiDisplay") << "\n\n^^^^^^^^^^^^^^^^^^ EcalDigiDisplay digi PN collection. Size: " << PNs->size(); 00378 00379 // Check that we look at PN from the given list 00380 std::vector<int>::iterator pnIter; 00381 pnIter = find(listPns.begin(), listPns.end(), pnNum); 00382 if (pnIter == listPns.end()) continue; 00383 } else { 00384 edm::LogError("EcalDigiDisplay")<< "[EcalDigiDisplay] parameter mode set to: " << Mode 00385 << ". Only mode 1 and 2 are allowed. Returning..."; 00386 inputIsOk = false; 00387 return; 00388 } 00389 00390 std::cout << "DCCID: " << pnDetId.iDCCId() << std::endl; 00391 std::cout << "\nPN num: " << (*pnItr).id().iPnId(); 00392 for ( int samId=0; samId < (*pnItr).size() ; samId++ ) { 00393 if (!(samId%3) ) std::cout << "\n\t"; 00394 std::cout << "sId: " << (samId+1) << " " 00395 << (*pnItr).sample(samId) 00396 << "\t"; 00397 } 00398 } 00399 }
bool EcalDigiDisplay::cryDigi [protected] |
std::string EcalDigiDisplay::digiProducer_ [protected] |
std::string EcalDigiDisplay::ebDigiCollection_ [protected] |
const EcalElectronicsMapping* EcalDigiDisplay::ecalElectronicsMap_ [protected] |
Definition at line 57 of file EcalDigiDisplay.h.
Referenced by beginJob(), readEBDigis(), and readEEDigis().
std::string EcalDigiDisplay::eeDigiCollection_ [protected] |
EcalFedMap* EcalDigiDisplay::fedMap [protected] |
bool EcalDigiDisplay::inputIsOk [protected] |
Definition at line 46 of file EcalDigiDisplay.h.
Referenced by analyze(), EcalDigiDisplay(), readEBDigis(), and readPNDigis().
std::vector<int> EcalDigiDisplay::listChannels [protected] |
Definition at line 53 of file EcalDigiDisplay.h.
Referenced by EcalDigiDisplay(), readEBDigis(), and readEEDigis().
std::vector<int> EcalDigiDisplay::listPns [protected] |
Definition at line 55 of file EcalDigiDisplay.h.
Referenced by EcalDigiDisplay(), and readPNDigis().
std::vector<int> EcalDigiDisplay::listTowers [protected] |
Definition at line 54 of file EcalDigiDisplay.h.
Referenced by EcalDigiDisplay(), readEBDigis(), and readEEDigis().
int EcalDigiDisplay::mode [protected] |
bool EcalDigiDisplay::pnDigi [protected] |
std::vector<std::string> EcalDigiDisplay::requestedEbs_ [protected] |
std::vector<int> EcalDigiDisplay::requestedFeds_ [protected] |
Definition at line 43 of file EcalDigiDisplay.h.
Referenced by EcalDigiDisplay(), readEBDigis(), readEEDigis(), and readPNDigis().
bool EcalDigiDisplay::ttDigi [protected] |