00001 #define printing false
00002
00003
00004 #include "DQM/SiPixelMonitorClient/interface/SiPixelActionExecutor.h"
00005 #include "DQM/SiPixelMonitorClient/interface/SiPixelUtility.h"
00006 #include "DQM/SiPixelMonitorClient/interface/SiPixelInformationExtractor.h"
00007 #include "DQM/SiPixelMonitorClient/interface/SiPixelTrackerMapCreator.h"
00008 #include "DQM/SiPixelMonitorClient/interface/ANSIColors.h"
00009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00010 #include "FWCore/ParameterSet/interface/FileInPath.h"
00011 #include "DQMServices/Core/interface/DQMStore.h"
00012 #include "DQMServices/Core/interface/MonitorElement.h"
00013 #include "DQM/SiPixelCommon/interface/SiPixelFolderOrganizer.h"
00014 #include "DataFormats/DetId/interface/DetId.h"
00015 #include "DataFormats/GeometrySurface/interface/Surface.h"
00016 #include "DataFormats/SiPixelDetId/interface/PixelBarrelName.h"
00017 #include "DataFormats/SiPixelDetId/interface/PixelEndcapName.h"
00018 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
00019 #include "CondFormats/SiPixelObjects/interface/DetectorIndex.h"
00020 #include "CondFormats/SiPixelObjects/interface/SiPixelFrameConverter.h"
00021 #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h"
00022 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00023 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00024 #include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h"
00025 #include "Geometry/CommonTopologies/interface/PixelTopology.h"
00026
00027 #include <math.h>
00028
00029 #include <iostream>
00030 using namespace std;
00031
00032
00033
00034
00035 SiPixelActionExecutor::SiPixelActionExecutor(bool offlineXMLfile,
00036 bool Tier0Flag) :
00037 offlineXMLfile_(offlineXMLfile),
00038 Tier0Flag_(Tier0Flag) {
00039 edm::LogInfo("SiPixelActionExecutor") <<
00040 " Creating SiPixelActionExecutor " << "\n" ;
00041 configParser_ = 0;
00042 configWriter_ = 0;
00043 qtHandler_ = 0;
00044 ndet_ = 0;
00045
00046 }
00047
00048
00049
00050
00051 SiPixelActionExecutor::~SiPixelActionExecutor() {
00052 edm::LogInfo("SiPixelActionExecutor") <<
00053 " Deleting SiPixelActionExecutor " << "\n" ;
00054 if (configParser_) delete configParser_;
00055 if (configWriter_) delete configWriter_;
00056 if (qtHandler_) delete qtHandler_;
00057 }
00058
00059
00060
00061
00062 void SiPixelActionExecutor::readConfiguration() {
00063 string localPath;
00064 if(offlineXMLfile_) localPath = string("DQM/SiPixelMonitorClient/test/sipixel_tier0_config.xml");
00065 else localPath = string("DQM/SiPixelMonitorClient/test/sipixel_monitorelement_config.xml");
00066 if (configParser_ == 0) {
00067 configParser_ = new SiPixelConfigParser();
00068 configParser_->getDocument(edm::FileInPath(localPath).fullPath());
00069 }
00070 }
00071
00072
00073
00074
00075 bool SiPixelActionExecutor::readConfiguration(int& tkmap_freq,
00076 int& sum_barrel_freq,
00077 int& sum_endcap_freq,
00078 int& sum_grandbarrel_freq,
00079 int& sum_grandendcap_freq,
00080 int& message_limit_,
00081 int& source_type_,
00082 int& calib_type_) {
00083
00084 string localPath;
00085 if(offlineXMLfile_) localPath = string("DQM/SiPixelMonitorClient/test/sipixel_tier0_config.xml");
00086 else localPath = string("DQM/SiPixelMonitorClient/test/sipixel_monitorelement_config.xml");
00087 if (configParser_ == 0) {
00088 configParser_ = new SiPixelConfigParser();
00089 configParser_->getDocument(edm::FileInPath(localPath).fullPath());
00090 }
00091
00092 if (!configParser_->getFrequencyForTrackerMap(tkmap_freq)){
00093 cout << "SiPixelActionExecutor::readConfiguration: Failed to read TrackerMap configuration parameters!! ";
00094 return false;
00095 }
00096 if (!configParser_->getFrequencyForBarrelSummary(sum_barrel_freq)){
00097 edm::LogInfo("SiPixelActionExecutor") << "Failed to read Barrel Summary configuration parameters!! " << "\n" ;
00098 return false;
00099 }
00100 if (!configParser_->getFrequencyForEndcapSummary(sum_endcap_freq)){
00101 edm::LogInfo("SiPixelActionExecutor") << "Failed to read Endcap Summary configuration parameters!! " << "\n" ;
00102 return false;
00103 }
00104 if (!configParser_->getFrequencyForGrandBarrelSummary(sum_grandbarrel_freq)){
00105 edm::LogInfo("SiPixelActionExecutor") << "Failed to read Grand Barrel Summary configuration parameters!! " << "\n" ;
00106 return false;
00107 }
00108 if (!configParser_->getFrequencyForGrandEndcapSummary(sum_grandendcap_freq)){
00109 edm::LogInfo("SiPixelActionExecutor") << "Failed to read Grand Endcap Summary configuration parameters!! " << "\n" ;
00110 return false;
00111 }
00112 if (!configParser_->getMessageLimitForQTests(message_limit_)){
00113 edm::LogInfo("SiPixelActionExecutor") << "Failed to read QTest Message Limit" << "\n" ;
00114 return false;
00115 }
00116 if (!configParser_->getSourceType(source_type_)){
00117 edm::LogInfo("SiPixelActionExecutor") << "Failed to read Source Type" << "\n" ;
00118 return false;
00119 }
00120 if (!configParser_->getCalibType(calib_type_)){
00121 edm::LogInfo("SiPixelActionExecutor") << "Failed to read Calib Type" << "\n" ;
00122 return false;
00123 }
00124
00125 return true;
00126 }
00127
00128 bool SiPixelActionExecutor::readConfiguration(int& tkmap_freq, int& summary_freq) {
00129
00130 string localPath;
00131 if(offlineXMLfile_) localPath = string("DQM/SiPixelMonitorClient/test/sipixel_tier0_config.xml");
00132 else localPath = string("DQM/SiPixelMonitorClient/test/sipixel_monitorelement_config.xml");
00133 if (configParser_ == 0) {
00134 configParser_ = new SiPixelConfigParser();
00135 configParser_->getDocument(edm::FileInPath(localPath).fullPath());
00136 }
00137
00138 if (!configParser_->getFrequencyForTrackerMap(tkmap_freq)){
00139 cout << "SiPixelActionExecutor::readConfiguration: Failed to read TrackerMap configuration parameters!! ";
00140 return false;
00141 }
00142 if (!configParser_->getFrequencyForBarrelSummary(summary_freq)){
00143 edm::LogInfo("SiPixelActionExecutor") << "Failed to read Summary configuration parameters!! " << "\n" ;
00144 return false;
00145 }
00146
00147 return true;
00148 }
00149
00150
00151
00152 void SiPixelActionExecutor::createTkMap(DQMStore* bei,
00153 string mEName,
00154 string theTKType)
00155 {
00156
00157 SiPixelTrackerMapCreator tkmap_creator(mEName,theTKType,offlineXMLfile_);
00158 tkmap_creator.create(bei);
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168 }
00169
00170
00171 void SiPixelActionExecutor::createSummary(DQMStore* bei) {
00172
00173 string barrel_structure_name;
00174 vector<string> barrel_me_names;
00175 string localPath;
00176 if(offlineXMLfile_) localPath = string("DQM/SiPixelMonitorClient/test/sipixel_tier0_config.xml");
00177 else localPath = string("DQM/SiPixelMonitorClient/test/sipixel_monitorelement_config.xml");
00178
00179 if (configParser_ == 0) {
00180 configParser_ = new SiPixelConfigParser();
00181 configParser_->getDocument(edm::FileInPath(localPath).fullPath());
00182 }
00183 if (!configParser_->getMENamesForBarrelSummary(barrel_structure_name, barrel_me_names)){
00184 cout << "SiPixelActionExecutor::createSummary: Failed to read Barrel Summary configuration parameters!! ";
00185 return;
00186 }
00187 configParser_->getSourceType(source_type_);
00188
00189 bei->setCurrentFolder("Pixel/");
00190
00191 fillSummary(bei, barrel_structure_name, barrel_me_names, true);
00192 bei->setCurrentFolder("Pixel/");
00193
00194 string endcap_structure_name;
00195 vector<string> endcap_me_names;
00196 if (!configParser_->getMENamesForEndcapSummary(endcap_structure_name, endcap_me_names)){
00197 edm::LogInfo("SiPixelActionExecutor") << "Failed to read Endcap Summary configuration parameters!! " << "\n" ;
00198 return;
00199 }
00200
00201
00202
00203 bei->setCurrentFolder("Pixel/");
00204
00205 fillSummary(bei, endcap_structure_name, endcap_me_names, false);
00206 bei->setCurrentFolder("Pixel/");
00207
00208 bei->setCurrentFolder("Pixel/");
00209
00210 if(source_type_==0||source_type_==5 || source_type_ == 20){
00211 string federror_structure_name;
00212 vector<string> federror_me_names;
00213 if (!configParser_->getMENamesForFEDErrorSummary(federror_structure_name, federror_me_names)){
00214 cout << "SiPixelActionExecutor::createSummary: Failed to read FED Error Summary configuration parameters!! ";
00215 return;
00216 }
00217 bei->setCurrentFolder("Pixel/");
00218
00219 fillFEDErrorSummary(bei, federror_structure_name, federror_me_names);
00220 bei->setCurrentFolder("Pixel/");
00221
00222 }
00223
00224
00225
00226 if (configWriter_) delete configWriter_;
00227 configWriter_ = 0;
00228
00229 }
00230
00231
00232 void SiPixelActionExecutor::bookDeviations(DQMStore* bei) {
00233 bei->cd();
00234 bei->setCurrentFolder("Pixel/Barrel");
00235 DEV_adc_Barrel = bei->book1D("DEV_adc_Barrel","Deviation from reference;Module;<adc_ref>-<adc>",768,0.,768.);
00236 DEV_ndigis_Barrel = bei->book1D("DEV_ndigis_Barrel","Deviation from reference;Module;<ndigis_ref>-<ndigis>",768,0.,768.);
00237 DEV_charge_Barrel = bei->book1D("DEV_charge_Barrel","Deviation from reference;Module;<charge_ref>-<charge>",768,0.,768.);
00238 DEV_nclusters_Barrel = bei->book1D("DEV_nclusters_Barrel","Deviation from reference;Module;<nclusters_ref>-<nclusters>",768,0.,768.);
00239 DEV_size_Barrel = bei->book1D("DEV_size_Barrel","Deviation from reference;Module;<size_ref>-<size>",768,0.,768.);
00240 bei->cd();
00241 bei->setCurrentFolder("Pixel/Endcap");
00242 DEV_adc_Endcap = bei->book1D("DEV_adc_Endcap","Deviation from reference;Module;<adc_ref>-<adc>",672,0.,672.);
00243 DEV_ndigis_Endcap = bei->book1D("DEV_ndigis_Endcap","Deviation from reference;Module;<ndigis_ref>-<ndigis>",672,0.,672.);
00244 DEV_charge_Endcap = bei->book1D("DEV_charge_Endcap","Deviation from reference;Module;<charge_ref>-<charge>",672,0.,672.);
00245 DEV_nclusters_Endcap = bei->book1D("DEV_nclusters_Endcap","Deviation from reference;Module;<nclusters_ref>-<nclusters>",672,0.,672.);
00246 DEV_size_Endcap = bei->book1D("DEV_size_Endcap","Deviation from reference;Module;<size_ref>-<size>",672,0.,672.);
00247 bei->cd();
00248 }
00249
00250
00251 void SiPixelActionExecutor::fillDeviations(DQMStore* bei) {
00252 int n = 768;
00253 MonitorElement* me1; MonitorElement* me2;
00254 MonitorElement* me3; MonitorElement* me4;
00255 MonitorElement* me5;
00256 TH1* ref1; TH1* ref2;
00257 TH1* ref3; TH1* ref4;
00258 TH1* ref5;
00259 MonitorElement* dev1; MonitorElement* dev2;
00260 MonitorElement* dev3; MonitorElement* dev4;
00261 MonitorElement* dev5;
00262 me1 = bei->get("Pixel/Barrel/SUMDIG_adc_Barrel");
00263 ref1 = me1->getRefTH1();
00264 dev1 = bei->get("Pixel/Barrel/DEV_adc_Barrel");
00265 me2 = bei->get("Pixel/Barrel/SUMDIG_ndigis_Barrel");
00266 ref2 = me2->getRefTH1();
00267 dev2 = bei->get("Pixel/Barrel/DEV_ndigis_Barrel");
00268 me3 = bei->get("Pixel/Barrel/SUMCLU_charge_Barrel");
00269 ref3 = me3->getRefTH1();
00270 dev3 = bei->get("Pixel/Barrel/DEV_charge_Barrel");
00271 me4 = bei->get("Pixel/Barrel/SUMCLU_nclusters_Barrel");
00272 ref4 = me4->getRefTH1();
00273 dev4 = bei->get("Pixel/Barrel/DEV_nclusters_Barrel");
00274 me5 = bei->get("Pixel/Barrel/SUMCLU_size_Barrel");
00275 ref5 = me5->getRefTH1();
00276 dev5 = bei->get("Pixel/Barrel/DEV_size_Barrel");
00277 for(int i=1; i!=n+1; i++){
00278 float ref_value; float new_value;
00279
00280 if(me1)if(ref1)if(dev1){
00281 new_value = me1->getBinContent(i);
00282 ref_value = ref1->GetBinContent(i);
00283 dev1->setBinContent(i,ref_value-new_value);
00284 }
00285
00286 if(me2)if(ref2)if(dev2){
00287 new_value = me2->getBinContent(i);
00288 ref_value = ref2->GetBinContent(i);
00289 dev2->setBinContent(i,ref_value-new_value);
00290 }
00291
00292 if(me3)if(ref3)if(dev3){
00293 new_value = me3->getBinContent(i);
00294 ref_value = ref3->GetBinContent(i);
00295 dev3->setBinContent(i,ref_value-new_value);
00296 }
00297
00298 if(me4)if(ref4)if(dev4){
00299 new_value = me4->getBinContent(i);
00300 ref_value = ref4->GetBinContent(i);
00301 dev4->setBinContent(i,ref_value-new_value);
00302 }
00303
00304 if(me5)if(ref5)if(dev5){
00305 new_value = me5->getBinContent(i);
00306 ref_value = ref5->GetBinContent(i);
00307 dev5->setBinContent(i,ref_value-new_value);
00308 }
00309 }
00310
00311 int nn = 672;
00312 MonitorElement* me11; MonitorElement* me12;
00313 MonitorElement* me13; MonitorElement* me14;
00314 MonitorElement* me15;
00315 TH1* ref11; TH1* ref12;
00316 TH1* ref13; TH1* ref14;
00317 TH1* ref15;
00318 MonitorElement* dev11; MonitorElement* dev12;
00319 MonitorElement* dev13; MonitorElement* dev14;
00320 MonitorElement* dev15;
00321 me11 = bei->get("Pixel/Endcap/SUMDIG_adc_Endcap");
00322 ref11 = me11->getRefTH1();
00323 dev11 = bei->get("Pixel/Endcap/DEV_adc_Endcap");
00324 me12 = bei->get("Pixel/Endcap/SUMDIG_ndigis_Endcap");
00325 ref12 = me12->getRefTH1();
00326 dev12 = bei->get("Pixel/Endcap/DEV_ndigis_Endcap");
00327 me13 = bei->get("Pixel/Endcap/SUMCLU_charge_Endcap");
00328 ref13 = me13->getRefTH1();
00329 dev13 = bei->get("Pixel/Endcap/DEV_charge_Endcap");
00330 me14 = bei->get("Pixel/Endcap/SUMCLU_nclusters_Endcap");
00331 ref14 = me14->getRefTH1();
00332 dev14 = bei->get("Pixel/Endcap/DEV_nclusters_Endcap");
00333 me15 = bei->get("Pixel/Endcap/SUMCLU_size_Endcap");
00334 ref15 = me15->getRefTH1();
00335 dev15 = bei->get("Pixel/Endcap/DEV_size_Endcap");
00336 for(int i=1; i!=nn+1; i++){
00337 float ref_value; float new_value;
00338
00339 if(me11)if(ref11)if(dev11){
00340 new_value = me11->getBinContent(i);
00341 ref_value = ref11->GetBinContent(i);
00342 dev11->setBinContent(i,ref_value-new_value);
00343 }
00344
00345 if(me12)if(ref12)if(dev12){
00346 new_value = me12->getBinContent(i);
00347 ref_value = ref12->GetBinContent(i);
00348 dev12->setBinContent(i,ref_value-new_value);
00349 }
00350
00351 if(me13)if(ref13)if(dev13){
00352 new_value = me13->getBinContent(i);
00353 ref_value = ref13->GetBinContent(i);
00354 dev13->setBinContent(i,ref_value-new_value);
00355 }
00356
00357 if(me14)if(ref14)if(dev14){
00358 new_value = me14->getBinContent(i);
00359 ref_value = ref14->GetBinContent(i);
00360 dev14->setBinContent(i,ref_value-new_value);
00361 }
00362
00363 if(me15)if(ref15)if(dev15){
00364 new_value = me15->getBinContent(i);
00365 ref_value = ref15->GetBinContent(i);
00366 dev15->setBinContent(i,ref_value-new_value);
00367 }
00368 }
00369 }
00370
00371
00372
00373 void SiPixelActionExecutor::GetBladeSubdirs(DQMStore* bei, vector<string>& blade_subdirs) {
00374 blade_subdirs.clear();
00375
00376 vector<string> panels = bei->getSubdirs();
00377 vector<string> modules;
00378 for (vector<string>::const_iterator it = panels.begin(); it != panels.end(); it++) {
00379 bei->cd(*it);
00380 modules = bei->getSubdirs();
00381 for (vector<string>::const_iterator m_it = modules.begin(); m_it != modules.end(); m_it++) {
00382
00383 blade_subdirs.push_back(*m_it);
00384 }
00385 }
00386
00387 }
00388
00389
00390
00391
00392 void SiPixelActionExecutor::fillSummary(DQMStore* bei, string dir_name, vector<string>& me_names, bool isbarrel)
00393 {
00394
00395
00396
00397 string currDir = bei->pwd();
00398
00399 string prefix;
00400 if(source_type_==0) prefix="SUMRAW";
00401 else if (source_type_==1) prefix="SUMDIG";
00402 else if (source_type_==2) prefix="SUMCLU";
00403 else if (source_type_==3) prefix="SUMTRK";
00404 else if (source_type_==4) prefix="SUMHIT";
00405 else if (source_type_>=7 && source_type_<20) prefix="SUMCAL";
00406 else if (source_type_==20) prefix="SUMOFF";
00407 if (currDir.find(dir_name) != string::npos) {
00408 vector<MonitorElement*> sum_mes;
00409 for (vector<string>::const_iterator iv = me_names.begin();
00410 iv != me_names.end(); iv++) {
00411 if(source_type_==5||source_type_==6){
00412 if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
00413 (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
00414 (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
00415 (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap")
00416 prefix="SUMRAW";
00417 else if((*iv)=="ndigis"||(*iv)=="adc")
00418 prefix="SUMDIG";
00419 else if((*iv)=="nclusters"||(*iv)=="x"||(*iv)=="y"||(*iv)=="charge"||
00420 (*iv)=="size"||(*iv)=="sizeX"||(*iv)=="sizeY"||(*iv)=="minrow"||
00421 (*iv)=="maxrow"||(*iv)=="mincol"||(*iv)=="maxcol")
00422 prefix="SUMCLU";
00423 if(currDir.find("Track")!=string::npos) prefix="SUMTRK";
00424 else if((*iv)=="residualX"||(*iv)=="residualY")
00425 prefix="SUMTRK";
00426 else if((*iv)=="ClustX"||(*iv)=="ClustY"||(*iv)=="nRecHits"||(*iv)=="ErrorX"||(*iv)=="ErrorY")
00427 prefix="SUMHIT";
00428 else if((*iv)=="Gain1d"||(*iv)=="GainChi2NDF1d"||
00429 (*iv)=="GainChi2Prob1d"||(*iv)=="Pedestal1d"||
00430 (*iv)=="GainNPoints1d"||(*iv)=="GainHighPoint1d"||
00431 (*iv)=="GainLowPoint1d"||(*iv)=="GainEndPoint1d"||
00432 (*iv)=="GainFitResult2d"||(*iv)=="GainDynamicRange2d"||
00433 (*iv)=="GainSaturate2d"||
00434 (*iv)=="ScurveChi2ProbSummary"||(*iv)=="ScurveFitResultSummary"||
00435 (*iv)=="ScurveSigmasSummary"||(*iv)=="ScurveThresholdSummary"||
00436 (*iv)=="pixelAliveSummary" || (*iv) == "SiPixelErrorsCalibDigis")
00437 prefix="SUMCAL";
00438 }
00439 MonitorElement* temp; string tag;
00440 if((*iv).find("residual")!=string::npos){
00441 tag = prefix + "_" + (*iv) + "_mean_"
00442 + currDir.substr(currDir.find(dir_name));
00443 temp = getSummaryME(bei, tag);
00444 sum_mes.push_back(temp);
00445 tag = prefix + "_" + (*iv) + "_RMS_"
00446 + currDir.substr(currDir.find(dir_name));
00447 temp = getSummaryME(bei, tag);
00448 sum_mes.push_back(temp);
00449 }else if(prefix == "SUMCAL"){
00450 if((*iv)=="Gain1d" || (*iv)=="GainChi2NDF1d" || (*iv)=="GainChi2Prob1d" ||
00451 (*iv)=="GainNPoints1d" || (*iv)=="GainHighPoint1d" ||
00452 (*iv)=="GainLowPoint1d" || (*iv)=="GainEndPoint1d" ||
00453 (*iv)=="GainDynamicRange2d" || (*iv)=="GainSaturate2d" ||
00454 (*iv)=="Pedestal1d" ||
00455 (*iv)=="ScurveChi2ProbSummary" || (*iv)=="ScurveFitResultSummary" ||
00456 (*iv)=="ScurveSigmasSummary" || (*iv)=="ScurveThresholdSummary"){
00457 tag = prefix + "_" + (*iv) + "_mean_"
00458 + currDir.substr(currDir.find(dir_name));
00459 temp = getSummaryME(bei, tag);
00460 sum_mes.push_back(temp);
00461 tag = prefix + "_" + (*iv) + "_RMS_"
00462 + currDir.substr(currDir.find(dir_name));
00463 temp = getSummaryME(bei, tag);
00464 sum_mes.push_back(temp);
00465 }else if((*iv) == "SiPixelErrorsCalibDigis"){
00466 tag = prefix + "_" + (*iv) + "_NCalibErrors_"
00467 + currDir.substr(currDir.find(dir_name));
00468 temp = getSummaryME(bei, tag);
00469 sum_mes.push_back(temp);
00470 }else if((*iv)=="GainFitResult2d"){
00471 tag = prefix + "_" + (*iv) + "_NNegativeFits_"
00472 + currDir.substr(currDir.find(dir_name));
00473 temp = getSummaryME(bei, tag);
00474 sum_mes.push_back(temp);
00475 }else if((*iv)=="pixelAliveSummary"){
00476 tag = prefix + "_" + (*iv) + "_FracOfPerfectPix_"
00477 + currDir.substr(currDir.find(dir_name));
00478 temp = getSummaryME(bei, tag);
00479 sum_mes.push_back(temp);
00480 tag = prefix + "_" + (*iv) + "_mean_"
00481 + currDir.substr(currDir.find(dir_name));
00482 temp = getSummaryME(bei, tag);
00483 sum_mes.push_back(temp);
00484 }
00485 }else{
00486 tag = prefix + "_" + (*iv) + "_" + currDir.substr(currDir.find(dir_name));
00487 temp = getSummaryME(bei, tag);
00488 sum_mes.push_back(temp);
00489 if((*iv)=="ndigis"){
00490 tag = prefix + "_" + (*iv) + "FREQ_"
00491 + currDir.substr(currDir.find(dir_name));
00492 temp = getSummaryME(bei, tag);
00493 sum_mes.push_back(temp);
00494 }
00495 if(prefix=="SUMDIG" && (*iv)=="adc"){
00496 tag = "ALLMODS_" + (*iv) + "COMB_" + currDir.substr(currDir.find(dir_name));
00497 temp = bei->book1D(tag.c_str(), tag.c_str(),128, 0., 256.);
00498 sum_mes.push_back(temp);
00499 }
00500 if(prefix=="SUMCLU" && (*iv)=="charge"){
00501 tag = "ALLMODS_" + (*iv) + "COMB_" + currDir.substr(currDir.find(dir_name));
00502 temp = bei->book1D(tag.c_str(), tag.c_str(),100, 0., 200.);
00503 sum_mes.push_back(temp);
00504 }
00505 }
00506 }
00507 if (sum_mes.size() == 0) {
00508 edm::LogInfo("SiPixelActionExecutor") << " Summary MEs can not be created" << "\n" ;
00509 return;
00510 }
00511 vector<string> subdirs = bei->getSubdirs();
00512
00513 if(dir_name.find("Blade_") == 0) GetBladeSubdirs(bei, subdirs);
00514
00515 int ndet = 0;
00516 for (vector<string>::const_iterator it = subdirs.begin();
00517 it != subdirs.end(); it++) {
00518 if (prefix!="SUMOFF" && (*it).find("Module_") == string::npos) continue;
00519 if (prefix=="SUMOFF" && (*it).find(isbarrel?"Layer_":"Disk_") == string::npos) continue;
00520 bei->cd(*it);
00521 ndet++;
00522
00523 vector<string> contents = bei->getMEs();
00524
00525 for (vector<MonitorElement*>::const_iterator isum = sum_mes.begin();
00526 isum != sum_mes.end(); isum++) {
00527 for (vector<string>::const_iterator im = contents.begin();
00528 im != contents.end(); im++) {
00529 string sname = ((*isum)->getName());
00530 string tname = " ";
00531 tname = sname.substr(7,(sname.find("_",7)-6));
00532 if(sname.find("ALLMODS_adcCOMB_")!=string::npos) tname = "adc_";
00533 if(sname.find("ALLMODS_chargeCOMB_")!=string::npos) tname = "charge_";
00534 if(sname.find("_charge_")!=string::npos && sname.find("Track_")==string::npos) tname = "charge_";
00535 if(sname.find("_nclusters_")!=string::npos && sname.find("Track_")==string::npos) tname = "nclusters_";
00536 if(sname.find("_size_")!=string::npos && sname.find("Track_")==string::npos) tname = "size_";
00537 if(sname.find("_charge_OffTrack_")!=string::npos) tname = "charge_OffTrack_";
00538 if(sname.find("_nclusters_OffTrack_")!=string::npos) tname = "nclusters_OffTrack_";
00539 if(sname.find("_size_OffTrack_")!=string::npos) tname = "size_OffTrack_";
00540 if(sname.find("_sizeX_OffTrack_")!=string::npos) tname = "sizeX_OffTrack_";
00541 if(sname.find("_sizeY_OffTrack_")!=string::npos) tname = "sizeY_OffTrack_";
00542 if(sname.find("_charge_OnTrack_")!=string::npos) tname = "charge_OnTrack_";
00543 if(sname.find("_nclusters_OnTrack_")!=string::npos) tname = "nclusters_OnTrack_";
00544 if(sname.find("_size_OnTrack_")!=string::npos) tname = "size_OnTrack_";
00545 if(sname.find("_sizeX_OnTrack_")!=string::npos) tname = "sizeX_OnTrack_";
00546 if(sname.find("_sizeY_OnTrack_")!=string::npos) tname = "sizeY_OnTrack_";
00547
00548 if(tname.find("FREQ")!=string::npos) tname = "ndigis_";
00549 if (((*im)).find(tname) == 0) {
00550 string fullpathname = bei->pwd() + "/" + (*im);
00551
00552 MonitorElement * me = bei->get(fullpathname);
00553
00554 if (me){
00555 if(sname.find("_charge")!=string::npos && sname.find("Track_")==string::npos && me->getName().find("Track_")!=string::npos) continue;
00556 if(sname.find("_nclusters_")!=string::npos && sname.find("Track_")==string::npos && me->getName().find("Track_")!=string::npos) continue;
00557 if(sname.find("_size")!=string::npos && sname.find("Track_")==string::npos && me->getName().find("Track_")!=string::npos) continue;
00558
00559
00560 if (sname.find("_RMS_")!=string::npos &&
00561 sname.find("GainDynamicRange2d")==string::npos &&
00562 sname.find("GainSaturate2d")==string::npos){
00563 (*isum)->Fill(ndet, me->getRMS());
00564 }else if (sname.find("GainDynamicRange2d")!=string::npos ||
00565 sname.find("GainSaturate2d")!=string::npos){
00566 float SumOfEntries=0.; float SumOfSquaredEntries=0.; int SumOfPixels=0;
00567 for(int cols=1; cols!=me->getNbinsX()+1; cols++) for(int rows=1; rows!=me->getNbinsY()+1; rows++){
00568 SumOfEntries+=me->getBinContent(cols,rows);
00569 SumOfSquaredEntries+=(me->getBinContent(cols,rows))*(me->getBinContent(cols,rows));
00570 SumOfPixels++;
00571 }
00572
00573 float MeanInZ = SumOfEntries / float(SumOfPixels);
00574 float RMSInZ = sqrt(SumOfSquaredEntries/float(SumOfPixels));
00575 if(sname.find("_mean_")!=string::npos) (*isum)->Fill(ndet, MeanInZ);
00576 if(sname.find("_RMS_")!=string::npos) (*isum)->Fill(ndet, RMSInZ);
00577 }else if (sname.find("_FracOfPerfectPix_")!=string::npos){
00578
00579 float nlast = me->getBinContent(me->getNbinsX());
00580 float nall = (me->getTH1F())->Integral(1,11);
00581
00582 (*isum)->Fill(ndet, nlast/nall);
00583 }else if (sname.find("_NCalibErrors_")!=string::npos ||
00584 sname.find("FREQ_")!=string::npos){
00585 float nall = me->getEntries();
00586 (*isum)->Fill(ndet, nall);
00587 }else if (sname.find("GainFitResult2d")!=string::npos){
00588 int NegFitPixels=0;
00589 for(int cols=1; cols!=me->getNbinsX()+1; cols++) for(int rows=1; rows!=me->getNbinsY()+1; rows++){
00590 if(me->getBinContent(cols,rows)<0.) NegFitPixels++;
00591 }
00592 (*isum)->Fill(ndet, float(NegFitPixels));
00593 }else if (sname.find("ALLMODS_adcCOMB_")!=string::npos ||
00594 (sname.find("ALLMODS_chargeCOMB_")!=string::npos && me->getName().find("Track_")==string::npos)){
00595 (*isum)->getTH1F()->Add(me->getTH1F());
00596 }else if (sname.find("_NErrors_")!=string::npos){
00597 string path1 = fullpathname;
00598 path1 = path1.replace(path1.find("NErrors"),7,"errorType");
00599 MonitorElement * me1 = bei->get(path1);
00600 bool notReset=true;
00601 if(me1){
00602 for(int jj=1; jj<16; jj++){
00603 if(me1->getBinContent(jj)>0.){
00604 if(jj==6){
00605 string path2 = path1;
00606 path2 = path2.replace(path2.find("errorType"),9,"TBMMessage");
00607 MonitorElement * me2 = bei->get(path2);
00608 if(me2) if(me2->getBinContent(6)>0. || me2->getBinContent(7)>0.) notReset=false;
00609 }
00610 }
00611 }
00612 }
00613 if(notReset) (*isum)->Fill(ndet, me1->getEntries());
00614 }else if ((sname.find("_charge_")!=string::npos && sname.find("Track_")==string::npos &&
00615 me->getName().find("Track_")==string::npos) ||
00616 (sname.find("_charge_")!=string::npos && sname.find("_OnTrack_")!=string::npos &&
00617 me->getName().find("_OnTrack_")!=string::npos) ||
00618 (sname.find("_charge_")!=string::npos && sname.find("_OffTrack_")!=string::npos &&
00619 me->getName().find("_OffTrack_")!=string::npos) ||
00620 (sname.find("_nclusters_")!=string::npos && sname.find("Track_")==string::npos &&
00621 me->getName().find("Track_")==string::npos) ||
00622 (sname.find("_nclusters_")!=string::npos && sname.find("_OnTrack_")!=string::npos &&
00623 me->getName().find("_OnTrack_")!=string::npos) ||
00624 (sname.find("_nclusters_")!=string::npos && sname.find("_OffTrack_")!=string::npos &&
00625 me->getName().find("_OffTrack_")!=string::npos) ||
00626 (sname.find("_size")!=string::npos && sname.find("Track_")==string::npos &&
00627 me->getName().find("Track_")==string::npos) ||
00628 (sname.find("_size")!=string::npos && sname.find("_OnTrack_")!=string::npos &&
00629 me->getName().find("_OnTrack_")!=string::npos) ||
00630 (sname.find("_size")!=string::npos && sname.find("_OffTrack_")!=string::npos &&
00631 me->getName().find("_OffTrack_")!=string::npos)){
00632 (*isum)->Fill(ndet, me->getMean());
00633 }else if(sname.find("_charge_")==string::npos && sname.find("_nclusters_")==string::npos && sname.find("_size")==string::npos){
00634 (*isum)->Fill(ndet, me->getMean());
00635
00636 }
00637
00638
00639 if(prefix=="SUMOFF"){
00640 (*isum)->setAxisTitle(isbarrel?"Ladders":"Blades",1);
00641 }else if(sname.find("ALLMODS_adcCOMB_")!=string::npos){
00642 (*isum)->setAxisTitle("Digi charge [ADC]",1);
00643 }else if(sname.find("ALLMODS_chargeCOMB_")!=string::npos){
00644 (*isum)->setAxisTitle("Cluster charge [kilo electrons]",1);
00645 }else{
00646 (*isum)->setAxisTitle("Modules",1);
00647 }
00648 string title = " ";
00649 if (sname.find("_RMS_")!=string::npos){
00650 title = "RMS of " + sname.substr(7,(sname.find("_",7)-7)) + " per module";
00651 }else if (sname.find("_FracOfPerfectPix_")!=string::npos){
00652 title = "FracOfPerfectPix " + sname.substr(7,(sname.find("_",7)-7)) + " per module";
00653 }else if(sname.find("_NCalibErrors_")!=string::npos){
00654 title = "Number of CalibErrors " + sname.substr(7,(sname.find("_",7)-7)) + " per module";
00655 }else if(sname.find("_NNegativeFits_")!=string::npos){
00656 title = "Number of pixels with neg. fit result " + sname.substr(7,(sname.find("_",7)-7)) + " per module";
00657 }else if (sname.find("FREQ_")!=string::npos){
00658 title = "NEvents with digis per module";
00659 }else if (sname.find("ALLMODS_adcCOMB_")!=string::npos){
00660 title = "NDigis";
00661 }else if (sname.find("ALLMODS_chargeCOMB_")!=string::npos){
00662 title = "NClusters";
00663 }else if (sname.find("_NErrors_")!=string::npos){
00664 if(prefix=="SUMOFF" && isbarrel) title = "Total number of errors per Ladder";
00665 else if(prefix=="SUMOFF" && !isbarrel) title = "Total number of errors per Blade";
00666 else title = "Total number of errors per Module";
00667 }else{
00668 if(prefix=="SUMOFF") title = "Mean " + sname.substr(7,(sname.find("_",7)-7)) + (isbarrel?" per Ladder":" per Blade");
00669 else title = "Mean " + sname.substr(7,(sname.find("_",7)-7)) + " per Module";
00670 }
00671 (*isum)->setAxisTitle(title,2);
00672 }
00673 break;
00674 }
00675 }
00676 }
00677 bei->goUp();
00678 if(dir_name.find("Blade") == 0) bei->goUp();
00679 }
00680 } else {
00681 vector<string> subdirs = bei->getSubdirs();
00682
00683 if(isbarrel)
00684 {
00685
00686 for (vector<string>::const_iterator it = subdirs.begin();
00687 it != subdirs.end(); it++) {
00688
00689 if((bei->pwd()).find("Endcap")!=string::npos ||
00690 (bei->pwd()).find("AdditionalPixelErrors")!=string::npos) bei->goUp();
00691 bei->cd(*it);
00692 if((*it).find("Endcap")!=string::npos ||
00693 (*it).find("AdditionalPixelErrors")!=string::npos) continue;
00694 fillSummary(bei, dir_name, me_names, true);
00695 bei->goUp();
00696 }
00697 string grandbarrel_structure_name;
00698 vector<string> grandbarrel_me_names;
00699 if (!configParser_->getMENamesForGrandBarrelSummary(grandbarrel_structure_name, grandbarrel_me_names)){
00700 cout << "SiPixelActionExecutor::createSummary: Failed to read Grand Barrel Summary configuration parameters!! ";
00701 return;
00702 }
00703 fillGrandBarrelSummaryHistos(bei, grandbarrel_me_names);
00704
00705 }
00706 else
00707 {
00708
00709 for (vector<string>::const_iterator it = subdirs.begin();
00710 it != subdirs.end(); it++) {
00711
00712 if((bei->pwd()).find("Barrel")!=string::npos ||
00713 (bei->pwd()).find("AdditionalPixelErrors")!=string::npos) bei->goUp();
00714 bei->cd((*it));
00715 if ((*it).find("Barrel")!=string::npos ||
00716 (*it).find("AdditionalPixelErrors")!=string::npos) continue;
00717 fillSummary(bei, dir_name, me_names, false);
00718 bei->goUp();
00719 }
00720 string grandendcap_structure_name;
00721 vector<string> grandendcap_me_names;
00722 if (!configParser_->getMENamesForGrandEndcapSummary(grandendcap_structure_name, grandendcap_me_names)){
00723 cout << "SiPixelActionExecutor::createSummary: Failed to read Grand Endcap Summary configuration parameters!! ";
00724 return;
00725 }
00726 fillGrandEndcapSummaryHistos(bei, grandendcap_me_names);
00727
00728
00729 }
00730 }
00731
00732
00733
00734
00735
00736 }
00737
00738
00739 void SiPixelActionExecutor::fillFEDErrorSummary(DQMStore* bei,
00740 string dir_name,
00741 vector<string>& me_names) {
00742
00743 string currDir = bei->pwd();
00744 string prefix;
00745 if(source_type_==0) prefix="SUMRAW";
00746 else if(source_type_==20) prefix="SUMOFF";
00747
00748 if (currDir.find(dir_name) != string::npos) {
00749 vector<MonitorElement*> sum_mes;
00750 for (vector<string>::const_iterator iv = me_names.begin();
00751 iv != me_names.end(); iv++) {
00752 bool isBooked = false;
00753 vector<string> contents = bei->getMEs();
00754 for (vector<string>::const_iterator im = contents.begin(); im != contents.end(); im++)
00755 if ((*im).find(*iv) != string::npos) isBooked = true;
00756 if(source_type_==5||source_type_==6){
00757 if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
00758 (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
00759 (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
00760 (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap"||
00761 (*iv)=="FedChLErrArray"||(*iv)=="FedChNErrArray"||(*iv)=="FedETypeNErrArray")
00762 prefix="SUMRAW";
00763 }
00764 if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
00765 (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
00766 (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
00767 (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap"){
00768 string tag = prefix + "_" + (*iv) + "_FEDErrors";
00769 MonitorElement* temp = getFEDSummaryME(bei, tag);
00770 sum_mes.push_back(temp);
00771 }else if((*iv)=="FedChLErrArray"||(*iv)=="FedChNErrArray"||(*iv)=="FedETypeNErrArray"){
00772 string tag = prefix + "_" + (*iv);
00773 MonitorElement* temp;
00774 if((*iv)=="FedChLErrArray") {if (!isBooked) temp = bei->book2D("FedChLErrArray","Type of last error",40,-0.5,39.5,37,0.,37.);
00775 else{
00776 string fullpathname = bei->pwd() + "/" + (*iv);
00777 temp = bei->get(fullpathname);
00778 temp->Reset();}}
00779 if((*iv)=="FedChNErrArray") {if (!isBooked) temp = bei->book2D("FedChNErrArray","Total number of errors",40,-0.5,39.5,37,0.,37.);
00780 else{
00781 string fullpathname = bei->pwd() + "/" + (*iv);
00782 temp = bei->get(fullpathname);
00783 temp->Reset();}}
00784 if((*iv)=="FedETypeNErrArray"){
00785 if(!isBooked){
00786 temp = bei->book2D("FedETypeNErrArray","Number of each error type",40,-0.5,39.5,21,0.,21.);
00787 temp->setBinLabel(1,"ROC of 25",2);
00788 temp->setBinLabel(2,"Gap word",2);
00789 temp->setBinLabel(3,"Dummy word",2);
00790 temp->setBinLabel(4,"FIFO full",2);
00791 temp->setBinLabel(5,"Timeout",2);
00792 temp->setBinLabel(6,"Stack full",2);
00793 temp->setBinLabel(7,"Pre-cal issued",2);
00794 temp->setBinLabel(8,"Trigger clear or sync",2);
00795 temp->setBinLabel(9,"No token bit",2);
00796 temp->setBinLabel(10,"Overflow",2);
00797 temp->setBinLabel(11,"FSM error",2);
00798 temp->setBinLabel(12,"Invalid #ROCs",2);
00799 temp->setBinLabel(13,"Event number",2);
00800 temp->setBinLabel(14,"Slink header",2);
00801 temp->setBinLabel(15,"Slink trailer",2);
00802 temp->setBinLabel(16,"Event size",2);
00803 temp->setBinLabel(17,"Invalid channel#",2);
00804 temp->setBinLabel(18,"ROC value",2);
00805 temp->setBinLabel(19,"Dcol or pixel value",2);
00806 temp->setBinLabel(20,"Readout order",2);
00807 temp->setBinLabel(21,"CRC error",2);
00808 }
00809 else{
00810 string fullpathname = bei->pwd() + "/" + (*iv);
00811 temp = bei->get(fullpathname);
00812 temp->Reset();}
00813 }
00814 sum_mes.push_back(temp);
00815 }
00816 }
00817 if (sum_mes.size() == 0) {
00818 edm::LogInfo("SiPixelActionExecutor") << " Summary MEs can not be created" << "\n" ;
00819 return;
00820 }
00821 vector<string> subdirs = bei->getSubdirs();
00822 int ndet = 0;
00823 for (vector<string>::const_iterator it = subdirs.begin();
00824 it != subdirs.end(); it++) {
00825 if ( (*it).find("FED_") == string::npos) continue;
00826 bei->cd(*it);
00827 string fedid = (*it).substr((*it).find("_")+1);
00828 std::istringstream isst;
00829 isst.str(fedid);
00830 isst>>ndet; ndet++;
00831 vector<string> contents = bei->getMEs();
00832
00833 for (vector<MonitorElement*>::const_iterator isum = sum_mes.begin();
00834 isum != sum_mes.end(); isum++) {
00835 for (vector<string>::const_iterator im = contents.begin();
00836 im != contents.end(); im++) {
00837 if(((*im).find("FedChNErrArray_")!=std::string::npos && (*isum)->getName().find("FedChNErrArray")!=std::string::npos) ||
00838 ((*im).find("FedChLErrArray_")!=std::string::npos && (*isum)->getName().find("FedChLErrArray")!=std::string::npos) ||
00839 ((*im).find("FedETypeNErrArray_")!=std::string::npos && (*isum)->getName().find("FedETypeNErrArray")!=std::string::npos)){
00840 string fullpathname = bei->pwd() + "/" + (*im);
00841 MonitorElement * me = bei->get(fullpathname);
00842 if(me && me->getIntValue()>0){
00843 for(int i=0; i!=37; i++){
00844 int n = (*im).find("_"); n++;
00845 string channel_str = (*im).substr(n);
00846 std::istringstream jsst;
00847 jsst.str(channel_str);
00848 int channel=-1;
00849 jsst>>channel;
00850 if(channel==i){
00851 if((*im).find("FedETypeNErrArray_")!=std::string::npos && i<21) (*isum)->Fill(ndet-1,i,me->getIntValue());
00852 else (*isum)->Fill(ndet-1,i,me->getIntValue());
00853 }
00854 }
00855 }
00856 }
00857 string sname = ((*isum)->getName());
00858 string tname = " ";
00859 tname = sname.substr(7,(sname.find("_",7)-6));
00860 if (((*im)).find(tname) == 0) {
00861 string fullpathname = bei->pwd() + "/" + (*im);
00862 MonitorElement * me = bei->get(fullpathname);
00863
00864 if (me){
00865 if(me->getMean()>0.){
00866 if (sname.find("_NErrors_")!=string::npos){
00867 string path1 = fullpathname;
00868 path1 = path1.replace(path1.find("NErrors"),7,"errorType");
00869 MonitorElement * me1 = bei->get(path1);
00870 bool notReset=true;
00871 if(me1){
00872 for(int jj=1; jj<16; jj++){
00873 if(me1->getBinContent(jj)>0.){
00874 if(jj==6){
00875 string path2 = path1;
00876 path2 = path2.replace(path2.find("errorType"),9,"TBMMessage");
00877 MonitorElement * me2 = bei->get(path2);
00878 if(me2) if(me2->getBinContent(6)>0. || me2->getBinContent(7)>0.) notReset=false;
00879 }
00880 }
00881 }
00882 }
00883 if(notReset) (*isum)->setBinContent(ndet, (*isum)->getBinContent(ndet) + me1->getEntries());
00884 }else (*isum)->setBinContent(ndet, (*isum)->getBinContent(ndet) + me->getEntries());
00885 }
00886 (*isum)->setAxisTitle("FED #",1);
00887 string title = " ";
00888 title = sname.substr(7,(sname.find("_",7)-7)) + " per FED";
00889 (*isum)->setAxisTitle(title,2);
00890 }
00891 break;
00892 }
00893 }
00894 }
00895 bei->goUp();
00896 }
00897 } else {
00898 vector<string> subdirs = bei->getSubdirs();
00899 for (vector<string>::const_iterator it = subdirs.begin();
00900 it != subdirs.end(); it++) {
00901 if((*it).find("Endcap")!=string::npos ||
00902 (*it).find("Barrel")!=string::npos) continue;
00903 bei->cd(*it);
00904 fillFEDErrorSummary(bei, dir_name, me_names);
00905 bei->goUp();
00906 }
00907 }
00908
00909 }
00910
00911
00912
00913 void SiPixelActionExecutor::fillGrandBarrelSummaryHistos(DQMStore* bei,
00914 vector<string>& me_names) {
00915
00916 vector<MonitorElement*> gsum_mes;
00917 string currDir = bei->pwd();
00918 string path_name = bei->pwd();
00919 string dir_name = path_name.substr(path_name.find_last_of("/")+1);
00920
00921 if ((dir_name.find("DQMData") == 0) ||
00922 (dir_name.find("Pixel") == 0) ||
00923 (dir_name.find("AdditionalPixelErrors") == 0) ||
00924 (dir_name.find("Endcap") == 0) ||
00925 (dir_name.find("HalfCylinder") == 0) ||
00926 (dir_name.find("Disk") == 0) ||
00927 (dir_name.find("Blade") == 0) ||
00928 (dir_name.find("Panel") == 0) ) return;
00929 vector<string> subdirs = bei->getSubdirs();
00930 int nDirs = subdirs.size();
00931 int iDir =0;
00932 int nbin = 0;
00933 int nbin_i = 0;
00934 int nbin_subdir = 0;
00935 int cnt=0;
00936 bool first_subdir = true;
00937 for (vector<string>::const_iterator it = subdirs.begin();
00938 it != subdirs.end(); it++) {
00939 cnt++;
00940 bei->cd(*it);
00941
00942 vector<string> contents = bei->getMEs();
00943
00944 bei->goUp();
00945
00946 string prefix;
00947 if(source_type_==0) prefix="SUMRAW";
00948 else if (source_type_==1) prefix="SUMDIG";
00949 else if (source_type_==2) prefix="SUMCLU";
00950 else if (source_type_==3) prefix="SUMTRK";
00951 else if (source_type_==4) prefix="SUMHIT";
00952 else if (source_type_>=7 && source_type_<20) prefix="SUMCAL";
00953 else if (source_type_==20) prefix="SUMOFF";
00954
00955
00956 for (vector<string>::const_iterator im = contents.begin();
00957 im != contents.end(); im++) {
00958
00959 for (vector<string>::const_iterator iv = me_names.begin();
00960 iv != me_names.end(); iv++) {
00961 string var = "_" + (*iv) + "_";
00962
00963 if ((*im).find(var) != string::npos) {
00964 if((var=="_charge_" || var=="_nclusters_" || var=="_size_" || var=="_sizeX_" || var=="_sizeY_") &&
00965 (*im).find("Track_")!=string::npos) continue;
00966
00967 string full_path = (*it) + "/" +(*im);
00968 MonitorElement * me = bei->get(full_path.c_str());
00969 if (!me) continue;
00970 if(source_type_==5||source_type_==6){
00971 if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
00972 (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
00973 (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
00974 (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap")
00975 prefix="SUMRAW";
00976 else if((*iv)=="ndigis"||(*iv)=="adc" ||
00977 (*iv)=="ndigisFREQ" || (*iv)=="adcCOMB")
00978 prefix="SUMDIG";
00979 else if((*iv)=="nclusters"||(*iv)=="x"||(*iv)=="y"||(*iv)=="charge"||(*iv)=="chargeCOMB"||
00980 (*iv)=="size"||(*iv)=="sizeX"||(*iv)=="sizeY"||(*iv)=="minrow"||
00981 (*iv)=="maxrow"||(*iv)=="mincol"||(*iv)=="maxcol")
00982 prefix="SUMCLU";
00983 if(currDir.find("Track")!=string::npos) prefix="SUMTRK";
00984 else if((*iv)=="residualX_mean"||(*iv)=="residualY_mean"||
00985 (*iv)=="residualX_RMS"||(*iv)=="residualY_RMS")
00986 prefix="SUMTRK";
00987 else if((*iv)=="ClustX"||(*iv)=="ClustY"||(*iv)=="nRecHits"||(*iv)=="ErrorX"||(*iv)=="ErrorY")
00988 prefix="SUMHIT";
00989 else if((*iv)=="Gain1d_mean"||(*iv)=="GainChi2NDF1d_mean"||
00990 (*iv)=="GainChi2Prob1d_mean"||(*iv)=="Pedestal1d_mean"||
00991 (*iv)=="ScurveChi2ProbSummary_mean"||(*iv)=="ScurveFitResultSummary_mean"||
00992 (*iv)=="ScurveSigmasSummary_mean"||(*iv)=="ScurveThresholdSummary_mean"||
00993 (*iv)=="Gain1d_RMS"||(*iv)=="GainChi2NDF1d_RMS"||
00994 (*iv)=="GainChi2Prob1d_RMS"||(*iv)=="Pedestal1d_RMS"||
00995 (*iv)=="GainNPoints1d_mean" || (*iv)=="GainNPoints1d_RMS" ||
00996 (*iv)=="GainHighPoint1d_mean" || (*iv)=="GainHighPoint1d_RMS" ||
00997 (*iv)=="GainLowPoint1d_mean" || (*iv)=="GainLowPoint1d_RMS" ||
00998 (*iv)=="GainEndPoint1d_mean" || (*iv)=="GainEndPoint1d_RMS" ||
00999 (*iv)=="GainFitResult2d_mean" || (*iv)=="GainFitResult2d_RMS" ||
01000 (*iv)=="GainDynamicRange2d_mean" || (*iv)=="GainDynamicRange2d_RMS" ||
01001 (*iv)=="GainSaturate2d_mean" || (*iv)=="GainSaturate2d_RMS" ||
01002 (*iv)=="ScurveChi2ProbSummary_RMS"||(*iv)=="ScurveFitResultSummary_RMS"||
01003 (*iv)=="ScurveSigmasSummary_RMS"||(*iv)=="ScurveThresholdSummary_RMS"||
01004 (*iv)=="pixelAliveSummary_mean"||(*iv)=="pixelAliveSummary_FracOfPerfectPix" ||
01005 (*iv)=="SiPixelErrorsCalibDigis_NCalibErrors" )
01006 prefix="SUMCAL";
01007 }
01008
01009
01010
01011
01012
01013
01014
01015 if (first_subdir){
01016
01017 nbin = me->getTH1F()->GetNbinsX();
01018 string me_name = prefix + "_" + (*iv) + "_" + dir_name;
01019 if((*iv)=="adcCOMB"||(*iv)=="chargeCOMB") me_name = "ALLMODS_" + (*iv) + "_" + dir_name;
01020 else if(prefix=="SUMOFF" && dir_name=="Barrel") nbin=192;
01021 else if((*iv)=="adcCOMB") nbin=256;
01022 else if(dir_name=="Barrel") nbin=768;
01023 else if(prefix=="SUMOFF" && dir_name.find("Shell")!=string::npos) nbin=48;
01024 else if(dir_name.find("Shell")!=string::npos) nbin=192;
01025 else nbin=nbin*nDirs;
01026
01027 getGrandSummaryME(bei, nbin, me_name, gsum_mes);
01028 }
01029
01030
01031
01032
01033
01034
01035
01036
01037
01038
01039
01040
01041
01042
01043 for (vector<MonitorElement*>::const_iterator igm = gsum_mes.begin();
01044 igm != gsum_mes.end(); igm++) {
01045
01046 if ((*igm)->getName().find(var) != string::npos) {
01047
01048 if(prefix=="SUMOFF") (*igm)->setAxisTitle("Ladders",1);
01049 else if((*igm)->getName().find("adcCOMB_")!=string::npos) (*igm)->setAxisTitle("Digi charge [ADC]",1);
01050 else if((*igm)->getName().find("chargeCOMB_")!=string::npos) (*igm)->setAxisTitle("Cluster charge [kilo electrons]",1);
01051 else (*igm)->setAxisTitle("Modules",1);
01052
01053
01054
01055 string title="";
01056 if((*igm)->getName().find("NErrors_") != string::npos && prefix=="SUMOFF") title = "Total number of errors per Ladder";
01057 else if((*igm)->getName().find("NErrors_") != string::npos && prefix=="SUMRAW") title = "Total number of errors per Module";
01058 else if(prefix=="SUMOFF") title = "mean " + (*iv) + " per Ladder";
01059 else if((*igm)->getName().find("FREQ_") != string::npos && prefix!="SUMOFF") title = "NEvents with digis per Module";
01060 else if((*igm)->getName().find("FREQ_") != string::npos && prefix=="SUMOFF") title = "NEvents with digis per Ladder/Blade";
01061 else if((*igm)->getName().find("adcCOMB_") != string::npos) title = "NDigis";
01062 else if((*igm)->getName().find("chargeCOMB_") != string::npos) title = "NClusters";
01063 else title = "mean " + (*iv) + " per Module";
01064 (*igm)->setAxisTitle(title,2);
01065
01066
01067
01068 if((*igm)->getName().find("ALLMODS_adcCOMB_")!=string::npos){
01069 nbin_subdir=128;
01070 }else if((*igm)->getName().find("ALLMODS_chargeCOMB_")!=string::npos){
01071 nbin_subdir=100;
01072 }else if((*igm)->getName().find("Ladder") != string::npos){
01073 nbin_i=0; nbin_subdir=4;
01074 }else if((*igm)->getName().find("Layer") != string::npos){
01075 nbin_i=(cnt-1)*4; nbin_subdir=4;
01076 }else if((*igm)->getName().find("Shell") != string::npos){
01077 if(prefix!="SUMOFF"){
01078 if(iDir==0){ nbin_i=0; nbin_subdir=40; }
01079 else if(iDir==1){ nbin_i=40; nbin_subdir=64; }
01080 else if(iDir==2){ nbin_i=104; nbin_subdir=88; }
01081 }else{
01082 if(iDir==0){ nbin_i=0; nbin_subdir=10; }
01083 else if(iDir==1){ nbin_i=10; nbin_subdir=16; }
01084 else if(iDir==2){ nbin_i=26; nbin_subdir=22; }
01085 }
01086 }else if((*igm)->getName().find("Barrel") != string::npos){
01087 if(prefix!="SUMOFF"){
01088 if(iDir==0){ nbin_i=0; nbin_subdir=192; }
01089 else if(iDir==1){ nbin_i=192; nbin_subdir=192; }
01090 else if(iDir==2){ nbin_i=384; nbin_subdir=192; }
01091 else if(iDir==3){ nbin_i=576; nbin_subdir=192; }
01092 }else{
01093 if(iDir==0){ nbin_i=0; nbin_subdir=48; }
01094 else if(iDir==1){ nbin_i=48; nbin_subdir=48; }
01095 else if(iDir==2){ nbin_i=96; nbin_subdir=48; }
01096 else if(iDir==3){ nbin_i=144; nbin_subdir=48; }
01097 }
01098 }
01099
01100
01101 if((*igm)->getName().find("ndigisFREQ")==string::npos)
01102 {
01103 if(((*igm)->getName().find("adcCOMB")!=string::npos && me->getName().find("adcCOMB")!=string::npos)
01104 || ((*igm)->getName().find("chargeCOMB")!=string::npos && me->getName().find("chargeCOMB")!=string::npos))
01105 {
01106 (*igm)->getTH1F()->Add(me->getTH1F());
01107 }else if(((*igm)->getName().find("charge_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
01108 me->getName().find("charge_")!=string::npos && me->getName().find("Track_")==string::npos) ||
01109 ((*igm)->getName().find("nclusters_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
01110 me->getName().find("nclusters_")!=string::npos && me->getName().find("Track_")==string::npos) ||
01111 ((*igm)->getName().find("size_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
01112 me->getName().find("size_")!=string::npos && me->getName().find("Track_")==string::npos) ||
01113 ((*igm)->getName().find("charge_OffTrack_")!=string::npos && me->getName().find("charge_OffTrack_")!=string::npos) ||
01114 ((*igm)->getName().find("nclusters_OffTrack_")!=string::npos && me->getName().find("nclusters_OffTrack_")!=string::npos) ||
01115 ((*igm)->getName().find("size_OffTrack_")!=string::npos && me->getName().find("size_OffTrack_")!=string::npos) ||
01116 ((*igm)->getName().find("charge_OnTrack_")!=string::npos && me->getName().find("charge_OnTrack_")!=string::npos) ||
01117 ((*igm)->getName().find("nclusters_OnTrack_")!=string::npos && me->getName().find("nclusters_OnTrack_")!=string::npos) ||
01118 ((*igm)->getName().find("size_OnTrack_")!=string::npos && me->getName().find("size_OnTrack_")!=string::npos) ||
01119 ((*igm)->getName().find("charge_")==string::npos && (*igm)->getName().find("nclusters_")==string::npos &&
01120 (*igm)->getName().find("size_")==string::npos)){
01121 for (int k = 1; k < nbin_subdir+1; k++) if(me->getBinContent(k) > 0) (*igm)->setBinContent(k+nbin_i, me->getBinContent(k));
01122 }
01123 }
01124 else if(me->getName().find("ndigisFREQ")!=string::npos)
01125 {
01126 for (int k = 1; k < nbin_subdir+1; k++) if(me->getBinContent(k) > 0) (*igm)->setBinContent(k+nbin_i, me->getBinContent(k));
01127 }
01128 }
01129 }
01130 }
01131 }
01132 }
01133 iDir++;
01134 first_subdir = false;
01135 }
01136
01137 }
01138
01139
01140 void SiPixelActionExecutor::fillGrandEndcapSummaryHistos(DQMStore* bei,
01141 vector<string>& me_names) {
01142
01143 vector<MonitorElement*> gsum_mes;
01144 string currDir = bei->pwd();
01145 string path_name = bei->pwd();
01146 string dir_name = path_name.substr(path_name.find_last_of("/")+1);
01147 if ((dir_name.find("DQMData") == 0) ||
01148 (dir_name.find("Pixel") == 0) ||
01149 (dir_name.find("AdditionalPixelErrors") == 0) ||
01150 (dir_name.find("Barrel") == 0) ||
01151 (dir_name.find("Shell") == 0) ||
01152 (dir_name.find("Layer") == 0) ||
01153 (dir_name.find("Ladder") == 0) ) return;
01154 vector<string> subdirs = bei->getSubdirs();
01155 int iDir =0;
01156 int nbin = 0;
01157 int nbin_i = 0;
01158 int nbin_subdir = 0;
01159 int cnt=0;
01160 bool first_subdir = true;
01161 for (vector<string>::const_iterator it = subdirs.begin();
01162 it != subdirs.end(); it++) {
01163 cnt++;
01164 bei->cd(*it);
01165 vector<string> contents = bei->getMEs();
01166 bei->goUp();
01167
01168 string prefix;
01169 if(source_type_==0) prefix="SUMRAW";
01170 else if (source_type_==1) prefix="SUMDIG";
01171 else if (source_type_==2) prefix="SUMCLU";
01172 else if (source_type_==3) prefix="SUMTRK";
01173 else if (source_type_==4) prefix="SUMHIT";
01174 else if (source_type_>=7 && source_type_<20) prefix="SUMCAL";
01175 else if (source_type_==20) prefix="SUMOFF";
01176
01177 for (vector<string>::const_iterator im = contents.begin();
01178 im != contents.end(); im++) {
01179 for (vector<string>::const_iterator iv = me_names.begin();
01180 iv != me_names.end(); iv++) {
01181 string var = "_" + (*iv) + "_";
01182 if ((*im).find(var) != string::npos) {
01183 if((var=="_charge_" || var=="_nclusters_" || var=="_size_" || var=="_sizeX_" || var=="_sizeY_") &&
01184 (*im).find("Track_")!=string::npos) continue;
01185 string full_path = (*it) + "/" +(*im);
01186 MonitorElement * me = bei->get(full_path.c_str());
01187 if (!me) continue;
01188 if(source_type_==5||source_type_==6){
01189 if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
01190 (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
01191 (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
01192 (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap")
01193 prefix="SUMRAW";
01194 else if((*iv)=="ndigis"||(*iv)=="adc" ||
01195 (*iv)=="ndigisFREQ"||(*iv)=="adcCOMB")
01196 prefix="SUMDIG";
01197 else if((*iv)=="nclusters"||(*iv)=="x"||(*iv)=="y"||(*iv)=="charge"||(*iv)=="chargeCOMB"||
01198 (*iv)=="size"||(*iv)=="sizeX"||(*iv)=="sizeY"||(*iv)=="minrow"||
01199 (*iv)=="maxrow"||(*iv)=="mincol"||(*iv)=="maxcol")
01200 prefix="SUMCLU";
01201 if(currDir.find("Track")!=string::npos) prefix="SUMTRK";
01202 else if((*iv)=="residualX_mean"||(*iv)=="residualY_mean"||
01203 (*iv)=="residualX_RMS"||(*iv)=="residualY_RMS")
01204 prefix="SUMTRK";
01205 else if((*iv)=="ClustX"||(*iv)=="ClustY"||(*iv)=="nRecHits"||(*iv)=="ErrorX"||(*iv)=="ErrorY")
01206 prefix="SUMHIT";
01207 else if((*iv)=="Gain1d_mean"||(*iv)=="GainChi2NDF1d_mean"||
01208 (*iv)=="GainChi2Prob1d_mean"||(*iv)=="Pedestal1d_mean"||
01209 (*iv)=="ScurveChi2ProbSummary_mean"||(*iv)=="ScurveFitResultSummary_mean"||
01210 (*iv)=="ScurveSigmasSummary_mean"||(*iv)=="ScurveThresholdSummary_mean"||
01211 (*iv)=="Gain1d_RMS"||(*iv)=="GainChi2NDF1d_RMS"||
01212 (*iv)=="GainChi2Prob1d_RMS"||(*iv)=="Pedestal1d_RMS"||
01213 (*iv)=="GainNPoints1d_mean" || (*iv)=="GainNPoints1d_RMS" ||
01214 (*iv)=="GainHighPoint1d_mean" || (*iv)=="GainHighPoint1d_RMS" ||
01215 (*iv)=="GainLowPoint1d_mean" || (*iv)=="GainLowPoint1d_RMS" ||
01216 (*iv)=="GainEndPoint1d_mean" || (*iv)=="GainEndPoint1d_RMS" ||
01217 (*iv)=="GainFitResult2d_mean" || (*iv)=="GainFitResult2d_RMS" ||
01218 (*iv)=="GainDynamicRange2d_mean" || (*iv)=="GainDynamicRange2d_RMS" ||
01219 (*iv)=="GainSaturate2d_mean" || (*iv)=="GainSaturate2d_RMS" ||
01220 (*iv)=="ScurveChi2ProbSummary_RMS"||(*iv)=="ScurveFitResultSummary_RMS"||
01221 (*iv)=="ScurveSigmasSummary_RMS"||(*iv)=="ScurveThresholdSummary_RMS"||
01222 (*iv)=="pixelAliveSummary_mean"||(*iv)=="pixelAliveSummary_FracOfPerfectPix"||
01223 (*iv) == "SiPixelErrorsCalibDigis_NCalibErrors")
01224 prefix="SUMCAL";
01225 }
01226
01227
01228
01229
01230
01231
01232 if (first_subdir){
01233
01234 nbin = me->getTH1F()->GetNbinsX();
01235 string me_name = prefix + "_" + (*iv) + "_" + dir_name;
01236 if((*iv)=="adcCOMB"||(*iv)=="chargeCOMB") me_name = "ALLMODS_" + (*iv) + "_" + dir_name;
01237 else if(prefix=="SUMOFF" && dir_name=="Endcap") nbin=96;
01238 else if(dir_name=="Endcap") nbin=672;
01239 else if(prefix=="SUMOFF" && dir_name.find("HalfCylinder")!=string::npos) nbin=24;
01240 else if(dir_name.find("HalfCylinder")!=string::npos) nbin=168;
01241 else if(prefix=="SUMOFF" && dir_name.find("Disk")!=string::npos) nbin=12;
01242 else if(dir_name.find("Disk")!=string::npos) nbin=84;
01243 else if(dir_name.find("Blade")!=string::npos) nbin=7;
01244
01245
01246
01247 getGrandSummaryME(bei, nbin, me_name, gsum_mes);
01248 }
01249
01250
01251
01252
01253
01254
01255
01256
01257
01258
01259
01260
01261
01262
01263 for (vector<MonitorElement*>::const_iterator igm = gsum_mes.begin();
01264 igm != gsum_mes.end(); igm++) {
01265 if ((*igm)->getName().find(var) != string::npos) {
01266 if(prefix=="SUMOFF") (*igm)->setAxisTitle("Blades",1);
01267 else if((*igm)->getName().find("adcCOMB_")!=string::npos) (*igm)->setAxisTitle("Digi charge [ADC]",1);
01268 else if((*igm)->getName().find("chargeCOMB_")!=string::npos) (*igm)->setAxisTitle("Cluster charge [kilo electrons]",1);
01269 else (*igm)->setAxisTitle("Modules",1);
01270 string title="";
01271 if((*igm)->getName().find("NErrors_") != string::npos && prefix=="SUMOFF") title = "Total number of errors per Blade";
01272 else if((*igm)->getName().find("NErrors_") != string::npos && prefix=="SUMRAW") title = "Total number of errors per Module";
01273 else if(prefix=="SUMOFF") title = "mean " + (*iv) + " per Blade";
01274 else if((*igm)->getName().find("FREQ_") != string::npos) title = "NEvents with digis per Module";
01275 else if((*igm)->getName().find("adcCOMB_")!=string::npos) title = "NDigis";
01276 else if((*igm)->getName().find("chargeCOMB_")!=string::npos) title = "NClusters";
01277 else title = "mean " + (*iv) + " per Module";
01278 (*igm)->setAxisTitle(title,2);
01279 nbin_i=0;
01280 if((*igm)->getName().find("ALLMODS_adcCOMB_")!=string::npos){
01281 nbin_subdir=128;
01282 }else if((*igm)->getName().find("ALLMODS_chargeCOMB_")!=string::npos){
01283 nbin_subdir=100;
01284 }else if((*igm)->getName().find("Panel_") != string::npos){
01285 nbin_subdir=7;
01286
01287
01288
01289
01290 }else if((*igm)->getName().find("Blade") != string::npos){
01291 if((*im).find("_1") != string::npos) nbin_subdir=4;
01292 if((*im).find("_2") != string::npos) {nbin_i=4; nbin_subdir=3;}
01293 }else if((*igm)->getName().find("Disk") != string::npos){
01294 nbin_i=((cnt-1)%12)*7; nbin_subdir=7;
01295 }else if((*igm)->getName().find("HalfCylinder") != string::npos){
01296 if(prefix!="SUMOFF"){
01297 nbin_subdir=84;
01298 if((*im).find("_2") != string::npos) nbin_i=84;
01299 }else{
01300 nbin_subdir=12;
01301 if((*im).find("_2") != string::npos) nbin_i=12;
01302 }
01303 }else if((*igm)->getName().find("Endcap") != string::npos){
01304 if(prefix!="SUMOFF"){
01305 nbin_subdir=168;
01306 if((*im).find("_mO") != string::npos) nbin_i=168;
01307 if((*im).find("_pI") != string::npos) nbin_i=336;
01308 if((*im).find("_pO") != string::npos) nbin_i=504;
01309 }else{
01310 nbin_subdir=24;
01311 if((*im).find("_mO") != string::npos) nbin_i=24;
01312 if((*im).find("_pI") != string::npos) nbin_i=48;
01313 if((*im).find("_pO") != string::npos) nbin_i=72;
01314 }
01315 }
01316
01317
01318 if((*igm)->getName().find("ndigisFREQ")==string::npos){
01319 if(((*igm)->getName().find("adcCOMB")!=string::npos && me->getName().find("adcCOMB")!=string::npos) || ((*igm)->getName().find("chargeCOMB")!=string::npos && me->getName().find("chargeCOMB")!=string::npos)){
01320 (*igm)->getTH1F()->Add(me->getTH1F());
01321 }else if(((*igm)->getName().find("charge_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
01322 me->getName().find("charge_")!=string::npos && me->getName().find("Track_")==string::npos) ||
01323 ((*igm)->getName().find("nclusters_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
01324 me->getName().find("nclusters_")!=string::npos && me->getName().find("Track_")==string::npos) ||
01325 ((*igm)->getName().find("size_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
01326 me->getName().find("size_")!=string::npos && me->getName().find("Track_")==string::npos) ||
01327 ((*igm)->getName().find("charge_OffTrack_")!=string::npos && me->getName().find("charge_OffTrack_")!=string::npos) ||
01328 ((*igm)->getName().find("nclusters_OffTrack_")!=string::npos && me->getName().find("nclusters_OffTrack_")!=string::npos) ||
01329 ((*igm)->getName().find("size_OffTrack_")!=string::npos && me->getName().find("size_OffTrack_")!=string::npos) ||
01330 ((*igm)->getName().find("charge_OnTrack_")!=string::npos && me->getName().find("charge_OnTrack_")!=string::npos) ||
01331 ((*igm)->getName().find("nclusters_OnTrack_")!=string::npos && me->getName().find("nclusters_OnTrack_")!=string::npos) ||
01332 ((*igm)->getName().find("size_OnTrack_")!=string::npos && me->getName().find("size_OnTrack_")!=string::npos) ||
01333 ((*igm)->getName().find("charge_")==string::npos && (*igm)->getName().find("nclusters_")==string::npos &&
01334 (*igm)->getName().find("size_")==string::npos)){
01335 for (int k = 1; k < nbin_subdir+1; k++) if(me->getBinContent(k) > 0) (*igm)->setBinContent(k+nbin_i, me->getBinContent(k));
01336 }
01337 }else if(me->getName().find("ndigisFREQ")!=string::npos){
01338 for (int k = 1; k < nbin_subdir+1; k++) if(me->getBinContent(k) > 0) (*igm)->setBinContent(k+nbin_i, me->getBinContent(k));
01339 }
01340
01341
01342 }
01343 }
01344 }
01345 }
01346 }
01347
01348 iDir++;
01349 first_subdir = false;
01350 }
01351 }
01352
01353
01354
01355
01356 void SiPixelActionExecutor::getGrandSummaryME(DQMStore* bei,
01357 int nbin,
01358 string& me_name,
01359 vector<MonitorElement*> & mes) {
01360
01361 if((bei->pwd()).find("Pixel")==string::npos) return;
01362 vector<string> contents = bei->getMEs();
01363
01364 for (vector<string>::const_iterator it = contents.begin();
01365 it != contents.end(); it++) {
01366
01367 if ((*it).find(me_name) == 0) {
01368 string fullpathname = bei->pwd() + "/" + me_name;
01369
01370 MonitorElement* me = bei->get(fullpathname);
01371
01372 if (me) {
01373
01374 me->Reset();
01375 mes.push_back(me);
01376
01377 return;
01378 }
01379 }
01380 }
01381
01382
01383
01384 MonitorElement* temp_me(0);
01385 if(me_name.find("ALLMODS_adcCOMB_")!=string::npos) temp_me = bei->book1D(me_name.c_str(),me_name.c_str(),128,0,256);
01386 else if(me_name.find("ALLMODS_chargeCOMB_")!=string::npos) temp_me = bei->book1D(me_name.c_str(),me_name.c_str(),100,0,200);
01387 else temp_me = bei->book1D(me_name.c_str(),me_name.c_str(),nbin,1.,nbin+1.);
01388 if (temp_me) mes.push_back(temp_me);
01389
01390
01391 }
01392
01393
01394
01395
01396
01397
01398 MonitorElement* SiPixelActionExecutor::getSummaryME(DQMStore* bei,
01399 string me_name) {
01400
01401 MonitorElement* me = 0;
01402 if((bei->pwd()).find("Pixel")==string::npos) return me;
01403 vector<string> contents = bei->getMEs();
01404
01405 for (vector<string>::const_iterator it = contents.begin();
01406 it != contents.end(); it++) {
01407 if ((*it).find(me_name) == 0) {
01408 string fullpathname = bei->pwd() + "/" + (*it);
01409 me = bei->get(fullpathname);
01410
01411 if (me) {
01412
01413 me->Reset();
01414 return me;
01415 }
01416 }
01417 }
01418 contents.clear();
01419
01420
01421
01422
01423
01424
01425
01426
01427 if(me_name.find("SUMOFF")==string::npos){
01428 if(me_name.find("Blade_")!=string::npos)me = bei->book1D(me_name.c_str(), me_name.c_str(),7,1.,8.);
01429 else me = bei->book1D(me_name.c_str(), me_name.c_str(),4,1.,5.);
01430
01431
01432 }else if(me_name.find("Layer_1")!=string::npos){ me = bei->book1D(me_name.c_str(), me_name.c_str(),10,1.,11.);
01433 }else if(me_name.find("Layer_2")!=string::npos){ me = bei->book1D(me_name.c_str(), me_name.c_str(),16,1.,17.);
01434 }else if(me_name.find("Layer_3")!=string::npos){ me = bei->book1D(me_name.c_str(), me_name.c_str(),22,1.,23.);
01435 }else if(me_name.find("Disk_")!=string::npos){ me = bei->book1D(me_name.c_str(), me_name.c_str(),12,1.,13.);
01436 }
01437
01438
01439
01440
01441
01442 return me;
01443 }
01444
01445
01446
01447 MonitorElement* SiPixelActionExecutor::getFEDSummaryME(DQMStore* bei,
01448 string me_name) {
01449
01450 MonitorElement* me = 0;
01451 if((bei->pwd()).find("Pixel")==string::npos) return me;
01452 vector<string> contents = bei->getMEs();
01453
01454 for (vector<string>::const_iterator it = contents.begin();
01455 it != contents.end(); it++) {
01456 if ((*it).find(me_name) == 0) {
01457 string fullpathname = bei->pwd() + "/" + (*it);
01458
01459 me = bei->get(fullpathname);
01460
01461 if (me) {
01462
01463 me->Reset();
01464 return me;
01465 }
01466 }
01467 }
01468 contents.clear();
01469 me = bei->book1D(me_name.c_str(), me_name.c_str(),40,-0.5,39.5);
01470
01471 return me;
01472
01473 }
01474
01475
01476 void SiPixelActionExecutor::bookOccupancyPlots(DQMStore* bei, bool hiRes, bool isbarrel)
01477 {
01478 if(Tier0Flag_) return;
01479 vector<string> subdirs = bei->getSubdirs();
01480 for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++)
01481 {
01482 if(isbarrel && (*it).find("Barrel")==string::npos) continue;
01483 if(!isbarrel && (*it).find("Endcap")==string::npos) continue;
01484
01485 if((*it).find("Module_")!=string::npos) continue;
01486 if((*it).find("Panel_")!=string::npos) continue;
01487 if((*it).find("Ladder_")!=string::npos) continue;
01488 if((*it).find("Blade_")!=string::npos) continue;
01489 if((*it).find("Layer_")!=string::npos) continue;
01490 if((*it).find("Disk_")!=string::npos) continue;
01491 bei->cd(*it);
01492 bookOccupancyPlots(bei, hiRes, isbarrel);
01493 if(!hiRes){
01494
01495 OccupancyMap = bei->book2D((isbarrel?"barrelOccupancyMap":"endcapOccupancyMap"),"Barrel Digi Occupancy Map (4 pix per bin)",isbarrel?208:130,0.,isbarrel?416.:260.,80,0.,160.);
01496 }else{
01497
01498 OccupancyMap = bei->book2D((isbarrel?"barrelOccupancyMap":"endcapOccupancyMap"),"Barrel Digi Occupancy Map (1 pix per bin)",isbarrel?416:260,0.,isbarrel?416.:260.,160,0.,160.);
01499 }
01500 OccupancyMap->setAxisTitle("Columns",1);
01501 OccupancyMap->setAxisTitle("Rows",2);
01502
01503 bei->goUp();
01504
01505 }
01506
01507
01508
01509 }
01510
01511 void SiPixelActionExecutor::bookOccupancyPlots(DQMStore* bei, bool hiRes) {
01512
01513 if(Tier0Flag_) return;
01514
01515 bei->cd();
01516 bei->setCurrentFolder("Pixel");
01517 this->bookOccupancyPlots(bei, hiRes, true);
01518
01519
01520 bei->cd();
01521 bei->setCurrentFolder("Pixel");
01522 this->bookOccupancyPlots(bei, hiRes, false);
01523
01524 }
01525
01526 void SiPixelActionExecutor::createOccupancy(DQMStore* bei) {
01527
01528 if(Tier0Flag_) return;
01529 bei->cd();
01530 fillOccupancy(bei, true);
01531 bei->cd();
01532 fillOccupancy(bei, false);
01533 bei->cd();
01534
01535 }
01536
01537
01538
01539 void SiPixelActionExecutor::fillOccupancy(DQMStore* bei, bool isbarrel)
01540 {
01541
01542 if(Tier0Flag_) return;
01543 string currDir = bei->pwd();
01544 string dname = currDir.substr(currDir.find_last_of("/")+1);
01545
01546
01547 if(dname.find("Layer_")!=string::npos || dname.find("Disk_")!=string::npos){
01548 vector<string> meVec = bei->getMEs();
01549 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
01550 string full_path = currDir + "/" + (*it);
01551 if(full_path.find("hitmap_siPixelDigis")!=string::npos){
01552 MonitorElement * me = bei->get(full_path);
01553 if (!me) continue;
01554
01555 string path = full_path;
01556 while (path.find_last_of("/") != 5)
01557 {
01558 path = path.substr(0,path.find_last_of("/"));
01559
01560 OccupancyMap = bei->get(path + "/" + (isbarrel?"barrel":"endcap") + "OccupancyMap");
01561
01562 if(OccupancyMap){
01563 for(int i=1; i!=me->getNbinsX()+1; i++) for(int j=1; j!=me->getNbinsY()+1; j++){
01564 float previous = OccupancyMap->getBinContent(i,j);
01565 OccupancyMap->setBinContent(i,j,previous + me->getBinContent(i,j));
01566 }
01567 OccupancyMap->getTH2F()->SetEntries(OccupancyMap->getTH2F()->Integral());
01568 }
01569
01570 }
01571 }
01572
01573 }
01574
01575 } else {
01576
01577 vector<string> subdirs = bei->getSubdirs();
01578 for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++) {
01579 bei->cd(*it);
01580
01581 if(*it != "Pixel" && ((isbarrel && (*it).find("Barrel")==string::npos) || (!isbarrel && (*it).find("Endcap")==string::npos))) continue;
01582
01583 fillOccupancy(bei, isbarrel);
01584 bei->goUp();
01585 }
01586 }
01587
01588
01589
01590 }
01591
01592
01593
01594
01595
01596
01597 void SiPixelActionExecutor::bookTrackerMaps(DQMStore* bei, std::string name)
01598 {
01599 bei->setCurrentFolder("Pixel/Barrel");
01600 std::string partB[] = { "Layer_1", "Layer_2", "Layer_3"};
01601 bei->book2D("TRKMAP_" + name + "_" + partB[0], "TRKMAP_" + name + "_" + partB[0], 20, 1., 21., 8, 1., 9.);
01602 bei->book2D("TRKMAP_" + name + "_" + partB[1], "TRKMAP_" + name + "_" + partB[1], 32, 1., 33., 8, 1., 9.);
01603 bei->book2D("TRKMAP_" + name + "_" + partB[2], "TRKMAP_" + name + "_" + partB[2], 44, 1., 45., 8, 1., 9.);
01604
01605 bei->setCurrentFolder("Pixel/Endcap");
01606 std::string partE[] = { "Disc_1_M", "Disc_2_M", "Disc_1_P", "Disc_2_P" };
01607 for(Int_t p = 0 ; p < NCyl ; p++)
01608 bei->book2D("TRKMAP_" + name + "_" + partE[p], "TRKMAP_" + name + "_" + partE[p], 24, 1., 25., 7, 1., 8.);
01609 }
01610
01611
01612 void SiPixelActionExecutor::createMaps(DQMStore* bei, std::string type, std::string name, funcType ff)
01613 {
01614
01615
01616 Double_t mapB[NLev1][NLev2][NLev3][NLev4];
01617 bei->setCurrentFolder("Pixel/Barrel/");
01618 createMap(mapB, type, bei, ff, true);
01619 Double_t minB = mapMin(mapB, true);
01620 Double_t maxB = mapMax(mapB, true);
01621
01622
01623 Double_t mapE[NLev1][NLev2][NLev3][NLev4];
01624 bei->setCurrentFolder("Pixel/Endcap/");
01625 createMap(mapE, type, bei, ff, false);
01626 Double_t minE = mapMin(mapE, false);
01627 Double_t maxE = mapMax(mapE, false);
01628
01629 Double_t min = minE<=minB?minE:minB;
01630 Double_t max = maxE>=maxB?maxE:maxB;
01631 if(!min)
01632 min = -0.01;
01633
01634
01635
01636
01637
01638 MonitorElement* meB[NLayer];
01639
01640 MonitorElement* meE[NCyl];
01641
01642 bei->setCurrentFolder("Pixel/Barrel");
01643 prephistosB(meB, bei, mapB, name, min, max);
01644 bei->setCurrentFolder("Pixel/Endcap");
01645 prephistosE(meE, bei, mapE, name, min, max);
01646
01647
01648 }
01649
01650
01651
01652 int SiPixelActionExecutor::createMap(Double_t map[][NLev2][NLev3][NLev4], std::string type, DQMStore* bei, funcType ff, bool isBarrel)
01653 {
01654
01655
01656 vector<string> dirLev1 = bei->getSubdirs();
01657 Int_t i = 0;
01658 for (vector<string>::const_iterator it = dirLev1.begin(); it != dirLev1.end(); it++)
01659 {
01660
01661 bei->cd(*it);
01662 vector<string> dirLev2 = bei->getSubdirs();
01663 Int_t j = 0;
01664 for (vector<string>::const_iterator it2 = dirLev2.begin(); it2 != dirLev2.end(); it2++)
01665 {
01666
01667 bei->cd(*it2);
01668 Int_t k = 0;
01669 vector<string> dirLev3 = bei->getSubdirs();
01670 for (vector<string>::const_iterator it3 = dirLev3.begin(); it3 != dirLev3.end(); it3++)
01671 {
01672
01673 bei->cd(*it3);
01674 if(Tier0Flag_)
01675 for (Int_t l = 0; l < NLev4; l++)
01676 getData(map, type, bei, ff, i, j, k, l);
01677 else
01678 {
01679 Int_t l = 0;
01680 vector<string> dirLev4 = bei->getSubdirs();
01681 for (vector<string>::const_iterator it4 = dirLev4.begin(); it4 != dirLev4.end(); it4++)
01682 {
01683
01684 bei->cd(*it4);
01685 if (isBarrel)
01686 getData(map, type, bei, ff, i, j, k, l++);
01687 else
01688 {
01689 vector<string> dirLev5 = bei->getSubdirs();
01690 for (vector<string>::const_iterator it5 = dirLev5.begin(); it5 != dirLev5.end(); it5++)
01691 {
01692
01693 bei->cd(*it5);
01694 getData(map, type, bei, ff, i, j, k, l++);
01695 }
01696 }
01697 }
01698 }
01699 k++;
01700 }
01701 j++;
01702 }
01703 i++;
01704 }
01705
01706
01707 return 0;
01708 }
01709
01710
01711
01712 void SiPixelActionExecutor::getData(Double_t map[][NLev2][NLev3][NLev4], std::string type, DQMStore* bei, funcType ff, Int_t i, Int_t j, Int_t k, Int_t l) {
01713
01714
01715 vector<string> contents = bei->getMEs();
01716 for (vector<string>::const_iterator im = contents.begin(); im != contents.end(); im++)
01717 {
01718 if((*im).find(type + "_") == string::npos){
01719
01720 continue;
01721 }
01722
01723 std::string fullpathname = bei->pwd() + "/" + (*im);
01724 MonitorElement* me = bei->get(fullpathname);
01725
01726 if (me) {
01727 TH1F* histo = me->getTH1F();
01728
01729 Int_t nbins = histo->GetNbinsX();
01730
01731 switch (ff){
01732 case EachBinContent:
01733 map[i][j][k][l] = histo->GetBinContent(l + 1);
01734 break;
01735
01736 case Entries:
01737 map[i][j][k][l] = histo->GetEntries();
01738 break;
01739
01740 case Mean:
01741 map[i][j][k][l] = histo->GetMean();
01742 break;
01743
01744 case Sum:
01745 {
01746 Double_t sum = 0;
01747 for(Int_t m = 0; m < nbins; m++)
01748 sum += histo->GetBinContent(m + 1);
01749 map[i][j][k][l] = sum;
01750 }
01751 break;
01752
01753 case WeightedSum:
01754 {
01755 Double_t sum = 0;
01756 for(Int_t m = 0; m < nbins; m++)
01757 sum += histo->GetBinContent(m + 1) * histo->GetBinLowEdge(m + 1);
01758 map[i][j][k][l] = sum;
01759 }
01760 break;
01761
01762 default:
01763 map[i][j][k][l] = 0;
01764 }
01765 }}
01766
01767 }
01768
01769
01770
01771 void SiPixelActionExecutor::prephistosB(MonitorElement* me[NLayer], DQMStore *bei, const Double_t map[][NLev2][NLev3][NLev4],std::string name, Double_t min, Double_t max){
01772
01773 std::string part[] = { "Layer_1", "Layer_2", "Layer_3"};
01774 std::string path = bei->pwd();
01775 for (Int_t i = 0; i < NLayer; i++)
01776 {
01777 std::string fullpath = path + "/" + "TRKMAP_" + name + "_" + part[i];
01778 MonitorElement* temp = bei->get(fullpath);
01779 if(temp)
01780 me[i] = temp;
01781 else
01782 cout << "Problem: " << fullpath << endl;
01783 }
01784
01785 for(Int_t p = 0 ; p < NLayer ; p++){
01786 for(Int_t b = 0 ; b < (10 + 6 * p); b++)
01787 for(Int_t i = 0 ; i < NModuleB ; i++){
01788 me[p]->getTH2F()->SetBinContent(b + 1, i + 1, map[0][p][b][i]);
01789 me[p]->getTH2F()->SetBinContent(b + 1, i + 1 + NModuleB, map[1][p][b][i]);
01790 me[p]->getTH2F()->SetBinContent(b + 1 + 10 + 6 * p, i + 1, map[2][p][b][i]);
01791 me[p]->getTH2F()->SetBinContent(b + 1 + 10 + 6 * p, i + 1 + NModuleB, map[3][p][b][i]);
01792 }
01793 me[p]->getTH2F()->SetMinimum(min);
01794 me[p]->getTH2F()->SetMaximum(max);
01795 }
01796
01797 }
01798
01799
01800
01801 void SiPixelActionExecutor::prephistosE(MonitorElement* me[NCyl], DQMStore *bei, const Double_t map[][NLev2][NLev3][NLev4], std::string name, Double_t min, Double_t max){
01802
01803 std::string part[] = { "Disc_1_M", "Disc_2_M", "Disc_1_P", "Disc_2_P" };
01804 std::string path = bei->pwd();
01805 for (Int_t i = 0; i < NCyl; i++)
01806 {
01807 std::string fullpath = path + "/" + "TRKMAP_" + name + "_" + part[i];
01808 MonitorElement* temp = bei->get(fullpath);
01809 if(temp)
01810 {
01811 me[i] = temp;
01812 me[i]->getTH2F()->SetMinimum(min);
01813 me[i]->getTH2F()->SetMaximum(max);
01814 }
01815 else
01816 cout << "Problem: " << fullpath << endl;
01817 }
01818
01819 for(Int_t c = 0 ; c < NCyl ; c += 2)
01820 for(Int_t d = 0 ; d < NDisk ; d++)
01821 for(Int_t b = 0 ; b < NBlade ; b++){
01822 me[c + d]->getTH2F()->SetBinContent(b + 1, 1, map[c][d][b][0]);
01823 me[c + d]->getTH2F()->SetBinContent(b + 1, 2, map[c][d][b][4]);
01824 me[c + d]->getTH2F()->SetBinContent(b + 1, 3, map[c][d][b][1]);
01825 me[c + d]->getTH2F()->SetBinContent(b + 1, 4, map[c][d][b][5]);
01826 me[c + d]->getTH2F()->SetBinContent(b + 1, 5, map[c][d][b][2]);
01827 me[c + d]->getTH2F()->SetBinContent(b + 1, 6, map[c][d][b][6]);
01828 me[c + d]->getTH2F()->SetBinContent(b + 1, 7, map[c][d][b][3]);
01829
01830 me[c + d]->getTH2F()->SetBinContent(2 * NBlade - b, 1, map[c + 1][d][b][0]);
01831 me[c + d]->getTH2F()->SetBinContent(2 * NBlade - b, 2, map[c + 1][d][b][4]);
01832 me[c + d]->getTH2F()->SetBinContent(2 * NBlade - b, 3, map[c + 1][d][b][1]);
01833 me[c + d]->getTH2F()->SetBinContent(2 * NBlade - b, 4, map[c + 1][d][b][5]);
01834 me[c + d]->getTH2F()->SetBinContent(2 * NBlade - b, 5, map[c + 1][d][b][2]);
01835 me[c + d]->getTH2F()->SetBinContent(2 * NBlade - b, 6, map[c + 1][d][b][6]);
01836 me[c + d]->getTH2F()->SetBinContent(2 * NBlade - b, 7, map[c + 1][d][b][3]);
01837 }
01838
01839 }
01840
01841
01842
01843 Double_t SiPixelActionExecutor::mapMin(const Double_t map[][NLev2][NLev3][NLev4], bool isBarrel){
01844
01845 Double_t min = map[0][0][0][0];
01846
01847 for(Int_t p = 0 ; p < NLev1 ; p++)
01848 for(Int_t d = 0 ; d < (isBarrel?3:2) ; d++)
01849 for(Int_t b = 0 ; b < (isBarrel?(d*6+10):12) ; b++)
01850 for(Int_t i = 0 ; i < (isBarrel?4:7); i++){
01851 if(map[p][d][b][i] < min)
01852 min = map[p][d][b][i];
01853 }
01854
01855 return min;
01856 }
01857
01858
01859
01860 Double_t SiPixelActionExecutor::mapMax(const Double_t map[][NLev2][NLev3][NLev4], bool isBarrel){
01861
01862 Double_t max = map[0][0][0][0];
01863
01864 for(Int_t p = 0 ; p < NLev1 ; p++)
01865 for(Int_t d = 0 ; d < (isBarrel?3:2); d++)
01866 for(Int_t b = 0 ; b < (isBarrel?(d*6+10):12); b++)
01867 for(Int_t i = 0 ; i < (isBarrel?4:7); i++)
01868 if(map[p][d][b][i] > max)
01869 max = map[p][d][b][i];
01870
01871 return max;
01872 }
01873
01874
01875
01876
01877
01878
01879
01880 void SiPixelActionExecutor::setupQTests(DQMStore * bei) {
01881
01882
01883 bei->cd();
01884 bei->cd("Pixel");
01885
01886 string localPath;
01887 if(offlineXMLfile_) localPath = string("DQM/SiPixelMonitorClient/test/sipixel_tier0_qualitytest.xml");
01888 else localPath = string("DQM/SiPixelMonitorClient/test/sipixel_qualitytest_config.xml");
01889 if(!qtHandler_){
01890 qtHandler_ = new QTestHandle();
01891 }
01892 if(!qtHandler_->configureTests(edm::FileInPath(localPath).fullPath(),bei)){
01893 qtHandler_->attachTests(bei,false);
01894 bei->cd();
01895 }else{
01896 cout << " Problem setting up quality tests "<<endl;
01897 }
01898
01899
01900 }
01901
01902
01903
01904
01905 void SiPixelActionExecutor::checkQTestResults(DQMStore * bei) {
01906
01907
01908 int messageCounter=0;
01909 string currDir = bei->pwd();
01910 vector<string> contentVec;
01911 bei->getContents(contentVec);
01912 configParser_->getCalibType(calib_type_);
01913
01914 configParser_->getMessageLimitForQTests(message_limit_);
01915 for (vector<string>::iterator it = contentVec.begin();
01916 it != contentVec.end(); it++) {
01917 vector<string> contents;
01918 int nval = SiPixelUtility::getMEList((*it), contents);
01919 if (nval == 0) continue;
01920 for (vector<string>::const_iterator im = contents.begin();
01921 im != contents.end(); im++) {
01922
01923 MonitorElement * me = bei->get((*im));
01924 if (me) {
01925 me->runQTests();
01926
01927 vector<QReport*> warnings = me->getQWarnings();
01928 for(vector<QReport *>::const_iterator wi = warnings.begin();
01929 wi != warnings.end(); ++wi) {
01930 messageCounter++;
01931 if(messageCounter<message_limit_) {
01932
01933
01934
01935
01936 edm::LogWarning("SiPixelActionExecutor::checkQTestResults") << " *** Warning for " << me->getName() << ","
01937 << (*wi)->getMessage() << " " << me->getMean()
01938 << " " << me->getRMS() << me->hasWarning()
01939 << endl;
01940 }
01941 }
01942 warnings=vector<QReport*>();
01943
01944 vector<QReport *> errors = me->getQErrors();
01945 for(vector<QReport *>::const_iterator ei = errors.begin();
01946 ei != errors.end(); ++ei) {
01947
01948 float empty_mean = me->getMean();
01949 float empty_rms = me->getRMS();
01950 if((empty_mean != 0 && empty_rms != 0) || (calib_type_ == 0)){
01951 messageCounter++;
01952 if(messageCounter<=message_limit_) {
01953
01954
01955
01956
01957 edm::LogWarning("SiPixelActionExecutor::checkQTestResults") << " *** Error for " << me->getName() << ","
01958 << (*ei)->getMessage() << " " << me->getMean()
01959 << " " << me->getRMS()
01960 << endl;
01961 }
01962 }
01963 }
01964 errors=vector<QReport*>();
01965 }
01966 me=0;
01967 }
01968 nval=int(); contents=vector<string>();
01969 }
01970 LogDebug("SiPixelActionExecutor::checkQTestResults") <<"messageCounter: "<<messageCounter<<" , message_limit: "<<message_limit_<<endl;
01971
01972
01973 contentVec=vector<string>(); currDir=string(); messageCounter=int();
01974
01975 }
01976
01977
01978 void SiPixelActionExecutor::createLayout(DQMStore * bei){
01979 if (configWriter_ == 0) {
01980 configWriter_ = new SiPixelConfigWriter();
01981 if (!configWriter_->init()) return;
01982 }
01983 string currDir = bei->pwd();
01984 if (currDir.find("Layer") != string::npos) {
01985 string name = "Default";
01986 configWriter_->createLayout(name);
01987 configWriter_->createRow();
01988 fillLayout(bei);
01989 } else {
01990 vector<string> subdirs = bei->getSubdirs();
01991 for (vector<string>::const_iterator it = subdirs.begin();
01992 it != subdirs.end(); it++) {
01993 bei->cd(*it);
01994 createLayout(bei);
01995 bei->goUp();
01996 }
01997 }
01998 }
01999
02000
02001 void SiPixelActionExecutor::fillLayout(DQMStore * bei){
02002
02003 static int icount = 0;
02004 string currDir = bei->pwd();
02005 if (currDir.find("Ladder_") != string::npos) {
02006
02007 vector<string> contents = bei->getMEs();
02008
02009 for (vector<string>::const_iterator im = contents.begin();
02010 im != contents.end(); im++) {
02011 if ((*im).find("Clusters") != string::npos) {
02012 icount++;
02013 if (icount != 0 && icount%6 == 0) {
02014 configWriter_->createRow();
02015 }
02016 ostringstream full_path;
02017 full_path << "test/" << currDir << "/" << *im ;
02018 string element = "monitorable";
02019 string element_name = full_path.str();
02020 configWriter_->createColumn(element, element_name);
02021 }
02022 }
02023 } else {
02024 vector<string> subdirs = bei->getSubdirs();
02025 for (vector<string>::const_iterator it = subdirs.begin();
02026 it != subdirs.end(); it++) {
02027 bei->cd(*it);
02028 fillLayout(bei);
02029 bei->goUp();
02030 }
02031 }
02032 }
02033
02034
02035
02036
02037
02038 int SiPixelActionExecutor::getTkMapMENames(std::vector<std::string>& names) {
02039 if (tkMapMENames.size() == 0) return 0;
02040 for (vector<string>::iterator it = tkMapMENames.begin();
02041 it != tkMapMENames.end(); it++) {
02042 names.push_back(*it) ;
02043 }
02044 return names.size();
02045 }
02046
02047
02049 void SiPixelActionExecutor::dumpModIds(DQMStore * bei, edm::EventSetup const& eSetup){
02050
02051 bei->cd();
02052 dumpBarrelModIds(bei,eSetup);
02053 bei->cd();
02054 dumpEndcapModIds(bei,eSetup);
02055 bei->cd();
02056
02057 }
02058
02059
02060
02061 void SiPixelActionExecutor::dumpBarrelModIds(DQMStore * bei, edm::EventSetup const& eSetup){
02062 string currDir = bei->pwd();
02063 string dir_name = "Ladder_";
02064 eSetup.get<SiPixelFedCablingMapRcd>().get(theCablingMap);
02065 int fedId=-1; int linkId=-1;
02066 if (currDir.find(dir_name) != string::npos) {
02067 vector<string> subdirs = bei->getSubdirs();
02068 for (vector<string>::const_iterator it = subdirs.begin();
02069 it != subdirs.end(); it++) {
02070 if ( (*it).find("Module_") == string::npos) continue;
02071 bei->cd(*it);
02072 ndet_++;
02073
02074
02075
02076 cout<<bei->pwd();
02077 vector<string> contents = bei->getMEs();
02078 bool first_me = false;
02079 int detId = -999;
02080 for (vector<string>::const_iterator im = contents.begin();
02081 im != contents.end(); im++) {
02082 if(first_me) break;
02083 string mEName = (*im);
02084 string detIdString = mEName.substr((mEName.find_last_of("_"))+1,9);
02085 std::istringstream isst;
02086 isst.str(detIdString);
02087 if(mEName.find("_3")!=string::npos) isst>>detId;
02088 }
02089 bei->goUp();
02090
02091
02092
02093 cout<<" "<<detId;
02094 for(int fedid=0; fedid<=40; ++fedid){
02095 SiPixelFrameConverter converter(theCablingMap.product(),fedid);
02096 uint32_t newDetId = detId;
02097 if(converter.hasDetUnit(newDetId)){
02098 fedId=fedid;
02099 break;
02100 }
02101 }
02102 if(fedId==-1) continue;
02103 sipixelobjects::ElectronicIndex cabling;
02104 SiPixelFrameConverter formatter(theCablingMap.product(),fedId);
02105 assert(detId >= 0);
02106 sipixelobjects::DetectorIndex detector = {static_cast<unsigned int>(detId), 1, 1};
02107 formatter.toCabling(cabling,detector);
02108 linkId = cabling.link;
02109
02110
02111
02112 cout<<" "<<fedId<<" "<<linkId<<endl;
02113 }
02114 } else {
02115 vector<string> subdirs = bei->getSubdirs();
02116 for (vector<string>::const_iterator it = subdirs.begin();
02117 it != subdirs.end(); it++) {
02118 if((*it).find("Endcap")!=string::npos) continue;
02119 bei->cd(*it);
02120 dumpBarrelModIds(bei,eSetup);
02121 bei->goUp();
02122 }
02123 }
02124 }
02125
02126
02127 void SiPixelActionExecutor::dumpEndcapModIds(DQMStore * bei, edm::EventSetup const& eSetup){
02128 string currDir = bei->pwd();
02129 string dir_name = "Panel_";
02130 eSetup.get<SiPixelFedCablingMapRcd>().get(theCablingMap);
02131 int fedId=-1; int linkId=-1;
02132 if (currDir.find(dir_name) != string::npos) {
02133 vector<string> subdirs = bei->getSubdirs();
02134 for (vector<string>::const_iterator it = subdirs.begin();
02135 it != subdirs.end(); it++) {
02136 if ( (*it).find("Module_") == string::npos) continue;
02137 bei->cd(*it);
02138 ndet_++;
02139
02140
02141
02142 cout<<bei->pwd();
02143 vector<string> contents = bei->getMEs();
02144 bool first_me = false;
02145 int detId = -999;
02146 for (vector<string>::const_iterator im = contents.begin();
02147 im != contents.end(); im++) {
02148 if(first_me) break;
02149 string mEName = (*im);
02150 string detIdString = mEName.substr((mEName.find_last_of("_"))+1,9);
02151 std::istringstream isst;
02152 isst.str(detIdString);
02153 if(mEName.find("_3")!=string::npos) isst>>detId;
02154 }
02155 bei->goUp();
02156
02157
02158
02159 cout<<" "<<detId;
02160 for(int fedid=0; fedid<=40; ++fedid){
02161 SiPixelFrameConverter converter(theCablingMap.product(),fedid);
02162 uint32_t newDetId = detId;
02163 if(converter.hasDetUnit(newDetId)){
02164 fedId=fedid;
02165 break;
02166 }
02167 }
02168 if(fedId==-1) continue;
02169 sipixelobjects::ElectronicIndex cabling;
02170 SiPixelFrameConverter formatter(theCablingMap.product(),fedId);
02171 assert(detId >= 0);
02172 sipixelobjects::DetectorIndex detector = {static_cast<unsigned int>(detId), 1, 1};
02173 formatter.toCabling(cabling,detector);
02174 linkId = cabling.link;
02175
02176
02177
02178 cout<<" "<<fedId<<" "<<linkId<<endl;
02179 }
02180 } else {
02181 vector<string> subdirs = bei->getSubdirs();
02182 for (vector<string>::const_iterator it = subdirs.begin();
02183 it != subdirs.end(); it++) {
02184 if((bei->pwd()).find("Barrel")!=string::npos) bei->goUp();
02185 bei->cd((*it));
02186 if((*it).find("Barrel")!=string::npos) continue;
02187 dumpEndcapModIds(bei,eSetup);
02188 bei->goUp();
02189 }
02190 }
02191
02192 }
02193
02194
02196 void SiPixelActionExecutor::dumpRefValues(DQMStore * bei, edm::EventSetup const& eSetup){
02197
02198 bei->cd();
02199 dumpBarrelRefValues(bei,eSetup);
02200 bei->cd();
02201 dumpEndcapRefValues(bei,eSetup);
02202 bei->cd();
02203
02204 }
02205
02206
02207
02208 void SiPixelActionExecutor::dumpBarrelRefValues(DQMStore * bei, edm::EventSetup const& eSetup){
02209 MonitorElement* me;
02210 me = bei->get("Pixel/Barrel/SUMDIG_adc_Barrel");
02211 if(me){
02212 std::cout<<"SUMDIG_adc_Barrel: "<<std::endl;
02213 for(int i=1; i!=769; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
02214 }
02215 me = bei->get("Pixel/Barrel/SUMDIG_ndigis_Barrel");
02216 if(me){
02217 std::cout<<"SUMDIG_ndigis_Barrel: "<<std::endl;
02218 for(int i=1; i!=769; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
02219 }
02220 me = bei->get("Pixel/Barrel/SUMCLU_charge_Barrel");
02221 if(me){
02222 std::cout<<"SUMCLU_charge_Barrel: "<<std::endl;
02223 for(int i=1; i!=769; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
02224 }
02225 me = bei->get("Pixel/Barrel/SUMCLU_nclusters_Barrel");
02226 if(me){
02227 std::cout<<"SUMCLU_nclusters_Barrel: "<<std::endl;
02228 for(int i=1; i!=769; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
02229 }
02230 me = bei->get("Pixel/Barrel/SUMCLU_size_Barrel");
02231 if(me){
02232 std::cout<<"SUMCLU_size_Barrel: "<<std::endl;
02233 for(int i=1; i!=769; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
02234 }
02235 }
02236
02237
02238 void SiPixelActionExecutor::dumpEndcapRefValues(DQMStore * bei, edm::EventSetup const& eSetup){
02239 MonitorElement* me;
02240 me = bei->get("Pixel/Endcap/SUMDIG_adc_Endcap");
02241 if(me){
02242 std::cout<<"SUMDIG_adc_Endcap: "<<std::endl;
02243 for(int i=1; i!=673; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
02244 }
02245 me = bei->get("Pixel/Endcap/SUMDIG_ndigis_Endcap");
02246 if(me){
02247 std::cout<<"SUMDIG_ndigis_Endcap: "<<std::endl;
02248 for(int i=1; i!=673; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
02249 }
02250 me = bei->get("Pixel/Endcap/SUMCLU_charge_Endcap");
02251 if(me){
02252 std::cout<<"SUMCLU_charge_Endcap: "<<std::endl;
02253 for(int i=1; i!=673; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
02254 }
02255 me = bei->get("Pixel/Endcap/SUMCLU_nclusters_Endcap");
02256 if(me){
02257 std::cout<<"SUMCLU_nclusters_Endcap: "<<std::endl;
02258 for(int i=1; i!=673; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
02259 }
02260 me = bei->get("Pixel/Endcap/SUMCLU_size_Endcap");
02261 if(me){
02262 std::cout<<"SUMCLU_size_Endcap: "<<std::endl;
02263 for(int i=1; i!=673; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
02264 }
02265 }
02266
02267
02268
02269 void SiPixelActionExecutor::bookEfficiency(DQMStore * bei){
02270
02271 bei->cd();
02272 bei->setCurrentFolder("Pixel/Barrel");
02273 if(Tier0Flag_){
02274 HitEfficiency_L1 = bei->book2D("HitEfficiency_L1","Hit Efficiency in Barrel_Layer1;z-side;Ladder",2,-1.,1.,20,-10.,10.);
02275 HitEfficiency_L2 = bei->book2D("HitEfficiency_L2","Hit Efficiency in Barrel_Layer2;z-side;Ladder",2,-1.,1.,32,-16.,16.);
02276 HitEfficiency_L3 = bei->book2D("HitEfficiency_L3","Hit Efficiency in Barrel_Layer3;z-side;Ladder",2,-1.,1.,44,-22.,22.);
02277 }else{
02278 HitEfficiency_L1 = bei->book2D("HitEfficiency_L1","Hit Efficiency in Barrel_Layer1;Module;Ladder",8,-4.,4.,20,-10.,10.);
02279 HitEfficiency_L2 = bei->book2D("HitEfficiency_L2","Hit Efficiency in Barrel_Layer2;Module;Ladder",8,-4.,4.,32,-16.,16.);
02280 HitEfficiency_L3 = bei->book2D("HitEfficiency_L3","Hit Efficiency in Barrel_Layer3;Module;Ladder",8,-4.,4.,44,-22.,22.);
02281 }
02282
02283 bei->cd();
02284 bei->setCurrentFolder("Pixel/Endcap");
02285 if(Tier0Flag_){
02286 HitEfficiency_Dp1 = bei->book2D("HitEfficiency_Dp1","Hit Efficiency in Endcap_Disk_p1;Blades;",24,-12.,12.,1,0.,1.);
02287 HitEfficiency_Dp2 = bei->book2D("HitEfficiency_Dp2","Hit Efficiency in Endcap_Disk_p2;Blades;",24,-12.,12.,1,0.,1.);
02288 HitEfficiency_Dm1 = bei->book2D("HitEfficiency_Dm1","Hit Efficiency in Endcap_Disk_m1;Blades;",24,-12.,12.,1,0.,1.);
02289 HitEfficiency_Dm2 = bei->book2D("HitEfficiency_Dm2","Hit Efficiency in Endcap_Disk_m2;Blades;",24,-12.,12.,1,0.,1.);
02290 }else{
02291 HitEfficiency_Dp1 = bei->book2D("HitEfficiency_Dp1","Hit Efficiency in Endcap_Disk_p1;Blades;Modules",24,-12.,12.,7,1.,8.);
02292 HitEfficiency_Dp2 = bei->book2D("HitEfficiency_Dp2","Hit Efficiency in Endcap_Disk_p2;Blades;Modules",24,-12.,12.,7,1.,8.);
02293 HitEfficiency_Dm1 = bei->book2D("HitEfficiency_Dm1","Hit Efficiency in Endcap_Disk_m1;Blades;Modules",24,-12.,12.,7,1.,8.);
02294 HitEfficiency_Dm2 = bei->book2D("HitEfficiency_Dm2","Hit Efficiency in Endcap_Disk_m2;Blades;Modules",24,-12.,12.,7,1.,8.);
02295 }
02296 }
02297
02298
02299
02300 void SiPixelActionExecutor::createEfficiency(DQMStore * bei){
02301
02302 bei->cd();
02303 fillEfficiency(bei, true);
02304 bei->cd();
02305 fillEfficiency(bei, false);
02306 bei->cd();
02307
02308 }
02309
02310
02311
02312 void SiPixelActionExecutor::fillEfficiency(DQMStore* bei, bool isbarrel){
02313
02314 string currDir = bei->pwd();
02315 string dname = currDir.substr(currDir.find_last_of("/")+1);
02316
02317
02318 if(Tier0Flag_){
02319 if(isbarrel && dname.find("Ladder_")!=string::npos){
02320 vector<string> meVec = bei->getMEs();
02321 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
02322 string full_path = currDir + "/" + (*it);
02323 if(full_path.find("missing_")!=string::npos){
02324 MonitorElement * me = bei->get(full_path);
02325 if (!me) continue;
02326 float missingHits = me->getEntries();
02327
02328 string new_path = full_path.replace(full_path.find("missing"),7,"valid");
02329 me = bei->get(new_path);
02330 if (!me) continue;
02331 float validHits = me->getEntries();
02332
02333 float hitEfficiency = -1.;
02334 if(validHits + missingHits > 0.) hitEfficiency = validHits / (validHits + missingHits);
02335
02336 int binx = 0; int biny = 0;
02337 if(currDir.find("Shell_m")!=string::npos){ binx = 1;}else{ binx = 2;}
02338 if(dname.find("01")!=string::npos){ biny = 1;}else if(dname.find("02")!=string::npos){ biny = 2;}
02339 else if(dname.find("03")!=string::npos){ biny = 3;}else if(dname.find("04")!=string::npos){ biny = 4;}
02340 else if(dname.find("05")!=string::npos){ biny = 5;}else if(dname.find("06")!=string::npos){ biny = 6;}
02341 else if(dname.find("07")!=string::npos){ biny = 7;}else if(dname.find("08")!=string::npos){ biny = 8;}
02342 else if(dname.find("09")!=string::npos){ biny = 9;}else if(dname.find("10")!=string::npos){ biny = 10;}
02343 else if(dname.find("11")!=string::npos){ biny = 11;}else if(dname.find("12")!=string::npos){ biny = 12;}
02344 else if(dname.find("13")!=string::npos){ biny = 13;}else if(dname.find("14")!=string::npos){ biny = 14;}
02345 else if(dname.find("15")!=string::npos){ biny = 15;}else if(dname.find("16")!=string::npos){ biny = 16;}
02346 else if(dname.find("17")!=string::npos){ biny = 17;}else if(dname.find("18")!=string::npos){ biny = 18;}
02347 else if(dname.find("19")!=string::npos){ biny = 19;}else if(dname.find("20")!=string::npos){ biny = 20;}
02348 else if(dname.find("21")!=string::npos){ biny = 21;}else if(dname.find("22")!=string::npos){ biny = 22;}
02349 if(currDir.find("Shell_mO")!=string::npos || currDir.find("Shell_pO")!=string::npos){
02350 if(currDir.find("Layer_1")!=string::npos){ biny = biny + 10;}
02351 else if(currDir.find("Layer_2")!=string::npos){ biny = biny + 16;}
02352 else if(currDir.find("Layer_3")!=string::npos){ biny = biny + 22;}
02353 }
02354 if(currDir.find("Layer_1")!=string::npos){
02355 HitEfficiency_L1 = bei->get("Pixel/Barrel/HitEfficiency_L1");
02356 if(HitEfficiency_L1) HitEfficiency_L1->setBinContent(binx, biny,(float)hitEfficiency);
02357
02358 }else if(currDir.find("Layer_2")!=string::npos){
02359 HitEfficiency_L2 = bei->get("Pixel/Barrel/HitEfficiency_L2");
02360 if(HitEfficiency_L2) HitEfficiency_L2->setBinContent(binx, biny,(float)hitEfficiency);
02361 }else if(currDir.find("Layer_3")!=string::npos){
02362 HitEfficiency_L3 = bei->get("Pixel/Barrel/HitEfficiency_L3");
02363 if(HitEfficiency_L3) HitEfficiency_L3->setBinContent(binx, biny,(float)hitEfficiency);
02364 }
02365 }
02366 }
02367 }else if(!isbarrel && dname.find("Blade_")!=string::npos){
02368 vector<string> meVec = bei->getMEs();
02369 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
02370 string full_path = currDir + "/" + (*it);
02371 if(full_path.find("missing_")!=string::npos){
02372 MonitorElement * me = bei->get(full_path);
02373 if (!me) continue;
02374 float missingHits = me->getEntries();
02375 string new_path = full_path.replace(full_path.find("missing"),7,"valid");
02376 me = bei->get(new_path);
02377 if (!me) continue;
02378 float validHits = me->getEntries();
02379 float hitEfficiency = -1.;
02380 if(validHits + missingHits > 0.) hitEfficiency = validHits / (validHits + missingHits);
02381 int binx = 0; int biny = 1;
02382 if(currDir.find("01")!=string::npos){ binx = 1;}else if(currDir.find("02")!=string::npos){ binx = 2;}
02383 else if(currDir.find("03")!=string::npos){ binx = 3;}else if(currDir.find("04")!=string::npos){ binx = 4;}
02384 else if(currDir.find("05")!=string::npos){ binx = 5;}else if(currDir.find("06")!=string::npos){ binx = 6;}
02385 else if(currDir.find("07")!=string::npos){ binx = 7;}else if(currDir.find("08")!=string::npos){ binx = 8;}
02386 else if(currDir.find("09")!=string::npos){ binx = 9;}else if(currDir.find("10")!=string::npos){ binx = 10;}
02387 else if(currDir.find("11")!=string::npos){ binx = 11;}else if(currDir.find("12")!=string::npos){ binx = 12;}
02388 if(currDir.find("HalfCylinder_mI")!=string::npos || currDir.find("HalfCylinder_pI")!=string::npos){ binx = binx + 12;}
02389 else{
02390 if(binx==1) binx = 12;
02391 else if(binx==2) binx = 11;
02392 else if(binx==3) binx = 10;
02393 else if(binx==4) binx = 9;
02394 else if(binx==5) binx = 8;
02395 else if(binx==6) binx = 7;
02396 else if(binx==7) binx = 6;
02397 else if(binx==8) binx = 5;
02398 else if(binx==9) binx = 4;
02399 else if(binx==10) binx = 3;
02400 else if(binx==11) binx = 2;
02401 else if(binx==12) binx = 1;
02402 }
02403 if(currDir.find("Disk_1")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
02404 HitEfficiency_Dm1 = bei->get("Pixel/Endcap/HitEfficiency_Dm1");
02405 if(HitEfficiency_Dm1) HitEfficiency_Dm1->setBinContent(binx, biny, (float)hitEfficiency);
02406 }else if(currDir.find("Disk_2")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
02407 HitEfficiency_Dm2 = bei->get("Pixel/Endcap/HitEfficiency_Dm2");
02408 if(HitEfficiency_Dm2) HitEfficiency_Dm2->setBinContent(binx, biny, (float)hitEfficiency);
02409 }else if(currDir.find("Disk_1")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
02410 HitEfficiency_Dp1 = bei->get("Pixel/Endcap/HitEfficiency_Dp1");
02411 if(HitEfficiency_Dp1) HitEfficiency_Dp1->setBinContent(binx, biny, (float)hitEfficiency);
02412 }else if(currDir.find("Disk_2")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
02413 HitEfficiency_Dp2 = bei->get("Pixel/Endcap/HitEfficiency_Dp2");
02414 if(HitEfficiency_Dp2) HitEfficiency_Dp2->setBinContent(binx, biny, (float)hitEfficiency);
02415 }
02416
02417 }
02418 }
02419 }else{
02420
02421 vector<string> subdirs = bei->getSubdirs();
02422 for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++) {
02423 bei->cd(*it);
02424
02425 if(*it != "Pixel" && ((isbarrel && (*it).find("Barrel")==string::npos) || (!isbarrel && (*it).find("Endcap")==string::npos))) continue;
02426
02427 fillEfficiency(bei, isbarrel);
02428 bei->goUp();
02429 }
02430 }
02431 }else{
02432 if(dname.find("Module_")!=string::npos){
02433 vector<string> meVec = bei->getMEs();
02434 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
02435 string full_path = currDir + "/" + (*it);
02436 if(full_path.find("missing_")!=string::npos){
02437 MonitorElement * me = bei->get(full_path);
02438 if (!me) continue;
02439 float missingHits = me->getEntries();
02440 string new_path = full_path.replace(full_path.find("missing"),7,"valid");
02441 me = bei->get(new_path);
02442 if (!me) continue;
02443 float validHits = me->getEntries();
02444 float hitEfficiency = -1.;
02445 if(validHits + missingHits > 0.) hitEfficiency = validHits / (validHits + missingHits);
02446 int binx = 0; int biny = 0;
02447 if(isbarrel){
02448 if(currDir.find("Shell_m")!=string::npos){
02449 if(currDir.find("Module_4")!=string::npos){ binx = 1;}else if(currDir.find("Module_3")!=string::npos){ binx = 2;}
02450 if(currDir.find("Module_2")!=string::npos){ binx = 3;}else if(currDir.find("Module_1")!=string::npos){ binx = 4;}
02451 }else if(currDir.find("Shell_p")!=string::npos){
02452 if(currDir.find("Module_1")!=string::npos){ binx = 5;}else if(currDir.find("Module_2")!=string::npos){ binx = 6;}
02453 if(currDir.find("Module_3")!=string::npos){ binx = 7;}else if(currDir.find("Module_4")!=string::npos){ binx = 8;}
02454 }
02455 if(currDir.find("01")!=string::npos){ biny = 1;}else if(currDir.find("02")!=string::npos){ biny = 2;}
02456 else if(currDir.find("03")!=string::npos){ biny = 3;}else if(currDir.find("04")!=string::npos){ biny = 4;}
02457 else if(currDir.find("05")!=string::npos){ biny = 5;}else if(currDir.find("06")!=string::npos){ biny = 6;}
02458 else if(currDir.find("07")!=string::npos){ biny = 7;}else if(currDir.find("08")!=string::npos){ biny = 8;}
02459 else if(currDir.find("09")!=string::npos){ biny = 9;}else if(currDir.find("10")!=string::npos){ biny = 10;}
02460 else if(currDir.find("11")!=string::npos){ biny = 11;}else if(currDir.find("12")!=string::npos){ biny = 12;}
02461 else if(currDir.find("13")!=string::npos){ biny = 13;}else if(currDir.find("14")!=string::npos){ biny = 14;}
02462 else if(currDir.find("15")!=string::npos){ biny = 15;}else if(currDir.find("16")!=string::npos){ biny = 16;}
02463 else if(currDir.find("17")!=string::npos){ biny = 17;}else if(currDir.find("18")!=string::npos){ biny = 18;}
02464 else if(currDir.find("19")!=string::npos){ biny = 19;}else if(currDir.find("20")!=string::npos){ biny = 20;}
02465 else if(currDir.find("21")!=string::npos){ biny = 21;}else if(currDir.find("22")!=string::npos){ biny = 22;}
02466 if(currDir.find("Shell_mO")!=string::npos || currDir.find("Shell_pO")!=string::npos){
02467 if(currDir.find("Layer_1")!=string::npos){ biny = biny + 10;}
02468 else if(currDir.find("Layer_2")!=string::npos){ biny = biny + 16;}
02469 else if(currDir.find("Layer_3")!=string::npos){ biny = biny + 22;}
02470 }
02471 }else{
02472 if(currDir.find("01")!=string::npos){ binx = 1;}else if(currDir.find("02")!=string::npos){ binx = 2;}
02473 else if(currDir.find("03")!=string::npos){ binx = 3;}else if(currDir.find("04")!=string::npos){ binx = 4;}
02474 else if(currDir.find("05")!=string::npos){ binx = 5;}else if(currDir.find("06")!=string::npos){ binx = 6;}
02475 else if(currDir.find("07")!=string::npos){ binx = 7;}else if(currDir.find("08")!=string::npos){ binx = 8;}
02476 else if(currDir.find("09")!=string::npos){ binx = 9;}else if(currDir.find("10")!=string::npos){ binx = 10;}
02477 else if(currDir.find("11")!=string::npos){ binx = 11;}else if(currDir.find("12")!=string::npos){ binx = 12;}
02478 if(currDir.find("HalfCylinder_mO")!=string::npos || currDir.find("HalfCylinder_pO")!=string::npos){ binx = binx + 12;}
02479 if(currDir.find("Panel_1/Module_1")!=string::npos){ biny = 1;}else if(currDir.find("Panel_2/Module_1")!=string::npos){ biny = 2;}
02480 else if(currDir.find("Panel_1/Module_2")!=string::npos){ biny = 3;}else if(currDir.find("Panel_2/Module_2")!=string::npos){ biny = 4;}
02481 else if(currDir.find("Panel_1/Module_3")!=string::npos){ biny = 5;}else if(currDir.find("Panel_2/Module_3")!=string::npos){ biny = 6;}
02482 else if(currDir.find("Panel_1/Module_4")!=string::npos){ biny = 7;}
02483 }
02484
02485 if(currDir.find("Layer_1")!=string::npos){
02486 HitEfficiency_L1 = bei->get("Pixel/Barrel/HitEfficiency_L1");
02487 if(HitEfficiency_L1) HitEfficiency_L1->setBinContent(binx, biny,(float)hitEfficiency);
02488 }else if(currDir.find("Layer_2")!=string::npos){
02489 HitEfficiency_L2 = bei->get("Pixel/Barrel/HitEfficiency_L2");
02490 if(HitEfficiency_L2) HitEfficiency_L2->setBinContent(binx, biny,(float)hitEfficiency);
02491 }else if(currDir.find("Layer_3")!=string::npos){
02492 HitEfficiency_L3 = bei->get("Pixel/Barrel/HitEfficiency_L3");
02493 if(HitEfficiency_L3) HitEfficiency_L3->setBinContent(binx, biny,(float)hitEfficiency);
02494 }else if(currDir.find("Disk_1")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
02495 HitEfficiency_Dm1 = bei->get("Pixel/Endcap/HitEfficiency_Dm1");
02496 if(HitEfficiency_Dm1) HitEfficiency_Dm1->setBinContent(binx, biny,(float)hitEfficiency);
02497 }else if(currDir.find("Disk_2")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
02498 HitEfficiency_Dm2 = bei->get("Pixel/Endcap/HitEfficiency_Dm2");
02499 if(HitEfficiency_Dm2) HitEfficiency_Dm2->setBinContent(binx, biny,(float)hitEfficiency);
02500 }else if(currDir.find("Disk_1")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
02501 HitEfficiency_Dp1 = bei->get("Pixel/Endcap/HitEfficiency_Dp1");
02502 if(HitEfficiency_Dp1) HitEfficiency_Dp1->setBinContent(binx, biny,(float)hitEfficiency);
02503 }else if(currDir.find("Disk_2")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
02504 HitEfficiency_Dp2 = bei->get("Pixel/Endcap/HitEfficiency_Dp2");
02505 if(HitEfficiency_Dp2) HitEfficiency_Dp2->setBinContent(binx, biny,(float)hitEfficiency);
02506 }
02507 }
02508 }
02509 }else{
02510
02511 vector<string> subdirs = bei->getSubdirs();
02512 for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++) {
02513 bei->cd(*it);
02514
02515 if(*it != "Pixel" && ((isbarrel && (*it).find("Barrel")==string::npos) || (!isbarrel && (*it).find("Endcap")==string::npos))) continue;
02516
02517 fillEfficiency(bei, isbarrel);
02518 bei->goUp();
02519 }
02520 }
02521 }
02522
02523
02524
02525 }