1 #ifndef LARG4_LARG4ANA_H 8 #define LARG4_LARG4ANA_H 24 #include "cetlib_except/exception.h" 37 #include "TLorentzVector.h" 100 Char_t fTTVolume[35];
101 Char_t fTMaterial[35];
102 Char_t fTDProcess[200][35];
137 fPDGCodes = tfs->
make<TH1D>(
"pdgcodes",
";PDG Code;", 5000, -2500, 2500);
138 fPi0Momentum = tfs->
make<TH1D>(
"pi0mom",
";#pi^{0} Momentum (GeV);", 1000, 0., 1000.);
140 fTree = tfs->
make<TTree>(
"MCTTree",
"MCTTree");
141 fnEnergy = tfs->
make<TH1D>(
"nEnergy",
";n,#Lambda^{0},K^{0} Momentum (GeV);", 100, 0., 10.);
142 fnDist = tfs->
make<TH1D>(
"nDistance",
";n,#Lambda^{0},K^{0} Distance (m);", 200, -30000.0, +30000.);
148 "Active channels;Active channels;# events",
151 "Drift Electrons per channel;Channel;Drift electrons",
155 "Charge in event;Total charge per event;# events",
158 "Energy in event;Total energy per event;# events",
161 "Charge on channel;Channel;Total charge per channel",
165 "Energy on channel;Channel;Total energy per channel",
187 fTree->Branch(
"MCNumDs", &
fTNds,
"MCNumDs/I");
189 fTree->Branch(
"MCDID",
fTDID,
"MCDID[MCNumDs]/I");
190 fTree->Branch(
"MCDPdg",
fTDPdg,
"MCDPdg[MCNumDs]/I");
191 fTree->Branch(
"MCDWt",
fTDWt,
"MCDWt[MCNumDs]/I");
198 fTree->Branch(
"MCOrigin", fT4Origin,
"MCOrigin[4]/F");
228 std::vector<const sim::SimChannel*> sccol;
231 double totalCharge=0.0;
232 double totalEnergy=0.0;
234 for(
size_t sc = 0; sc < sccol.size(); ++sc){
238 const auto & tdcidemap = sccol[sc]->TDCIDEMap();
239 for(
auto mapitr = tdcidemap.begin(); mapitr != tdcidemap.end(); mapitr++){
240 const std::vector<sim::IDE> idevec = (*mapitr).second;
241 numIDEs += idevec.size();
242 for(
size_t iv = 0; iv < idevec.size(); ++iv){
243 if(plist.
find( idevec[iv].trackID ) == plist.
end()
245 mf::LogWarning(
"LArG4Ana") << idevec[iv].trackID <<
" is not in particle list";
246 totalCharge +=idevec[iv].numElectrons;
247 scCharge += idevec[iv].numElectrons;
248 totalEnergy +=idevec[iv].energy;
249 scEnergy += idevec[iv].energy;
261 std::vector<const simb::MCParticle*> pvec;
262 pvec.reserve(Particles.
size());
263 for (
const auto& PartPair: Particles) {
264 pvec.push_back(PartPair.second);
265 fPDGCodes->Fill(PartPair.second->PdgCode());
271 for(
unsigned int i = 0; i < pvec.size(); ++i){
272 if(pvec[i]->PdgCode() == 111) pi0loc = i;
273 if(pvec[i]->Mother() == pi0loc+1 &&
275 pvec[i]->PdgCode() == 22){
276 mf::LogInfo(
"LArG4Ana") << pvec[i]->E() <<
" gamma energy ";
281 if (pvec[i]->PdgCode() == 2112 ||
282 pvec[i]->PdgCode() == 3122 ||
283 pvec[i]->PdgCode() == 130 ||
284 pvec[i]->PdgCode() == 310 ||
285 pvec[i]->PdgCode() == 311 ) {
286 fnEnergy->Fill(pvec[i]->
E(),pvec[i]->Weight());
287 fnDist->Fill(pvec[i]->Vx(),pvec[i]->Weight());
290 fTPdg = pvec[i]->PdgCode();
291 fTID = pvec[i]->TrackId();
293 for (
unsigned int s = 0;
s < 35; ++
s){
304 for(
unsigned int s = 0;
s < pvec[i]->Process().length(); ++
s) *(
fTProcess+
s) = pvec[i]->Process()[
s];
306 TVector3 dum = pvec[i]->Position().Vect();
308 for (
unsigned int s = 0;
s < geom->
MaterialName(pvec[i]->Position().Vect()).length(); ++
s)
311 for (
unsigned int s = 0;
s < geom->
VolumeName(pvec[i]->Position().Vect()).length(); ++
s)
314 for (
unsigned int s = 0;
s < geom->
VolumeName(pvec[i]->EndPosition().Vect()).length(); ++
s)
325 daughter = pvec[i]->Daughter(
d);
330 for(
unsigned int jj = i; jj < pvec.size(); ++jj){
332 if (
fTDID[
d] == pvec[jj]->TrackId()){
333 fTDPdg[
d] = pvec[jj]->PdgCode();
334 fTDWt[
d] = pvec[jj]->Weight();
336 for (
unsigned int s = 0;
s < pvec[jj]->Process().length(); ++
s)
339 for (
unsigned int kk = 0; kk < 4; ++kk){
348 for (
unsigned int ii = 0; ii < 4; ++ii){
360 if(numpi0gamma == 2 && pi0loc > 0){
378 #endif // LARG4_LARG4_H
SubRunNumber_t subRun() const
TProfile * fChannelCharge
Charge per channel.
void analyze(const art::Event &evt)
std::string fG4ModuleLabel
module label for the Geant
void reconfigure(fhicl::ParameterSet const &pset)
TH1D * fnumChannels
The number of channels recieving charge per event.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
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.
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::vector< ELEMENT const * > &result) const
Char_t fTDProcess[200][35]
#define DEFINE_ART_MODULE(klass)
static const int NoParticleId
T get(std::string const &key) const
TH1D * fEventCharge
Charge collected per event.
T * make(ARGS...args) 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
const sim::ParticleList & ParticleList()
std::string MaterialName(TVector3 const &point) const
Name of the deepest material containing the point xyz.
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.
std::string VolumeName(geo::Point_t const &point) const
Returns the name of the deepest volume containing specified point.
art framework interface to geometry description
TProfile * fnumIDEs
Number of drift electrons per channel.