1 |
tyetkin |
1.1 |
// -*- C++ -*-
|
2 |
|
|
//
|
3 |
|
|
// Package: ZDCAnalyzer
|
4 |
|
|
// Class: ZDCAnalyzer
|
5 |
|
|
//
|
6 |
|
|
/**\class ZDCAnalyzer ZDCAnalyzer.cc Analyzers/ZDCAnalyzer/src/ZDCAnalyzer.cc
|
7 |
|
|
|
8 |
|
|
Description: <one line class summary>
|
9 |
|
|
|
10 |
|
|
Implementation:
|
11 |
|
|
<Notes on implementation>
|
12 |
|
|
*/
|
13 |
|
|
//
|
14 |
|
|
// Original Author: Taylan Yetkin
|
15 |
|
|
// Created: Sat Nov 7 23:04:14 CET 2009
|
16 |
|
|
// $Id: ZDCAnalyzer.cc,v 1.4 2009/11/08 00:38:40 tyetkin Exp $
|
17 |
|
|
//
|
18 |
|
|
//
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
// system include files
|
22 |
|
|
#include <memory>
|
23 |
|
|
#include <iostream>
|
24 |
|
|
#include <fstream>
|
25 |
|
|
#include <algorithm>
|
26 |
|
|
#include <vector>
|
27 |
|
|
#include <string>
|
28 |
|
|
#include <sys/time.h>
|
29 |
|
|
|
30 |
|
|
// user include files
|
31 |
|
|
#include "FWCore/Framework/interface/Frameworkfwd.h"
|
32 |
|
|
#include "FWCore/Framework/interface/EDAnalyzer.h"
|
33 |
|
|
|
34 |
|
|
#include "FWCore/Framework/interface/Event.h"
|
35 |
|
|
#include "FWCore/Framework/interface/MakerMacros.h"
|
36 |
|
|
|
37 |
|
|
#include "FWCore/ParameterSet/interface/ParameterSet.h"
|
38 |
|
|
|
39 |
|
|
#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
|
40 |
|
|
// #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
|
41 |
|
|
// #include "CalibFormats/HcalObjects/interface/HcalCalibrations.h"
|
42 |
|
|
// #include "CalibFormats/HcalObjects/interface/HcalCoderDb.h"
|
43 |
|
|
#include "DataFormats/DetId/interface/DetId.h"
|
44 |
|
|
#include "Analyzers/ZDCAnalyzer/interface/ZDCAnalyzer.h"
|
45 |
|
|
#include "TH1F.h"
|
46 |
|
|
#include "TH2F.h"
|
47 |
|
|
#include "TStyle.h"
|
48 |
|
|
#include "TCanvas.h"
|
49 |
|
|
|
50 |
|
|
static const float HFQIEConst = 2.6;
|
51 |
|
|
static const float EMGain = 0.025514;
|
52 |
|
|
static const float HADGain = 0.782828;
|
53 |
|
|
|
54 |
|
|
using namespace edm;
|
55 |
|
|
using namespace std;
|
56 |
|
|
|
57 |
|
|
ZDCAnalyzer::ZDCAnalyzer(const edm::ParameterSet& iConfig){
|
58 |
|
|
Runno = iConfig.getUntrackedParameter < int >("RunNo", 1);
|
59 |
|
|
htmlPrint = iConfig.getUntrackedParameter < bool > ("printHTML", false);
|
60 |
|
|
doZDCHTML = iConfig.getUntrackedParameter < bool > ("printZDCHTML", false);
|
61 |
|
|
|
62 |
|
|
// base Html output directory
|
63 |
|
|
baseHtmlDir_ = iConfig.getUntrackedParameter < string > ("baseHtmlDir", "");
|
64 |
|
|
if (baseHtmlDir_.size() != 0)
|
65 |
|
|
cout << "-->HTML output will go to baseHtmlDir = '" << baseHtmlDir_ << "'" << endl;
|
66 |
|
|
else
|
67 |
|
|
cout << "-->HTML output is disabled" << endl;
|
68 |
|
|
|
69 |
|
|
runBegin = -1;
|
70 |
|
|
evtNo = 0;
|
71 |
|
|
lumibegin = 0;
|
72 |
|
|
lumiend = 0;
|
73 |
|
|
startTime = "Not Avaliable";
|
74 |
|
|
// root style
|
75 |
|
|
gStyle->Reset("Default");
|
76 |
|
|
gStyle->SetOptFit(1);
|
77 |
|
|
gStyle->SetCanvasColor(0);
|
78 |
|
|
gStyle->SetPadColor(0);
|
79 |
|
|
gStyle->SetFillColor(0);
|
80 |
|
|
gStyle->SetTitleFillColor(10);
|
81 |
|
|
// gStyle->SetOptStat(0);
|
82 |
|
|
gStyle->SetOptStat("ouemr");
|
83 |
|
|
gStyle->SetPalette(1);
|
84 |
|
|
//gStyle->SetPaintTextFormat("g");
|
85 |
|
|
}
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
ZDCAnalyzer::~ZDCAnalyzer(){
|
89 |
|
|
}
|
90 |
|
|
|
91 |
|
|
|
92 |
|
|
void ZDCAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
|
93 |
|
|
{
|
94 |
|
|
++evtNo;
|
95 |
|
|
time_t a = (iEvent.time().value()) >> 32;
|
96 |
|
|
event = iEvent.id().event();
|
97 |
|
|
run = iEvent.id().run();
|
98 |
|
|
bxnumber = iEvent.bunchCrossing();
|
99 |
|
|
//if (run != Runno) return;
|
100 |
|
|
|
101 |
|
|
if (iEvent.bunchCrossing() != 51 && iEvent.bunchCrossing() != 2724 ){
|
102 |
|
|
cout << "bunc crossing failed " << bxnumber << endl;
|
103 |
|
|
return;
|
104 |
|
|
}
|
105 |
|
|
std::cout << "~~~~~~~~~~event number " << event << std::endl;
|
106 |
|
|
lumi = iEvent.luminosityBlock();
|
107 |
|
|
|
108 |
|
|
//if (lumi < 105 ) return;
|
109 |
|
|
if (runBegin < 0) { // parameters for the first event
|
110 |
|
|
startTime = ctime(&a);
|
111 |
|
|
lumibegin = lumiend = lumi;
|
112 |
|
|
runBegin = iEvent.id().run();
|
113 |
|
|
}
|
114 |
|
|
run = iEvent.id().run();//needed in the tree
|
115 |
|
|
|
116 |
|
|
if (lumi < lumibegin)lumibegin = lumi;
|
117 |
|
|
if (lumi > lumiend)lumiend = lumi;
|
118 |
|
|
|
119 |
|
|
h_lumiBlock->Fill(iEvent.luminosityBlock());
|
120 |
|
|
h_bunchXing->Fill(iEvent.bunchCrossing());
|
121 |
|
|
|
122 |
|
|
// hf rechits
|
123 |
|
|
Handle < HFRecHitCollection > hf_recHits_h;
|
124 |
|
|
iEvent.getByLabel("hfreco", hf_recHits_h);
|
125 |
|
|
const HFRecHitCollection *hf_recHits = hf_recHits_h.failedToGet()? 0 : &*hf_recHits_h;
|
126 |
|
|
float hf_time_difference = -999.;
|
127 |
|
|
if (hf_recHits) { // object is available
|
128 |
|
|
std::cout << "HF RECHITS here" << iEvent.id() << std::endl;
|
129 |
|
|
float sumE_HFP = 0.;
|
130 |
|
|
float sumE_HFM = 0.;
|
131 |
|
|
float timeWeightedEnergy_HFP = 0.;
|
132 |
|
|
float timeWeightedEnergy_HFM = 0.;
|
133 |
|
|
float hf_time_difference = 0.;
|
134 |
|
|
for (HFRecHitCollection::const_iterator hhit = hf_recHits->begin(); hhit != hf_recHits->end(); hhit++) {
|
135 |
|
|
if (hhit->energy() > 2.0){ //GeV Cut
|
136 |
|
|
if((hhit->id()).ieta()>0.){ //HFP
|
137 |
|
|
if(hhit->id().depth() == 1){ //only Long Fibers
|
138 |
|
|
sumE_HFP += hhit->energy();
|
139 |
|
|
timeWeightedEnergy_HFP += (hhit->energy()*hhit->time());
|
140 |
|
|
}
|
141 |
|
|
}else{ //HFM
|
142 |
|
|
if(hhit->id().depth() == 1){ //only Long Fibers
|
143 |
|
|
sumE_HFM += hhit->energy();
|
144 |
|
|
timeWeightedEnergy_HFM += (hhit->energy()*hhit->time());
|
145 |
|
|
}
|
146 |
|
|
}
|
147 |
|
|
}
|
148 |
|
|
}
|
149 |
|
|
|
150 |
|
|
hf_time_difference = (timeWeightedEnergy_HFP/sumE_HFP - timeWeightedEnergy_HFM/sumE_HFM);
|
151 |
|
|
h_hf_time_difference ->Fill(hf_time_difference);
|
152 |
|
|
h_recHitSum_HFP_Long->Fill(sumE_HFP);
|
153 |
|
|
h_recHitSum_HFM_Long->Fill(sumE_HFM);
|
154 |
|
|
|
155 |
|
|
}
|
156 |
|
|
if(hf_time_difference == -999){
|
157 |
|
|
cout << "WARNING! RECHITS WERE NOT FOUND. NO TIMING INFORMATION" << endl;
|
158 |
|
|
}
|
159 |
|
|
|
160 |
|
|
if (fabs(hf_time_difference) < 60) return;
|
161 |
|
|
|
162 |
|
|
h_BX_after_return->Fill(iEvent.bunchCrossing());
|
163 |
|
|
//if (hf_time_difference < 60) return; //only Plus(or minus) outtime events
|
164 |
|
|
|
165 |
|
|
edm::Handle<ZDCDigiCollection> zdc_digi_h;
|
166 |
|
|
iEvent.getByType(zdc_digi_h);
|
167 |
|
|
const ZDCDigiCollection *zdc_digi = zdc_digi_h.failedToGet()? 0 : &*zdc_digi_h;
|
168 |
|
|
|
169 |
|
|
if(zdc_digi){
|
170 |
|
|
double QEM = 0.;
|
171 |
|
|
double QEMR = 0.;
|
172 |
|
|
double QHAD = 0.;
|
173 |
|
|
double QHAD1 = 0.;
|
174 |
|
|
double QHAD2 = 0.;
|
175 |
|
|
double QHADR = 0.;
|
176 |
|
|
for (ZDCDigiCollection::const_iterator j=zdc_digi->begin();j!=zdc_digi->end(); ++j) {
|
177 |
|
|
const ZDCDataFrame digi = (const ZDCDataFrame)(*j);
|
178 |
|
|
int iSide = digi.id().zside();
|
179 |
|
|
int iSection = digi.id().section();
|
180 |
|
|
int iChannel = digi.id().channel();
|
181 |
|
|
//std::cout << "Side= " << iSide << " Section= " << iSection << " Channel= " << iChannel << std::endl;
|
182 |
|
|
double fSum = 0.;
|
183 |
|
|
double fData[10] = {-999.};
|
184 |
|
|
double adcfData[10] = {-999.};
|
185 |
|
|
int fTS = digi.size();
|
186 |
|
|
for (int i = 0; i < fTS; ++i) {
|
187 |
|
|
fData[i] = HFQIEConst*digi[i].nominal_fC();
|
188 |
|
|
//fData[i] = digi[i].adc();
|
189 |
|
|
//fData[i] = digi[i].capid();
|
190 |
|
|
//std::cout << "capsRotation ";
|
191 |
|
|
// std::cout << fData[i] << std::endl;
|
192 |
|
|
//std::cout << fData[i] << std::endl;
|
193 |
|
|
histodeneme->Fill(fData[i],1);
|
194 |
|
|
}
|
195 |
|
|
|
196 |
|
|
if(!isGood(fData, 30, 0.001))continue;
|
197 |
|
|
double fTSMean = getTime(fData, fSum);
|
198 |
|
|
|
199 |
|
|
if(iSection==1){
|
200 |
|
|
|
201 |
|
|
if (iSide == -1) h_channel_side_charge->Fill(iSide+2,iChannel-1,fSum);
|
202 |
|
|
if (iSide == 1) h_channel_side_charge->Fill(iSide-1,iChannel-1,fSum);
|
203 |
|
|
//h_channel_side_timing->Fill(iSide,iChannel,fTSmean);
|
204 |
|
|
|
205 |
|
|
if (iSide ==1 ){
|
206 |
|
|
for(int i = 0; i < fTS; ++i){
|
207 |
|
|
h_ZDCP_EM_Pulse[iChannel-1]->Fill(i,fData[i]);
|
208 |
|
|
}
|
209 |
|
|
h_ZDCP_EM_Charge[iChannel-1]->Fill(fSum);
|
210 |
|
|
h_ZDCP_EM_TSMean[iChannel-1]->Fill(fTSMean);
|
211 |
|
|
//h_channel_side_timing->Fill(iSide+1,iChannel,fTSmean);
|
212 |
|
|
h_ZDCP_EM_RecHitEnergy[iChannel-1]->Fill(fSum*EMGain);
|
213 |
|
|
QEM += fSum;
|
214 |
|
|
QEMR += fSum*EMGain;
|
215 |
|
|
}
|
216 |
|
|
if (iSide == -1 ){
|
217 |
|
|
for(int i = 0; i < fTS; ++i){
|
218 |
|
|
h_ZDCM_EM_Pulse[iChannel-1]->Fill(i,fData[i]);}
|
219 |
|
|
h_ZDCM_EM_Charge[iChannel-1]->Fill(fSum);
|
220 |
|
|
h_ZDCM_EM_TSMean[iChannel-1]->Fill(fTSMean);
|
221 |
|
|
//h_channel_side_timing->Fill(iSide,iChannel,fTSmean);
|
222 |
|
|
h_ZDCM_EM_RecHitEnergy[iChannel-1]->Fill(fSum*EMGain);
|
223 |
|
|
}
|
224 |
|
|
}
|
225 |
|
|
if(iSection==2){
|
226 |
|
|
|
227 |
|
|
if (iSide == -1) h_channel_side_charge->Fill(iSide+2,iChannel+4,fSum);
|
228 |
|
|
if (iSide == 1) h_channel_side_charge->Fill(iSide-1,iChannel+4,fSum);
|
229 |
|
|
//h_channel_side_timing->Fill(iSide,iChannel+5,fTSmean);
|
230 |
|
|
|
231 |
|
|
if (iSide == 1 ){
|
232 |
|
|
for(int i = 0; i < fTS; ++i){
|
233 |
|
|
h_ZDCP_HAD_Pulse[iChannel-1]->Fill(i,fData[i]);}
|
234 |
|
|
h_ZDCP_HAD_Charge[iChannel-1]->Fill(fSum);
|
235 |
|
|
h_ZDCP_HAD_TSMean[iChannel-1]->Fill(fTSMean);
|
236 |
|
|
//h_channel_side_timing->Fill(iSide+1,iChannel+5,fTSmean);
|
237 |
|
|
h_ZDCP_HAD_RecHitEnergy[iChannel-1]->Fill(fSum*HADGain);
|
238 |
|
|
QHAD += fSum;
|
239 |
|
|
if (iChannel == 1 || iChannel ==2) QHAD1 += fSum;
|
240 |
|
|
if (iChannel == 3 || iChannel ==4) QHAD2 += fSum;
|
241 |
|
|
QHADR += fSum*HADGain;
|
242 |
|
|
if (QHAD > 10000) std::cout << "~~~~~~~~~~~~~~~"
|
243 |
|
|
<< "###############"
|
244 |
|
|
<< " Event Number " << event << " lumi = " << lumi << " BX = " << iEvent.bunchCrossing() << std::endl;
|
245 |
|
|
}
|
246 |
|
|
if (iSide == -1 ){
|
247 |
|
|
for(int i = 0; i < fTS; ++i){
|
248 |
|
|
h_ZDCM_HAD_Pulse[iChannel-1]->Fill(i,fData[i]);}
|
249 |
|
|
h_ZDCM_HAD_Charge[iChannel-1]->Fill(fSum);
|
250 |
|
|
h_ZDCM_HAD_TSMean[iChannel-1]->Fill(fTSMean);
|
251 |
|
|
//h_channel_side_timing->Fill(iSide,iChannel+5,fTSmean);
|
252 |
|
|
h_ZDCM_HAD_RecHitEnergy[iChannel-1]->Fill(fSum*HADGain);
|
253 |
|
|
}
|
254 |
|
|
}
|
255 |
|
|
}
|
256 |
|
|
h_ZDCP_Charge_Correlation->Fill(QEM, QHAD);
|
257 |
|
|
h_ZDCP_Charge_CorrelationHAD->Fill(QHAD1, QHAD2);
|
258 |
|
|
//h_ZDCP_Charge_Correlation2->Fill(QEM/5, QHAD/4);
|
259 |
|
|
//h_ZDCP_RecHit_Correlation->Fill(QEMR, QHADR);
|
260 |
|
|
}
|
261 |
|
|
}
|
262 |
|
|
|
263 |
|
|
void ZDCAnalyzer::beginJob(const edm::EventSetup& iSetup){
|
264 |
|
|
// iSetup.get<HcalDbRecord>().get(conditions);
|
265 |
|
|
TFileDirectory ZDCDir = mFileServer->mkdir("ZDC");
|
266 |
|
|
char title[128];
|
267 |
|
|
char name[128];
|
268 |
|
|
for(int i = 0; i < 4;++i){
|
269 |
|
|
// pulse Plus Side
|
270 |
|
|
sprintf(title,"h_ZDCP_HADChan_%i_Pulse",i+1);
|
271 |
|
|
sprintf(name,"ZDC Plus HAD Section Pulse for channel %i",i+1);
|
272 |
|
|
h_ZDCP_HAD_Pulse[i] = book1DHistogram(ZDCDir,title, name, 10, -0.5, 9.5);
|
273 |
|
|
h_ZDCP_HAD_Pulse[i]->SetFillColor(kBlue);
|
274 |
|
|
//integrated charge over 10 time samples
|
275 |
|
|
sprintf(title,"h_ZDCP_HADChan_%i_Charge",i+1);
|
276 |
|
|
sprintf(name,"ZDC Plus HAD Section Charge for channel %i",i+1);
|
277 |
|
|
h_ZDCP_HAD_Charge[i] = book1DHistogram(ZDCDir,title, name, 1000, -10., 30000.);
|
278 |
|
|
h_ZDCP_HAD_Charge[i]->SetFillColor(kBlue);
|
279 |
|
|
//charge weighted time slice
|
280 |
|
|
sprintf(title,"h_ZDCP_HADChan_%i_TSMean",i+1);
|
281 |
|
|
sprintf(name,"ZDC Plus HAD Section TSMean for channel %i",i+1);
|
282 |
|
|
h_ZDCP_HAD_TSMean[i] = book1DHistogram(ZDCDir,title, name, 100, -0.5, 9.5);
|
283 |
|
|
h_ZDCP_HAD_TSMean[i]->SetFillColor(kBlue);
|
284 |
|
|
//RecHit for HAD sections
|
285 |
|
|
sprintf(title,"h_ZDCP_HADChan_%i_RecHit_Energy",i+1);
|
286 |
|
|
sprintf(name,"ZDC Plus HAD Section Rechit Energy for channel %i",i+1);
|
287 |
|
|
h_ZDCP_HAD_RecHitEnergy[i] = book1DHistogram(ZDCDir,title, name, 1000, -10., 30000.);
|
288 |
|
|
h_ZDCP_HAD_RecHitEnergy[i]->SetFillColor(kRed);
|
289 |
|
|
|
290 |
|
|
// pulse Minus Side
|
291 |
|
|
sprintf(title,"h_ZDCM_HADChan_%i_Pulse",i+1);
|
292 |
|
|
sprintf(name,"ZDC Minus HAD Section Pulse for channel %i",i+1);
|
293 |
|
|
h_ZDCM_HAD_Pulse[i] = book1DHistogram(ZDCDir,title, name, 10, -0.5, 9.5);
|
294 |
|
|
h_ZDCM_HAD_Pulse[i]->SetFillColor(7);
|
295 |
|
|
//integrated charge over 10 time samples
|
296 |
|
|
sprintf(title,"h_ZDCM_HADChan_%i_Charge",i+1);
|
297 |
|
|
sprintf(name,"ZDC Minus HAD Section Charge for channel %i",i+1);
|
298 |
|
|
h_ZDCM_HAD_Charge[i] = book1DHistogram(ZDCDir,title, name, 1000, -10., 30000.);
|
299 |
|
|
h_ZDCM_HAD_Charge[i]->SetFillColor(7);
|
300 |
|
|
//charge weighted time slice
|
301 |
|
|
sprintf(title,"h_ZDCM_HADChan_%i_TSMean",i+1);
|
302 |
|
|
sprintf(name,"ZDC Minus HAD Section TSMean for channel %i",i+1);
|
303 |
|
|
h_ZDCM_HAD_TSMean[i] = book1DHistogram(ZDCDir,title, name, 100, -0.5, 9.5);
|
304 |
|
|
h_ZDCM_HAD_TSMean[i]->SetFillColor(7);
|
305 |
|
|
//RecHit for HAD sections
|
306 |
|
|
sprintf(title,"h_ZDCM_HADChan_%i_RecHit_Energy",i+1);
|
307 |
|
|
sprintf(name,"ZDC Minus HAD Section Rechit Energy for channel %i",i+1);
|
308 |
|
|
h_ZDCM_HAD_RecHitEnergy[i] = book1DHistogram(ZDCDir,title, name, 1000, -10.,30000.);
|
309 |
|
|
h_ZDCM_HAD_RecHitEnergy[i]->SetFillColor(kRed);
|
310 |
|
|
}
|
311 |
|
|
for(int i = 0; i < 5;++i){
|
312 |
|
|
// pulse Plus Side
|
313 |
|
|
sprintf(title,"h_ZDCP_EMChan_%i_Pulse",i+1);
|
314 |
|
|
sprintf(name,"ZDC Plus EM Section Pulse for channel %i",i+1);
|
315 |
|
|
h_ZDCP_EM_Pulse[i] = book1DHistogram(ZDCDir,title, name, 10, -0.5, 9.5);
|
316 |
|
|
h_ZDCP_EM_Pulse[i]->SetFillColor(kBlue);
|
317 |
|
|
//integrated charge over 10 time samples
|
318 |
|
|
sprintf(title,"h_ZDCP_EMChan_%i_Charge",i+1);
|
319 |
|
|
sprintf(name,"ZDC Plus EM Section Charge for channel %i",i+1);
|
320 |
|
|
h_ZDCP_EM_Charge[i] = book1DHistogram(ZDCDir,title, name, 1000, -10., 30000.);
|
321 |
|
|
h_ZDCP_EM_Charge[i]->SetFillColor(kBlue);
|
322 |
|
|
//charge weighted time slice
|
323 |
|
|
sprintf(title,"h_ZDCP_EMChan_%i_TSMean",i+1);
|
324 |
|
|
sprintf(name,"ZDC Plus EM Section TSMean for channel %i",i+1);
|
325 |
|
|
h_ZDCP_EM_TSMean[i] = book1DHistogram(ZDCDir,title, name, 100, -0.5, 9.5);
|
326 |
|
|
h_ZDCP_EM_TSMean[i]->SetFillColor(kBlue);
|
327 |
|
|
//RecHit for EM sections
|
328 |
|
|
sprintf(title,"h_ZDCP_EMChan_%i_RecHit_Energy",i+1);
|
329 |
|
|
sprintf(name,"ZDC Plus EM Section Rechit Energy for channel %i",i+1);
|
330 |
|
|
h_ZDCP_EM_RecHitEnergy[i] = book1DHistogram(ZDCDir,title, name, 1000, -10., 30000.);
|
331 |
|
|
h_ZDCP_EM_RecHitEnergy[i]->SetFillColor(kRed);
|
332 |
|
|
|
333 |
|
|
// pulse Minus Side
|
334 |
|
|
sprintf(title,"h_ZDCM_EMChan_%i_Pulse",i+1);
|
335 |
|
|
sprintf(name,"ZDC Minus EM Section Pulse for channel %i",i+1);
|
336 |
|
|
h_ZDCM_EM_Pulse[i] = book1DHistogram(ZDCDir,title, name, 10, -0.5, 9.5);
|
337 |
|
|
h_ZDCM_EM_Pulse[i]->SetFillColor(7);
|
338 |
|
|
//integrated charge over 10 time samples
|
339 |
|
|
sprintf(title,"h_ZDCM_EMChan_%i_Charge",i+1);
|
340 |
|
|
sprintf(name,"ZDC Minus EM Section Charge for channel %i",i+1);
|
341 |
|
|
h_ZDCM_EM_Charge[i] = book1DHistogram(ZDCDir,title, name, 1000, -10., 30000.);
|
342 |
|
|
h_ZDCM_EM_Charge[i]->SetFillColor(7);
|
343 |
|
|
//charge weighted time slice
|
344 |
|
|
sprintf(title,"h_ZDCM_EMChan_%i_TSMean",i+1);
|
345 |
|
|
sprintf(name,"ZDC Minus EM Section TSMean for channel %i",i+1);
|
346 |
|
|
h_ZDCM_EM_TSMean[i] = book1DHistogram(ZDCDir,title, name, 100, -0.5, 9.5);
|
347 |
|
|
h_ZDCM_EM_TSMean[i]->SetFillColor(7);
|
348 |
|
|
//RecHit for EM sections
|
349 |
|
|
sprintf(title,"h_ZDCM_EMChan_%i_RecHit_Energy",i+1);
|
350 |
|
|
sprintf(name,"ZDC Minus EM Section Rechit Energy for channel %i",i+1);
|
351 |
|
|
h_ZDCM_EM_RecHitEnergy[i] = book1DHistogram(ZDCDir,title, name, 1000, -10., 30000.);
|
352 |
|
|
h_ZDCM_EM_RecHitEnergy[i]->SetFillColor(kRed);
|
353 |
|
|
}
|
354 |
|
|
|
355 |
|
|
h_recHitSum_HFP_Long = book1DHistogram(ZDCDir,"h_recHitSum_HFP", "HFP RecHit Sum", 100, -10., 1000.);
|
356 |
|
|
h_recHitSum_HFM_Long = book1DHistogram(ZDCDir,"h_recHitSum_HFM", "HFM RecHit Sum", 100, -10., 1000.);
|
357 |
|
|
h_hf_time_difference = book1DHistogram(ZDCDir,"HF_time_difference", "HFP_L sum(E*Time)/sumE - HFM_L sum(E*Time)/sumE", 100, -100., 100.);
|
358 |
|
|
|
359 |
|
|
h_channel_side_charge = book2DHistogram(ZDCDir,"charge", "Occup. charge", 2,0,2,9,0,9);
|
360 |
|
|
h_channel_side_timing = book2DHistogram(ZDCDir,"timing", "Occup. timing", 2,0,2,9,0,9);
|
361 |
|
|
|
362 |
|
|
h_channel_side_charge->GetXaxis()->SetBinLabel(1,"ZDC+");
|
363 |
|
|
h_channel_side_charge->GetXaxis()->SetBinLabel(2,"ZDC-");
|
364 |
|
|
h_channel_side_timing->GetXaxis()->SetBinLabel(1,"ZDC+");
|
365 |
|
|
h_channel_side_timing->GetXaxis()->SetBinLabel(2,"ZDC-");
|
366 |
|
|
|
367 |
|
|
h_channel_side_charge->GetYaxis()->SetBinLabel(1,"EM1");
|
368 |
|
|
h_channel_side_charge->GetYaxis()->SetBinLabel(2,"EM2");
|
369 |
|
|
h_channel_side_charge->GetYaxis()->SetBinLabel(3,"EM3");
|
370 |
|
|
h_channel_side_charge->GetYaxis()->SetBinLabel(4,"EM4");
|
371 |
|
|
h_channel_side_charge->GetYaxis()->SetBinLabel(5,"EM5");
|
372 |
|
|
h_channel_side_charge->GetYaxis()->SetBinLabel(6,"HAD1");
|
373 |
|
|
h_channel_side_charge->GetYaxis()->SetBinLabel(7,"HAD2");
|
374 |
|
|
h_channel_side_charge->GetYaxis()->SetBinLabel(8,"HAD3");
|
375 |
|
|
h_channel_side_charge->GetYaxis()->SetBinLabel(9,"HAD4");
|
376 |
|
|
|
377 |
|
|
h_channel_side_timing->GetYaxis()->SetBinLabel(1,"EM1");
|
378 |
|
|
h_channel_side_timing->GetYaxis()->SetBinLabel(2,"EM2");
|
379 |
|
|
h_channel_side_timing->GetYaxis()->SetBinLabel(3,"EM3");
|
380 |
|
|
h_channel_side_timing->GetYaxis()->SetBinLabel(4,"EM4");
|
381 |
|
|
h_channel_side_timing->GetYaxis()->SetBinLabel(5,"EM5");
|
382 |
|
|
h_channel_side_timing->GetYaxis()->SetBinLabel(6,"HAD1");
|
383 |
|
|
h_channel_side_timing->GetYaxis()->SetBinLabel(7,"HAD2");
|
384 |
|
|
h_channel_side_timing->GetYaxis()->SetBinLabel(8,"HAD3");
|
385 |
|
|
h_channel_side_timing->GetYaxis()->SetBinLabel(9,"HAD4");
|
386 |
|
|
|
387 |
|
|
|
388 |
|
|
h_channel_side_charge_Ave = book2DHistogram(ZDCDir,"charge_Ave", "Occup. charge_Ave", 2,0,2,9,0,9);
|
389 |
|
|
|
390 |
|
|
//h_channel_side_charge_Ave->Draw("TEXT");
|
391 |
|
|
|
392 |
|
|
h_channel_side_charge_Ave->GetXaxis()->SetBinLabel(1,"ZDC+");
|
393 |
|
|
h_channel_side_charge_Ave->GetXaxis()->SetBinLabel(2,"ZDC-");
|
394 |
|
|
|
395 |
|
|
h_channel_side_charge_Ave->GetYaxis()->SetBinLabel(1,"EM1");
|
396 |
|
|
h_channel_side_charge_Ave->GetYaxis()->SetBinLabel(2,"EM2");
|
397 |
|
|
h_channel_side_charge_Ave->GetYaxis()->SetBinLabel(3,"EM3");
|
398 |
|
|
h_channel_side_charge_Ave->GetYaxis()->SetBinLabel(4,"EM4");
|
399 |
|
|
h_channel_side_charge_Ave->GetYaxis()->SetBinLabel(5,"EM5");
|
400 |
|
|
h_channel_side_charge_Ave->GetYaxis()->SetBinLabel(6,"HAD1");
|
401 |
|
|
h_channel_side_charge_Ave->GetYaxis()->SetBinLabel(7,"HAD2");
|
402 |
|
|
h_channel_side_charge_Ave->GetYaxis()->SetBinLabel(8,"HAD3");
|
403 |
|
|
h_channel_side_charge_Ave->GetYaxis()->SetBinLabel(9,"HAD4");
|
404 |
|
|
|
405 |
|
|
h_channel_side_TSMean_Ave = book2DHistogram(ZDCDir,"TSMean_Ave", "Occup. TSMean_Ave", 2,0,2,9,0,9);
|
406 |
|
|
|
407 |
|
|
h_channel_side_TSMean_Ave->GetXaxis()->SetBinLabel(1,"ZDC+");
|
408 |
|
|
h_channel_side_TSMean_Ave->GetXaxis()->SetBinLabel(2,"ZDC-");
|
409 |
|
|
|
410 |
|
|
h_channel_side_TSMean_Ave->GetYaxis()->SetBinLabel(1,"EM1");
|
411 |
|
|
h_channel_side_TSMean_Ave->GetYaxis()->SetBinLabel(2,"EM2");
|
412 |
|
|
h_channel_side_TSMean_Ave->GetYaxis()->SetBinLabel(3,"EM3");
|
413 |
|
|
h_channel_side_TSMean_Ave->GetYaxis()->SetBinLabel(4,"EM4");
|
414 |
|
|
h_channel_side_TSMean_Ave->GetYaxis()->SetBinLabel(5,"EM5");
|
415 |
|
|
h_channel_side_TSMean_Ave->GetYaxis()->SetBinLabel(6,"HAD1");
|
416 |
|
|
h_channel_side_TSMean_Ave->GetYaxis()->SetBinLabel(7,"HAD2");
|
417 |
|
|
h_channel_side_TSMean_Ave->GetYaxis()->SetBinLabel(8,"HAD3");
|
418 |
|
|
h_channel_side_TSMean_Ave->GetYaxis()->SetBinLabel(9,"HAD4");
|
419 |
|
|
|
420 |
|
|
h_bunchXing = book1DHistogram(ZDCDir,"h_bunchXing", "BX distribution", 3565, -0.5, 3563.5);
|
421 |
|
|
h_lumiBlock = book1DHistogram(ZDCDir,"h_lumiBlock", "Lumi Blocks", 300, -0.5, 295.5);
|
422 |
|
|
histodeneme = book1DHistogram(ZDCDir,"histodeneme", "QIE Bins", 128, -0.5, 127.5);
|
423 |
|
|
h_bunchXing->SetFillColor(kBlue);
|
424 |
|
|
h_lumiBlock->SetFillColor(kBlue);
|
425 |
|
|
histodeneme->SetFillColor(kBlue);
|
426 |
|
|
h_BX_before_return = book1DHistogram(ZDCDir,"h_BX_before", "BX distribution", 3565, -0.5, 3563.5);
|
427 |
|
|
h_BX_after_return = book1DHistogram(ZDCDir,"h_BX_after", "BX distribution for nonIP5 Events", 3565, -0.5, 3563.5);
|
428 |
|
|
|
429 |
|
|
h_ZDCP_EM_RecHitEnergyAve = book1DHistogram(ZDCDir,"h_ZDCP_EM_RecHitEnergyAve", "ZDC Plus EM Section RecHitEnergyAve", 5, -0.5, 4.5);
|
430 |
|
|
h_ZDCP_EM_RecHitEnergyAve->GetXaxis()->SetBinLabel(1,"+EM1");
|
431 |
|
|
h_ZDCP_EM_RecHitEnergyAve->GetXaxis()->SetBinLabel(2,"+EM2");
|
432 |
|
|
h_ZDCP_EM_RecHitEnergyAve->GetXaxis()->SetBinLabel(3,"+EM3");
|
433 |
|
|
h_ZDCP_EM_RecHitEnergyAve->GetXaxis()->SetBinLabel(4,"+EM4");
|
434 |
|
|
h_ZDCP_EM_RecHitEnergyAve->GetXaxis()->SetBinLabel(5,"+EM5");
|
435 |
|
|
h_ZDCP_HAD_RecHitEnergyAve = book1DHistogram(ZDCDir,"h_ZDCP_HAD_RecHitEnergyAve", "ZDC Plus HAD Section RecHitEnergyAve", 4, -0.5, 3.5);
|
436 |
|
|
h_ZDCP_HAD_RecHitEnergyAve->GetXaxis()->SetBinLabel(1,"+HAD1");
|
437 |
|
|
h_ZDCP_HAD_RecHitEnergyAve->GetXaxis()->SetBinLabel(2,"+HAD2");
|
438 |
|
|
h_ZDCP_HAD_RecHitEnergyAve->GetXaxis()->SetBinLabel(3,"+HAD3");
|
439 |
|
|
h_ZDCP_HAD_RecHitEnergyAve->GetXaxis()->SetBinLabel(4,"+HAD4");
|
440 |
|
|
|
441 |
|
|
h_ZDCP_EMHAD_ChargeAve = book1DHistogram(ZDCDir,"h_ZDCP_EMHAD_ChargeAve", "ZDC Plus ChargeAve", 9, -0.5, 8.5);
|
442 |
|
|
h_ZDCP_EMHAD_ChargeAve->GetXaxis()->SetBinLabel(1,"+EM1");
|
443 |
|
|
h_ZDCP_EMHAD_ChargeAve->GetXaxis()->SetBinLabel(2,"+EM2");
|
444 |
|
|
h_ZDCP_EMHAD_ChargeAve->GetXaxis()->SetBinLabel(3,"+EM3");
|
445 |
|
|
h_ZDCP_EMHAD_ChargeAve->GetXaxis()->SetBinLabel(4,"+EM4");
|
446 |
|
|
h_ZDCP_EMHAD_ChargeAve->GetXaxis()->SetBinLabel(5,"+EM5");
|
447 |
|
|
h_ZDCP_EMHAD_ChargeAve->GetXaxis()->SetBinLabel(6,"+HAD1");
|
448 |
|
|
h_ZDCP_EMHAD_ChargeAve->GetXaxis()->SetBinLabel(7,"+HAD2");
|
449 |
|
|
h_ZDCP_EMHAD_ChargeAve->GetXaxis()->SetBinLabel(8,"+HAD3");
|
450 |
|
|
h_ZDCP_EMHAD_ChargeAve->GetXaxis()->SetBinLabel(9,"+HAD4");
|
451 |
|
|
|
452 |
|
|
//setZDClabels(h_ZDCP_EMHAD_TSMeanAve);
|
453 |
|
|
h_ZDCP_EMHAD_TSMeanAve = book1DHistogram(ZDCDir,"h_ZDCP_EMHAD_TSMeanAve", "ZDC Plus Timing", 9, -0.5, 8.5);
|
454 |
|
|
h_ZDCP_EMHAD_TSMeanAve->GetXaxis()->SetBinLabel(1,"+EM1");
|
455 |
|
|
h_ZDCP_EMHAD_TSMeanAve->GetXaxis()->SetBinLabel(2,"+EM2");
|
456 |
|
|
h_ZDCP_EMHAD_TSMeanAve->GetXaxis()->SetBinLabel(3,"+EM3");
|
457 |
|
|
h_ZDCP_EMHAD_TSMeanAve->GetXaxis()->SetBinLabel(4,"+EM4");
|
458 |
|
|
h_ZDCP_EMHAD_TSMeanAve->GetXaxis()->SetBinLabel(5,"+EM5");
|
459 |
|
|
h_ZDCP_EMHAD_TSMeanAve->GetXaxis()->SetBinLabel(6,"+HAD1");
|
460 |
|
|
h_ZDCP_EMHAD_TSMeanAve->GetXaxis()->SetBinLabel(7,"+HAD2");
|
461 |
|
|
h_ZDCP_EMHAD_TSMeanAve->GetXaxis()->SetBinLabel(8,"+HAD3");
|
462 |
|
|
h_ZDCP_EMHAD_TSMeanAve->GetXaxis()->SetBinLabel(9,"+HAD4");
|
463 |
|
|
|
464 |
|
|
h_ZDCP_Charge_Correlation = book2DHistogram(ZDCDir,"h_ZDCP_Charge_Correlation","ZDC Plus Charge Correlation",1000,-10.,120000.,1000,-10.,120000.);
|
465 |
|
|
//h_ZDCP_Charge_Correlation2 = book2DHistogram(ZDCDir,"h_ZDCP_Charge_Correlation2","ZDCP Charge Correlation2",100,-10.,1000.,100,-10.,1000.);
|
466 |
|
|
//h_ZDCP_RecHit_Correlation = book2DHistogram(ZDCDir,"h_ZDCP_RecHit_Correlation","ZDCP RecHit Correlation",,0.,1000.,1000,0.,20000.);
|
467 |
|
|
h_ZDCP_Charge_CorrelationHAD = book2DHistogram(ZDCDir,"h_ZDCP_Charge_CorrelationHAD","ZDC Plus Charge CorrelationHAD",2000,-10.,60000.,2000,-10.,60000.);
|
468 |
|
|
|
469 |
|
|
h_ZDCP_EM_RecHitEnergyAve->Sumw2();
|
470 |
|
|
h_ZDCP_HAD_RecHitEnergyAve->Sumw2();
|
471 |
|
|
h_ZDCP_EMHAD_ChargeAve->Sumw2();
|
472 |
|
|
h_ZDCP_EMHAD_TSMeanAve->Sumw2();
|
473 |
|
|
|
474 |
|
|
h_ZDCP_EM_RecHitEnergyAve->SetFillColor(kRed);
|
475 |
|
|
h_ZDCP_HAD_RecHitEnergyAve->SetFillColor(kRed);
|
476 |
|
|
h_ZDCP_EMHAD_TSMeanAve->SetFillColor(kRed);
|
477 |
|
|
h_ZDCP_Charge_Correlation->SetMarkerColor(kBlue);
|
478 |
|
|
h_ZDCP_Charge_Correlation->SetMarkerStyle(kFullTriangleUp);
|
479 |
|
|
//h_ZDCP_Charge_Correlation2->SetMarkerColor(kRed);
|
480 |
|
|
//h_ZDCP_Charge_Correlation2->SetMarkerStyle(kFullTriangleUp);
|
481 |
|
|
//h_ZDCP_RecHit_Correlation->SetMarkerColor(kRed);
|
482 |
|
|
//h_ZDCP_RecHit_Correlation->SetMarkerStyle(kFullTriangleDown);
|
483 |
|
|
h_ZDCP_Charge_CorrelationHAD->SetMarkerColor(kRed);
|
484 |
|
|
h_ZDCP_Charge_CorrelationHAD->SetMarkerStyle(kFullTriangleUp);
|
485 |
|
|
|
486 |
|
|
// Minus Side Histograms
|
487 |
|
|
|
488 |
|
|
h_ZDCM_EM_RecHitEnergyAve = book1DHistogram(ZDCDir,"h_ZDCM_EM_RecHitEnergyAve", "ZDC Minus EM Section RecHitEnergyAve", 5, -0.5, 4.5);
|
489 |
|
|
h_ZDCM_EM_RecHitEnergyAve->GetXaxis()->SetBinLabel(1,"-EM1");
|
490 |
|
|
h_ZDCM_EM_RecHitEnergyAve->GetXaxis()->SetBinLabel(2,"-EM2");
|
491 |
|
|
h_ZDCM_EM_RecHitEnergyAve->GetXaxis()->SetBinLabel(3,"-EM3");
|
492 |
|
|
h_ZDCM_EM_RecHitEnergyAve->GetXaxis()->SetBinLabel(4,"-EM4");
|
493 |
|
|
h_ZDCM_EM_RecHitEnergyAve->GetXaxis()->SetBinLabel(5,"-EM5");
|
494 |
|
|
h_ZDCM_HAD_RecHitEnergyAve = book1DHistogram(ZDCDir,"h_ZDCM_HAD_RecHitEnergyAve", "ZDC Minus HAD Section RecHitEnergyAve", 4, -0.5, 3.5);
|
495 |
|
|
h_ZDCM_HAD_RecHitEnergyAve->GetXaxis()->SetBinLabel(1,"-HAD1");
|
496 |
|
|
h_ZDCM_HAD_RecHitEnergyAve->GetXaxis()->SetBinLabel(2,"-HAD2");
|
497 |
|
|
h_ZDCM_HAD_RecHitEnergyAve->GetXaxis()->SetBinLabel(3,"-HAD3");
|
498 |
|
|
h_ZDCM_HAD_RecHitEnergyAve->GetXaxis()->SetBinLabel(4,"-HAD4");
|
499 |
|
|
|
500 |
|
|
h_ZDCM_EMHAD_ChargeAve = book1DHistogram(ZDCDir,"h_ZDCM_EMHAD_ChargeAve", "ZDC Minus ChargeAve", 9, -0.5, 8.5);
|
501 |
|
|
h_ZDCM_EMHAD_ChargeAve->GetXaxis()->SetBinLabel(1,"-EM1");
|
502 |
|
|
h_ZDCM_EMHAD_ChargeAve->GetXaxis()->SetBinLabel(2,"-EM2");
|
503 |
|
|
h_ZDCM_EMHAD_ChargeAve->GetXaxis()->SetBinLabel(3,"-EM3");
|
504 |
|
|
h_ZDCM_EMHAD_ChargeAve->GetXaxis()->SetBinLabel(4,"-EM4");
|
505 |
|
|
h_ZDCM_EMHAD_ChargeAve->GetXaxis()->SetBinLabel(5,"-EM5");
|
506 |
|
|
h_ZDCM_EMHAD_ChargeAve->GetXaxis()->SetBinLabel(6,"-HAD1");
|
507 |
|
|
h_ZDCM_EMHAD_ChargeAve->GetXaxis()->SetBinLabel(7,"-HAD2");
|
508 |
|
|
h_ZDCM_EMHAD_ChargeAve->GetXaxis()->SetBinLabel(8,"-HAD3");
|
509 |
|
|
h_ZDCM_EMHAD_ChargeAve->GetXaxis()->SetBinLabel(9,"-HAD4");
|
510 |
|
|
|
511 |
|
|
h_ZDCM_EMHAD_TSMeanAve = book1DHistogram(ZDCDir,"h_ZDCM_EMHAD_TSMeanAve", "ZDC Minus Timing", 9, -0.5, 8.5);
|
512 |
|
|
h_ZDCM_EMHAD_TSMeanAve->GetXaxis()->SetBinLabel(1,"-EM1");
|
513 |
|
|
h_ZDCM_EMHAD_TSMeanAve->GetXaxis()->SetBinLabel(2,"-EM2");
|
514 |
|
|
h_ZDCM_EMHAD_TSMeanAve->GetXaxis()->SetBinLabel(3,"-EM3");
|
515 |
|
|
h_ZDCM_EMHAD_TSMeanAve->GetXaxis()->SetBinLabel(4,"-EM4");
|
516 |
|
|
h_ZDCM_EMHAD_TSMeanAve->GetXaxis()->SetBinLabel(5,"-EM5");
|
517 |
|
|
h_ZDCM_EMHAD_TSMeanAve->GetXaxis()->SetBinLabel(6,"-HAD1");
|
518 |
|
|
h_ZDCM_EMHAD_TSMeanAve->GetXaxis()->SetBinLabel(7,"-HAD2");
|
519 |
|
|
h_ZDCM_EMHAD_TSMeanAve->GetXaxis()->SetBinLabel(8,"-HAD3");
|
520 |
|
|
h_ZDCM_EMHAD_TSMeanAve->GetXaxis()->SetBinLabel(9,"-HAD4");
|
521 |
|
|
|
522 |
|
|
h_ZDCM_EM_RecHitEnergyAve->Sumw2();
|
523 |
|
|
h_ZDCM_HAD_RecHitEnergyAve->Sumw2();
|
524 |
|
|
h_ZDCM_EMHAD_ChargeAve->Sumw2();
|
525 |
|
|
h_ZDCM_EMHAD_TSMeanAve->Sumw2();
|
526 |
|
|
h_ZDCM_EM_RecHitEnergyAve->SetFillColor(kRed);
|
527 |
|
|
h_ZDCM_HAD_RecHitEnergyAve->SetFillColor(kRed);
|
528 |
|
|
h_ZDCM_EMHAD_TSMeanAve->SetFillColor(kRed);
|
529 |
|
|
}
|
530 |
|
|
|
531 |
|
|
//exact copy from http://cmslxr.fnal.gov/lxr/source/DQM/HcalMonitorModule/src/HcalTimingMonitorModule.cc#100
|
532 |
|
|
bool ZDCAnalyzer::isGood(double fData[10], double fCut, double fPercentage){
|
533 |
|
|
bool dec = false;
|
534 |
|
|
int n = 10;
|
535 |
|
|
int ts_max=-1; double max=-100;
|
536 |
|
|
ts_max = getTSMax(fData,10);
|
537 |
|
|
if(ts_max==0 || ts_max==(n-1)) return false;
|
538 |
|
|
float sum = fData[ts_max-1] + fData[ts_max+1];
|
539 |
|
|
//cout << "tsMax " << ts_max << " data[tsmax] " << mData[ts_max] << " sum " << sum << endl;
|
540 |
|
|
if(fData[ts_max] > fCut && sum > (fData[ts_max]*fPercentage)) dec = true;
|
541 |
|
|
return dec;
|
542 |
|
|
}
|
543 |
|
|
|
544 |
|
|
|
545 |
|
|
int ZDCAnalyzer::getTSMax(double fData[10], int fTS)
|
546 |
|
|
{
|
547 |
|
|
int ts_max = -100;
|
548 |
|
|
double max = -9999.;
|
549 |
|
|
for(int j = 0; j < fTS; ++j){
|
550 |
|
|
if(max < fData[j]){
|
551 |
|
|
max = fData[j];
|
552 |
|
|
ts_max = j;
|
553 |
|
|
}
|
554 |
|
|
}
|
555 |
|
|
return ts_max;
|
556 |
|
|
}
|
557 |
|
|
double ZDCAnalyzer::getTime(double fData[10], double& fSum){
|
558 |
|
|
int n = 10;
|
559 |
|
|
int ts_max = getTSMax(fData,10);
|
560 |
|
|
double Time=0,SumT=0; //,MaxT=-10;
|
561 |
|
|
if (ts_max>=0){
|
562 |
|
|
Time = ts_max*fData[ts_max];
|
563 |
|
|
SumT = fData[ts_max];
|
564 |
|
|
if(ts_max>0){
|
565 |
|
|
Time += (ts_max-1)*fData[ts_max-1];
|
566 |
|
|
SumT += fData[ts_max-1];
|
567 |
|
|
}
|
568 |
|
|
if(ts_max<(n-1)){
|
569 |
|
|
Time += (ts_max+1)*fData[ts_max+1];
|
570 |
|
|
SumT += fData[ts_max+1];
|
571 |
|
|
}
|
572 |
|
|
Time=Time/SumT;
|
573 |
|
|
}
|
574 |
|
|
if (SumT > 0.) fSum = SumT;
|
575 |
|
|
|
576 |
|
|
return Time;
|
577 |
|
|
}
|
578 |
|
|
TH1F *ZDCAnalyzer::book1DHistogram(TFileDirectory & fDir, const std::string & fName, const std::string & fTitle,
|
579 |
|
|
int fNbins, double fXmin, double fXmax) const {
|
580 |
|
|
char title[1024];
|
581 |
|
|
sprintf(title, "%s [RUN:%i]", fTitle.c_str(), Runno);
|
582 |
|
|
return fDir.make < TH1F > (fName.c_str(), title, fNbins, fXmin, fXmax);
|
583 |
|
|
}
|
584 |
|
|
TH2F *ZDCAnalyzer::book2DHistogram(TFileDirectory & fDir, const std::string & fName, const std::string & fTitle,
|
585 |
|
|
int fNbinsX, double fXmin, double fXmax, int fNbinsY, double fYmin, double fYmax) const {
|
586 |
|
|
char title[1024];
|
587 |
|
|
sprintf(title, "%s [RUN:%i]", fTitle.c_str(), Runno);
|
588 |
|
|
return fDir.make < TH2F > (fName.c_str(), title, fNbinsX, fXmin, fXmax, fNbinsY, fYmin, fYmax);
|
589 |
|
|
}
|
590 |
|
|
|
591 |
|
|
void ZDCAnalyzer::endJob() {
|
592 |
|
|
for(int i = 0; i < 5;++i){
|
593 |
|
|
h_ZDCP_EMHAD_TSMeanAve->SetBinContent(i+1,h_ZDCP_EM_TSMean[i]->GetMean());
|
594 |
|
|
h_ZDCP_EMHAD_TSMeanAve->SetBinError(i+1,h_ZDCP_EM_TSMean[i]->GetMeanError());
|
595 |
|
|
h_ZDCP_EMHAD_ChargeAve->SetBinContent(i+1,h_ZDCP_EM_Charge[i]->GetMean());
|
596 |
|
|
h_ZDCP_EMHAD_ChargeAve->SetBinError(i+1,h_ZDCP_EM_Charge[i]->GetMeanError());
|
597 |
|
|
h_ZDCP_EM_RecHitEnergyAve->SetBinContent(i+1,h_ZDCP_EM_RecHitEnergy[i]->GetMean());
|
598 |
|
|
h_ZDCP_EM_RecHitEnergyAve->SetBinError(i+1,h_ZDCP_EM_RecHitEnergy[i]->GetMeanError());
|
599 |
|
|
h_ZDCP_EM_Pulse[i]->Scale(10./h_ZDCP_EM_Pulse[i]->GetEntries());
|
600 |
|
|
|
601 |
|
|
h_channel_side_charge_Ave->SetBinContent(1,i+1,h_ZDCP_EM_Charge[i]->GetMean());
|
602 |
|
|
//h_channel_side_charge_Ave->Draw("TEXT");
|
603 |
|
|
h_channel_side_TSMean_Ave->SetBinContent(1,i+1,h_ZDCP_EM_TSMean[i]->GetMean());
|
604 |
|
|
//h_channel_side_TSMean_Ave->Draw("TEXT");
|
605 |
|
|
|
606 |
|
|
h_ZDCM_EMHAD_TSMeanAve->SetBinContent(i+1,h_ZDCM_EM_TSMean[i]->GetMean());
|
607 |
|
|
h_ZDCM_EMHAD_TSMeanAve->SetBinError(i+1,h_ZDCM_EM_TSMean[i]->GetMeanError());
|
608 |
|
|
h_ZDCM_EMHAD_ChargeAve->SetBinContent(i+1,h_ZDCM_EM_Charge[i]->GetMean());
|
609 |
|
|
h_ZDCM_EMHAD_ChargeAve->SetBinError(i+1,h_ZDCM_EM_Charge[i]->GetMeanError());
|
610 |
|
|
h_ZDCM_EM_RecHitEnergyAve->SetBinContent(i+1,h_ZDCM_EM_RecHitEnergy[i]->GetMean());
|
611 |
|
|
h_ZDCM_EM_RecHitEnergyAve->SetBinError(i+1,h_ZDCM_EM_RecHitEnergy[i]->GetMeanError());
|
612 |
|
|
h_ZDCM_EM_Pulse[i]->Scale(10./h_ZDCM_EM_Pulse[i]->GetEntries());
|
613 |
|
|
|
614 |
|
|
h_channel_side_charge_Ave->SetBinContent(2,i+1,h_ZDCM_EM_Charge[i]->GetMean());
|
615 |
|
|
h_channel_side_TSMean_Ave->SetBinContent(2,i+1,h_ZDCM_EM_TSMean[i]->GetMean());
|
616 |
|
|
}
|
617 |
|
|
for(int i = 0; i < 4;++i){
|
618 |
|
|
h_ZDCP_EMHAD_TSMeanAve->SetBinContent(i+6,h_ZDCP_HAD_TSMean[i]->GetMean());
|
619 |
|
|
h_ZDCP_EMHAD_TSMeanAve->SetBinError(i+6,h_ZDCP_HAD_TSMean[i]->GetMeanError());
|
620 |
|
|
h_ZDCP_EMHAD_ChargeAve->SetBinContent(i+6,h_ZDCP_HAD_Charge[i]->GetMean());
|
621 |
|
|
h_ZDCP_EMHAD_ChargeAve->SetBinError(i+6,h_ZDCP_HAD_Charge[i]->GetMeanError());
|
622 |
|
|
h_ZDCP_HAD_RecHitEnergyAve->SetBinContent(i+1,h_ZDCP_HAD_RecHitEnergy[i]->GetMean());
|
623 |
|
|
h_ZDCP_HAD_RecHitEnergyAve->SetBinError(i+1,h_ZDCP_HAD_RecHitEnergy[i]->GetMeanError());
|
624 |
|
|
h_ZDCP_HAD_Pulse[i]->Scale(10./h_ZDCP_HAD_Pulse[i]->GetEntries());
|
625 |
|
|
|
626 |
|
|
h_channel_side_charge_Ave->SetBinContent(1,i+6,h_ZDCP_HAD_Charge[i]->GetMean());
|
627 |
|
|
h_channel_side_TSMean_Ave->SetBinContent(1,i+6,h_ZDCP_HAD_TSMean[i]->GetMean());
|
628 |
|
|
|
629 |
|
|
h_ZDCM_EMHAD_TSMeanAve->SetBinContent(i+6,h_ZDCM_HAD_TSMean[i]->GetMean());
|
630 |
|
|
h_ZDCM_EMHAD_TSMeanAve->SetBinError(i+6,h_ZDCM_HAD_TSMean[i]->GetMeanError());
|
631 |
|
|
h_ZDCM_EMHAD_ChargeAve->SetBinContent(i+6,h_ZDCM_HAD_Charge[i]->GetMean());
|
632 |
|
|
h_ZDCM_EMHAD_ChargeAve->SetBinError(i+6,h_ZDCM_HAD_Charge[i]->GetMeanError());
|
633 |
|
|
h_ZDCM_HAD_RecHitEnergyAve->SetBinContent(i+1,h_ZDCM_HAD_RecHitEnergy[i]->GetMean());
|
634 |
|
|
h_ZDCM_HAD_RecHitEnergyAve->SetBinError(i+1,h_ZDCM_HAD_RecHitEnergy[i]->GetMeanError());
|
635 |
|
|
h_ZDCM_HAD_Pulse[i]->Scale(10./h_ZDCM_HAD_Pulse[i]->GetEntries());
|
636 |
|
|
|
637 |
|
|
h_channel_side_charge_Ave->SetBinContent(2,i+6,h_ZDCM_HAD_Charge[i]->GetMean());
|
638 |
|
|
h_channel_side_TSMean_Ave->SetBinContent(2,i+6,h_ZDCM_HAD_TSMean[i]->GetMean());
|
639 |
|
|
}
|
640 |
|
|
|
641 |
|
|
//h_channel_side_charge_Ave->Draw("TEXT");
|
642 |
|
|
//h_channel_side_TSMean_Ave->Draw("TEXT");
|
643 |
|
|
|
644 |
|
|
if (htmlPrint) htmlOutput();
|
645 |
|
|
|
646 |
|
|
}
|
647 |
|
|
|
648 |
|
|
void ZDCAnalyzer::htmlOutput(void)
|
649 |
|
|
{
|
650 |
|
|
|
651 |
|
|
|
652 |
|
|
cout << "Preparing html output ..." << endl;
|
653 |
|
|
|
654 |
|
|
char tmp[10];
|
655 |
|
|
|
656 |
|
|
if (runBegin != -1)
|
657 |
|
|
sprintf(tmp, "ZDCBeamSplash_R%09ld_L%ld_%ld", runBegin,lumibegin,lumiend);
|
658 |
|
|
else
|
659 |
|
|
sprintf(tmp, "ZDCBeamSplash_R%09d", 0);
|
660 |
|
|
string htmlDir = baseHtmlDir_ + "/" + tmp + "/";
|
661 |
|
|
|
662 |
|
|
system(("/bin/mkdir -p " + htmlDir).c_str());
|
663 |
|
|
|
664 |
|
|
std::ofstream htmlFile;
|
665 |
|
|
|
666 |
|
|
htmlFile.open((htmlDir + "index.html").c_str());
|
667 |
|
|
|
668 |
|
|
// html page header
|
669 |
|
|
htmlFile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"> " << endl;
|
670 |
|
|
htmlFile << "<html> " << endl;
|
671 |
|
|
htmlFile << "<head> " << endl;
|
672 |
|
|
htmlFile << " <meta content=\"text/html; charset=ISO-8859-1\" " << endl;
|
673 |
|
|
htmlFile << " http-equiv=\"content-type\"> " << endl;
|
674 |
|
|
htmlFile << " <title>ZDC Beam Splash Analysis Output</title> " << endl;
|
675 |
|
|
htmlFile << "</head> " << endl;
|
676 |
|
|
htmlFile << "<body> " << endl;
|
677 |
|
|
htmlFile << "<br> " << endl;
|
678 |
|
|
htmlFile << "<center><h1>ZDC Beam Splash Analysis Outputs</h1></center>" << endl;
|
679 |
|
|
htmlFile << "<h2>Authors: (U. of Iowa) S. Sen, T. Yetkin</h2>" << endl;
|
680 |
|
|
htmlFile << "<h2>Run Number: " << endl;
|
681 |
|
|
htmlFile << "<span style=\"color: rgb(0, 0, 153);\">" << runBegin << "</span>" << endl;
|
682 |
|
|
|
683 |
|
|
htmlFile << " LS: " << endl;
|
684 |
|
|
htmlFile << "<span style=\"color: rgb(0, 0, 153);\">" << lumibegin << "</span>" << endl;
|
685 |
|
|
|
686 |
|
|
htmlFile << "-" << endl;
|
687 |
|
|
htmlFile << "<span style=\"color: rgb(0, 0, 153);\">" << lumiend << "</span>" << endl;
|
688 |
|
|
|
689 |
|
|
htmlFile << " Start Time: <span style=\"color: rgb(0, 0, 153);\">" <<
|
690 |
|
|
startTime << "</span></h2> " << endl;
|
691 |
|
|
htmlFile << "<h2>Events processed: " << endl;
|
692 |
|
|
htmlFile << "<span style=\"color: rgb(0, 0, 153);\">" << evtNo << "</span></h2> " << endl;
|
693 |
|
|
htmlFile << "<hr>" << endl;
|
694 |
|
|
htmlFile << "<ul>" << endl;
|
695 |
|
|
|
696 |
|
|
string htmlName;
|
697 |
|
|
|
698 |
|
|
if (doZDCHTML) {
|
699 |
|
|
htmlName = "ZDC.html";
|
700 |
|
|
ZDCHTMLOutput(startTime, htmlDir, htmlName);
|
701 |
|
|
htmlFile << "<table border=0 WIDTH=\"50%\"><tr>" << endl;
|
702 |
|
|
htmlFile << "<td WIDTH=\"35%\"><a href=\"" << htmlName << "\">ZDC</a></td>" << endl;
|
703 |
|
|
|
704 |
|
|
}
|
705 |
|
|
htmlFile << "</tr></table>" << endl;
|
706 |
|
|
htmlFile << "</ul>" << endl;
|
707 |
|
|
|
708 |
|
|
// html page footer
|
709 |
|
|
htmlFile << "</body> " << endl;
|
710 |
|
|
htmlFile << "</html> " << endl;
|
711 |
|
|
|
712 |
|
|
htmlFile.close();
|
713 |
|
|
cout << "html output done..." << endl;
|
714 |
|
|
return;
|
715 |
|
|
}
|
716 |
|
|
|
717 |
|
|
void ZDCAnalyzer::ZDCHTMLOutput(string startTime, string htmlDir, string htmlName) {
|
718 |
|
|
cout << "Preparing html output for " << htmlName << endl;
|
719 |
|
|
|
720 |
|
|
ofstream htmlFile;
|
721 |
|
|
|
722 |
|
|
htmlFile.open((htmlDir + htmlName).c_str());
|
723 |
|
|
|
724 |
|
|
// html page header
|
725 |
|
|
htmlFile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"> " << endl;
|
726 |
|
|
htmlFile << "<html> " << endl;
|
727 |
|
|
htmlFile << "<head> " << endl;
|
728 |
|
|
htmlFile << " <meta content=\"text/html; charset=ISO-8859-1\" " << endl;
|
729 |
|
|
htmlFile << " http-equiv=\"content-type\"> " << endl;
|
730 |
|
|
htmlFile << " <title>ZDC Plots</title> " << endl;
|
731 |
|
|
htmlFile << "</head> " << endl;
|
732 |
|
|
htmlFile << "<style type=\"text/css\"> td { font-weight: bold } </style>" << endl;
|
733 |
|
|
htmlFile << "<body> " << endl;
|
734 |
|
|
htmlFile << "<br> " << endl;
|
735 |
|
|
htmlFile << "<h2>Run Number: " << endl;
|
736 |
|
|
htmlFile << "<span style=\"color: rgb(0, 0, 153);\">" << runBegin << "</span>" << endl;
|
737 |
|
|
|
738 |
|
|
htmlFile << " LS: " << endl;
|
739 |
|
|
htmlFile << "<span style=\"color: rgb(0, 0, 153);\">" << lumibegin << "</span>" << endl;
|
740 |
|
|
|
741 |
|
|
htmlFile << "-" << endl;
|
742 |
|
|
htmlFile << "<span style=\"color: rgb(0, 0, 153);\">" << lumiend << "</span>" << endl;
|
743 |
|
|
|
744 |
|
|
htmlFile << " Start Time: <span style=\"color: rgb(0, 0, 153);\">" <<
|
745 |
|
|
startTime << "</span></h2> " << endl;
|
746 |
|
|
htmlFile << "<h2>Plots from : <span " << endl;
|
747 |
|
|
htmlFile << " style=\"color: rgb(0, 0, 153);\">ZDC</span></h2> " << endl;
|
748 |
|
|
htmlFile << "<h2>Events processed: " << endl;
|
749 |
|
|
htmlFile << " <span " << endl;
|
750 |
|
|
htmlFile << " style=\"color: rgb(0, 0, 153);\">" << evtNo << "</span></h2>" << endl;
|
751 |
|
|
// begin table for histograms
|
752 |
|
|
htmlFile << "<table width=100% border=1><tr>" << endl;
|
753 |
|
|
htmlFile << "</tr></table>" << endl;
|
754 |
|
|
htmlFile << "<hr>" << endl;
|
755 |
|
|
|
756 |
|
|
htmlFile << "<h2><strong>ZDC Histograms</strong></h2>" << endl;
|
757 |
|
|
htmlFile << "<h3>" << endl;
|
758 |
|
|
htmlFile << "<a href=\"#ZDC_Plots\">ZDC Plots </a></br>" << endl;
|
759 |
|
|
htmlFile << "</h3>" << endl;
|
760 |
|
|
htmlFile << "<hr>" << endl;
|
761 |
|
|
|
762 |
|
|
|
763 |
|
|
string type = "ZDC";
|
764 |
|
|
htmlFile << "<tr align=\"left\">" << endl;
|
765 |
|
|
htmlFile << "<td> <a name=\"" << type << "_Plots\"><h3>" << type << " Histograms</h3></td></tr>" << endl;
|
766 |
|
|
|
767 |
|
|
htmlFile << "<tr align=\"left\">" << endl;
|
768 |
|
|
histoHTML2(h_channel_side_charge_Ave, "", "", 92, htmlFile, htmlDir,true);
|
769 |
|
|
histoHTML2(h_channel_side_TSMean_Ave, "", "", 92, htmlFile, htmlDir,true);
|
770 |
|
|
histoHTML(h_bunchXing, "Bunch Xing", "Events", 92, htmlFile, htmlDir);
|
771 |
|
|
histoHTML(h_BX_after_return, "Bunch Xing", "Events", 92, htmlFile, htmlDir);
|
772 |
|
|
histoHTML(h_lumiBlock, "Lumi Block", "Events", 92, htmlFile, htmlDir);
|
773 |
|
|
histoHTML(h_hf_time_difference, "Time (ns)", "Events", 92, htmlFile, htmlDir);
|
774 |
|
|
//histoHTML(histodeneme, "QIE bins", "bins", 92, htmlFile, htmlDir,false);
|
775 |
|
|
histoHTML(h_ZDCP_EMHAD_ChargeAve, "ZDCP Channel id", "Ave. Charge (fC)", 92, htmlFile, htmlDir,false);
|
776 |
|
|
histoHTML(h_ZDCP_EMHAD_TSMeanAve, "ZDCP Channel id", "TS_Mean", 92, htmlFile, htmlDir,false);
|
777 |
|
|
histoHTML(h_ZDCP_EM_RecHitEnergyAve, "ZDCP EM Channel id", "Ave. Rechit Energy (GeV)", 92, htmlFile, htmlDir,false);
|
778 |
|
|
histoHTML(h_ZDCP_HAD_RecHitEnergyAve, "ZDCP HAD Channel id", "Ave. Rechit Energy (GeV)", 92, htmlFile, htmlDir,false);
|
779 |
|
|
histoHTML(h_ZDCM_EMHAD_ChargeAve, "ZDCM Channel id", "Ave. Charge (fC)", 92, htmlFile, htmlDir,false);
|
780 |
|
|
histoHTML(h_ZDCM_EMHAD_TSMeanAve, "ZDCM Channel id", "TS_Mean", 92, htmlFile, htmlDir,false);
|
781 |
|
|
histoHTML(h_ZDCM_EM_RecHitEnergyAve, "ZDCM EM Channel id", "Ave. Rechit Energy (GeV)", 92, htmlFile, htmlDir,false);
|
782 |
|
|
histoHTML(h_ZDCM_HAD_RecHitEnergyAve, "ZDCM HAD Channel id", "Ave. Rechit Energy (GeV)", 92, htmlFile, htmlDir,false);
|
783 |
|
|
histoHTML2(h_ZDCP_Charge_Correlation,"Total EM Charge {fC}","Total HAD Charge {fC}",92, htmlFile, htmlDir, false);
|
784 |
|
|
histoHTML2(h_ZDCP_Charge_CorrelationHAD,"HAD1+HAD2 Charge {fC}","HAD3+HAD4 Charge {fC}",92, htmlFile, htmlDir, false);
|
785 |
|
|
//histoHTML2(h_ZDCP_Charge_Correlation2,"(Total EM Charge {fC})/5","(Total HAD Charge {fC})/4",92, htmlFile,htmlDir,false);
|
786 |
|
|
//histoHTML2(h_ZDCP_RecHit_Correlation,"(Total EM RecHit {GeV})/5","(Total HAD RecHit {GeV})/4",92, htmlFile,htmlDir,false);
|
787 |
|
|
histoHTML(h_ZDCP_EM_Pulse[0], "Time Slice id", "Ave. Pulse Height", 92, htmlFile, htmlDir,false);
|
788 |
|
|
histoHTML(h_ZDCP_EM_Pulse[1], "Time Slice id", "Ave. Pulse Height", 92, htmlFile, htmlDir,false);
|
789 |
|
|
histoHTML(h_ZDCP_EM_Pulse[2], "Time Slice id", "Ave. Pulse Height", 92, htmlFile, htmlDir,false);
|
790 |
|
|
histoHTML(h_ZDCP_EM_Pulse[3], "Time Slice id", "Ave. Pulse Height", 92, htmlFile, htmlDir,false);
|
791 |
|
|
histoHTML(h_ZDCP_EM_Pulse[4], "Time Slice id", "Ave. Pulse Height", 92, htmlFile, htmlDir,false);
|
792 |
|
|
histoHTML(h_ZDCP_HAD_Pulse[0], "Time Slice id", "Ave. Pulse Height", 92, htmlFile, htmlDir,false);
|
793 |
|
|
histoHTML(h_ZDCP_HAD_Pulse[1], "Time Slice id", "Ave. Pulse Height", 92, htmlFile, htmlDir,false);
|
794 |
|
|
histoHTML(h_ZDCP_HAD_Pulse[2], "Time Slice id", "Ave. Pulse Height", 92, htmlFile, htmlDir,false);
|
795 |
|
|
histoHTML(h_ZDCP_HAD_Pulse[3], "Time Slice id", "Ave. Pulse Height", 92, htmlFile, htmlDir,false);
|
796 |
|
|
histoHTML(h_ZDCP_EM_Charge[0], "ZDCP EM Channel1 Charge (fC)", "Events", 92, htmlFile, htmlDir,false);
|
797 |
|
|
histoHTML(h_ZDCP_EM_Charge[1], "ZDCP EM Channel1 Charge (fC)", "Events", 92, htmlFile, htmlDir,false);
|
798 |
|
|
histoHTML(h_ZDCP_EM_Charge[2], "ZDCP EM Channel1 Charge (fC)", "Events", 92, htmlFile, htmlDir,false);
|
799 |
|
|
histoHTML(h_ZDCP_EM_Charge[3], "ZDCP EM Channel1 Charge (fC)", "Events", 92, htmlFile, htmlDir,false);
|
800 |
|
|
histoHTML(h_ZDCP_EM_Charge[4], "ZDCP EM Channel1 Charge (fC)", "Events", 92, htmlFile, htmlDir,false);
|
801 |
|
|
histoHTML(h_ZDCP_HAD_Charge[0], "ZDCP HAD Channel1 Charge (fC)", "Events", 92, htmlFile, htmlDir,false);
|
802 |
|
|
histoHTML(h_ZDCP_HAD_Charge[1], "ZDCP HAD Channel1 Charge (fC)", "Events", 92, htmlFile, htmlDir,false);
|
803 |
|
|
histoHTML(h_ZDCP_HAD_Charge[2], "ZDCP HAD Channel1 Charge (fC)", "Events", 92, htmlFile, htmlDir,false);
|
804 |
|
|
histoHTML(h_ZDCP_HAD_Charge[3], "ZDCP HAD Channel1 Charge (fC)", "Events", 92, htmlFile, htmlDir,false);
|
805 |
|
|
histoHTML(h_ZDCP_EM_RecHitEnergy[0], "ZDCP EM Channel1 RecHitEnergy (GeV)", "Events", 92, htmlFile, htmlDir,false);
|
806 |
|
|
histoHTML(h_ZDCP_EM_RecHitEnergy[1], "ZDCP EM Channel1 RecHitEnergy (GeV)", "Events", 92, htmlFile, htmlDir,false);
|
807 |
|
|
histoHTML(h_ZDCP_EM_RecHitEnergy[2], "ZDCP EM Channel1 RecHitEnergy (GeV)", "Events", 92, htmlFile, htmlDir,false);
|
808 |
|
|
histoHTML(h_ZDCP_EM_RecHitEnergy[3], "ZDCP EM Channel1 RecHitEnergy (GeV)", "Events", 92, htmlFile, htmlDir,false);
|
809 |
|
|
histoHTML(h_ZDCP_EM_RecHitEnergy[4], "ZDCP EM Channel1 RecHitEnergy (GeV)", "Events", 92, htmlFile, htmlDir,false);
|
810 |
|
|
histoHTML(h_ZDCP_HAD_RecHitEnergy[0], "ZDCP HAD Channel1 RecHitEnergy (GeV)", "Events", 92, htmlFile, htmlDir,false);
|
811 |
|
|
histoHTML(h_ZDCP_HAD_RecHitEnergy[1], "ZDCP HAD Channel1 RecHitEnergy (GeV)", "Events", 92, htmlFile, htmlDir,false);
|
812 |
|
|
histoHTML(h_ZDCP_HAD_RecHitEnergy[2], "ZDCP HAD Channel1 RecHitEnergy (GeV)", "Events", 92, htmlFile, htmlDir,false);
|
813 |
|
|
histoHTML(h_ZDCP_HAD_RecHitEnergy[3], "ZDCP HAD Channel1 RecHitEnergy (GeV)", "Events", 92, htmlFile, htmlDir,false);
|
814 |
|
|
histoHTML(h_ZDCP_EM_TSMean[0], "ZDCP EM Channel1 TS Mean", "Events", 92, htmlFile, htmlDir,false);
|
815 |
|
|
histoHTML(h_ZDCP_EM_TSMean[1], "ZDCP EM Channel2 TS Mean", "Events", 92, htmlFile, htmlDir,false);
|
816 |
|
|
histoHTML(h_ZDCP_EM_TSMean[2], "ZDCP EM Channel3 TS Mean", "Events", 92, htmlFile, htmlDir,false);
|
817 |
|
|
histoHTML(h_ZDCP_EM_TSMean[3], "ZDCP EM Channel4 TS Mean", "Events", 92, htmlFile, htmlDir,false);
|
818 |
|
|
histoHTML(h_ZDCP_EM_TSMean[4], "ZDCP EM Channel5 TS Mean", "Events", 92, htmlFile, htmlDir,false);
|
819 |
|
|
histoHTML(h_ZDCP_HAD_TSMean[0], "ZDCP HAD Channel1 TS Mean", "Events", 92, htmlFile, htmlDir,false);
|
820 |
|
|
histoHTML(h_ZDCP_HAD_TSMean[1], "ZDCP HAD Channel2 TS Mean", "Events", 92, htmlFile, htmlDir,false);
|
821 |
|
|
histoHTML(h_ZDCP_HAD_TSMean[2], "ZDCP HAD Channel3 TS Mean", "Events", 92, htmlFile, htmlDir,false);
|
822 |
|
|
histoHTML(h_ZDCP_HAD_TSMean[3], "ZDCP HAD Channel4 TS Mean", "Events", 92, htmlFile, htmlDir,false);
|
823 |
|
|
|
824 |
|
|
histoHTML(h_ZDCM_EM_Pulse[0], "Time Slice id", "Ave. Pulse Height", 92, htmlFile, htmlDir,false);
|
825 |
|
|
histoHTML(h_ZDCM_EM_Pulse[1], "Time Slice id", "Ave. Pulse Height", 92, htmlFile, htmlDir,false);
|
826 |
|
|
histoHTML(h_ZDCM_EM_Pulse[2], "Time Slice id", "Ave. Pulse Height", 92, htmlFile, htmlDir,false);
|
827 |
|
|
histoHTML(h_ZDCM_EM_Pulse[3], "Time Slice id", "Ave. Pulse Height", 92, htmlFile, htmlDir,false);
|
828 |
|
|
histoHTML(h_ZDCM_EM_Pulse[4], "Time Slice id", "Ave. Pulse Height", 92, htmlFile, htmlDir,false);
|
829 |
|
|
histoHTML(h_ZDCM_HAD_Pulse[0], "Time Slice id", "Ave. Pulse Height", 92, htmlFile, htmlDir,false);
|
830 |
|
|
histoHTML(h_ZDCM_HAD_Pulse[1], "Time Slice id", "Ave. Pulse Height", 92, htmlFile, htmlDir,false);
|
831 |
|
|
histoHTML(h_ZDCM_HAD_Pulse[2], "Time Slice id", "Ave. Pulse Height", 92, htmlFile, htmlDir,false);
|
832 |
|
|
histoHTML(h_ZDCM_HAD_Pulse[3], "Time Slice id", "Ave. Pulse Height", 92, htmlFile, htmlDir,false);
|
833 |
|
|
histoHTML(h_ZDCM_EM_Charge[0], "ZDCM EM Channel1 Charge (fC)", "Events", 92, htmlFile, htmlDir,false);
|
834 |
|
|
histoHTML(h_ZDCM_EM_Charge[1], "ZDCM EM Channel1 Charge (fC)", "Events", 92, htmlFile, htmlDir,false);
|
835 |
|
|
histoHTML(h_ZDCM_EM_Charge[2], "ZDCM EM Channel1 Charge (fC)", "Events", 92, htmlFile, htmlDir,false);
|
836 |
|
|
histoHTML(h_ZDCM_EM_Charge[3], "ZDCM EM Channel1 Charge (fC)", "Events", 92, htmlFile, htmlDir,false);
|
837 |
|
|
histoHTML(h_ZDCM_EM_Charge[4], "ZDCM EM Channel1 Charge (fC)", "Events", 92, htmlFile, htmlDir,false);
|
838 |
|
|
histoHTML(h_ZDCM_HAD_Charge[0], "ZDCM HAD Channel1 Charge (fC)", "Events", 92, htmlFile, htmlDir,false);
|
839 |
|
|
histoHTML(h_ZDCM_HAD_Charge[1], "ZDCM HAD Channel1 Charge (fC)", "Events", 92, htmlFile, htmlDir,false);
|
840 |
|
|
histoHTML(h_ZDCM_HAD_Charge[2], "ZDCM HAD Channel1 Charge (fC)", "Events", 92, htmlFile, htmlDir,false);
|
841 |
|
|
histoHTML(h_ZDCM_HAD_Charge[3], "ZDCM HAD Channel1 Charge (fC)", "Events", 92, htmlFile, htmlDir,false);
|
842 |
|
|
histoHTML(h_ZDCM_EM_RecHitEnergy[0], "ZDCM EM Channel1 RecHitEnergy (GeV)", "Events", 92, htmlFile, htmlDir,false);
|
843 |
|
|
histoHTML(h_ZDCM_EM_RecHitEnergy[1], "ZDCM EM Channel1 RecHitEnergy (GeV)", "Events", 92, htmlFile, htmlDir,false);
|
844 |
|
|
histoHTML(h_ZDCM_EM_RecHitEnergy[2], "ZDCM EM Channel1 RecHitEnergy (GeV)", "Events", 92, htmlFile, htmlDir,false);
|
845 |
|
|
histoHTML(h_ZDCM_EM_RecHitEnergy[3], "ZDCM EM Channel1 RecHitEnergy (GeV)", "Events", 92, htmlFile, htmlDir,false);
|
846 |
|
|
histoHTML(h_ZDCM_EM_RecHitEnergy[4], "ZDCM EM Channel1 RecHitEnergy (GeV)", "Events", 92, htmlFile, htmlDir,false);
|
847 |
|
|
histoHTML(h_ZDCM_HAD_RecHitEnergy[0], "ZDCM HAD Channel1 RecHitEnergy (GeV)", "Events", 92, htmlFile, htmlDir,false);
|
848 |
|
|
histoHTML(h_ZDCM_HAD_RecHitEnergy[1], "ZDCM HAD Channel1 RecHitEnergy (GeV)", "Events", 92, htmlFile, htmlDir,false);
|
849 |
|
|
histoHTML(h_ZDCM_HAD_RecHitEnergy[2], "ZDCM HAD Channel1 RecHitEnergy (GeV)", "Events", 92, htmlFile, htmlDir,false);
|
850 |
|
|
histoHTML(h_ZDCM_HAD_RecHitEnergy[3], "ZDCM HAD Channel1 RecHitEnergy (GeV)", "Events", 92, htmlFile, htmlDir,false);
|
851 |
|
|
histoHTML(h_ZDCM_EM_TSMean[0], "ZDCM EM Channel1 TS Mean", "Events", 92, htmlFile, htmlDir,false);
|
852 |
|
|
histoHTML(h_ZDCM_EM_TSMean[1], "ZDCM EM Channel2 TS Mean", "Events", 92, htmlFile, htmlDir,false);
|
853 |
|
|
histoHTML(h_ZDCM_EM_TSMean[2], "ZDCM EM Channel3 TS Mean", "Events", 92, htmlFile, htmlDir,false);
|
854 |
|
|
histoHTML(h_ZDCM_EM_TSMean[3], "ZDCM EM Channel4 TS Mean", "Events", 92, htmlFile, htmlDir,false);
|
855 |
|
|
histoHTML(h_ZDCM_EM_TSMean[4], "ZDCM EM Channel5 TS Mean", "Events", 92, htmlFile, htmlDir,false);
|
856 |
|
|
histoHTML(h_ZDCM_HAD_TSMean[0], "ZDCM HAD Channel1 TS Mean", "Events", 92, htmlFile, htmlDir,false);
|
857 |
|
|
histoHTML(h_ZDCM_HAD_TSMean[1], "ZDCM HAD Channel2 TS Mean", "Events", 92, htmlFile, htmlDir,false);
|
858 |
|
|
histoHTML(h_ZDCM_HAD_TSMean[2], "ZDCM HAD Channel3 TS Mean", "Events", 92, htmlFile, htmlDir,false);
|
859 |
|
|
histoHTML(h_ZDCM_HAD_TSMean[3], "ZDCM HAD Channel4 TS Mean", "Events", 92, htmlFile, htmlDir,false);
|
860 |
|
|
htmlFile << "</tr>" << endl;
|
861 |
|
|
htmlFile << "</table>" << endl;
|
862 |
|
|
// end table
|
863 |
|
|
htmlFile << "<br>" << endl;
|
864 |
|
|
|
865 |
|
|
// html page footer
|
866 |
|
|
htmlFile << "</body> " << endl;
|
867 |
|
|
htmlFile << "</html> " << endl;
|
868 |
|
|
htmlFile.close();
|
869 |
|
|
}
|
870 |
|
|
void ZDCAnalyzer::histoHTML(TH1F * hist, const char *xlab, const char *ylab, int width, ofstream & htmlFile,
|
871 |
|
|
string htmlDir, bool log) {
|
872 |
|
|
|
873 |
|
|
if (hist != NULL) {
|
874 |
|
|
string imgNameTMB = "";
|
875 |
|
|
|
876 |
|
|
imgNameTMB = getIMG(hist, 1, htmlDir, xlab, ylab,log);
|
877 |
|
|
string imgName = "";
|
878 |
|
|
|
879 |
|
|
imgName = getIMG(hist, 2, htmlDir, xlab, ylab, log);
|
880 |
|
|
|
881 |
|
|
if (imgName.size() != 0)
|
882 |
|
|
htmlFile << "<td><a href=\"" << imgName << "\"><img src=\"" << imgNameTMB << "\"></a></td>" << endl;
|
883 |
|
|
else
|
884 |
|
|
htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
|
885 |
|
|
} else
|
886 |
|
|
htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
|
887 |
|
|
return;
|
888 |
|
|
}
|
889 |
|
|
|
890 |
|
|
void ZDCAnalyzer::histoHTML2(TH2F * hist, const char *xlab, const char *ylab, int width,
|
891 |
|
|
ofstream & htmlFile, string htmlDir, bool color, bool log) {
|
892 |
|
|
if (hist != NULL) {
|
893 |
|
|
string imgNameTMB = "";
|
894 |
|
|
|
895 |
|
|
imgNameTMB = getIMG2(hist, 1, htmlDir, xlab, ylab, color,log);
|
896 |
|
|
string imgName = "";
|
897 |
|
|
|
898 |
|
|
imgName = getIMG2(hist, 2, htmlDir, xlab, ylab, color,log);
|
899 |
|
|
if (imgName.size() != 0)
|
900 |
|
|
htmlFile << "<td><a href=\"" << imgName << "\"><img src=\"" << imgNameTMB << "\"></a></td>" << endl;
|
901 |
|
|
else
|
902 |
|
|
htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
|
903 |
|
|
} else
|
904 |
|
|
htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
|
905 |
|
|
return;
|
906 |
|
|
}
|
907 |
|
|
|
908 |
|
|
|
909 |
|
|
|
910 |
|
|
string ZDCAnalyzer::getIMG(TH1F * hist, int size, string htmlDir, const char *xlab, const char *ylab, bool log) {
|
911 |
|
|
|
912 |
|
|
if (hist == NULL) {
|
913 |
|
|
printf("getIMG: This histo is NULL, %s, %s\n", xlab, ylab);
|
914 |
|
|
return "";
|
915 |
|
|
}
|
916 |
|
|
|
917 |
|
|
string name = hist->GetName();
|
918 |
|
|
|
919 |
|
|
cleanString(name);
|
920 |
|
|
char dest[512];
|
921 |
|
|
|
922 |
|
|
if (runBegin > -1)
|
923 |
|
|
sprintf(dest, "%s - Run %ld LS %ld-%ld", name.c_str(), runBegin, lumibegin, lumiend);
|
924 |
|
|
else
|
925 |
|
|
sprintf(dest, "%s", name.c_str());
|
926 |
|
|
// set run generically hist->SetTitle(dest);
|
927 |
|
|
string title = dest;
|
928 |
|
|
|
929 |
|
|
int xwid = 900;
|
930 |
|
|
int ywid = 540;
|
931 |
|
|
|
932 |
|
|
if (size == 1) {
|
933 |
|
|
title = title + "_tmb";
|
934 |
|
|
xwid = 600;
|
935 |
|
|
ywid = 360;
|
936 |
|
|
}
|
937 |
|
|
TCanvas *can = new TCanvas(dest, dest, xwid, ywid);
|
938 |
|
|
if(log){
|
939 |
|
|
can->SetLogy();
|
940 |
|
|
}
|
941 |
|
|
|
942 |
|
|
parseString(title);
|
943 |
|
|
string outName = title + ".gif";
|
944 |
|
|
string saveName = htmlDir + outName;
|
945 |
|
|
|
946 |
|
|
hist->SetXTitle(xlab);
|
947 |
|
|
hist->SetYTitle(ylab);
|
948 |
|
|
// if(name.find("h_max",0)!=string::npos){
|
949 |
|
|
// hist->Fit("landau");
|
950 |
|
|
// }
|
951 |
|
|
hist->Draw();
|
952 |
|
|
|
953 |
|
|
can->SaveAs(saveName.c_str());
|
954 |
|
|
delete can;
|
955 |
|
|
|
956 |
|
|
return outName;
|
957 |
|
|
}
|
958 |
|
|
|
959 |
|
|
string ZDCAnalyzer::getIMG2(TH2F * hist, int size, string htmlDir, const char *xlab, const char *ylab,
|
960 |
|
|
bool color, bool log) {
|
961 |
|
|
|
962 |
|
|
if (hist == NULL) {
|
963 |
|
|
printf("getIMG2: This histo is NULL, %s, %s\n", xlab, ylab);
|
964 |
|
|
return "";
|
965 |
|
|
}
|
966 |
|
|
|
967 |
|
|
string name = hist->GetName();
|
968 |
|
|
|
969 |
|
|
cleanString(name);
|
970 |
|
|
char dest[512];
|
971 |
|
|
|
972 |
|
|
if (runBegin > -1)
|
973 |
|
|
sprintf(dest, "%s - Run %ld LS %ld-%ld", name.c_str(), runBegin, lumibegin, lumiend);
|
974 |
|
|
else
|
975 |
|
|
sprintf(dest, "%s", name.c_str());
|
976 |
|
|
// set run generically hist->SetTitle(dest);
|
977 |
|
|
string title = dest;
|
978 |
|
|
|
979 |
|
|
int xwid = 900;
|
980 |
|
|
int ywid = 540;
|
981 |
|
|
|
982 |
|
|
if (size == 1) {
|
983 |
|
|
title = title + "_tmb";
|
984 |
|
|
xwid = 600;
|
985 |
|
|
ywid = 360;
|
986 |
|
|
}
|
987 |
|
|
TCanvas *can = new TCanvas(dest, dest, xwid, ywid);
|
988 |
|
|
|
989 |
|
|
parseString(title);
|
990 |
|
|
string outName = title + ".gif";
|
991 |
|
|
string saveName = htmlDir + outName;
|
992 |
|
|
|
993 |
|
|
hist->SetXTitle(xlab);
|
994 |
|
|
hist->SetYTitle(ylab);
|
995 |
|
|
if (!color)
|
996 |
|
|
hist->Draw();
|
997 |
|
|
else {
|
998 |
|
|
hist->SetStats(false);
|
999 |
|
|
hist->Draw("COLZ");
|
1000 |
|
|
}
|
1001 |
|
|
can->SaveAs(saveName.c_str());
|
1002 |
|
|
delete can;
|
1003 |
|
|
|
1004 |
|
|
return outName;
|
1005 |
|
|
}
|
1006 |
|
|
void ZDCAnalyzer::cleanString(string & title) {
|
1007 |
|
|
|
1008 |
|
|
for (unsigned int i = 0; i < title.size(); i++) {
|
1009 |
|
|
if (title.substr(i, 6) == " - Run") {
|
1010 |
|
|
title.replace(i, title.size() - i, "");
|
1011 |
|
|
}
|
1012 |
|
|
if (title.substr(i, 4) == "_Run") {
|
1013 |
|
|
title.replace(i, title.size() - i, "");
|
1014 |
|
|
}
|
1015 |
|
|
if (title.substr(i, 5) == "__Run") {
|
1016 |
|
|
title.replace(i, title.size() - i, "");
|
1017 |
|
|
}
|
1018 |
|
|
}
|
1019 |
|
|
}
|
1020 |
|
|
|
1021 |
|
|
void ZDCAnalyzer::parseString(string & title) {
|
1022 |
|
|
|
1023 |
|
|
for (unsigned int i = 0; i < title.size(); i++) {
|
1024 |
|
|
if (title.substr(i, 1) == " ") {
|
1025 |
|
|
title.replace(i, 1, "_");
|
1026 |
|
|
}
|
1027 |
|
|
if (title.substr(i, 1) == "#") {
|
1028 |
|
|
title.replace(i, 1, "N");
|
1029 |
|
|
}
|
1030 |
|
|
if (title.substr(i, 1) == "-") {
|
1031 |
|
|
title.replace(i, 1, "_");
|
1032 |
|
|
}
|
1033 |
|
|
if (title.substr(i, 1) == "&") {
|
1034 |
|
|
title.replace(i, 1, "_and_");
|
1035 |
|
|
}
|
1036 |
|
|
if (title.substr(i, 1) == "(" || title.substr(i, 1) == ")") {
|
1037 |
|
|
title.replace(i, 1, "_");
|
1038 |
|
|
}
|
1039 |
|
|
}
|
1040 |
|
|
|
1041 |
|
|
return;
|
1042 |
|
|
}
|
1043 |
|
|
|