219 std::cout<<
"============================================"<<std::endl
220 <<
"Run = "<<
event.run()<<
", SubRun = "<<
event.subRun()<<
", Event = "<<
event.id().event()<<std::endl
221 <<
"============================================"<<std::endl;
228 auto particleHandle =
event.getValidHandle<std::vector<simb::MCParticle>>(
fSimModuleLabel);
231 auto crtHitHandle =
event.getValidHandle<std::vector<sbn::crt::CRTHit>>(
fCRTHitLabel);
234 art::FindManyP<sbnd::crt::CRTData> findManyData(crtHitHandle, event,
fCRTHitLabel);
241 std::map<int, std::vector<sbn::crt::CRTHit>> crtHits;
242 double minHitTime = 99999;
243 double maxHitTime = -99999;
245 for(
auto const&
hit : (*crtHitHandle)){
248 if(trueId == -99999)
continue;
249 crtHits[trueId].push_back(
hit);
250 double hitTime = (double)(
int)
hit.ts1_ns * 1
e-3;
251 if(hitTime < minHitTime) minHitTime = hitTime;
252 if(hitTime > maxHitTime) maxHitTime = hitTime;
259 std::map<int, simb::MCParticle> particles;
260 for (
auto const& particle: (*particleHandle)){
261 int partId = particle.TrackId();
262 particles[partId] = particle;
265 double time = particle.T() * 1
e-3;
266 if(time < minHitTime || time > maxHitTime)
continue;
268 if(!(
std::abs(particle.PdgCode()) == 13 && particle.Mother()==0))
continue;
272 for(
auto const& stripName : stripNames){
282 if(crtHits.find(partId) == crtHits.end())
continue;
284 for(
size_t i = 0; i < crtHits[partId].size(); i++){
286 if(crtHits[partId][i].tagger == tagger) match =
true;
299 for(
auto const&
hit : (*crtHitHandle)){
300 std::string tagger =
hit.tagger;
303 double time = (double)(
int)
hit.ts1_ns * 1
e-3;
309 std::vector<art::Ptr<sbnd::crt::CRTData>> data = findManyData.at(hit_i);
312 std::vector<std::string> stripNames;
313 for(
auto const&
dat : data){
315 if(std::find(stripNames.begin(), stripNames.end(),
name) == stripNames.end())
316 stripNames.push_back(name);
322 if(particles.find(trueId) == particles.end())
continue;
323 if(!(
std::abs(particles[trueId].PdgCode()) == 13 && particles[trueId].Mother()==0))
continue;
328 hNpe[tagger]->Fill(
hit.peshit);
329 hAngle[tagger]->Fill(angle);
333 for(
auto const& stripName : stripNames){
358 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(event);
std::map< std::string, TH2D * > hNpeAngle
void Draw(detinfo::DetectorClocksData const &clockData, const art::Event &event)
bool fVerbose
print information about what's going on
std::map< std::string, TH1D * > hEffLengthReco
geo::Point_t StripCrossingPoint(std::string stripName, const simb::MCParticle &particle)
std::map< std::string, TH2D * > hTrueRecoSipmDist
int fPlotTrackID
id of track to plot
std::map< std::string, TH1D * > hRecoSipmDist
bool fVeryVerbose
print more information about what's going on
double fMinAngleNpePlot
Maximum angle for plotting Npe per hit.
int TrueIdFromHitId(const art::Event &event, int hit_i)
void Initialize(const art::Event &event)
std::map< std::string, TH1D * > hHitTime
std::map< std::string, TH1D * > hNpe
std::map< std::string, TH1D * > hAngle
art::InputTag fCRTHitLabel
name of CRT hit producer
std::map< std::string, TH1D * > hEffWidthTotal
std::string ChannelToStripName(size_t channel) const
double DistanceDownStrip(geo::Point_t position, std::string stripName) const
std::string GetTaggerName(std::string name) const
std::vector< std::string > CrossesStrips(const simb::MCParticle &particle)
double AngleToTagger(std::string taggerName, const simb::MCParticle &particle)
std::map< std::string, TH1D * > hTrueSipmDist
void SetDrawCrtTracks(bool tf)
std::map< std::string, TH1D * > hEffLengthTotal
std::map< std::string, TH2D * > hNpeStripDist
std::map< std::string, TH2D * > hNpeSipmDist
finds tracks best matching by angle
std::map< std::string, TH1D * > hEffWidthReco
void SetDrawCrtHits(bool tf)
CRTBackTracker fCrtBackTrack
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.
bool ValidCrossingPoint(std::string taggerName, const simb::MCParticle &particle)
void SetDrawCrtData(bool tf)
BEGIN_PROLOG could also be cout
art::InputTag fSimModuleLabel
name of detsim producer
double DistanceBetweenSipms(geo::Point_t position, size_t channel) const