19 #include "art_root_io/TFileService.h" 79 for (
int i = 0; i<3; ++i){
80 for (
int j = 0; j<800; ++j){
90 std::vector<art::Ptr<raw::RawDigit> > rawlist;
92 auto rawListHandle = e.
getHandle< std::vector<raw::RawDigit> >(itag);
95 std::vector < art::Ptr < recob::Wire > > wires;
97 auto wireListHandle = e.
getHandle< std::vector < recob::Wire > >(itag2);
102 std::vector <art::Ptr<recob::Hit> > hits;
103 auto hitListHandle = e.
getHandle<std::vector<recob::Hit> >(
"gaushit");
108 auto const*
geo = lar::providerFrom<geo::Geometry>();
110 auto simChannelHandle = e.
getValidHandle<std::vector<sim::SimChannel>>(
"tpcrawdecoder:simpleSC");
112 for (
unsigned int ich = 0; ich < rawlist.size(); ++ich){
113 const auto & digitVec = rawlist[ich];
114 const auto & wireid =
geo->ChannelToWire(digitVec->Channel());
115 if (wireid[0].
TPC != 1)
continue;
117 int wire = wireid[0].Wire;
118 int plane = wireid[0].Plane;
119 double this_charge = 0;
120 std::vector<short> rawadc(6000);
121 raw::Uncompress(digitVec->ADCs(), rawadc, digitVec->GetPedestal(), digitVec->Compression());
122 for (
size_t itck = 0; itck < rawadc.size(); ++itck){
123 this_charge += rawadc[itck] - digitVec->GetPedestal();
124 rawwf[plane][wire]->SetBinContent(itck, rawadc[itck] - digitVec->GetPedestal());
126 charge[plane][wire] = this_charge;
129 for (
auto const&
channel : (*simChannelHandle) ){
130 const auto & wireid =
geo->ChannelToWire(
channel.Channel());
131 if (wireid[0].
TPC != 1)
continue;
133 int wire = wireid[0].Wire;
134 int plane = wireid[0].Plane;
135 double this_nelec = 0;
136 auto const& timeSlices =
channel.TDCIDEMap();
137 for (
auto const& timeSlice : timeSlices ){
138 auto const& energyDeposits = timeSlice.second;
139 for (
auto const& energyDeposit : energyDeposits ){
140 this_nelec += energyDeposit.numElectrons;
143 nelec[plane][wire] = this_nelec;
146 for (
unsigned int ich = 0; ich < wires.size(); ++ich){
147 const auto & wireid =
geo->ChannelToWire(wires[ich]->Channel());
148 if (wireid[0].
TPC != 1)
continue;
150 int wire = wireid[0].Wire;
151 int plane = wireid[0].Plane;
152 double this_charge = 0;
153 const auto & signal = wires[ich]->Signal();
155 for (
size_t itck = 0; itck < signal.size(); ++itck){
156 this_charge += signal[itck];
157 deconwf[plane][wire]->SetBinContent(itck, signal[itck]);
159 deconchg[plane][wire] = this_charge;
162 for (
auto const &
hit : hits){
163 if (
hit->WireID().TPC != 1)
continue;
164 int wire =
hit->WireID().Wire;
165 int plane =
hit->WireID().Plane;
176 ftree = fileServiceHandle->make<TTree>(
"ftree",
"raw digit info");
177 ftree->Branch(
"charge",
charge,
"charge[3][800]/D");
178 ftree->Branch(
"nelec",
nelec,
"nelec[3][800]/D");
180 ftree->Branch(
"hitchg",
hitchg,
"hitchg[3][800]/D");
183 for (
int i = 0; i<3; ++i){
184 for (
int j = 0; j<800; ++j){
185 rawwf[i][j] = fileServiceHandle->make<TH1D>(Form(
"rawwf_%d_%d",i,j),Form(
"Plane %d Wire %d",i,j),6000,0,6000);
186 deconwf[i][j] = fileServiceHandle->make<TH1D>(Form(
"deconwf_%d_%d",i,j),Form(
"Plane %d Wire %d",i,j),6000,0,6000);
WireChgAna & operator=(WireChgAna const &)=delete
Handle< PROD > getHandle(SelectorBase const &) const
WireChgAna(fhicl::ParameterSet const &p)
EDAnalyzer(fhicl::ParameterSet const &pset)
art framework interface to geometry description
void analyze(art::Event const &e) override
#define DEFINE_ART_MODULE(klass)
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Detector simulation of raw signals on wires.
Declaration of signal hit object.
Declaration of basic channel signal object.
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
LArSoft geometry interface.