227 std::cout<<
"============================================"<<std::endl
228 <<
"Run = "<<
event.run()<<
", SubRun = "<<
event.subRun()<<
", Event = "<<
event.id().event()<<std::endl
229 <<
"============================================"<<std::endl;
238 art::ServiceHandle<cheat::ParticleInventoryService> pi_serv;
239 auto particleHandle =
event.getValidHandle<std::vector<simb::MCParticle>>(
fSimModuleLabel);
242 art::Handle< std::vector<sbnd::crt::CRTData>> crtDataHandle;
243 std::vector<art::Ptr<sbnd::crt::CRTData> > crtDataList;
245 art::fill_ptr_vector(crtDataList, crtDataHandle);
247 art::FindManyP<sim::AuxDetIDE> findManyIdes(crtDataHandle, event,
fCRTSimLabel);
250 art::Handle<std::vector<sim::AuxDetSimChannel> > channels;
257 std::map<int, simb::MCParticle> particles;
259 for (
auto const& particle: (*particleHandle)){
262 int partID = particle.TrackId();
263 particles[partID] = particle;
271 std::map<int, std::vector<sbnd::crt::CRTData>> crtData;
272 for(
size_t i = 0; i < crtDataList.size(); i++){
276 for(
auto const&
id : trueIDs){
277 crtData[id].push_back(*crtDataList[i]);
282 if(particles.find(trueID) == particles.end())
continue;
283 if(!(
std::abs(particles[trueID].PdgCode()) == 13 && particles[trueID].Mother() == 0))
continue;
286 std::vector<art::Ptr<sim::AuxDetIDE>> ides = findManyIdes.at(i);
288 double x = 0,
y = 0,
z = 0;
289 for(
auto const& ide : ides){
290 x += (ide->entryX + ide->exitX)/2.;
291 y += (ide->entryY + ide->exitY)/2.;
292 z += (ide->entryZ + ide->exitZ)/2.;
299 int channel = crtDataList[i]->Channel();
303 double npe = ((double)crtDataList[i]->ADC() -
fQPed)/
fQSlope;
308 hSipmDistADC[tagger]->Fill(sipmDist, crtDataList[i]->ADC());
311 if(channel % 2 == 0){
312 double npe1 = ((double)crtDataList[i+1]->ADC() -
fQPed)/
fQSlope;
320 hStripDistADC[tagger]->Fill(stripDist, crtDataList[i]->ADC());
323 hADC[tagger]->Fill(crtDataList[i]->ADC());
324 hNpe[tagger]->Fill(npe);
329 hTime[tagger]->Fill(time);
336 for (
auto& adsc : *channels) {
338 if(adsc.AuxDetSensitiveID() == UINT_MAX) {
339 mf::LogWarning(
"CRTDetSimAna") <<
"AuxDetSimChannel with ID: UINT_MAX\n"
340 <<
"skipping channel...";
346 std::vector<sim::AuxDetIDE> ides = adsc.AuxDetIDEs();
348 for(
auto const& ide : ides){
350 (ide.entryY + ide.exitY)/2,
351 (ide.entryZ + ide.exitZ)/2};
352 int trueID = ide.trackID;
354 double length = std::sqrt(std::pow(ide.entryX - ide.exitX, 2)
355 + std::pow(ide.entryY - ide.exitY, 2)
356 + std::pow(ide.entryZ - ide.exitZ, 2));
362 if(particles.find(trueID) == particles.end())
continue;
363 if(!(
std::abs(particles[trueID].PdgCode()) == 13 && particles[trueID].Mother() == 0))
continue;
372 if(crtData.find(trueID) == crtData.end())
continue;
375 for(
auto const& data : crtData[trueID]){
377 if(stripName == stripNameData) match =
true;
process_name opflash particleana ie ie ie z
std::vector< int > AllTrueIds(const art::Event &event, const sbnd::crt::CRTData &data)
process_name opflash particleana ie x
std::map< std::string, TH1D * > hEffStripDistReco
std::map< std::string, TH1D * > hSipmDist
CRTBackTracker fCrtBackTrack
std::map< std::string, TH1D * > hEffStripDistTotal
std::map< std::string, TH1D * > hEffLengthTotal
art::InputTag fCRTSimLabel
name of CRT producer
bool fVerbose
print information about what's going on
std::map< std::string, TH1D * > hNpe
int TrueIdFromTotalEnergy(const art::Event &event, const sbnd::crt::CRTData &data)
art::InputTag fSimModuleLabel
name of MCParticle producer in g4
process_name opflash particleana ie ie y
std::string ChannelToStripName(size_t channel) const
double DistanceDownStrip(geo::Point_t position, std::string stripName) const
CRTStripGeo GetStrip(std::string stripName) const
std::map< std::string, TH2D * > hSipmDistNpeRatio
std::string GetTaggerName(std::string name) const
std::map< std::string, TH1D * > hNpeRatio
std::map< std::string, TH2D * > hSipmDistNpe
std::map< std::string, TH1D * > hADC
std::map< std::string, TH1D * > hEffSipmDistReco
std::map< std::string, TH1D * > hEffEDepTotal
std::map< std::string, TH2D * > hSipmDistADC
std::map< std::string, TH1D * > hEffEDepReco
std::map< std::string, TH2D * > hStripDistADC
std::map< std::string, TH1D * > hStripDist
art::InputTag fSimChannelModuleLabel
name of SimChannel producer in g4
Vector cross(Vector const &a, Vector const &b)
Return cross product of two vectors.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
std::map< std::string, TH1D * > hTime
std::map< std::string, TH1D * > hEffLengthReco
std::map< std::string, TH1D * > hEffSipmDistTotal
std::map< std::string, TH2D * > hStripDistNpe
BEGIN_PROLOG could also be cout
double DistanceBetweenSipms(geo::Point_t position, size_t channel) const