10 using namespace dedefs;
17 std::cout <<
"L1TdeECAL::L1TdeECAL()...\n" << std::flush;
32 if (histFile_.size()!=0) {
34 <<
"L1TEmulator ECAL specific histograms will be saved to "
40 dbe->setCurrentFolder(histFolder_);
45 std::cout <<
"L1TdeECAL::L1TdeECAL()...done.\n" << std::flush;
54 std::cout <<
"L1TdeECAL::beginJob() start\n";
60 dbe->
rmdir(histFolder_);
66 etmapData.reserve(nSM);
67 etmapEmul.reserve(nSM);
68 etmapDiff.reserve(nSM);
69 etmapData.resize( nSM, static_cast<MonitorElement*>(0) );
70 etmapEmul.resize( nSM, static_cast<MonitorElement*>(0) );
71 etmapDiff.resize( nSM, static_cast<MonitorElement*>(0) );
76 for(
int j=0;
j<nSM;
j++) {
78 sprintf(tmp,
"etmapDataSM%d",
j+1);
80 etmapData[
j] = dbe->
book3D(lbl.c_str(),lbl.c_str(),
84 sprintf(tmp,
"etmapEmulSM%d",
j+1);
85 lbl.clear(); lbl+=
tmp;
86 etmapEmul[
j] = dbe->
book3D(lbl.c_str(),lbl.c_str(),
90 sprintf(tmp,
"etmapDiffSM%d",
j+1);
91 lbl.clear(); lbl+=
tmp;
92 etmapDiff[
j] = dbe->
book3D(lbl.c_str(),lbl.c_str(),
97 lbl=
"EcalEtMapDiff" ;
102 lbl=
"EcalFGMapDiff" ;
110 std::cout <<
"L1TdeECAL::beginJob() end.\n" << std::flush;
116 std::cout <<
"L1TdeECAL::endJob()...\n" << std::flush;
117 if(histFile_.size()!=0 && dbe)
118 dbe->save(histFile_);
131 std::cout <<
"L1TdeECAL::analyze() start\n" << std::flush;
139 <<
"Cannot find L1DataEmulRecord with label "
141 <<
" Please verify that comparator was successfully executed."
142 <<
" Emulator DQM for ECAL will be skipped!"
148 bool isComp = deRecord->get_isComp(
ETP);
151 std::cout <<
"[L1TdeECAL] Ecal information not generated in de-record."
152 <<
" Skiping event!\n";
157 for(
int j=0;
j<2;
j++)
158 DEncand[
j] = deRecord->getNCand(
ETP,
j);
162 <<
" data: " << DEncand[0]
163 <<
" emul: " << DEncand[1]
169 deColl = deRecord->getColl();
173 for(L1DEDigiCollection::const_iterator it=deColl.begin(); it!=deColl.end(); it++)
184 for(L1DEDigiCollection::const_iterator it=deColl.begin();
185 it!=deColl.end(); it++) {
199 std::cout <<
"[L1TdeECAL] processing digi: \n\t"
200 << *it <<
"\n" << std::flush;
203 int iphi = (int)it->x1();
204 int ieta = (int)it->x2();
207 int ism = iEtaiPhiToSMid(ieta,iphi);
210 int zside = (ieta>0?1:-1);
214 if ( ipt > 72 ) ipt = ipt - 72;
216 if ( zside > 0 ) ipt = 5 - ipt;
223 int itcc = emap.
TCCid(idt);
225 int smid = TCCidToSMid(itcc);
234 <<
" local phi:" << ipt <<
" eta:" << iet
235 <<
"\n" << std::flush
237 <<
"\n" << std::flush;
239 LogDebug(
"L1TdeECAL") <<
"consistency check failure\n\t"
245 float xiet = iet+0.5;
246 float xipt = ipt+0.5;
252 unsigned int raw[2] ;
254 int FG[2] = { (raw[0] & 0x1000000)!=0, (raw[1] & 0x1000000)!=0 } ;
256 int type = it->type();
257 if(type!=4 && etmapData[ism-1])
258 etmapData[ism-1]->Fill(xiet-1, xipt-1, rankarr[0]);
259 if(type!=3 && etmapEmul[ism-1])
260 etmapEmul[ism-1]->Fill(xiet-1, xipt-1, rankarr[1]);
261 if(type<2 && etmapDiff[ism-1]) {
262 float diff = fabs(rankarr[0]-rankarr[1]);
263 etmapDiff[ism-1]->Fill(xiet-1, xipt-1, diff);
265 if (phi>70) phi -= 73 ;
267 if (phi>0) phi -= 5 ;
268 EcalEtMapDiff->Fill(ieta, phi, diff) ;
269 diff = fabs(FG[0]-FG[1]);
270 EcalFGMapDiff->Fill(ieta, phi, diff) ;
276 std::cout <<
"L1TdeECAL::analyze() end.\n" << std::flush;
285 int iz = (ieta<0)?-1:1;
287 if (iphi > 72) iphi -= 72;
288 const int kEBTowersInPhi = 4;
289 int sm = ( iphi - 1 ) / kEBTowersInPhi;
301 if ( tccid>37-1 && tccid<54+1)
return tccid-37+19;
302 else if ( tccid>55-1 && tccid<72+1)
return tccid-55+ 1;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual void analyze(const edm::Event &, const edm::EventSetup &)
void rmdir(const std::string &fullpath)
MonitorElement * book3D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ)
Book 3D histogram.
std::vector< L1DataEmulDigi > L1DEDigiCollection
int TCCid(const EBDetId &id) const
returns the TCCid of an EBDetId
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
L1TdeECAL(const edm::ParameterSet &)
virtual void beginJob(void)
std::vector< std::vector< double > > tmp
int iEtaiPhiToSMid(int, int)
int ism(int ieta, int iphi)
void setCurrentFolder(const std::string &fullpath)
MonitorElement * bookProfile2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, const char *option="s")