CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/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: 2010/01/05 10:15:45 $
00006  *  $Revision: 1.5 $
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         vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin(); 
00160         vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
00161         stringstream superLayer; superLayer << sl.superlayer();
00162         
00163         string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str();
00164         string histo_name = digiFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/TimeBoxes/TimeBox_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str()+ "_SL" + superLayer.str();
00165         TH1F *histo = (TH1F *) theFile->Get(histo_name.c_str());
00166         if(histo){
00167           int pad = (ch.station() - 1)*3 + sl.superlayer();
00168           c1.cd(pad);
00169           histo->Draw();
00170         }
00171       }
00172     }
00173     c1.Update();
00174     psFile.NewPage();
00175     
00176     // Occupancy in Time Histos
00177     c1.Clear();
00178     c1.Divide(4,3);
00179     // Loop over all the chambers
00180     vector<DTChamber*>::const_iterator ch_digi2_it = muonGeom->chambers().begin();
00181     vector<DTChamber*>::const_iterator ch_digi2_end = muonGeom->chambers().end();
00182     for (; ch_digi2_it != ch_digi2_end; ++ch_digi2_it) {
00183       DTChamberId ch = (*ch_digi2_it)->id();
00184       stringstream wheel; wheel << ch.wheel();
00185       stringstream station; station << ch.station();
00186       stringstream sector; sector << ch.sector();
00187       bool found = false;
00188       vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_digi2_it)->superLayers().begin(); 
00189       vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_digi2_it)->superLayers().end();
00190       // Loop over the SLs
00191       for(; sl_it != sl_end; ++sl_it) {
00192         DTSuperLayerId sl = (*sl_it)->id();
00193         vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin(); 
00194         vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
00195         stringstream superLayer; superLayer << sl.superlayer();
00196         // Loop over the Ls
00197         for(; l_it != l_end; ++l_it) {
00198           DTLayerId layerId = (*l_it)->id();
00199           stringstream layer; layer << layerId.layer();
00200           
00201           string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str();
00202           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();     
00203           TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00204           if(histo){
00205             found = true;
00206             int pad = (sl.superlayer() - 1)*4 + layerId.layer();
00207             c1.cd(pad);
00208             histo->Draw();
00209           }
00210         }
00211       }
00212       if(found){
00213         c1.Update();
00214         psFile.NewPage();
00215       }
00216     }
00217     
00218     // Occupancy Noise
00219     // Loop over all the chambers
00220     vector<DTChamber*>::const_iterator ch_digi3_it = muonGeom->chambers().begin();
00221     vector<DTChamber*>::const_iterator ch_digi3_end = muonGeom->chambers().end();
00222     for (; ch_digi3_it != ch_digi3_end; ++ch_digi3_it) {
00223       DTChamberId ch = (*ch_digi3_it)->id();
00224       stringstream wheel; wheel << ch.wheel();
00225       stringstream station; station << ch.station();
00226       stringstream sector; sector << ch.sector();
00227       bool found = false;
00228       vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_digi3_it)->superLayers().begin(); 
00229       vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_digi3_it)->superLayers().end();
00230       // Loop over the SLs
00231       for(; sl_it != sl_end; ++sl_it) {
00232         DTSuperLayerId sl = (*sl_it)->id();
00233         vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin(); 
00234         vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
00235         stringstream superLayer; superLayer << sl.superlayer();
00236         // Loop over the Ls
00237         for(; l_it != l_end; ++l_it) {
00238           DTLayerId layerId = (*l_it)->id();
00239           stringstream layer; layer << layerId.layer();
00240           
00241           string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str();
00242           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(); 
00243           TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00244           if(histo){
00245             found = true;
00246             int pad = (sl.superlayer() - 1)*4 + layerId.layer();
00247             c1.cd(pad);
00248             histo->Draw();
00249           }
00250         }
00251       }
00252       if(found) {
00253         c1.Update();
00254         psFile.NewPage();
00255       }
00256     }
00257     
00258     // Digi Per Event
00259     // Loop over all the chambers
00260     vector<DTChamber*>::const_iterator ch_digi4_it = muonGeom->chambers().begin();
00261     vector<DTChamber*>::const_iterator ch_digi4_end = muonGeom->chambers().end();
00262     for (; ch_digi4_it != ch_digi4_end; ++ch_digi4_it) {
00263       DTChamberId ch = (*ch_digi4_it)->id();
00264       stringstream wheel; wheel << ch.wheel();
00265       stringstream station; station << ch.station();
00266       stringstream sector; sector << ch.sector();
00267       bool found = false;
00268       vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_digi4_it)->superLayers().begin(); 
00269       vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_digi4_it)->superLayers().end();
00270       // Loop over the SLs
00271       for(; sl_it != sl_end; ++sl_it) {
00272         DTSuperLayerId sl = (*sl_it)->id();
00273         vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin(); 
00274         vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
00275         stringstream superLayer; superLayer << sl.superlayer();
00276         // Loop over the Ls
00277         for(; l_it != l_end; ++l_it) {
00278           DTLayerId layerId = (*l_it)->id();
00279           stringstream layer; layer << layerId.layer();
00280           
00281           string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str();
00282           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();
00283           TProfile *histo = (TProfile*) theFile -> Get(histo_name.c_str());
00284           if(histo){
00285             found = true;
00286             int pad = (sl.superlayer() - 1)*4 + layerId.layer();
00287             c1.cd(pad);
00288             histo->Draw();
00289           }
00290         }
00291       }
00292       if(found){
00293         c1.Update();
00294         psFile.NewPage();
00295       }
00296     }
00297   }
00298   
00299   // Reconstruction summary histos  *********************************************************
00300   if(RecoHistos){
00301     // reco segment Histos - page1
00302     c1.Clear(); 
00303     c1.Divide(2,4);
00304     // Loop over all the chambers
00305     vector<DTChamber*>::const_iterator ch_reco_it = muonGeom->chambers().begin();
00306     vector<DTChamber*>::const_iterator ch_reco_end = muonGeom->chambers().end();
00307     for (; ch_reco_it != ch_reco_end; ++ch_reco_it) {
00308       DTChamberId ch = (*ch_reco_it)->id();
00309       stringstream wheel; wheel << ch.wheel();
00310       stringstream station; station << ch.station();
00311       stringstream sector; sector << ch.sector();
00312       
00313       string recoFolder = MainFolder + "DTSegmentAnalysisTask/Wheel" + wheel.str();
00314       string histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/hN4DSeg_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();  
00315       TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00316       if(histo){
00317         int pad = (ch.station() - 1)*2 + 1;
00318         c1.cd(pad);
00319         histo->Draw();
00320       }
00321       histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/h4DSegmXvsYInCham_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
00322       TProfile *histo2 = (TProfile*) theFile -> Get(histo_name.c_str());
00323       if(histo2){
00324         int pad = (ch.station() - 1)*2 + 2;
00325         c1.cd(pad);
00326         histo2->Draw();
00327       }
00328     }
00329     c1.Update();
00330     psFile.NewPage();
00331     
00332     // reco segment Histos - page2
00333     // Loop over all the chambers
00334     vector<DTChamber*>::const_iterator ch_reco2_it = muonGeom->chambers().begin();
00335     vector<DTChamber*>::const_iterator ch_reco2_end = muonGeom->chambers().end();
00336     for (; ch_reco2_it != ch_reco2_end; ++ch_reco2_it) {
00337       DTChamberId ch = (*ch_reco2_it)->id();
00338       stringstream wheel; wheel << ch.wheel();
00339       stringstream station; station << ch.station();
00340       stringstream sector; sector << ch.sector();
00341       
00342       string recoFolder = MainFolder + "DTSegmentAnalysisTask/Wheel" + wheel.str();
00343       string histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/h4DSegmPhiDirection_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
00344       TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00345       if(histo) {
00346         int pad = (ch.station() - 1)*2 + 1;
00347         c1.cd(pad);
00348         histo->Draw();
00349       }
00350       histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/h4DSegmThetaDirection_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
00351       TH1F *histo2 = (TH1F*) theFile -> Get(histo_name.c_str()); 
00352       if(histo2) {
00353         int pad = (ch.station() - 1)*2 + 2;
00354         c1.cd(pad);
00355         histo2->Draw();
00356       }
00357     }      
00358     c1.Update();
00359     psFile.NewPage();
00360   }
00361     
00362   // Resolution summary histos  *******************************************************************
00363   if(ResoHistos){
00364     // Residuals histos
00365     c1.Clear();
00366     c1.Divide(3,4);
00367     // Loop over all the chambers
00368     vector<DTChamber*>::const_iterator ch_reso_it = muonGeom->chambers().begin();
00369     vector<DTChamber*>::const_iterator ch_reso_end = muonGeom->chambers().end();
00370     for (; ch_reso_it != ch_reso_end; ++ch_reso_it) {
00371       DTChamberId ch = (*ch_reso_it)->id();
00372       stringstream wheel; wheel << ch.wheel();
00373       stringstream station; station << ch.station();
00374       stringstream sector; sector << ch.sector();
00375       vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_reso_it)->superLayers().begin(); 
00376       vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_reso_it)->superLayers().end();
00377       // Loop over the SLs
00378       for(; sl_it != sl_end; ++sl_it) {
00379         DTSuperLayerId sl = (*sl_it)->id();
00380         stringstream superLayer; superLayer << sl.superlayer();
00381         
00382         string resoFolder = MainFolder + "DTResolutionAnalysisTask/Wheel" + wheel.str();
00383         string histo_name = resoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/hResDist_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str();  
00384         TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00385         if(histo){
00386           int pad = (ch.station() - 1)*3 + sl.superlayer();
00387           c1.cd(pad);
00388           histo->Draw();
00389         }
00390       }
00391     }
00392     c1.Update();
00393     psFile.NewPage();
00394     
00395     // Residuals as a function of the position Histos
00396     // Loop over all the chambers
00397     vector<DTChamber*>::const_iterator ch_reso2_it = muonGeom->chambers().begin();
00398     vector<DTChamber*>::const_iterator ch_reso2_end = muonGeom->chambers().end();
00399     for (; ch_reso2_it != ch_reso2_end; ++ch_reso2_it) {
00400       DTChamberId ch = (*ch_reso2_it)->id();
00401       stringstream wheel; wheel << ch.wheel();
00402       stringstream station; station << ch.station();
00403       stringstream sector; sector << ch.sector();
00404       vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_reso2_it)->superLayers().begin(); 
00405       vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_reso2_it)->superLayers().end();
00406       // Loop over the SLs
00407       for(; sl_it != sl_end; ++sl_it) {
00408         DTSuperLayerId sl = (*sl_it)->id();
00409         stringstream superLayer; superLayer << sl.superlayer();
00410         
00411         string resoFolder = MainFolder + "DTResolutionAnalysisTask/Wheel" + wheel.str();
00412         string histo_name = resoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/hResDistVsDist_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str();
00413         TProfile *histo = (TProfile*) theFile -> Get(histo_name.c_str());
00414         if(histo){
00415           int pad = (ch.station() - 1)*3 + sl.superlayer();
00416           c1.cd(pad);
00417           histo->Draw();
00418         }
00419       }
00420     }
00421     c1.Update();
00422     psFile.NewPage();
00423   }
00424   
00425   // Efficiency summary histos  ******************************************************************
00426   if(EfficiencyHistos){
00427     // Cell efficiency
00428     c1.Clear();
00429     c1.Divide(4,3);
00430     // Loop over all the chambers
00431     vector<DTChamber*>::const_iterator ch_eff_it = muonGeom->chambers().begin();
00432     vector<DTChamber*>::const_iterator ch_eff_end = muonGeom->chambers().end();
00433     for (; ch_eff_it != ch_eff_end; ++ch_eff_it) {
00434       DTChamberId ch = (*ch_eff_it)->id();
00435       stringstream wheel; wheel << ch.wheel();
00436       stringstream station; station << ch.station();
00437       stringstream sector; sector << ch.sector();
00438       bool found = false;
00439       vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_eff_it)->superLayers().begin(); 
00440       vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_eff_it)->superLayers().end();
00441       // Loop over the SLs
00442       for(; sl_it != sl_end; ++sl_it) {
00443         DTSuperLayerId sl = (*sl_it)->id();
00444         vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin(); 
00445         vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
00446         stringstream superLayer; superLayer << sl.superlayer();
00447         // Loop over the Ls
00448         for(; l_it != l_end; ++l_it) {
00449           DTLayerId layerId = (*l_it)->id();
00450           stringstream layer; layer << layerId.layer();
00451           
00452           string efficiencyFolder = MainFolder + "Tests/DTEfficiency/Wheel" + wheel.str();
00453           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();
00454           TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00455           if(histo){
00456             found = true;
00457             int pad = (sl.superlayer() - 1)*4 + layerId.layer();
00458             c1.cd(pad);
00459             histo->Draw();
00460           }
00461         }
00462       }
00463       if(found){
00464         c1.Update();
00465         psFile.NewPage();
00466       }
00467     }
00468     
00469     // Chamber X efficiency
00470     c1.Clear();
00471     c1.Divide(2,2);
00472     // Loop over all the chambers
00473     vector<DTChamber*>::const_iterator ch_eff2_it = muonGeom->chambers().begin();
00474     vector<DTChamber*>::const_iterator ch_eff2_end = muonGeom->chambers().end();
00475     for (; ch_eff2_it != ch_eff2_end; ++ch_eff2_it) {
00476       DTChamberId ch = (*ch_eff2_it)->id();
00477       stringstream wheel; wheel << ch.wheel();
00478       stringstream station; station << ch.station();
00479       stringstream sector; sector << ch.sector();
00480       
00481       string efficiencyFolder = MainFolder + "Tests/DTChamberEfficiency/Wheel" + wheel.str();
00482       string histo_name = efficiencyFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/xEfficiency_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
00483       TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00484       if(histo){
00485         c1.cd(ch.station());
00486         histo->Draw();
00487       }
00488     }
00489     c1.Update();
00490     psFile.NewPage();
00491     
00492     // Chamber Y efficiency
00493     // Loop over all the chambers
00494     vector<DTChamber*>::const_iterator ch_eff3_it = muonGeom->chambers().begin();
00495     vector<DTChamber*>::const_iterator ch_eff3_end = muonGeom->chambers().end();
00496     for (; ch_eff3_it != ch_eff3_end; ++ch_eff3_it) {
00497       DTChamberId ch = (*ch_eff3_it)->id();
00498       stringstream wheel; wheel << ch.wheel();
00499       stringstream station; station << ch.station();
00500       stringstream sector; sector << ch.sector();
00501       
00502       string efficiencyFolder = MainFolder + "Tests/DTChamberEfficiency/Wheel" + wheel.str();
00503       string histo_name = efficiencyFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/yEfficiency_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
00504       TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00505       if(histo){
00506         c1.cd(ch.station());
00507         histo->Draw();
00508       }
00509     }
00510     c1.Update();
00511     psFile.NewPage();
00512   }
00513 
00514   // Test Pulses Summary Histos  **************************************************************
00515   if(TestPulsesHistos){
00516     c1.Clear();
00517     c1.Divide(4,3);
00518     // Loop over all the chambers
00519     vector<DTChamber*>::const_iterator ch_TP_it = muonGeom->chambers().begin();
00520     vector<DTChamber*>::const_iterator ch_TP_end = muonGeom->chambers().end();
00521     for (; ch_TP_it != ch_TP_end; ++ch_TP_it) {
00522       DTChamberId ch = (*ch_TP_it)->id();
00523       stringstream wheel; wheel << ch.wheel();
00524       stringstream station; station << ch.station();
00525       stringstream sector; sector << ch.sector();
00526       bool found = false;
00527       vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_TP_it)->superLayers().begin(); 
00528       vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_TP_it)->superLayers().end();
00529       // Loop over the SLs
00530       for(; sl_it != sl_end; ++sl_it) {
00531         DTSuperLayerId sl = (*sl_it)->id();
00532         vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin(); 
00533         vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
00534         stringstream superLayer; superLayer << sl.superlayer();
00535         // Loop over the Ls
00536         for(; l_it != l_end; ++l_it) {
00537           DTLayerId layerId = (*l_it)->id();
00538           stringstream layer; layer << layerId.layer();
00539           
00540           string testPulsesFolder = MainFolder + "DTTestPulsesTask/Wheel" + wheel.str();
00541           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();
00542           TProfile *histo = (TProfile*) theFile -> Get(histo_name.c_str());
00543           if(histo){
00544             found = true;
00545             int pad = (sl.superlayer() - 1)*4 + layerId.layer();
00546             c1.cd(pad);
00547             histo->Draw();
00548           }
00549       }
00550       }
00551       if(found){
00552         c1.Update();
00553         psFile.NewPage();
00554       }
00555     }
00556   }
00557 
00558   // Trigger Summary Histos ************************************************************************
00559   if(TriggerHistos){
00560     c1.Clear();
00561     c1.Divide(2,2);
00562     // Loop over all the chambers
00563     vector<DTChamber*>::const_iterator ch_trigger_it = muonGeom->chambers().begin();
00564     vector<DTChamber*>::const_iterator ch_trigger_end = muonGeom->chambers().end();
00565     for (; ch_trigger_it != ch_trigger_end; ++ch_trigger_it) {
00566       DTChamberId ch = (*ch_trigger_it)->id();
00567       stringstream wheel; wheel << ch.wheel();
00568       stringstream station; station << ch.station();
00569       stringstream sector; sector << ch.sector();
00570       
00571       string triggerFolder = MainFolder + "DTLocalTriggerTask/Wheel" + wheel.str();
00572       string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/LocalTriggerPhi/DDU_BXvsQual_W" +  wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
00573       TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00574       if(histo){
00575         c1.cd(ch.station());
00576         histo->Draw();
00577       }
00578     }
00579     c1.Update();
00580     psFile.NewPage();
00581     
00582     // Loop over all the chambers
00583     vector<DTChamber*>::const_iterator ch_trigger2_it = muonGeom->chambers().begin();
00584     vector<DTChamber*>::const_iterator ch_trigger2_end = muonGeom->chambers().end();
00585     for (; ch_trigger2_it != ch_trigger2_end; ++ch_trigger2_it) {
00586       DTChamberId ch = (*ch_trigger2_it)->id();
00587       stringstream wheel; wheel << ch.wheel();
00588       stringstream station; station << ch.station();
00589       stringstream sector; sector << ch.sector();
00590       
00591       string triggerFolder = MainFolder + "DTLocalTriggerTask/Wheel" + wheel.str();
00592       string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/LocalTriggerTheta/DDU_ThetaBXvsQual_W" +  wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
00593       TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00594       if(histo){
00595         c1.cd(ch.station());
00596         histo->Draw();
00597       }
00598     }
00599     c1.Update();
00600     psFile.NewPage();
00601     
00602     c1.Clear();
00603     c1.Divide(1,2);
00604     int counter1=0,counter2=0;
00605     // Loop over all the chambers
00606     vector<DTChamber*>::const_iterator ch_trigger3_it = muonGeom->chambers().begin();
00607     vector<DTChamber*>::const_iterator ch_trigger3_end = muonGeom->chambers().end();
00608     for (; ch_trigger3_it != ch_trigger3_end; ++ch_trigger3_it) {
00609       DTChamberId ch = (*ch_trigger3_it)->id();
00610       stringstream wheel; wheel << ch.wheel();
00611       stringstream sector; sector << ch.sector();
00612       
00613       string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str();
00614       string histo_Name = triggerFolder + "/Sector" + sector.str() + "/LocalTriggerPhi/CorrFraction_Phi_W" +  wheel.str() + "_Sec" + sector.str();
00615       TH1F *Histo1 = (TH1F*) theFile -> Get(histo_Name.c_str());
00616       if(Histo1 && counter1==0){
00617         counter1++;
00618         c1.cd(1);
00619         Histo1->Draw();
00620       }
00621       histo_Name = triggerFolder + "/Sector" + sector.str() + "/LocalTriggerTheta/HFraction_Theta_W" +  wheel.str() + "_Sec" + sector.str();
00622       TH1F *Histo2 = (TH1F*) theFile -> Get(histo_Name.c_str());
00623       if(Histo2 && counter2==0){
00624         counter2++;
00625         c1.cd(2);
00626         Histo2->Draw();
00627       }
00628     }
00629     c1.Update();
00630     psFile.NewPage();
00631     
00632     c1.Clear();
00633     c1.Divide(2,2);
00634     // Loop over all the chambers
00635     vector<DTChamber*>::const_iterator ch_trigger4_it = muonGeom->chambers().begin();
00636     vector<DTChamber*>::const_iterator ch_trigger4_end = muonGeom->chambers().end();
00637     for (; ch_trigger4_it != ch_trigger4_end; ++ch_trigger4_it) {
00638       DTChamberId ch = (*ch_trigger4_it)->id();
00639       stringstream wheel; wheel << ch.wheel();
00640       stringstream station; station << ch.station();
00641       stringstream sector; sector << ch.sector();
00642       
00643       string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str();
00644       string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffPos_Phi_W" +  wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
00645       TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00646       string histo_nameHHHL = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffPosHHHL_Phi_W" +  wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
00647       TH1F *histoHHHL = (TH1F*) theFile -> Get(histo_nameHHHL.c_str());
00648       if(histo){
00649         c1.cd(ch.station());
00650         histo->GetYaxis()->SetRangeUser(0,1.1);
00651         histo->Draw();
00652         if(histoHHHL){
00653                 histoHHHL->Draw("same");
00654         }
00655       }
00656     }
00657     c1.Update();
00658     psFile.NewPage();
00659 
00660     c1.Clear();
00661     c1.Divide(2,2);
00662     // Loop over all the chambers
00663     vector<DTChamber*>::const_iterator ch_trigger5_it = muonGeom->chambers().begin();
00664     vector<DTChamber*>::const_iterator ch_trigger5_end = muonGeom->chambers().end();
00665     for (; ch_trigger5_it != ch_trigger5_end; ++ch_trigger5_it) {
00666       DTChamberId ch = (*ch_trigger5_it)->id();
00667       stringstream wheel; wheel << ch.wheel();
00668       stringstream station; station << ch.station();
00669       stringstream sector; sector << ch.sector();
00670       
00671       string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str();
00672       string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffAngle_Phi_W" +  wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
00673       TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00674       if(histo){
00675         c1.cd(ch.station());
00676         histo->GetYaxis()->SetRangeUser(0,1.1);
00677         histo->Draw();
00678       }
00679     }
00680     c1.Update();
00681     psFile.NewPage();
00682     
00683     c1.Clear();
00684     c1.Divide(2,2);
00685     // Loop over all the chambers
00686     vector<DTChamber*>::const_iterator ch_trigger6_it = muonGeom->chambers().begin();
00687     vector<DTChamber*>::const_iterator ch_trigger6_end = muonGeom->chambers().end();
00688     for (; ch_trigger6_it != ch_trigger6_end; ++ch_trigger6_it) {
00689       DTChamberId ch = (*ch_trigger6_it)->id();
00690       stringstream wheel; wheel << ch.wheel();
00691       stringstream station; station << ch.station();
00692       stringstream sector; sector << ch.sector();
00693       
00694       string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str();
00695       string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffPos_Theta_W" +  wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
00696       TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00697       if(histo){
00698         c1.cd(ch.station());
00699         histo->GetYaxis()->SetRangeUser(0,1.1);
00700         histo->Draw();
00701       }
00702     }
00703     c1.Update();
00704     psFile.NewPage();
00705 
00706     c1.Clear();
00707     c1.Divide(2,2);
00708     // Loop over all the chambers
00709     vector<DTChamber*>::const_iterator ch_trigger7_it = muonGeom->chambers().begin();
00710     vector<DTChamber*>::const_iterator ch_trigger7_end = muonGeom->chambers().end();
00711     for (; ch_trigger7_it != ch_trigger7_end; ++ch_trigger7_it) {
00712       DTChamberId ch = (*ch_trigger7_it)->id();
00713       stringstream wheel; wheel << ch.wheel();
00714       stringstream station; station << ch.station();
00715       stringstream sector; sector << ch.sector();
00716       
00717       string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str();
00718       string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffAngle_Theta_W" +  wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
00719       TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str());
00720       if(histo){
00721         histo->GetYaxis()->SetRangeUser(0,1.1);
00722         c1.cd(ch.station());
00723         histo->Draw();
00724       }
00725     }
00726     c1.Update();
00727   }
00728   psFile.Close();
00729 }