![]() |
![]() |
#include <DQM/L1TMonitor/interface/L1TdeECAL.h>
Public Member Functions | |
int | iEtaiPhiToSMid (int, int) |
L1TdeECAL (const edm::ParameterSet &) | |
int | TCCidToSMid (int) |
~L1TdeECAL () | |
Static Public Attributes | |
static const int | nSM = 36 |
static const int | nTTEta = 17 |
static const int | nTTPhi = 4 |
Protected Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob (const edm::EventSetup &) |
virtual void | endJob () |
Private Member Functions | |
int | verbose () |
Private Attributes | |
DQMStore * | dbe |
edm::InputTag | DEsource_ |
MonitorElement * | EcalEtMapDiff |
MonitorElement * | EcalFGMapDiff |
std::vector< MonitorElement * > | etmapData |
std::vector< MonitorElement * > | etmapDiff |
std::vector< MonitorElement * > | etmapEmul |
bool | hasRecord_ |
std::string | histFile_ |
std::string | histFolder_ |
bool | monitorDaemon_ |
int | verbose_ |
Definition at line 29 of file L1TdeECAL.h.
L1TdeECAL::L1TdeECAL | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 12 of file L1TdeECAL.cc.
References GenMuonPlsPt100GeV_cfg::cout, dbe, DEsource_, lat::endl(), flush(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hasRecord_, histFile_, histFolder_, NULL, verbose(), and verbose_.
00012 { 00013 00014 verbose_ = iConfig.getUntrackedParameter<int>("VerboseFlag",0); 00015 00016 if(verbose()) 00017 std::cout << "L1TdeECAL::L1TdeECAL()...\n" << std::flush; 00018 00019 DEsource_ = iConfig.getParameter<edm::InputTag>("DataEmulCompareSource"); 00020 histFolder_ = iConfig.getUntrackedParameter<std::string>("HistFolder", "L1TEMU//ECALexpert/"); 00021 00022 dbe = NULL; 00023 if (iConfig.getUntrackedParameter<bool>("DQMStore", false)) { 00024 dbe = edm::Service<DQMStore>().operator->(); 00025 dbe->setVerbose(0); 00026 } 00027 00028 histFile_ = iConfig.getUntrackedParameter<std::string>("HistFile", ""); 00029 if(iConfig.getUntrackedParameter<bool> ("disableROOToutput", true)) 00030 histFile_ = ""; 00031 00032 if (histFile_.size()!=0) { 00033 edm::LogInfo("OutputRootFile") 00034 << "L1TEmulator ECAL specific histograms will be saved to " 00035 << histFile_.c_str() 00036 << std::endl; 00037 } 00038 00039 if(dbe!=NULL) 00040 dbe->setCurrentFolder(histFolder_); 00041 00042 hasRecord_=true; 00043 00044 if(verbose()) 00045 std::cout << "L1TdeECAL::L1TdeECAL()...done.\n" << std::flush; 00046 }
L1TdeECAL::~L1TdeECAL | ( | ) |
void L1TdeECAL::analyze | ( | const edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [protected, virtual] |
get the comparison results
get the de candidates
--- Fill histograms(me) ---
Alternatively:
Implements edm::EDAnalyzer.
Definition at line 125 of file L1TdeECAL.cc.
References funct::abs(), GenMuonPlsPt100GeV_cfg::cout, DEsource_, diff, EcalBarrel, EcalEtMapDiff, EcalFGMapDiff, dedefs::ECALtp, lat::endl(), etmapData, etmapDiff, etmapEmul, dedefs::ETP, MonitorElement::Fill(), flush(), edm::Event::getByLabel(), hasRecord_, iEtaiPhiToSMid(), int, edm::Handle< T >::isValid(), it, j, edm::InputTag::label(), LogDebug, phi, EcalElectronicsMapping::TCCid(), TCCidToSMid(), and verbose().
00125 { 00126 00127 if(!hasRecord_) 00128 return; 00129 00130 if(verbose()) 00131 std::cout << "L1TdeECAL::analyze() start\n" << std::flush; 00132 00134 edm::Handle<L1DataEmulRecord> deRecord; 00135 iEvent.getByLabel(DEsource_, deRecord); 00136 00137 if (!deRecord.isValid()) { 00138 edm::LogInfo("DataNotFound") 00139 << "Cannot find L1DataEmulRecord with label " 00140 << DEsource_.label() 00141 << " Please verify that comparator was successfully executed." 00142 << " Emulator DQM for ECAL will be skipped!" 00143 << std::endl; 00144 hasRecord_=false; 00145 return; 00146 } 00147 00148 bool isComp = deRecord->get_isComp(ETP); 00149 if(!isComp) { 00150 if(verbose()) 00151 std::cout << "[L1TdeECAL] Ecal information not generated in de-record." 00152 << " Skiping event!\n"; 00153 return; 00154 } 00155 00156 int DEncand[2]; 00157 for(int j=0; j<2; j++) 00158 DEncand[j] = deRecord->getNCand(ETP,j); 00159 00160 if(verbose()) 00161 std::cout << "[L1TdeECAL] ncands" 00162 << " data: " << DEncand[0] 00163 << " emul: " << DEncand[1] 00164 << std::endl; 00165 00166 00168 L1DEDigiCollection deColl; 00169 deColl = deRecord->getColl(); 00170 00171 if(verbose()) { 00172 std::cout << "[L1TdeECAL] digis: \n"; 00173 for(L1DEDigiCollection::const_iterator it=deColl.begin(); it!=deColl.end(); it++) 00174 if(it->sid()==ETP) 00175 std::cout << "\t" << *it << std::endl; 00176 } 00177 00178 00180 00181 EcalElectronicsMapping emap; 00182 00183 // d|e candidate loop 00184 for(L1DEDigiCollection::const_iterator it=deColl.begin(); 00185 it!=deColl.end(); it++) { 00186 00187 int sid = it->sid(); 00188 int cid = it->cid(); 00189 00190 if(sid!=ETP) 00191 continue; 00192 00193 if(it->empty()) 00194 continue; 00195 00196 assert(cid==ECALtp); 00197 00198 if(verbose()) 00199 std::cout << "[L1TdeECAL] processing digi: \n\t" 00200 << *it << "\n" << std::flush; 00201 00202 //get (global) tt coordinates 00203 int iphi = (int)it->x1(); 00204 int ieta = (int)it->x2(); 00205 00206 //get sm id 00207 int ism = iEtaiPhiToSMid(ieta,iphi); //1..36 00208 00209 //get local indices 00210 int zside = (ieta>0?1:-1); 00211 int iet = abs(ieta); 00212 int ipt = iphi; 00213 ipt = ipt + 2; 00214 if ( ipt > 72 ) ipt = ipt - 72; 00215 ipt = (ipt-1)%4 + 1; 00216 if ( zside > 0 ) ipt = 5 - ipt; 00217 00218 00220 EcalTrigTowerDetId idt(zside, EcalBarrel, abs(ieta), iphi); 00221 // ... from EcalElectronicsMapping (needs addt'l lib) 00222 //int itt = map.iTT (idt); //1..68 00223 int itcc = emap.TCCid(idt); //37..54(eb+) 55..72(eb-) 00224 // need here converter tcc->sm id 00225 int smid = TCCidToSMid(itcc); 00226 // ... or as in EBTriggerTowerTask (needs addt'l lib) 00227 //int ismt = Numbers::iSM( idt ); 00228 00229 if(verbose()) 00230 std::cout << "L1TdeECAL \t" 00231 << " smid:" << smid 00232 << " ism:" << ism 00233 << " itcc:" << itcc 00234 << " local phi:" << ipt << " eta:" << iet 00235 << "\n" << std::flush 00236 << *it 00237 << "\n" << std::flush; 00238 if(ism!=smid) 00239 LogDebug("L1TdeECAL") << "consistency check failure\n\t" 00240 << " smid:" << smid 00241 << " ism:" << ism 00242 << " itcc:" << itcc 00243 << std::endl; 00244 00245 float xiet = iet+0.5; 00246 float xipt = ipt+0.5; 00247 00248 //get energy values 00249 float rankarr[2]; 00250 it->rank(rankarr); 00251 // get FG values 00252 unsigned int raw[2] ; 00253 it->data(raw) ; 00254 int FG[2] = { (raw[0] & 0x1000000)!=0, (raw[1] & 0x1000000)!=0 } ; 00255 00256 int type = it->type(); //3 data only, 4 emul only 00257 if(type!=4 && etmapData[ism-1]) 00258 etmapData[ism-1]->Fill(xiet-1, xipt-1, rankarr[0]); 00259 if(type!=3 && etmapEmul[ism-1]) 00260 etmapEmul[ism-1]->Fill(xiet-1, xipt-1, rankarr[1]); 00261 if(type<2 && etmapDiff[ism-1]) { 00262 float diff = fabs(rankarr[0]-rankarr[1]); 00263 etmapDiff[ism-1]->Fill(xiet-1, xipt-1, diff); 00264 float phi = iphi ; 00265 if (phi>70) phi -= 73 ; 00266 phi *= 5 ; 00267 if (phi>0) phi -= 5 ; 00268 EcalEtMapDiff->Fill(ieta, phi, diff) ; 00269 diff = fabs(FG[0]-FG[1]); 00270 EcalFGMapDiff->Fill(ieta, phi, diff) ; 00271 } 00272 }//close loop over dedigi-cands 00273 00274 00275 if(verbose()) 00276 std::cout << "L1TdeECAL::analyze() end.\n" << std::flush; 00277 00278 }
void L1TdeECAL::beginJob | ( | const edm::EventSetup & | ) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 51 of file L1TdeECAL.cc.
References DQMStore::book3D(), DQMStore::bookProfile2D(), GenMuonPlsPt100GeV_cfg::cout, dbe, EcalEtMapDiff, EcalFGMapDiff, etmapData, etmapDiff, etmapEmul, flush(), histFolder_, j, nSM, nTTEta, nTTPhi, DQMStore::rmdir(), DQMStore::setCurrentFolder(), tmp, and verbose().
00051 { 00052 00053 if(verbose()) 00054 std::cout << "L1TdeECAL::beginJob() start\n"; 00055 00056 DQMStore* dbe = 0; 00057 dbe = edm::Service<DQMStore>().operator->(); 00058 if(dbe) { 00059 dbe->setCurrentFolder(histFolder_); 00060 dbe->rmdir(histFolder_); 00061 } 00062 00063 if(dbe) { 00064 dbe->setCurrentFolder(histFolder_); 00065 00066 etmapData.reserve(nSM); 00067 etmapEmul.reserve(nSM); 00068 etmapDiff.reserve(nSM); 00069 etmapData.resize( nSM, static_cast<MonitorElement*>(0) ); 00070 etmapEmul.resize( nSM, static_cast<MonitorElement*>(0) ); 00071 etmapDiff.resize( nSM, static_cast<MonitorElement*>(0) ); 00072 00073 00074 std::string lbl(""); 00075 char tmp[100]; 00076 for(int j=0; j<nSM; j++) { 00077 lbl.clear(); 00078 sprintf(tmp, "etmapDataSM%d", j+1); 00079 lbl+=tmp; 00080 etmapData[j] = dbe->book3D(lbl.c_str(),lbl.c_str(), 00081 nTTEta, 0, nTTEta, 00082 nTTPhi, 0, nTTPhi, 00083 256, 0, 256.); 00084 sprintf(tmp, "etmapEmulSM%d", j+1); 00085 lbl.clear(); lbl+=tmp; 00086 etmapEmul[j] = dbe->book3D(lbl.c_str(),lbl.c_str(), 00087 nTTEta, 0, nTTEta, 00088 nTTPhi, 0, nTTPhi, 00089 256, 0, 256.); 00090 sprintf(tmp, "etmapDiffSM%d", j+1); 00091 lbl.clear(); lbl+=tmp; 00092 etmapDiff[j] = dbe->book3D(lbl.c_str(),lbl.c_str(), 00093 nTTEta, 0, nTTEta, 00094 nTTPhi, 0, nTTPhi, 00095 256, 0, 256.); 00096 } 00097 lbl= "EcalEtMapDiff" ; 00098 EcalEtMapDiff = dbe->bookProfile2D(lbl.c_str(),lbl.c_str(), 00099 35, -17.5, 17.5, 00100 72, -10., 350., 00101 256, 0, 256.); 00102 lbl= "EcalFGMapDiff" ; 00103 EcalFGMapDiff = dbe->bookProfile2D(lbl.c_str(),lbl.c_str(), 00104 35, -17.5, 17.5, 00105 72, -10., 350., 00106 2, 0, 2.); 00107 } 00108 00109 if(verbose()) 00110 std::cout << "L1TdeECAL::beginJob() end.\n" << std::flush; 00111 }
Reimplemented from edm::EDAnalyzer.
Definition at line 114 of file L1TdeECAL.cc.
References GenMuonPlsPt100GeV_cfg::cout, dbe, flush(), histFile_, DQMStore::save(), and verbose().
00114 { 00115 if(verbose()) 00116 std::cout << "L1TdeECAL::endJob()...\n" << std::flush; 00117 if(histFile_.size()!=0 && dbe) 00118 dbe->save(histFile_); 00119 //tbd delete emap; 00120 }
Definition at line 283 of file L1TdeECAL.cc.
Referenced by analyze().
00283 { 00284 // barrel 00285 int iz = (ieta<0)?-1:1; 00286 iphi += 2; 00287 if (iphi > 72) iphi -= 72; 00288 const int kEBTowersInPhi = 4; //EBDetId::kTowersInPhi 00289 int sm = ( iphi - 1 ) / kEBTowersInPhi; 00290 if ( iz < 0 ) 00291 sm += 19; 00292 else 00293 sm += 1; 00294 return sm; 00295 }
Definition at line 299 of file L1TdeECAL.cc.
Referenced by analyze().
00299 { 00300 // barrel 00301 if ( tccid>37-1 && tccid<54+1) return tccid-37+19; 00302 else if ( tccid>55-1 && tccid<72+1) return tccid-55+ 1; 00303 else return 999; 00304 }
int L1TdeECAL::verbose | ( | ) | [inline, private] |
Definition at line 56 of file L1TdeECAL.h.
References verbose_.
Referenced by analyze(), beginJob(), endJob(), and L1TdeECAL().
00056 {return verbose_;}
DQMStore* L1TdeECAL::dbe [private] |
edm::InputTag L1TdeECAL::DEsource_ [private] |
MonitorElement* L1TdeECAL::EcalEtMapDiff [private] |
MonitorElement* L1TdeECAL::EcalFGMapDiff [private] |
std::vector<MonitorElement*> L1TdeECAL::etmapData [private] |
std::vector<MonitorElement*> L1TdeECAL::etmapDiff [private] |
std::vector<MonitorElement*> L1TdeECAL::etmapEmul [private] |
bool L1TdeECAL::hasRecord_ [private] |
std::string L1TdeECAL::histFile_ [private] |
std::string L1TdeECAL::histFolder_ [private] |
bool L1TdeECAL::monitorDaemon_ [private] |
Definition at line 66 of file L1TdeECAL.h.
const int L1TdeECAL::nSM = 36 [static] |
const int L1TdeECAL::nTTEta = 17 [static] |
const int L1TdeECAL::nTTPhi = 4 [static] |
int L1TdeECAL::verbose_ [private] |