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 
26  consumes<int>(conf_.getParameter<std::string>("HLTProducer"));
28  consumes<uint>(conf_.getParameter<std::string>("HLTProducer"));
30  consumes<std::map<uint, std::vector<SiStripCluster> > >(
31  conf_.getParameter<std::string>("HLTProducer"));
32 }
33 
35  const edm::Run& run,
36  const edm::EventSetup& es) {
38  std::string HLTProducer = conf_.getParameter<std::string>("HLTProducer");
39  HLTDecision = ibooker.book1D(HLTProducer + "_HLTDecision",
40  HLTProducer + "HLTDecision", 2, -0.5, 1.5);
41  // all
43  "SumOfClusterCharges_all", "SumOfClusterCharges_all", 50, 0, 2000);
45  ibooker.book1D("ChargeOfEachClusterTIB_all", "ChargeOfEachClusterTIB_all",
46  400, -0.5, 400.5);
48  ibooker.book1D("ChargeOfEachClusterTOB_all", "ChargeOfEachClusterTOB_all",
49  400, -0.5, 400.5);
51  ibooker.book1D("ChargeOfEachClusterTEC_all", "ChargeOfEachClusterTEC_all",
52  400, -0.5, 400.5);
54  ibooker.book1D("NumberOfClustersAboveThreshold_all",
55  "NumberOfClustersAboveThreshold_all", 30, 30.5, 60.5);
56  // 31 = TIB2, 32 = TIB2, 33 = TIB3, 51 = TOB1, 52=TOB2, 60 = TEC
57  // accepted from HLT
59  "SumOfClusterCharges_hlt", "SumOfClusterCharges_hlt", 50, 0, 2000);
61  ibooker.book1D("ChargeOfEachClusterTIB_hlt", "ChargeOfEachClusterTIB_hlt",
62  400, -0.5, 400.5);
64  ibooker.book1D("ChargeOfEachClusterTOB_hlt", "ChargeOfEachClusterTOB_hlt",
65  400, -0.5, 400.5);
67  ibooker.book1D("ChargeOfEachClusterTEC_hlt", "ChargeOfEachClusterTEC_hlt",
68  400, -0.5, 400.5);
70  ibooker.book1D("NumberOfClustersAboveThreshold_hlt",
71  "NumberOfClustersAboveThreshold_hlt", 30, 30.5, 60.5);
72 }
73 
75  const edm::EventSetup& iSetup) {
76  // get from event
77  std::string HLTProducer = conf_.getParameter<std::string>("HLTProducer");
78  edm::Handle<int> filter_decision;
79  iEvent.getByToken(filerDecisionToken_, filter_decision); // filter decision
80  edm::Handle<uint> sum_of_clustch;
82  sum_of_clustch); // sum of cluster charges
83  // first element of pair: layer: TIB1, ...., TEC; second element: nr of
84  // clusters above threshold
86  clusters_in_subcomponents;
87  if (HLTProducer == "ClusterMTCCFilter")
88  iEvent.getByToken(clusterInSubComponentsToken_, clusters_in_subcomponents);
89 
90  // trigger decision
91  HLTDecision->Fill(*filter_decision);
92 
93  // sum of charges of clusters
94  SumOfClusterCharges_all->Fill(*sum_of_clustch);
95  if (*filter_decision) SumOfClusterCharges_hlt->Fill(*sum_of_clustch);
96 
97  // clusters in different layers
98  if (HLTProducer == "ClusterMTCCFilter") {
99  // loop over layers ("subcomponents")
100  for (std::map<uint, std::vector<SiStripCluster> >::const_iterator it =
101  clusters_in_subcomponents->begin();
102  it != clusters_in_subcomponents->end(); it++) {
103  int generalized_layer = it->first;
104  std::vector<SiStripCluster> theclusters = it->second;
106  generalized_layer,
107  theclusters.size()); // number of clusters in this generalized layer
108  if (*filter_decision)
109  NumberOfClustersAboveThreshold_hlt->Fill(generalized_layer,
110  theclusters.size());
111  // loop over clusters (and detids)
112  for (std::vector<SiStripCluster>::const_iterator icluster =
113  theclusters.begin();
114  icluster != theclusters.end(); icluster++) {
115  // calculate sum of amplitudes
116  unsigned int amplclus = 0;
117  for (auto ia = icluster->amplitudes().begin();
118  ia != icluster->amplitudes().end(); ia++) {
119  if ((*ia) > 0) amplclus += (*ia); // why should this be negative?
120  }
121  if (generalized_layer == 31 || generalized_layer == 32 ||
122  generalized_layer ==
123  33) { // you can also ask the detid here whether is TIB
124  ChargeOfEachClusterTIB_all->Fill(amplclus, 1.);
125  if (*filter_decision) ChargeOfEachClusterTIB_hlt->Fill(amplclus, 1.);
126  }
127  if (generalized_layer == 51 || generalized_layer == 52) {
128  ChargeOfEachClusterTOB_all->Fill(amplclus, 1.);
129  if (*filter_decision) ChargeOfEachClusterTOB_hlt->Fill(amplclus, 1.);
130  }
131  if (generalized_layer == 60) {
132  ChargeOfEachClusterTEC_all->Fill(amplclus, 1.);
133  if (*filter_decision) ChargeOfEachClusterTEC_hlt->Fill(amplclus, 1.);
134  }
135  }
136  }
137  }
138 }
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * NumberOfClustersAboveThreshold_all
void Fill(long long x)
MonitorElement * SumOfClusterCharges_all
int iEvent
Definition: GenABIO.cc:224
MonitorElement * ChargeOfEachClusterTEC_hlt
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
std::string HLTDirectory
MonitorElement * ChargeOfEachClusterTIB_all
MonitorElement * NumberOfClustersAboveThreshold_hlt
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
MonitorElement * HLTDecision
MonitorElement * ChargeOfEachClusterTEC_all
MonitorElement * SumOfClusterCharges_hlt
def uint(string)
MonitorElement * ChargeOfEachClusterTOB_hlt
SiStripMonitorHLT(const edm::ParameterSet &)
edm::EDGetTokenT< int > filerDecisionToken_
MonitorElement * ChargeOfEachClusterTIB_hlt
edm::EDGetTokenT< std::map< uint, std::vector< SiStripCluster > > > clusterInSubComponentsToken_
MonitorElement * ChargeOfEachClusterTOB_all
edm::ParameterSet conf_
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: Run.h:45
edm::EDGetTokenT< uint > sumOfClusterToken_