示例#1
0
def analysis(input):
    """Analysis method"""
    
    # Add the input files to the ROOT chain
    chain = ROOT.TChain("CollectionTree")     
    for inputFile in input["input"]:
        chain.AddFile(inputFile)
    
    # Select all branches
    chain.SetBranchStatus("*", 1)
    
    # Intitialize histogramService
    histoSrv = HistogramService()
    
    # Create Histogram branches
    histoCalo = histoSrv.branch("Calorimeters")
    histoPixel = histoSrv.branch("Pixel detector")
    histoTRT = histoSrv.branch("TRT detector")
    histoTruth = histoSrv.branch("Truth information")
    # Initialize tools
    calo = Calo(chain, histoCalo)
    pixel = Pixel(chain, histoPixel)
    trt = TRT(chain, histoTRT)

    smpEvent = SMPEvent(chain, histoTruth)
    
    ## event loop    
    N_evts = 10000
    if chain.GetEntries() < N_evts:
        N_evts = chain.GetEntries()
    for i in xrange(N_evts):
        chain.GetEntry(i)
        smpEvent.GetEntry()
        
        ## Cuts
        # if chain.PassedL1_MU40 == 0: continue
        
        # Loop over tracks
        for trk in xrange(chain.Trk_N):
            
            # Track cuts for High_pT analysis
            if chain.Trk_p_T[trk] > 40000 and chain.Trk_eta[trk] < 1.7:
                calo.dedxLAr(trk)
                calo.dedxTile(trk)
                calo.alldedx(trk)
                pixel.dedx(trk)
                
                trt.betastuff(trk)
                trt.dedx_bit(trk)
               
            # Low pT plots 
            elif chain.Trk_p_T[trk] <= 10000:
                calo.lowdedx(trk)
    
    
    
    # Return histogram service for merging
    return histoSrv.returnTree()