1 |
konec |
1.1 |
#include "UserCode/L1RpcTriggerAnalysis/interface/DetEfficiency.h"
|
2 |
|
|
#include "DataFormats/MuonDetId/interface/RPCDetId.h"
|
3 |
|
|
#include <sstream>
|
4 |
|
|
|
5 |
|
|
bool DetEfficiency::isDummy() const
|
6 |
|
|
{
|
7 |
|
|
if (theRawId==637632537|| theRawId==637567001) return true;
|
8 |
|
|
return ( RPCDetId(theRawId).roll() == 0);
|
9 |
|
|
}
|
10 |
|
|
|
11 |
|
|
double DetEfficiency::efficiency() const
|
12 |
|
|
{
|
13 |
|
|
return (theMuons == 0) ? 0. : static_cast<double>(theHits)/static_cast<double>(theMuons);
|
14 |
|
|
}
|
15 |
|
|
|
16 |
|
|
double DetEfficiency::efficiencyError() const
|
17 |
|
|
{
|
18 |
|
|
double eff = efficiency();
|
19 |
|
|
double nH = (theHits == 0) ? 1 : static_cast<double>(theHits);
|
20 |
|
|
// return eff/sqrt(nH);
|
21 |
|
|
|
22 |
|
|
// double corr = (eff < 1.) ? sqrt(eff*(1.-eff)) : 0.;
|
23 |
|
|
// eff *= corr;
|
24 |
|
|
return sqrt(eff*(1.-eff))/sqrt(nH);
|
25 |
|
|
}
|
26 |
|
|
|
27 |
|
|
std::string DetEfficiency::print() const
|
28 |
|
|
{
|
29 |
|
|
RPCDetId rpc(theRawId);
|
30 |
|
|
std::stringstream name;
|
31 |
akalinow |
1.2 |
//AK std::string localPartVal[7]={"Forward","Central","Backward","A","B","C","D"};
|
32 |
konec |
1.1 |
if (rpc.roll()==0) name.str("DUMMY");
|
33 |
|
|
else if (rpc.region() ==0) {
|
34 |
|
|
std::string layerVal[6]={"RB1in","RB1out","RB2in","RB2out","RB3","RB4"};
|
35 |
akalinow |
1.2 |
//AK std::string subsVal[5]={"--","-","","+","++"};
|
36 |
konec |
1.1 |
name << "W";
|
37 |
|
|
if (rpc.ring()>0) name <<"+";
|
38 |
|
|
name <<rpc.ring();
|
39 |
|
|
int lv = rpc.station() <=2 ? 2*( rpc.station()-1)+ rpc.layer() : rpc.station()+2 ;
|
40 |
|
|
name <<"/"<<layerVal[lv-1]<<"/"<<rpc.sector();
|
41 |
|
|
name <<"_sub:"<<rpc.subsector();
|
42 |
|
|
name <<"_roll:"<<rpc.roll();
|
43 |
|
|
//name<<"_roll="<<localPartVal[rpc.roll()+1];
|
44 |
|
|
} else {
|
45 |
|
|
if (rpc.region() == -1) name <<"RE-";
|
46 |
|
|
if (rpc.region() == 1) name <<"RE+";
|
47 |
|
|
name <<rpc.station()<<"/"<<rpc.ring()<<"/"<<rpc.sector()<<" roll:"<<rpc.roll();
|
48 |
|
|
}
|
49 |
|
|
std::stringstream str;
|
50 |
|
|
str <<" DET: "<<theRawId<<" "<<name.str()<<" H: "<<theHits<<" SH: "<<theSimHits<<" M: "<<theMuons<< " eff: "<<efficiency()<<" effErr: "<<efficiencyError();
|
51 |
|
|
return str.str();
|
52 |
|
|
}
|