CMS 3D CMS Logo

L1TCaloLayer1Summary.cc
Go to the documentation of this file.
2 
4  : caloLayer1CICADAScoreToken_(
5  consumes<l1t::CICADABxCollection>(iConfig.getParameter<edm::InputTag>("caloLayer1CICADAScore"))),
6  gtCICADAScoreToken_(consumes<l1t::CICADABxCollection>(iConfig.getParameter<edm::InputTag>("gtCICADAScore"))),
7  simCICADAScoreToken_(consumes<l1t::CICADABxCollection>(iConfig.getParameter<edm::InputTag>("simCICADAScore"))),
8  caloLayer1RegionsToken_(
9  consumes<L1CaloRegionCollection>(iConfig.getParameter<edm::InputTag>("caloLayer1Regions"))),
10  simRegionsToken_(consumes<L1CaloRegionCollection>(iConfig.getParameter<edm::InputTag>("simRegions"))),
11  fedRawData_(consumes<FEDRawDataCollection>(iConfig.getParameter<edm::InputTag>("fedRawDataLabel"))),
12  histFolder_(iConfig.getParameter<std::string>("histFolder")) {}
13 
14 // ------------ method called for each event ------------
16  edm::Handle<FEDRawDataCollection> fedRawDataCollection;
17  iEvent.getByToken(fedRawData_, fedRawDataCollection);
18  if (fedRawDataCollection.isValid()) {
19  for (int iFed = FEDNumbering::MINRCTFEDID + 4; iFed < FEDNumbering::MAXRCTFEDID; iFed += 2) {
20  const FEDRawData& fedRawData = fedRawDataCollection->FEDData(iFed);
21  if (fedRawData.size() == 0) {
22  continue;
23  }
24  const uint64_t* fedRawDataArray = (const uint64_t*)fedRawData.data();
25  UCTDAQRawData daqData(fedRawDataArray);
26 
27  if (daqData.nAMCs() == 7) {
28  UCTAMCRawData amcSlot7(daqData.amcPayload(3));
29  if (amcSlot7.amcNo() == 7) {
30  histoSlot7MinusDaqBxid->Fill(amcSlot7.BXID() - daqData.BXID());
31  }
32  }
33  }
34  }
35 
38  int nRegions = caloLayer1Regions.size();
39 
40  unsigned int maxEtaIdx = 0;
41  for (int iRegion = 0; iRegion < nRegions; iRegion++) {
42  if (maxEtaIdx < caloLayer1Regions[iRegion].gctEta()) {
43  maxEtaIdx = caloLayer1Regions[iRegion].gctEta();
44  }
45  }
46  int matrixSize = maxEtaIdx + 1;
47 
48  bool foundMatrix[2][matrixSize][matrixSize];
49  int etMatrix[2][matrixSize][matrixSize];
50  for (int i = 0; i < 2; i++) {
51  for (int j = 0; j < matrixSize; j++) {
52  for (int k = 0; k < matrixSize; k++) {
53  foundMatrix[i][j][k] = false;
54  etMatrix[i][j][k] = 0;
55  }
56  }
57  }
58 
59  for (int iRegion = 0; iRegion < nRegions; iRegion++) {
60  L1CaloRegion cRegion = caloLayer1Regions[iRegion];
61  L1CaloRegion sRegion = simRegions[iRegion];
62 
63  foundMatrix[0][cRegion.gctEta()][cRegion.gctPhi()] = true;
64  etMatrix[0][cRegion.gctEta()][cRegion.gctPhi()] = cRegion.et();
65  foundMatrix[1][sRegion.gctEta()][sRegion.gctPhi()] = true;
66  etMatrix[1][sRegion.gctEta()][sRegion.gctPhi()] = sRegion.et();
67  }
68  int iRegion = 0;
69  for (int iEta = 0; iEta < matrixSize; iEta++) {
70  for (int iPhi = 0; iPhi < matrixSize; iPhi++) {
71  if (foundMatrix[0][iEta][iPhi] && foundMatrix[1][iEta][iPhi]) {
72  histoCaloRegions->Fill(iRegion, etMatrix[0][iEta][iPhi]);
73  histoSimRegions->Fill(iRegion, etMatrix[1][iEta][iPhi]);
74  histoCaloMinusSimRegions->Fill(iRegion, etMatrix[0][iEta][iPhi] - etMatrix[1][iEta][iPhi]);
75  iRegion++;
76  }
77  }
78  }
79 
80  auto caloCICADAScores = iEvent.get(caloLayer1CICADAScoreToken_);
81  auto gtCICADAScores = iEvent.get(gtCICADAScoreToken_);
82  auto simCICADAScores = iEvent.get(simCICADAScoreToken_);
83 
84  if (caloCICADAScores.size() > 0) {
85  histoCaloLayer1CICADAScore->Fill(caloCICADAScores[0]);
86  if (gtCICADAScores.size() > 0) {
87  histoGtCICADAScore->Fill(gtCICADAScores.at(0, 0));
88  histoCaloMinusGt->Fill(caloCICADAScores[0] - gtCICADAScores.at(0, 0));
89  }
90  if (simCICADAScores.size() > 0) {
91  histoSimCICADAScore->Fill(simCICADAScores[0]);
92  histoCaloMinusSim->Fill(caloCICADAScores[0] - simCICADAScores[0]);
93  }
94  }
95 }
96 
99  histoSlot7MinusDaqBxid = ibooker.book1D("slot7BXID", "Slot 7- DAQ BXID", 50, -20, 20);
100 
101  ibooker.setCurrentFolder(histFolder_ + "/CICADAScore");
102  histoCaloLayer1CICADAScore = ibooker.book1D("caloLayer1CICADAScore", "CaloLayer1 CICADAScore", 50, 0, 200);
103  histoGtCICADAScore = ibooker.book1D("gtCICADAScore", "GT CICADAScore at BX0", 50, 0, 200);
104  histoCaloMinusGt = ibooker.book1D("caloMinusGtCICADAScore", "CaloLayer1 - GT CICADAScore at BX0", 50, -50, 50);
106  ibooker.book1D("simCaloLayer1CICADAScore", "simCaloLayer1 CICADAScore (input: DAQ regions)", 50, 0, 200);
107  histoCaloMinusSim = ibooker.book1D(
108  "caloMinusSimCICADAScore", "CaloLayer1 - simCaloLayer1 (input: DAQ regions) CICADAScore", 50, -50, 50);
109 
110  ibooker.setCurrentFolder(histFolder_ + "/Regions");
112  ibooker.book2D("caloMinusSumRegions",
113  "CaloLayer1 - simCaloLayer1 (input: DAQ trigger primatives) Regions;Region;ET Difference",
114  252,
115  -0.5,
116  252.5,
117  100,
118  -400,
119  400);
120  histoCaloRegions = ibooker.book2D("caloLayer1Regions", "CaloLayer1 Regions;Region;ET", 252, -0.5, 252.5, 100, 0, 800);
121  histoSimRegions = ibooker.book2D("simCaloLayer1Regions",
122  "simCaloLayer1 Regions (input: DAQ trigger primatives);Region;ET",
123  252,
124  -0.5,
125  252.5,
126  100,
127  0,
128  800);
129 }
130 
131 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
133  // l1tCaloLayer1Summary
135  desc.add<edm::InputTag>("caloLayer1CICADAScore", edm::InputTag("caloLayer1Digis", "CICADAScore"));
136  desc.add<edm::InputTag>("gtCICADAScore", edm::InputTag("gtTestcrateStage2Digis", "CICADAScore"));
137  desc.add<edm::InputTag>("simCICADAScore", edm::InputTag("simCaloStage2Layer1Summary", "CICADAScore"));
138  desc.add<edm::InputTag>("caloLayer1Regions", edm::InputTag("caloLayer1Digis"));
139  desc.add<edm::InputTag>("simRegions", edm::InputTag("simCaloStage2Layer1Digis"));
140  desc.add<edm::InputTag>("fedRawDataLabel", edm::InputTag("rawDataCollector"));
141  desc.add<std::string>("histFolder", "L1T/L1TCaloLayer1Summary");
142  descriptions.add("l1tCaloLayer1Summary", desc);
143 }
edm::EDGetTokenT< FEDRawDataCollection > fedRawData_
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
uint32_t BXID()
Definition: UCTDAQRawData.h:37
edm::EDGetTokenT< L1CaloRegionCollection > simRegionsToken_
dqm::reco::MonitorElement * histoGtCICADAScore
dqm::reco::MonitorElement * histoCaloMinusSim
edm::EDGetTokenT< l1t::CICADABxCollection > gtCICADAScoreToken_
delete x;
Definition: CaloConfig.h:22
void analyze(const edm::Event &, const edm::EventSetup &) override
void Fill(long long x)
edm::EDGetTokenT< L1CaloRegionCollection > caloLayer1RegionsToken_
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< l1t::CICADABxCollection > caloLayer1CICADAScoreToken_
L1TCaloLayer1Summary(const edm::ParameterSet &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
uint32_t nAMCs()
Definition: UCTDAQRawData.h:41
void bookHistograms(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &) override
dqm::reco::MonitorElement * histoSimCICADAScore
edm::EDGetTokenT< l1t::CICADABxCollection > simCICADAScoreToken_
const uint32_t * amcPayload(uint32_t amc)
dqm::reco::MonitorElement * histoCaloLayer1CICADAScore
unsigned gctEta() const
get GCT eta index
Definition: L1CaloRegion.h:153
unsigned long long uint64_t
Definition: Time.h:13
unsigned et() const
get Et
Definition: L1CaloRegion.h:90
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:221
dqm::reco::MonitorElement * histoCaloMinusSimRegions
void add(std::string const &label, ParameterSetDescription const &psetDescription)
dqm::reco::MonitorElement * histoCaloMinusGt
dqm::reco::MonitorElement * histoCaloRegions
bool isValid() const
Definition: HandleBase.h:70
dqm::reco::MonitorElement * histoSimRegions
HLT enums.
unsigned gctPhi() const
get GCT phi index
Definition: L1CaloRegion.h:156
A calorimeter trigger region (sum of 4x4 trigger towers)
Definition: L1CaloRegion.h:21
BXVector< float > CICADABxCollection
Definition: CICADA.h:7
std::vector< L1CaloRegion > L1CaloRegionCollection
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
dqm::reco::MonitorElement * histoSlot7MinusDaqBxid
Definition: Run.h:45