/[PAMELA software]/PamelaLevel2/doc/examples/My-Selection.cpp
ViewVC logotype

Contents of /PamelaLevel2/doc/examples/My-Selection.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Wed Jan 3 13:28:49 2007 UTC (17 years, 11 months ago) by pam-fi
Branch: MAIN
CVS Tags: v0r02, v2r02
Changes since 1.1: +51 -100 lines
new example with selection cuts

1 #if !defined(__CINT__) || defined(__MAKECINT__)
2
3
4 #include <TString.h>
5 #include <TH1F.h>
6 #include <TH2F.h>
7 #include <TMath.h>
8 #include <TLine.h>
9 #include <TPolyMarker.h>
10 #include <TSelector.h>
11 #include <TFile.h>
12
13 #include <stdlib.h>
14 #include <iostream>
15 using namespace std;
16
17 #include <PamLevel2.h>
18 #include <CaloAxis.h>
19
20 #endif
21
22
23 //===============================================================================
24 //
25 //
26 //
27 //
28 //===============================================================================
29 Bool_t IsHit(TString what , AcLevel2* ac){
30
31 char* cabl[] = {"CARD4","CAT2","CAS1","ND","CARD2","CAT4","CAS4","ND",
32 "CARD3","CAT3","CAS3","ND","CARD1","CAT1","CAS2","ND"};
33
34 Bool_t answer = kFALSE;
35 for(Int_t ibit=0; ibit<16; ibit++){
36 if( what.Contains( cabl[ibit], TString::kIgnoreCase ) ){
37 if( what.Contains( "M" , TString::kIgnoreCase ) )
38 answer = (Bool_t)((ac->hitmap[0]>>ibit)&1) & (Bool_t)((ac->hitstatus[0]>>ibit)&1);
39 else if( what.Contains( "E" , TString::kIgnoreCase ) )
40 answer = (Bool_t)((ac->hitmap[1]>>ibit)&1) & (Bool_t)((ac->hitstatus[1]>>ibit)&1);
41 else cout << " M-ain or E-xtra not indicated" << endl;
42 return answer;
43 };
44 };
45 cout << " wrong input "<< what << endl;
46 return answer;
47
48 }
49
50 //===============================================================================
51 //
52 //
53 //
54 //
55 //===============================================================================
56 bool Select( PamLevel2* event ){
57
58 // -----------------------------------------
59 // +++++++++++++++++++++++++++++++++++++++++
60 // GENERAL SELECTION CUTS
61 // +++++++++++++++++++++++++++++++++++++++++
62 // -----------------------------------------
63
64 // ------------
65 // single track
66 // ------------
67 if( event->GetNTracks()!=1 ) return false;
68
69 // ------------
70 // calorimeter
71 // ------------
72
73 // ---------------------------
74 // one hit paddle on S1 S2 S3
75 // no single-PMT hits
76 // ---------------------------
77 if(
78 event->GetNHitPaddles(0) == 1 &&
79 event->GetNHitPaddles(1) == 1 &&
80 event->GetNHitPaddles(2) == 1 &&
81 event->GetNHitPaddles(3) == 1 &&
82 event->GetNHitPaddles(4) == 1 &&
83 event->GetNHitPaddles(5) == 1 &&
84 event->npmt() == 12 &&
85 true
86 ){;;;
87 }else return false;
88
89 // ----------------------------------------------
90 // no activity either in main and spare AC boards
91 // ----------------------------------------------
92 AcLevel2* ac = event->GetAcLevel2();
93 if( IsHit("CARD1-M",ac) || IsHit("CARD1-E",ac) )return false;
94 if( IsHit("CARD2-M",ac) || IsHit("CARD2-E",ac) )return false;
95 if( IsHit("CARD3-M",ac) || IsHit("CARD3-E",ac) )return false;
96 if( IsHit("CARD4-M",ac) || IsHit("CARD4-E",ac) )return false;
97
98 if( IsHit("CAT1-M",ac) || IsHit("CAT1-E",ac) )return false;
99 if( IsHit("CAT2-M",ac) || IsHit("CAT2-E",ac) )return false;
100 if( IsHit("CAT3-M",ac) || IsHit("CAT3-E",ac) )return false;
101 if( IsHit("CAT4-M",ac) || IsHit("CAT4-E",ac) )return false;
102
103 if( IsHit("CAS1-M",ac) || IsHit("CAS1-E",ac) )return false;
104 if( IsHit("CAS2-M",ac) || IsHit("CAS2-E",ac) )return false;
105 if( IsHit("CAS3-M",ac) || IsHit("CAS3-E",ac) )return false;
106 if( IsHit("CAS4-M",ac) || IsHit("CAS4-E",ac) )return false;
107
108
109 // -----------------------------------------
110 // +++++++++++++++++++++++++++++++++++++++++
111 // TRACK SELECTION CUTS
112 // +++++++++++++++++++++++++++++++++++++++++
113 // -----------------------------------------
114
115 // -------------------
116 // tracker:
117 // - good fit
118 // - nx>=4 ny>=3
119 // - 5-plane lever-arm
120 // tof:
121 // - beta>0
122 // calorimeter:
123 // - non interacting
124 // -------------------
125 PamTrack *track = event->GetTrack(0);
126 bool TRACK__OK = false;
127 if(
128 track->chi2 >0 &&
129 track->GetNX()>=4 &&
130 track->GetNY()>=3 &&
131 ((track->XGood(0) && track->XGood(5)) || (track->XGood(0) && track->XGood(4)) || (track->XGood(1) && track->XGood(5)) ) &&
132 track->beta[12]>0 &&
133 true
134 ){
135
136 if(event->qtot>0){
137 if(track->qtrack/event->qtot <0.8)TRACK__OK = false;
138 }
139
140 TRACK__OK = true;
141 };
142 delete track;
143
144 if(!TRACK__OK)return false;
145
146 return true;
147
148 }

  ViewVC Help
Powered by ViewVC 1.1.23