CMS 3D CMS Logo

ESDcsInfoTask.cc
Go to the documentation of this file.
1 #include <iostream>
2 
5 
8 
10 
13 
15 
16 using namespace cms;
17 using namespace edm;
18 using namespace std;
19 
21 
22  dqmStore_ = Service<DQMStore>().operator->();
23 
24  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
25 
26  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
27 
28  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
29 
30  dcsStatustoken_ = consumes<DcsStatusCollection>(ps.getParameter<InputTag>("DcsStatusLabel"));
31 
32  meESDcsFraction_ = 0;
33  meESDcsActiveMap_ = 0;
34 
35 }
36 
38 
39 }
40 
42 
43  char histo[200];
44 
45  if ( dqmStore_ ) {
46 
47  dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo");
48 
49  sprintf(histo, "DCSSummary");
50  meESDcsFraction_ = dqmStore_->bookFloat(histo);
51  meESDcsFraction_->Fill(-1.0);
52 
53  sprintf(histo, "DCSSummaryMap");
54  meESDcsActiveMap_ = dqmStore_->book1D(histo,histo, 2, 0., 2.);
55  meESDcsActiveMap_->setAxisTitle("(ES+/ES-)", 1);
56 
57 
58  }
59 
60 }
61 
63 
64  if ( enableCleanup_ ) this->cleanup();
65 
66 }
67 
69 
70  this->reset();
71 
72  for( int i = 0; i < 2; i++) {
73  meESDcsActiveMap_->setBinContent(i+1 , -1.0);
74  }
75 
76 }
77 
79 
80 }
81 
83 
84  if ( meESDcsFraction_ ) meESDcsFraction_->Reset();
85 
86  if ( meESDcsActiveMap_ ) meESDcsActiveMap_->Reset();
87 
88 }
89 
90 
92 
93  if ( dqmStore_ ) {
94 
95  dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo");
96 
97  if ( meESDcsFraction_ ) dqmStore_->removeElement( meESDcsFraction_->getName() );
98 
99  if ( meESDcsActiveMap_ ) dqmStore_->removeElement( meESDcsActiveMap_->getName() );
100 
101  }
102 
103 }
104 
105 void ESDcsInfoTask::analyze(const Event& e, const EventSetup& c){
106 
107  ievt_++;
108 
109  float ESpDcsStatus = 0;
110  float ESmDcsStatus = 0;
111 
112  Handle<DcsStatusCollection> dcsStatus;
113  e.getByToken(dcsStatustoken_, dcsStatus);
114  if (dcsStatus.isValid()) {
115  for (DcsStatusCollection::const_iterator dcsStatusItr = dcsStatus->begin(); dcsStatusItr != dcsStatus->end(); ++dcsStatusItr) {
116  ESpDcsStatus = dcsStatusItr->ready(DcsStatus::ESp);
117  ESmDcsStatus = dcsStatusItr->ready(DcsStatus::ESm);
118  }
119 
120  ESpDcsStatus = (ESpDcsStatus + float(ievt_-1)*meESDcsActiveMap_->getBinContent(1))/float(ievt_);
121  ESmDcsStatus = (ESmDcsStatus + float(ievt_-1)*meESDcsActiveMap_->getBinContent(2))/float(ievt_);
122  }
123 
124  meESDcsActiveMap_->setBinContent(1, ESpDcsStatus);
125  meESDcsActiveMap_->setBinContent(2, ESmDcsStatus);
126 
127  meESDcsFraction_->Fill( (ESpDcsStatus + ESmDcsStatus)/2. );
128 
129 }
130 
131 //define this as a plug-in
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual ~ESDcsInfoTask()
Destructor.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
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:74
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
HLT enums.
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.