1 #ifndef SimMuon_DTDigiReader_h 2 #define SimMuon_DTDigiReader_h 33 file =
new TFile(
"DTDigiPlots.root",
"RECREATE");
35 DigiTimeBox =
new TH1F(
"DigiTimeBox",
"Digi Time Box", 2048, 0, 1600);
36 DigiTimeBoxW0 =
new TH1F(
"DigiTimeBoxW0",
"Digi Time Box W0", 2000, 0, 1600);
37 DigiTimeBoxW1 =
new TH1F(
"DigiTimeBoxW1",
"Digi Time Box W1", 2000, 0, 1600);
38 DigiTimeBoxW2 =
new TH1F(
"DigiTimeBoxW2",
"Digi Time Box W2", 2000, 0, 1600);
40 cout <<
"file open!" << endl;
42 cout <<
"*** Error in opening file ***" << endl;
43 label =
pset.getUntrackedParameter<
string>(
"label");
44 psim_token = consumes<PSimHitContainer>(
edm::InputTag(
"g4SimHits",
"MuonDTHits"));
51 DigiTimeBoxW0->Write();
52 DigiTimeBoxW1->Write();
53 DigiTimeBoxW2->Write();
60 cout <<
"--- Run: " <<
event.id().run() <<
" Event: " <<
event.id().event() << endl;
63 event.getByToken(DTd_token, dtDigis);
66 event.getByToken(psim_token,
simHits);
69 for (detUnitIt = dtDigis->begin(); detUnitIt != dtDigis->end(); ++detUnitIt) {
74 cout <<
"--------------" << endl;
80 cout <<
" Wire: " << (*digiIt).wire() << endl <<
" digi time (ns): " << (*digiIt).time() << endl;
83 DTWireId wireId((*simHit).detUnitId());
84 if (wireId.layerId() ==
id &&
abs((*simHit).particleType()) == 13) {
85 cout <<
"entry: " << (*simHit).entryPoint() << endl
86 <<
"exit: " << (*simHit).exitPoint() << endl
87 <<
"TOF: " << (*simHit).timeOfFlight() << endl;
94 DigiTimeBoxW0->Fill((*digiIt).time());
95 else if (
abs(
id.superlayer()) == 1)
96 DigiTimeBoxW1->Fill((*digiIt).time());
97 else if (
abs(
id.superlayer()) == 2)
98 DigiTimeBoxW2->Fill((*digiIt).time());
100 cout <<
"Error" << endl;
101 DigiTimeBox->Fill((*digiIt).time());
105 cout <<
"--------------" << endl;
DTDigiReader(const ParameterSet &pset)
edm::EDGetTokenT< DTDigiCollection > DTd_token
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< PSimHitContainer > psim_token
std::pair< const_iterator, const_iterator > Range
std::vector< DigiType >::const_iterator const_iterator
void analyze(const Event &event, const EventSetup &eventSetup) override