41 std::ostringstream
ss;
44 ss << idint <<
"_Anode_First_Time";
45 mh_FirstTime[idint] =
new TH2F(
ss.str().c_str(),
"", 675, 0.0, 675.0, 50, 0.0, 10.0);
46 mh_FirstTime[idint]->GetXaxis()->SetTitle(
"(AFEB-1)*16+ch");
47 mh_FirstTime[idint]->GetYaxis()->SetTitle(
"Anode First Time Bin");
53 ss << idint <<
"_Anode_Chan_Eff";
54 mh_ChanEff[idint] =
new TH1F(
ss.str().c_str(),
"", 675, 0.0, 675.0);
55 mh_ChanEff[idint]->GetXaxis()->SetTitle(
"(AFEB-1)*16+ch");
56 mh_ChanEff[idint]->GetYaxis()->SetTitle(
"Entries");
61 ss << idint <<
"_Anode_AfebDac";
62 mh_AfebDac[idint] =
new TH2F(
ss.str().c_str(),
"", 75, 0.0, 75.0, 50, 0.0, 50.0);
63 mh_AfebDac[idint]->GetXaxis()->SetTitle(
"Threshold DAC");
64 mh_AfebDac[idint]->GetYaxis()->SetTitle(
"AFEB Channel Occupancy");
70 ss << idint <<
"_Anode_AfebThrPar";
71 mh_AfebThrPar[idint] =
new TH2F(
ss.str().c_str(),
"", 700, 0.0, 700.0, 50, 0.0, 50.0);
73 mh_AfebThrPar[idint]->GetYaxis()->SetTitle(
"AFEB Channel Threshold (DAC)");
79 ss << idint <<
"_Anode_AfebNoisePar";
80 mh_AfebNoisePar[idint] =
new TH2F(
ss.str().c_str(),
"", 700, 0.0, 700.0, 50, 0.0, 5.0);
82 mh_AfebNoisePar[idint]->GetYaxis()->SetTitle(
"AFEB Channel Noise (DAC)");
88 ss << idint <<
"_Anode_AfebNDF";
89 mh_AfebNDF[idint] =
new TH2F(
ss.str().c_str(),
"", 700, 0.0, 700.0, 25, -5.0, 20.0);
90 mh_AfebNDF[idint]->GetXaxis()->SetTitle(
"(AFEB-1)*16+ch");
91 mh_AfebNDF[idint]->GetYaxis()->SetTitle(
"AFEB Channel Fit NDF");
97 ss << idint <<
"_Anode_AfebChi2perNDF";
107 std::map<int, TH1*>::iterator
h;
113 h->second->Fill(
x,
w);
117 std::map<int, TH2*>::iterator
h;
123 h->second->Fill(
x,
y,
w);
128 std::ostringstream
ss;
129 std::map<int, std::vector<int> >::iterator intIt;
130 std::map<int, std::vector<std::vector<int> > >::iterator wiredacIt;
132 std::vector<int> vec;
152 if (wirecltn.begin() == wirecltn.end())
155 if (wirecltn.begin() != wirecltn.end()) {
158 for (wiredetUnitIt = wirecltn.begin(); wiredetUnitIt != wirecltn.end(); ++wiredetUnitIt) {
159 const CSCDetId&
id = (*wiredetUnitIt).first;
161 const int idchamber =
id.
endcap() * 10000 +
id.station() * 1000 +
id.ring() * 100 +
id.chamber();
163 id.endcap() * 100000 +
id.station() * 10000 +
id.ring() * 1000 +
id.chamber() * 10 +
id.layer();
168 std::vector<int> wireplane(maxwire, 0);
172 int iwire = (*digiIt).getWireGroup();
173 if (iwire <= maxwire) {
174 if (wireplane[iwire - 1] == 0) {
175 wireplane[iwire - 1] = (*digiIt).getBeamCrossingTag() + 1;
181 x = (afeb - 1) * 16 + ch;
182 y = wireplane[iwire - 1];
199 const int idwirev = (*intIt).first;
200 const std::vector<int> wiretemp = (*intIt).second;
202 std::vector<int> zer(nsize, 0);
206 for (
unsigned int j = 0;
j < wiretemp.size();
j++)
212 for (
unsigned int i = 0;
i < (*intIt).second.size();
i++)
213 if ((*intIt).second[
i] > 0)
228 std::map<int, std::vector<std::vector<int> > >::iterator mwiredacIt;
229 std::map<int, std::vector<std::vector<float> > >::iterator mresfordbIt;
230 std::vector<int>::iterator vecIt;
235 std::cout <<
"DAC occupancy" << std::endl;
237 for (
size_t i = 0;
i < ndacsize;
i++)
241 std::vector<float> inputx;
242 std::vector<float> inputy;
244 std::vector<float> mypar(2, 0.0);
245 std::vector<float> ermypar(2, 0.0);
246 float ercorr, chisq,
edm;
249 int ch, afeb, idchmb;
253 std::vector<float> fitres(4, 0);
258 int idwiredac = (*mwiredacIt).first;
260 int layer = idwiredac - (idwiredac / 10) * 10;
261 idchmb = idwiredac / 10;
263 for (
int unsigned iwire = 0; iwire < mwiredacIt->second.size(); iwire++) {
269 for (vecIt = mwiredacIt->second[iwire].begin(); vecIt != mwiredacIt->second[iwire].end(); ++vecIt) {
276 x = (afeb - 1) * 16 + ch;
293 for (
unsigned int i = 0;
i < 2;
i++) {
306 fitAnodeThr->
ThresholdNoise(inputx, inputy,
npulses,
vecDacOccup, mypar, ermypar, ercorr, chisq, ndf, niter,
edm);
314 x = (afeb - 1) * 16 + ch;
335 fitres[0] = mypar[0];
336 fitres[1] = mypar[1];
340 fitres[3] = chisq / (
float)ndf;
358 std::cout <<
"The following CSCs will go to DB" << std::endl << std::endl;
361 int idlayer = (*mresfordbIt).first;
362 idchmb = idlayer / 10;
363 int layer = idlayer - idchmb * 10;
364 std::cout <<
"CSC " << idchmb <<
" Layer " <<
layer <<
" " << (*mresfordbIt).second.size() << std::endl;
368 int idlayer = (*mresfordbIt).first;
371 int size = (*mresfordbIt).second.size();
372 cn.obj[idlayer].resize(
size);
374 for (
unsigned int i = 0;
i < (*mresfordbIt).second.size();
i++) {
377 for (
int j = 0;
j < 4;
j++)
382 cn.obj[idlayer][
i].resize(4);
383 cn.obj[idlayer][
i][0] = (*mresfordbIt).second[
i][0];
384 cn.obj[idlayer][
i][1] = (*mresfordbIt).second[
i][1];
385 cn.obj[idlayer][
i][2] = (*mresfordbIt).second[
i][2];
386 cn.obj[idlayer][
i][3] = (*mresfordbIt).second[
i][3];
402 std::cout <<
" End of CSCAFEBThrAnalysis" << std::endl;
void hf2ForId(std::map< int, TH2 *> &mp, int flag, const int &id, float &x, float &y, float w)
std::map< int, TH2 * > mh_FirstTime
std::map< int, std::vector< std::vector< float > > > m_res_for_db
int getAfebCh(int layer, int wiregroup) const
return AFEB channel number
void hf1ForId(std::map< int, TH1 *> &mp, int flag, const int &id, float &x, float w)
std::map< int, std::vector< int > > m_wire_ev
Maps - per event, threshold curve, fit results.
std::map< int, TH1 * > mh_ChanEff
Histogram maps.
std::vector< int > vecDacOccup
std::map< int, TH2 * > mh_AfebChi2perNDF
virtual bool ThresholdNoise(const std::vector< float > &inputx, const std::vector< float > &inputy, const int &npulses, std::vector< int > &dacoccup, std::vector< float > &mypar, std::vector< float > &ermypar, float &ercorr, float &chisq, int &ndf, int &niter, float &edm) const
int getMaxWire(int station, int ring) const
return max. number of wiregroups per layer
std::map< int, TH2 * > mh_AfebDac
std::vector< float > vecDac
const CSCToAFEB csctoafeb
Layer, wire to AFEB, channel conversion.
std::pair< const_iterator, const_iterator > Range
std::vector< DigiType >::const_iterator const_iterator
std::map< int, TH2 * > mh_AfebNDF
deadvectors [0] push_back({0.0175431, 0.538005, 6.80997, 13.29})
TFile * hist_file
ROOT hist file.
std::map< int, TH2 * > mh_AfebNoisePar
std::map< int, std::vector< std::vector< int > > > m_wire_dac
void setup(const std::string &histoFileName)
void analyze(const CSCWireDigiCollection &wirecltn)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
std::map< int, TH2 * > mh_AfebThrPar
void bookForId(int flag, const int &idint, const std::string &ids)
int getAfebPos(int layer, int wiregroup) const
return AFEB position number