CMS 3D CMS Logo

ME0HitsValidation.cc
Go to the documentation of this file.
3 #include <TMath.h>
4 
6  InputTagToken_ = consumes<edm::PSimHitContainer>(cfg.getParameter<edm::InputTag>("simInputLabel"));
7 }
8 
10  LogDebug("MuonME0HitsValidation") << "Info : Loading Geometry information\n";
11  ibooker.setCurrentFolder("MuonME0HitsV/ME0HitsTask");
12 
13  unsigned int nregion = 2;
14 
15  edm::LogInfo("MuonME0HitsValidation") << "+++ Info : # of region : " << nregion << std::endl;
16 
17  LogDebug("MuonME0HitsValidation") << "+++ Info : finish to get geometry information from ES.\n";
18 
19  for (unsigned int region_num = 0; region_num < nregion; region_num++) {
20  me0_sh_tot_zr[region_num] = BookHistZR(ibooker, "me0_sh", "SimHit", region_num);
21  for (unsigned int layer_num = 0; layer_num < 6; layer_num++) {
22  me0_sh_zr[region_num][layer_num] = BookHistZR(ibooker, "me0_sh", "SimHit", region_num, layer_num);
23  me0_sh_xy[region_num][layer_num] = BookHistXY(ibooker, "me0_sh", "SimHit", region_num, layer_num);
24  std::string hist_name_for_tof =
25  std::string("me0_sh_tof_r") + regionLabel[region_num] + "_l" + layerLabel[layer_num];
26  std::string hist_name_for_tofMu =
27  std::string("me0_sh_tofMuon_r") + regionLabel[region_num] + "_l" + layerLabel[layer_num];
28  std::string hist_name_for_eloss =
29  std::string("me0_sh_energyloss_r") + regionLabel[region_num] + "_l" + layerLabel[layer_num];
30  std::string hist_name_for_elossMu =
31  std::string("me0_sh_energylossMuon_r") + regionLabel[region_num] + "_l" + layerLabel[layer_num];
32  std::string hist_label_for_xy = "SimHit occupancy : region" + regionLabel[region_num] + " layer " +
33  layerLabel[layer_num] + " ; globalX [cm]; globalY[cm]";
34  std::string hist_label_for_tof = "SimHit TOF : region" + regionLabel[region_num] + " layer " +
35  layerLabel[layer_num] + " " + " ; Time of flight [ns] ; entries";
36  std::string hist_label_for_tofMu = "SimHit TOF(Muon only) : region" + regionLabel[region_num] + " layer " +
37  layerLabel[layer_num] + " " + " ; Time of flight [ns] ; entries";
38  std::string hist_label_for_eloss = "SimHit energy loss : region" + regionLabel[region_num] + " layer " +
39  layerLabel[layer_num] + " " + " ; Energy loss [eV] ; entries";
40  std::string hist_label_for_elossMu = "SimHit energy loss(Muon only) : region" + regionLabel[region_num] +
41  " layer " + layerLabel[layer_num] + " " + " ; Energy loss [eV] ; entries";
42 
43  double tof_min, tof_max;
44  tof_min = 10;
45  tof_max = 30;
46  me0_sh_tof[region_num][layer_num] =
47  ibooker.book1D(hist_name_for_tof.c_str(), hist_label_for_tof.c_str(), 40, tof_min, tof_max);
48  me0_sh_tofMu[region_num][layer_num] =
49  ibooker.book1D(hist_name_for_tofMu.c_str(), hist_label_for_tofMu.c_str(), 40, tof_min, tof_max);
50  me0_sh_eloss[region_num][layer_num] =
51  ibooker.book1D(hist_name_for_eloss.c_str(), hist_label_for_eloss.c_str(), 60, 0., 6000.);
52  me0_sh_elossMu[region_num][layer_num] =
53  ibooker.book1D(hist_name_for_elossMu.c_str(), hist_label_for_elossMu.c_str(), 60, 0., 6000.);
54  }
55  }
56 }
57 
59 
62  iSetup.get<MuonGeometryRecord>().get(hGeom);
63  const ME0Geometry *ME0Geometry_ = (&*hGeom);
64 
66  e.getByToken(InputTagToken_, ME0Hits);
67  if (!ME0Hits.isValid()) {
68  edm::LogError("ME0HitsValidation") << "Cannot get ME0Hits by Token simInputTagToken";
69  return;
70  }
71 
72  Float_t timeOfFlightMuon = 0.;
73  Float_t energyLossMuon = 0;
74 
75  for (auto hits = ME0Hits->begin(); hits != ME0Hits->end(); hits++) {
76  const ME0DetId id(hits->detUnitId());
77  Int_t region = id.region();
78  Int_t layer = id.layer();
79 
80  // Int_t even_odd = id.chamber()%2;
81  if (ME0Geometry_->idToDet(hits->detUnitId()) == nullptr) {
82  std::cout << "simHit did not matched with GEMGeometry." << std::endl;
83  continue;
84  }
85 
86  const LocalPoint hitLP(hits->localPosition());
87 
88  const GlobalPoint hitGP(ME0Geometry_->idToDet(hits->detUnitId())->surface().toGlobal(hitLP));
89  Float_t g_r = hitGP.perp();
90  Float_t g_x = hitGP.x();
91  Float_t g_y = hitGP.y();
92  Float_t g_z = hitGP.z();
93  Float_t energyLoss = hits->energyLoss();
94  Float_t timeOfFlight = hits->timeOfFlight();
95 
96  if (abs(hits->particleType()) == 13) {
97  timeOfFlightMuon = hits->timeOfFlight();
98  energyLossMuon = hits->energyLoss();
99  // fill histos for Muons only
100  me0_sh_tofMu[(int)(region / 2. + 0.5)][layer - 1]->Fill(timeOfFlightMuon);
101  me0_sh_elossMu[(int)(region / 2. + 0.5)][layer - 1]->Fill(energyLossMuon * 1.e9);
102  }
103 
104  me0_sh_zr[(int)(region / 2. + 0.5)][layer - 1]->Fill(g_z, g_r);
105  me0_sh_tot_zr[(int)(region / 2. + 0.5)]->Fill(g_z, g_r);
106  me0_sh_xy[(int)(region / 2. + 0.5)][layer - 1]->Fill(g_x, g_y);
107  me0_sh_tof[(int)(region / 2. + 0.5)][layer - 1]->Fill(timeOfFlight);
108  me0_sh_eloss[(int)(region / 2. + 0.5)][layer - 1]->Fill(energyLoss * 1.e9);
109  }
110 }
ME0BaseValidation::regionLabel
std::vector< std::string > regionLabel
Definition: ME0BaseValidation.h:32
ME0HitsValidation::~ME0HitsValidation
~ME0HitsValidation() override
Definition: ME0HitsValidation.cc:58
Handle.h
ME0BaseValidation::layerLabel
std::vector< std::string > layerLabel
Definition: ME0BaseValidation.h:33
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
edm::Run
Definition: Run.h:45
ME0HitsValidation::analyze
void analyze(const edm::Event &e, const edm::EventSetup &) override
Definition: ME0HitsValidation.cc:60
ME0Geometry
Definition: ME0Geometry.h:12
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::LogInfo
Definition: MessageLogger.h:254
ME0HitsValidation::me0_sh_elossMu
MonitorElement * me0_sh_elossMu[2][6]
Definition: ME0HitsValidation.h:21
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
ME0Geometry::idToDet
const GeomDet * idToDet(DetId) const override
Definition: ME0Geometry.cc:24
ME0BaseValidation
Definition: ME0BaseValidation.h:21
edm::Handle< edm::PSimHitContainer >
spr::timeOfFlight
double timeOfFlight(DetId id, const CaloGeometry *geo, bool debug=false)
Definition: CaloSimInfo.cc:17
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
ME0HitsValidation::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: ME0HitsValidation.cc:9
edm::ESHandle< ME0Geometry >
ME0HitsValidation::me0_sh_eloss
MonitorElement * me0_sh_eloss[2][6]
Definition: ME0HitsValidation.h:20
ME0HitsValidation::me0_sh_tofMu
MonitorElement * me0_sh_tofMu[2][6]
Definition: ME0HitsValidation.h:19
Point3DBase< float, LocalTag >
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ME0BaseValidation::BookHistXY
MonitorElement * BookHistXY(DQMStore::IBooker &, const char *name, const char *label, unsigned int region_num, unsigned int layer_num=99)
Definition: ME0BaseValidation.cc:55
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
ME0BaseValidation::BookHistZR
MonitorElement * BookHistZR(DQMStore::IBooker &, const char *name, const char *label, unsigned int region_num, unsigned int layer_num=99)
Definition: ME0BaseValidation.cc:23
createfilelist.int
int
Definition: createfilelist.py:10
edm::EventSetup
Definition: EventSetup.h:57
ME0DetId
Definition: ME0DetId.h:16
get
#define get
ME0HitsValidation::ME0HitsValidation
ME0HitsValidation(const edm::ParameterSet &)
Definition: ME0HitsValidation.cc:5
looper.cfg
cfg
Definition: looper.py:297
ME0HitsValidation::me0_sh_zr
MonitorElement * me0_sh_zr[2][6]
Definition: ME0HitsValidation.h:15
ME0HitsValidation::me0_sh_tof
MonitorElement * me0_sh_tof[2][6]
Definition: ME0HitsValidation.h:18
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
ME0HitsValidation.h
HLT_2018_cff.region
region
Definition: HLT_2018_cff.py:81479
dqm::implementation::IBooker
Definition: DQMStore.h:43
ME0HitsValidation::me0_sh_xy
MonitorElement * me0_sh_xy[2][6]
Definition: ME0HitsValidation.h:14
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
ME0HitsValidation::me0_sh_tot_zr
MonitorElement * me0_sh_tot_zr[2]
Definition: ME0HitsValidation.h:16
fastSimProducer_cff.energyLoss
energyLoss
Definition: fastSimProducer_cff.py:55
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
edm::InputTag
Definition: InputTag.h:15
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
ME0BaseValidation::InputTagToken_
edm::EDGetToken InputTagToken_
Definition: ME0BaseValidation.h:36
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
Run