/[PAMELA software]/PamCut/TofCuts/TofPatternCut/TofPatternCut.cpp
ViewVC logotype

Diff of /PamCut/TofCuts/TofPatternCut/TofPatternCut.cpp

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

revision 1.1 by pam-fi, Wed May 27 13:30:09 2009 UTC revision 1.2 by pam-fi, Thu Mar 18 14:44:11 2010 UTC
# Line 25  int TofPatternCut::Check(PamLevel2 *even Line 25  int TofPatternCut::Check(PamLevel2 *even
25    if (!tof)    if (!tof)
26      return (0);      return (0);
27    
 #ifdef DEBUGPAMCUT  
     cout << ">>> TofPatternCut CHECK <<<" << endl;  
 #endif  
   
28    bool TOF__OK = false;    bool TOF__OK = false;
29    
 #ifdef DEBUGPAMCUT  
     cout << "Check topology:" << endl;  
     for (int ip = 0; ip < 6; ip++)  
       cout << "plane " << ip << " n.hit paddles " << tofl2->GetNHitPaddles(ip) << endl;  
     for (int ip = 0; ip < 6; ip++)  
       cout << "plane " << ip << " n.hit PMTs outside track " << GetNHitPMTsOutsideTrack(event, ip) << endl;  
 #endif  
   
   // -----------------------------------------  
   // at least one hit paddle on both S1 and S2  
   // -----------------------------------------  
30    if (    if (
31    //-----------------------------------        //-----------------------------------
32    // not more than 1 paddle per layer        // (1) no more than 1 paddle on S11, S12, S21, S22
33    //-----------------------------------        //-----------------------------------
34    tofl2 && tofl2->GetNHitPaddles(0) <= 1 && //S11        tofl2 && tofl2->GetNHitPaddles(0) <= 1 && //S11
35        tofl2->GetNHitPaddles(1) <= 1 && //S12        tofl2->GetNHitPaddles(1) <= 1 && //S12
36        tofl2->GetNHitPaddles(2) <= 1 && //S21        tofl2->GetNHitPaddles(2) <= 1 && //S21
37        tofl2->GetNHitPaddles(3) <= 1 && //S22        tofl2->GetNHitPaddles(3) <= 1 && //S22
38        //        tofl2->GetNHitPaddles(4) <= 1 && //S31        //        tofl2->GetNHitPaddles(4) <= 1 && //S31
39        //        tofl2->GetNHitPaddles(5) <= 1 && //S32        //        tofl2->GetNHitPaddles(5) <= 1 && //S32
40        //-----------------------------------        //-----------------------------------
41        // at least 1 paddle per plane        // (2) at least 1 hit paddle on S1, S2
42        //-----------------------------------        //-----------------------------------
43        (tofl2->GetNHitPaddles(0) == 1 || tofl2->GetNHitPaddles(1) == 1) && //S1        (tofl2->GetNHitPaddles(0) == 1 || tofl2->GetNHitPaddles(1) == 1) && //S1
44        (tofl2->GetNHitPaddles(2) == 1 || tofl2->GetNHitPaddles(3) == 1) && //S2        (tofl2->GetNHitPaddles(2) == 1 || tofl2->GetNHitPaddles(3) == 1) && //S2
45        //        (tofl2->GetNHitPaddles(4)==1 || tofl2->GetNHitPaddles(5)==1) && //S3        //        (tofl2->GetNHitPaddles(4)==1 || tofl2->GetNHitPaddles(5)==1) && //S3
46        //-----------------------------------        //-----------------------------------
47        // n.hit pmts outside track        // (3) less than 3 hit pmts outside track on S11,S12
48        //-----------------------------------        //-----------------------------------
       //        GetHitPMTsOutsideTrack(event,0)<2 && //S11       //troppo (puo` succedere )  
       //        GetHitPMTsOutsideTrack(event,1)<2 && //S12  
       //        GetHitPMTsOutsideTrack(event,2)<2 && //S21  
       //        GetHitPMTsOutsideTrack(event,3)<2 && //S22  
49        GetNHitPMTsOutsideTrack(event, 0) < 3 && //S11        GetNHitPMTsOutsideTrack(event, 0) < 3 && //S11
50        GetNHitPMTsOutsideTrack(event, 1) < 3 && //S12        GetNHitPMTsOutsideTrack(event, 1) < 3 && //S12
51        //        GetHitPMTsOutsideTrack(event,2)<3 && //S21        //        GetHitPMTsOutsideTrack(event,2)<3 && //S21
# Line 73  int TofPatternCut::Check(PamLevel2 *even Line 54  int TofPatternCut::Check(PamLevel2 *even
54      TOF__OK = true;      TOF__OK = true;
55    
56    if (!TOF__OK) {    if (!TOF__OK) {
 #ifdef DEBUGPAMCUT  
       cout << "(((DISCARDED)))" << endl;  
 #endif  
57      return (0);      return (0);
58    };    };
59    
 #ifdef DEBUGPAMCUT  
     cout << "--> OK" << endl;  
     cout << "Check track concistency:" << endl;  
 #endif  
   
60    // -----------------------------------------------    // -----------------------------------------------
61    // the hit paddles MUST be associated to the track    // (4) for S11,S12,S21,S22: if there is a hit paddle, it MUST be associated to the track (done with Wolfgang help)
   // (in collaborazione con wolfgang)  
62    // -----------------------------------------------    // -----------------------------------------------
63    //    //
64    //  first build the map of hit PMTs along the track    //  first build the map of hit PMTs along the track
65    //  and discard the event if there is an hit paddle,    //  and discard the event if there is a hit paddle,
66    //  but it is not the one associated to the track    //  but it is not the one associated to the track
67    //    //
   
68    int hitplane[] = { 0, 0, 0, 0, 0, 0 };    int hitplane[] = { 0, 0, 0, 0, 0, 0 };
69    int hitpaddle[] = { -1, -1, -1, -1, -1, -1 };    int hitpaddle[] = { -1, -1, -1, -1, -1, -1 };
70    for (Int_t ip = 0; ip < tof->npmttdc; ip++) {//loop over tdc hits associated to the track    for (Int_t ip = 0; ip < tof->npmttdc; ip++) {//loop over tdc hits associated to the track
# Line 104  int TofPatternCut::Check(PamLevel2 *even Line 75  int TofPatternCut::Check(PamLevel2 *even
75      tofl2->GetPMTName(id, iplane, ipaddle, ipmt);      tofl2->GetPMTName(id, iplane, ipaddle, ipmt);
76      if (tof->tdcflag[ip] == 0) {      if (tof->tdcflag[ip] == 0) {
77        hitplane[iplane] = 1; //there is a true tdc signal associated to the track        hitplane[iplane] = 1; //there is a true tdc signal associated to the track
 #ifdef DEBUGPAMCUT  
       if (hitpaddle[iplane] >= 0 && hitpaddle[iplane] != ipaddle)  
         cout << "ORRORE!!!!" << endl;  
 #endif  
78        hitpaddle[iplane] = ipaddle;//store the id of the paddle associated to the track        hitpaddle[iplane] = ipaddle;//store the id of the paddle associated to the track
79        //        //
80        //        //
# Line 115  int TofPatternCut::Check(PamLevel2 *even Line 82  int TofPatternCut::Check(PamLevel2 *even
82        if (tofl2->GetNHitPaddles(iplane) > 0 && //if there is a hit paddle in this plane...        if (tofl2->GetNHitPaddles(iplane) > 0 && //if there is a hit paddle in this plane...
83            !tofl2->HitPaddle(iplane, hitpaddle[iplane]) && //... and the paddle associated to the track is not hit            !tofl2->HitPaddle(iplane, hitpaddle[iplane]) && //... and the paddle associated to the track is not hit
84            true) {            true) {
 #ifdef DEBUGPAMCUT  
           cout << "hit plane " << iplane << " -- track PMT " << hitpaddle[iplane] << " is not hit " << endl;  
           cout << "(((DISCARDED)))" << endl;  
 #endif  
85          return (0);//discard the event          return (0);//discard the event
86        }        }
87      }      }
# Line 131  int TofPatternCut::Check(PamLevel2 *even Line 94  int TofPatternCut::Check(PamLevel2 *even
94      if (hitplane[iplane] == 0 && //if there are no PMTs associated to the track...      if (hitplane[iplane] == 0 && //if there are no PMTs associated to the track...
95          tofl2->GetNHitPaddles(iplane) > 0 && //...and the plane has hit paddles          tofl2->GetNHitPaddles(iplane) > 0 && //...and the plane has hit paddles
96          true) {          true) {
 #ifdef DEBUGPAMCUT  
         cout << "hit plane " << iplane << " has no PMTs associated to the track " << endl;  
         cout << "(((DISCARDED)))" << endl;  
 #endif  
97        return (0);//discard the event        return (0);//discard the event
98      }      }
99    }    }
100    
   //  
   // forse non c'e` bisogno di tutto cio`?  
   //  
   //     for(int iplane=0; iplane<4; iplane++){//loop over S11/S12/S21/S22  
   //    //retrieve the id of the paddle traversed by the track  
   //    // (...there is some tolerance...)  
   //    int ipaddle = tofl2->GetPaddleIdOfTrack(tof->xtr_tof[iplane],tof->ytr_tof[iplane],iplane);  
   //    //check if the traversed paddle is hit  
   //    bool OK = true;  
   //    if(  
   //        tofl2->GetNHitPaddles(iplane)>0 &&//if there is a hit paddle in this plane...  
   //        !tofl2->HitPaddle(iplane,ipaddle) && //...and the paddle traversed by the track is not hit  
   //        true)OK = false;//..discard the event  
   //    /// hence try to recover some events...  
   //    if(  
   //        tofl2->GetNHitPaddles(iplane)>0 &&//if there is a hit paddle...  
   //        ipaddle==-1 &&//...and the track does not traverse any paddle...  
   //        tofl2->HitPaddle(iplane,hitpaddle[iplane]) &&//... BUT there are tdc signals belonging to a hit paddle  
   //        true)OK=true;//recover  
   
   //    if(!OK)return (0);  
   
   //     }  
   
   //    if( !TOF__OK )return (0);  
   
 #ifdef DEBUGPAMCUT  
     cout << "--> OK" << endl;  
 #endif  
   
101    return CUTOK; //good pattern    return CUTOK; //good pattern
102    
103  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.23