13 #include "art/Framework/Core/EDAnalyzer.h"
14 #include "art/Framework/Core/ModuleMacros.h"
15 #include "art/Framework/Principal/Event.h"
16 #include "fhiclcpp/ParameterSet.h"
17 #include "art/Framework/Principal/Run.h"
18 #include "art/Framework/Principal/SubRun.h"
19 #include "art/Framework/Principal/Handle.h"
20 #include "canvas/Persistency/Common/Ptr.h"
21 #include "canvas/Persistency/Common/PtrVector.h"
22 #include "art/Framework/Services/Registry/ServiceHandle.h"
23 #include "art_root_io/TFileService.h"
24 #include "art_root_io/TFileDirectory.h"
25 #include "canvas/Persistency/Common/FindOneP.h"
26 #include "canvas/Persistency/Common/FindManyP.h"
27 #include "canvas/Utilities/InputTag.h"
28 #include "messagefacility/MessageLogger/MessageLogger.h"
54 #include "nusimdata/SimulationBase/MCParticle.h"
55 #include "nusimdata/SimulationBase/MCTruth.h"
56 #include "nusimdata/SimulationBase/MCNeutrino.h"
58 #include "nug4/ParticleNavigation/ParticleList.h"
71 #include "TTimeStamp.h"
90 explicit TrigInfo(fhicl::ParameterSet
const &
p);
101 void analyze(art::Event
const &
e)
override;
173 photonLabel(p.
get<art::InputTag>(
"fottoni",
"largeant")),
174 chargeLabel(p.
get<art::InputTag>(
"carconi",
"largeant")),
175 typoLabel (p.
get<art::InputTag>(
"tiponi",
"generator")),
176 hitLabel (p.
get<art::InputTag>(
"hittoni",
"ophit"))
188 art::ServiceHandle<geo::Geometry> geom;
190 std::vector<sim::SimPhotons>
const& optical = *(evt.getValidHandle<std::vector<sim::SimPhotons>>(photonLabel));
191 std::vector<sim::SimChannel>
const& charge = *(evt.getValidHandle<std::vector<sim::SimChannel>>(chargeLabel));
192 std::vector<recob::OpHit>
const&
hit = *(evt.getValidHandle<std::vector<recob::OpHit>>(hitLabel));
197 event = evt.id().event();
201 auto type = evt.getMany< std::vector<simb::MCTruth> >();
203 for(
size_t mcl = 0; mcl <
type.size(); ++mcl)
205 art::Handle< std::vector<simb::MCTruth> > mclistHandle =
type[mcl];
207 for(
size_t m = 0;
m < mclistHandle->size(); ++
m)
209 art::Ptr<simb::MCTruth> mct(mclistHandle,
m);
217 event_type=mct->GetParticle(0).PdgCode();
218 vertex_x=mct->GetParticle(0).Vx();
219 vertex_y=mct->GetParticle(0).Vy();
220 vertex_z=mct->GetParticle(0).Vz();
222 if (event_type==12||event_type==-12||event_type==14||event_type==-14||event_type==16||event_type==-16)
225 Neutrino_Interaction=mct->GetNeutrino().InteractionType();
230 Neutrino_Interaction=-9999;
243 for (
int u=0; u<360; u++)
249 true_barycentre_x =0;
250 true_barycentre_y =0;
251 true_barycentre_z =0;
253 total_quenched_energy =0;
257 for (std::size_t chargechannel = 0; chargechannel<charge.size(); ++chargechannel)
259 auto const& channeltdcide = charge.at(chargechannel).TDCIDEMap();
261 for (std::size_t TDCnu = 0; TDCnu<channeltdcide.size(); ++TDCnu)
264 sim::TDCIDE const& tdcide = channeltdcide.at(TDCnu);
266 for (std::size_t IDEnu = 0; IDEnu<tdcide.second.size(); ++IDEnu)
268 sim::IDE const& ida = tdcide.second.at(IDEnu);
272 true_barycentre_x = true_barycentre_x + ida.
x*ida.
energy;
273 true_barycentre_y = true_barycentre_y + ida.
y*ida.
energy;
274 true_barycentre_z = true_barycentre_z + ida.
z*ida.
energy;
275 total_quenched_energy = total_quenched_energy + ida.
energy;
283 true_barycentre_x = true_barycentre_x/total_quenched_energy;
284 true_barycentre_y = true_barycentre_y/total_quenched_energy;
285 true_barycentre_z = true_barycentre_z/total_quenched_energy;
287 total_quenched_energy = total_quenched_energy/3;
295 total_coll_photons=0;
297 for (std::size_t channel = 0; channel < optical.size(); ++channel) {
301 noPMT[channel] = channel;
303 photons_collected[channel]= photon_vec.size();
309 QE_photons_collected[channel]= 0.06*photons_collected[channel];
311 if (photons_collected[channel]>0){
318 geom->OpDetGeoFromOpChannel(channel).GetCenter(xyz);
320 PMTx[channel] = xyz[0];
321 PMTy[channel] = xyz[1];
322 PMTz[channel] = xyz[2];
324 reco_barycentre_y = reco_barycentre_y + PMTy[channel]*photons_collected[channel];
325 reco_barycentre_z = reco_barycentre_z + PMTz[channel]*photons_collected[channel];
326 total_coll_photons= total_coll_photons + photons_collected[channel];
328 firstphoton_time[channel] = 100000000;
330 if (photons_collected[channel]>0)
332 for (
size_t i = 0; i<photon_vec.size() && int(i)<
MaxPhotons; ++i)
334 photon_time[channel][i]= photon_vec.at(i).Time;
336 if (photon_time[channel][i]<firstphoton_time[channel])
338 firstphoton_time[channel]=photon_time[channel][i];
347 if (PMTx[channel]<0){Cryostat[channel]=0;}
348 if (PMTx[channel]>0){Cryostat[channel]=1;}
350 if (PMTx[channel]<-200){
TPC[channel]=0;}
351 if (PMTx[channel]>-200 && PMTx[channel]<0){
TPC[channel]=1;}
352 if (PMTx[channel]<200 && PMTx[channel]>0){
TPC[channel]=2;}
353 if (PMTx[channel]>200){
TPC[channel]=3;}
361 reco_barycentre_y = reco_barycentre_y/total_coll_photons;
362 reco_barycentre_z = reco_barycentre_z/total_coll_photons;
365 PMT_error_y = reco_barycentre_y-true_barycentre_y;
366 PMT_error_z = reco_barycentre_z-true_barycentre_z;
367 PMT_total_error = sqrt((PMT_error_y*PMT_error_y)+(PMT_error_z*PMT_error_z));
382 std::cout <<
"Qua arriva prima del for" << std::endl;
384 for (std::size_t hit_n = 0; hit_n < hit.size(); ++hit_n) {
389 std::cout <<
"apre il vettore numer = " << hit_n << std::endl;
394 std::cout <<
"del canale numer = " << noPMT[hit_n] << std::endl;
398 hit_peaktime[hit_n] = hit_vec.
PeakTime();
399 hit_width[hit_n] = hit_vec.
Width();
400 hit_area[hit_n] = hit_vec.
Area();
402 hit_phe[hit_n] = hit_vec.
PE();
404 std::cout <<
"di area uguale a = " << hit_area[hit_n] << std::endl;
414 art::ServiceHandle<art::TFileService>
tfs;
415 fTree = tfs->make<TTree>(
"lighttree",
"tree for the light response");
417 fTree->Branch(
"event",&event,
"event/I");
418 fTree->Branch(
"event_type",&event_type,
"event_type/I");
419 fTree->Branch(
"is_Neutrino",&is_Neutrino,
"is_Neutrino/I");
420 fTree->Branch(
"Neutrino_Interaction",&Neutrino_Interaction,
"Neutrino_Interaction/I");
421 fTree->Branch(
"total_quenched_energy",&total_quenched_energy,
"total_quenched_energy");
428 fTree->Branch(
"turned_PMT",&turned_PMT,
"turned_PMT/I");
429 fTree->Branch(
"total_coll_photons",&total_coll_photons,
"total_coll_photons/I");
430 fTree->Branch(
"photons_colleted",photons_collected,(
"photons_collected[" +
std::to_string(
nPMTs) +
"]/F").c_str());
431 fTree->Branch(
"QE_photons_colleted",QE_photons_collected,(
"QE_photons_collected[" +
std::to_string(
nPMTs) +
"]/F").c_str());
432 fTree->Branch(
"firstphoton_time",firstphoton_time,(
"firstphoton_time[" +
std::to_string(
nPMTs) +
"]/F").c_str());
435 fTree->Branch(
"nHit",&nHit,
"nHit/I");
436 fTree->Branch(
"hit_peaktime",hit_peaktime,(
"hit_peaktime[" +
std::to_string(
nPMTs) +
"]/D").c_str());
437 fTree->Branch(
"hit_width",hit_width,(
"hit_width[" +
std::to_string(
nPMTs) +
"]/D").c_str());
442 fTree->Branch(
"vertex_x",&vertex_x,
"vertex_x/D");
443 fTree->Branch(
"vertex_y",&vertex_y,
"vertex_y/D");
444 fTree->Branch(
"vertex_z",&vertex_z,
"vertex_z/D");
445 fTree->Branch(
"true_barycentre_x",&true_barycentre_x,
"true_barycentre_x/F");
446 fTree->Branch(
"true_barycentre_y",&true_barycentre_y,
"true_barycentre_y/F");
447 fTree->Branch(
"true_barycentre_z",&true_barycentre_z,
"true_barycentre_z/F");
448 fTree->Branch(
"reco_barycentre_y",&reco_barycentre_y,
"reco_barycentre_y/F");
449 fTree->Branch(
"reco_barycentre_z",&reco_barycentre_z,
"reco_barycentre_z/F");
450 fTree->Branch(
"PMT_error_y",&PMT_error_y,
"PMT_error_y/F");
451 fTree->Branch(
"PMT_error_z",&PMT_error_z,
"PMT_error_z/F");
452 fTree->Branch(
"PMT_total_error",&PMT_total_error,
"PMT_total_error/F");
float z
z position of ionization [cm]
std::pair< unsigned short, std::vector< sim::IDE > > TDCIDE
List of energy deposits at the same time (on this channel)
float photon_time[nPMTs][MaxPhotons]
Declaration of signal hit object.
float photons_collected[nPMTs]
art::InputTag photonLabel
double hit_peaktime[nPMTs]
float x
x position of ionization [cm]
tuple m
now if test mode generate materials, CRT shell, world, gdml header else just generate CRT shell for u...
void analyze(art::Event const &e) override
Simulation objects for optical detectors.
Ionization at a point of the TPC sensitive volume.
float energy
energy deposited by ionization by this track ID and time [MeV]
float QE_photons_collected[nPMTs]
Declaration of cluster object.
Definition of data types for geometry description.
Provides recob::Track data product.
float y
y position of ionization [cm]
Collection of photons which recorded on one channel.
float total_quenched_energy
TrigInfo & operator=(TrigInfo const &)=delete
std::string to_string(WindowPattern const &pattern)
art::InputTag chargeLabel
object containing MC truth information necessary for making RawDigits and doing back tracking ...
Declaration of basic channel signal object.
art::ServiceHandle< art::TFileService > tfs
Utility functions to extract information from recob::Track
Tools and modules for checking out the basics of the Monte Carlo.
float firstphoton_time[nPMTs]
TrigInfo(fhicl::ParameterSet const &p)
art framework interface to geometry description
BEGIN_PROLOG could also be cout