1 |
/*
|
2 |
* See header file for a description of this class.
|
3 |
*
|
4 |
* $Date: 2010/12/15 11:52:26 $
|
5 |
* $Revision: 1.3 $
|
6 |
* \author G. Cerminara - INFN Torino
|
7 |
*/
|
8 |
|
9 |
#include "UserCode/DTDPGAnalysis/src/DTROUtility.h"
|
10 |
|
11 |
#include "TFile.h"
|
12 |
#include "TH1F.h"
|
13 |
|
14 |
#include <sstream>
|
15 |
#include <iostream>
|
16 |
|
17 |
using namespace std;
|
18 |
|
19 |
DTROUtility::DTROUtility( TFile* file, const std::string mainFolder) {
|
20 |
|
21 |
// Use FEDIntegrity Monitor to determine if a given FED is in the RO
|
22 |
|
23 |
//const TH1F *fedIntegrityHisto = (const TH1F *) file->Get(string(mainFolder + "FEDIntegrity_DT/FEDEntries").c_str());
|
24 |
//const TH1F *fedIntegrityHistoNF = (const TH1F *) file->Get(string(mainFolder + "FEDIntegrity_DT/FEDNonFatal").c_str());
|
25 |
//const TH1F *fedIntegrityHistoF = (const TH1F *) file->Get(string(mainFolder + "FEDIntegrity_DT/FEDFatal").c_str());
|
26 |
const TH1F *fedIntegrityHisto = (const TH1F *) file->Get(string(mainFolder + "FEDIntegrity/FEDEntries").c_str());
|
27 |
const TH1F *fedIntegrityHistoNF = (const TH1F *) file->Get(string(mainFolder + "FEDIntegrity/FEDNonFatal").c_str());
|
28 |
const TH1F *fedIntegrityHistoF = (const TH1F *) file->Get(string(mainFolder + "FEDIntegrity/FEDFatal").c_str());
|
29 |
|
30 |
if(fedIntegrityHisto != 0 && fedIntegrityHistoNF != 0 && fedIntegrityHistoF != 0) {
|
31 |
for(int fed0 = 770; fed0 != 775; ++fed0) { // loop over FEDs
|
32 |
int bin = fed0 - 769;
|
33 |
int bin2 = bin+5;
|
34 |
bool fedfound[2]={false,false};
|
35 |
if(fedIntegrityHisto->GetBinContent(bin) != 0 ||
|
36 |
fedIntegrityHistoNF->GetBinContent(bin) != 0 ||
|
37 |
fedIntegrityHistoF->GetBinContent(bin) != 0) fedfound[0]=true;
|
38 |
|
39 |
if(fedIntegrityHisto->GetBinContent(bin2) != 0 ||
|
40 |
fedIntegrityHistoNF->GetBinContent(bin2) != 0 ||
|
41 |
fedIntegrityHistoF->GetBinContent(bin2) != 0) fedfound[1]=true;
|
42 |
|
43 |
if(fedfound[0]!=false || fedfound[1]!=false)
|
44 |
{
|
45 |
vector<int> rosInTheFED;
|
46 |
for(int ifed=0;ifed<2;ifed++)
|
47 |
{
|
48 |
if(fedfound[ifed]!=false)
|
49 |
{
|
50 |
int fed=fed0+ifed*5;
|
51 |
cout << "FED: " << fed << " in the RO" << endl;
|
52 |
for(int ros = 1; ros != 13; ++ros) { // loop over ROS
|
53 |
stringstream rosHistoName; rosHistoName << mainFolder << "00-DataIntegrity/FED" << fed << "/ROS" << ros
|
54 |
<< "/FED" << fed << "_ROS" << ros << "_ROSEventLenght";
|
55 |
const TH1F *hBunchId = (const TH1F*) file->Get(rosHistoName.str().c_str());
|
56 |
if(hBunchId != 0) {
|
57 |
if(hBunchId->GetEntries() != 0) {
|
58 |
cout << " ROS: " << ros << " in the RO" << endl;
|
59 |
rosInTheFED.push_back(ros);
|
60 |
if(ros==4 )rosInTheFED.push_back(13); // Add extra MB4 at S4 == S13
|
61 |
if(ros==10)rosInTheFED.push_back(14); // Add extra MB4 at S10 == S14
|
62 |
}
|
63 |
} else {
|
64 |
cout << "[DTROUtility] Error: histo " << rosHistoName.str() << " not found!" << endl;
|
65 |
}
|
66 |
}// End loop ROS
|
67 |
}
|
68 |
else { cout << "FED: " << fed0+ifed*5 << " NOT in the RO" << endl; }
|
69 |
}
|
70 |
|
71 |
int wheel = fed0 - 772;
|
72 |
sectorsInROPerWheel[wheel] = rosInTheFED;
|
73 |
}
|
74 |
else { cout << "FED: " << fed0 << " and FED: " << fed0+5 << " NOT in the RO" << endl; }
|
75 |
}// End loop FEDs
|
76 |
} else {
|
77 |
cout << "[DTROUtility] Error: histo " << string(mainFolder + "FEDIntegrity/FEDEntries") << " not found!" << endl;
|
78 |
}
|
79 |
}
|
80 |
|
81 |
DTROUtility::DTROUtility(const DQMStore* file){} //FIXME: dummy implementation at the moment
|
82 |
|
83 |
DTROUtility::~DTROUtility() {}
|
84 |
|