Esempio n. 1
0
 def reconstruct_cluster(self, cluster, layer, energy=None, vertex=None):
     if vertex is None:
         vertex = TVector3()
     pdg_id = None
     if layer=='ecal_in':
         pdg_id = 22
     elif layer=='hcal_in':
         pdg_id = 130
     else:
         raise ValueError('layer must be equal to ecal_in or hcal_in')
     assert(pdg_id)
     mass, charge = particle_data[pdg_id]
     if energy is None:
         energy = cluster.energy
     if energy < mass: 
         return None 
     momentum = math.sqrt(energy**2 - mass**2)
     p3 = cluster.position.Unit() * momentum
     p4 = TLorentzVector(p3.Px(), p3.Py(), p3.Pz(), energy)
     particle = Particle(p4, vertex, charge, pdg_id)
     path = StraightLine(p4, vertex)
     path.points[layer] = cluster.position
     particle.set_path(path)
     particle.clusters[layer] = cluster
     cluster.locked = True
     return particle
Esempio n. 2
0
 def reconstruct_cluster(self, cluster, layer, energy = None, vertex = None):
     '''construct a photon if it is an ecal
        construct a neutral hadron if it is an hcal
     '''        
     if vertex is None:
         vertex = TVector3()
     pdg_id = None
     if layer=='ecal_in':
         pdg_id = 22 #photon
     elif layer=='hcal_in':
         pdg_id = 130 #K0
     else:
         raise ValueError('layer must be equal to ecal_in or hcal_in')
     assert(pdg_id)
     mass, charge = particle_data[pdg_id]
     if energy is None:
         energy = cluster.energy
     if energy < mass: 
         return None 
     if (mass==0):
         momentum= energy #avoid sqrt for zero mass
     else:
         momentum = math.sqrt(energy**2 - mass**2)
     p3 = cluster.position.Unit() * momentum
     p4 = TLorentzVector(p3.Px(), p3.Py(), p3.Pz(), energy) #mass is not accurate here
     particle = Particle(p4, vertex, charge, pdg_id, Identifier.PFOBJECTTYPE.RECPARTICLE)
     path = StraightLine(p4, vertex)
     path.points[layer] = cluster.position #alice: this may be a bit strange because we can make a photon with a path where the point is actually that of the hcal?
                                         # nb this only is problem if the cluster and the assigned layer are different
     particle.set_path(path)
     particle.clusters[layer] = cluster  # not sure about this either when hcal is used to make an ecal cluster?
     self.locked[cluster.uniqueid] = True #just OK but not nice if hcal used to make ecal.
     pdebugger.info(str('Made {} from {}'.format(particle,  cluster)))
     return particle
Esempio n. 3
0
 def reconstruct_track(self, track, clusters=None):
     vertex = track.path.points['vertex']
     pdg_id = 211 * track.charge
     mass, charge = particle_data[pdg_id]
     p4 = TLorentzVector()
     p4.SetVectM(track.p3, mass)
     particle = Particle(p4, vertex, charge, pdg_id)
     particle.set_path(track.path)
     particle.clusters = clusters
     track.locked = True
     return particle
Esempio n. 4
0
 def reconstruct_track(self, track, clusters=None):  # cluster argument does not ever seem to be used at present
     """construct a charged hadron from the track
     """
     vertex = track.path.points["vertex"]
     pdg_id = 211 * track.charge
     mass, charge = particle_data[pdg_id]
     p4 = TLorentzVector()
     p4.SetVectM(track.p3, mass)
     particle = Particle(p4, vertex, charge, pdg_id, Identifier.PFOBJECTTYPE.RECPARTICLE)
     particle.set_path(track.path)
     particle.clusters = clusters
     self.locked[track.uniqueid] = True
     pdebugger.info(str("Made {} from {}".format(particle, track)))
     return particle
Esempio n. 5
0
 def reconstruct_track(self, track, clusters = None): # cluster argument does not ever seem to be used at present
     '''construct a charged hadron from the track
     '''
     vertex = track.path.points['vertex']
     pdg_id = 211 * track.charge
     mass, charge = particle_data[pdg_id]
     p4 = TLorentzVector()
     p4.SetVectM(track.p3, mass)
     particle = Particle(p4, vertex, charge, pdg_id, Identifier.PFOBJECTTYPE.RECPARTICLE)
     particle.set_path(track.path)
     particle.clusters = clusters
     self.locked[track.uniqueid] = True
     pdebugger.info(str('Made {} from {}'.format(particle,  track)))
     return particle