test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Private Attributes
RPCEfficiencyShiftHisto Class Reference

#include <RPCEfficiencyShiftHisto.h>

Inheritance diagram for RPCEfficiencyShiftHisto:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup)
 Analyze. More...
 
void beginJob ()
 BeginJob. More...
 
void beginRun (const edm::Run &r, const edm::EventSetup &c)
 
void endRun (const edm::Run &r, const edm::EventSetup &c)
 
 RPCEfficiencyShiftHisto (const edm::ParameterSet &iConfig)
 Constructor. More...
 
virtual ~RPCEfficiencyShiftHisto ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Public Attributes

MonitorElementEffBarrelRoll
 
MonitorElementEffEndcapMinusRoll
 
MonitorElementEffEndcapPlusRoll
 
MonitorElementRollPercentage
 

Private Attributes

DQMStoredbe_
 
int effCut_
 
std::string globalFolder_
 
std::string NameFile
 
int numberOfDisks_
 
bool SaveFile
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 29 of file RPCEfficiencyShiftHisto.h.

Constructor & Destructor Documentation

RPCEfficiencyShiftHisto::RPCEfficiencyShiftHisto ( const edm::ParameterSet iConfig)

Constructor.

Definition at line 24 of file RPCEfficiencyShiftHisto.cc.

References effCut_, edm::ParameterSet::getUntrackedParameter(), globalFolder_, NameFile, numberOfDisks_, SaveFile, and AlCaHLTBitMon_QueryRunRegistry::string.

24  {
25 
26  globalFolder_ = ps.getUntrackedParameter<std::string>("GlobalFolder", "RPC/RPCEfficiency/");
27  effCut_= ps.getUntrackedParameter<int>("EffCut", 90);
28  SaveFile = ps.getUntrackedParameter<bool>("SaveFile", false);
29  NameFile = ps.getUntrackedParameter<std::string>("NameFile","RPCEfficiency.root");
30  numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 4);
31 }
RPCEfficiencyShiftHisto::~RPCEfficiencyShiftHisto ( )
virtual

Destructor.

Definition at line 34 of file RPCEfficiencyShiftHisto.cc.

34 { }

Member Function Documentation

void RPCEfficiencyShiftHisto::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Analyze.

Implements edm::EDAnalyzer.

Definition at line 36 of file RPCEfficiencyShiftHisto.cc.

36 {}
void RPCEfficiencyShiftHisto::beginJob ( void  )
virtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 38 of file RPCEfficiencyShiftHisto.cc.

References dbe_, and cppFunctionSkipper::operator.

void RPCEfficiencyShiftHisto::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 43 of file RPCEfficiencyShiftHisto.cc.

References DQMStore::book1D(), DQMStore::book2D(), dbe_, EffBarrelRoll, EffEndcapMinusRoll, EffEndcapPlusRoll, globalFolder_, RollPercentage, MonitorElement::setBinLabel(), and DQMStore::setCurrentFolder().

43  {
44 
45  if(dbe_ == 0) return;
46 
48  EffBarrelRoll = dbe_->book1D("EffBarrelRoll", "Barrel Efficiency",101,-0.5, 100.5);
49  EffEndcapPlusRoll = dbe_->book1D("EffEndcapPlusRoll", "Endcap + Efficiency",101,-0.5, 100.5);
50  EffEndcapMinusRoll = dbe_->book1D("EffEndcapMinusRoll", "Endcap - Efficiency",101,-0.5, 100.5);
51  RollPercentage = dbe_->book2D("RollPercentage", "RollPercentage",1,0.,1.,3,0.,3.);
52 
53  RollPercentage->setBinLabel(1,"%",1);
54  RollPercentage->setBinLabel(1,"E+",2);
55  RollPercentage->setBinLabel(2,"B",2);
56  RollPercentage->setBinLabel(3,"E-",2);
57 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1082
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
void RPCEfficiencyShiftHisto::endRun ( const edm::Run r,
const edm::EventSetup c 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 59 of file RPCEfficiencyShiftHisto.cc.

References dbe_, EffBarrelRoll, effCut_, EffEndcapMinusRoll, EffEndcapPlusRoll, MonitorElement::Fill(), DQMStore::get(), MonitorElement::getBinContent(), MonitorElement::getNbinsX(), MonitorElement::getNbinsY(), globalFolder_, NameFile, numberOfDisks_, RollPercentage, alignCSCRings::s, DQMStore::save(), SaveFile, MonitorElement::setBinContent(), w, x, and detailsBasic3DVector::y.

59  {
60 
61  std::stringstream meName;
62  MonitorElement * myMe;
63 
64  meName.str("");
65  meName<<globalFolder_;
66 
67  //Barrel
68 
69  int entriesBarrel = 0;
70  int entriesBarrelBeyondEff = 0;
71  float percBarrel = 0;
72 
73  for(int w = -2 ; w<3; w++){
74 
75  meName.str("");
76  if(w <= 0) meName<<globalFolder_<<"Efficiency_Roll_vs_Sector_Wheel_"<<w;
77  else meName<<globalFolder_<<"Efficiency_Roll_vs_Sector_Wheel_+"<<w;
78 
79  myMe = dbe_->get(meName.str());
80 
81  if(myMe){
82  for(int s = 1; s <= myMe->getNbinsX(); s++){
83  for(int r = 1;r <= myMe->getNbinsY(); r++){
84 
85  double effBarrel = myMe->getBinContent(s,r);
86 
87  if(effBarrel >= 0){//5
88 
89  if (EffBarrelRoll) EffBarrelRoll->Fill(effBarrel);
90  entriesBarrel++;
91 
92  if(effBarrel >= effCut_) entriesBarrelBeyondEff++;
93  }
94  }
95  }
96  }
97  }
98 
99  if(entriesBarrel != 0){
100  percBarrel = 100*entriesBarrelBeyondEff/entriesBarrel;
101  if(RollPercentage)RollPercentage->setBinContent(1,2,percBarrel);}
102 
103 
104  //EndcapMinus
105 
106  int entriesEndcapMinus = 0;
107  int entriesEndcapMinusBeyondEff = 0;
108  float percEndcapMinus = 0;
109  int entriesEndcapPlus = 0;
110  int entriesEndcapPlusBeyondEff = 0;
111  float percEndcapPlus = 0;
112  for(int d = -numberOfDisks_ ; d <= numberOfDisks_; d++){
113 
114  if(d == 0) continue;
115 
116  meName.str("");
117  meName<<globalFolder_<<"Efficiency_Roll_vs_Segment_Disk_"<<d;
118  myMe = dbe_->get(meName.str());
119 
120 
121  if(myMe){
122 
123  for (int x = 1 ;x <= myMe->getNbinsX();x++){
124  for(int y = 1;y<=myMe->getNbinsY(); y++){
125 
126  double effEndcap = myMe->getBinContent(x,y);
127 
128  if(d<0 ){
129  entriesEndcapMinus++;
131  if(effEndcap >= effCut_) entriesEndcapMinusBeyondEff++;
132  }else {
133  entriesEndcapPlus++;
135  if(effEndcap >= effCut_) entriesEndcapPlusBeyondEff++;
136  }
137  }
138  }
139  }
140  }
141 
142 
143  if(entriesEndcapMinus != 0){
144  percEndcapMinus = 100*entriesEndcapMinusBeyondEff/entriesEndcapMinus;
145  if( RollPercentage) RollPercentage->setBinContent(1,3,percEndcapMinus);}
146 
147 
148  if(entriesEndcapPlus != 0){
149  percEndcapPlus = 100*entriesEndcapPlusBeyondEff/entriesEndcapPlus;
150  if(RollPercentage) RollPercentage->setBinContent(1,1,percEndcapPlus);
151  }
152 
153  if(SaveFile) dbe_->save(NameFile);
154 
155 }
void setBinContent(int binx, double content)
set content of bin (1-D)
const double w
Definition: UKUtility.cc:23
int getNbinsY(void) const
get # of bins in Y-axis
void Fill(long long x)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1708
double getBinContent(int binx) const
get content of bin (1-D)
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2540
int getNbinsX(void) const
get # of bins in X-axis
Definition: DDAxes.h:10

Member Data Documentation

DQMStore* RPCEfficiencyShiftHisto::dbe_
private

Definition at line 63 of file RPCEfficiencyShiftHisto.h.

Referenced by beginJob(), beginRun(), and endRun().

MonitorElement* RPCEfficiencyShiftHisto::EffBarrelRoll

Definition at line 50 of file RPCEfficiencyShiftHisto.h.

Referenced by beginRun(), and endRun().

int RPCEfficiencyShiftHisto::effCut_
private

Definition at line 61 of file RPCEfficiencyShiftHisto.h.

Referenced by endRun(), and RPCEfficiencyShiftHisto().

MonitorElement* RPCEfficiencyShiftHisto::EffEndcapMinusRoll

Definition at line 52 of file RPCEfficiencyShiftHisto.h.

Referenced by beginRun(), and endRun().

MonitorElement* RPCEfficiencyShiftHisto::EffEndcapPlusRoll

Definition at line 51 of file RPCEfficiencyShiftHisto.h.

Referenced by beginRun(), and endRun().

std::string RPCEfficiencyShiftHisto::globalFolder_
private

Definition at line 65 of file RPCEfficiencyShiftHisto.h.

Referenced by beginRun(), endRun(), and RPCEfficiencyShiftHisto().

std::string RPCEfficiencyShiftHisto::NameFile
private

Definition at line 59 of file RPCEfficiencyShiftHisto.h.

Referenced by endRun(), and RPCEfficiencyShiftHisto().

int RPCEfficiencyShiftHisto::numberOfDisks_
private

Definition at line 60 of file RPCEfficiencyShiftHisto.h.

Referenced by endRun(), and RPCEfficiencyShiftHisto().

MonitorElement* RPCEfficiencyShiftHisto::RollPercentage

Definition at line 53 of file RPCEfficiencyShiftHisto.h.

Referenced by beginRun(), and endRun().

bool RPCEfficiencyShiftHisto::SaveFile
private

Definition at line 57 of file RPCEfficiencyShiftHisto.h.

Referenced by endRun(), and RPCEfficiencyShiftHisto().