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 if(source_type_==5||source_type_==6){
00753 if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
00754 (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
00755 (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
00756 (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap"||
00757 (*iv)=="FedChLErrArray"||(*iv)=="FedChNErrArray"||(*iv)=="FedETypeNErrArray")
00758 prefix="SUMRAW";
00759 }
00760 if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
00761 (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
00762 (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
00763 (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap"){
00764 string tag = prefix + "_" + (*iv) + "_FEDErrors";
00765 MonitorElement* temp = getFEDSummaryME(bei, tag);
00766 sum_mes.push_back(temp);
00767 }else if((*iv)=="FedChLErrArray"||(*iv)=="FedChNErrArray"||(*iv)=="FedETypeNErrArray"){
00768 string tag = prefix + "_" + (*iv);
00769 MonitorElement* temp;
00770 if((*iv)=="FedChLErrArray") temp = bei->book2D("FedChLErrArray","Type of last error",40,-0.5,39.5,37,0.,37.);
00771 if((*iv)=="FedChNErrArray") temp = bei->book2D("FedChNErrArray","Total number of errors",40,-0.5,39.5,37,0.,37.);
00772 if((*iv)=="FedETypeNErrArray"){
00773 temp = bei->book2D("FedETypeNErrArray","Number of each error type",40,-0.5,39.5,21,0.,21.);
00774 temp->setBinLabel(1,"ROC of 25",2);
00775 temp->setBinLabel(2,"Gap word",2);
00776 temp->setBinLabel(3,"Dummy word",2);
00777 temp->setBinLabel(4,"FIFO full",2);
00778 temp->setBinLabel(5,"Timeout",2);
00779 temp->setBinLabel(6,"Stack full",2);
00780 temp->setBinLabel(7,"Pre-cal issued",2);
00781 temp->setBinLabel(8,"Trigger clear or sync",2);
00782 temp->setBinLabel(9,"No token bit",2);
00783 temp->setBinLabel(10,"Overflow",2);
00784 temp->setBinLabel(11,"FSM error",2);
00785 temp->setBinLabel(12,"Invalid #ROCs",2);
00786 temp->setBinLabel(13,"Event number",2);
00787 temp->setBinLabel(14,"Slink header",2);
00788 temp->setBinLabel(15,"Slink trailer",2);
00789 temp->setBinLabel(16,"Event size",2);
00790 temp->setBinLabel(17,"Invalid channel#",2);
00791 temp->setBinLabel(18,"ROC value",2);
00792 temp->setBinLabel(19,"Dcol or pixel value",2);
00793 temp->setBinLabel(20,"Readout order",2);
00794 temp->setBinLabel(21,"CRC error",2);
00795 }
00796 sum_mes.push_back(temp);
00797 }
00798 }
00799 if (sum_mes.size() == 0) {
00800 edm::LogInfo("SiPixelActionExecutor") << " Summary MEs can not be created" << "\n" ;
00801 return;
00802 }
00803 vector<string> subdirs = bei->getSubdirs();
00804 int ndet = 0;
00805 for (vector<string>::const_iterator it = subdirs.begin();
00806 it != subdirs.end(); it++) {
00807 if ( (*it).find("FED_") == string::npos) continue;
00808 bei->cd(*it);
00809 string fedid = (*it).substr((*it).find("_")+1);
00810 std::istringstream isst;
00811 isst.str(fedid);
00812 isst>>ndet; ndet++;
00813 vector<string> contents = bei->getMEs();
00814
00815 for (vector<MonitorElement*>::const_iterator isum = sum_mes.begin();
00816 isum != sum_mes.end(); isum++) {
00817 for (vector<string>::const_iterator im = contents.begin();
00818 im != contents.end(); im++) {
00819 if(((*im).find("FedChNErrArray_")!=std::string::npos && (*isum)->getName().find("FedChNErrArray")!=std::string::npos) ||
00820 ((*im).find("FedChLErrArray_")!=std::string::npos && (*isum)->getName().find("FedChLErrArray")!=std::string::npos) ||
00821 ((*im).find("FedETypeNErrArray_")!=std::string::npos && (*isum)->getName().find("FedETypeNErrArray")!=std::string::npos)){
00822 string fullpathname = bei->pwd() + "/" + (*im);
00823 MonitorElement * me = bei->get(fullpathname);
00824 if(me && me->getIntValue()>0){
00825 for(int i=0; i!=37; i++){
00826 int n = (*im).find("_"); n++;
00827 string channel_str = (*im).substr(n);
00828 std::istringstream jsst;
00829 jsst.str(channel_str);
00830 int channel=-1;
00831 jsst>>channel;
00832 if(channel==i){
00833 if((*im).find("FedETypeNErrArray_")!=std::string::npos && i<21) (*isum)->Fill(ndet-1,i,me->getIntValue());
00834 else (*isum)->Fill(ndet-1,i,me->getIntValue());
00835 }
00836 }
00837 }
00838 }
00839 string sname = ((*isum)->getName());
00840 string tname = " ";
00841 tname = sname.substr(7,(sname.find("_",7)-6));
00842 if (((*im)).find(tname) == 0) {
00843 string fullpathname = bei->pwd() + "/" + (*im);
00844 MonitorElement * me = bei->get(fullpathname);
00845
00846 if (me){
00847 if(me->getMean()>0.){
00848 if (sname.find("_NErrors_")!=string::npos){
00849 string path1 = fullpathname;
00850 path1 = path1.replace(path1.find("NErrors"),7,"errorType");
00851 MonitorElement * me1 = bei->get(path1);
00852 bool notReset=true;
00853 if(me1){
00854 for(int jj=1; jj<16; jj++){
00855 if(me1->getBinContent(jj)>0.){
00856 if(jj==6){
00857 string path2 = path1;
00858 path2 = path2.replace(path2.find("errorType"),9,"TBMMessage");
00859 MonitorElement * me2 = bei->get(path2);
00860 if(me2) if(me2->getBinContent(6)>0. || me2->getBinContent(7)>0.) notReset=false;
00861 }
00862 }
00863 }
00864 }
00865 if(notReset) (*isum)->setBinContent(ndet, (*isum)->getBinContent(ndet) + me1->getEntries());
00866 }else (*isum)->setBinContent(ndet, (*isum)->getBinContent(ndet) + me->getEntries());
00867 }
00868 (*isum)->setAxisTitle("FED #",1);
00869 string title = " ";
00870 title = sname.substr(7,(sname.find("_",7)-7)) + " per FED";
00871 (*isum)->setAxisTitle(title,2);
00872 }
00873 break;
00874 }
00875 }
00876 }
00877 bei->goUp();
00878 }
00879 } else {
00880 vector<string> subdirs = bei->getSubdirs();
00881 for (vector<string>::const_iterator it = subdirs.begin();
00882 it != subdirs.end(); it++) {
00883 if((*it).find("Endcap")!=string::npos ||
00884 (*it).find("Barrel")!=string::npos) continue;
00885 bei->cd(*it);
00886 fillFEDErrorSummary(bei, dir_name, me_names);
00887 bei->goUp();
00888 }
00889 }
00890
00891 }
00892
00893
00894
00895 void SiPixelActionExecutor::fillGrandBarrelSummaryHistos(DQMStore* bei,
00896 vector<string>& me_names) {
00897
00898 vector<MonitorElement*> gsum_mes;
00899 string currDir = bei->pwd();
00900 string path_name = bei->pwd();
00901 string dir_name = path_name.substr(path_name.find_last_of("/")+1);
00902
00903 if ((dir_name.find("DQMData") == 0) ||
00904 (dir_name.find("Pixel") == 0) ||
00905 (dir_name.find("AdditionalPixelErrors") == 0) ||
00906 (dir_name.find("Endcap") == 0) ||
00907 (dir_name.find("HalfCylinder") == 0) ||
00908 (dir_name.find("Disk") == 0) ||
00909 (dir_name.find("Blade") == 0) ||
00910 (dir_name.find("Panel") == 0) ) return;
00911 vector<string> subdirs = bei->getSubdirs();
00912 int nDirs = subdirs.size();
00913 int iDir =0;
00914 int nbin = 0;
00915 int nbin_i = 0;
00916 int nbin_subdir = 0;
00917 int cnt=0;
00918 bool first_subdir = true;
00919 for (vector<string>::const_iterator it = subdirs.begin();
00920 it != subdirs.end(); it++) {
00921 cnt++;
00922 bei->cd(*it);
00923
00924 vector<string> contents = bei->getMEs();
00925
00926 bei->goUp();
00927
00928 string prefix;
00929 if(source_type_==0) prefix="SUMRAW";
00930 else if (source_type_==1) prefix="SUMDIG";
00931 else if (source_type_==2) prefix="SUMCLU";
00932 else if (source_type_==3) prefix="SUMTRK";
00933 else if (source_type_==4) prefix="SUMHIT";
00934 else if (source_type_>=7 && source_type_<20) prefix="SUMCAL";
00935 else if (source_type_==20) prefix="SUMOFF";
00936
00937
00938 for (vector<string>::const_iterator im = contents.begin();
00939 im != contents.end(); im++) {
00940
00941 for (vector<string>::const_iterator iv = me_names.begin();
00942 iv != me_names.end(); iv++) {
00943 string var = "_" + (*iv) + "_";
00944
00945 if ((*im).find(var) != string::npos) {
00946 if((var=="_charge_" || var=="_nclusters_" || var=="_size_" || var=="_sizeX_" || var=="_sizeY_") &&
00947 (*im).find("Track_")!=string::npos) continue;
00948
00949 string full_path = (*it) + "/" +(*im);
00950 MonitorElement * me = bei->get(full_path.c_str());
00951 if (!me) continue;
00952 if(source_type_==5||source_type_==6){
00953 if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
00954 (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
00955 (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
00956 (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap")
00957 prefix="SUMRAW";
00958 else if((*iv)=="ndigis"||(*iv)=="adc" ||
00959 (*iv)=="ndigisFREQ" || (*iv)=="adcCOMB")
00960 prefix="SUMDIG";
00961 else if((*iv)=="nclusters"||(*iv)=="x"||(*iv)=="y"||(*iv)=="charge"||(*iv)=="chargeCOMB"||
00962 (*iv)=="size"||(*iv)=="sizeX"||(*iv)=="sizeY"||(*iv)=="minrow"||
00963 (*iv)=="maxrow"||(*iv)=="mincol"||(*iv)=="maxcol")
00964 prefix="SUMCLU";
00965 if(currDir.find("Track")!=string::npos) prefix="SUMTRK";
00966 else if((*iv)=="residualX_mean"||(*iv)=="residualY_mean"||
00967 (*iv)=="residualX_RMS"||(*iv)=="residualY_RMS")
00968 prefix="SUMTRK";
00969 else if((*iv)=="ClustX"||(*iv)=="ClustY"||(*iv)=="nRecHits"||(*iv)=="ErrorX"||(*iv)=="ErrorY")
00970 prefix="SUMHIT";
00971 else if((*iv)=="Gain1d_mean"||(*iv)=="GainChi2NDF1d_mean"||
00972 (*iv)=="GainChi2Prob1d_mean"||(*iv)=="Pedestal1d_mean"||
00973 (*iv)=="ScurveChi2ProbSummary_mean"||(*iv)=="ScurveFitResultSummary_mean"||
00974 (*iv)=="ScurveSigmasSummary_mean"||(*iv)=="ScurveThresholdSummary_mean"||
00975 (*iv)=="Gain1d_RMS"||(*iv)=="GainChi2NDF1d_RMS"||
00976 (*iv)=="GainChi2Prob1d_RMS"||(*iv)=="Pedestal1d_RMS"||
00977 (*iv)=="GainNPoints1d_mean" || (*iv)=="GainNPoints1d_RMS" ||
00978 (*iv)=="GainHighPoint1d_mean" || (*iv)=="GainHighPoint1d_RMS" ||
00979 (*iv)=="GainLowPoint1d_mean" || (*iv)=="GainLowPoint1d_RMS" ||
00980 (*iv)=="GainEndPoint1d_mean" || (*iv)=="GainEndPoint1d_RMS" ||
00981 (*iv)=="GainFitResult2d_mean" || (*iv)=="GainFitResult2d_RMS" ||
00982 (*iv)=="GainDynamicRange2d_mean" || (*iv)=="GainDynamicRange2d_RMS" ||
00983 (*iv)=="GainSaturate2d_mean" || (*iv)=="GainSaturate2d_RMS" ||
00984 (*iv)=="ScurveChi2ProbSummary_RMS"||(*iv)=="ScurveFitResultSummary_RMS"||
00985 (*iv)=="ScurveSigmasSummary_RMS"||(*iv)=="ScurveThresholdSummary_RMS"||
00986 (*iv)=="pixelAliveSummary_mean"||(*iv)=="pixelAliveSummary_FracOfPerfectPix" ||
00987 (*iv)=="SiPixelErrorsCalibDigis_NCalibErrors" )
00988 prefix="SUMCAL";
00989 }
00990
00991
00992
00993
00994
00995
00996
00997 if (first_subdir){
00998
00999 nbin = me->getTH1F()->GetNbinsX();
01000 string me_name = prefix + "_" + (*iv) + "_" + dir_name;
01001 if((*iv)=="adcCOMB"||(*iv)=="chargeCOMB") me_name = "ALLMODS_" + (*iv) + "_" + dir_name;
01002 else if(prefix=="SUMOFF" && dir_name=="Barrel") nbin=192;
01003 else if((*iv)=="adcCOMB") nbin=256;
01004 else if(dir_name=="Barrel") nbin=768;
01005 else if(prefix=="SUMOFF" && dir_name.find("Shell")!=string::npos) nbin=48;
01006 else if(dir_name.find("Shell")!=string::npos) nbin=192;
01007 else nbin=nbin*nDirs;
01008
01009 getGrandSummaryME(bei, nbin, me_name, gsum_mes);
01010 }
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025 for (vector<MonitorElement*>::const_iterator igm = gsum_mes.begin();
01026 igm != gsum_mes.end(); igm++) {
01027
01028 if ((*igm)->getName().find(var) != string::npos) {
01029
01030 if(prefix=="SUMOFF") (*igm)->setAxisTitle("Ladders",1);
01031 else if((*igm)->getName().find("adcCOMB_")!=string::npos) (*igm)->setAxisTitle("Digi charge [ADC]",1);
01032 else if((*igm)->getName().find("chargeCOMB_")!=string::npos) (*igm)->setAxisTitle("Cluster charge [kilo electrons]",1);
01033 else (*igm)->setAxisTitle("Modules",1);
01034
01035
01036
01037 string title="";
01038 if((*igm)->getName().find("NErrors_") != string::npos && prefix=="SUMOFF") title = "Total number of errors per Ladder";
01039 else if((*igm)->getName().find("NErrors_") != string::npos && prefix=="SUMRAW") title = "Total number of errors per Module";
01040 else if(prefix=="SUMOFF") title = "mean " + (*iv) + " per Ladder";
01041 else if((*igm)->getName().find("FREQ_") != string::npos && prefix!="SUMOFF") title = "NEvents with digis per Module";
01042 else if((*igm)->getName().find("FREQ_") != string::npos && prefix=="SUMOFF") title = "NEvents with digis per Ladder/Blade";
01043 else if((*igm)->getName().find("adcCOMB_") != string::npos) title = "NDigis";
01044 else if((*igm)->getName().find("chargeCOMB_") != string::npos) title = "NClusters";
01045 else title = "mean " + (*iv) + " per Module";
01046 (*igm)->setAxisTitle(title,2);
01047
01048
01049
01050 if((*igm)->getName().find("ALLMODS_adcCOMB_")!=string::npos){
01051 nbin_subdir=128;
01052 }else if((*igm)->getName().find("ALLMODS_chargeCOMB_")!=string::npos){
01053 nbin_subdir=100;
01054 }else if((*igm)->getName().find("Ladder") != string::npos){
01055 nbin_i=0; nbin_subdir=4;
01056 }else if((*igm)->getName().find("Layer") != string::npos){
01057 nbin_i=(cnt-1)*4; nbin_subdir=4;
01058 }else if((*igm)->getName().find("Shell") != string::npos){
01059 if(prefix!="SUMOFF"){
01060 if(iDir==0){ nbin_i=0; nbin_subdir=40; }
01061 else if(iDir==1){ nbin_i=40; nbin_subdir=64; }
01062 else if(iDir==2){ nbin_i=104; nbin_subdir=88; }
01063 }else{
01064 if(iDir==0){ nbin_i=0; nbin_subdir=10; }
01065 else if(iDir==1){ nbin_i=10; nbin_subdir=16; }
01066 else if(iDir==2){ nbin_i=26; nbin_subdir=22; }
01067 }
01068 }else if((*igm)->getName().find("Barrel") != string::npos){
01069 if(prefix!="SUMOFF"){
01070 if(iDir==0){ nbin_i=0; nbin_subdir=192; }
01071 else if(iDir==1){ nbin_i=192; nbin_subdir=192; }
01072 else if(iDir==2){ nbin_i=384; nbin_subdir=192; }
01073 else if(iDir==3){ nbin_i=576; nbin_subdir=192; }
01074 }else{
01075 if(iDir==0){ nbin_i=0; nbin_subdir=48; }
01076 else if(iDir==1){ nbin_i=48; nbin_subdir=48; }
01077 else if(iDir==2){ nbin_i=96; nbin_subdir=48; }
01078 else if(iDir==3){ nbin_i=144; nbin_subdir=48; }
01079 }
01080 }
01081
01082
01083 if((*igm)->getName().find("ndigisFREQ")==string::npos)
01084 {
01085 if(((*igm)->getName().find("adcCOMB")!=string::npos && me->getName().find("adcCOMB")!=string::npos)
01086 || ((*igm)->getName().find("chargeCOMB")!=string::npos && me->getName().find("chargeCOMB")!=string::npos))
01087 {
01088 (*igm)->getTH1F()->Add(me->getTH1F());
01089 }else if(((*igm)->getName().find("charge_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
01090 me->getName().find("charge_")!=string::npos && me->getName().find("Track_")==string::npos) ||
01091 ((*igm)->getName().find("nclusters_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
01092 me->getName().find("nclusters_")!=string::npos && me->getName().find("Track_")==string::npos) ||
01093 ((*igm)->getName().find("size_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
01094 me->getName().find("size_")!=string::npos && me->getName().find("Track_")==string::npos) ||
01095 ((*igm)->getName().find("charge_OffTrack_")!=string::npos && me->getName().find("charge_OffTrack_")!=string::npos) ||
01096 ((*igm)->getName().find("nclusters_OffTrack_")!=string::npos && me->getName().find("nclusters_OffTrack_")!=string::npos) ||
01097 ((*igm)->getName().find("size_OffTrack_")!=string::npos && me->getName().find("size_OffTrack_")!=string::npos) ||
01098 ((*igm)->getName().find("charge_OnTrack_")!=string::npos && me->getName().find("charge_OnTrack_")!=string::npos) ||
01099 ((*igm)->getName().find("nclusters_OnTrack_")!=string::npos && me->getName().find("nclusters_OnTrack_")!=string::npos) ||
01100 ((*igm)->getName().find("size_OnTrack_")!=string::npos && me->getName().find("size_OnTrack_")!=string::npos) ||
01101 ((*igm)->getName().find("charge_")==string::npos && (*igm)->getName().find("nclusters_")==string::npos &&
01102 (*igm)->getName().find("size_")==string::npos)){
01103 for (int k = 1; k < nbin_subdir+1; k++) if(me->getBinContent(k) > 0) (*igm)->setBinContent(k+nbin_i, me->getBinContent(k));
01104 }
01105 }
01106 else if(me->getName().find("ndigisFREQ")!=string::npos)
01107 {
01108 for (int k = 1; k < nbin_subdir+1; k++) if(me->getBinContent(k) > 0) (*igm)->setBinContent(k+nbin_i, me->getBinContent(k));
01109 }
01110 }
01111 }
01112 }
01113 }
01114 }
01115 iDir++;
01116 first_subdir = false;
01117 }
01118
01119 }
01120
01121
01122 void SiPixelActionExecutor::fillGrandEndcapSummaryHistos(DQMStore* bei,
01123 vector<string>& me_names) {
01124
01125 vector<MonitorElement*> gsum_mes;
01126 string currDir = bei->pwd();
01127 string path_name = bei->pwd();
01128 string dir_name = path_name.substr(path_name.find_last_of("/")+1);
01129 if ((dir_name.find("DQMData") == 0) ||
01130 (dir_name.find("Pixel") == 0) ||
01131 (dir_name.find("AdditionalPixelErrors") == 0) ||
01132 (dir_name.find("Barrel") == 0) ||
01133 (dir_name.find("Shell") == 0) ||
01134 (dir_name.find("Layer") == 0) ||
01135 (dir_name.find("Ladder") == 0) ) return;
01136 vector<string> subdirs = bei->getSubdirs();
01137 int iDir =0;
01138 int nbin = 0;
01139 int nbin_i = 0;
01140 int nbin_subdir = 0;
01141 int cnt=0;
01142 bool first_subdir = true;
01143 for (vector<string>::const_iterator it = subdirs.begin();
01144 it != subdirs.end(); it++) {
01145 cnt++;
01146 bei->cd(*it);
01147 vector<string> contents = bei->getMEs();
01148 bei->goUp();
01149
01150 string prefix;
01151 if(source_type_==0) prefix="SUMRAW";
01152 else if (source_type_==1) prefix="SUMDIG";
01153 else if (source_type_==2) prefix="SUMCLU";
01154 else if (source_type_==3) prefix="SUMTRK";
01155 else if (source_type_==4) prefix="SUMHIT";
01156 else if (source_type_>=7 && source_type_<20) prefix="SUMCAL";
01157 else if (source_type_==20) prefix="SUMOFF";
01158
01159 for (vector<string>::const_iterator im = contents.begin();
01160 im != contents.end(); im++) {
01161 for (vector<string>::const_iterator iv = me_names.begin();
01162 iv != me_names.end(); iv++) {
01163 string var = "_" + (*iv) + "_";
01164 if ((*im).find(var) != string::npos) {
01165 if((var=="_charge_" || var=="_nclusters_" || var=="_size_" || var=="_sizeX_" || var=="_sizeY_") &&
01166 (*im).find("Track_")!=string::npos) continue;
01167 string full_path = (*it) + "/" +(*im);
01168 MonitorElement * me = bei->get(full_path.c_str());
01169 if (!me) continue;
01170 if(source_type_==5||source_type_==6){
01171 if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
01172 (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
01173 (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
01174 (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap")
01175 prefix="SUMRAW";
01176 else if((*iv)=="ndigis"||(*iv)=="adc" ||
01177 (*iv)=="ndigisFREQ"||(*iv)=="adcCOMB")
01178 prefix="SUMDIG";
01179 else if((*iv)=="nclusters"||(*iv)=="x"||(*iv)=="y"||(*iv)=="charge"||(*iv)=="chargeCOMB"||
01180 (*iv)=="size"||(*iv)=="sizeX"||(*iv)=="sizeY"||(*iv)=="minrow"||
01181 (*iv)=="maxrow"||(*iv)=="mincol"||(*iv)=="maxcol")
01182 prefix="SUMCLU";
01183 if(currDir.find("Track")!=string::npos) prefix="SUMTRK";
01184 else if((*iv)=="residualX_mean"||(*iv)=="residualY_mean"||
01185 (*iv)=="residualX_RMS"||(*iv)=="residualY_RMS")
01186 prefix="SUMTRK";
01187 else if((*iv)=="ClustX"||(*iv)=="ClustY"||(*iv)=="nRecHits"||(*iv)=="ErrorX"||(*iv)=="ErrorY")
01188 prefix="SUMHIT";
01189 else if((*iv)=="Gain1d_mean"||(*iv)=="GainChi2NDF1d_mean"||
01190 (*iv)=="GainChi2Prob1d_mean"||(*iv)=="Pedestal1d_mean"||
01191 (*iv)=="ScurveChi2ProbSummary_mean"||(*iv)=="ScurveFitResultSummary_mean"||
01192 (*iv)=="ScurveSigmasSummary_mean"||(*iv)=="ScurveThresholdSummary_mean"||
01193 (*iv)=="Gain1d_RMS"||(*iv)=="GainChi2NDF1d_RMS"||
01194 (*iv)=="GainChi2Prob1d_RMS"||(*iv)=="Pedestal1d_RMS"||
01195 (*iv)=="GainNPoints1d_mean" || (*iv)=="GainNPoints1d_RMS" ||
01196 (*iv)=="GainHighPoint1d_mean" || (*iv)=="GainHighPoint1d_RMS" ||
01197 (*iv)=="GainLowPoint1d_mean" || (*iv)=="GainLowPoint1d_RMS" ||
01198 (*iv)=="GainEndPoint1d_mean" || (*iv)=="GainEndPoint1d_RMS" ||
01199 (*iv)=="GainFitResult2d_mean" || (*iv)=="GainFitResult2d_RMS" ||
01200 (*iv)=="GainDynamicRange2d_mean" || (*iv)=="GainDynamicRange2d_RMS" ||
01201 (*iv)=="GainSaturate2d_mean" || (*iv)=="GainSaturate2d_RMS" ||
01202 (*iv)=="ScurveChi2ProbSummary_RMS"||(*iv)=="ScurveFitResultSummary_RMS"||
01203 (*iv)=="ScurveSigmasSummary_RMS"||(*iv)=="ScurveThresholdSummary_RMS"||
01204 (*iv)=="pixelAliveSummary_mean"||(*iv)=="pixelAliveSummary_FracOfPerfectPix"||
01205 (*iv) == "SiPixelErrorsCalibDigis_NCalibErrors")
01206 prefix="SUMCAL";
01207 }
01208
01209
01210
01211
01212
01213
01214 if (first_subdir){
01215
01216 nbin = me->getTH1F()->GetNbinsX();
01217 string me_name = prefix + "_" + (*iv) + "_" + dir_name;
01218 if((*iv)=="adcCOMB"||(*iv)=="chargeCOMB") me_name = "ALLMODS_" + (*iv) + "_" + dir_name;
01219 else if(prefix=="SUMOFF" && dir_name=="Endcap") nbin=96;
01220 else if(dir_name=="Endcap") nbin=672;
01221 else if(prefix=="SUMOFF" && dir_name.find("HalfCylinder")!=string::npos) nbin=24;
01222 else if(dir_name.find("HalfCylinder")!=string::npos) nbin=168;
01223 else if(prefix=="SUMOFF" && dir_name.find("Disk")!=string::npos) nbin=12;
01224 else if(dir_name.find("Disk")!=string::npos) nbin=84;
01225 else if(dir_name.find("Blade")!=string::npos) nbin=7;
01226
01227
01228
01229 getGrandSummaryME(bei, nbin, me_name, gsum_mes);
01230 }
01231
01232
01233
01234
01235
01236
01237
01238
01239
01240
01241
01242
01243
01244
01245 for (vector<MonitorElement*>::const_iterator igm = gsum_mes.begin();
01246 igm != gsum_mes.end(); igm++) {
01247 if ((*igm)->getName().find(var) != string::npos) {
01248 if(prefix=="SUMOFF") (*igm)->setAxisTitle("Blades",1);
01249 else if((*igm)->getName().find("adcCOMB_")!=string::npos) (*igm)->setAxisTitle("Digi charge [ADC]",1);
01250 else if((*igm)->getName().find("chargeCOMB_")!=string::npos) (*igm)->setAxisTitle("Cluster charge [kilo electrons]",1);
01251 else (*igm)->setAxisTitle("Modules",1);
01252 string title="";
01253 if((*igm)->getName().find("NErrors_") != string::npos && prefix=="SUMOFF") title = "Total number of errors per Blade";
01254 else if((*igm)->getName().find("NErrors_") != string::npos && prefix=="SUMRAW") title = "Total number of errors per Module";
01255 else if(prefix=="SUMOFF") title = "mean " + (*iv) + " per Blade";
01256 else if((*igm)->getName().find("FREQ_") != string::npos) title = "NEvents with digis per Module";
01257 else if((*igm)->getName().find("adcCOMB_")!=string::npos) title = "NDigis";
01258 else if((*igm)->getName().find("chargeCOMB_")!=string::npos) title = "NClusters";
01259 else title = "mean " + (*iv) + " per Module";
01260 (*igm)->setAxisTitle(title,2);
01261 nbin_i=0;
01262 if((*igm)->getName().find("ALLMODS_adcCOMB_")!=string::npos){
01263 nbin_subdir=128;
01264 }else if((*igm)->getName().find("ALLMODS_chargeCOMB_")!=string::npos){
01265 nbin_subdir=100;
01266 }else if((*igm)->getName().find("Panel_") != string::npos){
01267 nbin_subdir=7;
01268
01269
01270
01271
01272 }else if((*igm)->getName().find("Blade") != string::npos){
01273 if((*im).find("_1") != string::npos) nbin_subdir=4;
01274 if((*im).find("_2") != string::npos) {nbin_i=4; nbin_subdir=3;}
01275 }else if((*igm)->getName().find("Disk") != string::npos){
01276 nbin_i=((cnt-1)%12)*7; nbin_subdir=7;
01277 }else if((*igm)->getName().find("HalfCylinder") != string::npos){
01278 if(prefix!="SUMOFF"){
01279 nbin_subdir=84;
01280 if((*im).find("_2") != string::npos) nbin_i=84;
01281 }else{
01282 nbin_subdir=12;
01283 if((*im).find("_2") != string::npos) nbin_i=12;
01284 }
01285 }else if((*igm)->getName().find("Endcap") != string::npos){
01286 if(prefix!="SUMOFF"){
01287 nbin_subdir=168;
01288 if((*im).find("_mO") != string::npos) nbin_i=168;
01289 if((*im).find("_pI") != string::npos) nbin_i=336;
01290 if((*im).find("_pO") != string::npos) nbin_i=504;
01291 }else{
01292 nbin_subdir=24;
01293 if((*im).find("_mO") != string::npos) nbin_i=24;
01294 if((*im).find("_pI") != string::npos) nbin_i=48;
01295 if((*im).find("_pO") != string::npos) nbin_i=72;
01296 }
01297 }
01298
01299
01300 if((*igm)->getName().find("ndigisFREQ")==string::npos){
01301 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)){
01302 (*igm)->getTH1F()->Add(me->getTH1F());
01303 }else if(((*igm)->getName().find("charge_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
01304 me->getName().find("charge_")!=string::npos && me->getName().find("Track_")==string::npos) ||
01305 ((*igm)->getName().find("nclusters_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
01306 me->getName().find("nclusters_")!=string::npos && me->getName().find("Track_")==string::npos) ||
01307 ((*igm)->getName().find("size_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
01308 me->getName().find("size_")!=string::npos && me->getName().find("Track_")==string::npos) ||
01309 ((*igm)->getName().find("charge_OffTrack_")!=string::npos && me->getName().find("charge_OffTrack_")!=string::npos) ||
01310 ((*igm)->getName().find("nclusters_OffTrack_")!=string::npos && me->getName().find("nclusters_OffTrack_")!=string::npos) ||
01311 ((*igm)->getName().find("size_OffTrack_")!=string::npos && me->getName().find("size_OffTrack_")!=string::npos) ||
01312 ((*igm)->getName().find("charge_OnTrack_")!=string::npos && me->getName().find("charge_OnTrack_")!=string::npos) ||
01313 ((*igm)->getName().find("nclusters_OnTrack_")!=string::npos && me->getName().find("nclusters_OnTrack_")!=string::npos) ||
01314 ((*igm)->getName().find("size_OnTrack_")!=string::npos && me->getName().find("size_OnTrack_")!=string::npos) ||
01315 ((*igm)->getName().find("charge_")==string::npos && (*igm)->getName().find("nclusters_")==string::npos &&
01316 (*igm)->getName().find("size_")==string::npos)){
01317 for (int k = 1; k < nbin_subdir+1; k++) if(me->getBinContent(k) > 0) (*igm)->setBinContent(k+nbin_i, me->getBinContent(k));
01318 }
01319 }else if(me->getName().find("ndigisFREQ")!=string::npos){
01320 for (int k = 1; k < nbin_subdir+1; k++) if(me->getBinContent(k) > 0) (*igm)->setBinContent(k+nbin_i, me->getBinContent(k));
01321 }
01322
01323
01324 }
01325 }
01326 }
01327 }
01328 }
01329
01330 iDir++;
01331 first_subdir = false;
01332 }
01333 }
01334
01335
01336
01337
01338 void SiPixelActionExecutor::getGrandSummaryME(DQMStore* bei,
01339 int nbin,
01340 string& me_name,
01341 vector<MonitorElement*> & mes) {
01342
01343 if((bei->pwd()).find("Pixel")==string::npos) return;
01344 vector<string> contents = bei->getMEs();
01345
01346 for (vector<string>::const_iterator it = contents.begin();
01347 it != contents.end(); it++) {
01348
01349 if ((*it).find(me_name) == 0) {
01350 string fullpathname = bei->pwd() + "/" + me_name;
01351
01352 MonitorElement* me = bei->get(fullpathname);
01353
01354 if (me) {
01355
01356 me->Reset();
01357 mes.push_back(me);
01358
01359 return;
01360 }
01361 }
01362 }
01363
01364
01365
01366 MonitorElement* temp_me(0);
01367 if(me_name.find("ALLMODS_adcCOMB_")!=string::npos) temp_me = bei->book1D(me_name.c_str(),me_name.c_str(),128,0,256);
01368 else if(me_name.find("ALLMODS_chargeCOMB_")!=string::npos) temp_me = bei->book1D(me_name.c_str(),me_name.c_str(),100,0,200);
01369 else temp_me = bei->book1D(me_name.c_str(),me_name.c_str(),nbin,1.,nbin+1.);
01370 if (temp_me) mes.push_back(temp_me);
01371
01372
01373 }
01374
01375
01376
01377
01378
01379
01380 MonitorElement* SiPixelActionExecutor::getSummaryME(DQMStore* bei,
01381 string me_name) {
01382
01383 MonitorElement* me = 0;
01384 if((bei->pwd()).find("Pixel")==string::npos) return me;
01385 vector<string> contents = bei->getMEs();
01386
01387 for (vector<string>::const_iterator it = contents.begin();
01388 it != contents.end(); it++) {
01389 if ((*it).find(me_name) == 0) {
01390 string fullpathname = bei->pwd() + "/" + (*it);
01391 me = bei->get(fullpathname);
01392
01393 if (me) {
01394
01395 me->Reset();
01396 return me;
01397 }
01398 }
01399 }
01400 contents.clear();
01401
01402
01403
01404
01405
01406
01407
01408
01409 if(me_name.find("SUMOFF")==string::npos){
01410 if(me_name.find("Blade_")!=string::npos)me = bei->book1D(me_name.c_str(), me_name.c_str(),7,1.,8.);
01411 else me = bei->book1D(me_name.c_str(), me_name.c_str(),4,1.,5.);
01412
01413
01414 }else if(me_name.find("Layer_1")!=string::npos){ me = bei->book1D(me_name.c_str(), me_name.c_str(),10,1.,11.);
01415 }else if(me_name.find("Layer_2")!=string::npos){ me = bei->book1D(me_name.c_str(), me_name.c_str(),16,1.,17.);
01416 }else if(me_name.find("Layer_3")!=string::npos){ me = bei->book1D(me_name.c_str(), me_name.c_str(),22,1.,23.);
01417 }else if(me_name.find("Disk_")!=string::npos){ me = bei->book1D(me_name.c_str(), me_name.c_str(),12,1.,13.);
01418 }
01419
01420
01421
01422
01423
01424 return me;
01425 }
01426
01427
01428
01429 MonitorElement* SiPixelActionExecutor::getFEDSummaryME(DQMStore* bei,
01430 string me_name) {
01431
01432 MonitorElement* me = 0;
01433 if((bei->pwd()).find("Pixel")==string::npos) return me;
01434 vector<string> contents = bei->getMEs();
01435
01436 for (vector<string>::const_iterator it = contents.begin();
01437 it != contents.end(); it++) {
01438 if ((*it).find(me_name) == 0) {
01439 string fullpathname = bei->pwd() + "/" + (*it);
01440
01441 me = bei->get(fullpathname);
01442
01443 if (me) {
01444
01445 me->Reset();
01446 return me;
01447 }
01448 }
01449 }
01450 contents.clear();
01451 me = bei->book1D(me_name.c_str(), me_name.c_str(),40,-0.5,39.5);
01452
01453 return me;
01454
01455 }
01456
01457
01458 void SiPixelActionExecutor::bookOccupancyPlots(DQMStore* bei, bool hiRes, bool isbarrel)
01459 {
01460 if(Tier0Flag_) return;
01461 vector<string> subdirs = bei->getSubdirs();
01462 for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++)
01463 {
01464 if(isbarrel && (*it).find("Barrel")==string::npos) continue;
01465 if(!isbarrel && (*it).find("Endcap")==string::npos) continue;
01466
01467 if((*it).find("Module_")!=string::npos) continue;
01468 if((*it).find("Panel_")!=string::npos) continue;
01469 if((*it).find("Ladder_")!=string::npos) continue;
01470 if((*it).find("Blade_")!=string::npos) continue;
01471 if((*it).find("Layer_")!=string::npos) continue;
01472 if((*it).find("Disk_")!=string::npos) continue;
01473 bei->cd(*it);
01474 bookOccupancyPlots(bei, hiRes, isbarrel);
01475 if(!hiRes){
01476
01477 OccupancyMap = bei->book2D((isbarrel?"barrelOccupancyMap":"endcapOccupancyMap"),"Barrel Digi Occupancy Map (4 pix per bin)",isbarrel?208:130,0.,isbarrel?416.:260.,80,0.,160.);
01478 }else{
01479
01480 OccupancyMap = bei->book2D((isbarrel?"barrelOccupancyMap":"endcapOccupancyMap"),"Barrel Digi Occupancy Map (1 pix per bin)",isbarrel?416:260,0.,isbarrel?416.:260.,160,0.,160.);
01481 }
01482 OccupancyMap->setAxisTitle("Columns",1);
01483 OccupancyMap->setAxisTitle("Rows",2);
01484
01485 bei->goUp();
01486
01487 }
01488
01489
01490
01491 }
01492
01493 void SiPixelActionExecutor::bookOccupancyPlots(DQMStore* bei, bool hiRes) {
01494
01495 if(Tier0Flag_) return;
01496
01497 bei->cd();
01498 bei->setCurrentFolder("Pixel");
01499 this->bookOccupancyPlots(bei, hiRes, true);
01500
01501
01502 bei->cd();
01503 bei->setCurrentFolder("Pixel");
01504 this->bookOccupancyPlots(bei, hiRes, false);
01505
01506 }
01507
01508 void SiPixelActionExecutor::createOccupancy(DQMStore* bei) {
01509
01510 if(Tier0Flag_) return;
01511 bei->cd();
01512 fillOccupancy(bei, true);
01513 bei->cd();
01514 fillOccupancy(bei, false);
01515 bei->cd();
01516
01517 }
01518
01519
01520
01521 void SiPixelActionExecutor::fillOccupancy(DQMStore* bei, bool isbarrel)
01522 {
01523
01524 if(Tier0Flag_) return;
01525 string currDir = bei->pwd();
01526 string dname = currDir.substr(currDir.find_last_of("/")+1);
01527
01528
01529 if(dname.find("Layer_")!=string::npos || dname.find("Disk_")!=string::npos){
01530 vector<string> meVec = bei->getMEs();
01531 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
01532 string full_path = currDir + "/" + (*it);
01533 if(full_path.find("hitmap_siPixelDigis")!=string::npos){
01534 MonitorElement * me = bei->get(full_path);
01535 if (!me) continue;
01536
01537 string path = full_path;
01538 while (path.find_last_of("/") != 5)
01539 {
01540 path = path.substr(0,path.find_last_of("/"));
01541
01542 OccupancyMap = bei->get(path + "/" + (isbarrel?"barrel":"endcap") + "OccupancyMap");
01543
01544 if(OccupancyMap){
01545 for(int i=1; i!=me->getNbinsX()+1; i++) for(int j=1; j!=me->getNbinsY()+1; j++){
01546 float previous = OccupancyMap->getBinContent(i,j);
01547 OccupancyMap->setBinContent(i,j,previous + me->getBinContent(i,j));
01548 }
01549 OccupancyMap->getTH2F()->SetEntries(OccupancyMap->getTH2F()->Integral());
01550 }
01551
01552 }
01553 }
01554
01555 }
01556
01557 } else {
01558
01559 vector<string> subdirs = bei->getSubdirs();
01560 for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++) {
01561 bei->cd(*it);
01562
01563 if(*it != "Pixel" && ((isbarrel && (*it).find("Barrel")==string::npos) || (!isbarrel && (*it).find("Endcap")==string::npos))) continue;
01564
01565 fillOccupancy(bei, isbarrel);
01566 bei->goUp();
01567 }
01568 }
01569
01570
01571
01572 }
01573
01574
01575
01576
01577
01578
01579 void SiPixelActionExecutor::bookTrackerMaps(DQMStore* bei, std::string name)
01580 {
01581 bei->setCurrentFolder("Pixel/Barrel");
01582 std::string partB[] = { "Layer_1", "Layer_2", "Layer_3"};
01583 bei->book2D("TRKMAP_" + name + "_" + partB[0], "TRKMAP_" + name + "_" + partB[0], 20, 1., 21., 8, 1., 9.);
01584 bei->book2D("TRKMAP_" + name + "_" + partB[1], "TRKMAP_" + name + "_" + partB[1], 32, 1., 33., 8, 1., 9.);
01585 bei->book2D("TRKMAP_" + name + "_" + partB[2], "TRKMAP_" + name + "_" + partB[2], 44, 1., 45., 8, 1., 9.);
01586
01587 bei->setCurrentFolder("Pixel/Endcap");
01588 std::string partE[] = { "Disc_1_M", "Disc_2_M", "Disc_1_P", "Disc_2_P" };
01589 for(Int_t p = 0 ; p < NCyl ; p++)
01590 bei->book2D("TRKMAP_" + name + "_" + partE[p], "TRKMAP_" + name + "_" + partE[p], 24, 1., 25., 7, 1., 8.);
01591 }
01592
01593
01594 void SiPixelActionExecutor::createMaps(DQMStore* bei, std::string type, std::string name, funcType ff)
01595 {
01596
01597
01598 Double_t mapB[NLev1][NLev2][NLev3][NLev4];
01599 bei->setCurrentFolder("Pixel/Barrel/");
01600 createMap(mapB, type, bei, ff, true);
01601 Double_t minB = mapMin(mapB, true);
01602 Double_t maxB = mapMax(mapB, true);
01603
01604
01605 Double_t mapE[NLev1][NLev2][NLev3][NLev4];
01606 bei->setCurrentFolder("Pixel/Endcap/");
01607 createMap(mapE, type, bei, ff, false);
01608 Double_t minE = mapMin(mapE, false);
01609 Double_t maxE = mapMax(mapE, false);
01610
01611 Double_t min = minE<=minB?minE:minB;
01612 Double_t max = maxE>=maxB?maxE:maxB;
01613 if(!min)
01614 min = -0.01;
01615
01616
01617
01618
01619
01620 MonitorElement* meB[NLayer];
01621
01622 MonitorElement* meE[NCyl];
01623
01624 bei->setCurrentFolder("Pixel/Barrel");
01625 prephistosB(meB, bei, mapB, name, min, max);
01626 bei->setCurrentFolder("Pixel/Endcap");
01627 prephistosE(meE, bei, mapE, name, min, max);
01628
01629
01630 }
01631
01632
01633
01634 int SiPixelActionExecutor::createMap(Double_t map[][NLev2][NLev3][NLev4], std::string type, DQMStore* bei, funcType ff, bool isBarrel)
01635 {
01636
01637
01638 vector<string> dirLev1 = bei->getSubdirs();
01639 Int_t i = 0;
01640 for (vector<string>::const_iterator it = dirLev1.begin(); it != dirLev1.end(); it++)
01641 {
01642
01643 bei->cd(*it);
01644 vector<string> dirLev2 = bei->getSubdirs();
01645 Int_t j = 0;
01646 for (vector<string>::const_iterator it2 = dirLev2.begin(); it2 != dirLev2.end(); it2++)
01647 {
01648
01649 bei->cd(*it2);
01650 Int_t k = 0;
01651 vector<string> dirLev3 = bei->getSubdirs();
01652 for (vector<string>::const_iterator it3 = dirLev3.begin(); it3 != dirLev3.end(); it3++)
01653 {
01654
01655 bei->cd(*it3);
01656 if(Tier0Flag_)
01657 for (Int_t l = 0; l < NLev4; l++)
01658 getData(map, type, bei, ff, i, j, k, l);
01659 else
01660 {
01661 Int_t l = 0;
01662 vector<string> dirLev4 = bei->getSubdirs();
01663 for (vector<string>::const_iterator it4 = dirLev4.begin(); it4 != dirLev4.end(); it4++)
01664 {
01665
01666 bei->cd(*it4);
01667 if (isBarrel)
01668 getData(map, type, bei, ff, i, j, k, l++);
01669 else
01670 {
01671 vector<string> dirLev5 = bei->getSubdirs();
01672 for (vector<string>::const_iterator it5 = dirLev5.begin(); it5 != dirLev5.end(); it5++)
01673 {
01674
01675 bei->cd(*it5);
01676 getData(map, type, bei, ff, i, j, k, l++);
01677 }
01678 }
01679 }
01680 }
01681 k++;
01682 }
01683 j++;
01684 }
01685 i++;
01686 }
01687
01688
01689 return 0;
01690 }
01691
01692
01693
01694 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) {
01695
01696
01697 vector<string> contents = bei->getMEs();
01698 for (vector<string>::const_iterator im = contents.begin(); im != contents.end(); im++)
01699 {
01700 if((*im).find(type + "_") == string::npos){
01701
01702 continue;
01703 }
01704
01705 std::string fullpathname = bei->pwd() + "/" + (*im);
01706 MonitorElement* me = bei->get(fullpathname);
01707
01708 if (me) {
01709 TH1F* histo = me->getTH1F();
01710
01711 Int_t nbins = histo->GetNbinsX();
01712
01713 switch (ff){
01714 case EachBinContent:
01715 map[i][j][k][l] = histo->GetBinContent(l + 1);
01716 break;
01717
01718 case Entries:
01719 map[i][j][k][l] = histo->GetEntries();
01720 break;
01721
01722 case Mean:
01723 map[i][j][k][l] = histo->GetMean();
01724 break;
01725
01726 case Sum:
01727 {
01728 Double_t sum = 0;
01729 for(Int_t m = 0; m < nbins; m++)
01730 sum += histo->GetBinContent(m + 1);
01731 map[i][j][k][l] = sum;
01732 }
01733 break;
01734
01735 case WeightedSum:
01736 {
01737 Double_t sum = 0;
01738 for(Int_t m = 0; m < nbins; m++)
01739 sum += histo->GetBinContent(m + 1) * histo->GetBinLowEdge(m + 1);
01740 map[i][j][k][l] = sum;
01741 }
01742 break;
01743
01744 default:
01745 map[i][j][k][l] = 0;
01746 }
01747 }}
01748
01749 }
01750
01751
01752
01753 void SiPixelActionExecutor::prephistosB(MonitorElement* me[NLayer], DQMStore *bei, const Double_t map[][NLev2][NLev3][NLev4],std::string name, Double_t min, Double_t max){
01754
01755 std::string part[] = { "Layer_1", "Layer_2", "Layer_3"};
01756 std::string path = bei->pwd();
01757 for (Int_t i = 0; i < NLayer; i++)
01758 {
01759 std::string fullpath = path + "/" + "TRKMAP_" + name + "_" + part[i];
01760 MonitorElement* temp = bei->get(fullpath);
01761 if(temp)
01762 me[i] = temp;
01763 else
01764 cout << "Problem: " << fullpath << endl;
01765 }
01766
01767 for(Int_t p = 0 ; p < NLayer ; p++){
01768 for(Int_t b = 0 ; b < (10 + 6 * p); b++)
01769 for(Int_t i = 0 ; i < NModuleB ; i++){
01770 me[p]->getTH2F()->SetBinContent(b + 1, i + 1, map[0][p][b][i]);
01771 me[p]->getTH2F()->SetBinContent(b + 1, i + 1 + NModuleB, map[1][p][b][i]);
01772 me[p]->getTH2F()->SetBinContent(b + 1 + 10 + 6 * p, i + 1, map[2][p][b][i]);
01773 me[p]->getTH2F()->SetBinContent(b + 1 + 10 + 6 * p, i + 1 + NModuleB, map[3][p][b][i]);
01774 }
01775 me[p]->getTH2F()->SetMinimum(min);
01776 me[p]->getTH2F()->SetMaximum(max);
01777 }
01778
01779 }
01780
01781
01782
01783 void SiPixelActionExecutor::prephistosE(MonitorElement* me[NCyl], DQMStore *bei, const Double_t map[][NLev2][NLev3][NLev4], std::string name, Double_t min, Double_t max){
01784
01785 std::string part[] = { "Disc_1_M", "Disc_2_M", "Disc_1_P", "Disc_2_P" };
01786 std::string path = bei->pwd();
01787 for (Int_t i = 0; i < NCyl; i++)
01788 {
01789 std::string fullpath = path + "/" + "TRKMAP_" + name + "_" + part[i];
01790 MonitorElement* temp = bei->get(fullpath);
01791 if(temp)
01792 {
01793 me[i] = temp;
01794 me[i]->getTH2F()->SetMinimum(min);
01795 me[i]->getTH2F()->SetMaximum(max);
01796 }
01797 else
01798 cout << "Problem: " << fullpath << endl;
01799 }
01800
01801 for(Int_t c = 0 ; c < NCyl ; c += 2)
01802 for(Int_t d = 0 ; d < NDisk ; d++)
01803 for(Int_t b = 0 ; b < NBlade ; b++){
01804 me[c + d]->getTH2F()->SetBinContent(b + 1, 1, map[c][d][b][0]);
01805 me[c + d]->getTH2F()->SetBinContent(b + 1, 2, map[c][d][b][4]);
01806 me[c + d]->getTH2F()->SetBinContent(b + 1, 3, map[c][d][b][1]);
01807 me[c + d]->getTH2F()->SetBinContent(b + 1, 4, map[c][d][b][5]);
01808 me[c + d]->getTH2F()->SetBinContent(b + 1, 5, map[c][d][b][2]);
01809 me[c + d]->getTH2F()->SetBinContent(b + 1, 6, map[c][d][b][6]);
01810 me[c + d]->getTH2F()->SetBinContent(b + 1, 7, map[c][d][b][3]);
01811
01812 me[c + d]->getTH2F()->SetBinContent(2 * NBlade - b, 1, map[c + 1][d][b][0]);
01813 me[c + d]->getTH2F()->SetBinContent(2 * NBlade - b, 2, map[c + 1][d][b][4]);
01814 me[c + d]->getTH2F()->SetBinContent(2 * NBlade - b, 3, map[c + 1][d][b][1]);
01815 me[c + d]->getTH2F()->SetBinContent(2 * NBlade - b, 4, map[c + 1][d][b][5]);
01816 me[c + d]->getTH2F()->SetBinContent(2 * NBlade - b, 5, map[c + 1][d][b][2]);
01817 me[c + d]->getTH2F()->SetBinContent(2 * NBlade - b, 6, map[c + 1][d][b][6]);
01818 me[c + d]->getTH2F()->SetBinContent(2 * NBlade - b, 7, map[c + 1][d][b][3]);
01819 }
01820
01821 }
01822
01823
01824
01825 Double_t SiPixelActionExecutor::mapMin(const Double_t map[][NLev2][NLev3][NLev4], bool isBarrel){
01826
01827 Double_t min = map[0][0][0][0];
01828
01829 for(Int_t p = 0 ; p < NLev1 ; p++)
01830 for(Int_t d = 0 ; d < (isBarrel?3:2) ; d++)
01831 for(Int_t b = 0 ; b < (isBarrel?(d*6+10):12) ; b++)
01832 for(Int_t i = 0 ; i < (isBarrel?4:7); i++){
01833 if(map[p][d][b][i] < min)
01834 min = map[p][d][b][i];
01835 }
01836
01837 return min;
01838 }
01839
01840
01841
01842 Double_t SiPixelActionExecutor::mapMax(const Double_t map[][NLev2][NLev3][NLev4], bool isBarrel){
01843
01844 Double_t max = map[0][0][0][0];
01845
01846 for(Int_t p = 0 ; p < NLev1 ; p++)
01847 for(Int_t d = 0 ; d < (isBarrel?3:2); d++)
01848 for(Int_t b = 0 ; b < (isBarrel?(d*6+10):12); b++)
01849 for(Int_t i = 0 ; i < (isBarrel?4:7); i++)
01850 if(map[p][d][b][i] > max)
01851 max = map[p][d][b][i];
01852
01853 return max;
01854 }
01855
01856
01857
01858
01859
01860
01861
01862 void SiPixelActionExecutor::setupQTests(DQMStore * bei) {
01863
01864
01865 bei->cd();
01866 bei->cd("Pixel");
01867
01868 string localPath;
01869 if(offlineXMLfile_) localPath = string("DQM/SiPixelMonitorClient/test/sipixel_tier0_qualitytest.xml");
01870 else localPath = string("DQM/SiPixelMonitorClient/test/sipixel_qualitytest_config.xml");
01871 if(!qtHandler_){
01872 qtHandler_ = new QTestHandle();
01873 }
01874 if(!qtHandler_->configureTests(edm::FileInPath(localPath).fullPath(),bei)){
01875 qtHandler_->attachTests(bei,false);
01876 bei->cd();
01877 }else{
01878 cout << " Problem setting up quality tests "<<endl;
01879 }
01880
01881
01882 }
01883
01884
01885
01886
01887 void SiPixelActionExecutor::checkQTestResults(DQMStore * bei) {
01888
01889
01890 int messageCounter=0;
01891 string currDir = bei->pwd();
01892 vector<string> contentVec;
01893 bei->getContents(contentVec);
01894 configParser_->getCalibType(calib_type_);
01895
01896 configParser_->getMessageLimitForQTests(message_limit_);
01897 for (vector<string>::iterator it = contentVec.begin();
01898 it != contentVec.end(); it++) {
01899 vector<string> contents;
01900 int nval = SiPixelUtility::getMEList((*it), contents);
01901 if (nval == 0) continue;
01902 for (vector<string>::const_iterator im = contents.begin();
01903 im != contents.end(); im++) {
01904
01905 MonitorElement * me = bei->get((*im));
01906 if (me) {
01907 me->runQTests();
01908
01909 vector<QReport*> warnings = me->getQWarnings();
01910 for(vector<QReport *>::const_iterator wi = warnings.begin();
01911 wi != warnings.end(); ++wi) {
01912 messageCounter++;
01913 if(messageCounter<message_limit_) {
01914
01915
01916
01917
01918 edm::LogWarning("SiPixelActionExecutor::checkQTestResults") << " *** Warning for " << me->getName() << ","
01919 << (*wi)->getMessage() << " " << me->getMean()
01920 << " " << me->getRMS() << me->hasWarning()
01921 << endl;
01922 }
01923 }
01924 warnings=vector<QReport*>();
01925
01926 vector<QReport *> errors = me->getQErrors();
01927 for(vector<QReport *>::const_iterator ei = errors.begin();
01928 ei != errors.end(); ++ei) {
01929
01930 float empty_mean = me->getMean();
01931 float empty_rms = me->getRMS();
01932 if((empty_mean != 0 && empty_rms != 0) || (calib_type_ == 0)){
01933 messageCounter++;
01934 if(messageCounter<=message_limit_) {
01935
01936
01937
01938
01939 edm::LogWarning("SiPixelActionExecutor::checkQTestResults") << " *** Error for " << me->getName() << ","
01940 << (*ei)->getMessage() << " " << me->getMean()
01941 << " " << me->getRMS()
01942 << endl;
01943 }
01944 }
01945 }
01946 errors=vector<QReport*>();
01947 }
01948 me=0;
01949 }
01950 nval=int(); contents=vector<string>();
01951 }
01952 LogDebug("SiPixelActionExecutor::checkQTestResults") <<"messageCounter: "<<messageCounter<<" , message_limit: "<<message_limit_<<endl;
01953
01954
01955 contentVec=vector<string>(); currDir=string(); messageCounter=int();
01956
01957 }
01958
01959
01960 void SiPixelActionExecutor::createLayout(DQMStore * bei){
01961 if (configWriter_ == 0) {
01962 configWriter_ = new SiPixelConfigWriter();
01963 if (!configWriter_->init()) return;
01964 }
01965 string currDir = bei->pwd();
01966 if (currDir.find("Layer") != string::npos) {
01967 string name = "Default";
01968 configWriter_->createLayout(name);
01969 configWriter_->createRow();
01970 fillLayout(bei);
01971 } else {
01972 vector<string> subdirs = bei->getSubdirs();
01973 for (vector<string>::const_iterator it = subdirs.begin();
01974 it != subdirs.end(); it++) {
01975 bei->cd(*it);
01976 createLayout(bei);
01977 bei->goUp();
01978 }
01979 }
01980 }
01981
01982
01983 void SiPixelActionExecutor::fillLayout(DQMStore * bei){
01984
01985 static int icount = 0;
01986 string currDir = bei->pwd();
01987 if (currDir.find("Ladder_") != string::npos) {
01988
01989 vector<string> contents = bei->getMEs();
01990
01991 for (vector<string>::const_iterator im = contents.begin();
01992 im != contents.end(); im++) {
01993 if ((*im).find("Clusters") != string::npos) {
01994 icount++;
01995 if (icount != 0 && icount%6 == 0) {
01996 configWriter_->createRow();
01997 }
01998 ostringstream full_path;
01999 full_path << "test/" << currDir << "/" << *im ;
02000 string element = "monitorable";
02001 string element_name = full_path.str();
02002 configWriter_->createColumn(element, element_name);
02003 }
02004 }
02005 } else {
02006 vector<string> subdirs = bei->getSubdirs();
02007 for (vector<string>::const_iterator it = subdirs.begin();
02008 it != subdirs.end(); it++) {
02009 bei->cd(*it);
02010 fillLayout(bei);
02011 bei->goUp();
02012 }
02013 }
02014 }
02015
02016
02017
02018
02019
02020 int SiPixelActionExecutor::getTkMapMENames(std::vector<std::string>& names) {
02021 if (tkMapMENames.size() == 0) return 0;
02022 for (vector<string>::iterator it = tkMapMENames.begin();
02023 it != tkMapMENames.end(); it++) {
02024 names.push_back(*it) ;
02025 }
02026 return names.size();
02027 }
02028
02029
02031 void SiPixelActionExecutor::dumpModIds(DQMStore * bei, edm::EventSetup const& eSetup){
02032
02033 bei->cd();
02034 dumpBarrelModIds(bei,eSetup);
02035 bei->cd();
02036 dumpEndcapModIds(bei,eSetup);
02037 bei->cd();
02038
02039 }
02040
02041
02042
02043 void SiPixelActionExecutor::dumpBarrelModIds(DQMStore * bei, edm::EventSetup const& eSetup){
02044 string currDir = bei->pwd();
02045 string dir_name = "Ladder_";
02046 eSetup.get<SiPixelFedCablingMapRcd>().get(theCablingMap);
02047 int fedId=-1; int linkId=-1;
02048 if (currDir.find(dir_name) != string::npos) {
02049 vector<string> subdirs = bei->getSubdirs();
02050 for (vector<string>::const_iterator it = subdirs.begin();
02051 it != subdirs.end(); it++) {
02052 if ( (*it).find("Module_") == string::npos) continue;
02053 bei->cd(*it);
02054 ndet_++;
02055
02056
02057
02058 cout<<bei->pwd();
02059 vector<string> contents = bei->getMEs();
02060 bool first_me = false;
02061 int detId = -999;
02062 for (vector<string>::const_iterator im = contents.begin();
02063 im != contents.end(); im++) {
02064 if(first_me) break;
02065 string mEName = (*im);
02066 string detIdString = mEName.substr((mEName.find_last_of("_"))+1,9);
02067 std::istringstream isst;
02068 isst.str(detIdString);
02069 if(mEName.find("_3")!=string::npos) isst>>detId;
02070 }
02071 bei->goUp();
02072
02073
02074
02075 cout<<" "<<detId;
02076 for(int fedid=0; fedid<=40; ++fedid){
02077 SiPixelFrameConverter converter(theCablingMap.product(),fedid);
02078 uint32_t newDetId = detId;
02079 if(converter.hasDetUnit(newDetId)){
02080 fedId=fedid;
02081 break;
02082 }
02083 }
02084 if(fedId==-1) continue;
02085 sipixelobjects::ElectronicIndex cabling;
02086 SiPixelFrameConverter formatter(theCablingMap.product(),fedId);
02087 sipixelobjects::DetectorIndex detector = {detId, 1, 1};
02088 formatter.toCabling(cabling,detector);
02089 linkId = cabling.link;
02090
02091
02092
02093 cout<<" "<<fedId<<" "<<linkId<<endl;
02094 }
02095 } else {
02096 vector<string> subdirs = bei->getSubdirs();
02097 for (vector<string>::const_iterator it = subdirs.begin();
02098 it != subdirs.end(); it++) {
02099 if((*it).find("Endcap")!=string::npos) continue;
02100 bei->cd(*it);
02101 dumpBarrelModIds(bei,eSetup);
02102 bei->goUp();
02103 }
02104 }
02105 }
02106
02107
02108 void SiPixelActionExecutor::dumpEndcapModIds(DQMStore * bei, edm::EventSetup const& eSetup){
02109 string currDir = bei->pwd();
02110 string dir_name = "Panel_";
02111 eSetup.get<SiPixelFedCablingMapRcd>().get(theCablingMap);
02112 int fedId=-1; int linkId=-1;
02113 if (currDir.find(dir_name) != string::npos) {
02114 vector<string> subdirs = bei->getSubdirs();
02115 for (vector<string>::const_iterator it = subdirs.begin();
02116 it != subdirs.end(); it++) {
02117 if ( (*it).find("Module_") == string::npos) continue;
02118 bei->cd(*it);
02119 ndet_++;
02120
02121
02122
02123 cout<<bei->pwd();
02124 vector<string> contents = bei->getMEs();
02125 bool first_me = false;
02126 int detId = -999;
02127 for (vector<string>::const_iterator im = contents.begin();
02128 im != contents.end(); im++) {
02129 if(first_me) break;
02130 string mEName = (*im);
02131 string detIdString = mEName.substr((mEName.find_last_of("_"))+1,9);
02132 std::istringstream isst;
02133 isst.str(detIdString);
02134 if(mEName.find("_3")!=string::npos) isst>>detId;
02135 }
02136 bei->goUp();
02137
02138
02139
02140 cout<<" "<<detId;
02141 for(int fedid=0; fedid<=40; ++fedid){
02142 SiPixelFrameConverter converter(theCablingMap.product(),fedid);
02143 uint32_t newDetId = detId;
02144 if(converter.hasDetUnit(newDetId)){
02145 fedId=fedid;
02146 break;
02147 }
02148 }
02149 if(fedId==-1) continue;
02150 sipixelobjects::ElectronicIndex cabling;
02151 SiPixelFrameConverter formatter(theCablingMap.product(),fedId);
02152 sipixelobjects::DetectorIndex detector = {detId, 1, 1};
02153 formatter.toCabling(cabling,detector);
02154 linkId = cabling.link;
02155
02156
02157
02158 cout<<" "<<fedId<<" "<<linkId<<endl;
02159 }
02160 } else {
02161 vector<string> subdirs = bei->getSubdirs();
02162 for (vector<string>::const_iterator it = subdirs.begin();
02163 it != subdirs.end(); it++) {
02164 if((bei->pwd()).find("Barrel")!=string::npos) bei->goUp();
02165 bei->cd((*it));
02166 if((*it).find("Barrel")!=string::npos) continue;
02167 dumpEndcapModIds(bei,eSetup);
02168 bei->goUp();
02169 }
02170 }
02171
02172 }
02173
02174
02176 void SiPixelActionExecutor::dumpRefValues(DQMStore * bei, edm::EventSetup const& eSetup){
02177
02178 bei->cd();
02179 dumpBarrelRefValues(bei,eSetup);
02180 bei->cd();
02181 dumpEndcapRefValues(bei,eSetup);
02182 bei->cd();
02183
02184 }
02185
02186
02187
02188 void SiPixelActionExecutor::dumpBarrelRefValues(DQMStore * bei, edm::EventSetup const& eSetup){
02189 MonitorElement* me;
02190 me = bei->get("Pixel/Barrel/SUMDIG_adc_Barrel");
02191 if(me){
02192 std::cout<<"SUMDIG_adc_Barrel: "<<std::endl;
02193 for(int i=1; i!=769; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
02194 }
02195 me = bei->get("Pixel/Barrel/SUMDIG_ndigis_Barrel");
02196 if(me){
02197 std::cout<<"SUMDIG_ndigis_Barrel: "<<std::endl;
02198 for(int i=1; i!=769; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
02199 }
02200 me = bei->get("Pixel/Barrel/SUMCLU_charge_Barrel");
02201 if(me){
02202 std::cout<<"SUMCLU_charge_Barrel: "<<std::endl;
02203 for(int i=1; i!=769; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
02204 }
02205 me = bei->get("Pixel/Barrel/SUMCLU_nclusters_Barrel");
02206 if(me){
02207 std::cout<<"SUMCLU_nclusters_Barrel: "<<std::endl;
02208 for(int i=1; i!=769; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
02209 }
02210 me = bei->get("Pixel/Barrel/SUMCLU_size_Barrel");
02211 if(me){
02212 std::cout<<"SUMCLU_size_Barrel: "<<std::endl;
02213 for(int i=1; i!=769; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
02214 }
02215 }
02216
02217
02218 void SiPixelActionExecutor::dumpEndcapRefValues(DQMStore * bei, edm::EventSetup const& eSetup){
02219 MonitorElement* me;
02220 me = bei->get("Pixel/Endcap/SUMDIG_adc_Endcap");
02221 if(me){
02222 std::cout<<"SUMDIG_adc_Endcap: "<<std::endl;
02223 for(int i=1; i!=673; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
02224 }
02225 me = bei->get("Pixel/Endcap/SUMDIG_ndigis_Endcap");
02226 if(me){
02227 std::cout<<"SUMDIG_ndigis_Endcap: "<<std::endl;
02228 for(int i=1; i!=673; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
02229 }
02230 me = bei->get("Pixel/Endcap/SUMCLU_charge_Endcap");
02231 if(me){
02232 std::cout<<"SUMCLU_charge_Endcap: "<<std::endl;
02233 for(int i=1; i!=673; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
02234 }
02235 me = bei->get("Pixel/Endcap/SUMCLU_nclusters_Endcap");
02236 if(me){
02237 std::cout<<"SUMCLU_nclusters_Endcap: "<<std::endl;
02238 for(int i=1; i!=673; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
02239 }
02240 me = bei->get("Pixel/Endcap/SUMCLU_size_Endcap");
02241 if(me){
02242 std::cout<<"SUMCLU_size_Endcap: "<<std::endl;
02243 for(int i=1; i!=673; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
02244 }
02245 }
02246
02247
02248
02249 void SiPixelActionExecutor::bookEfficiency(DQMStore * bei){
02250
02251 bei->cd();
02252 bei->setCurrentFolder("Pixel/Barrel");
02253 if(Tier0Flag_){
02254 HitEfficiency_L1 = bei->book2D("HitEfficiency_L1","Hit Efficiency in Barrel_Layer1;z-side;Ladder",2,-1.,1.,20,-10.,10.);
02255 HitEfficiency_L2 = bei->book2D("HitEfficiency_L2","Hit Efficiency in Barrel_Layer2;z-side;Ladder",2,-1.,1.,32,-16.,16.);
02256 HitEfficiency_L3 = bei->book2D("HitEfficiency_L3","Hit Efficiency in Barrel_Layer3;z-side;Ladder",2,-1.,1.,44,-22.,22.);
02257 }else{
02258 HitEfficiency_L1 = bei->book2D("HitEfficiency_L1","Hit Efficiency in Barrel_Layer1;Module;Ladder",8,-4.,4.,20,-10.,10.);
02259 HitEfficiency_L2 = bei->book2D("HitEfficiency_L2","Hit Efficiency in Barrel_Layer2;Module;Ladder",8,-4.,4.,32,-16.,16.);
02260 HitEfficiency_L3 = bei->book2D("HitEfficiency_L3","Hit Efficiency in Barrel_Layer3;Module;Ladder",8,-4.,4.,44,-22.,22.);
02261 }
02262
02263 bei->cd();
02264 bei->setCurrentFolder("Pixel/Endcap");
02265 if(Tier0Flag_){
02266 HitEfficiency_Dp1 = bei->book2D("HitEfficiency_Dp1","Hit Efficiency in Endcap_Disk_p1;Blades;",24,-12.,12.,1,0.,1.);
02267 HitEfficiency_Dp2 = bei->book2D("HitEfficiency_Dp2","Hit Efficiency in Endcap_Disk_p2;Blades;",24,-12.,12.,1,0.,1.);
02268 HitEfficiency_Dm1 = bei->book2D("HitEfficiency_Dm1","Hit Efficiency in Endcap_Disk_m1;Blades;",24,-12.,12.,1,0.,1.);
02269 HitEfficiency_Dm2 = bei->book2D("HitEfficiency_Dm2","Hit Efficiency in Endcap_Disk_m2;Blades;",24,-12.,12.,1,0.,1.);
02270 }else{
02271 HitEfficiency_Dp1 = bei->book2D("HitEfficiency_Dp1","Hit Efficiency in Endcap_Disk_p1;Blades;Modules",24,-12.,12.,7,1.,8.);
02272 HitEfficiency_Dp2 = bei->book2D("HitEfficiency_Dp2","Hit Efficiency in Endcap_Disk_p2;Blades;Modules",24,-12.,12.,7,1.,8.);
02273 HitEfficiency_Dm1 = bei->book2D("HitEfficiency_Dm1","Hit Efficiency in Endcap_Disk_m1;Blades;Modules",24,-12.,12.,7,1.,8.);
02274 HitEfficiency_Dm2 = bei->book2D("HitEfficiency_Dm2","Hit Efficiency in Endcap_Disk_m2;Blades;Modules",24,-12.,12.,7,1.,8.);
02275 }
02276 }
02277
02278
02279
02280 void SiPixelActionExecutor::createEfficiency(DQMStore * bei){
02281
02282 bei->cd();
02283 fillEfficiency(bei, true);
02284 bei->cd();
02285 fillEfficiency(bei, false);
02286 bei->cd();
02287
02288 }
02289
02290
02291
02292 void SiPixelActionExecutor::fillEfficiency(DQMStore* bei, bool isbarrel){
02293
02294 string currDir = bei->pwd();
02295 string dname = currDir.substr(currDir.find_last_of("/")+1);
02296
02297
02298 if(Tier0Flag_){
02299 if(isbarrel && dname.find("Ladder_")!=string::npos){
02300 vector<string> meVec = bei->getMEs();
02301 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
02302 string full_path = currDir + "/" + (*it);
02303 if(full_path.find("missing_")!=string::npos){
02304 MonitorElement * me = bei->get(full_path);
02305 if (!me) continue;
02306 float missingHits = me->getEntries();
02307
02308 string new_path = full_path.replace(full_path.find("missing"),7,"valid");
02309 me = bei->get(new_path);
02310 if (!me) continue;
02311 float validHits = me->getEntries();
02312
02313 float hitEfficiency = -1.;
02314 if(validHits + missingHits > 0.) hitEfficiency = validHits / (validHits + missingHits);
02315
02316 int binx = 0; int biny = 0;
02317 if(currDir.find("Shell_m")!=string::npos){ binx = 1;}else{ binx = 2;}
02318 if(dname.find("01")!=string::npos){ biny = 1;}else if(dname.find("02")!=string::npos){ biny = 2;}
02319 else if(dname.find("03")!=string::npos){ biny = 3;}else if(dname.find("04")!=string::npos){ biny = 4;}
02320 else if(dname.find("05")!=string::npos){ biny = 5;}else if(dname.find("06")!=string::npos){ biny = 6;}
02321 else if(dname.find("07")!=string::npos){ biny = 7;}else if(dname.find("08")!=string::npos){ biny = 8;}
02322 else if(dname.find("09")!=string::npos){ biny = 9;}else if(dname.find("10")!=string::npos){ biny = 10;}
02323 else if(dname.find("11")!=string::npos){ biny = 11;}else if(dname.find("12")!=string::npos){ biny = 12;}
02324 else if(dname.find("13")!=string::npos){ biny = 13;}else if(dname.find("14")!=string::npos){ biny = 14;}
02325 else if(dname.find("15")!=string::npos){ biny = 15;}else if(dname.find("16")!=string::npos){ biny = 16;}
02326 else if(dname.find("17")!=string::npos){ biny = 17;}else if(dname.find("18")!=string::npos){ biny = 18;}
02327 else if(dname.find("19")!=string::npos){ biny = 19;}else if(dname.find("20")!=string::npos){ biny = 20;}
02328 else if(dname.find("21")!=string::npos){ biny = 21;}else if(dname.find("22")!=string::npos){ biny = 22;}
02329 if(currDir.find("Shell_mO")!=string::npos || currDir.find("Shell_pO")!=string::npos){
02330 if(currDir.find("Layer_1")!=string::npos){ biny = biny + 10;}
02331 else if(currDir.find("Layer_2")!=string::npos){ biny = biny + 16;}
02332 else if(currDir.find("Layer_3")!=string::npos){ biny = biny + 22;}
02333 }
02334 if(currDir.find("Layer_1")!=string::npos){
02335 HitEfficiency_L1 = bei->get("Pixel/Barrel/HitEfficiency_L1");
02336 if(HitEfficiency_L1) HitEfficiency_L1->setBinContent(binx, biny,(float)hitEfficiency);
02337
02338 }else if(currDir.find("Layer_2")!=string::npos){
02339 HitEfficiency_L2 = bei->get("Pixel/Barrel/HitEfficiency_L2");
02340 if(HitEfficiency_L2) HitEfficiency_L2->setBinContent(binx, biny,(float)hitEfficiency);
02341 }else if(currDir.find("Layer_3")!=string::npos){
02342 HitEfficiency_L3 = bei->get("Pixel/Barrel/HitEfficiency_L3");
02343 if(HitEfficiency_L3) HitEfficiency_L3->setBinContent(binx, biny,(float)hitEfficiency);
02344 }
02345 }
02346 }
02347 }else if(!isbarrel && dname.find("Blade_")!=string::npos){
02348 vector<string> meVec = bei->getMEs();
02349 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
02350 string full_path = currDir + "/" + (*it);
02351 if(full_path.find("missing_")!=string::npos){
02352 MonitorElement * me = bei->get(full_path);
02353 if (!me) continue;
02354 float missingHits = me->getEntries();
02355 string new_path = full_path.replace(full_path.find("missing"),7,"valid");
02356 me = bei->get(new_path);
02357 if (!me) continue;
02358 float validHits = me->getEntries();
02359 float hitEfficiency = -1.;
02360 if(validHits + missingHits > 0.) hitEfficiency = validHits / (validHits + missingHits);
02361 int binx = 0; int biny = 1;
02362 if(currDir.find("01")!=string::npos){ binx = 1;}else if(currDir.find("02")!=string::npos){ binx = 2;}
02363 else if(currDir.find("03")!=string::npos){ binx = 3;}else if(currDir.find("04")!=string::npos){ binx = 4;}
02364 else if(currDir.find("05")!=string::npos){ binx = 5;}else if(currDir.find("06")!=string::npos){ binx = 6;}
02365 else if(currDir.find("07")!=string::npos){ binx = 7;}else if(currDir.find("08")!=string::npos){ binx = 8;}
02366 else if(currDir.find("09")!=string::npos){ binx = 9;}else if(currDir.find("10")!=string::npos){ binx = 10;}
02367 else if(currDir.find("11")!=string::npos){ binx = 11;}else if(currDir.find("12")!=string::npos){ binx = 12;}
02368 if(currDir.find("HalfCylinder_mI")!=string::npos || currDir.find("HalfCylinder_pI")!=string::npos){ binx = binx + 12;}
02369 else{
02370 if(binx==1) binx = 12;
02371 else if(binx==2) binx = 11;
02372 else if(binx==3) binx = 10;
02373 else if(binx==4) binx = 9;
02374 else if(binx==5) binx = 8;
02375 else if(binx==6) binx = 7;
02376 else if(binx==7) binx = 6;
02377 else if(binx==8) binx = 5;
02378 else if(binx==9) binx = 4;
02379 else if(binx==10) binx = 3;
02380 else if(binx==11) binx = 2;
02381 else if(binx==12) binx = 1;
02382 }
02383 if(currDir.find("Disk_1")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
02384 HitEfficiency_Dm1 = bei->get("Pixel/Endcap/HitEfficiency_Dm1");
02385 if(HitEfficiency_Dm1) HitEfficiency_Dm1->setBinContent(binx, biny, (float)hitEfficiency);
02386 }else if(currDir.find("Disk_2")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
02387 HitEfficiency_Dm2 = bei->get("Pixel/Endcap/HitEfficiency_Dm2");
02388 if(HitEfficiency_Dm2) HitEfficiency_Dm2->setBinContent(binx, biny, (float)hitEfficiency);
02389 }else if(currDir.find("Disk_1")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
02390 HitEfficiency_Dp1 = bei->get("Pixel/Endcap/HitEfficiency_Dp1");
02391 if(HitEfficiency_Dp1) HitEfficiency_Dp1->setBinContent(binx, biny, (float)hitEfficiency);
02392 }else if(currDir.find("Disk_2")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
02393 HitEfficiency_Dp2 = bei->get("Pixel/Endcap/HitEfficiency_Dp2");
02394 if(HitEfficiency_Dp2) HitEfficiency_Dp2->setBinContent(binx, biny, (float)hitEfficiency);
02395 }
02396
02397 }
02398 }
02399 }else{
02400
02401 vector<string> subdirs = bei->getSubdirs();
02402 for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++) {
02403 bei->cd(*it);
02404
02405 if(*it != "Pixel" && ((isbarrel && (*it).find("Barrel")==string::npos) || (!isbarrel && (*it).find("Endcap")==string::npos))) continue;
02406
02407 fillEfficiency(bei, isbarrel);
02408 bei->goUp();
02409 }
02410 }
02411 }else{
02412 if(dname.find("Module_")!=string::npos){
02413 vector<string> meVec = bei->getMEs();
02414 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
02415 string full_path = currDir + "/" + (*it);
02416 if(full_path.find("missing_")!=string::npos){
02417 MonitorElement * me = bei->get(full_path);
02418 if (!me) continue;
02419 float missingHits = me->getEntries();
02420 string new_path = full_path.replace(full_path.find("missing"),7,"valid");
02421 me = bei->get(new_path);
02422 if (!me) continue;
02423 float validHits = me->getEntries();
02424 float hitEfficiency = -1.;
02425 if(validHits + missingHits > 0.) hitEfficiency = validHits / (validHits + missingHits);
02426 int binx = 0; int biny = 0;
02427 if(isbarrel){
02428 if(currDir.find("Shell_m")!=string::npos){
02429 if(currDir.find("Module_4")!=string::npos){ binx = 1;}else if(currDir.find("Module_3")!=string::npos){ binx = 2;}
02430 if(currDir.find("Module_2")!=string::npos){ binx = 3;}else if(currDir.find("Module_1")!=string::npos){ binx = 4;}
02431 }else if(currDir.find("Shell_p")!=string::npos){
02432 if(currDir.find("Module_1")!=string::npos){ binx = 5;}else if(currDir.find("Module_2")!=string::npos){ binx = 6;}
02433 if(currDir.find("Module_3")!=string::npos){ binx = 7;}else if(currDir.find("Module_4")!=string::npos){ binx = 8;}
02434 }
02435 if(currDir.find("01")!=string::npos){ biny = 1;}else if(currDir.find("02")!=string::npos){ biny = 2;}
02436 else if(currDir.find("03")!=string::npos){ biny = 3;}else if(currDir.find("04")!=string::npos){ biny = 4;}
02437 else if(currDir.find("05")!=string::npos){ biny = 5;}else if(currDir.find("06")!=string::npos){ biny = 6;}
02438 else if(currDir.find("07")!=string::npos){ biny = 7;}else if(currDir.find("08")!=string::npos){ biny = 8;}
02439 else if(currDir.find("09")!=string::npos){ biny = 9;}else if(currDir.find("10")!=string::npos){ biny = 10;}
02440 else if(currDir.find("11")!=string::npos){ biny = 11;}else if(currDir.find("12")!=string::npos){ biny = 12;}
02441 else if(currDir.find("13")!=string::npos){ biny = 13;}else if(currDir.find("14")!=string::npos){ biny = 14;}
02442 else if(currDir.find("15")!=string::npos){ biny = 15;}else if(currDir.find("16")!=string::npos){ biny = 16;}
02443 else if(currDir.find("17")!=string::npos){ biny = 17;}else if(currDir.find("18")!=string::npos){ biny = 18;}
02444 else if(currDir.find("19")!=string::npos){ biny = 19;}else if(currDir.find("20")!=string::npos){ biny = 20;}
02445 else if(currDir.find("21")!=string::npos){ biny = 21;}else if(currDir.find("22")!=string::npos){ biny = 22;}
02446 if(currDir.find("Shell_mO")!=string::npos || currDir.find("Shell_pO")!=string::npos){
02447 if(currDir.find("Layer_1")!=string::npos){ biny = biny + 10;}
02448 else if(currDir.find("Layer_2")!=string::npos){ biny = biny + 16;}
02449 else if(currDir.find("Layer_3")!=string::npos){ biny = biny + 22;}
02450 }
02451 }else{
02452 if(currDir.find("01")!=string::npos){ binx = 1;}else if(currDir.find("02")!=string::npos){ binx = 2;}
02453 else if(currDir.find("03")!=string::npos){ binx = 3;}else if(currDir.find("04")!=string::npos){ binx = 4;}
02454 else if(currDir.find("05")!=string::npos){ binx = 5;}else if(currDir.find("06")!=string::npos){ binx = 6;}
02455 else if(currDir.find("07")!=string::npos){ binx = 7;}else if(currDir.find("08")!=string::npos){ binx = 8;}
02456 else if(currDir.find("09")!=string::npos){ binx = 9;}else if(currDir.find("10")!=string::npos){ binx = 10;}
02457 else if(currDir.find("11")!=string::npos){ binx = 11;}else if(currDir.find("12")!=string::npos){ binx = 12;}
02458 if(currDir.find("HalfCylinder_mO")!=string::npos || currDir.find("HalfCylinder_pO")!=string::npos){ binx = binx + 12;}
02459 if(currDir.find("Panel_1/Module_1")!=string::npos){ biny = 1;}else if(currDir.find("Panel_2/Module_1")!=string::npos){ biny = 2;}
02460 else if(currDir.find("Panel_1/Module_2")!=string::npos){ biny = 3;}else if(currDir.find("Panel_2/Module_2")!=string::npos){ biny = 4;}
02461 else if(currDir.find("Panel_1/Module_3")!=string::npos){ biny = 5;}else if(currDir.find("Panel_2/Module_3")!=string::npos){ biny = 6;}
02462 else if(currDir.find("Panel_1/Module_4")!=string::npos){ biny = 7;}
02463 }
02464
02465 if(currDir.find("Layer_1")!=string::npos){
02466 HitEfficiency_L1 = bei->get("Pixel/Barrel/HitEfficiency_L1");
02467 if(HitEfficiency_L1) HitEfficiency_L1->setBinContent(binx, biny,(float)hitEfficiency);
02468 }else if(currDir.find("Layer_2")!=string::npos){
02469 HitEfficiency_L2 = bei->get("Pixel/Barrel/HitEfficiency_L2");
02470 if(HitEfficiency_L2) HitEfficiency_L2->setBinContent(binx, biny,(float)hitEfficiency);
02471 }else if(currDir.find("Layer_3")!=string::npos){
02472 HitEfficiency_L3 = bei->get("Pixel/Barrel/HitEfficiency_L3");
02473 if(HitEfficiency_L3) HitEfficiency_L3->setBinContent(binx, biny,(float)hitEfficiency);
02474 }else if(currDir.find("Disk_1")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
02475 HitEfficiency_Dm1 = bei->get("Pixel/Endcap/HitEfficiency_Dm1");
02476 if(HitEfficiency_Dm1) HitEfficiency_Dm1->setBinContent(binx, biny,(float)hitEfficiency);
02477 }else if(currDir.find("Disk_2")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
02478 HitEfficiency_Dm2 = bei->get("Pixel/Endcap/HitEfficiency_Dm2");
02479 if(HitEfficiency_Dm2) HitEfficiency_Dm2->setBinContent(binx, biny,(float)hitEfficiency);
02480 }else if(currDir.find("Disk_1")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
02481 HitEfficiency_Dp1 = bei->get("Pixel/Endcap/HitEfficiency_Dp1");
02482 if(HitEfficiency_Dp1) HitEfficiency_Dp1->setBinContent(binx, biny,(float)hitEfficiency);
02483 }else if(currDir.find("Disk_2")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
02484 HitEfficiency_Dp2 = bei->get("Pixel/Endcap/HitEfficiency_Dp2");
02485 if(HitEfficiency_Dp2) HitEfficiency_Dp2->setBinContent(binx, biny,(float)hitEfficiency);
02486 }
02487 }
02488 }
02489 }else{
02490
02491 vector<string> subdirs = bei->getSubdirs();
02492 for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++) {
02493 bei->cd(*it);
02494
02495 if(*it != "Pixel" && ((isbarrel && (*it).find("Barrel")==string::npos) || (!isbarrel && (*it).find("Endcap")==string::npos))) continue;
02496
02497 fillEfficiency(bei, isbarrel);
02498 bei->goUp();
02499 }
02500 }
02501 }
02502
02503
02504
02505 }