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