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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide 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.2: +20 -17 lines
v3r00 **NEW**

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

  ViewVC Help
Powered by ViewVC 1.1.23