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

Annotation of /PamelaLevel2/doc/examples/My-Selection-0.cpp

Parent Directory Parent Directory | Revision Log Revision Log


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

1 pam-fi 1.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     void Dump(AcLevel2* ac){
57    
58     cout << "status[0] :"<< hex << ac->status[0] <<endl;
59     cout << "status[1] :"<< hex << ac->status[1] <<endl;
60     cout << "hitmap[0] :"<< hex << ac->hitmap[0] <<endl;
61     cout << "hitmap[1] :"<< hex << ac->hitmap[1] <<endl;
62     cout << "hitstatus[0] :"<< hex << ac->hitstatus[0] <<endl;
63     cout << "hitstatus[1] :"<< hex << ac->hitstatus[1] <<endl;
64     cout << "trigger[0] :"<< hex << ac->trigger[0] <<endl;
65     cout << "trigger[1] :"<< hex << ac->trigger[1] <<endl;
66    
67     }
68     void Dump(ToFTrkVar* tof){
69    
70     cout << endl<< "n. tdc hits :"<<tof->npmttdc;
71     cout << endl<< "PMTs :";
72     for(Int_t ip=0; ip< tof->npmttdc; ip++)cout << " "<< tof->pmttdc[ip];
73     cout << endl<< "n. adc hits :"<<tof->npmtadc;
74     cout << endl<< "PMTs :";
75     for(Int_t ip=0; ip< tof->npmtadc; ip++)cout << " "<< tof->pmtadc[ip];
76     cout << endl<< "dedx :";
77     for(Int_t ib=0; ib< tof->npmtadc; ib++)cout << " "<< tof->dedx[ib];
78     cout << endl<< "beta :";
79     for(Int_t ib=0; ib<13 ; ib++)cout << " "<< tof->beta[ib];
80     cout << endl<< "xtofpos :";
81     for(Int_t ib=0; ib<3 ; ib++)cout << " "<< tof->xtofpos[ib];
82     cout << endl<< "ytofpos :";
83     for(Int_t ib=0; ib<3 ; ib++)cout << " "<<tof->ytofpos[ib];
84     cout << endl;
85     }
86    
87    
88     //===============================================================================
89     //
90     //
91     //
92     //
93     //===============================================================================
94     bool Select( PamLevel2* event ){
95    
96    
97     if(event->ntrk() ==0 )return false;
98    
99     // cout << event->nstrip << " "<<event->npmt() << " " << event->ntrk()<<endl;
100     // -----------------------------------------
101     // +++++++++++++++++++++++++++++++++++++++++
102     // CALORIMETER CUTS
103     // +++++++++++++++++++++++++++++++++++++++++
104     // -----------------------------------------
105    
106     // CaloAxis *x_axis = new CaloAxis();
107     // CaloAxis *y_axis = new CaloAxis();
108    
109     // if(event->nstrip<60){
110    
111     // // --------------------------------
112     // // evaluate track axis
113     // // --------------------------------
114     // float rcil = 1.;// tolerance (cm)
115     // if( !x_axis->FitAxis(event->GetCaloLevel1(),0,rcil) )return 0;
116     // if( !y_axis->FitAxis(event->GetCaloLevel1(),1,rcil) )return 0;
117    
118     // if(x_axis->GetN()<4 || y_axis->GetN()<4)return 0;
119    
120     // float qtrack = x_axis->GetQaxis()+y_axis->GetQaxis();
121     // int ntrack = x_axis->GetN()+y_axis->GetN();
122    
123     // float qstrip = qtrack/ntrack;
124    
125     // // --------------------------------
126     // // evaluate total energy release
127     // // --------------------------------
128     // float qtot = 0;
129     // int ntot = 0;
130     // qtot = event->qtot;
131     // ntot = event->nstrip;
132    
133    
134     // float nratio = 0;
135     // float qratio = 0;
136     // if(ntot>0){
137     // nratio = (float)ntrack/(float)ntot;
138     // qratio = qtrack/qtot;
139     // }
140    
141     // // cout << qtrack << " " << ntrack << " "<< qtot << " "<<ntot<<endl;
142     // if(qratio < 0.8)return false;
143    
144     // }else return false;
145    
146     // x_axis->Delete();
147     // y_axis->Delete();
148    
149     // -----------------------------------------
150     // +++++++++++++++++++++++++++++++++++++++++
151     // TOF CUTS
152     // +++++++++++++++++++++++++++++++++++++++++
153     // -----------------------------------------
154    
155     // ---------------------------
156     // one hit paddle on S1 and S2
157     // ---------------------------
158     // if(
159     // event->GetNHitPaddles(0) == 1 &&
160     // event->GetNHitPaddles(1) == 1 &&
161     // event->GetNHitPaddles(2) == 1 &&
162     // event->GetNHitPaddles(3) == 1 &&
163     // event->GetNHitPaddles(4) == 1 &&
164     // event->GetNHitPaddles(5) == 1 &&
165     // true
166     // ){;;;
167     // }else return false;
168    
169     // -----------------------------------------
170     // +++++++++++++++++++++++++++++++++++++++++
171     // AC CUTS
172     // +++++++++++++++++++++++++++++++++++++++++
173     // -----------------------------------------
174     // AcLevel2* ac = event->GetAcLevel2();
175    
176     // if( IsHit("CARD1-M",ac) || IsHit("CARD1-E",ac) )return false;
177     // if( IsHit("CARD2-M",ac) || IsHit("CARD2-E",ac) )return false;
178     // if( IsHit("CARD3-M",ac) || IsHit("CARD3-E",ac) )return false;
179     // if( IsHit("CARD4-M",ac) || IsHit("CARD4-E",ac) )return false;
180    
181     // if( IsHit("CAT1-M",ac) || IsHit("CAT1-E",ac) )return false;
182     // if( IsHit("CAT2-M",ac) || IsHit("CAT2-E",ac) )return false;
183     // if( IsHit("CAT3-M",ac) || IsHit("CAT3-E",ac) )return false;
184     // if( IsHit("CAT4-M",ac) || IsHit("CAT4-E",ac) )return false;
185    
186     // if( IsHit("CAS1-M",ac) || IsHit("CAS1-E",ac) )return false;
187     // if( IsHit("CAS2-M",ac) || IsHit("CAS2-E",ac) )return false;
188     // if( IsHit("CAS3-M",ac) || IsHit("CAS3-E",ac) )return false;
189     // if( IsHit("CAS4-M",ac) || IsHit("CAS4-E",ac) )return false;
190    
191     return true;
192    
193     }
194    
195    
196    
197    
198    
199    

  ViewVC Help
Powered by ViewVC 1.1.23