15 #include "art_root_io/TFileService.h" 28 #include "TLorentzVector.h" 110 fPDGCodes = tfs->make<TH1D>(
"pdgcodes",
";PDG Code;", 5000, -2500, 2500);
111 fPi0Momentum = tfs->make<TH1D>(
"pi0mom",
";#pi^{0} Momentum (GeV);", 1000, 0., 1000.);
113 fTree = tfs->make<TTree>(
"MCTTree",
"MCTTree");
114 fnEnergy = tfs->make<TH1D>(
"nEnergy",
";n,#Lambda^{0},K^{0} Momentum (GeV);", 100, 0., 10.);
116 tfs->make<TH1D>(
"nDistance",
";n,#Lambda^{0},K^{0} Distance (m);", 200, -30000.0, +30000.);
121 "fnumChannels",
"Active channels;Active channels;# events", 256, 0, geo->
Nchannels());
122 fnumIDEs = tfs->make<TProfile>(
"fnumIDEs",
123 "Drift Electrons per channel;Channel;Drift electrons",
130 "fEventCharge",
"Charge in event;Total charge per event;# events", 100, 0, 2.5e8);
132 "fEventEnergy",
"Energy in event;Total energy per event;# events", 100, 0, 1e4);
134 "Charge on channel;Channel;Total charge per channel",
141 "Energy on channel;Channel;Total energy per channel",
165 fTree->Branch(
"MCNumDs", &
fTNds,
"MCNumDs/I");
167 fTree->Branch(
"MCDID",
fTDID,
"MCDID[MCNumDs]/I");
168 fTree->Branch(
"MCDPdg",
fTDPdg,
"MCDPdg[MCNumDs]/I");
169 fTree->Branch(
"MCDWt",
fTDWt,
"MCDWt[MCNumDs]/I");
176 fTree->Branch(
"MCOrigin", fT4Origin,
"MCOrigin[4]/F");
194 std::vector<const sim::SimChannel*> sccol;
197 double totalCharge = 0.0;
198 double totalEnergy = 0.0;
200 for (
size_t sc = 0;
sc < sccol.size(); ++
sc) {
201 double numIDEs = 0.0;
202 double scCharge = 0.0;
203 double scEnergy = 0.0;
204 const auto& tdcidemap = sccol[
sc]->TDCIDEMap();
205 for (
auto mapitr = tdcidemap.begin(); mapitr != tdcidemap.end(); mapitr++) {
206 const std::vector<sim::IDE> idevec = (*mapitr).second;
207 numIDEs += idevec.size();
208 for (
size_t iv = 0; iv < idevec.size(); ++iv) {
209 if (plist.
find(idevec[iv].trackID) == plist.
end() &&
211 mf::LogWarning(
"LArG4Ana") << idevec[iv].trackID <<
" is not in particle list";
212 totalCharge += idevec[iv].numElectrons;
213 scCharge += idevec[iv].numElectrons;
214 totalEnergy += idevec[iv].energy;
215 scEnergy += idevec[iv].energy;
227 std::vector<const simb::MCParticle*> pvec;
228 pvec.reserve(Particles.
size());
229 for (
const auto& PartPair : Particles) {
230 pvec.push_back(PartPair.second);
231 fPDGCodes->Fill(PartPair.second->PdgCode());
237 for (
unsigned int i = 0; i < pvec.size(); ++i) {
238 if (pvec[i]->PdgCode() == 111) pi0loc = i;
239 if (pvec[i]->Mother() == pi0loc + 1 && pi0loc > 0 && pvec[i]->PdgCode() == 22) {
240 mf::LogInfo(
"LArG4Ana") << pvec[i]->E() <<
" gamma energy ";
245 if (pvec[i]->PdgCode() == 2112 || pvec[i]->PdgCode() == 3122 || pvec[i]->PdgCode() == 130 ||
246 pvec[i]->PdgCode() == 310 || pvec[i]->PdgCode() == 311) {
247 fnEnergy->Fill(pvec[i]->
E(), pvec[i]->Weight());
248 fnDist->Fill(pvec[i]->Vx(), pvec[i]->Weight());
251 fTPdg = pvec[i]->PdgCode();
252 fTID = pvec[i]->TrackId();
254 for (
unsigned int s = 0; s < 35; ++s) {
265 for (
unsigned int s = 0; s < pvec[i]->Process().length(); ++s)
266 *(
fTProcess + s) = pvec[i]->Process()[s];
268 TVector3 dum = pvec[i]->Position().Vect();
272 for (
unsigned int s = 0; s < material_at_pos.length(); ++s)
275 auto const volume_at_pos = geom->
VolumeName(
toPoint(pvec[i]->Position().Vect()));
276 for (
unsigned int s = 0; s < volume_at_pos.length(); ++s)
279 auto const volume_at_end = geom->
VolumeName(
toPoint(pvec[i]->EndPosition().Vect()));
280 for (
unsigned int s = 0; s < volume_at_end.length(); ++s)
291 daughter = pvec[i]->Daughter(
d);
294 for (
unsigned int s = 0; s < 35; ++s)
297 for (
unsigned int jj = i; jj < pvec.size(); ++jj) {
299 if (
fTDID[
d] == pvec[jj]->TrackId()) {
300 fTDPdg[
d] = pvec[jj]->PdgCode();
301 fTDWt[
d] = pvec[jj]->Weight();
303 for (
unsigned int s = 0; s < pvec[jj]->Process().length(); ++s)
306 for (
unsigned int kk = 0; kk < 4; ++kk) {
315 for (
unsigned int ii = 0; ii < 4; ++ii) {
327 if (numpi0gamma == 2 && pi0loc > 0) {
SubRunNumber_t subRun() const
TProfile * fChannelCharge
Charge per channel.
void analyze(const art::Event &evt)
std::string fG4ModuleLabel
module label for the Geant
TH1D * fnumChannels
The number of channels recieving charge per event.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
EDAnalyzer(fhicl::ParameterSet const &pset)
TH1D * fEventEnergy
Energy collected per event.
unsigned int Nchannels() const
Returns the number of TPC readout channels in the detector.
iterator find(const key_type &key)
TProfile * fChannelEnergy
Energy per channel.
Char_t fTDProcess[200][35]
std::string VolumeName(Point_t const &point) const
Returns the name of the deepest volume containing specified point.
#define DEFINE_ART_MODULE(klass)
static const int NoParticleId
T get(std::string const &key) const
std::string MaterialName(Point_t const &point) const
Name of the deepest material containing the point xyz.
TH1D * fEventCharge
Charge collected per event.
LArG4Ana(fhicl::ParameterSet const &pset)
Standard constructor and destructor for an FMWK module.
const sim::ParticleList & ParticleList() const
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, std::vector< ELEMENT const * > &result) const
std::string fTruthModuleLabel
module label for the Geant
object containing MC truth information necessary for making RawDigits and doing back tracking ...
EventNumber_t event() const
Particle list in DetSim contains Monte Carlo particle information.
Namespace collecting geometry-related classes utilities.
Tools and modules for checking out the basics of the Monte Carlo.
art framework interface to geometry description
TProfile * fnumIDEs
Number of drift electrons per channel.