{ ULong_t event_id = 0; UInt_t channel = 0; UInt_t module = 0; UInt_t plane = 0; Int_t thresh = 0; Int_t ctc = 0; Long64_t nEvent = 0; Long64_t i = 0; Int_t j = 0; Int_t k = 0; Int_t mask[2304]; const Int_t MOD = 384; const Int_t PLN = 192; TFile *f = new TFile("out.root"); TTree *pct = (TTree*) f.Get("pct"); TFile *froot = new TFile("out2.root","RECREATE"); TTree *pickct = new TTree("pct", "filtered pct events"); TBranch* br = pct.GetBranch("event_id"); TBranch* br1 = pct.GetBranch("channel"); TBranch* br2 = pct.GetBranch("module"); TBranch* br3 = pct.GetBranch("plane"); br.SetAddress( &event_id ); br1.SetAddress( &channel ); br2.SetAddress( &module ); br3.SetAddress( &plane ); pickct->Branch("event_id" , &event_id, "event_id/i"); pickct->Branch("channel" , &channel , "channel/i"); pickct->Branch("module" , &module , "module/i"); pickct->Branch("plane" , &plane , "plane/i"); for( j = 0; j < 1920; j++ ) // 5 modules / 10 planes mask[j] = 1; mask[ (2 * MOD) + (0 * PLN) + 43 ] = 0; mask[ (2 * MOD) + (0 * PLN) + 44 ] = 0; mask[ (2 * MOD) + (0 * PLN) + 45 ] = 0; mask[ (2 * MOD) + (0 * PLN) + 107 ] = 0; mask[ (2 * MOD) + (1 * PLN) + 24 ] = 0; mask[ (2 * MOD) + (1 * PLN) + 25 ] = 0; mask[ (2 * MOD) + (1 * PLN) + 26 ] = 0; mask[ (2 * MOD) + (1 * PLN) + 27 ] = 0; mask[ (2 * MOD) + (1 * PLN) + 28 ] = 0; mask[ (3 * MOD) + (0 * PLN) + 62 ] = 0; mask[ (3 * MOD) + (0 * PLN) + 63 ] = 0; mask[ (3 * MOD) + (0 * PLN) + 64 ] = 0; mask[ (3 * MOD) + (0 * PLN) + 65 ] = 0; mask[ (3 * MOD) + (0 * PLN) + 66 ] = 0; mask[ (3 * MOD) + (0 * PLN) + 67 ] = 0; mask[ (3 * MOD) + (0 * PLN) + 68 ] = 0; mask[ (3 * MOD) + (0 * PLN) + 69 ] = 0; mask[ (4 * MOD) + (0 * PLN) + 18 ] = 0; mask[ (4 * MOD) + (0 * PLN) + 20 ] = 0; mask[ (4 * MOD) + (1 * PLN) + 2 ] = 0; mask[ (4 * MOD) + (1 * PLN) + 4 ] = 0; nEvent = (unsigned long) pct.GetEntries(); for( i = 0; i < nEvent; ++i ) { br.GetEntry(i); br1.GetEntry(i); br2.GetEntry(i); br3.GetEntry(i); j = (module * MOD) + (plane * PLN) + channel; if( mask[ j ] ) pickct->Fill(); } froot->Write(); }