CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ESDcsInfoTask.cc
Go to the documentation of this file.
1 #include <iostream>
2 
5 
8 
10 
13 
15 
17 
18 using namespace cms;
19 using namespace edm;
20 using namespace std;
21 
23 
24  dqmStore_ = Service<DQMStore>().operator->();
25 
26  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
27 
28  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
29 
30  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
31 
32  dcsStatuslabel_ = ps.getParameter<InputTag>("DcsStatusLabel");
33 
34  meESDcsFraction_ = 0;
35  meESDcsActiveMap_ = 0;
36 
37 }
38 
40 
41 }
42 
44 
45  char histo[200];
46 
47  if ( dqmStore_ ) {
48 
49  dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo");
50 
51  sprintf(histo, "DCSSummary");
52  meESDcsFraction_ = dqmStore_->bookFloat(histo);
53  meESDcsFraction_->Fill(-1.0);
54 
55  sprintf(histo, "DCSSummaryMap");
56  meESDcsActiveMap_ = dqmStore_->book1D(histo,histo, 2, 0., 2.);
57  meESDcsActiveMap_->setAxisTitle("(ES+/ES-)", 1);
58 
59 
60  }
61 
62 }
63 
65 
66  if ( enableCleanup_ ) this->cleanup();
67 
68 }
69 
71 
72  this->reset();
73 
74  for( int i = 0; i < 2; i++) {
75  meESDcsActiveMap_->setBinContent(i+1 , -1.0);
76  }
77 
78 }
79 
81 
82 }
83 
85 
86  if ( meESDcsFraction_ ) meESDcsFraction_->Reset();
87 
88  if ( meESDcsActiveMap_ ) meESDcsActiveMap_->Reset();
89 
90 }
91 
92 
94 
95  if ( dqmStore_ ) {
96 
97  dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo");
98 
99  if ( meESDcsFraction_ ) dqmStore_->removeElement( meESDcsFraction_->getName() );
100 
101  if ( meESDcsActiveMap_ ) dqmStore_->removeElement( meESDcsActiveMap_->getName() );
102 
103  }
104 
105 }
106 
107 void ESDcsInfoTask::analyze(const Event& e, const EventSetup& c){
108 
109  ievt_++;
110 
111  float ESpDcsStatus = 0;
112  float ESmDcsStatus = 0;
113 
114  Handle<DcsStatusCollection> dcsStatus;
115  e.getByLabel(dcsStatuslabel_, dcsStatus);
116  if (dcsStatus.isValid()) {
117  for (DcsStatusCollection::const_iterator dcsStatusItr = dcsStatus->begin(); dcsStatusItr != dcsStatus->end(); ++dcsStatusItr) {
118  ESpDcsStatus = dcsStatusItr->ready(DcsStatus::ESp);
119  ESmDcsStatus = dcsStatusItr->ready(DcsStatus::ESm);
120  }
121 
122  ESpDcsStatus = (ESpDcsStatus + float(ievt_-1)*meESDcsActiveMap_->getBinContent(1))/float(ievt_);
123  ESmDcsStatus = (ESmDcsStatus + float(ievt_-1)*meESDcsActiveMap_->getBinContent(2))/float(ievt_);
124  }
125 
126  meESDcsActiveMap_->setBinContent(1, ESpDcsStatus);
127  meESDcsActiveMap_->setBinContent(2, ESmDcsStatus);
128 
129  meESDcsFraction_->Fill( (ESpDcsStatus + ESmDcsStatus)/2. );
130 
131 }
132 
133 //define this as a plug-in
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
virtual ~ESDcsInfoTask()
Destructor.
DEFINE_FWK_MODULE(TauMET)
static void cleanup(const Factory::MakerMap::value_type &v)
Definition: Factory.cc:12
void beginJob(void)
BeginJob.
ESDcsInfoTask(const edm::ParameterSet &ps)
Constructor.
void endLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup)
EndLuminosityBlock.
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
void reset(void)
Reset.
void beginLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup)
BeginLuminosityBlock.
void endJob(void)
EndJob.
void reset(double vett[256])
Definition: TPedValues.cc:11
void cleanup(void)
Cleanup.