28 #include "art_root_io/TFileService.h" 29 #include "art_root_io/TFileDirectory.h" 47 #include "nug4/ParticleNavigation/ParticleList.h" 109 fTree =
tfs->make<TTree>(
"EMEnergyCalib",
"EMEnergyCalib");
142 std::vector<art::Ptr<recob::Hit> > hits;
148 std::vector<art::Ptr<recob::Cluster> > clusters;
163 for (
unsigned int hitIt = 0; hitIt < hits.size(); ++hitIt) {
170 double correctedHitCharge = ( hit->
Integral() * TMath::Exp( (
sampling_rate(clockData) * hit->
PeakTime()) / (detProp.ElectronLifetime()*1e3) ) );
196 std::vector<art::Ptr<recob::Cluster> > clusters = fmc.at(hitIt);
197 if (clusters.size() != 0) {
216 for (
auto channelIt = simChannels.begin(); channelIt != simChannels.end(); ++channelIt) {
217 int plane =
geom->
View((*channelIt)->Channel());
218 for (
auto const& tdcIt : (*channelIt)->TDCIDEMap()) {
219 for (
auto const& ideIt : tdcIt.second) {
236 TVector3
vertex = TVector3(trueParticle->
Vx(),trueParticle->
Vy(),trueParticle->
Vz());
237 TVector3
end = TVector3(trueParticle->
EndX(),trueParticle->
EndY(),trueParticle->
EndZ());
238 TVector3
direction = TVector3(trueParticle->
Px(),trueParticle->
Py(),trueParticle->
Pz()).Unit();
240 int distanceStep = 1, steps = 0;
244 pos = end + ( (steps*distanceStep) * direction );
245 double currentPos[3]; currentPos[0] = pos.X(); currentPos[1] = pos.Y(); currentPos[2] = pos.Z();
265 double particleEnergy = 0;
266 int likelyTrackID = 0;
268 for (
unsigned int idIt = 0; idIt < trackIDs.size(); ++idIt) {
269 if (trackIDs.at(idIt).energy > particleEnergy) {
270 particleEnergy = trackIDs.at(idIt).energy;
271 likelyTrackID = TMath::Abs(trackIDs.at(idIt).trackID);
274 return likelyTrackID;
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
double Py(const int i=0) const
Encapsulate the construction of a single cyostat.
std::string fHitsModuleLabel
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
art::ServiceHandle< cheat::ParticleInventoryService > particleinventory
Handle< PROD > getHandle(SelectorBase const &) const
geo::WireID WireID() const
bool isValid
Whether this ID points to a valid element.
double Px(const int i=0) const
Planes which measure Z direction.
float Integral() const
Integral under the calibrated signal waveform of the hit, in tick x ADC units.
WireID_t Wire
Index of the wire within its plane.
EDAnalyzer(fhicl::ParameterSet const &pset)
int FindTrackID(detinfo::DetectorClocksData const &clockData, art::Ptr< recob::Hit > const &hit)
art framework interface to geometry description
int hit_truetrackid[kMaxHits]
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
art::ServiceHandle< cheat::BackTrackerService > backtracker
void analyze(art::Event const &evt)
double hit_charge[kMaxHits]
double vertexDetectorDist
#define DEFINE_ART_MODULE(klass)
art::ServiceHandle< art::TFileService > tfs
T get(std::string const &key) const
PlaneID_t Plane
Index of the plane within its TPC.
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
Detector simulation of raw signals on wires.
const sim::ParticleList & ParticleList() const
double Vx(const int i=0) const
float PeakTime() const
Time of the signal peak, in tick units.
Declaration of signal hit object.
void reconfigure(fhicl::ParameterSet const &p)
std::string fClusterModuleLabel
int hit_clusterid[kMaxHits]
Encapsulate the construction of a single detector plane.
Contains all timing reference information for the detector.
const TLorentzVector & Momentum(const int i=0) const
double Pz(const int i=0) const
double hit_peakT[kMaxHits]
double Vz(const int i=0) const
const std::vector< art::Ptr< sim::SimChannel > > & SimChannels() const
int hit_channel[kMaxHits]
Tools and modules for checking out the basics of the Monte Carlo.
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
TPCID_t TPC
Index of the TPC within its cryostat.
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
art::ServiceHandle< geo::Geometry > geom
raw::ChannelID_t Channel() const
ID of the readout channel the hit was extracted from.
double Vy(const int i=0) const
Encapsulate the construction of a single detector plane.
EMEnergyCalib(fhicl::ParameterSet const &pset)