29 std::cout <<
"Calculating Pedestal constants...\n";
30 std::vector<NewPedBunch>::iterator bunch_it;
31 for(bunch_it=
Bunches.begin(); bunch_it !=
Bunches.end(); bunch_it++)
33 if(bunch_it->usedflag){
37 if(bunch_it->num[0][0]!=0) bunch_it->cap[0] /= bunch_it->num[0][0];
38 if(bunch_it->num[1][1]!=0) bunch_it->cap[1] /= bunch_it->num[1][1];
39 if(bunch_it->num[2][2]!=0) bunch_it->cap[2] /= bunch_it->num[2][2];
40 if(bunch_it->num[3][3]!=0) bunch_it->cap[3] /= bunch_it->num[3][3];
41 if(bunch_it->num[0][0]!=0) bunch_it->capfc[0] /= bunch_it->num[0][0];
42 if(bunch_it->num[1][1]!=0) bunch_it->capfc[1] /= bunch_it->num[1][1];
43 if(bunch_it->num[2][2]!=0) bunch_it->capfc[2] /= bunch_it->num[2][2];
44 if(bunch_it->num[3][3]!=0) bunch_it->capfc[3] /= bunch_it->num[3][3];
46 bunch_it->sig[0][0] = (bunch_it->prod[0][0]/bunch_it->num[0][0])-(bunch_it->cap[0])*(bunch_it->cap[0]);
47 bunch_it->sig[1][1] = (bunch_it->prod[1][1]/bunch_it->num[1][1])-(bunch_it->cap[1])*(bunch_it->cap[1]);
48 bunch_it->sig[2][2] = (bunch_it->prod[2][2]/bunch_it->num[2][2])-(bunch_it->cap[2])*(bunch_it->cap[2]);
49 bunch_it->sig[3][3] = (bunch_it->prod[3][3]/bunch_it->num[3][3])-(bunch_it->cap[3])*(bunch_it->cap[3]);
50 bunch_it->sig[0][1] = (bunch_it->prod[0][1])/(bunch_it->num[0][1])-(bunch_it->cap[0]*bunch_it->cap[1]);
51 bunch_it->sig[0][2] = (bunch_it->prod[0][2])/(bunch_it->num[0][2])-(bunch_it->cap[0]*bunch_it->cap[2]);
52 bunch_it->sig[0][3] = (bunch_it->prod[3][0])/(bunch_it->num[3][0])-(bunch_it->cap[0]*bunch_it->cap[3]);
53 bunch_it->sig[1][2] = (bunch_it->prod[1][2])/(bunch_it->num[1][2])-(bunch_it->cap[1]*bunch_it->cap[2]);
54 bunch_it->sig[1][3] = (bunch_it->prod[1][3])/(bunch_it->num[1][3])-(bunch_it->cap[1]*bunch_it->cap[3]);
55 bunch_it->sig[2][3] = (bunch_it->prod[2][3])/(bunch_it->num[2][3])-(bunch_it->cap[2]*bunch_it->cap[3]);
57 bunch_it->sigfc[0][0] = (bunch_it->prodfc[0][0]/bunch_it->num[0][0])-(bunch_it->capfc[0])*(bunch_it->capfc[0]);
58 bunch_it->sigfc[1][1] = (bunch_it->prodfc[1][1]/bunch_it->num[1][1])-(bunch_it->capfc[1])*(bunch_it->capfc[1]);
59 bunch_it->sigfc[2][2] = (bunch_it->prodfc[2][2]/bunch_it->num[2][2])-(bunch_it->capfc[2])*(bunch_it->capfc[2]);
60 bunch_it->sigfc[3][3] = (bunch_it->prodfc[3][3]/bunch_it->num[3][3])-(bunch_it->capfc[3])*(bunch_it->capfc[3]);
61 bunch_it->sigfc[0][1] = (bunch_it->prodfc[0][1]/(bunch_it->num[0][1]))-(bunch_it->capfc[0]*bunch_it->capfc[1]);
62 bunch_it->sigfc[0][2] = (bunch_it->prodfc[0][2]/(bunch_it->num[0][2]))-(bunch_it->capfc[0]*bunch_it->capfc[2]);
63 bunch_it->sigfc[0][3] = (bunch_it->prodfc[3][0]/(bunch_it->num[3][0]))-(bunch_it->capfc[0]*bunch_it->capfc[3]);
64 bunch_it->sigfc[1][2] = (bunch_it->prodfc[1][2]/(bunch_it->num[1][2]))-(bunch_it->capfc[1]*bunch_it->capfc[2]);
65 bunch_it->sigfc[1][3] = (bunch_it->prodfc[1][3]/(bunch_it->num[1][3]))-(bunch_it->capfc[1]*bunch_it->capfc[3]);
66 bunch_it->sigfc[2][3] = (bunch_it->prodfc[2][3]/(bunch_it->num[2][3]))-(bunch_it->capfc[2]*bunch_it->capfc[3]);
68 if(bunch_it->detid.subdet() == 1){
69 for(
int i = 0;
i != 4;
i++){
74 if(bunch_it->detid.subdet() == 2){
75 for(
int i = 0;
i != 4;
i++){
80 if(bunch_it->detid.subdet() == 3){
81 for(
int i = 0;
i != 4;
i++){
86 if(bunch_it->detid.subdet() == 4){
87 for(
int i = 0;
i != 4;
i++){
93 const HcalPedestal item(bunch_it->detid, bunch_it->cap[0], bunch_it->cap[1], bunch_it->cap[2], bunch_it->cap[3]);
96 widthsp.
setSigma(0,0,bunch_it->sig[0][0]);
97 widthsp.
setSigma(0,1,bunch_it->sig[0][1]);
98 widthsp.
setSigma(0,2,bunch_it->sig[0][2]);
99 widthsp.
setSigma(0,3,bunch_it->sig[0][3]);
100 widthsp.
setSigma(1,1,bunch_it->sig[1][1]);
101 widthsp.
setSigma(1,2,bunch_it->sig[1][2]);
102 widthsp.
setSigma(1,3,bunch_it->sig[1][3]);
103 widthsp.
setSigma(2,2,bunch_it->sig[2][2]);
104 widthsp.
setSigma(2,3,bunch_it->sig[2][3]);
105 widthsp.
setSigma(3,3,bunch_it->sig[3][3]);
108 const HcalPedestal itemfc(bunch_it->detid, bunch_it->capfc[0], bunch_it->capfc[1],
109 bunch_it->capfc[2], bunch_it->capfc[3]);
112 widthspfc.
setSigma(0,0,bunch_it->sigfc[0][0]);
113 widthspfc.
setSigma(0,1,bunch_it->sigfc[0][1]);
114 widthspfc.
setSigma(0,2,bunch_it->sigfc[0][2]);
115 widthspfc.
setSigma(0,3,bunch_it->sigfc[0][3]);
116 widthspfc.
setSigma(1,1,bunch_it->sigfc[1][1]);
117 widthspfc.
setSigma(1,2,bunch_it->sigfc[1][2]);
118 widthspfc.
setSigma(1,3,bunch_it->sigfc[1][3]);
119 widthspfc.
setSigma(2,2,bunch_it->sigfc[2][2]);
120 widthspfc.
setSigma(2,3,bunch_it->sigfc[2][3]);
121 widthspfc.
setSigma(3,3,bunch_it->sigfc[3][3]);
191 std::string runnum_string;
192 std::stringstream tempstringout;
194 runnum_string = tempstringout.str();
200 XMLfilename = runnum_string +
"-peds_ADC_complete.xml";
201 XMLtag =
"Hcal_pedestals_" + runnum_string;
212 HBMeans =
new TH1F(
"All Ped Means HB",
"All Ped Means HB", 100, 0, 9);
213 HBWidths =
new TH1F(
"All Ped Widths HB",
"All Ped Widths HB", 100, 0, 3);
214 HEMeans =
new TH1F(
"All Ped Means HE",
"All Ped Means HE", 100, 0, 9);
215 HEWidths =
new TH1F(
"All Ped Widths HE",
"All Ped Widths HE", 100, 0, 3);
216 HFMeans =
new TH1F(
"All Ped Means HF",
"All Ped Means HF", 100, 0, 9);
217 HFWidths =
new TH1F(
"All Ped Widths HF",
"All Ped Widths HF", 100, 0, 3);
218 HOMeans =
new TH1F(
"All Ped Means HO",
"All Ped Means HO", 100, 0, 9);
219 HOWidths =
new TH1F(
"All Ped Widths HO",
"All Ped Widths HO", 100, 0, 3);
224 std::vector<HcalGenericDetId> listEMap = myRefEMap->
allPrecisionId();
225 for (std::vector<HcalGenericDetId>::const_iterator it = listEMap.begin(); it != listEMap.end(); it++)
228 if(mygenid.isHcalDetId())
234 for(
int i = 0;
i != 4;
i++)
238 for(
int j = 0;
j != 4;
j++)
253 std::vector<NewPedBunch>::iterator bunch_it;
258 for(bunch_it =
Bunches.begin(); bunch_it !=
Bunches.end(); bunch_it++)
259 if(bunch_it->detid.rawId() == digi.
id().
rawId())
break;
260 bunch_it->usedflag =
true;
268 bunch_it->capfc[digi.
sample(ts).
capid()] += charge1;
272 if(digi.
sample(ts+1).
adc() > 15)
continue;
279 if(digi.
sample(ts+2).
adc() > 15)
continue;
286 if(digi.
sample(ts+3).
adc() > 15)
continue;
298 for(bunch_it =
Bunches.begin(); bunch_it !=
Bunches.end(); bunch_it++)
299 if(bunch_it->detid.rawId() == digi.
id().
rawId())
break;
300 bunch_it->usedflag =
true;
308 bunch_it->capfc[digi.
sample(ts).
capid()] += charge1;
312 if(digi.
sample(ts+1).
adc() > 15)
continue;
319 if(digi.
sample(ts+2).
adc() > 15)
continue;
326 if(digi.
sample(ts+3).
adc() > 15)
continue;
338 for(bunch_it =
Bunches.begin(); bunch_it !=
Bunches.end(); bunch_it++)
339 if(bunch_it->detid.rawId() == digi.
id().
rawId())
break;
340 bunch_it->usedflag =
true;
348 bunch_it->capfc[digi.
sample(ts).
capid()] += charge1;
352 if(digi.
sample(ts+1).
adc() > 15)
continue;
359 if(digi.
sample(ts+2).
adc() > 15)
continue;
366 if(digi.
sample(ts+3).
adc() > 15)
continue;
std::string pedsADCfilename
T getUntrackedParameter(std::string const &, T const &) const
bool addValues(const Item &myItem, bool h2mode_=false)
#define DEFINE_FWK_MODULE(type)
int adc() const
get the ADC sample
bool dumpObject(std::ostream &fOutput, unsigned fRun, unsigned long fGMTIOVBegin, unsigned long fGMTIOVEnd, const std::string &fTag, unsigned fVersion, const HcalPedestals &fObject, const HcalPedestalWidths &fError)
int size() const
total number of samples in the digi
std::string pedsfCfilename
std::vector< T >::const_iterator const_iterator
std::string widthsADCfilename
bool getByType(Handle< PROD > &result) const
const HcalQIESample & sample(int i) const
access a sample
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup)
virtual ~HcalPedestalsAnalysis()
HcalPedestalWidths * rawWidthsItem
const HcalDetId & id() const
std::string widthsfCfilename
uint32_t rawId() const
get the raw id
HcalPedestals * rawPedsItemfc
int size() const
total number of samples in the digi
const HcalQIESample & sample(int i) const
access a sample
std::vector< HcalGenericDetId > allPrecisionId() const
HcalPedestals * rawPedsItem
int size() const
total number of samples in the digi
int capid() const
get the Capacitor id
const HcalQIESample & sample(int i) const
access a sample
T const * product() const
HcalPedestalsAnalysis(const edm::ParameterSet &ps)
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
const HcalDetId & id() const
HcalPedestalWidths * rawWidthsItemfc
const HcalDetId & id() const
void setSigma(int fCapId1, int fCapId2, float fSigma)
std::vector< NewPedBunch > Bunches
float charge(const HcalQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -> fC conversion.