36 hist_file=
new TFile(histoFileName.c_str(),
"RECREATE");
44 std::ostringstream ss;
47 ss <<idint<<
"_Anode_First_Time";
48 mh_FirstTime[idint]=
new TH2F(ss.str().c_str(),
"",675,0.0,675.0,50,0.0,10.0);
49 mh_FirstTime[idint]->GetXaxis()->SetTitle(
"(AFEB-1)*16+ch");
50 mh_FirstTime[idint]->GetYaxis()->SetTitle(
"Anode First Time Bin");
56 ss <<idint<<
"_Anode_Chan_Eff";
57 mh_ChanEff[idint]=
new TH1F(ss.str().c_str(),
"",675,0.0,675.0);
58 mh_ChanEff[idint]->GetXaxis()->SetTitle(
"(AFEB-1)*16+ch");
59 mh_ChanEff[idint]->GetYaxis()->SetTitle(
"Entries");
64 ss <<idint<<
"_Anode_AfebDac";
65 mh_AfebDac[idint]=
new TH2F(ss.str().c_str(),
"",75,0.0,75.0, 50,0.0,50.0);
66 mh_AfebDac[idint]->GetXaxis()->SetTitle(
"Threshold DAC");
67 mh_AfebDac[idint]->GetYaxis()->SetTitle(
"AFEB Channel Occupancy");
73 ss <<idint<<
"_Anode_AfebThrPar";
74 mh_AfebThrPar[idint]=
new TH2F(ss.str().c_str(),
"",700,0.0,700.0, 50,0.0,50.0);
76 mh_AfebThrPar[idint]->GetYaxis()->SetTitle(
"AFEB Channel Threshold (DAC)");
82 ss <<idint<<
"_Anode_AfebNoisePar";
83 mh_AfebNoisePar[idint]=
new TH2F(ss.str().c_str(),
"",700,0.0,700.0, 50,0.0,5.0);
85 mh_AfebNoisePar[idint]->GetYaxis()->SetTitle(
"AFEB Channel Noise (DAC)");
91 ss <<idint<<
"_Anode_AfebNDF";
92 mh_AfebNDF[idint]=
new TH2F(ss.str().c_str(),
"",700,0.0,700.0, 25,-5.0,20.0);
93 mh_AfebNDF[idint]->GetXaxis()->SetTitle(
"(AFEB-1)*16+ch");
94 mh_AfebNDF[idint]->GetYaxis()->SetTitle(
"AFEB Channel Fit NDF");
100 ss <<idint<<
"_Anode_AfebChi2perNDF";
101 mh_AfebChi2perNDF[idint]=
new TH2F(ss.str().c_str(),
"",700,0.0,700.0, 50,0.0,10.0);
110 const int&
id,
float&
x,
float w) {
112 std::map<int,TH1*>::iterator
h;
118 h->second->Fill(x,w);
122 const int&
id,
float&
x,
float&
y,
float w) {
124 std::map<int,TH2*>::iterator
h;
130 h->second->Fill(x,y,w);
137 std::ostringstream ss;
138 std::map<int,std::vector<int> >::iterator intIt;
139 std::map<int, std::vector<std::vector<int> > >::iterator wiredacIt;
141 std::vector<int> vec;
162 if(wirecltn.begin() != wirecltn.end()) {
166 for (wiredetUnitIt=wirecltn.begin();
167 wiredetUnitIt!=wirecltn.end();
170 const CSCDetId&
id = (*wiredetUnitIt).first;
172 const int idchamber=
id.
endcap()*10000 +
id.station()*1000+
173 id.ring()*100 +
id.chamber();
174 const int idlayer =
id.endcap()*100000+
id.station()*10000+
175 id.ring()*1000+
id.chamber()*10+
id.layer();
180 std::vector<int> wireplane(maxwire,0);
184 range.first; digiIt!=range.second; ++digiIt){
186 int iwire=(*digiIt).getWireGroup();
188 if(wireplane[iwire-1]==0) {
189 wireplane[iwire-1]=(*digiIt).getBeamCrossingTag()+1;
196 y=wireplane[iwire-1];
214 const int idwirev=(*intIt).first;
215 const std::vector<int> wiretemp=(*intIt).second;
217 std::vector<int> zer(nsize,0);
221 for(
unsigned int j=0;
j<wiretemp.size();
j++)
227 for(
unsigned int i=0;
i<(*intIt).second.size();
i++)
228 if((*intIt).second[
i]>0) wiredacIt->second[
i][
indDac]=
229 wiredacIt->second[
i][
indDac]+1;
233 if(dac==(
float)
EndDac) indDac=0;
248 std::map<int, std::vector<std::vector<int> > >::iterator mwiredacIt;
249 std::map<int, std::vector<std::vector<float> > >::iterator mresfordbIt;
250 std::vector<int>::iterator vecIt;
261 std::vector<float> inputx;
262 std::vector<float> inputy;
264 std::vector<float> mypar(2, 0.0);
265 std::vector<float> ermypar(2, 0.0);
266 float ercorr, chisq, edm;
269 int ch, afeb, idchmb;
273 std::vector<float> fitres(4,0);
278 int idwiredac=(*mwiredacIt).first;
280 int layer=idwiredac-(idwiredac/10)*10;
283 for(
int unsigned iwire=0; iwire<mwiredacIt->second.size();iwire++) {
290 for(vecIt=mwiredacIt->second[iwire].begin();
291 vecIt!=mwiredacIt->second[iwire].end(); ++vecIt) {
316 for(
unsigned int i=0;
i<2;
i++) {mypar[
i]=0.0; ermypar[
i]=0.0;}
326 fitAnodeThr->
ThresholdNoise(inputx,inputy,
npulses,
vecDacOccup,mypar,ermypar,ercorr,chisq,ndf,niter,edm);
350 if(ndf>0) y=chisq/(float)ndf;
358 if(ndf>0) fitres[3]=chisq/(float)ndf;
375 std::cout<<
"The following CSCs will go to DB"<<std::endl<<std::endl;
379 int idlayer=(*mresfordbIt).first;
381 int layer=idlayer-idchmb*10;
382 std::cout<<
"CSC "<<idchmb<<
" Layer "<<layer<<
" "
383 <<(*mresfordbIt).second.size()<<std::endl;
388 int idlayer=(*mresfordbIt).first;
391 int size = (*mresfordbIt).second.size();
392 cn->
obj[idlayer].resize(size);
394 for (
unsigned int i=0;
i<(*mresfordbIt).second.size();
i++) {
402 cn->
obj[idlayer][i].resize(4);
403 cn->
obj[idlayer][
i][0] = (*mresfordbIt).second[
i][0];
404 cn->
obj[idlayer][
i][1] = (*mresfordbIt).second[
i][1];
405 cn->
obj[idlayer][
i][2] = (*mresfordbIt).second[
i][2];
406 cn->
obj[idlayer][
i][3] = (*mresfordbIt).second[
i][3];
422 std::cout<<
" End of CSCAFEBThrAnalysis"<<std::endl;
int getAfebCh(int layer, int wiregroup) const
return AFEB channel number
std::map< int, TH2 * > mh_FirstTime
std::map< int, std::vector< std::vector< float > > > m_res_for_db
std::map< int, std::vector< int > > m_wire_ev
Maps - per event, threshold curve, fit results.
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
std::map< int, TH1 * > mh_ChanEff
Histogram maps.
std::vector< int > vecDacOccup
std::map< int, TH2 * > mh_AfebChi2perNDF
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.
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
std::vector< CSCWireDigi >::const_iterator const_iterator
std::map< int, TH2 * > mh_AfebNDF
void hf1ForId(std::map< int, TH1 * > &mp, int flag, const int &id, float &x, float w)
TFile * hist_file
ROOT hist file.
int getAfebPos(int layer, int wiregroup) const
return AFEB position number
std::map< int, TH2 * > mh_AfebNoisePar
std::map< int, std::vector< std::vector< int > > > m_wire_dac
std::pair< const_iterator, const_iterator > Range
void setup(const std::string &histoFileName)
void analyze(const CSCWireDigiCollection &wirecltn)
std::map< int, std::vector< std::vector< float > > > obj
std::map< int, TH2 * > mh_AfebThrPar
void hf2ForId(std::map< int, TH2 * > &mp, int flag, const int &id, float &x, float &y, float w)
tuple size
Write out results.
void bookForId(int flag, const int &idint, const std::string &ids)