CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/DQM/DTMonitorClient/src/DTCreateSummaryHistos.cc

Go to the documentation of this file.
00001 
00002 /*
00003  *  See header file for a description of this class.
00004  *
00005  *  $Date: 2011/11/24 09:17:30 $
00006  *  $Revision: 1.6 $
00007  *  \author G. Mila - INFN Torino
00008  */
00009 
00010 
00011 #include <DQM/DTMonitorClient/src/DTCreateSummaryHistos.h>
00012 
00013 // Framework
00014 #include <FWCore/Framework/interface/EventSetup.h>
00015 
00016 
00017 // Geometry
00018 #include "Geometry/Records/interface/MuonGeometryRecord.h"
00019 #include "Geometry/DTGeometry/interface/DTGeometry.h"
00020 #include "Geometry/DTGeometry/interface/DTLayer.h"
00021 
00022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00023 
00024 #include <stdio.h>
00025 #include <sstream>
00026 #include <math.h>
00027 
00028 #include "TCanvas.h"
00029 #include "TFile.h"
00030 #include "TProfile.h"
00031 
00032 using namespace edm;
00033 using namespace std;
00034 
00035 DTCreateSummaryHistos::DTCreateSummaryHistos(const edm::ParameterSet& ps){
00036 
00037   edm::LogVerbatim ("histos") << "[DTCreateSummaryHistos]: Constructor";
00038 
00039   parameters = ps;
00040 
00041   // The root file which contain the histos
00042   string rootFileName = ps.getUntrackedParameter<string>("rootFileName", "DTEfficiencyTest.root");
00043   theFile = new TFile(rootFileName.c_str(), "READ");
00044 
00045    // The *.ps file which contains the summary histos
00046   PsFileName = ps.getUntrackedParameter<string>("PsFileName", "DTSummaryHistos");
00047 
00048   // Files to write in the *.ps file
00049   DataIntegrityHistos = ps.getUntrackedParameter<bool>("DataIntegrityHistos", false);
00050   DigiHistos = ps.getUntrackedParameter<bool>("DigiHistos", false);
00051   RecoHistos = ps.getUntrackedParameter<bool>("RecoHistos", false);
00052   ResoHistos = ps.getUntrackedParameter<bool>("ResoHistos", false);
00053   EfficiencyHistos = ps.getUntrackedParameter<bool>("EfficiencyHistos", false);
00054   TestPulsesHistos = ps.getUntrackedParameter<bool>("TestPulsesHistos", false);
00055   TriggerHistos = ps.getUntrackedParameter<bool>("TriggerHistos", false);
00056 
00057   // The DDU Id
00058   DDUId = ps.getUntrackedParameter<int>("DDUId");
00059 
00060   MainFolder = "DQMData/DT/";
00061 }
00062 
00063 DTCreateSummaryHistos::~DTCreateSummaryHistos(){
00064 
00065   edm::LogVerbatim ("histos") << "DTCreateSummaryHistos: analyzed " << nevents << " events";
00066   theFile->Close();
00067 
00068 }
00069 
00070 
00071 void DTCreateSummaryHistos::beginJob(){
00072 
00073   edm::LogVerbatim ("histos") << "[DTCreateSummaryHistos]: BeginJob";
00074 
00075   nevents = 0;
00076 
00077 }
00078 
00079 void DTCreateSummaryHistos::beginRun(const edm::Run& run, const edm::EventSetup& context){
00080 
00081   // Get the geometry
00082   context.get<MuonGeometryRecord>().get(muonGeom);
00083 
00084 }
00085 
00086 void DTCreateSummaryHistos::analyze(const edm::Event& e, const edm::EventSetup& context){
00087   
00088   nevents++;
00089   runNumber = e.id().run();
00090 
00091 }
00092 
00093 
00094 void DTCreateSummaryHistos::endJob(){
00095 
00096   edm::LogVerbatim ("histos") << "[DTCreateSummaryHistos] endjob called!";
00097 
00098   stringstream RunNum; RunNum << runNumber;
00099   string PsFileNameWithRun = PsFileName + "_" + RunNum.str() + ".ps";
00100   TPostScript psFile(PsFileNameWithRun.c_str(),111);
00101   psFile.Range(20,26);
00102   //psFile.NewPage();
00103   TCanvas c1("c1","",600,780);
00104 
00105 
00106 
00107   // DataIntegrity summary histos **************************************************************
00108   if(DataIntegrityHistos){
00109     c1.Clear();
00110     c1.Divide(2,2);    
00111     stringstream dduID; dduID << DDUId;
00112 
00113     string histo_name1 = MainFolder + "DataIntegrity/FED" + dduID.str() + "/FED" + dduID.str() + "_TTSValues";
00114     TH1F *histo1 = (TH1F*) theFile -> Get(histo_name1.c_str());
00115     c1.cd(1);
00116     if(histo1)
00117       histo1->Draw();
00118     
00119     string histo_name2 = MainFolder + "DataIntegrity/FED" + dduID.str() + "/FED" + dduID.str() + "_ROSStatus";
00120     TH1F *histo2 = (TH1F*) theFile -> Get(histo_name2.c_str());
00121     c1.cd(2);
00122     if(histo2)
00123       histo2->Draw();
00124     
00125     string histo_name3 = MainFolder + "DataIntegrity/FED" + dduID.str() + "/FED" + dduID.str() + "_ROSSummary";
00126     TH1F *histo3 = (TH1F*) theFile -> Get(histo_name3.c_str());
00127     c1.cd(3);
00128     if(histo3)
00129     histo3->Draw();
00130     
00131     string histo_name4 = MainFolder + "DataIntegrity/FED" + dduID.str() + "/ROS1/FED" + dduID.str() + "_ROS1_ROSError";
00132     TH1F *histo4 = (TH1F*) theFile -> Get(histo_name4.c_str());
00133     c1.cd(4);
00134     if(histo4)
00135       histo4->Draw();
00136     
00137     c1.Update();
00138     psFile.NewPage();
00139   }
00140 
00141   // Digi summary histos  ********************************************************************
00142   if(DigiHistos){
00143     // Time Box Histos
00144     c1.Clear();
00145     c1.Divide(3,4);
00146     // Loop over all the chambers
00147     vector<DTChamber*>::const_iterator ch_digi_it = muonGeom->chambers().begin();
00148     vector<DTChamber*>::const_iterator ch_digi_end = muonGeom->chambers().end();
00149     for (; ch_digi_it != ch_digi_end; ++ch_digi_it) {
00150       DTChamberId ch = (*ch_digi_it)->id();
00151       stringstream wheel; wheel << ch.wheel();
00152       stringstream station; station << ch.station();
00153       stringstream sector; sector << ch.sector();
00154       vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_digi_it)->superLayers().begin(); 
00155       vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_digi_it)->superLayers().end();
00156       // Loop over the SLs
00157       for(; sl_it != sl_end; ++sl_it) {
00158         DTSuperLayerId sl = (*sl_it)->id();
00159         stringstream superLayer; superLayer << sl.superlayer();
00160         
00161         string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str();
00162         string histo_name = digiFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/TimeBoxes/TimeBox_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str()+ "_SL" + superLayer.str();
00163         TH1F *histo = (TH1F *) theFile->Get(histo_name.c_str());
00164         if(histo){
00165           int pad = (ch.station() - 1)*3 + sl.superlayer();
00166           c1.cd(pad);
00167           histo->Draw();
00168         }
00169       }
00170     }
00171     c1.Update();
00172     psFile.NewPage();
00173     
00174     // Occupancy in Time Histos
00175     c1.Clear();
00176     c1.Divide(4,3);
00177     // Loop over all the chambers
00178     vector<DTChamber*>::const_iterator ch_digi2_it = muonGeom->chambers().begin();
00179     vector<DTChamber*>::const_iterator ch_digi2_end = muonGeom->chambers().end();
00180     for (; ch_digi2_it != ch_digi2_end; ++ch_digi2_it) {
00181       DTChamberId ch = (*ch_digi2_it)->id();
00182       stringstream wheel; wheel << ch.wheel();
00183       stringstream station; station << ch.station();
00184       stringstream sector; sector << ch.sector();
00185       bool found = false;
00186       vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_digi2_it)->superLayers().begin(); 
00187       vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_digi2_it)->superLayers().end();
00188       // Loop over the SLs
00189       for(; sl_it != sl_end; ++sl_it) {
00190         DTSuperLayerId sl = (*sl_it)->id();
00191         vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin(); 
00192         vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
00193         stringstream superLayer; superLayer << sl.superlayer();
00194         // Loop over the Ls
00195         for(; l_it != l_end; ++l_it) {
00196           DTLayerId layerId = (*l_it)->id();
00197           stringstream layer; layer << layerId.layer();
00198           
00199           string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str();
00200           string histo_name = digiFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/Occupancies/OccupancyInTimeHits_perL_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str()+ "_SL" + superLayer.str() + "_L" + layer.str();     
00201           TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00202           if(histo){
00203             found = true;
00204             int pad = (sl.superlayer() - 1)*4 + layerId.layer();
00205             c1.cd(pad);
00206             histo->Draw();
00207           }
00208         }
00209       }
00210       if(found){
00211         c1.Update();
00212         psFile.NewPage();
00213       }
00214     }
00215     
00216     // Occupancy Noise
00217     // Loop over all the chambers
00218     vector<DTChamber*>::const_iterator ch_digi3_it = muonGeom->chambers().begin();
00219     vector<DTChamber*>::const_iterator ch_digi3_end = muonGeom->chambers().end();
00220     for (; ch_digi3_it != ch_digi3_end; ++ch_digi3_it) {
00221       DTChamberId ch = (*ch_digi3_it)->id();
00222       stringstream wheel; wheel << ch.wheel();
00223       stringstream station; station << ch.station();
00224       stringstream sector; sector << ch.sector();
00225       bool found = false;
00226       vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_digi3_it)->superLayers().begin(); 
00227       vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_digi3_it)->superLayers().end();
00228       // Loop over the SLs
00229       for(; sl_it != sl_end; ++sl_it) {
00230         DTSuperLayerId sl = (*sl_it)->id();
00231         vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin(); 
00232         vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
00233         stringstream superLayer; superLayer << sl.superlayer();
00234         // Loop over the Ls
00235         for(; l_it != l_end; ++l_it) {
00236           DTLayerId layerId = (*l_it)->id();
00237           stringstream layer; layer << layerId.layer();
00238           
00239           string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str();
00240           string histo_name = digiFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/Occupancies/OccupancyNoise_perL_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str()+ "_SL" + superLayer.str() + "_L" + layer.str(); 
00241           TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00242           if(histo){
00243             found = true;
00244             int pad = (sl.superlayer() - 1)*4 + layerId.layer();
00245             c1.cd(pad);
00246             histo->Draw();
00247           }
00248         }
00249       }
00250       if(found) {
00251         c1.Update();
00252         psFile.NewPage();
00253       }
00254     }
00255     
00256     // Digi Per Event
00257     // Loop over all the chambers
00258     vector<DTChamber*>::const_iterator ch_digi4_it = muonGeom->chambers().begin();
00259     vector<DTChamber*>::const_iterator ch_digi4_end = muonGeom->chambers().end();
00260     for (; ch_digi4_it != ch_digi4_end; ++ch_digi4_it) {
00261       DTChamberId ch = (*ch_digi4_it)->id();
00262       stringstream wheel; wheel << ch.wheel();
00263       stringstream station; station << ch.station();
00264       stringstream sector; sector << ch.sector();
00265       bool found = false;
00266       vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_digi4_it)->superLayers().begin(); 
00267       vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_digi4_it)->superLayers().end();
00268       // Loop over the SLs
00269       for(; sl_it != sl_end; ++sl_it) {
00270         DTSuperLayerId sl = (*sl_it)->id();
00271         vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin(); 
00272         vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
00273         stringstream superLayer; superLayer << sl.superlayer();
00274         // Loop over the Ls
00275         for(; l_it != l_end; ++l_it) {
00276           DTLayerId layerId = (*l_it)->id();
00277           stringstream layer; layer << layerId.layer();
00278           
00279           string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str();
00280           string histo_name = digiFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/DigiPerEvent/DigiPerEvent_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str();
00281           TProfile *histo = (TProfile*) theFile -> Get(histo_name.c_str());
00282           if(histo){
00283             found = true;
00284             int pad = (sl.superlayer() - 1)*4 + layerId.layer();
00285             c1.cd(pad);
00286             histo->Draw();
00287           }
00288         }
00289       }
00290       if(found){
00291         c1.Update();
00292         psFile.NewPage();
00293       }
00294     }
00295   }
00296   
00297   // Reconstruction summary histos  *********************************************************
00298   if(RecoHistos){
00299     // reco segment Histos - page1
00300     c1.Clear(); 
00301     c1.Divide(2,4);
00302     // Loop over all the chambers
00303     vector<DTChamber*>::const_iterator ch_reco_it = muonGeom->chambers().begin();
00304     vector<DTChamber*>::const_iterator ch_reco_end = muonGeom->chambers().end();
00305     for (; ch_reco_it != ch_reco_end; ++ch_reco_it) {
00306       DTChamberId ch = (*ch_reco_it)->id();
00307       stringstream wheel; wheel << ch.wheel();
00308       stringstream station; station << ch.station();
00309       stringstream sector; sector << ch.sector();
00310       
00311       string recoFolder = MainFolder + "DTSegmentAnalysisTask/Wheel" + wheel.str();
00312       string histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/hN4DSeg_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();  
00313       TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00314       if(histo){
00315         int pad = (ch.station() - 1)*2 + 1;
00316         c1.cd(pad);
00317         histo->Draw();
00318       }
00319       histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/h4DSegmXvsYInCham_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
00320       TProfile *histo2 = (TProfile*) theFile -> Get(histo_name.c_str());
00321       if(histo2){
00322         int pad = (ch.station() - 1)*2 + 2;
00323         c1.cd(pad);
00324         histo2->Draw();
00325       }
00326     }
00327     c1.Update();
00328     psFile.NewPage();
00329     
00330     // reco segment Histos - page2
00331     // Loop over all the chambers
00332     vector<DTChamber*>::const_iterator ch_reco2_it = muonGeom->chambers().begin();
00333     vector<DTChamber*>::const_iterator ch_reco2_end = muonGeom->chambers().end();
00334     for (; ch_reco2_it != ch_reco2_end; ++ch_reco2_it) {
00335       DTChamberId ch = (*ch_reco2_it)->id();
00336       stringstream wheel; wheel << ch.wheel();
00337       stringstream station; station << ch.station();
00338       stringstream sector; sector << ch.sector();
00339       
00340       string recoFolder = MainFolder + "DTSegmentAnalysisTask/Wheel" + wheel.str();
00341       string histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/h4DSegmPhiDirection_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
00342       TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00343       if(histo) {
00344         int pad = (ch.station() - 1)*2 + 1;
00345         c1.cd(pad);
00346         histo->Draw();
00347       }
00348       histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/h4DSegmThetaDirection_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
00349       TH1F *histo2 = (TH1F*) theFile -> Get(histo_name.c_str()); 
00350       if(histo2) {
00351         int pad = (ch.station() - 1)*2 + 2;
00352         c1.cd(pad);
00353         histo2->Draw();
00354       }
00355     }      
00356     c1.Update();
00357     psFile.NewPage();
00358   }
00359     
00360   // Resolution summary histos  *******************************************************************
00361   if(ResoHistos){
00362     // Residuals histos
00363     c1.Clear();
00364     c1.Divide(3,4);
00365     // Loop over all the chambers
00366     vector<DTChamber*>::const_iterator ch_reso_it = muonGeom->chambers().begin();
00367     vector<DTChamber*>::const_iterator ch_reso_end = muonGeom->chambers().end();
00368     for (; ch_reso_it != ch_reso_end; ++ch_reso_it) {
00369       DTChamberId ch = (*ch_reso_it)->id();
00370       stringstream wheel; wheel << ch.wheel();
00371       stringstream station; station << ch.station();
00372       stringstream sector; sector << ch.sector();
00373       vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_reso_it)->superLayers().begin(); 
00374       vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_reso_it)->superLayers().end();
00375       // Loop over the SLs
00376       for(; sl_it != sl_end; ++sl_it) {
00377         DTSuperLayerId sl = (*sl_it)->id();
00378         stringstream superLayer; superLayer << sl.superlayer();
00379         
00380         string resoFolder = MainFolder + "DTResolutionAnalysisTask/Wheel" + wheel.str();
00381         string histo_name = resoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/hResDist_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str();  
00382         TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00383         if(histo){
00384           int pad = (ch.station() - 1)*3 + sl.superlayer();
00385           c1.cd(pad);
00386           histo->Draw();
00387         }
00388       }
00389     }
00390     c1.Update();
00391     psFile.NewPage();
00392     
00393     // Residuals as a function of the position Histos
00394     // Loop over all the chambers
00395     vector<DTChamber*>::const_iterator ch_reso2_it = muonGeom->chambers().begin();
00396     vector<DTChamber*>::const_iterator ch_reso2_end = muonGeom->chambers().end();
00397     for (; ch_reso2_it != ch_reso2_end; ++ch_reso2_it) {
00398       DTChamberId ch = (*ch_reso2_it)->id();
00399       stringstream wheel; wheel << ch.wheel();
00400       stringstream station; station << ch.station();
00401       stringstream sector; sector << ch.sector();
00402       vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_reso2_it)->superLayers().begin(); 
00403       vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_reso2_it)->superLayers().end();
00404       // Loop over the SLs
00405       for(; sl_it != sl_end; ++sl_it) {
00406         DTSuperLayerId sl = (*sl_it)->id();
00407         stringstream superLayer; superLayer << sl.superlayer();
00408         
00409         string resoFolder = MainFolder + "DTResolutionAnalysisTask/Wheel" + wheel.str();
00410         string histo_name = resoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/hResDistVsDist_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str();
00411         TProfile *histo = (TProfile*) theFile -> Get(histo_name.c_str());
00412         if(histo){
00413           int pad = (ch.station() - 1)*3 + sl.superlayer();
00414           c1.cd(pad);
00415           histo->Draw();
00416         }
00417       }
00418     }
00419     c1.Update();
00420     psFile.NewPage();
00421   }
00422   
00423   // Efficiency summary histos  ******************************************************************
00424   if(EfficiencyHistos){
00425     // Cell efficiency
00426     c1.Clear();
00427     c1.Divide(4,3);
00428     // Loop over all the chambers
00429     vector<DTChamber*>::const_iterator ch_eff_it = muonGeom->chambers().begin();
00430     vector<DTChamber*>::const_iterator ch_eff_end = muonGeom->chambers().end();
00431     for (; ch_eff_it != ch_eff_end; ++ch_eff_it) {
00432       DTChamberId ch = (*ch_eff_it)->id();
00433       stringstream wheel; wheel << ch.wheel();
00434       stringstream station; station << ch.station();
00435       stringstream sector; sector << ch.sector();
00436       bool found = false;
00437       vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_eff_it)->superLayers().begin(); 
00438       vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_eff_it)->superLayers().end();
00439       // Loop over the SLs
00440       for(; sl_it != sl_end; ++sl_it) {
00441         DTSuperLayerId sl = (*sl_it)->id();
00442         vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin(); 
00443         vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
00444         stringstream superLayer; superLayer << sl.superlayer();
00445         // Loop over the Ls
00446         for(; l_it != l_end; ++l_it) {
00447           DTLayerId layerId = (*l_it)->id();
00448           stringstream layer; layer << layerId.layer();
00449           
00450           string efficiencyFolder = MainFolder + "Tests/DTEfficiency/Wheel" + wheel.str();
00451           string histo_name = efficiencyFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/UnassEfficiency_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str();
00452           TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00453           if(histo){
00454             found = true;
00455             int pad = (sl.superlayer() - 1)*4 + layerId.layer();
00456             c1.cd(pad);
00457             histo->Draw();
00458           }
00459         }
00460       }
00461       if(found){
00462         c1.Update();
00463         psFile.NewPage();
00464       }
00465     }
00466     
00467     // Chamber X efficiency
00468     c1.Clear();
00469     c1.Divide(2,2);
00470     // Loop over all the chambers
00471     vector<DTChamber*>::const_iterator ch_eff2_it = muonGeom->chambers().begin();
00472     vector<DTChamber*>::const_iterator ch_eff2_end = muonGeom->chambers().end();
00473     for (; ch_eff2_it != ch_eff2_end; ++ch_eff2_it) {
00474       DTChamberId ch = (*ch_eff2_it)->id();
00475       stringstream wheel; wheel << ch.wheel();
00476       stringstream station; station << ch.station();
00477       stringstream sector; sector << ch.sector();
00478       
00479       string efficiencyFolder = MainFolder + "Tests/DTChamberEfficiency/Wheel" + wheel.str();
00480       string histo_name = efficiencyFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/xEfficiency_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
00481       TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00482       if(histo){
00483         c1.cd(ch.station());
00484         histo->Draw();
00485       }
00486     }
00487     c1.Update();
00488     psFile.NewPage();
00489     
00490     // Chamber Y efficiency
00491     // Loop over all the chambers
00492     vector<DTChamber*>::const_iterator ch_eff3_it = muonGeom->chambers().begin();
00493     vector<DTChamber*>::const_iterator ch_eff3_end = muonGeom->chambers().end();
00494     for (; ch_eff3_it != ch_eff3_end; ++ch_eff3_it) {
00495       DTChamberId ch = (*ch_eff3_it)->id();
00496       stringstream wheel; wheel << ch.wheel();
00497       stringstream station; station << ch.station();
00498       stringstream sector; sector << ch.sector();
00499       
00500       string efficiencyFolder = MainFolder + "Tests/DTChamberEfficiency/Wheel" + wheel.str();
00501       string histo_name = efficiencyFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/yEfficiency_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
00502       TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00503       if(histo){
00504         c1.cd(ch.station());
00505         histo->Draw();
00506       }
00507     }
00508     c1.Update();
00509     psFile.NewPage();
00510   }
00511 
00512   // Test Pulses Summary Histos  **************************************************************
00513   if(TestPulsesHistos){
00514     c1.Clear();
00515     c1.Divide(4,3);
00516     // Loop over all the chambers
00517     vector<DTChamber*>::const_iterator ch_TP_it = muonGeom->chambers().begin();
00518     vector<DTChamber*>::const_iterator ch_TP_end = muonGeom->chambers().end();
00519     for (; ch_TP_it != ch_TP_end; ++ch_TP_it) {
00520       DTChamberId ch = (*ch_TP_it)->id();
00521       stringstream wheel; wheel << ch.wheel();
00522       stringstream station; station << ch.station();
00523       stringstream sector; sector << ch.sector();
00524       bool found = false;
00525       vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_TP_it)->superLayers().begin(); 
00526       vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_TP_it)->superLayers().end();
00527       // Loop over the SLs
00528       for(; sl_it != sl_end; ++sl_it) {
00529         DTSuperLayerId sl = (*sl_it)->id();
00530         vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin(); 
00531         vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
00532         stringstream superLayer; superLayer << sl.superlayer();
00533         // Loop over the Ls
00534         for(; l_it != l_end; ++l_it) {
00535           DTLayerId layerId = (*l_it)->id();
00536           stringstream layer; layer << layerId.layer();
00537           
00538           string testPulsesFolder = MainFolder + "DTTestPulsesTask/Wheel" + wheel.str();
00539           string histo_name = testPulsesFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/SuperLayer" + superLayer.str() +  "/TPProfile/TestPulses2D_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str();
00540           TProfile *histo = (TProfile*) theFile -> Get(histo_name.c_str());
00541           if(histo){
00542             found = true;
00543             int pad = (sl.superlayer() - 1)*4 + layerId.layer();
00544             c1.cd(pad);
00545             histo->Draw();
00546           }
00547       }
00548       }
00549       if(found){
00550         c1.Update();
00551         psFile.NewPage();
00552       }
00553     }
00554   }
00555 
00556   // Trigger Summary Histos ************************************************************************
00557   if(TriggerHistos){
00558     c1.Clear();
00559     c1.Divide(2,2);
00560     // Loop over all the chambers
00561     vector<DTChamber*>::const_iterator ch_trigger_it = muonGeom->chambers().begin();
00562     vector<DTChamber*>::const_iterator ch_trigger_end = muonGeom->chambers().end();
00563     for (; ch_trigger_it != ch_trigger_end; ++ch_trigger_it) {
00564       DTChamberId ch = (*ch_trigger_it)->id();
00565       stringstream wheel; wheel << ch.wheel();
00566       stringstream station; station << ch.station();
00567       stringstream sector; sector << ch.sector();
00568       
00569       string triggerFolder = MainFolder + "DTLocalTriggerTask/Wheel" + wheel.str();
00570       string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/LocalTriggerPhi/DDU_BXvsQual_W" +  wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
00571       TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00572       if(histo){
00573         c1.cd(ch.station());
00574         histo->Draw();
00575       }
00576     }
00577     c1.Update();
00578     psFile.NewPage();
00579     
00580     // Loop over all the chambers
00581     vector<DTChamber*>::const_iterator ch_trigger2_it = muonGeom->chambers().begin();
00582     vector<DTChamber*>::const_iterator ch_trigger2_end = muonGeom->chambers().end();
00583     for (; ch_trigger2_it != ch_trigger2_end; ++ch_trigger2_it) {
00584       DTChamberId ch = (*ch_trigger2_it)->id();
00585       stringstream wheel; wheel << ch.wheel();
00586       stringstream station; station << ch.station();
00587       stringstream sector; sector << ch.sector();
00588       
00589       string triggerFolder = MainFolder + "DTLocalTriggerTask/Wheel" + wheel.str();
00590       string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/LocalTriggerTheta/DDU_ThetaBXvsQual_W" +  wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
00591       TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00592       if(histo){
00593         c1.cd(ch.station());
00594         histo->Draw();
00595       }
00596     }
00597     c1.Update();
00598     psFile.NewPage();
00599     
00600     c1.Clear();
00601     c1.Divide(1,2);
00602     int counter1=0,counter2=0;
00603     // Loop over all the chambers
00604     vector<DTChamber*>::const_iterator ch_trigger3_it = muonGeom->chambers().begin();
00605     vector<DTChamber*>::const_iterator ch_trigger3_end = muonGeom->chambers().end();
00606     for (; ch_trigger3_it != ch_trigger3_end; ++ch_trigger3_it) {
00607       DTChamberId ch = (*ch_trigger3_it)->id();
00608       stringstream wheel; wheel << ch.wheel();
00609       stringstream sector; sector << ch.sector();
00610       
00611       string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str();
00612       string histo_Name = triggerFolder + "/Sector" + sector.str() + "/LocalTriggerPhi/CorrFraction_Phi_W" +  wheel.str() + "_Sec" + sector.str();
00613       TH1F *Histo1 = (TH1F*) theFile -> Get(histo_Name.c_str());
00614       if(Histo1 && counter1==0){
00615         counter1++;
00616         c1.cd(1);
00617         Histo1->Draw();
00618       }
00619       histo_Name = triggerFolder + "/Sector" + sector.str() + "/LocalTriggerTheta/HFraction_Theta_W" +  wheel.str() + "_Sec" + sector.str();
00620       TH1F *Histo2 = (TH1F*) theFile -> Get(histo_Name.c_str());
00621       if(Histo2 && counter2==0){
00622         counter2++;
00623         c1.cd(2);
00624         Histo2->Draw();
00625       }
00626     }
00627     c1.Update();
00628     psFile.NewPage();
00629     
00630     c1.Clear();
00631     c1.Divide(2,2);
00632     // Loop over all the chambers
00633     vector<DTChamber*>::const_iterator ch_trigger4_it = muonGeom->chambers().begin();
00634     vector<DTChamber*>::const_iterator ch_trigger4_end = muonGeom->chambers().end();
00635     for (; ch_trigger4_it != ch_trigger4_end; ++ch_trigger4_it) {
00636       DTChamberId ch = (*ch_trigger4_it)->id();
00637       stringstream wheel; wheel << ch.wheel();
00638       stringstream station; station << ch.station();
00639       stringstream sector; sector << ch.sector();
00640       
00641       string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str();
00642       string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffPos_Phi_W" +  wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
00643       TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00644       string histo_nameHHHL = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffPosHHHL_Phi_W" +  wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
00645       TH1F *histoHHHL = (TH1F*) theFile -> Get(histo_nameHHHL.c_str());
00646       if(histo){
00647         c1.cd(ch.station());
00648         histo->GetYaxis()->SetRangeUser(0,1.1);
00649         histo->Draw();
00650         if(histoHHHL){
00651                 histoHHHL->Draw("same");
00652         }
00653       }
00654     }
00655     c1.Update();
00656     psFile.NewPage();
00657 
00658     c1.Clear();
00659     c1.Divide(2,2);
00660     // Loop over all the chambers
00661     vector<DTChamber*>::const_iterator ch_trigger5_it = muonGeom->chambers().begin();
00662     vector<DTChamber*>::const_iterator ch_trigger5_end = muonGeom->chambers().end();
00663     for (; ch_trigger5_it != ch_trigger5_end; ++ch_trigger5_it) {
00664       DTChamberId ch = (*ch_trigger5_it)->id();
00665       stringstream wheel; wheel << ch.wheel();
00666       stringstream station; station << ch.station();
00667       stringstream sector; sector << ch.sector();
00668       
00669       string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str();
00670       string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffAngle_Phi_W" +  wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
00671       TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00672       if(histo){
00673         c1.cd(ch.station());
00674         histo->GetYaxis()->SetRangeUser(0,1.1);
00675         histo->Draw();
00676       }
00677     }
00678     c1.Update();
00679     psFile.NewPage();
00680     
00681     c1.Clear();
00682     c1.Divide(2,2);
00683     // Loop over all the chambers
00684     vector<DTChamber*>::const_iterator ch_trigger6_it = muonGeom->chambers().begin();
00685     vector<DTChamber*>::const_iterator ch_trigger6_end = muonGeom->chambers().end();
00686     for (; ch_trigger6_it != ch_trigger6_end; ++ch_trigger6_it) {
00687       DTChamberId ch = (*ch_trigger6_it)->id();
00688       stringstream wheel; wheel << ch.wheel();
00689       stringstream station; station << ch.station();
00690       stringstream sector; sector << ch.sector();
00691       
00692       string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str();
00693       string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffPos_Theta_W" +  wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
00694       TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00695       if(histo){
00696         c1.cd(ch.station());
00697         histo->GetYaxis()->SetRangeUser(0,1.1);
00698         histo->Draw();
00699       }
00700     }
00701     c1.Update();
00702     psFile.NewPage();
00703 
00704     c1.Clear();
00705     c1.Divide(2,2);
00706     // Loop over all the chambers
00707     vector<DTChamber*>::const_iterator ch_trigger7_it = muonGeom->chambers().begin();
00708     vector<DTChamber*>::const_iterator ch_trigger7_end = muonGeom->chambers().end();
00709     for (; ch_trigger7_it != ch_trigger7_end; ++ch_trigger7_it) {
00710       DTChamberId ch = (*ch_trigger7_it)->id();
00711       stringstream wheel; wheel << ch.wheel();
00712       stringstream station; station << ch.station();
00713       stringstream sector; sector << ch.sector();
00714       
00715       string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str();
00716       string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffAngle_Theta_W" +  wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
00717       TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00718       if(histo){
00719         histo->GetYaxis()->SetRangeUser(0,1.1);
00720         c1.cd(ch.station());
00721         histo->Draw();
00722       }
00723     }
00724     c1.Update();
00725   }
00726   psFile.Close();
00727 }