Example #1
0
from heppy.analyzers.Filter import Filter
gen_particles_stable = cfg.Analyzer(
    Filter,
    output='gen_particles_stable',
    # output = 'particles',
    input_objects='gen_particles',
    filter_func=lambda x: x.status() == 1 and abs(x.pdgid()) not in
    [12, 14, 16] and x.pt() > 1e-5)

# configure the papas fast simulation with the CMS detector
# help(Papas) for more information
# history nodes keeps track of which particles produced which tracks, clusters
from heppy.analyzers.PapasSim import PapasSim
# from heppy.analyzers.Papas import Papas
from heppy.papas.detectors.CMS import CMS
detector = CMS()

papas = cfg.Analyzer(PapasSim,
                     instance_label='papas',
                     detector=detector,
                     gen_particles='gen_particles_stable',
                     sim_particles='sim_particles',
                     merged_ecals='ecal_clusters',
                     merged_hcals='hcal_clusters',
                     tracks='tracks',
                     output_history='history_nodes',
                     display_filter_func=lambda ptc: ptc.e() > 1.,
                     display=False,
                     verbose=True)

# group the clusters, tracks from simulation into connected blocks ready for reconstruction
Example #2
0
            pass
        else:
            raise ValueError('implement drawing for projection ' + projection )


class GDetector(object):
    def __init__(self, description):
        self.desc = description
        elems = sorted(self.desc.elements.values(), key= lambda x : x.volume.outer.rad, reverse = True)
        self.elements = [GDetectorElement(elem) for elem in elems]
        #self.elements = [GDetectorElement(elem) for elem in self.desc.elements.values()]
            
    def draw(self, projection):
        for elem in self.elements:
            elem.draw(projection)


            
if __name__ == '__main__':

    from ROOT import TCanvas, TH2F
    from heppy.papas.detectors.CMS import CMS
    from heppy.display.core import Display

    cms = CMS()
    gcms = GDetector(cms)

    display = Display()
    display.register(gcms, 0)
    display.draw()