29 LogDebug(
"HLTMonElectron") <<
"constructor...." ;
31 logFile_.open(
"HLTMonElectron.log");
41 if (outputFile_.size() != 0) {
42 LogInfo(
"HLTMonElectron") <<
"L1T Monitoring histograms will be saved to "
46 outputFile_ =
"L1TDQM.root";
58 dbe->setCurrentFolder(dirname_);
69 std::vector<edm::ParameterSet>
filters = iConfig.
getParameter<std::vector<edm::ParameterSet> >(
"filters");
71 for(std::vector<edm::ParameterSet>::iterator filterconf = filters.begin() ; filterconf != filters.end() ; filterconf++){
72 theHLTCollectionLabels.push_back(filterconf->getParameter<
edm::InputTag>(
"HLTCollectionLabels"));
73 theHLTOutputTypes.push_back(filterconf->getParameter<
unsigned int>(
"theHLTOutputTypes"));
74 std::vector<double> bounds = filterconf->getParameter<std::vector<double> >(
"PlotBounds");
75 assert(bounds.size() == 2);
76 plotBounds.push_back(std::pair<double,double>(bounds[0],bounds[1]));
77 isoNames.push_back(filterconf->getParameter<std::vector<edm::InputTag> >(
"IsoCollections"));
78 assert(isoNames.back().size()>0);
79 if (isoNames.back().at(0).label()==
"none")
80 plotiso.push_back(
false);
82 plotiso.push_back(
true);
107 using namespace trigger;
109 LogDebug(
"HLTMonElectron")<<
"HLTMonElectron: analyze...." ;
113 iEvent.
getByLabel(
"hltTriggerSummaryRAW",triggerObj);
114 if(!triggerObj.isValid()) {
115 edm::LogWarning(
"HLTMonElectron") <<
"RAW-type HLT results not found, skipping event";
120 total->Fill(theHLTCollectionLabels.size()+0.5);
123 for(
unsigned int n=0;
n < theHLTCollectionLabels.size() ;
n++) {
124 switch(theHLTOutputTypes[
n]){
126 fillHistos<l1extra::L1EmParticleCollection>(triggerObj,
iEvent,
n);
break;
128 fillHistos<l1extra::L1EmParticleCollection>(triggerObj,
iEvent,
n);
break;
130 fillHistos<reco::RecoEcalCandidateCollection>(triggerObj,
iEvent,
n);
break;
132 fillHistos<reco::ElectronCollection>(triggerObj,
iEvent,
n);
break;
134 fillHistos<reco::RecoEcalCandidateCollection>(triggerObj,
iEvent,
n);
break;
135 default:
throw(
cms::Exception(
"Release Validation Error")<<
"HLT output type not implemented: theHLTOutputTypes[n]" );
142 std::vector<edm::Ref<T> > recoecalcands;
143 if (!( triggerObj->filterIndex(theHLTCollectionLabels[n])>=triggerObj->size() )){
146 triggerObj->getObjects(triggerObj->filterIndex(theHLTCollectionLabels[n]),theHLTOutputTypes[
n],recoecalcands);
149 if(theHLTOutputTypes[n]==82){
150 std::vector<edm::Ref<T> > isocands;
151 triggerObj->getObjects(triggerObj->filterIndex(theHLTCollectionLabels[n]),83,isocands);
152 if(isocands.size()>0)
153 for(
unsigned int i=0;
i < isocands.size();
i++)
154 recoecalcands.push_back(isocands[
i]);
159 if (recoecalcands.size()!=0){
160 if(recoecalcands.size() >= reqNum )
162 for (
unsigned int i=0;
i<recoecalcands.size();
i++) {
164 ethist[
n]->Fill(recoecalcands[
i]->et() );
165 phihist[
n]->Fill(recoecalcands[
i]->
phi() );
166 etahist[
n]->Fill(recoecalcands[
i]->
eta() );
170 if(n+1 < theHLTCollectionLabels.size()){
172 for(
unsigned int j = 0 ;
j < isoNames[n+1].size() ;
j++ ){
176 if(mapi!=depMap->end()){
177 etahistiso[n+1]->Fill(recoecalcands[i]->
eta(),mapi->val);
178 phihistiso[n+1]->Fill(recoecalcands[i]->
phi(),mapi->val);
179 ethistiso[n+1]->Fill(recoecalcands[i]->et(),mapi->val);
198 dbe->setCurrentFolder(dirname_);
199 dbe->rmdir(dirname_);
204 dbe->setCurrentFolder(dirname_);
210 total = dbe->book1D(histoname.c_str(),histoname.c_str(),theHLTCollectionLabels.size()+1,0,theHLTCollectionLabels.size()+1);
211 total->setBinLabel(theHLTCollectionLabels.size()+1,
"Total",1);
212 for (
unsigned int u=0; u<theHLTCollectionLabels.size(); u++){
total->setBinLabel(u+1,theHLTCollectionLabels[u].
label().c_str());}
215 for(
unsigned int i = 0;
i< theHLTCollectionLabels.size() ;
i++){
216 histoname = theHLTCollectionLabels[
i].label()+
"et";
217 tmphisto = dbe->book1D(histoname.c_str(),histoname.c_str(),theNbins,thePtMin,thePtMax);
218 ethist.push_back(tmphisto);
220 histoname = theHLTCollectionLabels[
i].label()+
"eta";
221 tmphisto = dbe->book1D(histoname.c_str(),histoname.c_str(),theNbins,-2.7,2.7);
222 etahist.push_back(tmphisto);
224 histoname = theHLTCollectionLabels[
i].label()+
"phi";
225 tmphisto = dbe->book1D(histoname.c_str(),histoname.c_str(),theNbins,-3.2,3.2);
226 phihist.push_back(tmphisto);
229 histoname = theHLTCollectionLabels[
i].label()+
"eta isolation";
230 tmphisto = dbe->book2D(histoname.c_str(),histoname.c_str(),theNbins,-2.7,2.7,theNbins,plotBounds[
i].first,plotBounds[
i].second);
235 etahistiso.push_back(tmphisto);
238 histoname = theHLTCollectionLabels[
i].label()+
"phi isolation";
239 tmphisto = dbe->book2D(histoname.c_str(),histoname.c_str(),theNbins,-3.2,3.2,theNbins,plotBounds[
i].first,plotBounds[
i].second);
244 phihistiso.push_back(tmphisto);
247 histoname = theHLTCollectionLabels[
i].label()+
"et isolation";
248 tmphisto = dbe->book2D(histoname.c_str(),histoname.c_str(),theNbins,thePtMin,thePtMax,theNbins,plotBounds[
i].first,plotBounds[
i].second);
253 ethistiso.push_back(tmphisto);
265 LogInfo(
"HLTMonElectron") <<
"analyzed " << nev_ <<
" events";
267 if (outputFile_.size() != 0 && dbe)
268 dbe->save(outputFile_);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual void analyze(const edm::Event &, const edm::EventSetup &)
std::vector< TPRegexp > filters
HLTMonElectron(const edm::ParameterSet &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
void fillHistos(edm::Handle< trigger::TriggerEventWithRefs > &, const edm::Event &, unsigned int)