Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-10 02:21:31

0001 #include "Validation/Geometry/interface/MaterialBudgetEcalHistos.h"
0002 #include "Validation/Geometry/interface/MaterialBudgetData.h"
0003 
0004 #include <CLHEP/Units/SystemOfUnits.h>
0005 
0006 MaterialBudgetEcalHistos::MaterialBudgetEcalHistos(std::shared_ptr<MaterialBudgetData> data,
0007                                                    std::shared_ptr<TestHistoMgr> mgr,
0008                                                    const std::string& fileName)
0009     : MaterialBudgetFormat(data), hmgr(mgr) {
0010   theFileName = fileName;
0011   book();
0012 }
0013 
0014 void MaterialBudgetEcalHistos::book() {
0015   edm::LogVerbatim("MaterialBudget") << "MaterialBudgetEcalHistos: Booking user histos";
0016 
0017   // total X0
0018   hmgr->addHistoProf1(new TProfile("10", "MB prof Eta ", 250, -5., 5.));
0019   hmgr->addHisto1(new TH1F("11", "Eta ", 501, -5., 5.));
0020   hmgr->addHistoProf1(new TProfile("20", "MB prof Phi ", 180, -3.1416, 3.1416));
0021   hmgr->addHisto1(new TH1F("21", "Phi ", 180, -3.1416, 3.1416));
0022   hmgr->addHistoProf2(new TProfile2D("30", "MB prof Eta  Phi ", 250, -5., 5., 180, -3.1416, 3.1416));
0023   hmgr->addHisto2(new TH2F("31", "Eta vs Phi ", 501, -5., 5., 180, -3.1416, 3.1416));
0024 
0025   // Support
0026   hmgr->addHistoProf1(new TProfile("110", "MB prof Eta [Support]", 250, -5.0, 5.0));
0027   hmgr->addHisto1(new TH1F("111", "Eta [Support]", 501, -5., 5.));
0028   hmgr->addHistoProf1(new TProfile("120", "MB prof Phi [Support]", 180, -3.1416, 3.1416));
0029   hmgr->addHisto1(new TH1F("121", "Phi [Support]", 180, -3.1416, 3.1416));
0030   hmgr->addHistoProf2(new TProfile2D("130", "MB prof Eta  Phi [Support]", 250, -5., 5., 180, -3.1416, 3.1416));
0031   hmgr->addHisto2(new TH2F("131", "Eta vs Phi [Support]", 501, -5., 5., 180, -3.1416, 3.1416));
0032 
0033   // Sensitive
0034   hmgr->addHistoProf1(new TProfile("210", "MB prof Eta [Sensitive]", 250, -5.0, 5.0));
0035   hmgr->addHisto1(new TH1F("211", "Eta [Sensitive]", 501, -5., 5.));
0036   hmgr->addHistoProf1(new TProfile("220", "MB prof Phi [Sensitive]", 180, -3.1416, 3.1416));
0037   hmgr->addHisto1(new TH1F("221", "Phi [Sensitive]", 180, -3.1416, 3.1416));
0038   hmgr->addHistoProf2(new TProfile2D("230", "MB prof Eta  Phi [Sensitive]", 250, -5., 5., 180, -3.1416, 3.1416));
0039   hmgr->addHisto2(new TH2F("231", "Eta vs Phi [Sensitive]", 501, -5., 5., 180, -3.1416, 3.1416));
0040 
0041   // Cables
0042   hmgr->addHistoProf1(new TProfile("310", "MB prof Eta [Cables]", 250, -5.0, 5.0));
0043   hmgr->addHisto1(new TH1F("311", "Eta [Cables]", 501, -5., 5.));
0044   hmgr->addHistoProf1(new TProfile("320", "MB prof Phi [Cables]", 180, -3.1416, 3.1416));
0045   hmgr->addHisto1(new TH1F("321", "Phi [Cables]", 180, -3.1416, 3.1416));
0046   hmgr->addHistoProf2(new TProfile2D("330", "MB prof Eta  Phi [Cables]", 250, -5., 5., 180, -3.1416, 3.1416));
0047   hmgr->addHisto2(new TH2F("331", "Eta vs Phi [Cables]", 501, -5., 5., 180, -3.1416, 3.1416));
0048 
0049   // Cooling
0050   hmgr->addHistoProf1(new TProfile("410", "MB prof Eta [Cooling]", 250, -5.0, 5.0));
0051   hmgr->addHisto1(new TH1F("411", "Eta [Cooling]", 501, -5., 5.));
0052   hmgr->addHistoProf1(new TProfile("420", "MB prof Phi [Cooling]", 180, -3.1416, 3.1416));
0053   hmgr->addHisto1(new TH1F("421", "Phi [Cooling]", 180, -3.1416, 3.1416));
0054   hmgr->addHistoProf2(new TProfile2D("430", "MB prof Eta  Phi [Cooling]", 250, -5., 5., 180, -3.1416, 3.1416));
0055   hmgr->addHisto2(new TH2F("431", "Eta vs Phi [Cooling]", 501, -5., 5., 180, -3.1416, 3.1416));
0056 
0057   // Electronics
0058   hmgr->addHistoProf1(new TProfile("510", "MB prof Eta [Electronics]", 250, -5.0, 5.0));
0059   hmgr->addHisto1(new TH1F("511", "Eta [Electronics]", 501, -5., 5.));
0060   hmgr->addHistoProf1(new TProfile("520", "MB prof Phi [Electronics]", 180, -3.1416, 3.1416));
0061   hmgr->addHisto1(new TH1F("521", "Phi [Electronics]", 180, -3.1416, 3.1416));
0062   hmgr->addHistoProf2(new TProfile2D("530", "MB prof Eta  Phi [Electronics]", 250, -5., 5., 180, -3.1416, 3.1416));
0063   hmgr->addHisto2(new TH2F("531", "Eta vs Phi [Electronics]", 501, -5., 5., 180, -3.1416, 3.1416));
0064 
0065   // Other
0066   hmgr->addHistoProf1(new TProfile("610", "MB prof Eta [Other]", 250, -5.0, 5.0));
0067   hmgr->addHisto1(new TH1F("611", "Eta [Other]", 501, -5., 5.));
0068   hmgr->addHistoProf1(new TProfile("620", "MB prof Phi [Other]", 180, -3.1416, 3.1416));
0069   hmgr->addHisto1(new TH1F("621", "Phi [Other]", 180, -3.1416, 3.1416));
0070   hmgr->addHistoProf2(new TProfile2D("630", "MB prof Eta  Phi [Other]", 250, -5., 5., 180, -3.1416, 3.1416));
0071   hmgr->addHisto2(new TH2F("631", "Eta vs Phi [Other]", 501, -5., 5., 180, -3.1416, 3.1416));
0072 
0073   // Air
0074   hmgr->addHistoProf1(new TProfile("710", "MB prof Eta [Air]", 250, -5.0, 5.0));
0075   hmgr->addHisto1(new TH1F("711", "Eta [Air]", 501, -5., 5.));
0076   hmgr->addHistoProf1(new TProfile("720", "MB prof Phi [Air]", 180, -3.1416, 3.1416));
0077   hmgr->addHisto1(new TH1F("721", "Phi [Air]", 180, -3.1416, 3.1416));
0078   hmgr->addHistoProf2(new TProfile2D("730", "MB prof Eta  Phi [Air]", 250, -5., 5., 180, -3.1416, 3.1416));
0079   hmgr->addHisto2(new TH2F("731", "Eta vs Phi [Air]", 501, -5., 5., 180, -3.1416, 3.1416));
0080 
0081   // ECAL specific
0082   hmgr->addHistoProf1(new TProfile("1001", "MB prof Eta ECAL Barrel", 340, -1.5, 1.5));
0083   hmgr->addHistoProf1(new TProfile("1002", "MB prof Phi ECAL Barrel", 180, -3.1416, 3.1416));
0084   hmgr->addHistoProf1(new TProfile("1003", "MB prof Phi ECAL Barrel SM", 20, 0., 20.));
0085   hmgr->addHistoProf1(new TProfile("2003", "MB prof Phi ECAL Barrel SM", 10, 0., 20.));
0086   hmgr->addHistoProf1(new TProfile("1004", "MB prof Phi ECAL Barrel SM module 1", 20, 0., 20.));
0087   hmgr->addHistoProf1(new TProfile("1005", "MB prof Phi ECAL Barrel SM module 2", 20, 0., 20.));
0088   hmgr->addHistoProf1(new TProfile("1006", "MB prof Phi ECAL Barrel SM module 3", 20, 0., 20.));
0089   hmgr->addHistoProf1(new TProfile("1007", "MB prof Phi ECAL Barrel SM module 4", 20, 0., 20.));
0090 
0091   hmgr->addHistoProf1(new TProfile("1011", "MB prof Eta ECAL Preshower +", 100, 1.65, 2.6));
0092   hmgr->addHistoProf1(new TProfile("1012", "MB prof Phi ECAL Preshower +", 180, -3.1416, 3.1416));
0093 
0094   hmgr->addHistoProf1(new TProfile("1013", "MB prof Eta ECAL Preshower -", 100, -2.6, -1.65));
0095   hmgr->addHistoProf1(new TProfile("1014", "MB prof Phi ECAL Preshower -", 180, -3.1416, 3.1416));
0096 
0097   edm::LogVerbatim("MaterialBudget") << "MaterialBudgetEcalHistos: booking user histos done";
0098 }
0099 
0100 void MaterialBudgetEcalHistos::fillStartTrack() {}
0101 
0102 void MaterialBudgetEcalHistos::fillPerStep() {}
0103 
0104 void MaterialBudgetEcalHistos::fillEndTrack() {
0105   // Total X0
0106   hmgr->getHisto1(11)->Fill(theData->getEta());
0107   hmgr->getHisto1(21)->Fill(theData->getPhi());
0108   hmgr->getHisto2(31)->Fill(theData->getEta(), theData->getPhi());
0109 
0110   hmgr->getHistoProf1(10)->Fill(theData->getEta(), theData->getTotalMB());
0111   hmgr->getHistoProf1(20)->Fill(theData->getPhi(), theData->getTotalMB());
0112   hmgr->getHistoProf2(30)->Fill(theData->getEta(), theData->getPhi(), theData->getTotalMB());
0113 
0114   // ECAL specific
0115   if (fabs(theData->getEta()) <= 1.479) {
0116     static const double twenty(20. * CLHEP::degree);
0117     const double phi(theData->getPhi() + M_PI);
0118     const double phiModTwenty((phi - floor(phi / twenty) * twenty) / CLHEP::degree);
0119     hmgr->getHistoProf1(1001)->Fill(theData->getEta(), theData->getTotalMB());
0120     hmgr->getHistoProf1(1002)->Fill(theData->getPhi(), theData->getTotalMB());
0121     hmgr->getHistoProf1(1003)->Fill(phiModTwenty, theData->getTotalMB());
0122     hmgr->getHistoProf1(2003)->Fill(phiModTwenty, theData->getTotalMB());
0123     if (fabs(theData->getEta()) >= 0. && fabs(theData->getEta()) < 0.435) {
0124       hmgr->getHistoProf1(1004)->Fill(phiModTwenty, theData->getTotalMB());
0125     }
0126     if (fabs(theData->getEta()) >= 0.435 && fabs(theData->getEta()) < 0.783) {
0127       hmgr->getHistoProf1(1005)->Fill(phiModTwenty, theData->getTotalMB());
0128     }
0129     if (fabs(theData->getEta()) > 0.783 && fabs(theData->getEta()) <= 1.131) {
0130       hmgr->getHistoProf1(1006)->Fill(phiModTwenty, theData->getTotalMB());
0131     }
0132     if (fabs(theData->getEta()) > 1.131 && fabs(theData->getEta()) <= 1.479) {
0133       hmgr->getHistoProf1(1007)->Fill(phiModTwenty, theData->getTotalMB());
0134     }
0135   }
0136 
0137   if (theData->getEta() >= 1.653 && theData->getEta() <= 2.6) {
0138     hmgr->getHistoProf1(1011)->Fill(theData->getEta(), theData->getTotalMB());
0139     hmgr->getHistoProf1(1012)->Fill(theData->getPhi(), theData->getTotalMB());
0140   }
0141 
0142   if (theData->getEta() >= -2.6 && theData->getEta() <= -1.653) {
0143     hmgr->getHistoProf1(1013)->Fill(theData->getEta(), theData->getTotalMB());
0144     hmgr->getHistoProf1(1014)->Fill(theData->getPhi(), theData->getTotalMB());
0145   }
0146 }
0147 
0148 void MaterialBudgetEcalHistos::endOfRun() {
0149   edm::LogVerbatim("MaterialBudget") << "MaterialBudgetEcalHistos: Writing histos ROOT file to:" << theFileName;
0150   hmgr->save(theFileName);
0151 }