ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/L1RpcTriggerAnalysis/src/AnaSynch.cc
Revision: 1.3
Committed: Mon Oct 22 06:28:46 2012 UTC (12 years, 6 months ago) by konec
Content type: text/plain
Branch: MAIN
CVS Tags: Artur_11_07_2013_B, Artur_11_07_2013_A, Artur_11_07_2013, Artur_28_06_2013, HEAD
Changes since 1.2: +13 -1 lines
Error occurred while calculating annotation data.
Log Message:
*** empty log message ***

File Contents

# Content
1 #include "UserCode/L1RpcTriggerAnalysis/interface/AnaSynch.h"
2 #include "TProfile.h"
3 #include "TObjArray.h"
4 #include "TH2F.h"
5 #include "TH1D.h"
6 #include "TGraphErrors.h"
7 #include "TF1.h"
8 #include "UserCode/L1RpcTriggerAnalysis/interface/MuonObj.h"
9
10 #include "FWCore/Framework/interface/ESTransientHandle.h"
11 #include "FWCore/Framework/interface/EventSetup.h"
12 #include "CondFormats/RPCObjects/interface/RPCEMap.h"
13 #include "CondFormats/DataRecord/interface/RPCEMapRcd.h"
14 #include "CondFormats/RPCObjects/interface/RPCReadOutMapping.h"
15
16 #include "DQM/RPCMonitorClient/interface/RPCLinkSynchroHistoMaker.h"
17 #include "TH1F.h"
18 #include "TH2F.h"
19 #include "TFile.h"
20 #include <fstream>
21
22 namespace {
23 TH1F *hSynch_delaySummary;
24 TH2F *hSynch_delaySpread, *hSynch_topOccup, *hSynch_topSpread;
25 TH2F *hSynch_notComplete[3];
26 }
27
28
29
30
31 AnaSynch::AnaSynch()
32 : theSynchroStat(true)
33 { }
34
35 void AnaSynch::init(TObjArray& histos)
36 {
37
38 hSynch_delaySummary = new TH1F("hSynch_delaySummary","LinkDelaySummary",8,-3.5, 4.5); hSynch_delaySummary->SetStats(111); histos.Add(hSynch_delaySummary);
39
40 double widthX=1.0/50 ; // bin width of 1/25 BX = 1ns
41 unsigned int nbinsX=2*(Int_t)(3.0/widthX)+1; // nbins for [-3 BX, +3 BX] range
42 double widthY=1.0/50 ; // bin width of 1/25 BX = 1ns
43 unsigned int nbinsY=(Int_t)(7.0/widthY); // nbins for [0 BX, 7 BX[ range
44
45 hSynch_delaySpread = new TH2F("hSynch_delaySpread",
46 "Average signal spread vs average signal arrival per Link Board; Avg signal arrival wrt L1A per Link Board [BX]; Avg signal spread per Link Board [BX]; Link Boards / bin",
47 nbinsX, 0.0-(int)(nbinsX/2)*widthX, 0.0+(int)(nbinsX/2)*widthX,
48 nbinsY, 0.0, 0.0+nbinsY*widthY);
49 // 71,-3.05, 4.05, 31,-0.05,3.05);
50 hSynch_delaySpread->Sumw2();
51 //hSynch_delaySpread->SetStats(0);
52 histos.Add(hSynch_delaySpread);
53
54 hSynch_notComplete[0] = new TH2F("hSynch_notComplete790","FED790: not All Paths hit",36,-0.5,35.5,18,-0.5,17.5); histos.Add(hSynch_notComplete[0]);
55 hSynch_notComplete[1] = new TH2F("hSynch_notComplete791","FED791: not All Paths hit",36,-0.5,35.5,18,-0.5,17.5); histos.Add(hSynch_notComplete[1]);
56 hSynch_notComplete[2] = new TH2F("hSynch_notComplete792","FED792: not All Paths hit",36,-0.5,35.5,18,-0.5,17.5); histos.Add(hSynch_notComplete[2]);
57 for (unsigned int i=0;i<3;++i) {
58 hSynch_notComplete[i]->GetXaxis()->SetNdivisions(512);
59 hSynch_notComplete[i]->GetYaxis()->SetNdivisions(505);
60 hSynch_notComplete[i]->SetXTitle("rmb");
61 hSynch_notComplete[i]->SetYTitle("link");
62 hSynch_notComplete[i]->SetStats(0);
63 }
64 hSynch_topOccup = new TH2F("hSynch_topOccup","Top10 LinkBoard occupancy",8,-0.5,7.5, 10,0.,10.); histos.Add( hSynch_topOccup);
65 hSynch_topSpread = new TH2F("hSynch_topSpread","Top10 LinkBoard delay spread",8,-0.5,7.5, 10,0.,10.); histos.Add( hSynch_topSpread);
66 hSynch_topOccup->GetXaxis()->SetNdivisions(110);
67 hSynch_topSpread->GetXaxis()->SetNdivisions(110);
68 hSynch_topOccup->SetStats(0);
69 hSynch_topSpread->SetStats(0);
70
71 }
72
73 void AnaSynch::beginRun(const edm::Run&, const edm::EventSetup& es)
74 {
75 edm::ESTransientHandle<RPCEMap> readoutMapping;
76 es.get<RPCEMapRcd>().get(readoutMapping);
77 RPCReadOutMapping * cabling = readoutMapping->convert();
78 std::cout <<" INITIALISING READOUT MAP, version: "<< cabling->version() << std::endl;
79 theSynchroStat.init(cabling, true); // second for use of DetNames
80 delete cabling;
81 }
82
83
84 void AnaSynch::run( const EventObj* event, const MuonObj* muon, const RPCRawSynchro::ProdItem & synchro)
85 {
86 std::vector<LinkBoardElectronicIndex> problems;
87 theSynchroStat.add(synchro, problems);
88 for (std::vector<LinkBoardElectronicIndex>::const_iterator it=problems.begin(); it != problems.end(); ++it) {
89 hSynch_notComplete[it->dccId-790]->Fill(it->dccInputChannelNum,it->tbLinkInputNum);
90 }
91 }
92
93 void AnaSynch::endJob()
94 {
95 RPCLinkSynchroHistoMaker hm(theSynchroStat);
96 hm.fill(hSynch_delaySummary, hSynch_delaySpread, hSynch_topOccup, hSynch_topSpread);
97
98 std::ofstream file("l1RpcDelays.txt");
99 file << theSynchroStat.dumpDelays() << std::endl;
100 file.close();
101 }