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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Mon Jan 15 11:51:39 2007 UTC (17 years, 10 months ago) by pam-fi
Branch: MAIN
CVS Tags: v5r00, v3r03, v4r00, v10RED, v6r00, v9r00, HEAD
Changes since 1.1: +74 -67 lines
v3r00 **NEW**

1 //////////////////////////////////////////////////////////
2 // Selection of events with non-interacting pattern
3 // in the calorimeter.
4 // The selection is independent from the track variables
5 // (for tracker-efficiency studies)
6 //////////////////////////////////////////////////////////
7
8 #if !defined(__CINT__) || defined(__MAKECINT__)
9
10
11 #include <TString.h>
12 #include <TH1F.h>
13 #include <TH2F.h>
14 #include <TMath.h>
15 #include <TLine.h>
16 #include <TPolyMarker.h>
17 #include <TSelector.h>
18 #include <TFile.h>
19
20 #include <stdlib.h>
21 #include <iostream>
22 using namespace std;
23
24 #include <PamLevel2.h>
25 #include <CaloAxis.h>
26
27 #endif
28
29
30 //===============================================================================
31 //
32 //
33 //
34 //
35 //===============================================================================
36 Bool_t IsHit(TString what , AcLevel2* ac){
37
38 char* cabl[] = {"CARD4","CAT2","CAS1","ND","CARD2","CAT4","CAS4","ND",
39 "CARD3","CAT3","CAS3","ND","CARD1","CAT1","CAS2","ND"};
40
41 Bool_t answer = kFALSE;
42 for(Int_t ibit=0; ibit<16; ibit++){
43 if( what.Contains( cabl[ibit], TString::kIgnoreCase ) ){
44 if( what.Contains( "M" , TString::kIgnoreCase ) )
45 answer = (Bool_t)((ac->hitmap[0]>>ibit)&1) & (Bool_t)((ac->hitstatus[0]>>ibit)&1);
46 else if( what.Contains( "E" , TString::kIgnoreCase ) )
47 answer = (Bool_t)((ac->hitmap[1]>>ibit)&1) & (Bool_t)((ac->hitstatus[1]>>ibit)&1);
48 else cout << " M-ain or E-xtra not indicated" << endl;
49 return answer;
50 };
51 };
52 cout << " wrong input "<< what << endl;
53 return answer;
54
55 }
56
57 //===============================================================================
58 //
59 //
60 //
61 //
62 //===============================================================================
63 void Dump(AcLevel2* ac){
64
65 cout << "status[0] :"<< hex << ac->status[0] <<endl;
66 cout << "status[1] :"<< hex << ac->status[1] <<endl;
67 cout << "hitmap[0] :"<< hex << ac->hitmap[0] <<endl;
68 cout << "hitmap[1] :"<< hex << ac->hitmap[1] <<endl;
69 cout << "hitstatus[0] :"<< hex << ac->hitstatus[0] <<endl;
70 cout << "hitstatus[1] :"<< hex << ac->hitstatus[1] <<endl;
71 cout << "trigger[0] :"<< hex << ac->trigger[0] <<endl;
72 cout << "trigger[1] :"<< hex << ac->trigger[1] <<endl;
73
74 }
75 void Dump(ToFTrkVar* tof){
76
77 cout << endl<< "n. tdc hits :"<<tof->npmttdc;
78 cout << endl<< "PMTs :";
79 for(Int_t ip=0; ip< tof->npmttdc; ip++)cout << " "<< tof->pmttdc[ip];
80 cout << endl<< "n. adc hits :"<<tof->npmtadc;
81 cout << endl<< "PMTs :";
82 for(Int_t ip=0; ip< tof->npmtadc; ip++)cout << " "<< tof->pmtadc[ip];
83 cout << endl<< "dedx :";
84 for(Int_t ib=0; ib< tof->npmtadc; ib++)cout << " "<< tof->dedx[ib];
85 cout << endl<< "beta :";
86 for(Int_t ib=0; ib<13 ; ib++)cout << " "<< tof->beta[ib];
87 cout << endl<< "xtofpos :";
88 for(Int_t ib=0; ib<3 ; ib++)cout << " "<< tof->xtofpos[ib];
89 cout << endl<< "ytofpos :";
90 for(Int_t ib=0; ib<3 ; ib++)cout << " "<<tof->ytofpos[ib];
91 cout << endl;
92 }
93
94
95 //===============================================================================
96 //
97 //
98 //
99 //
100 //===============================================================================
101 bool Select( PamLevel2* event ){
102
103
104 if(event->GetTrkLevel2()->ntrk() ==0 )return false;
105
106 // cout << event->GetCaloLevel2()->nstrip << " "<<event->GetToFLevel2()->npmt() << " " << event->GetTrkLevel2()->ntrk()<<endl;
107 // -----------------------------------------
108 // +++++++++++++++++++++++++++++++++++++++++
109 // CALORIMETER CUTS
110 // +++++++++++++++++++++++++++++++++++++++++
111 // -----------------------------------------
112
113 CaloAxis *x_axis = new CaloAxis();
114 CaloAxis *y_axis = new CaloAxis();
115
116 if(event->GetCaloLevel2()->nstrip<60){
117
118 // --------------------------------
119 // evaluate track axis
120 // --------------------------------
121 float rcil = 1.;// tolerance (cm)
122 if( !x_axis->FitAxis(event->GetCaloLevel1(),0,rcil) )return 0;
123 if( !y_axis->FitAxis(event->GetCaloLevel1(),1,rcil) )return 0;
124
125 if(x_axis->GetN()<4 || y_axis->GetN()<4)return 0;
126
127 float qtrack = x_axis->GetQaxis()+y_axis->GetQaxis();
128 int ntrack = x_axis->GetN()+y_axis->GetN();
129
130 float qstrip = qtrack/ntrack;
131
132 // --------------------------------
133 // evaluate total energy release
134 // --------------------------------
135 float qtot = 0;
136 int ntot = 0;
137 qtot = event->GetCaloLevel2()->qtot;
138 ntot = event->GetCaloLevel2()->nstrip;
139
140
141 float nratio = 0;
142 float qratio = 0;
143 if(ntot>0){
144 nratio = (float)ntrack/(float)ntot;
145 qratio = qtrack/qtot;
146 }
147
148 // cout << qtrack << " " << ntrack << " "<< qtot << " "<<ntot<<endl;
149 if(qratio < 0.8)return false;
150
151 }else return false;
152
153 x_axis->Delete();
154 y_axis->Delete();
155
156 // -----------------------------------------
157 // +++++++++++++++++++++++++++++++++++++++++
158 // TOF CUTS
159 // +++++++++++++++++++++++++++++++++++++++++
160 // -----------------------------------------
161
162 // ---------------------------
163 // one hit paddle on S1 and S2
164 // ---------------------------
165 if(
166 event->GetToFLevel2()->GetNHitPaddles(0) == 1 &&
167 event->GetToFLevel2()->GetNHitPaddles(1) == 1 &&
168 event->GetToFLevel2()->GetNHitPaddles(2) == 1 &&
169 event->GetToFLevel2()->GetNHitPaddles(3) == 1 &&
170 event->GetToFLevel2()->GetNHitPaddles(4) == 1 &&
171 event->GetToFLevel2()->GetNHitPaddles(5) == 1 &&
172 true
173 ){;;;
174 }else return false;
175
176 // -----------------------------------------
177 // +++++++++++++++++++++++++++++++++++++++++
178 // AC CUTS
179 // +++++++++++++++++++++++++++++++++++++++++
180 // -----------------------------------------
181 AcLevel2* ac = event->GetAcLevel2();
182
183 if( IsHit("CARD1-M",ac) || IsHit("CARD1-E",ac) )return false;
184 if( IsHit("CARD2-M",ac) || IsHit("CARD2-E",ac) )return false;
185 if( IsHit("CARD3-M",ac) || IsHit("CARD3-E",ac) )return false;
186 if( IsHit("CARD4-M",ac) || IsHit("CARD4-E",ac) )return false;
187
188 if( IsHit("CAT1-M",ac) || IsHit("CAT1-E",ac) )return false;
189 if( IsHit("CAT2-M",ac) || IsHit("CAT2-E",ac) )return false;
190 if( IsHit("CAT3-M",ac) || IsHit("CAT3-E",ac) )return false;
191 if( IsHit("CAT4-M",ac) || IsHit("CAT4-E",ac) )return false;
192
193 if( IsHit("CAS1-M",ac) || IsHit("CAS1-E",ac) )return false;
194 if( IsHit("CAS2-M",ac) || IsHit("CAS2-E",ac) )return false;
195 if( IsHit("CAS3-M",ac) || IsHit("CAS3-E",ac) )return false;
196 if( IsHit("CAS4-M",ac) || IsHit("CAS4-E",ac) )return false;
197
198 return true;
199
200 }
201
202
203
204
205
206

  ViewVC Help
Powered by ViewVC 1.1.23