19 #include "art_root_io/TFileService.h" 20 #include "art_root_io/TFileDirectory.h" 37 #include "nug4/ParticleNavigation/ParticleList.h" 107 fTree =
tfs->make<TTree>(
"EMPi0Energy",
"EMPi0Energy");
144 std::vector<art::Ptr<recob::Hit> > hits;
150 std::vector<art::Ptr<recob::Cluster> > clusters;
159 for (
unsigned int clus = 0; clus < clusters.size(); ++clus) {
162 std::vector<art::Ptr<recob::Hit> > hits = fmh.at(clus);
167 charge += ((*hit)->Integral() * TMath::Exp((500 * (*hit)->PeakTime())/3e6));
191 truePhoton2 = truePhoton1;
241 std::vector<sim::IDE> ides;
243 ides.push_back(*ide_P);
249 deposit += ideIt->energy;
263 double particleEnergy = 0;
264 int likelyTrackID = 0;
266 for (
unsigned int idIt = 0; idIt < trackIDs.size(); ++idIt) {
267 if (trackIDs.at(idIt).energy > particleEnergy) {
268 particleEnergy = trackIDs.at(idIt).energy;
269 likelyTrackID = TMath::Abs(trackIDs.at(idIt).trackID);
272 return likelyTrackID;
280 std::map<int,double> trackMap;
284 trackMap[trackID] += hit->
Integral();
287 double highestCharge = 0;
288 int clusterTrack = 0;
290 if (trackIt->second > highestCharge) {
291 highestCharge = trackIt->second;
292 clusterTrack = trackIt->first;
301 TVector3
end = TVector3(particle->
EndX(),particle->
EndY(),particle->
EndZ());
302 TVector3
direction = TVector3(particle->
Px(),particle->
Py(),particle->
Pz()).Unit();
304 int distanceStep = 1, steps = 0;
309 pos = end + ( (steps*distanceStep) * direction );
310 double currentPos[3]; currentPos[0] = pos.X(); currentPos[1] = pos.Y(); currentPos[2] = pos.Z();
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
double vertexDetectorDistLowEPhoton
double cluster_charge[kMaxClusters]
double Py(const int i=0) const
void cluster(In first, In last, Out result, Pred *pred)
Encapsulate the construction of a single cyostat.
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
std::string fClusterModuleLabel
Handle< PROD > getHandle(SelectorBase const &) const
art::ServiceHandle< art::TFileService > tfs
art::ServiceHandle< cheat::BackTrackerService > backtracker
const simb::MCParticle * TrackIdToParticle_P(int id) const
bool isValid
Whether this ID points to a valid element.
std::string fHitsModuleLabel
double Px(const int i=0) const
int trueTrackIDLowEPhoton
std::vector< const sim::IDE * > TrackIdToSimIDEs_Ps(int const &id) const
int trueTrackIDHighEPhoton
float Integral() const
Integral under the calibrated signal waveform of the hit, in tick x ADC units.
geo::PlaneID Plane() const
Returns the plane ID this cluster lies on.
Cluster finding and building.
EDAnalyzer(fhicl::ParameterSet const &pset)
int NumberDaughters() const
art framework interface to geometry description
EMPi0Energy(fhicl::ParameterSet const &pset)
int Daughter(const int i) const
double FindVertexDetectorDistance(const simb::MCParticle *particle)
art::ServiceHandle< geo::Geometry > geom
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
art::ServiceHandle< cheat::ParticleInventoryService > particleinventory
double ConvertChargeToEnergy(double charge, int plane)
#define DEFINE_ART_MODULE(klass)
double FindDepositedEnergy(int trackID)
int cluster_truetrackid[kMaxClusters]
T get(std::string const &key) const
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
PlaneID_t Plane
Index of the plane within its TPC.
double depositHighEPhoton
double cluster_energy[kMaxClusters]
Detector simulation of raw signals on wires.
const sim::ParticleList & ParticleList() const
int cluster_size[kMaxClusters]
void analyze(art::Event const &evt)
Declaration of signal hit object.
double trueEnergyHighEPhoton
Encapsulate the construction of a single detector plane.
int FindTrackID(detinfo::DetectorClocksData const &clockData, art::Ptr< recob::Hit > const &hit)
Contains all timing reference information for the detector.
const TLorentzVector & Momentum(const int i=0) const
int cluster_plane[kMaxClusters]
double Pz(const int i=0) const
int FindTrueTrack(detinfo::DetectorClocksData const &clockData, std::vector< art::Ptr< recob::Hit > > const &clusterHits)
Tools and modules for checking out the basics of the Monte Carlo.
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
void reconfigure(fhicl::ParameterSet const &p)
double vertexDetectorDistHighEPhoton
double trueEnergyLowEPhoton
Encapsulate the construction of a single detector plane.