39 hfDigiCollectionTag_(fConfiguration.getParameter<edm::InputTag>(
"hfDigiCollectionTag")),
40 hcalCalibDigiCollectionTag_(fConfiguration.getParameter<edm::InputTag>(
"hcalCalibDigiCollectionTag")) {
54 std::cout<<std::endl<<
"HFPreLightCal beginJob: --> ";
58 printf(
"\nNo textfile open\n\n");
59 std::cout<<
"Problem with output Pre-textFILE => exit"<<std::endl;
63 htsmax =
new TH1F(
"htsmax",
"Max TS",100,0,10);
64 htspinmax =
new TH1F(
"htspinmax",
"Max TS PIN",100,0,10);
66 for (
int i=0;
i<13;
i++)
for (
int j=0;
j<36;
j++)
for (
int k=0;
k<2;
k++) {
67 if (
i>10 &&
j%2==0)
continue;
68 sprintf(htit,
"tspre_+%d_%d_%d",
i+29,
j*2+1,
k+1);
69 hts[
i][
j][
k] =
new TH1F(htit,htit,10,-0.5,9.5);
70 sprintf(htit,
"tspre_-%d_%d_%d",
i+29,
j*2+1,
k+1);
71 hts[
i+13][
j][
k] =
new TH1F(htit,htit,10,-0.5,9.5);
74 for (
int i=0;
i<4;
i++)
for (
int j=0;
j<3;
j++) {
75 sprintf(htit,
"tspre_PIN%d_+Q%d",
j+1,
i+1);
76 htspin[
i][
j] =
new TH1F(htit,htit,10,-0.5,9.5);
77 sprintf(htit,
"tspre_PIN%d_-Q%d",
j+1,
i+1);
78 htspin[
i+4][
j] =
new TH1F(htit,htit,10,-0.5,9.5);
89 std::cout<<std::endl<<
"HFPreLightCal endJob --> ";
91 for (
int i=0;
i<26;
i++)
for (
int j=0;
j<36;
j++)
for (
int k=0;
k<2;
k++) {
92 if (
i>10 &&
i<13 &&
j%2==0)
continue;
93 if (
i>23 &&
j%2==0)
continue;
95 for (
int ii=1;
ii<=10;
ii++) {
96 cont =
hts[
i][
j][
k]->GetBinContent(
ii);
97 if (
ii<3) cont=cont-(
hts[
i][
j][
k]->GetBinContent(
ii+4)+
hts[
i][
j][
k]->GetBinContent(
ii+8))/2;
98 else if (
ii<5) cont=cont-
hts[
i][
j][
k]->GetBinContent(
ii+4);
99 else if (
ii<7) cont=cont-(
hts[
i][
j][
k]->GetBinContent(
ii-4)+
hts[
i][
j][
k]->GetBinContent(
ii+4))/2;
100 else if (
ii<9) cont=cont-
hts[
i][
j][
k]->GetBinContent(
ii-4);
101 else cont=cont-(
hts[
i][
j][
k]->GetBinContent(
ii-4)+
hts[
i][
j][
k]->GetBinContent(
ii-8))/2;
108 if (
i<13) fprintf(
tFile,
" %d %d %d %d\n",
i+29,
j*2+1,
k+1,tsmax);
109 else fprintf(
tFile,
" %d %d %d %d\n",13-
i-29,
j*2+1,
k+1,tsmax);
112 for (
int i=0;
i<8;
i++)
for (
int j=0;
j<3;
j++) {
114 tsmax =
htspin[
i][
j]->GetMaximumBin();
116 if (
i<4) fprintf(
tFile,
"%d %d %d\n",
i+1,
j+1,tsmax);
117 else fprintf(
tFile,
"%d %d %d\n",-
i+3,
j+1,tsmax);
132 int eventNumber = eventId.
event ();
135 if (
verbose)
std::cout <<
"========================================="<<std::endl
136 <<
"run/event: "<<runNumber<<
'/'<<eventNumber<<std::endl;
141 if (
verbose)
std::cout<<
"Analysis-> total CAL digis= "<<calib->size()<<std::endl;
169 if (
verbose)
std::cout<<
"Analysis-> total HF digis= "<<hf_digi->size()<<std::endl;
171 for (
unsigned ihit = 0; ihit < hf_digi->size (); ++ihit) {
174 int ieta = detId.
ieta();
175 int iphi = detId.
iphi();
176 int depth = detId.
depth();
178 <<ieta<<
'/'<<iphi<<
'/'<< depth << std::endl;
180 if (ieta>0) ieta = ieta-29;
181 else ieta = 13-ieta-29;
183 for (
int isample = 0; isample < frame.
size(); ++isample) {
184 int adc = frame[isample].adc();
185 int capid = frame[isample].capid ();
186 double linear_ADC = frame[isample].nominal_fC();
187 double nominal_fC = detId.
subdet () ==
HcalForward ? 2.6 * linear_ADC : linear_ADC;
190 <<
", capid=" << capid
192 <<
", linearized ADC=" << linear_ADC
193 <<
", nominal fC=" << nominal_fC << std::endl;
195 hts[ieta][(iphi-1)/2][depth-1]->
Fill(isample,linear_ADC);
int adc(sample_type sample)
get the ADC sample (12 bits)
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
virtual void analyze(const edm::Event &fEvent, const edm::EventSetup &fSetup)
edm::InputTag hcalCalibDigiCollectionTag_
HcalSubdetector subdet() const
get the subdetector
virtual void endJob(void)
int depth() const
get the tower depth
MVATrainerComputer * calib
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
int ieta() const
get the cell ieta
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
int iphi() const
get the cell iphi
int size() const
total number of samples in the digi
edm::InputTag hfDigiCollectionTag_
const HcalDetId & id() const
HFPreLightCal(const edm::ParameterSet &fConfiguration)