1 #ifndef SimMuon_DTDigiReader_h 2 #define SimMuon_DTDigiReader_h 34 file =
new TFile(
"DTDigiPlots.root",
"RECREATE");
36 DigiTimeBox =
new TH1F(
"DigiTimeBox",
"Digi Time Box",2048,0,1600);
37 DigiTimeBoxW0 =
new TH1F(
"DigiTimeBoxW0",
"Digi Time Box W0",2000,0,1600);
38 DigiTimeBoxW1 =
new TH1F(
"DigiTimeBoxW1",
"Digi Time Box W1",2000,0,1600);
39 DigiTimeBoxW2 =
new TH1F(
"DigiTimeBoxW2",
"Digi Time Box W2",2000,0,1600);
40 if(
file->IsOpen())
cout<<
"file open!"<<endl;
41 else cout<<
"*** Error in opening file ***"<<endl;
43 psim_token = consumes<PSimHitContainer>(
edm::InputTag(
"g4SimHits",
"MuonDTHits") );
50 DigiTimeBoxW0->Write();
51 DigiTimeBoxW1->Write();
52 DigiTimeBoxW2->Write();
59 cout <<
"--- Run: " <<
event.id().run()
60 <<
" Event: " <<
event.id().event() << endl;
63 event.getByToken(DTd_token, dtDigis);
66 event.getByToken(psim_token,simHits);
70 for (detUnitIt=dtDigis->begin();
71 detUnitIt!=dtDigis->end();
78 cout<<
"--------------"<<endl;
86 cout<<
" Wire: "<<(*digiIt).wire()<<endl
87 <<
" digi time (ns): "<<(*digiIt).time()<<endl;
89 for(vector<PSimHit>::const_iterator
simHit = simHits->begin();
91 DTWireId wireId((*simHit).detUnitId());
92 if (wireId.layerId()==
id &&
abs((*simHit).particleType())==13){
93 cout<<
"entry: "<<(*simHit).entryPoint()<<endl
94 <<
"exit: "<<(*simHit).exitPoint()<<endl
95 <<
"TOF: "<<(*simHit).timeOfFlight()<<endl;
102 DigiTimeBoxW0->Fill((*digiIt).time());
103 else if(
abs(
id.superlayer())==1)
104 DigiTimeBoxW1->Fill((*digiIt).time());
105 else if(
abs(
id.superlayer())==2)
106 DigiTimeBoxW2->Fill((*digiIt).time());
107 else cout<<
"Error"<<endl;
108 DigiTimeBox->Fill((*digiIt).time());
112 cout<<
"--------------"<<endl;
T getUntrackedParameter(std::string const &, T const &) const
DTDigiReader(const ParameterSet &pset)
Abs< T >::type abs(const T &t)
std::vector< DTDigi >::const_iterator const_iterator
edm::EDGetTokenT< PSimHitContainer > psim_token
void analyze(const Event &event, const EventSetup &eventSetup) override
std::pair< const_iterator, const_iterator > Range
edm::EDGetTokenT< DTDigiCollection > DTd_token