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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by pam-fi, Mon Dec 11 18:26:55 2006 UTC revision 1.3 by pam-fi, Mon Jan 15 11:51:39 2007 UTC
# Line 1  Line 1 
1    //////////////////////////////////////////////////////////
2    // Selection of events with single good tracks
3    // (good fit, no albedo) with non-interacting pattern
4    // in the calorimeter.
5    //////////////////////////////////////////////////////////
6  #if !defined(__CINT__) || defined(__MAKECINT__)  #if !defined(__CINT__) || defined(__MAKECINT__)
7    
   
8  #include <TString.h>  #include <TString.h>
9  #include <TH1F.h>  #include <TH1F.h>
10  #include <TH2F.h>  #include <TH2F.h>
# Line 53  Bool_t IsHit(TString what , AcLevel2* ac Line 57  Bool_t IsHit(TString what , AcLevel2* ac
57  //  //
58  //  //
59  //===============================================================================  //===============================================================================
 void Dump(AcLevel2* ac){  
   
     cout << "status[0]  :"<< hex << ac->status[0] <<endl;  
     cout << "status[1]  :"<< hex << ac->status[1] <<endl;  
     cout << "hitmap[0]  :"<< hex << ac->hitmap[0] <<endl;  
     cout << "hitmap[1]  :"<< hex << ac->hitmap[1] <<endl;  
     cout << "hitstatus[0]  :"<< hex << ac->hitstatus[0] <<endl;  
     cout << "hitstatus[1]  :"<< hex << ac->hitstatus[1] <<endl;  
     cout << "trigger[0]  :"<< hex << ac->trigger[0] <<endl;  
     cout << "trigger[1]  :"<< hex << ac->trigger[1] <<endl;  
   
 }  
 void Dump(ToFTrkVar* tof){  
   
     cout << endl<< "n. tdc hits :"<<tof->npmttdc;  
     cout << endl<< "PMTs        :";  
     for(Int_t ip=0; ip< tof->npmttdc; ip++)cout << " "<< tof->pmttdc[ip];  
     cout << endl<< "n. adc hits :"<<tof->npmtadc;  
     cout << endl<< "PMTs        :";  
     for(Int_t ip=0; ip< tof->npmtadc; ip++)cout << " "<< tof->pmtadc[ip];  
     cout << endl<< "dedx        :";  
     for(Int_t ib=0; ib< tof->npmtadc; ib++)cout << " "<< tof->dedx[ib];  
     cout << endl<< "beta        :";  
     for(Int_t ib=0; ib<13 ; ib++)cout << " "<< tof->beta[ib];  
     cout << endl<< "xtofpos     :";  
     for(Int_t ib=0; ib<3 ; ib++)cout << " "<< tof->xtofpos[ib];  
     cout << endl<< "ytofpos     :";  
     for(Int_t ib=0; ib<3 ; ib++)cout << " "<<tof->ytofpos[ib];  
     cout << endl;  
 }  
   
   
 //===============================================================================  
 //  
 //  
 //  
 //  
 //===============================================================================  
60  bool Select( PamLevel2* event ){  bool Select( PamLevel2* event ){
61    
   
 //  cout << event->nstrip << " "<<event->npmt() << " " << event->ntrk()<<endl;  
62  //  -----------------------------------------  //  -----------------------------------------
63  //  +++++++++++++++++++++++++++++++++++++++++  //  +++++++++++++++++++++++++++++++++++++++++
64  //              CALORIMETER CUTS  //  GENERAL SELECTION CUTS
65  //  +++++++++++++++++++++++++++++++++++++++++  //  +++++++++++++++++++++++++++++++++++++++++
66  //  -----------------------------------------  //  -----------------------------------------
       
     CaloAxis *x_axis = new CaloAxis();  
     CaloAxis *y_axis = new CaloAxis();  
   
     if(event->nstrip<60){  
   
         // --------------------------------  
         // evaluate track axis  
         // --------------------------------  
         float rcil = 1.;// tolerance (cm)  
         if( !x_axis->FitAxis(event->GetCaloLevel1(),0,rcil) )return 0;  
         if( !y_axis->FitAxis(event->GetCaloLevel1(),1,rcil) )return 0;  
   
         if(x_axis->GetN()<4 || y_axis->GetN()<4)return 0;  
   
         float qtrack = x_axis->GetQaxis()+y_axis->GetQaxis();  
         int   ntrack = x_axis->GetN()+y_axis->GetN();  
   
         float qstrip = qtrack/ntrack;  
   
         // --------------------------------  
         // evaluate total energy release  
         // --------------------------------  
         float qtot   = 0;  
         int   ntot   = 0;  
         qtot = event->qtot;  
         ntot = event->nstrip;  
   
   
         float nratio = 0;  
         float qratio = 0;  
         if(ntot>0){  
             nratio = (float)ntrack/(float)ntot;  
             qratio = qtrack/qtot;  
         }  
   
 //      cout << qtrack << " " << ntrack << " "<< qtot << " "<<ntot<<endl;  
         if(qratio < 0.8)return false;  
           
     }else return false;  
   
     x_axis->Delete();  
     y_axis->Delete();  
67    
68  //  -----------------------------------------      //  ------------
69  //  +++++++++++++++++++++++++++++++++++++++++      //  single track
70  //                  TOF CUTS      //  ------------
71  //  +++++++++++++++++++++++++++++++++++++++++      if( event->GetTrkLevel2()->GetNTracks()!=1 ) return false;
 //  -----------------------------------------  
72    
73        //  ------------
74        //  calorimeter
75        //  ------------
76        
77      //  ---------------------------      //  ---------------------------
78      //  one hit paddle on S1 and S2      //  one hit paddle on S1 S2 S3
79        //  no single-PMT hits
80      //  ---------------------------      //  ---------------------------
81      if(      if(
82          event->GetNHitPaddles(0) == 1 &&          event->GetToFLevel2()->GetNHitPaddles(0) == 1 &&
83          event->GetNHitPaddles(1) == 1 &&          event->GetToFLevel2()->GetNHitPaddles(1) == 1 &&
84          event->GetNHitPaddles(2) == 1 &&          event->GetToFLevel2()->GetNHitPaddles(2) == 1 &&
85          event->GetNHitPaddles(3) == 1 &&          event->GetToFLevel2()->GetNHitPaddles(3) == 1 &&
86          event->GetNHitPaddles(4) == 1 &&          event->GetToFLevel2()->GetNHitPaddles(4) == 1 &&
87          event->GetNHitPaddles(5) == 1 &&          event->GetToFLevel2()->GetNHitPaddles(5) == 1 &&
88            event->GetToFLevel2()->npmt() == 12           &&
89          true          true
90          ){;;;          ){;;;
91      }else return false;      }else return false;
92    
93  //  -----------------------------------------      //  ----------------------------------------------
94  //  +++++++++++++++++++++++++++++++++++++++++      //  no activity either in main and spare AC boards
95  //                  AC CUTS      //  ----------------------------------------------
 //  +++++++++++++++++++++++++++++++++++++++++  
 //  -----------------------------------------  
96      AcLevel2* ac = event->GetAcLevel2();      AcLevel2* ac = event->GetAcLevel2();
   
97      if( IsHit("CARD1-M",ac) || IsHit("CARD1-E",ac) )return false;      if( IsHit("CARD1-M",ac) || IsHit("CARD1-E",ac) )return false;
98      if( IsHit("CARD2-M",ac) || IsHit("CARD2-E",ac) )return false;      if( IsHit("CARD2-M",ac) || IsHit("CARD2-E",ac) )return false;
99      if( IsHit("CARD3-M",ac) || IsHit("CARD3-E",ac) )return false;      if( IsHit("CARD3-M",ac) || IsHit("CARD3-E",ac) )return false;
# Line 185  bool Select( PamLevel2* event ){ Line 108  bool Select( PamLevel2* event ){
108      if( IsHit("CAS2-M",ac) || IsHit("CAS2-E",ac) )return false;      if( IsHit("CAS2-M",ac) || IsHit("CAS2-E",ac) )return false;
109      if( IsHit("CAS3-M",ac) || IsHit("CAS3-E",ac) )return false;      if( IsHit("CAS3-M",ac) || IsHit("CAS3-E",ac) )return false;
110      if( IsHit("CAS4-M",ac) || IsHit("CAS4-E",ac) )return false;      if( IsHit("CAS4-M",ac) || IsHit("CAS4-E",ac) )return false;
       
     return true;  
   
 }  
111    
112    
113    //  -----------------------------------------
114    //  +++++++++++++++++++++++++++++++++++++++++
115    //  TRACK SELECTION CUTS
116    //  +++++++++++++++++++++++++++++++++++++++++
117    //  -----------------------------------------
118    
119        //  -------------------
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            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            true
138            ){
139            
140            if(event->GetCaloLevel2()->qtot>0){
141                if(track->GetCaloTrack()->qtrack/event->GetCaloLevel2()->qtot <0.8)TRACK__OK = false;
142            }
143    
144            TRACK__OK = true;
145        };
146    
147        if(!TRACK__OK)return false;
148        
149        return true;
150    
151    }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.23