27 #include "art_root_io/TFileService.h" 29 #include "artg4tk/pluginDetectors/gdml/ByParticle.hh" 30 #include "artg4tk/pluginDetectors/gdml/DRCalorimeterHit.hh" 39 #include "CLHEP/Units/SystemOfUnits.h" 42 class CheckDRCalorimeterHits;
69 , pstl(p.
get<
fhicl::ParameterSet>(
"pstl"))
82 _hnDRHits = tfs->make<TH1F>(
"hnDRHits",
"Number of DRCaloArtHits", 100, 0., 20000.);
83 _hDREdep = tfs->make<TH1F>(
"hDREdep",
"total Energy deposition in DRCaloArtHits", 100, 0., 11.);
85 "hNCeren",
"total number of Cerenkov Photons in DRCaloArtHits", 100, 0., 10000.);
86 _hEdepvsNCeren = tfs->make<TH2F>(
"hEdepvsNCeren",
"Edep vs. NCeren", 100, 0, 11, 100, 0, 10000.);
88 "ntuple",
"Demo ntuple",
"Event:Edep0:Edep1:Edep2:Edep3:Edep4:Edep5:Edep6:Edep7:Edep8:Edep9");
92 "Event:Nceren0:Nceren1:Nceren2:Nceren3:Nceren4:Nceren5:Nceren6:Nceren7:Nceren8:Nceren9");
93 mapofhistos[
"Fragment"] = tfs->make<TH1F>(
"hFragment",
"Fragment percentage", 100, 0., 100.);
94 mapofhistos[
"He3"] = tfs->make<TH1F>(
"hHe3",
"He3 percentage", 100, 0., 100.);
95 mapofhistos[
"alpha"] = tfs->make<TH1F>(
"halpha",
"alpha percentage", 100, 0., 100.);
96 mapofhistos[
"deuteron"] = tfs->make<TH1F>(
"hdeuteron",
"deuteron percentage", 100, 0., 100.);
97 mapofhistos[
"triton"] = tfs->make<TH1F>(
"htriton",
"triton percentage", 100, 0., 100.);
98 mapofhistos[
"proton"] = tfs->make<TH1F>(
"hproton",
"proton percentage", 100, 0., 100.);
99 mapofhistos[
"neutron"] = tfs->make<TH1F>(
"hneutron",
"neutron percentage", 100, 0., 100.);
100 mapofhistos[
"e+"] = tfs->make<TH1F>(
"he+",
"positron percentage", 100, 0., 100.);
101 mapofhistos[
"e-"] = tfs->make<TH1F>(
"he-",
"electron percentage", 100, 0., 100.);
102 mapofhistos[
"pi+"] = tfs->make<TH1F>(
"hpiplus",
"piplus percentage", 100, 0., 100.);
103 mapofhistos[
"pi-"] = tfs->make<TH1F>(
"hpiminus",
"piminus percentage", 100, 0., 100.);
104 mapofhistos[
"gamma"] = tfs->make<TH1F>(
"hgamma",
"gamma percentage", 100, 0., 100.);
105 mapofhistos[
"mu+"] = tfs->make<TH1F>(
"hmu+",
"mu+ percentage", 100, 0., 100.);
106 mapofhistos[
"mu-"] = tfs->make<TH1F>(
"hmu-",
"mu- percentage", 100, 0., 100.);
107 mapofhistos[
"sigma+"] = tfs->make<TH1F>(
"hsigma+",
"sigma+ percentage", 100, 0., 100.);
108 mapofhistos[
"sigma-"] = tfs->make<TH1F>(
"hsigma-",
"sigma- percentage", 100, 0., 100.);
109 mapofhistos[
"kaon+"] = tfs->make<TH1F>(
"hkaon+",
"kaon+ percentage", 100, 0., 100.);
110 mapofhistos[
"kaon-"] = tfs->make<TH1F>(
"hkaon-",
"kaon- percentage", 100, 0., 100.);
111 mapofhistos[
"kaon0L"] = tfs->make<TH1F>(
"hkaon0L",
"kaon0 percentage", 100, 0., 100.);
112 mapofhistos[
"kaon0S"] = tfs->make<TH1F>(
"hkaon0S",
"Kspercentage", 100, 0., 100.);
113 mapofhistos[
"lambda"] = tfs->make<TH1F>(
"hlambda",
"lambda percentage", 100, 0., 100.);
114 mapofhistos[
"xi-"] = tfs->make<TH1F>(
"hximinus",
"ximinu percentage", 100, 0., 100.);
115 mapofhistos[
"anti_neutron"] =
116 tfs->make<TH1F>(
"hneutronbar",
"neutronbar percentage", 100, 0., 100.);
117 mapofhistos[
"anti_sigma-"] =
118 tfs->make<TH1F>(
"hsigmaminusbar",
"anti_sigma- percentage", 100, 0., 100.);
119 mapofhistos[
"anti_proton"] = tfs->make<TH1F>(
"hpar",
"pbar percentage", 100, 0., 100.);
120 mapofhistos[
"anti_xi-"] = tfs->make<TH1F>(
"hantiximinus",
"anti_xi-percentage", 100, 0., 100.);
121 mapofhistos[
"anti_omega-"] =
122 tfs->make<TH1F>(
"hantiomegaminus",
"anti_omega- percentage", 100, 0., 100.);
123 mapofhistos[
"anti_sigma+"] =
124 tfs->make<TH1F>(
"hantisigmaplus",
"anti_sigma+percentage", 100, 0., 100.);
125 mapofhistos[
"anti_lambda"] =
126 tfs->make<TH1F>(
"hlambdabar",
"anti_lambda percentage", 100, 0., 100.);
127 mapofhistos[
"anti_xi0"] = tfs->make<TH1F>(
"hxi0bar",
"anti_xi0 percentage", 100, 0., 100.);
128 mapofhistos[
"other"] =
129 tfs->make<TH1F>(
"hother",
"other percentage", 100, 0., 100.);
132 tfs->make<TH1F>(
"NCeren_deuteron",
"deuteronp ercentage", 100, 0., 100.);
133 ncmapofhistos[
"triton"] = tfs->make<TH1F>(
"NCeren_triton",
"triton percentage", 100, 0., 100.);
134 ncmapofhistos[
"He3"] = tfs->make<TH1F>(
"NCeren_He3",
"He3 percentage", 100, 0., 100.);
135 ncmapofhistos[
"proton"] = tfs->make<TH1F>(
"NCeren_proton",
"proton percentage", 100, 0., 100.);
136 ncmapofhistos[
"e+"] = tfs->make<TH1F>(
"NCeren_e+",
"e+ percentage", 100, 0., 100.);
137 ncmapofhistos[
"e-"] = tfs->make<TH1F>(
"NCeren_e-",
"e- percentage", 100, 0., 100.);
138 ncmapofhistos[
"mu+"] = tfs->make<TH1F>(
"NCeren_mu+",
"mu+ percentage", 100, 0., 100.);
139 ncmapofhistos[
"mu-"] = tfs->make<TH1F>(
"NCeren_mu-",
"mu- percentage", 100, 0., 100.);
140 ncmapofhistos[
"pi+"] = tfs->make<TH1F>(
"NCeren_pi+",
"pi+ percentage", 100, 0., 100.);
141 ncmapofhistos[
"pi-"] = tfs->make<TH1F>(
"NCeren_pi-",
"pi- percentage", 100, 0., 100.);
142 ncmapofhistos[
"kaon+"] = tfs->make<TH1F>(
"NCeren_kaon+",
"kaon+ percentage", 100, 0., 100.);
143 ncmapofhistos[
"kaon-"] = tfs->make<TH1F>(
"NCeren_kaon-",
"kaon- percentage", 100, 0., 100.);
144 ncmapofhistos[
"sigma+"] = tfs->make<TH1F>(
"NCeren_sigma+",
"sigma+ percentage", 100, 0., 100.);
145 ncmapofhistos[
"sigma-"] = tfs->make<TH1F>(
"NCeren_sigma-",
"sigma- percentage", 100, 0., 100.);
146 ncmapofhistos[
"xi-"] = tfs->make<TH1F>(
"NCeren_xi-",
"xi- percentage", 100, 0., 100.);
148 tfs->make<TH1F>(
"NCeren_anti_sigma+",
"anti_sigma+ percentage", 100, 0., 100.);
150 tfs->make<TH1F>(
"NCeren_anti_sigma-",
"anti_sigma- percentage", 100, 0., 100.);
152 tfs->make<TH1F>(
"NCeren_anti_proton",
"anti_proton percentage", 100, 0., 100.);
154 tfs->make<TH1F>(
"NCeren_anti_xi-",
"anti_xi- percentage", 100, 0., 100.);
156 tfs->make<TH1F>(
"NCeren_anti_omega-",
"anti_omega- percentage", 100, 0., 100.);
158 tfs->make<TH1F>(
"NCeren_other",
"other percentage", 100, 0., 100.);
159 const unsigned int numz = 10;
160 for (
unsigned int jj = 0; jj < numz; jj++) {
162 std::string histonamethick =
"Edep_thick_lay" +
std::to_string(jj);
163 cout << histonamethin << endl;
164 cout << histonamethin.c_str() << endl;
166 tfs->make<TH1F>(histonamethin.c_str(), histonamethin.c_str(), 100, 0., 2.));
168 tfs->make<TH1F>(histonamethick.c_str(), histonamethick.c_str(), 100, 0., 2.));
170 std::cout <<
" artg4tk::CheckDRCalorimeterHits: The name of the used reference physics list is: " 171 <<
pstl.
get<std::string>(
"PhysicsListName") << std::endl;
178 typedef std::vector<art::Handle<DRCalorimeterHitCollection>> DRHandleVector;
181 double sumNCeren = 0.0;
182 unsigned int numz = 10;
185 std::vector<double> ncerenthin;
186 std::vector<double> ncerenthick;
187 for (
unsigned int ijk = 0; ijk < numz; ijk++) {
188 edepthin.push_back(0.0);
189 edepthick.push_back(0.0);
190 ncerenthin.push_back(0.0);
191 ncerenthick.push_back(0.0);
194 auto allDRSims =
event.getMany<DRCalorimeterHitCollection>();
198 string iname = prov->productInstanceName();
199 string pname = prov->processName();
200 std::cout <<
"iname: " << iname << std::endl;
201 std::cout <<
"pname: " << pname << std::endl;
203 std::vector<std::string> names = ps.
get_names();
206 std::cout << *t << std::endl;
208 const DRCalorimeterHitCollection& DRsims(**i);
211 const DRCalorimeterHit&
hit = *j;
212 unsigned int lay = (int)(hit.GetID() / (numz * numz));
217 sumDRE = sumDRE + hit.GetEdep();
218 sumNCeren = sumNCeren + hit.GetNceren();
219 if (iname.find(
"thin") != std::string::npos) {
220 edepthin[lay] = edepthin[lay] + hit.GetEdep();
221 ncerenthin[lay] = ncerenthin[lay] + hit.GetNceren();
223 edepthick[lay] = edepthick[lay] + hit.GetEdep();
224 ncerenthick[lay] = ncerenthick[lay] + hit.GetNceren();
228 _hDREdep->Fill(sumDRE / CLHEP::GeV);
231 for (
unsigned int ijk = 0; ijk < numz; ijk++) {
257 typedef std::vector<art::Handle<ByParticle>> EdepHandleVector;
260 auto allEdeps =
event.getMany<ByParticle>();
268 string instancename = prov->productInstanceName();
270 if (instancename.find(
"NCeren") != std::string::npos) {
271 const ByParticle& Edeps(**i);
274 junkie = Edeps.at(
"NCerentot");
277 junkie = junkie + Edeps.at(
"NCerentot");
280 addupnc[it->first] = addupnc[it->first] + it->second;
283 }
else if (instancename.find(
"Edep") != std::string::npos) {
284 const ByParticle& Edeps(**i);
287 junkie = Edeps.at(
"Etot");
290 junkie = junkie + Edeps.at(
"Etot");
293 addup[it->first] = addup[it->first] + it->second;
308 mapofhistos[it->first]->Fill((100. * it->second) / junkie);
313 ncmapofhistos[it->first]->Fill((100. * it->second) / junkie);
std::vector< TH1F * > vecofhistosthick
std::vector< double > edepthick
#define DEFINE_ART_MODULE(klass)
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
Provenance const * provenance() const
T get(std::string const &key) const
EventNumber_t event() const
std::map< std::string, TH1F * > ncmapofhistos
Detector simulation of raw signals on wires.
void analyze(const art::Event &event) override
decltype(auto) get(T &&obj)
ADL-aware version of std::to_string.
CheckDRCalorimeterHits(fhicl::ParameterSet const &p)
std::vector< std::string > get_names() const
std::vector< double > edepthin
std::map< std::string, TH1F * > mapofhistos
Event finding and building.
std::vector< TH1F * > vecofhistosthin