TOFTimingResolution_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: TOFTimingResolution
3 // Plugin Type: analyzer (art v2_12_01)
4 // File: TOFTimingResolution_module.cc
5 //
6 // Generated at Sat Apr 6 11:35:16 2019 by Dung Phan using cetskelgen
7 // from cetlib version v3_06_00.
8 ////////////////////////////////////////////////////////////////////////
9 
13 #include "fhiclcpp/ParameterSet.h"
21 
22 // nova
24 #include "RawData/RawBeamline.h"
28 #include "BeamlineRecoBase/ToF.h"
31 
32 // ROOT
33 #include "TH1D.h"
34 #include "TH2D.h"
35 #include "TTree.h"
36 
37 // stl
38 #include <iostream>
39 
40 namespace novatb {
41  class TOFTimingResolution;
42 }
43 
44 
46 public:
47  explicit TOFTimingResolution(fhicl::ParameterSet const & p);
48  void analyze(art::Event const & e) override;
49  void reconfigure(const fhicl::ParameterSet& p);
50  void beginJob() override;
51  double* selectChannel(unsigned int digitizerChannel);
52 
53 private:
56  // art::InputTag _WCInputTag;
57 
58  // beamlinereco::CFDHitFinder<double>* cfdHF;
59  // std::map<beamlinereco::CFDParams, double> paramSet;
60 
61  TTree * tof_tree;
62  // double Channel_9[1024];
63  // double Channel_8[1024];
64  // double Channel_7[1024];
65  // double Channel_6[1024];
66  double Cherenkov[1024];
67  double Paddle_4[1024];
68  double Paddle_3[1024];
69  double Paddle_2[1024];
70  double Paddle_1[1024];
71 
72  // services
74 
75 };
76 
77 
79  reconfigure(p);
80 }
81 
84  tof_tree = tfs->make<TTree>("tof_tree", "TOF Tree");
85  tof_tree->Branch("Paddle_1", Paddle_1, "Paddle_1[1024]/D");
86  tof_tree->Branch("Paddle_2", Paddle_2, "Paddle_2[1024]/D");
87  tof_tree->Branch("Paddle_3", Paddle_3, "Paddle_3[1024]/D");
88  tof_tree->Branch("Paddle_4", Paddle_4, "Paddle_4[1024]/D");
89  tof_tree->Branch("Cherenkov", Cherenkov, "Cherenkov[1024]/D");
90  // tof_tree->Branch("Channel_6", Channel_6, "Channel_6[1024]/D");
91  // tof_tree->Branch("Channel_7", Channel_7, "Channel_7[1024]/D");
92  // tof_tree->Branch("Channel_8", Channel_8, "Channel_8[1024]/D");
93 
94  // double samplingRateInGSPS = 5;
95  //
96  // paramSet[beamlinereco::kADCNBits] = 12;
97  // paramSet[beamlinereco::kADCDynamicRange] = 1;
98  // paramSet[beamlinereco::kADCOffset] = 0;
99  // paramSet[beamlinereco::kTimeSamplingInterval] = 1 / (samplingRateInGSPS);
100  // paramSet[beamlinereco::kNSamplingPoints] = 1024;
101  // paramSet[beamlinereco::kIsWaveformNegativePolarity] = 1;
102  // paramSet[beamlinereco::kCFDThreshold] = 0.4;
103  // paramSet[beamlinereco::kRawHitFinderThresholdInNoiseSigma] = 8;
104  // paramSet[beamlinereco::kShortRawHitIgnoringDurationInTicks] = 10;
105  // paramSet[beamlinereco::kConsecutiveHitSeperationDurationInTicks] = 5;
106  // paramSet[beamlinereco::kGSFilter] = 0;
107  // paramSet[beamlinereco::kGSFilterWindow] = 17;
108  // paramSet[beamlinereco::kGSFilterDegree] = 3;
109  // paramSet[beamlinereco::kIntergratedWindowFixed] = 0;
110  // paramSet[beamlinereco::kIntergratedWindowLowerLimitIndex] = 0;
111  // paramSet[beamlinereco::kIntergratedWindowUpperLimitIndex] = 1024;
112  //
113  // cfdHF = new beamlinereco::CFDHitFinder<double>();
114  // cfdHF->SetParams(paramSet);
115 }
116 
118  _ToFInputTag = "daq:ToF";
119  _CherenkovInputTag = "daq:Cherenkov";
120 }
121 
124  std::vector<art::Ptr<rawdata::RawBeamlineDigit> > ToFs;
125  if (e.getByLabel(_ToFInputTag, ToFHandle)) art::fill_ptr_vector(ToFs, ToFHandle);
126 
128  std::vector<art::Ptr<rawdata::RawBeamlineDigit> > Cherenkovs;
129  if (e.getByLabel(_CherenkovInputTag, CherenkovHandle)) art::fill_ptr_vector(Cherenkovs, CherenkovHandle);
130 
131  // art::Handle<std::vector<rawdata::RawBeamlineWC> > WCHandle;
132  // std::vector<art::Ptr<rawdata::RawBeamlineWC> > WCs;
133  // if (e.getByLabel(_WCInputTag, WCHandle)) art::fill_ptr_vector(WCs, WCHandle);
134 
135  for (auto itr = ToFs.begin(); itr != ToFs.end(); itr++) {
136  unsigned int channel = fChannelMap->OnlineDigitChannel((*itr)->ChannelID());
137  double* chPointer = selectChannel(channel);
138  std::vector<uint16_t> waveform = (*itr)->ADCs();
139 
140  if (chPointer != NULL) {
141  for (unsigned int i = 0; i < 1024; i++) {
142  *(chPointer + i) = (double)waveform.at(i);
143  }
144  }
145  }
146 
147  for (auto itr = Cherenkovs.begin(); itr != Cherenkovs.end(); itr++) {
148  unsigned int channel = fChannelMap->OnlineDigitChannel((*itr)->ChannelID());
149  double* chPointer = selectChannel(channel);
150  std::vector<uint16_t> waveform = (*itr)->ADCs();
151 
152  if (chPointer != NULL) {
153  for (unsigned int i = 0; i < 1024; i++) {
154  *(chPointer + i) = (double)waveform.at(i);
155  }
156  }
157  }
158 
159  tof_tree->Fill();
160 }
161 
162 double* novatb::TOFTimingResolution::selectChannel(unsigned int digitizerChannel) {
163  double* chPointer;
164  switch (digitizerChannel) {
165  case (3): {chPointer = &Cherenkov[0]; break;}
166  case (4): {chPointer = &Paddle_1[0]; break;}
167  case (5): {chPointer = &Paddle_2[0]; break;}
168  case (6): {chPointer = &Paddle_3[0]; break;}
169  case (7): {chPointer = &Paddle_4[0]; break;}
170  // case (5): {chPointer = &Channel_5[0]; break;}
171  // case (6): {chPointer = &Channel_6[0]; break;}
172  // case (7): {chPointer = &Channel_7[0]; break;}
173  // case (8): {chPointer = &Channel_8[0]; break;}
174  default: {chPointer = NULL; break;}
175  }
176 
177  return chPointer;
178 }
179 
180 
art::ServiceHandle< beamlineutil::BeamlineChannelMap > fChannelMap
void reconfigure(const fhicl::ParameterSet &p)
const char * p
Definition: xmltok.h:285
DEFINE_ART_MODULE(TestTMapFile)
unsigned int OnlineDigitChannel(ChannelID channel) const
Online digiziter channel number for this offline ChannelID.
Encapsulation of reconstructed digitizer &#39;hits&#39;. Used for ToF PMTs and SiPMs, and Cherenkov and Muon ...
Encapsulation of reconstructed Time-of-Flight (ToF) information. Part of beamline reconstruction for ...
Encapsulation of reconstructed Wire Chamber track. Part of beamline reconstruction for NOvA test beam...
void analyze(art::Event const &e) override
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
TOFTimingResolution(fhicl::ParameterSet const &p)
T * make(ARGS...args) const
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
Raw data definitions for beamline data used in NOvA test beam experiment.
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:464
Encapsulation of reconstructed PID information from detectors in the beamline (ToF, WCs, Cherenkov). Part of beamline reconstruction for NOvA test beam.
Float_t e
Definition: plot.C:35
double * selectChannel(unsigned int digitizerChannel)
Channel mapping service which may be used to interpret the channels which are read out by the various...
Encapsulation of reconstructed track in the muon stack downstream of test beam detector. Part of beamline reconstruction for NOvA test beam.