#include <stdlib.h>
#include <fstream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <assert.h>
#include <iostream>
#include "global_variables.h"
#include "LegsSelectorCosmics.h"
ClassImp(LegsSelectorCosmics)
//____________________________________________________________
// preliminary cuts are placed on two branches and then if decided not
// to read the event return false.  If want event - return true. This way
// not all events are read completely and therefore save time on slow
// disks. 
// $Log: LegsSelectorCosmics.cxx,v $
// Revision 1.1  2004/01/05 17:51:02  ardashev
// Initial revision
//
// Revision 1.20  2002/02/01 19:14:21  ardashev
// *** empty log message ***
//
// Revision 1.19  2001/11/01 15:11:23  ardashev
// *** empty log message ***
//
// Revision 1.18  2001/10/13 23:13:37  ardashev
// *** empty log message ***
//
// Revision 1.17  2001/09/18 23:10:10  ardashev
// *** empty log message ***
//


 LegsSelectorCosmics::LegsSelectorCosmics(Int_t add)
    : LegsSelector("SelectorCosmics", "select cosmics hits",add)
{
  Init();
  fDir->cd("../");
}  

 void LegsSelectorCosmics::Init()
{
  // user initialization, create histos  etc

//   cout << " LegsSelectorCosmics::Init() " << endl;
//   cout << " SETTING some branches status to NON-READ" << endl;
  
 

  
  it->fTree->SetBranchStatus("pcount",0);
  it->fTree->SetBranchStatus("pegy",0);
  it->fTree->SetBranchStatus("pr",0);
  it->fTree->SetBranchStatus("ptheta",0);
  it->fTree->SetBranchStatus("pphi",0);
  it->fTree->SetBranchStatus("ptof",0);
  it->fTree->SetBranchStatus("pdlgt",0);
  it->fTree->SetBranchStatus("pdegy",0);
  it->fTree->SetBranchStatus("pmom",0);
  it->fTree->SetBranchStatus("pid",0);
  it->fTree->SetBranchStatus("pnhits",0);  
  
  if(!GeantSimulation())
    {
      it->fTree->SetBranchStatus("lgt",0);                
      it->fTree->SetBranchStatus("tof",0);
      it->fTree->SetBranchStatus("clump",0);
      it->fTree->SetBranchStatus("tag_egy",0);
      it->fTree->SetBranchStatus("slr_count",0);
      it->fTree->SetBranchStatus("livslr",0);
      it->fTree->SetBranchStatus("rawslr",0);

      it->fTree->SetBranchStatus("mc_count",0);
      it->fTree->SetBranchStatus("mc_id",0);
      it->fTree->SetBranchStatus("mc_px",0);  
      it->fTree->SetBranchStatus("mc_py",0);  
      it->fTree->SetBranchStatus("mc_pz",0);
      it->fTree->SetBranchStatus("mc_egy",0);  
      it->fTree->SetBranchStatus("mc_true",0);  
      it->fTree->SetBranchStatus("mc_x",0);
      it->fTree->SetBranchStatus("mc_y",0);  
      it->fTree->SetBranchStatus("mc_z",0);  
      it->fTree->SetBranchStatus("mc_pol",0);  
      it->fTree->SetBranchStatus("mc_photegy",0);  
    }
  else
    {
      it->fTree->SetBranchStatus("clump",0);
      it->fTree->SetBranchStatus("st_count",0);
      it->fTree->SetBranchStatus("st_id",0);
      it->fTree->SetBranchStatus("st_tdc",0);
      it->fTree->SetBranchStatus("reg_io",0);
      it->fTree->SetBranchStatus("slr_count",0);
      it->fTree->SetBranchStatus("livslr",0);
      it->fTree->SetBranchStatus("rawslr",0);
    }
  cout << "FINISHED SETTING some branches status to NON-READ " << endl;
}

 bool LegsSelectorCosmics::Make()
{
  // here user may specify preliminary cuts on active branches, specified above in Init()
  // if cut is satisfied return true and the whole event will be read in.
  if(it->IsDetOff() == true) return true;
  //  fBranch = it->fTree->GetBranch("fera_reg");
  // assert(fBranch!=NULL);
  //  fNbytes = fBranch->GetEntry(fReadEntry);
  
  //  if( !GeantSimulation() && ((it->GetFeraReg() & (Int_t)4) != (Int_t)4)) return false; // event36 only
  //  if( !GeantSimulation() && ((it->GetFeraReg() & (Int_t)1) != (Int_t)1)) return false; // event32 only
//   fBranch = it->fTree->GetBranch("slr_count");
//   assert(fBranch!=NULL);
//   fNbytes = fBranch->GetEntry(fReadEntry);

  //  fBranchCount = it->fTree->GetBranch("slr_count");
  
  //if(it->GetSlrCount() > 0) return false; // don't take scalar events
  // if( it->GetTagCount() == 0) return false;  
 //    if(it->rpn_count < 1   ||(it->rxt_count + it->rxc_count )  < 1) return false; // X eff
  //  if(it->rxt_count + it->rxc_count  + it->rpb_count < 2) return false; // piZero in XTC PB
  
  if(it->rxt_count < 7 || it->rxc_count   < 2) return false;
  //    if(it->rpn_count == 0 ||  it->rpv_count ==  0  ) return false;
 

//   //   if(it->GetCount() < 2) return false;   //  CUTS HERE !!!!!!!!!!
  
//    if(GeantSimulation()) 
//      {
// //        fBranch  = it->fTree->GetBranch("mc_photegy");
// //        //        static TBranch*  branch;  branch  = it->fTree->GetBranch("mc_count");
// //        assert(fBranch!=NULL);
// //        fNbytes = fBranch->GetEntry(fReadEntry);
// //        //       branch  = it->fTree->GetBranch("mc_egy");
// //        //        fNbytes = branch->GetEntry(fReadEntry);
// //        //       branch  = it->fTree->GetBranch("mc_photegy");
// //        //       fNbytes = branch->GetEntry(fReadEntry);
// //        //       // CUTS HERE
       
// //        //       //   if(it->GetMcCount() ==1 && it->GetMcEgy(0) > 95 && it->GetMcEgy(0) < 125) return true;
// //        //       //      if(it->GetMcPhotEgy() < 235 ||it->GetMcPhotEgy() > 405) return false;
// //        if(it->GetMcPhotEgy() < 298.8 ||it->GetMcPhotEgy() > 301.1) return false;
//      }
//    else
//      {
//        fBranch  = it->fTree->GetBranch("tag_count");
//    assert(fBranch!=NULL);
//    fNbytes = fBranch->GetEntry(fReadEntry);
//    if(it->GetTagCount() <= 0) return false;
//    fBranch  = it->fTree->GetBranch("tag_id");
//    assert(fBranch!=NULL);
//    fNbytes = fBranch->GetEntry(fReadEntry);
   
//    if(it->GetTagIDdirect(0) != 36) return false;
//      }
   //return false;
  
  //  if(it->IsCG3())
  // return true;
  // if(it->IsPn())
  // return true;
  //  if(it->AreTwoNeutralsInXT()) return true;// face is needed	
  // if(it->IsXt(2) || it->IsXc(2) || (it->IsXt(1) && it->IsXc(1))) // require XT or XC hit 
  //  return true;
  

//    // if you want to place cut on XV you need to read in adc1
//   fBranchDet      = it->fTree->GetBranch("adc1");
//   assert(fBranchDet!=NULL);
//   fNbytes = fBranchDet->GetEntry(fReadEntry);
//   if(it->IsXv(1,0.8)) return false;
 
//   return true;     
//      if((it->rxt_count > 0 && it->rxc_count > 0) ||
// 	(it->rxt_count == 0 && it->rxc_count > 1) ||
// 	(it->rxt_count > 1 && it->rxc_count == 0))
//      {
//        // 2 blocks in XT or XC hit
//        return true;
//      }
//  if(it->rpf_count > 0  && it->rpn_count > 0)
  //   {
      //       // PN  and PF  hit
  //  return true;
  //  }

//   if(it->rpv_count > 0  && it->rpn_count > 0 &&    (it->rxt_count > 0 || it->rxc_count > 0) )
//     {
//       // PN and   PV and one block in XTC  hit
//       return true;
//     }
  
//    if(it->rpv_count > 0  && it->rpn_count > 0 &&
//       ((it->rxt_count > 0 && it->rxc_count > 0) ||
//        (it->rxt_count == 0 && it->rxc_count > 1) ||
//        (it->rxt_count > 1 && it->rxc_count == 0)))
//    {
//      // PN  and 2 blocks in XTC   hit
//      return true;
//    }
      
  return true;
} 



 void LegsSelectorCosmics::RunEnd()
{
  ;
}



ROOT page - Home page - Class index - Class Hierarchy - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.