1+ #include " DQM/L1TMonitor/interface/L1TCaloLayer1Summary.h"
2+
3+ L1TCaloLayer1Summary::L1TCaloLayer1Summary (const edm::ParameterSet& iConfig)
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 ------------
15+ void L1TCaloLayer1Summary::analyze (const edm::Event& iEvent, const edm::EventSetup& iSetup) {
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+
36+ L1CaloRegionCollection caloLayer1Regions = iEvent.get (caloLayer1RegionsToken_);
37+ L1CaloRegionCollection simRegions = iEvent.get (simRegionsToken_);
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+
97+ void L1TCaloLayer1Summary::bookHistograms (DQMStore::IBooker& ibooker, edm::Run const &, edm::EventSetup const &) {
98+ ibooker.setCurrentFolder (histFolder_);
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 );
105+ histoSimCICADAScore =
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" );
111+ histoCaloMinusSimRegions =
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 ------------
132+ void L1TCaloLayer1Summary::fillDescriptions (edm::ConfigurationDescriptions& descriptions) {
133+ // l1tCaloLayer1Summary
134+ edm::ParameterSetDescription desc;
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+ }
0 commit comments