00001 #include "DQM/HcalMonitorTasks/interface/HcalCaloTowerMonitor.h"
00002 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
00003
00004 HcalCaloTowerMonitor::HcalCaloTowerMonitor(){}
00005
00006 HcalCaloTowerMonitor::~HcalCaloTowerMonitor() {}
00007
00008 void HcalCaloTowerMonitor::setup(const edm::ParameterSet& ps, DQMStore* dbe)
00009 {
00010 HcalBaseMonitor::setup(ps,dbe);
00011
00012 baseFolder_ = rootFolder_+"CaloTowerMonitor";
00013 etaMax_ = ps.getUntrackedParameter<double>("MaxEta", 41.5);
00014 etaMin_ = ps.getUntrackedParameter<double>("MinEta", -41.5);
00015 etaBins_ = (int)(etaMax_ - etaMin_);
00016 std::cout << "CaloTower Monitor eta min/max set to " << etaMin_ << "/" << etaMax_ << std::endl;
00017
00018 phiMax_ = ps.getUntrackedParameter<double>("MaxPhi", 73);
00019 phiMin_ = ps.getUntrackedParameter<double>("MinPhi", 0);
00020 phiBins_ = (int)(phiMax_ - phiMin_);
00021 std::cout << "CaloTower Monitor phi min/max set to " << phiMin_ << "/" << phiMax_ << std::endl;
00022
00023 ievt_=0;
00024
00025 if (m_dbe)
00026 {
00027 m_dbe->setCurrentFolder(baseFolder_);
00028 meEVT_ = m_dbe->bookInt("CaloTower Event Number");
00029 meEVT_->Fill(ievt_);
00030
00031
00032 caloTowerOccMap=m_dbe->book2D("CaloTowerOccupancyMap", "Calo Tower Occupancy Map",
00033 etaBins_,etaMin_,etaMax_,
00034 phiBins_,phiMin_,phiMax_);
00035
00036 caloTowerEnergyMap=m_dbe->book2D("CaloTowerEnergyMap", "Calo Tower Energy Map",
00037 etaBins_,etaMin_,etaMax_,
00038 phiBins_,phiMin_,phiMax_);
00039
00040 caloTowerTime = m_dbe->book1D("CaloTowerTime", "Calo Tower Time",
00041 10,0,10);
00042 caloTowerEnergy = m_dbe->book1D("CalotowerEnergy", "Calo Tower Energy",
00043 100,0,100);
00044 caloTowerMeanEnergyEta = m_dbe->bookProfile("CaloTowerMeanEnergyEta","Calo tower Mean Energy vs. Eta",
00045 etaBins_,etaMin_,etaMax_,100,0,100);
00046
00047
00048 m_dbe->setCurrentFolder(baseFolder_+"/"+"HCAL");
00049 hcalOccMap=m_dbe->book2D("HcalOccupancyMap", "Calo Tower Occupancy Map",
00050 etaBins_,etaMin_,etaMax_,
00051 phiBins_,phiMin_,phiMax_);
00052
00053 hcalEnergyMap=m_dbe->book2D("HcalEnergyMap", "Calo Tower Energy Map",
00054 etaBins_,etaMin_,etaMax_,
00055 phiBins_,phiMin_,phiMax_);
00056
00057 hcalTime = m_dbe->book1D("HcalTime", "Calo Tower Time",
00058 10,0,10);
00059 hcalEnergy = m_dbe->book1D("HcalEnergy", "Calo Tower Energy",
00060 100,0,100);
00061 hcalMeanEnergyEta = m_dbe->bookProfile("HcalMeanEnergyEta",
00062 "Calo tower Mean Energy vs. Eta",
00063 etaBins_,etaMin_,etaMax_,
00064 100,0,100);
00065
00066
00067 m_dbe->setCurrentFolder(baseFolder_+"/"+"ECAL");
00068 ecalOccMap=m_dbe->book2D("EcalOccupancyMap", "Calo Tower Occupancy Map",
00069 etaBins_,etaMin_,etaMax_,
00070 phiBins_,phiMin_,phiMax_);
00071
00072 ecalEnergyMap=m_dbe->book2D("EcalEnergyMap", "Calo Tower Energy Map",
00073 etaBins_,etaMin_,etaMax_,
00074 phiBins_,phiMin_,phiMax_);
00075
00076 ecalTime = m_dbe->book1D("EcalTime", "Calo Tower Time",
00077 10,0,10);
00078 ecalEnergy = m_dbe->book1D("EcalEnergy", "Calo Tower Energy",
00079 100,0,100);
00080 ecalMeanEnergyEta = m_dbe->bookProfile("EcalMeanEnergyEta",
00081 "Calo tower Mean Energy vs. Eta",
00082 etaBins_,etaMin_,etaMax_,
00083 100,0,100);
00084
00085
00086 m_dbe->setCurrentFolder(baseFolder_+"/"+"ComparisonPlots");
00087 time_HcalvsEcal=m_dbe->book2D("HcalvsEcalTime",
00088 "Hcal Time vs. Ecal time",
00089 10,0,10,10,0,10);
00090 time_CaloTowervsEcal=m_dbe->book2D("CaloTowervsEcalTime",
00091 "Calotower Time vs. Ecal time",
00092 10,0,10,10,0,10);
00093 time_CaloTowervsHcal=m_dbe->book2D("CaloTowervsHcalTime",
00094 "CaloTower Time vs. Hcal time",
00095 10,0,10,10,0,10);
00096 energy_HcalvsEcal=m_dbe->book2D("HcalvsEcalEnergy",
00097 "Hcal Energy vs. Ecal energy",
00098 100,0,100,100,0,100);
00099 energy_CaloTowervsEcal=m_dbe->book2D("CaloTowervsEcalEnergy",
00100 "Calotower Energy vs. Ecal energy",
00101 100,0,100,100,0,100);
00102 energy_CaloTowervsHcal=m_dbe->book2D("CaloTowervsHcalEnergy",
00103 "CaloTower Energy vs. Hcal energy",
00104 100,0,100,100,0,100);
00105 }
00106
00107 }
00108
00109
00110 void HcalCaloTowerMonitor::processEvent(const CaloTowerCollection& calotower)
00111 {
00112
00113 if(!m_dbe)
00114 {
00115 if(fVerbosity) std::cout <<"<HcalCaloTowerMonitor::processEvent> DQMStore not instantiated!!!\n";
00116 return;
00117 }
00118
00119 if (fVerbosity) std::cout <<"Processing calotower"<<std::endl;
00120
00121
00122
00123 float hcalenergy[90]={0.};
00124 float ecalenergy[90]={0.};
00125 int etacounts[90]={0};
00126
00127 for (CaloTowerCollection::const_iterator it=calotower.begin();
00128 it!=calotower.end();++it)
00129 {
00130
00131
00132
00133
00134
00135
00136
00137 int iphi;
00138 double eta=it->eta();
00139 double phi=it->phi();
00140
00141 if (phi<0)
00142 phi+=2*3.14159265359;
00143 iphi = int(phi/.087)+1;
00144 if (fabs(eta)>1.74)
00145 {
00146 if (fabs(eta)<=4.716)
00147 iphi=(iphi-1)/2*2+1;
00148 else
00149 iphi=(iphi-1)/4*4+3;
00150
00151 }
00152
00153 int ieta=getIeta(eta);
00154
00155
00156 hcalenergy[ieta+42]+=it->hadEnergy();
00157 ecalenergy[ieta+42]+=it->emEnergy();
00158 etacounts[ieta+42]++;
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168 caloTowerOccMap->Fill(ieta,iphi);
00169 caloTowerEnergyMap->Fill(ieta,iphi,it->energy());
00170 caloTowerTime->Fill((it->ecalTime()+it->hcalTime())/2.);
00171 caloTowerEnergy->Fill(it->energy());
00172
00173
00174
00175 hcalOccMap->Fill(ieta,iphi);
00176 hcalEnergyMap->Fill(ieta,iphi,it->hadEnergy());
00177 hcalTime->Fill(it->hcalTime());
00178 hcalEnergy->Fill(it->hadEnergy());
00179
00180
00181 ecalOccMap->Fill(ieta,iphi);
00182 ecalEnergyMap->Fill(ieta,iphi,it->emEnergy());
00183 ecalTime->Fill(it->ecalTime());
00184 ecalEnergy->Fill(it->emEnergy());
00185
00186 time_HcalvsEcal->Fill(it->ecalTime(),it->hcalTime());
00187 energy_HcalvsEcal->Fill(it->emEnergy(),it->hadEnergy());
00188 }
00189
00190
00191 for (int i=0;i<90;++i)
00192 {
00193 if (etacounts[i]==0) continue;
00194 caloTowerMeanEnergyEta->Fill(i-42, 1.*(hcalenergy[i]+ecalenergy[i])/etacounts[i]);
00195 hcalMeanEnergyEta->Fill(i-42, 1.*hcalenergy[i]/etacounts[i]);
00196 ecalMeanEnergyEta->Fill(i-42,1.*ecalenergy[i]/etacounts[i]);
00197 }
00198 }
00199
00200 int HcalCaloTowerMonitor::getIeta(double eta)
00201 {
00202
00203
00204 double myeta=fabs(eta);
00205 int neg=int(eta/myeta);
00206
00207 if (myeta<=1.740)
00208 return (1+int(myeta/.087))*neg;
00209
00210 if (fabs(eta)<=1.83)
00211 return int(21*neg);
00212 if (fabs(eta)<=1.93)
00213 return int(22*neg);
00214 if (fabs(eta)<=2.043)
00215 return int(23*neg);
00216 if (fabs(eta)<=2.172)
00217 return int(24*neg);
00218 if (fabs(eta)<=2.322)
00219 return int(25*neg);
00220
00221 if (fabs(eta)<=2.5)
00222 return int(26*neg);
00223 if (fabs(eta)<=2.65)
00224 return int(27*neg);
00225
00226
00227 if (fabs(eta)<=2.853)
00228 return int(28*neg);
00229 if (fabs(eta)<=2.964)
00230 return int(29*neg);
00231 if (fabs(eta)<=3.139)
00232 return int(30*neg);
00233
00234 if (fabs(eta)<=3.314)
00235 return int(31*neg);
00236 if (fabs(eta)<=3.489)
00237 return int(32*neg);
00238 if (fabs(eta)<=3.664)
00239 return int(33*neg);
00240 if (fabs(eta)<=3.839)
00241 return int(34*neg);
00242 if (fabs(eta)<=4.013)
00243 return int(35*neg);
00244
00245 if (fabs(eta)<=4.191)
00246 return int(36*neg);
00247 if (fabs(eta)<=4.363)
00248 return int(37*neg);
00249 if (fabs(eta)<=4.538)
00250 return int(38*neg);
00251 if (fabs(eta)<=4.716)
00252 return int(39*neg);
00253 if (fabs(eta)<=4.889)
00254 return int(40*neg);
00255 if (fabs(eta)<=5.191)
00256 return int(41*neg);
00257
00258
00259
00260 return 42;
00261
00262 }
00263
00264
00265 void HcalCaloTowerMonitor::reset(){}