12 castorDigiCollectionTag(ps.getParameter<
edm::InputTag>(
"castorDigiCollectionTag"))
31 std::cout <<
"Calculating Pedestal constants...\n";
32 std::vector<NewPedBunch>::iterator bunch_it;
33 for(bunch_it=
Bunches.begin(); bunch_it !=
Bunches.end(); ++bunch_it)
35 if(bunch_it->usedflag){
38 <<
" module = " << bunch_it->detid.module()
41 bunch_it->cap[0] /= bunch_it->num[0][0];
42 bunch_it->cap[1] /= bunch_it->num[1][1];
43 bunch_it->cap[2] /= bunch_it->num[2][2];
44 bunch_it->cap[3] /= bunch_it->num[3][3];
45 bunch_it->capfc[0] /= bunch_it->num[0][0];
46 bunch_it->capfc[1] /= bunch_it->num[1][1];
47 bunch_it->capfc[2] /= bunch_it->num[2][2];
48 bunch_it->capfc[3] /= bunch_it->num[3][3];
50 bunch_it->sig[0][0] = (bunch_it->prod[0][0]/bunch_it->num[0][0])-(bunch_it->cap[0]*bunch_it->cap[0]);
51 bunch_it->sig[0][1] = (bunch_it->prod[0][1]/bunch_it->num[0][1])-(bunch_it->cap[0]*bunch_it->cap[1]);
52 bunch_it->sig[0][2] = (bunch_it->prod[0][2]/bunch_it->num[0][2])-(bunch_it->cap[0]*bunch_it->cap[2]);
53 bunch_it->sig[0][3] = (bunch_it->prod[0][3]/bunch_it->num[0][3])-(bunch_it->cap[0]*bunch_it->cap[3]);
54 bunch_it->sig[1][0] = (bunch_it->prod[1][0]/bunch_it->num[1][0])-(bunch_it->cap[1]*bunch_it->cap[0]);
55 bunch_it->sig[1][1] = (bunch_it->prod[1][1]/bunch_it->num[1][1])-(bunch_it->cap[1]*bunch_it->cap[1]);
56 bunch_it->sig[1][2] = (bunch_it->prod[1][2]/bunch_it->num[1][2])-(bunch_it->cap[1]*bunch_it->cap[2]);
57 bunch_it->sig[1][3] = (bunch_it->prod[1][3]/bunch_it->num[1][3])-(bunch_it->cap[1]*bunch_it->cap[3]);
58 bunch_it->sig[2][0] = (bunch_it->prod[2][0]/bunch_it->num[2][0])-(bunch_it->cap[2]*bunch_it->cap[0]);
59 bunch_it->sig[2][1] = (bunch_it->prod[2][1]/bunch_it->num[2][1])-(bunch_it->cap[2]*bunch_it->cap[1]);
60 bunch_it->sig[2][2] = (bunch_it->prod[2][2]/bunch_it->num[2][2])-(bunch_it->cap[2]*bunch_it->cap[2]);
61 bunch_it->sig[2][3] = (bunch_it->prod[2][3]/bunch_it->num[2][3])-(bunch_it->cap[2]*bunch_it->cap[3]);
62 bunch_it->sig[3][0] = (bunch_it->prod[3][0]/bunch_it->num[3][0])-(bunch_it->cap[3]*bunch_it->cap[0]);
63 bunch_it->sig[3][1] = (bunch_it->prod[3][1]/bunch_it->num[3][1])-(bunch_it->cap[3]*bunch_it->cap[1]);
64 bunch_it->sig[3][2] = (bunch_it->prod[3][2]/bunch_it->num[3][2])-(bunch_it->cap[3]*bunch_it->cap[2]);
65 bunch_it->sig[3][3] = (bunch_it->prod[3][3]/bunch_it->num[3][3])-(bunch_it->cap[3]*bunch_it->cap[3]);
67 bunch_it->sigfc[0][0] = (bunch_it->prodfc[0][0]/bunch_it->num[0][0])-(bunch_it->capfc[0]*bunch_it->capfc[0]);
68 bunch_it->sigfc[0][1] = (bunch_it->prodfc[0][1]/bunch_it->num[0][1])-(bunch_it->capfc[0]*bunch_it->capfc[1]);
69 bunch_it->sigfc[0][2] = (bunch_it->prodfc[0][2]/bunch_it->num[0][2])-(bunch_it->capfc[0]*bunch_it->capfc[2]);
70 bunch_it->sigfc[0][3] = (bunch_it->prodfc[0][3]/bunch_it->num[0][3])-(bunch_it->capfc[0]*bunch_it->capfc[3]);
71 bunch_it->sigfc[1][0] = (bunch_it->prodfc[1][0]/bunch_it->num[1][0])-(bunch_it->capfc[1]*bunch_it->capfc[0]);
72 bunch_it->sigfc[1][1] = (bunch_it->prodfc[1][1]/bunch_it->num[1][1])-(bunch_it->capfc[1]*bunch_it->capfc[1]);
73 bunch_it->sigfc[1][2] = (bunch_it->prodfc[1][2]/bunch_it->num[1][2])-(bunch_it->capfc[1]*bunch_it->capfc[2]);
74 bunch_it->sigfc[1][3] = (bunch_it->prodfc[1][3]/bunch_it->num[1][3])-(bunch_it->capfc[1]*bunch_it->capfc[3]);
75 bunch_it->sigfc[2][0] = (bunch_it->prodfc[2][0]/bunch_it->num[2][0])-(bunch_it->capfc[2]*bunch_it->capfc[0]);
76 bunch_it->sigfc[2][1] = (bunch_it->prodfc[2][1]/bunch_it->num[2][1])-(bunch_it->capfc[2]*bunch_it->capfc[1]);
77 bunch_it->sigfc[2][2] = (bunch_it->prodfc[2][2]/bunch_it->num[2][2])-(bunch_it->capfc[2]*bunch_it->capfc[2]);
78 bunch_it->sigfc[2][3] = (bunch_it->prodfc[2][3]/bunch_it->num[2][3])-(bunch_it->capfc[2]*bunch_it->capfc[3]);
79 bunch_it->sigfc[3][0] = (bunch_it->prodfc[3][0]/bunch_it->num[3][0])-(bunch_it->capfc[3]*bunch_it->capfc[0]);
80 bunch_it->sigfc[3][1] = (bunch_it->prodfc[3][1]/bunch_it->num[3][1])-(bunch_it->capfc[3]*bunch_it->capfc[1]);
81 bunch_it->sigfc[3][2] = (bunch_it->prodfc[3][2]/bunch_it->num[3][2])-(bunch_it->capfc[3]*bunch_it->capfc[2]);
82 bunch_it->sigfc[3][3] = (bunch_it->prodfc[3][3]/bunch_it->num[3][3])-(bunch_it->capfc[3]*bunch_it->capfc[3]);
84 for(
int i = 0;
i != 3;
i++){
93 int fillphi = bunch_it->detid.sector();
98 dephist->Fill( bunch_it->detid.module(),fillphi,
99 (bunch_it->cap[0]+bunch_it->cap[1]+bunch_it->cap[2]+bunch_it->cap[3])/4);
101 const CastorPedestal item(bunch_it->detid, bunch_it->cap[0], bunch_it->cap[1], bunch_it->cap[2], bunch_it->cap[3],
102 bunch_it->sig[0][0], bunch_it->sig[1][1], bunch_it->sig[2][2], bunch_it->sig[3][3]);
105 widthsp.
setSigma(0,0,bunch_it->sig[0][0]);
106 widthsp.
setSigma(0,1,bunch_it->sig[0][1]);
107 widthsp.
setSigma(0,2,bunch_it->sig[0][2]);
108 widthsp.
setSigma(0,3,bunch_it->sig[0][3]);
109 widthsp.
setSigma(1,0,bunch_it->sig[1][0]);
110 widthsp.
setSigma(1,1,bunch_it->sig[1][1]);
111 widthsp.
setSigma(1,2,bunch_it->sig[1][2]);
112 widthsp.
setSigma(1,3,bunch_it->sig[1][3]);
113 widthsp.
setSigma(2,0,bunch_it->sig[2][0]);
114 widthsp.
setSigma(2,1,bunch_it->sig[2][1]);
115 widthsp.
setSigma(2,2,bunch_it->sig[2][2]);
116 widthsp.
setSigma(2,3,bunch_it->sig[2][3]);
117 widthsp.
setSigma(3,0,bunch_it->sig[3][0]);
118 widthsp.
setSigma(3,1,bunch_it->sig[3][1]);
119 widthsp.
setSigma(3,2,bunch_it->sig[3][2]);
120 widthsp.
setSigma(3,3,bunch_it->sig[3][3]);
123 const CastorPedestal itemfc(bunch_it->detid, bunch_it->capfc[0], bunch_it->capfc[1], bunch_it->capfc[2], bunch_it->capfc[3],
124 bunch_it->sigfc[0][0], bunch_it->sigfc[1][1], bunch_it->sigfc[2][2], bunch_it->sigfc[3][3]);
127 widthspfc.
setSigma(0,0,bunch_it->sigfc[0][0]);
128 widthspfc.
setSigma(0,1,bunch_it->sigfc[0][1]);
129 widthspfc.
setSigma(0,2,bunch_it->sigfc[0][2]);
130 widthspfc.
setSigma(0,3,bunch_it->sigfc[0][3]);
131 widthspfc.
setSigma(1,0,bunch_it->sigfc[1][0]);
132 widthspfc.
setSigma(1,1,bunch_it->sigfc[1][1]);
133 widthspfc.
setSigma(1,2,bunch_it->sigfc[1][2]);
134 widthspfc.
setSigma(1,3,bunch_it->sigfc[1][3]);
135 widthspfc.
setSigma(2,0,bunch_it->sigfc[2][0]);
136 widthspfc.
setSigma(2,1,bunch_it->sigfc[2][1]);
137 widthspfc.
setSigma(2,2,bunch_it->sigfc[2][2]);
138 widthspfc.
setSigma(2,3,bunch_it->sigfc[2][3]);
139 widthspfc.
setSigma(3,0,bunch_it->sigfc[3][0]);
140 widthspfc.
setSigma(3,1,bunch_it->sigfc[3][1]);
141 widthspfc.
setSigma(3,2,bunch_it->sigfc[3][2]);
142 widthspfc.
setSigma(3,3,bunch_it->sigfc[3][3]);
175 dephist->SetDrawOption(
"colz");
176 dephist->GetXaxis()->SetTitle(
"module");
177 dephist->GetYaxis()->SetTitle(
"sector");
187 std::stringstream tempstringout;
189 std::string name1 = tempstringout.str() +
"_pedplots_1d.png";
190 std::string name2 = tempstringout.str() +
"_pedplots_2d.png";
192 TStyle *theStyle =
new TStyle(
"style",
"null");
193 theStyle->SetPalette(1,0);
194 theStyle->SetCanvasDefH(1200);
195 theStyle->SetCanvasDefW(1600);
248 std::stringstream tempstringout;
250 runnum_string = tempstringout.str();
256 XMLfilename = runnum_string +
"-peds_ADC_complete.xml";
257 XMLtag =
"Castor_pedestals_" + runnum_string;
265 CASTORMeans =
new TH1F(
"All Ped Means CASTOR",
"All Ped Means CASTOR", 100, 0, 9);
266 CASTORWidths =
new TH1F(
"All Ped Widths CASTOR",
"All Ped Widths CASTOR", 100, 0, 3);
268 dephist =
new TH2F(
"Pedestals (ADC)",
"All Castor",14, 0., 14.5, 16, .5, 16.5);
277 std::vector<HcalGenericDetId> listEMap = myRefEMap->
allPrecisionId();
278 for (std::vector<HcalGenericDetId>::const_iterator it = listEMap.begin(); it != listEMap.end(); ++it)
281 if(mygenid.isHcalCastorDetId())
289 for(
int i = 0;
i != 4;
i++)
293 for(
int j = 0; j != 4; j++)
308 std::vector<NewPedBunch>::iterator bunch_it;
313 for(bunch_it =
Bunches.begin(); bunch_it !=
Bunches.end(); ++bunch_it)
314 if(bunch_it->detid.rawId() == digi.
id().
rawId())
break;
315 bunch_it->usedflag =
true;
322 bunch_it->capfc[digi.
sample(ts).
capid()] += charge1;
T getUntrackedParameter(std::string const &, T const &) const
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup)
void setSigma(int fCapId1, int fCapId2, float fSigma)
std::vector< NewPedBunch > Bunches
#define DEFINE_FWK_MODULE(type)
int adc() const
get the ADC sample
const HcalQIESample & sample(int i) const
access a sample
std::vector< CastorDataFrame >::const_iterator const_iterator
std::string widthsfCfilename
uint32_t rawId() const
get the raw id
const CastorQIEShape * getCastorShape() const
edm::InputTag castorDigiCollectionTag
float charge(const CastorQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -> fC conversion.
std::string widthsADCfilename
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
const_iterator end() const
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
std::vector< HcalGenericDetId > allPrecisionId() const
int capid() const
get the Capacitor id
std::string pedsADCfilename
virtual ~CastorPedestalsAnalysis()
CastorPedestalsAnalysis(const edm::ParameterSet &ps)
bool addValues(const Item &myItem)
std::string pedsfCfilename
const HcalCastorDetId & id() const
int size() const
total number of samples in the digi
T const * product() const
const_iterator begin() const
const CastorQIECoder * getCastorCoder(const HcalGenericDetId &fId) const