34 LogDebug(
"HLTMonPhotonSource") <<
"constructor...." ;
36 logFile_.open(
"HLTMonPhotonSource.log");
48 if (outputFile_.size() != 0) {
49 edm::LogInfo(
"HLTMonPhotonSource") <<
"Photon Trigger Monitoring histograms will be saved to " <<
56 outputFile_ =
"PhotonDQM.root";
66 dirname_=
"HLT/HLTMonPhoton/"+iConfig.
getParameter<std::string>(
"@module_label");
69 dbe->setCurrentFolder(dirname_);
81 std::vector<edm::ParameterSet>
filters = iConfig.
getParameter<std::vector<edm::ParameterSet> >(
"filters");
83 for(std::vector<edm::ParameterSet>::iterator filterconf = filters.begin() ; filterconf != filters.end() ; filterconf++){
84 theHLTCollectionLabels.push_back(filterconf->getParameter<
edm::InputTag>(
"HLTCollectionLabels"));
85 theHLTOutputTypes.push_back(filterconf->getParameter<
unsigned int>(
"theHLTOutputTypes"));
86 std::vector<double> bounds = filterconf->getParameter<std::vector<double> >(
"PlotBounds");
87 assert(bounds.size() == 2);
88 plotBounds.push_back(std::pair<double,double>(bounds[0],bounds[1]));
89 isoNames.push_back(filterconf->getParameter<std::vector<edm::InputTag> >(
"IsoCollections"));
90 assert(isoNames.back().size()>0);
91 if (isoNames.back().at(0).label()==
"none")
92 plotiso.push_back(
false);
94 plotiso.push_back(
true);
121 using namespace trigger;
124 edm::LogInfo(
"HLTMonPhotonSource")<<
"HLTMonPhotonSource: analyze...." ;
128 iEvent.
getByLabel(
"hltTriggerSummaryRAW",triggerObj);
129 if(!triggerObj.isValid()) {
130 edm::LogWarning(
"HLTMonPhotonSource") <<
"RAW-type HLT results not found, skipping event";
141 for(
unsigned int n=0;
n < theHLTCollectionLabels.size() ;
n++) {
145 switch(theHLTOutputTypes[
n]){
147 fillHistos<l1extra::L1EmParticleCollection>(triggerObj,
iEvent,
n);
break;
149 fillHistos<l1extra::L1EmParticleCollection>(triggerObj,
iEvent,
n);
break;
151 fillHistos<reco::RecoEcalCandidateCollection>(triggerObj,
iEvent,
n);
break;
153 fillHistos<reco::ElectronCollection>(triggerObj,
iEvent,
n);
break;
155 fillHistos<reco::RecoEcalCandidateCollection>(triggerObj,
iEvent,
n);
break;
156 default:
throw(
cms::Exception(
"Release Validation Error")<<
"HLT output type not implemented: theHLTOutputTypes[n]" );
163 std::vector<edm::Ref<T> > recoecalcands;
169 if (!( triggerObj->filterIndex(theHLTCollectionLabels[n])>=triggerObj->size() )){
176 triggerObj->getObjects(triggerObj->filterIndex(theHLTCollectionLabels[n]),theHLTOutputTypes[
n],recoecalcands);
179 if(theHLTOutputTypes[n]==82){
180 std::vector<edm::Ref<T> > isocands;
181 triggerObj->getObjects(triggerObj->filterIndex(theHLTCollectionLabels[n]),83,isocands);
182 if(isocands.size()>0)
183 for(
unsigned int i=0;
i < isocands.size();
i++)
184 recoecalcands.push_back(isocands[
i]);
190 if(n == 0 && recoecalcands.size()!=0){
191 for (
unsigned int i=0;
i<recoecalcands.size();
i++) {
192 if(recoecalcands[
i]->
et() > maxEt){
193 maxEt = recoecalcands[
i]->et();
194 eta = recoecalcands[
i]->eta();
195 phi = recoecalcands[
i]->phi();
197 if ( theHLTOutputTypes[n]==100){
206 if (recoecalcands.size()!=0){
207 if(recoecalcands.size() >= reqNum){
208 eventCounter->Fill(n+0.5);
209 ethist[
n]->Fill(maxEt);
210 phihist[
n]->Fill(
phi);
211 etahist[
n]->Fill(
eta);
215 for (
unsigned int i=0;
i<recoecalcands.size();
i++) {
217 if(n+1 < theHLTCollectionLabels.size()){
219 for(
unsigned int j = 0 ;
j < isoNames[n+1].size() ;
j++ ){
223 if(mapi!=depMap->end()){
224 histiso[n+1]->Fill(mapi->val);
225 etahistiso[n+1]->Fill(recoecalcands[i]->
eta(),mapi->val);
226 phihistiso[n+1]->Fill(recoecalcands[i]->
phi(),mapi->val);
227 ethistiso[n+1]->Fill(recoecalcands[i]->
et(),mapi->val);
248 dbe->
rmdir(dirname_);
255 std::string histoname;
258 eventCounter = dbe->
book1D(
"Evts Passing Filters",
"Evts Passing Filters",5,0,5);
259 eventCounter->
setBinLabel(1,
"SinglePhotonEtFilter");
260 eventCounter->setBinLabel(2,
"SinglePhotonEcalIsolFilter");
261 eventCounter->setBinLabel(3,
"SinglePhotonHcalIsolFilter");
262 eventCounter->setBinLabel(4,
"SinglePhotonTrackIsolFilter");
295 for(
unsigned int i = 0;
i< theHLTCollectionLabels.size() ;
i++){
296 histoname = theHLTCollectionLabels[
i].label()+
" Et Dist";
297 tmphisto = dbe->
book1D(histoname.c_str(),histoname.c_str(),theNbins,thePtMin,thePtMax);
298 ethist.push_back(tmphisto);
300 histoname = theHLTCollectionLabels[
i].label()+
" Eta Dist";
301 tmphisto = dbe->
book1D(histoname.c_str(),histoname.c_str(),theNbins,-2.7,2.7);
302 etahist.push_back(tmphisto);
304 histoname = theHLTCollectionLabels[
i].label()+
" Phi Dist";
305 tmphisto = dbe->
book1D(histoname.c_str(),histoname.c_str(),theNbins,-3.2,3.2);
306 phihist.push_back(tmphisto);
309 histoname = theHLTCollectionLabels[
i].label()+
" Isolation Variable";
310 tmphisto = dbe->
book1D(histoname.c_str(),histoname.c_str(),theNbins,plotBounds[
i].first,plotBounds[
i].second);
315 histiso.push_back(tmphisto);
318 histoname = theHLTCollectionLabels[
i].label()+
" Isolation vs Eta";
319 tmphisto = dbe->
book2D(histoname.c_str(),histoname.c_str(),theNbins,-2.7,2.7,theNbins,plotBounds[
i].first,plotBounds[
i].second);
324 etahistiso.push_back(tmphisto);
327 histoname = theHLTCollectionLabels[
i].label()+
" Isolation vs Phi";
328 tmphisto = dbe->
book2D(histoname.c_str(),histoname.c_str(),theNbins,-3.2,3.2,theNbins,plotBounds[
i].first,plotBounds[
i].second);
333 phihistiso.push_back(tmphisto);
336 histoname = theHLTCollectionLabels[
i].label()+
" Isolation vs Et";
337 tmphisto = dbe->
book2D(histoname.c_str(),histoname.c_str(),theNbins,thePtMin,thePtMax,theNbins,plotBounds[
i].first,plotBounds[
i].second);
342 ethistiso.push_back(tmphisto);
353 LogInfo(
"HLTMonPhotonSource") <<
"analyzed " << nev_ <<
" events";
355 if (outputFile_.size() != 0 && dbe)
356 dbe->save(outputFile_);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
void rmdir(const std::string &fullpath)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
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)
HLTMonPhotonSource(const edm::ParameterSet &)
DEFINE_FWK_MODULE(HiMixingModule)
std::vector< TPRegexp > filters
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
void fillHistos(edm::Handle< trigger::TriggerEventWithRefs > &, const edm::Event &, unsigned int)
void setCurrentFolder(const std::string &fullpath)