14 #include "SimMuon/DTDigitizer/test/Histograms.h" 31 hDigis_global = std::make_unique<hDigis>(
"Global");
32 hDigis_W0 = std::make_unique<hDigis>(
"Wheel0");
33 hDigis_W1 = std::make_unique<hDigis>(
"Wheel1");
34 hDigis_W2 = std::make_unique<hDigis>(
"Wheel2");
35 hAllHits = std::make_unique<hHits>(
"AllHits");
40 cout <<
"[MuonDTDigis] Destructor called" << endl;
46 meDigiTimeBox_wheel2m_ = 0;
47 meDigiTimeBox_wheel1m_ = 0;
48 meDigiTimeBox_wheel0_ = 0;
49 meDigiTimeBox_wheel1p_ = 0;
50 meDigiTimeBox_wheel2p_ = 0;
51 meDigiEfficiency_ = 0;
52 meDigiEfficiencyMu_ = 0;
55 meWire_DoubleDigi_ = 0;
58 meMB1_digi_occup_ = 0;
60 meMB2_digi_occup_ = 0;
62 meMB3_digi_occup_ = 0;
64 meMB4_digi_occup_ = 0;
77 sprintf (histo_n,
"DigiTimeBox" );
78 sprintf (histo_t,
"Digi Time Box" );
79 meDigiTimeBox_ = iBooker.
book1D(histo_n, histo_t, 1536,0,1200);
81 sprintf (histo_n,
"DigiTimeBox_wheel2m" );
82 sprintf (histo_t,
"Digi Time Box wheel -2" );
83 meDigiTimeBox_wheel2m_ = iBooker.
book1D(histo_n, histo_t, 384,0,1200);
85 sprintf (histo_n,
"DigiTimeBox_wheel1m" );
86 sprintf (histo_t,
"Digi Time Box wheel -1" );
87 meDigiTimeBox_wheel1m_ = iBooker.
book1D(histo_n, histo_t, 384,0,1200);
89 sprintf (histo_n,
"DigiTimeBox_wheel0" );
90 sprintf (histo_t,
"Digi Time Box wheel 0" );
91 meDigiTimeBox_wheel0_ = iBooker.
book1D(histo_n, histo_t, 384,0,1200);
93 sprintf (histo_n,
"DigiTimeBox_wheel1p" );
94 sprintf (histo_t,
"Digi Time Box wheel 1" );
95 meDigiTimeBox_wheel1p_ = iBooker.
book1D(histo_n, histo_t, 384,0,1200);
97 sprintf (histo_n,
"DigiTimeBox_wheel2p" );
98 sprintf (histo_t,
"Digi Time Box wheel 2" );
99 meDigiTimeBox_wheel2p_ = iBooker.
book1D(histo_n, histo_t, 384,0,1200);
101 sprintf (histo_n,
"DigiEfficiencyMu" );
102 sprintf (histo_t,
"Ratio (#Digis Mu)/(#SimHits Mu)" );
103 meDigiEfficiencyMu_ = iBooker.
book1D(histo_n, histo_t, 100, 0., 5.);
105 sprintf (histo_n,
"DigiEfficiency" );
106 sprintf (histo_t,
"Ratio (#Digis)/(#SimHits)" );
107 meDigiEfficiency_ = iBooker.
book1D(histo_n, histo_t, 100, 0., 5.);
109 sprintf (histo_n,
"Number_Digi_per_layer" );
110 sprintf (histo_t,
"Number_Digi_per_layer" );
111 meDoubleDigi_ = iBooker.
book1D(histo_n, histo_t, 10,0.,10.);
113 sprintf (histo_n,
"Number_simhit_vs_digi" );
114 sprintf (histo_t,
"Number_simhit_vs_digi" );
115 meSimvsDigi_ = iBooker.
book2D(histo_n, histo_t, 100, 0., 140., 100, 0., 140.);
117 sprintf (histo_n,
"Wire_Number_with_double_Digi" );
118 sprintf (histo_t,
"Wire_Number_with_double_Digi" );
119 meWire_DoubleDigi_ = iBooker.
book1D(histo_n, histo_t, 100,0.,100.);
121 sprintf (histo_n,
"Simhit_occupancy_MB1" );
122 sprintf (histo_t,
"Simhit_occupancy_MB1" );
123 meMB1_sim_occup_ = iBooker.
book1D(histo_n, histo_t, 55, 0., 55. );
125 sprintf (histo_n,
"Digi_occupancy_MB1" );
126 sprintf (histo_t,
"Digi_occupancy_MB1" );
127 meMB1_digi_occup_ = iBooker.
book1D(histo_n, histo_t, 55, 0., 55. );
129 sprintf (histo_n,
"Simhit_occupancy_MB2" );
130 sprintf (histo_t,
"Simhit_occupancy_MB2" );
131 meMB2_sim_occup_ = iBooker.
book1D(histo_n, histo_t, 63, 0., 63. );
133 sprintf (histo_n,
"Digi_occupancy_MB2" );
134 sprintf (histo_t,
"Digi_occupancy_MB2" );
135 meMB2_digi_occup_ = iBooker.
book1D(histo_n, histo_t, 63, 0., 63. );
137 sprintf (histo_n,
"Simhit_occupancy_MB3" );
138 sprintf (histo_t,
"Simhit_occupancy_MB3" );
139 meMB3_sim_occup_ = iBooker.
book1D(histo_n, histo_t, 75, 0., 75. );
141 sprintf (histo_n,
"Digi_occupancy_MB3" );
142 sprintf (histo_t,
"Digi_occupancy_MB3" );
143 meMB3_digi_occup_ = iBooker.
book1D(histo_n, histo_t, 75, 0., 75. );
145 sprintf (histo_n,
"Simhit_occupancy_MB4" );
146 sprintf (histo_t,
"Simhit_occupancy_MB4" );
147 meMB4_sim_occup_ = iBooker.
book1D(histo_n, histo_t, 99, 0., 99. );
149 sprintf (histo_n,
"Digi_occupancy_MB4" );
150 sprintf (histo_t,
"Digi_occupancy_MB4" );
151 meMB4_digi_occup_ = iBooker.
book1D(histo_n, histo_t, 99, 0., 99. );
155 for (
int slnum = 1; slnum < 62; ++slnum ) {
156 sprintf(stringcham,
"DigiTimeBox_slid_%d", slnum) ;
157 meDigiHisto_ = iBooker.
book1D(stringcham, stringcham, 100,0,1200);
158 meDigiTimeBox_SL_.push_back(meDigiHisto_);
165 cout <<
"--- [MuonDTDigis] Analysing Event: #Run: " <<
event.id().run()
166 <<
" #Event: " <<
event.id().event() << endl;
174 event.getByToken(DigiToken_, dtDigis);
178 event.getByToken(SimHitToken_, simHits);
192 for(vector<PSimHit>::const_iterator
hit = simHits->begin();
193 hit != simHits->end();
hit++){
199 wireMap[wireId].push_back(&(*
hit));
203 int partType =
hit->particleType();
204 if (
abs(partType) == 13 ) num_musimhits++;
206 if ( wireId.station() == 1 &&
abs(partType) == 13 ) meMB1_sim_occup_->Fill(wireId.wire());
207 if ( wireId.station() == 2 &&
abs(partType) == 13 ) meMB2_sim_occup_->Fill(wireId.wire());
208 if ( wireId.station() == 3 &&
abs(partType) == 13 ) meMB3_sim_occup_->Fill(wireId.wire());
209 if ( wireId.station() == 4 &&
abs(partType) == 13 ) meMB4_sim_occup_->Fill(wireId.wire());
212 float path = (exitP-entryP).
mag();
213 float path_x = fabs((exitP-entryP).x());
215 hAllHits->Fill(entryP.
x(),exitP.
x(),
216 entryP.
y(),exitP.
y(),
217 entryP.
z(),exitP.
z(),
219 partType,
hit->processType(),
227 for (detUnitIt=dtDigis->begin();
228 detUnitIt!=dtDigis->end();
231 const DTLayerId&
id = (*detUnitIt).first;
234 num_digis_layer = 0 ;
240 digiIt!=range.second;
247 if (num_digis_layer > 1 )
249 if ( (*digiIt).wire() == wire_touched )
251 meWire_DoubleDigi_->Fill((*digiIt).wire());
255 wire_touched = (*digiIt).wire();
257 meDigiTimeBox_->Fill((*digiIt).time());
258 if (
id.
wheel() == -2 ) meDigiTimeBox_wheel2m_->Fill((*digiIt).time());
259 if (
id.
wheel() == -1 ) meDigiTimeBox_wheel1m_->Fill((*digiIt).time());
260 if (
id.
wheel() == 0 ) meDigiTimeBox_wheel0_ ->
Fill((*digiIt).time());
261 if (
id.
wheel() == 1 ) meDigiTimeBox_wheel1p_->Fill((*digiIt).time());
262 if (
id.
wheel() == 2 ) meDigiTimeBox_wheel2p_->Fill((*digiIt).time());
266 cham_num = (
id.wheel() +2)*12 + (
id.
station() -1)*3 +
id.superlayer();
269 meDigiTimeBox_SL_[cham_num]->Fill((*digiIt).time());
273 DTWireId wireId(
id,(*digiIt).wire());
274 if (wireId.station() == 1 ) meMB1_digi_occup_->Fill((*digiIt).wire());
275 if (wireId.station() == 2 ) meMB2_digi_occup_->Fill((*digiIt).wire());
276 if (wireId.station() == 3 ) meMB3_digi_occup_->Fill((*digiIt).wire());
277 if (wireId.station() == 4 ) meMB4_digi_occup_->Fill((*digiIt).wire());
282 for(vector<const PSimHit*>::iterator
hit = wireMap[wireId].
begin();
283 hit != wireMap[wireId].end();
hit++)
284 if(
abs((*hit)->particleType()) == 13){
285 theta = atan( (*hit)->momentumAtEntry().x()/ (-(*hit)->momentumAtEntry().z()) )*180/
M_PI;
292 if( mu ) num_mudigis++;
295 hDigis_global->Fill((*digiIt).time(),
theta,
id.superlayer());
297 WheelHistos(
id.
wheel())->Fill((*digiIt).time(),
theta,
id.superlayer());
302 meDoubleDigi_->Fill( (
float)num_digis_layer );
308 if (num_musimhits != 0) {
309 meDigiEfficiencyMu_->Fill( (
float)num_mudigis/(
float)num_musimhits );
310 meDigiEfficiency_->Fill( (
float)num_digis/(
float)num_musimhits );
313 meSimvsDigi_->Fill( (
float)num_musimhits, (
float)num_digis ) ;
321 case 0:
return hDigis_W0.get();
323 case 1:
return hDigis_W1.get();
325 case 2:
return hDigis_W2.get();
327 default:
return NULL;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::map< DTWireId, std::vector< const PSimHit * > > DTWireIdMap
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
#define DEFINE_FWK_MODULE(type)
Geom::Theta< T > theta() const
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
hDigis * WheelHistos(int wheel)
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
std::vector< DTDigi >::const_iterator const_iterator
std::pair< const_iterator, const_iterator > Range
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override
MuonDTDigis(const edm::ParameterSet &pset)