File indexing completed on 2024-04-06 12:19:33
0001
0002
0003 #include <memory>
0004 #include <cmath>
0005 #include <iostream>
0006 #include <sstream>
0007
0008
0009 #include "FWCore/Framework/interface/Frameworkfwd.h"
0010 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0011
0012 #include "FWCore/Framework/interface/Event.h"
0013 #include "FWCore/Framework/interface/MakerMacros.h"
0014
0015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0016 #include "FWCore/ServiceRegistry/interface/Service.h"
0017 #include "CommonTools/UtilAlgos/interface/TFileService.h"
0018
0019 #include "L1Trigger/CSCTrackFinder/interface/CSCSectorReceiverLUT.h"
0020 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h"
0021 #include "DataFormats/L1CSCTrackFinder/interface/TrackStub.h" //
0022 #include "DataFormats/L1CSCTrackFinder/interface/CSCTriggerContainer.h"
0023 #include "DataFormats/MuonDetId/interface/CSCTriggerNumbering.h"
0024 #include "L1Trigger/CSCTrackFinder/interface/CSCTrackFinderDataTypes.h"
0025
0026 #include "L1Trigger/CSCTrackFinder/test/src/RunSRLUTs.h"
0027
0028 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0029 #include "DataFormats/VertexReco/interface/Vertex.h"
0030
0031 #include "FWCore/Framework/interface/LuminosityBlock.h"
0032 #include "DataFormats/Luminosity/interface/LumiSummary.h"
0033
0034 #include "TH1F.h"
0035 #include "TFile.h"
0036 #include "TTree.h"
0037
0038 using namespace std;
0039 using namespace edm;
0040
0041 class LCTOccupancies : public edm::one::EDAnalyzer<edm::one::SharedResources, edm::one::WatchLuminosityBlocks> {
0042 public:
0043 explicit LCTOccupancies(const edm::ParameterSet&);
0044 ~LCTOccupancies() override;
0045
0046 private:
0047 void beginJob() override;
0048 void analyze(const edm::Event&, const edm::EventSetup&) override;
0049 void endJob() override;
0050 void beginLuminosityBlock(edm::LuminosityBlock const& iLumiBlock, edm::EventSetup const& iSetup) override;
0051
0052
0053
0054
0055
0056 edm::InputTag lctsTag;
0057 edm::InputTag vertexColTag;
0058 edm::Service<TFileService> fs;
0059 csctf_analysis::RunSRLUTs* runSRLUTs;
0060 float insLumi;
0061 int nVertex;
0062 bool haveRECO;
0063 int singleSectorNum;
0064 std::string outTreeFileName;
0065
0066 TH1F* hNVertex;
0067 TH1F* hInsLumi;
0068
0069 TH1F* hMPCLink;
0070 TH1F* hLocalPhi;
0071 TH1F* hPhi;
0072 TH1F* hEta;
0073 TH1F* hPhiPacked;
0074 TH1F* hEtaPacked;
0075 TH1F* hBx;
0076
0077 TH1F* hSector;
0078 TH1F* hStation;
0079 TH1F* hEndcap;
0080 TH1F* hSubSector;
0081
0082 TH1F* hOccStation1SubSec1;
0083 TH1F* hOccStation1SubSec2;
0084 TH1F* hOccStation2;
0085 TH1F* hOccStation3;
0086 TH1F* hOccStation4;
0087 TH1F* hOccMax;
0088 TH1F* hOccMaxNo0;
0089 TH1F* hStubsTotal;
0090
0091 TH1F* hOccME11a;
0092 TH1F* hOccME11b;
0093 TH1F* hOccME12;
0094 TH1F* hOccME13;
0095 TH1F* hOccME21;
0096 TH1F* hOccME22;
0097 TH1F* hOccME31;
0098 TH1F* hOccME32;
0099 TH1F* hOccME41;
0100 TH1F* hOccME42;
0101 TH1F* hOccME42SingleSector;
0102
0103 std::vector<TH1F*> hOccME1ChambsSubSec1;
0104 std::vector<TH1F*> hOccME1ChambsSubSec2;
0105 std::vector<TH1F*> hOccME2Chambs;
0106 std::vector<TH1F*> hOccME3Chambs;
0107 std::vector<TH1F*> hOccME4Chambs;
0108
0109
0110 TFile* treeFile;
0111 TTree* tree;
0112 std::vector<int> occStation1SubSec1;
0113 std::vector<int> occStation1SubSec2;
0114 std::vector<int> occStation2;
0115 std::vector<int> occStation3;
0116 std::vector<int> occStation4;
0117
0118 std::vector<std::vector<int> > occME1ChamberSubSec1;
0119 std::vector<std::vector<int> > occME1ChamberSubSec2;
0120 std::vector<std::vector<int> > occME2Chamber;
0121 std::vector<std::vector<int> > occME3Chamber;
0122 std::vector<std::vector<int> > occME4Chamber;
0123 };
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135 LCTOccupancies::LCTOccupancies(const edm::ParameterSet& iConfig)
0136
0137 {
0138 usesResource(TFileService::kSharedResource);
0139
0140
0141 runSRLUTs = new csctf_analysis::RunSRLUTs();
0142 lctsTag = iConfig.getParameter<edm::InputTag>("lctsTag");
0143 vertexColTag = iConfig.getParameter<edm::InputTag>("vertexColTag");
0144 outTreeFileName = iConfig.getUntrackedParameter<std::string>("outTreeFileName");
0145 haveRECO = iConfig.getUntrackedParameter<bool>("haveRECO");
0146 singleSectorNum = iConfig.getUntrackedParameter<int>("singleSectorNum");
0147
0148 treeFile = new TFile(outTreeFileName.c_str(), "RECREATE");
0149 tree = new TTree("tree", "tree");
0150
0151 occStation1SubSec1 = std::vector<int>(12, 0);
0152 occStation1SubSec2 = std::vector<int>(12, 0);
0153 occStation2 = std::vector<int>(12, 0);
0154 occStation3 = std::vector<int>(12, 0);
0155 occStation4 = std::vector<int>(12, 0);
0156
0157 for (int iSector = 0; iSector < 12; iSector++) {
0158 occME1ChamberSubSec1.push_back(std::vector<int>(12, 0));
0159 occME1ChamberSubSec2.push_back(std::vector<int>(12, 0));
0160 occME2Chamber.push_back(std::vector<int>(9, 0));
0161 occME3Chamber.push_back(std::vector<int>(9, 0));
0162 occME4Chamber.push_back(std::vector<int>(9, 0));
0163 }
0164
0165 tree->Branch("nVertex", &nVertex, "nVertex/I");
0166 tree->Branch("insLumi", &insLumi, "insLumi/F");
0167
0168 tree->Branch("occStation1SubSec1", "vector<int>", &occStation1SubSec1);
0169 tree->Branch("occStation1SubSec2", "vector<int>", &occStation1SubSec2);
0170 tree->Branch("occStation2", "vector<int>", &occStation2);
0171 tree->Branch("occStation3", "vector<int>", &occStation3);
0172 tree->Branch("occStation4", "vector<int>", &occStation4);
0173
0174 tree->Branch("occME1ChamberSubSec1", "vector<std::vector<int> >", &occME1ChamberSubSec1);
0175 tree->Branch("occME1ChamberSubSec2", "vector<std::vector<int> >", &occME1ChamberSubSec2);
0176 tree->Branch("occME2Chamber", "vector<std::vector<int> >", &occME2Chamber);
0177 tree->Branch("occME3Chamber", "vector<std::vector<int> >", &occME3Chamber);
0178 tree->Branch("occME4Chamber", "vector<std::vector<int> >", &occME4Chamber);
0179 }
0180
0181 LCTOccupancies::~LCTOccupancies() {
0182
0183
0184 treeFile->cd();
0185 tree->Write();
0186 delete runSRLUTs;
0187 }
0188
0189
0190
0191
0192
0193
0194 void LCTOccupancies::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0195
0196
0197
0198 nVertex = 0;
0199
0200 std::vector<csctf::TrackStub> stubs;
0201 std::vector<csctf::TrackStub>::const_iterator stub;
0202
0203
0204 edm::Handle<CSCCorrelatedLCTDigiCollection> lctDigiColls;
0205 iEvent.getByLabel(lctsTag, lctDigiColls);
0206
0207 std::vector<csctf::TrackStub>* trackStubs = new std::vector<csctf::TrackStub>;
0208 runSRLUTs->makeTrackStubs(lctDigiColls.product(), trackStubs);
0209
0210 std::vector<csctf::TrackStub>::const_iterator ts = trackStubs->begin();
0211 std::vector<csctf::TrackStub>::const_iterator tsEnd = trackStubs->end();
0212
0213 for (unsigned i = 0; i < 12; i++) {
0214 }
0215
0216 std::vector<int> occME11a(24, 0);
0217 std::vector<int> occME11b(24, 0);
0218 std::vector<int> occME12(24, 0);
0219 std::vector<int> occME13(24, 0);
0220 std::vector<int> occME21(12, 0);
0221 std::vector<int> occME22(12, 0);
0222 std::vector<int> occME31(12, 0);
0223 std::vector<int> occME32(12, 0);
0224 std::vector<int> occME41(12, 0);
0225 std::vector<int> occME42(12, 0);
0226 int occME42SingleSector = 0;
0227
0228 for (int iSectors = 0; iSectors < 12; iSectors++) {
0229 occStation1SubSec1[iSectors] = 0;
0230 occStation1SubSec2[iSectors] = 0;
0231 occStation2[iSectors] = 0;
0232 occStation3[iSectors] = 0;
0233 occStation4[iSectors] = 0;
0234 for (int iChambers = 0; iChambers < 12; iChambers++) {
0235 occME1ChamberSubSec1[iSectors][iChambers] = 0;
0236 occME1ChamberSubSec2[iSectors][iChambers] = 0;
0237 if (iChambers < 9) {
0238 occME2Chamber[iSectors][iChambers] = 0;
0239 occME3Chamber[iSectors][iChambers] = 0;
0240 occME4Chamber[iSectors][iChambers] = 0;
0241 }
0242 }
0243 }
0244
0245 for (; ts != tsEnd; ts++) {
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259 unsigned sector = ts->sector() - 1;
0260
0261 if (ts->BX() != 0)
0262 continue;
0263 hMPCLink->Fill(ts->getMPCLink());
0264 hLocalPhi->Fill(ts->phiValue());
0265 hPhi->Fill(ts->phiValue() + 15.0 * M_PI / 180 + (sector)*60.0 * M_PI / 180);
0266 hPhiPacked->Fill(ts->phiPacked());
0267 hEta->Fill(ts->etaValue());
0268 hEtaPacked->Fill(ts->etaPacked());
0269 hBx->Fill(ts->BX());
0270 int station = ts->station();
0271 int subsector = ts->subsector();
0272
0273 CSCDetId detId(ts->getDetId());
0274 int ring = detId.ring();
0275 int triggerChamber = CSCTriggerNumbering::triggerCscIdFromLabels(detId);
0276
0277
0278
0279 if (ts->endcap() == 2) {
0280 station = -station;
0281 sector = sector + 6;
0282 }
0283 hSector->Fill(sector + 1);
0284 hStation->Fill(station);
0285 hSubSector->Fill(subsector);
0286
0287
0288
0289
0290
0291 station = abs(station);
0292 if (station == 1) {
0293 if (subsector == 1) {
0294 occME1ChamberSubSec1[sector][triggerChamber - 1]++;
0295 occStation1SubSec1[sector]++;
0296 if (ring == 4)
0297 occME11a[sector]++;
0298 else if (ring == 1)
0299 occME11b[sector]++;
0300 else if (ring == 2)
0301 occME12[sector]++;
0302 else if (ring == 3)
0303 occME13[sector]++;
0304 } else {
0305 occME1ChamberSubSec2[sector][triggerChamber - 1]++;
0306 occStation1SubSec2[sector]++;
0307 if (ring == 4)
0308 occME11a[sector + 12]++;
0309 else if (ring == 1)
0310 occME11b[sector + 12]++;
0311 else if (ring == 2)
0312 occME12[sector + 12]++;
0313 else if (ring == 3)
0314 occME13[sector + 12]++;
0315 }
0316 }
0317 if (station == 2) {
0318 occME2Chamber[sector][triggerChamber - 1]++;
0319 occStation2[sector]++;
0320 if (ring == 1)
0321 occME21[sector]++;
0322 else if (ring == 2)
0323 occME22[sector]++;
0324 }
0325 if (station == 3) {
0326 occME3Chamber[sector][triggerChamber - 1]++;
0327 occStation3[sector]++;
0328 if (ring == 1)
0329 occME31[sector]++;
0330 else if (ring == 2)
0331 occME32[sector]++;
0332 }
0333 if (station == 4) {
0334 occME4Chamber[sector][triggerChamber - 1]++;
0335 occStation4[sector]++;
0336 if (ring == 1)
0337 occME41[sector]++;
0338 else if (ring == 2) {
0339 occME42[sector]++;
0340 occME42SingleSector++;
0341 }
0342 }
0343 }
0344
0345 int maxOcc = 0;
0346
0347 for (unsigned iSector = 0; iSector < 12; iSector++) {
0348 if (singleSectorNum != -1 && singleSectorNum != (int)iSector)
0349 continue;
0350 hOccStation1SubSec1->Fill(occStation1SubSec1[iSector]);
0351 hOccStation1SubSec2->Fill(occStation1SubSec2[iSector]);
0352 hOccStation2->Fill(occStation2[iSector]);
0353 hOccStation3->Fill(occStation3[iSector]);
0354 hOccStation4->Fill(occStation4[iSector]);
0355
0356 if (occStation1SubSec1[iSector] > maxOcc)
0357 maxOcc = occStation1SubSec1[iSector];
0358 if (occStation1SubSec2[iSector] > maxOcc)
0359 maxOcc = occStation1SubSec2[iSector];
0360 if (occStation2[iSector] > maxOcc)
0361 maxOcc = occStation2[iSector];
0362 if (occStation3[iSector] > maxOcc)
0363 maxOcc = occStation3[iSector];
0364 if (occStation4[iSector] > maxOcc)
0365 maxOcc = occStation4[iSector];
0366 }
0367 hOccMax->Fill(maxOcc);
0368 if (maxOcc > 0)
0369 hOccMaxNo0->Fill(maxOcc);
0370
0371 hStubsTotal->Fill(trackStubs->size());
0372
0373 for (unsigned iSector = 0; iSector < 24; iSector++) {
0374 if (singleSectorNum != -1 && abs(singleSectorNum) != (int)iSector && abs(singleSectorNum) != (int)iSector - 12)
0375 continue;
0376 hOccME11a->Fill(occME11a[iSector]);
0377 hOccME11b->Fill(occME11b[iSector]);
0378 hOccME12->Fill(occME12[iSector]);
0379 hOccME13->Fill(occME13[iSector]);
0380 if (iSector < 12) {
0381 hOccME21->Fill(occME21[iSector]);
0382 hOccME22->Fill(occME22[iSector]);
0383 hOccME31->Fill(occME31[iSector]);
0384 hOccME32->Fill(occME32[iSector]);
0385 hOccME41->Fill(occME41[iSector]);
0386 hOccME42->Fill(occME42[iSector]);
0387 }
0388 }
0389 hOccME42SingleSector->Fill(occME42SingleSector);
0390
0391 for (unsigned iChamb = 0; iChamb < 12; iChamb++) {
0392 for (unsigned iSector = 0; iSector < 12; iSector++) {
0393 if (singleSectorNum != -1 && abs(singleSectorNum) != (int)iSector && abs(singleSectorNum) != (int)iSector - 12)
0394 continue;
0395 hOccME1ChambsSubSec1[iChamb]->Fill(occME1ChamberSubSec1[iSector][iChamb]);
0396 hOccME1ChambsSubSec2[iChamb]->Fill(occME1ChamberSubSec2[iSector][iChamb]);
0397 if (iChamb < 9) {
0398 hOccME2Chambs[iChamb]->Fill(occME2Chamber[iSector][iChamb]);
0399 hOccME3Chambs[iChamb]->Fill(occME3Chamber[iSector][iChamb]);
0400 hOccME4Chambs[iChamb]->Fill(occME4Chamber[iSector][iChamb]);
0401 }
0402 }
0403 }
0404
0405
0406
0407 if (haveRECO)
0408 if (vertexColTag.label() != "null") {
0409 edm::Handle<reco::VertexCollection> vertexCol;
0410 iEvent.getByLabel(vertexColTag, vertexCol);
0411 reco::VertexCollection::const_iterator vertex;
0412 for (vertex = vertexCol->begin(); vertex != vertexCol->end(); vertex++) {
0413 if (vertex->isValid() && !vertex->isFake())
0414 nVertex++;
0415 }
0416
0417
0418 hNVertex->Fill(nVertex);
0419 }
0420
0421 tree->Fill();
0422 }
0423
0424
0425 void LCTOccupancies::beginJob() {
0426 hNVertex = fs->make<TH1F>("NVertex", "N Primary Vertices", 30, 0, 30);
0427 hNVertex->GetXaxis()->SetTitle("N Primary Vertices");
0428 hNVertex->GetYaxis()->SetTitle("Counts");
0429 hInsLumi = fs->make<TH1F>("InsLumi", "Lumi Section Instantanious Luminosity", 10000, 0, 1000000);
0430 hInsLumi->GetXaxis()->SetTitle("Lumi Section Instantanious Luminosity (Uncorrected HF--10^{30} cm^{2}s^{-1})");
0431 hInsLumi->GetYaxis()->SetTitle("Counts");
0432
0433 hMPCLink = fs->make<TH1F>("MPCLink", "Stub MPC Link Number", 5, -1, 4);
0434 hMPCLink->GetXaxis()->SetTitle("MPC Link");
0435 hMPCLink->GetYaxis()->SetTitle("Counts");
0436 hLocalPhi = fs->make<TH1F>("LocalPhi", "Stub Local #phi", 4096, 0, 2.0 * 62.0 * M_PI / 180.0);
0437 hLocalPhi->GetXaxis()->SetTitle("Local #phi");
0438 hLocalPhi->GetYaxis()->SetTitle("Counts");
0439 hPhi = fs->make<TH1F>("Phi", "Stub #phi", 100, 0, 3.2);
0440 hPhi->GetXaxis()->SetTitle("#phi");
0441 hPhi->GetYaxis()->SetTitle("Counts");
0442 hPhiPacked = fs->make<TH1F>("PhiPacked", "Stub #phi Packed", 4096, 0, 4096);
0443 hPhiPacked->GetXaxis()->SetTitle("#phi Packed");
0444 hPhiPacked->GetYaxis()->SetTitle("Counts");
0445 hEta = fs->make<TH1F>("Eta", "Stub |#eta|", 128, 0.9, 2.4);
0446 hEta->GetXaxis()->SetTitle("|#eta|");
0447 hEta->GetYaxis()->SetTitle("Counts");
0448 hEtaPacked = fs->make<TH1F>("EtaPacked", "Stub #eta Packed", 128, 0, 128);
0449 hEtaPacked->GetXaxis()->SetTitle("#eta Packed");
0450 hEtaPacked->GetYaxis()->SetTitle("Counts");
0451 hBx = fs->make<TH1F>("Bx", "Stub Bx Number", 15, 0, 15);
0452 hBx->GetXaxis()->SetTitle("bx");
0453 hBx->GetYaxis()->SetTitle("Counts");
0454
0455 hStation = fs->make<TH1F>("Station", "Stub Station", 9, -4.5, 4.5);
0456 hStation->GetXaxis()->SetTitle("Station");
0457 hStation->GetYaxis()->SetTitle("Counts");
0458 hSector = fs->make<TH1F>("Sector", "Stub Sector", 12, 0.5, 12.5);
0459 hSector->GetXaxis()->SetTitle("Sector");
0460 hSector->GetYaxis()->SetTitle("Counts");
0461 hSubSector = fs->make<TH1F>("SubSector", "Stub SubSector", 3, 0, 3);
0462 hSubSector->GetXaxis()->SetTitle("SubSector");
0463 hSubSector->GetYaxis()->SetTitle("Counts");
0464
0465 hOccStation1SubSec1 = fs->make<TH1F>("OccStation1SubSec1", "Stub Occupancy, Station 1, Subsector 1", 5, -0.5, 4.5);
0466 hOccStation1SubSec1->GetXaxis()->SetTitle("Stub Occupancy, Station 1, Subsector 1, Summed over Sectors");
0467 hOccStation1SubSec1->GetYaxis()->SetTitle("Counts");
0468 hOccStation1SubSec2 = fs->make<TH1F>("OccStation1SubSec2", "Stub Occupancy, Station 1, Subsector 2", 5, -0.5, 4.5);
0469 hOccStation1SubSec2->GetXaxis()->SetTitle("Stub Occupancy, Station 1, Subsector 1, Summed over Sectors");
0470 hOccStation1SubSec2->GetYaxis()->SetTitle("Counts");
0471 hOccStation2 = fs->make<TH1F>("OccStation2", "Stub Occupancy, Station 2", 5, -0.5, 4.5);
0472 hOccStation2->GetXaxis()->SetTitle("Stub Occupancy, Station 2, Summed over Sectors");
0473 hOccStation2->GetYaxis()->SetTitle("Counts");
0474 hOccStation3 = fs->make<TH1F>("OccStation3", "Stub Occupancy, Station 3", 5, -0.5, 4.5);
0475 hOccStation3->GetXaxis()->SetTitle("Stub Occupancy, Station 3, Summed over Sectors");
0476 hOccStation3->GetYaxis()->SetTitle("Counts");
0477 hOccStation4 = fs->make<TH1F>("OccStation4", "Stub Occupancy, Station 4", 5, -0.5, 4.5);
0478 hOccStation4->GetXaxis()->SetTitle("Stub Occupancy, Station 4, Summed over Sectors");
0479 hOccStation4->GetYaxis()->SetTitle("Counts");
0480 hOccMax = fs->make<TH1F>("OccMax", "Maximum Stub Occupancy", 5, -0.5, 4.5);
0481 hOccMax->GetXaxis()->SetTitle("Maximum Stub Occupancy of Stations, Sectors, and Subsectors");
0482 hOccMax->GetYaxis()->SetTitle("Counts");
0483 hOccMaxNo0 = fs->make<TH1F>("OccMaxNo0", "Maximum Stub Occupancy", 4, 0.5, 4.5);
0484 hOccMaxNo0->GetXaxis()->SetTitle("Maximum Stub Occupancy of Stations, Sectors, and Subsectors");
0485 hOccMaxNo0->GetYaxis()->SetTitle("Counts");
0486 hStubsTotal = fs->make<TH1F>("StubsTotal", "N Stubs", 20, 0, 20);
0487 hStubsTotal->GetXaxis()->SetTitle("N Stubs Unpacked in Event");
0488 hStubsTotal->GetYaxis()->SetTitle("Counts");
0489
0490 hOccME11a = fs->make<TH1F>("OccME11a", "Stub Occupancy, ME11a, Summed over Sectors, Subsectors", 5, -0.5, 4.5);
0491 hOccME11a->GetXaxis()->SetTitle("Stub Occupancy, ME11a, Summed over Sectors, Subsectors");
0492 hOccME11a->GetYaxis()->SetTitle("Counts");
0493 hOccME11b = fs->make<TH1F>("OccME11b", "Stub Occupancy, ME11b, Summed over Sectors, Subsectors", 5, -0.5, 4.5);
0494 hOccME11b->GetXaxis()->SetTitle("Stub Occupancy, ME11b, Summed over Sectors, Subsectors");
0495 hOccME11b->GetYaxis()->SetTitle("Counts");
0496 hOccME12 = fs->make<TH1F>("OccME12", "Stub Occupancy, ME12, Summed over Sectors, Subsectors", 5, -0.5, 4.5);
0497 hOccME12->GetXaxis()->SetTitle("Stub Occupancy, ME12, Summed over Sectors, Subsectors");
0498 hOccME12->GetYaxis()->SetTitle("Counts");
0499 hOccME13 = fs->make<TH1F>("OccME13", "Stub Occupancy, ME13, Summed over Sectors, Subsectors", 5, -0.5, 4.5);
0500 hOccME13->GetXaxis()->SetTitle("Stub Occupancy, ME13, Summed over Sectors, Subsectors");
0501 hOccME13->GetYaxis()->SetTitle("Counts");
0502 hOccME21 = fs->make<TH1F>("OccME21", "Stub Occupancy, ME21, Summed over Sectors", 5, -0.5, 4.5);
0503 hOccME21->GetXaxis()->SetTitle("Stub Occupancy, ME21, Summed over Sectors");
0504 hOccME21->GetYaxis()->SetTitle("Counts");
0505 hOccME22 = fs->make<TH1F>("OccME22", "Stub Occupancy, ME22, Summed over Sectors", 5, -0.5, 4.5);
0506 hOccME22->GetXaxis()->SetTitle("Stub Occupancy, ME22, Summed over Sectors");
0507 hOccME22->GetYaxis()->SetTitle("Counts");
0508 hOccME31 = fs->make<TH1F>("OccME31", "Stub Occupancy, ME31, Summed over Sectors", 5, -0.5, 4.5);
0509 hOccME31->GetXaxis()->SetTitle("Stub Occupancy, ME31, Summed over Sectors");
0510 hOccME31->GetYaxis()->SetTitle("Counts");
0511 hOccME32 = fs->make<TH1F>("OccME32", "Stub Occupancy, ME32, Summed over Sectors", 5, -0.5, 4.5);
0512 hOccME32->GetXaxis()->SetTitle("Stub Occupancy, ME32, Summed over Sectors");
0513 hOccME32->GetYaxis()->SetTitle("Counts");
0514 hOccME41 = fs->make<TH1F>("OccME41", "Stub Occupancy, ME41, Summed over Sectors", 5, -0.5, 4.5);
0515 hOccME41->GetXaxis()->SetTitle("Stub Occupancy, ME41, Summed over Sectors");
0516 hOccME41->GetYaxis()->SetTitle("Counts");
0517 hOccME42 = fs->make<TH1F>("OccME42", "Stub Occupancy, ME42, Summed over Sectors", 5, -0.5, 4.5);
0518 hOccME42->GetXaxis()->SetTitle("Stub Occupancy, ME42, Summed over Sectors");
0519 hOccME42->GetYaxis()->SetTitle("Counts");
0520 hOccME42SingleSector =
0521 fs->make<TH1F>("OccME42SingleSector", "Stub Occupancy, ME42, All Stubs in 1 Sector", 5, -0.5, 4.5);
0522 hOccME42SingleSector->GetXaxis()->SetTitle("Stub Occupancy, ME42");
0523 hOccME42SingleSector->GetYaxis()->SetTitle("Counts");
0524
0525
0526 TFileDirectory chambsME1Dir = fs->mkdir("chambsME1");
0527 TFileDirectory chambsME2Dir = fs->mkdir("chambsME2");
0528 TFileDirectory chambsME3Dir = fs->mkdir("chambsME3");
0529 TFileDirectory chambsME4Dir = fs->mkdir("chambsME4");
0530
0531 for (int i = 0; i < 12; i++) {
0532 std::stringstream tmpName;
0533 std::stringstream tmpTitle;
0534 tmpName << "OccME1Chamb" << i + 1;
0535 tmpTitle << "Stub Occupancy ME1, Chamber " << i + 1 << " Summed Over Sectors, SubSectors";
0536 TH1F* tempHist = chambsME1Dir.make<TH1F>(tmpName.str().c_str(), tmpTitle.str().c_str(), 3, -0.5, 2.5);
0537 tempHist->GetXaxis()->SetTitle(tmpTitle.str().c_str());
0538 tempHist->GetYaxis()->SetTitle("Counts");
0539 hOccME1ChambsSubSec1.push_back(tempHist);
0540 hOccME1ChambsSubSec2.push_back((TH1F*)tempHist->Clone());
0541 }
0542
0543 for (int i = 0; i < 9; i++) {
0544 for (int j = 2; j < 5; j++) {
0545 std::stringstream tmpName;
0546 std::stringstream tmpTitle;
0547 tmpName << "OccME" << j << "Chamb" << i + 1;
0548 tmpTitle << "Stub Occupancy ME" << j << ", Chamber " << i + 1 << " Summed Over Sectors";
0549 TH1F* tempHist;
0550 if (j == 2) {
0551 tempHist = chambsME2Dir.make<TH1F>(tmpName.str().c_str(), tmpTitle.str().c_str(), 3, -0.5, 2.5);
0552 hOccME2Chambs.push_back(tempHist);
0553 } else if (j == 3) {
0554 tempHist = chambsME3Dir.make<TH1F>(tmpName.str().c_str(), tmpTitle.str().c_str(), 3, -0.5, 2.5);
0555 hOccME3Chambs.push_back(tempHist);
0556 } else if (j == 4) {
0557 tempHist = chambsME4Dir.make<TH1F>(tmpName.str().c_str(), tmpTitle.str().c_str(), 3, -0.5, 2.5);
0558 hOccME4Chambs.push_back(tempHist);
0559 } else
0560 std::cout << "Warning: problem in initializing Chamber Occ hists!" << std::endl;
0561
0562 tempHist->GetXaxis()->SetTitle(tmpTitle.str().c_str());
0563 tempHist->GetYaxis()->SetTitle("Counts");
0564 }
0565 }
0566 }
0567
0568
0569 void LCTOccupancies::endJob() {
0570 TH1F* hOccStation1AddSubSec = fs->make<TH1F>("OccStation1AddSubSec", "Stub Occupancy, Station 1", 5, -0.5, 4.5);
0571 hOccStation1AddSubSec->GetXaxis()->SetTitle("Stub Occupancy, Station 1, Summed over Sectors, Subsectors");
0572 hOccStation1AddSubSec->GetYaxis()->SetTitle("Counts");
0573 TH1F* hOccAddStations = fs->make<TH1F>("OccAddStation", "Stub Occupancy", 5, -0.5, 4.5);
0574 hOccAddStations->GetXaxis()->SetTitle("Stub Occupancy, Summed over Stations, Sectors, Subsectors");
0575 hOccAddStations->GetYaxis()->SetTitle("Counts");
0576
0577 hOccStation1AddSubSec->Add(hOccStation1SubSec1);
0578 hOccStation1AddSubSec->Add(hOccStation1SubSec2);
0579 hOccAddStations->Add(hOccStation1SubSec1);
0580 hOccAddStations->Add(hOccStation1SubSec2);
0581 hOccAddStations->Add(hOccStation2);
0582 hOccAddStations->Add(hOccStation3);
0583 hOccAddStations->Add(hOccStation4);
0584 }
0585
0586 void LCTOccupancies::beginLuminosityBlock(edm::LuminosityBlock const& iLumiBlock, edm::EventSetup const& iSetup) {
0587 if (haveRECO) {
0588 edm::Handle<LumiSummary> lumiSummary;
0589 iLumiBlock.getByLabel("lumiProducer", lumiSummary);
0590
0591
0592
0593
0594 insLumi = lumiSummary->avgInsDelLumi();
0595
0596 hInsLumi->Fill(insLumi);
0597 }
0598 }
0599
0600
0601 DEFINE_FWK_MODULE(LCTOccupancies);