39 #include "TPaveStats.h" 50 SiStripPedestalsTest() :
cond::payloadInspector::Histogram1D<
SiStripPedestals>(
"SiStrip Pedestals test",
51 "SiStrip Pedestals test", 10,0.0,10.0),
57 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
58 for (
auto const & iov: iovs) {
65 ss <<
"Summary of strips pedestals:" << std::endl;
68 payload->printSummary(ss,&m_trackerTopo);
70 std::vector<uint32_t> detid;
71 payload->getDetIds(detid);
101 SiStripPedestalsValue() :
cond::payloadInspector::Histogram1D<
SiStripPedestals>(
"SiStrip Pedestals values",
102 "SiStrip Pedestals values", 300,0.0,300.0){
103 Base::setSingleIov(
true );
106 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
107 for (
auto const & iov: iovs) {
108 std::shared_ptr<SiStripPedestals> payload = Base::fetchPayload( std::get<1>(iov) );
111 std::vector<uint32_t> detid;
112 payload->getDetIds(detid);
114 for (
const auto &
d : detid) {
116 for(
int it=0; it < (range.second-range.first)*8/10; ++it ){
117 auto ped = payload->getPed(it,range);
137 setSingleIov(
true );
140 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override {
141 auto iov = iovs.front();
142 std::shared_ptr<SiStripPedestals> payload = fetchPayload( std::get<1>(iov) );
144 std::string titleMap =
"Tracker Map of SiStrip Pedestals "+
estimatorType(est)+
" per module (payload : "+std::get<1>(iov)+
")";
146 std::unique_ptr<TrackerMap> tmap = std::unique_ptr<TrackerMap>(
new TrackerMap(
"SiStripPedestals"));
147 tmap->setTitle(titleMap);
150 std::vector<uint32_t> detid;
151 payload->getDetIds(detid);
153 std::map<unsigned int,float> info_per_detid;
155 for (
const auto &
d : detid) {
159 for(
int it=0; it < (range.second-range.first)*8/10; ++it ){
161 auto ped = payload->getPed(it,range);
177 info_per_detid[
d]=
min;
180 info_per_detid[
d]=
max;
183 info_per_detid[
d]=
mean;
186 info_per_detid[
d]=
rms;
194 for(
const auto &
d : detid){
195 tmap->fill(
d,info_per_detid[
d]);
205 typedef SiStripPedestalsTrackerMap<SiStripPI::min> SiStripPedestalsMin_TrackerMap;
206 typedef SiStripPedestalsTrackerMap<SiStripPI::max> SiStripPedestalsMax_TrackerMap;
207 typedef SiStripPedestalsTrackerMap<SiStripPI::mean> SiStripPedestalsMean_TrackerMap;
208 typedef SiStripPedestalsTrackerMap<SiStripPI::rms> SiStripPedestalsRMS_TrackerMap;
219 setSingleIov(
true );
222 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override {
223 auto iov = iovs.front();
224 std::shared_ptr<SiStripPedestals> payload = fetchPayload( std::get<1>(iov) );
227 std::vector<uint32_t> detid;
228 payload->getDetIds(detid);
230 for (
const auto &
d : detid) {
234 for(
int it=0; it < (range.second-range.first)*8/10; ++it ){
236 auto ped = payload->getPed(it,range);
244 if((
rms/nstrips-mean*mean)>0.){
252 summaryPedestals.add(
d,
min);
255 summaryPedestals.add(
d,
max);
258 summaryPedestals.add(
d,mean);
261 summaryPedestals.add(
d,
rms);
269 std::map<unsigned int, SiStripDetSummary::Values>
map = summaryPedestals.getCounts();
272 TCanvas
canvas(
"Partion summary",
"partition summary",1200,1000);
274 auto h1 = std::unique_ptr<TH1F>(
new TH1F(
"byRegion",Form(
"Average by partition of %s SiStrip Pedestals per module;;average SiStrip Pedestals %s [ADC counts]",
estimatorType(est).c_str(),
estimatorType(est).c_str()),map.size(),0.,map.size()));
276 canvas.SetBottomMargin(0.18);
277 canvas.SetLeftMargin(0.17);
278 canvas.SetRightMargin(0.05);
281 std::vector<int> boundaries;
287 for (
const auto &element : map){
289 int count = element.second.count;
290 double mean = (element.second.mean)/count;
291 double rms = (element.second.rms)/count - mean*mean;
298 if(currentDetector.empty()) currentDetector=
"TIB";
300 switch ((element.first)/1000)
316 h1->SetBinContent(iBin,mean);
318 h1->GetXaxis()->LabelsOption(
"v");
320 if(detector!=currentDetector) {
321 boundaries.push_back(iBin);
326 h1->SetMarkerStyle(20);
327 h1->SetMarkerSize(1);
328 h1->SetMaximum(h1->GetMaximum()*1.1);
334 TLine
l[boundaries.size()];
336 for (
const auto &
line : boundaries){
338 l[
i].SetLineWidth(1);
339 l[
i].SetLineStyle(9);
340 l[
i].SetLineColor(2);
345 TLegend
legend = TLegend(0.52,0.82,0.95,0.9);
346 legend.SetHeader((std::get<1>(iov)).c_str(),
"C");
347 legend.AddEntry(h1.get(),(
"IOV: "+std::to_string(std::get<0>(iov))).c_str(),
"PL");
348 legend.SetTextSize(0.025);
361 typedef SiStripPedestalsByRegion<SiStripPI::mean> SiStripPedestalsMeanByRegion;
362 typedef SiStripPedestalsByRegion<SiStripPI::min> SiStripPedestalsMinByRegion;
363 typedef SiStripPedestalsByRegion<SiStripPI::max> SiStripPedestalsMaxByRegion;
364 typedef SiStripPedestalsByRegion<SiStripPI::rms> SiStripPedestalsRMSByRegion;
std::pair< ContainerIterator, ContainerIterator > Range
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
void fillWithValue(float value, float weight=1)
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
std::string estimatorType(SiStripPI::estimator e)
std::pair< int, const char * > regionType(int index)
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
void setSingleIov(bool flag)
bool fill(const std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs) override
TrackerTopology fromTrackerParametersXMLFile(const std::string &xmlFileName)