CMS 3D CMS Logo

SiStripMonitorHLT.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiStripMonitorCluster
4 // Class: SiStripMonitorHLT
5 //
6 // class SiStripMonitorHLT SiStripMonitorHLT.cc
7 // DQM/SiStripMonitorCluster/src/SiStripMonitorHLT.cc
8 #include <vector>
9 
10 #include <iostream>
11 #include <numeric>
12 
15 
17 
20 
22  HLTDirectory = "HLTResults";
23  conf_ = iConfig;
24 
25  filerDecisionToken_ = consumes<int>(conf_.getParameter<std::string>("HLTProducer"));
26  sumOfClusterToken_ = consumes<uint>(conf_.getParameter<std::string>("HLTProducer"));
28  consumes<std::map<uint, std::vector<SiStripCluster> > >(conf_.getParameter<std::string>("HLTProducer"));
29 }
30 
34  HLTDecision = ibooker.book1D(HLTProducer + "_HLTDecision", HLTProducer + "HLTDecision", 2, -0.5, 1.5);
35  // all
36  SumOfClusterCharges_all = ibooker.book1D("SumOfClusterCharges_all", "SumOfClusterCharges_all", 50, 0, 2000);
38  ibooker.book1D("ChargeOfEachClusterTIB_all", "ChargeOfEachClusterTIB_all", 400, -0.5, 400.5);
40  ibooker.book1D("ChargeOfEachClusterTOB_all", "ChargeOfEachClusterTOB_all", 400, -0.5, 400.5);
42  ibooker.book1D("ChargeOfEachClusterTEC_all", "ChargeOfEachClusterTEC_all", 400, -0.5, 400.5);
44  ibooker.book1D("NumberOfClustersAboveThreshold_all", "NumberOfClustersAboveThreshold_all", 30, 30.5, 60.5);
45  // 31 = TIB2, 32 = TIB2, 33 = TIB3, 51 = TOB1, 52=TOB2, 60 = TEC
46  // accepted from HLT
47  SumOfClusterCharges_hlt = ibooker.book1D("SumOfClusterCharges_hlt", "SumOfClusterCharges_hlt", 50, 0, 2000);
49  ibooker.book1D("ChargeOfEachClusterTIB_hlt", "ChargeOfEachClusterTIB_hlt", 400, -0.5, 400.5);
51  ibooker.book1D("ChargeOfEachClusterTOB_hlt", "ChargeOfEachClusterTOB_hlt", 400, -0.5, 400.5);
53  ibooker.book1D("ChargeOfEachClusterTEC_hlt", "ChargeOfEachClusterTEC_hlt", 400, -0.5, 400.5);
55  ibooker.book1D("NumberOfClustersAboveThreshold_hlt", "NumberOfClustersAboveThreshold_hlt", 30, 30.5, 60.5);
56 }
57 
59  // get from event
61  edm::Handle<int> filter_decision;
62  iEvent.getByToken(filerDecisionToken_, filter_decision); // filter decision
63  edm::Handle<uint> sum_of_clustch;
64  iEvent.getByToken(sumOfClusterToken_,
65  sum_of_clustch); // sum of cluster charges
66  // first element of pair: layer: TIB1, ...., TEC; second element: nr of
67  // clusters above threshold
68  edm::Handle<std::map<uint, std::vector<SiStripCluster> > > clusters_in_subcomponents;
69  if (HLTProducer == "ClusterMTCCFilter")
70  iEvent.getByToken(clusterInSubComponentsToken_, clusters_in_subcomponents);
71 
72  // trigger decision
73  HLTDecision->Fill(*filter_decision);
74 
75  // sum of charges of clusters
76  SumOfClusterCharges_all->Fill(*sum_of_clustch);
77  if (*filter_decision)
78  SumOfClusterCharges_hlt->Fill(*sum_of_clustch);
79 
80  // clusters in different layers
81  if (HLTProducer == "ClusterMTCCFilter") {
82  // loop over layers ("subcomponents")
83  for (std::map<uint, std::vector<SiStripCluster> >::const_iterator it = clusters_in_subcomponents->begin();
84  it != clusters_in_subcomponents->end();
85  it++) {
86  int generalized_layer = it->first;
87  std::vector<SiStripCluster> theclusters = it->second;
88  NumberOfClustersAboveThreshold_all->Fill(generalized_layer,
89  theclusters.size()); // number of clusters in this generalized layer
90  if (*filter_decision)
91  NumberOfClustersAboveThreshold_hlt->Fill(generalized_layer, theclusters.size());
92  // loop over clusters (and detids)
93  for (std::vector<SiStripCluster>::const_iterator icluster = theclusters.begin(); icluster != theclusters.end();
94  icluster++) {
95  // calculate sum of amplitudes
96  unsigned int amplclus = 0;
97  for (auto ia = icluster->amplitudes().begin(); ia != icluster->amplitudes().end(); ia++) {
98  if ((*ia) > 0)
99  amplclus += (*ia); // why should this be negative?
100  }
101  if (generalized_layer == 31 || generalized_layer == 32 ||
102  generalized_layer == 33) { // you can also ask the detid here whether is TIB
103  ChargeOfEachClusterTIB_all->Fill(amplclus, 1.);
104  if (*filter_decision)
105  ChargeOfEachClusterTIB_hlt->Fill(amplclus, 1.);
106  }
107  if (generalized_layer == 51 || generalized_layer == 52) {
108  ChargeOfEachClusterTOB_all->Fill(amplclus, 1.);
109  if (*filter_decision)
110  ChargeOfEachClusterTOB_hlt->Fill(amplclus, 1.);
111  }
112  if (generalized_layer == 60) {
113  ChargeOfEachClusterTEC_all->Fill(amplclus, 1.);
114  if (*filter_decision)
115  ChargeOfEachClusterTEC_hlt->Fill(amplclus, 1.);
116  }
117  }
118  }
119  }
120 }
SiStripMonitorHLT::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: SiStripMonitorHLT.cc:58
MessageLogger.h
edm::Run
Definition: Run.h:45
SiStripMonitorHLT_cfi.HLTProducer
HLTProducer
Definition: SiStripMonitorHLT_cfi.py:5
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
SiStripMonitorHLT::SumOfClusterCharges_all
MonitorElement * SumOfClusterCharges_all
Definition: SiStripMonitorHLT.h:38
DQMStore.h
edm::Handle< int >
parallelization.uint
uint
Definition: parallelization.py:124
SiStripMonitorHLT::NumberOfClustersAboveThreshold_all
MonitorElement * NumberOfClustersAboveThreshold_all
Definition: SiStripMonitorHLT.h:39
SiStripMonitorHLT::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: SiStripMonitorHLT.cc:31
SiStripMonitorHLT.h
Service.h
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
SiStripMonitorHLT::ChargeOfEachClusterTIB_all
MonitorElement * ChargeOfEachClusterTIB_all
Definition: SiStripMonitorHLT.h:40
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
SiStripMonitorHLT::NumberOfClustersAboveThreshold_hlt
MonitorElement * NumberOfClustersAboveThreshold_hlt
Definition: SiStripMonitorHLT.h:45
SiStripCluster.h
SiStripMonitorHLT::ChargeOfEachClusterTEC_hlt
MonitorElement * ChargeOfEachClusterTEC_hlt
Definition: SiStripMonitorHLT.h:48
iEvent
int iEvent
Definition: GenABIO.cc:224
SiStripMonitorHLT::filerDecisionToken_
edm::EDGetTokenT< int > filerDecisionToken_
Definition: SiStripMonitorHLT.h:31
SiStripMonitorHLT::HLTDirectory
std::string HLTDirectory
Definition: SiStripMonitorHLT.h:50
SiStripMonitorHLT::ChargeOfEachClusterTEC_all
MonitorElement * ChargeOfEachClusterTEC_all
Definition: SiStripMonitorHLT.h:42
edm::EventSetup
Definition: EventSetup.h:57
SiStripMonitorHLT::SumOfClusterCharges_hlt
MonitorElement * SumOfClusterCharges_hlt
Definition: SiStripMonitorHLT.h:44
SiStripMonitorHLT::HLTDecision
MonitorElement * HLTDecision
Definition: SiStripMonitorHLT.h:36
SiStripMonitorHLT::conf_
edm::ParameterSet conf_
Definition: SiStripMonitorHLT.h:35
writedatasetfile.run
run
Definition: writedatasetfile.py:27
SiStripMonitorHLT::sumOfClusterToken_
edm::EDGetTokenT< uint > sumOfClusterToken_
Definition: SiStripMonitorHLT.h:32
SiStripMonitorHLT::ChargeOfEachClusterTOB_all
MonitorElement * ChargeOfEachClusterTOB_all
Definition: SiStripMonitorHLT.h:41
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
SiStripMonitorHLT::ChargeOfEachClusterTIB_hlt
MonitorElement * ChargeOfEachClusterTIB_hlt
Definition: SiStripMonitorHLT.h:46
dqm::implementation::IBooker
Definition: DQMStore.h:43
SiStripMonitorHLT::ChargeOfEachClusterTOB_hlt
MonitorElement * ChargeOfEachClusterTOB_hlt
Definition: SiStripMonitorHLT.h:47
genParticles_cff.map
map
Definition: genParticles_cff.py:11
SiStripMonitorHLT::SiStripMonitorHLT
SiStripMonitorHLT(const edm::ParameterSet &)
Definition: SiStripMonitorHLT.cc:21
edm::Event
Definition: Event.h:73
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
SiStripMonitorHLT::clusterInSubComponentsToken_
edm::EDGetTokenT< std::map< uint, std::vector< SiStripCluster > > > clusterInSubComponentsToken_
Definition: SiStripMonitorHLT.h:33