00001
00002
00003
00004
00005
00006
00007 #include <vector>
00008
00009 #include <numeric>
00010 #include <iostream>
00011
00012 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00013 #include "FWCore/ServiceRegistry/interface/Service.h"
00014
00015
00016 #include "DataFormats/SiStripCluster/interface/SiStripCluster.h"
00017
00018 #include "DQM/SiStripMonitorCluster/interface/SiStripMonitorHLT.h"
00019 #include "DQMServices/Core/interface/DQMStore.h"
00020
00021
00022 SiStripMonitorHLT::SiStripMonitorHLT(const edm::ParameterSet& iConfig)
00023 {
00024 HLTDirectory="HLTResults";
00025 dqmStore_ = edm::Service<DQMStore>().operator->();
00026 conf_ = iConfig;
00027 }
00028
00029
00030 void SiStripMonitorHLT::beginJob(){
00031
00032 dqmStore_->setCurrentFolder(HLTDirectory);
00033 std::string HLTProducer = conf_.getParameter<std::string>("HLTProducer");
00034 HLTDecision = dqmStore_->book1D(HLTProducer+"_HLTDecision", HLTProducer+"HLTDecision", 2, -0.5, 1.5);
00035
00036 SumOfClusterCharges_all = dqmStore_->book1D("SumOfClusterCharges_all", "SumOfClusterCharges_all", 50, 0, 2000);
00037 ChargeOfEachClusterTIB_all = dqmStore_->book1D("ChargeOfEachClusterTIB_all", "ChargeOfEachClusterTIB_all", 400, -0.5, 400.5);
00038 ChargeOfEachClusterTOB_all = dqmStore_->book1D("ChargeOfEachClusterTOB_all", "ChargeOfEachClusterTOB_all", 400, -0.5, 400.5);
00039 ChargeOfEachClusterTEC_all = dqmStore_->book1D("ChargeOfEachClusterTEC_all", "ChargeOfEachClusterTEC_all", 400, -0.5, 400.5);
00040 NumberOfClustersAboveThreshold_all = dqmStore_->book1D("NumberOfClustersAboveThreshold_all", "NumberOfClustersAboveThreshold_all", 30, 30.5, 60.5);
00041
00042
00043 SumOfClusterCharges_hlt = dqmStore_->book1D("SumOfClusterCharges_hlt", "SumOfClusterCharges_hlt", 50, 0, 2000);
00044 ChargeOfEachClusterTIB_hlt = dqmStore_->book1D("ChargeOfEachClusterTIB_hlt", "ChargeOfEachClusterTIB_hlt", 400, -0.5, 400.5);
00045 ChargeOfEachClusterTOB_hlt = dqmStore_->book1D("ChargeOfEachClusterTOB_hlt", "ChargeOfEachClusterTOB_hlt", 400, -0.5, 400.5);
00046 ChargeOfEachClusterTEC_hlt = dqmStore_->book1D("ChargeOfEachClusterTEC_hlt", "ChargeOfEachClusterTEC_hlt", 400, -0.5, 400.5);
00047 NumberOfClustersAboveThreshold_hlt = dqmStore_->book1D("NumberOfClustersAboveThreshold_hlt", "NumberOfClustersAboveThreshold_hlt", 30, 30.5, 60.5);
00048 }
00049
00050 void SiStripMonitorHLT::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00051 {
00052
00053
00054 std::string HLTProducer = conf_.getParameter<std::string>("HLTProducer");
00055 edm::Handle<int> filter_decision; iEvent.getByLabel(HLTProducer, "", filter_decision);
00056 edm::Handle<uint> sum_of_clustch; iEvent.getByLabel(HLTProducer, "", sum_of_clustch);
00057
00058 edm::Handle<std::map<uint,std::vector<SiStripCluster> > > clusters_in_subcomponents;
00059 if(HLTProducer=="ClusterMTCCFilter") iEvent.getByLabel(HLTProducer, "", clusters_in_subcomponents);
00060
00061
00062 HLTDecision->Fill(*filter_decision);
00063
00064
00065 SumOfClusterCharges_all->Fill(*sum_of_clustch);
00066 if(*filter_decision) SumOfClusterCharges_hlt->Fill(*sum_of_clustch);
00067
00068
00069 if(HLTProducer=="ClusterMTCCFilter"){
00070
00071 for(std::map<uint,std::vector<SiStripCluster> >::const_iterator it = clusters_in_subcomponents->begin(); it != clusters_in_subcomponents->end(); it++){
00072 int generalized_layer = it->first;
00073 std::vector<SiStripCluster> theclusters = it->second;
00074 NumberOfClustersAboveThreshold_all->Fill( generalized_layer, theclusters.size() );
00075 if(*filter_decision) NumberOfClustersAboveThreshold_hlt->Fill( generalized_layer, theclusters.size() );
00076
00077 for(std::vector<SiStripCluster>::const_iterator icluster = theclusters.begin(); icluster != theclusters.end(); icluster++){
00078
00079 unsigned int amplclus=0;
00080 for(std::vector<uint8_t>::const_iterator ia=icluster->amplitudes().begin(); ia!=icluster->amplitudes().end(); ia++) {
00081 if ((*ia)>0) amplclus+=(*ia);
00082 }
00083 if(generalized_layer==31 || generalized_layer==32 || generalized_layer==33){
00084 ChargeOfEachClusterTIB_all->Fill(amplclus,1.);
00085 if(*filter_decision) ChargeOfEachClusterTIB_hlt->Fill(amplclus,1.);
00086 }
00087 if(generalized_layer==51 || generalized_layer==52){
00088 ChargeOfEachClusterTOB_all->Fill(amplclus,1.);
00089 if(*filter_decision) ChargeOfEachClusterTOB_hlt->Fill(amplclus,1.);
00090 }
00091 if(generalized_layer==60 ){
00092 ChargeOfEachClusterTEC_all->Fill(amplclus,1.);
00093 if(*filter_decision) ChargeOfEachClusterTEC_hlt->Fill(amplclus,1.);
00094 }
00095 }
00096 }
00097 }
00098 }
00099
00100 void SiStripMonitorHLT::endJob(void){
00101 edm::LogInfo("DQM|SiStripMonitorHLT")<<"Events rejected/accepted "<<HLTDecision->getBinContent(1)<<"/"<<HLTDecision->getBinContent(2);
00102 bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
00103 std::string outputFileName = conf_.getParameter<std::string>("OutputFileName");
00104 if(outputMEsInRootFile){
00105 dqmStore_->save(outputFileName);
00106 }
00107
00108
00109
00111
00112
00113
00114
00115
00116 }
00117