/[PAMELA software]/PamCut/CollectionActions/RefitTrackAction/RefitTrackAction.cpp
ViewVC logotype

Diff of /PamCut/CollectionActions/RefitTrackAction/RefitTrackAction.cpp

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

revision 1.1.2.2 by pam-fi, Tue May 11 15:32:09 2010 UTC revision 1.1.2.7 by pam-fi, Thu Jun 24 17:22:10 2010 UTC
# Line 11  TRandom3* RefitTrackAction::_r3 = new TR Line 11  TRandom3* RefitTrackAction::_r3 = new TR
11  long int RefitTrackAction::_currEvent = -1;  long int RefitTrackAction::_currEvent = -1;
12  TString RefitTrackAction::_currTrkParamsFile = "";  TString RefitTrackAction::_currTrkParamsFile = "";
13    
14    float RefitTrackAction::_xmBackup[6], RefitTrackAction::_ymBackup[6];
15    int RefitTrackAction::_layerXBackup[6], RefitTrackAction::_layerYBackup[6];
16    
17  void RefitTrackAction::OnGood(PamLevel2 *event) {  void RefitTrackAction::OnGood(PamLevel2 *event) {
18    
19    // Reload the TRK parameters only if they have been changed (ie., if another instance of    // Do something only if at least one track exists
20    // this class used a different set of parameters.    if (event->GetTrkLevel2()->GetNTracks() == 0)
21        return;
22    
23      // Reload the TRK alignment parameters only if they have been changed (ie., if another instance of
24      // this class used a different set of parameters).
25    if (_trkParamsFile != _currTrkParamsFile) {    if (_trkParamsFile != _currTrkParamsFile) {
26      TrkParams::Set(_trkParamsFile, 5);      TrkParams::Set(_trkParamsFile, 5);
27      _currTrkParamsFile = _trkParamsFile;      _currTrkParamsFile = _trkParamsFile;
28    }    }
29    
30      if (_sortingMethod)
31        event->SetSortingMethod(_sortingMethod);
32    TrkTrack *trkTrack = event->GetTrack(0)->GetTrkTrack();    TrkTrack *trkTrack = event->GetTrack(0)->GetTrkTrack();
33    if (!trkTrack)    if (!trkTrack)
34      return;      return;
35    
36      // Check if good clusters have meaningful energy releases
37      for (UInt_t ip = 0; ip < 6; ip++) {
38        if (trkTrack->XGood(ip) == 1 && trkTrack->GetDEDX(ip, 0) <= 0.)
39          trkTrack->xgood[ip] = 0; // Set it to bad
40        if (trkTrack->YGood(ip) == 1 && trkTrack->GetDEDX(ip, 1) <= 0.)
41          trkTrack->ygood[ip] = 0; // Set it to bad
42      }
43    
44    if (_currEvent != event->GetReadEntry()) {    if (_currEvent != event->GetReadEntry()) {
45      // Saves the original track data if the current event (recorded in the static member _currEvent) is      // Saves the original track data if the current event (recorded in the static member _currEvent) is
46      // different from the actually processed event. This way, multiple instances of the class      // different from the actually processed event. This way, multiple instances of the class
# Line 50  void RefitTrackAction::OnGood(PamLevel2 Line 67  void RefitTrackAction::OnGood(PamLevel2
67    }    }
68    
69    // Apply the gaussian spread    // Apply the gaussian spread
70    
71    for (Int_t ip = 0; ip < 6; ip++) {    for (Int_t ip = 0; ip < 6; ip++) {
72      // gaussian distributed random number Gauss(mean,sigma) (in cm)      // gaussian distributed random number Gauss(mean,sigma) (in cm)
73      trkTrack->xm[ip] += _r3->Gaus(0., _spreadX);      trkTrack->xm[ip] += _r3->Gaus(0., _spreadX);
# Line 88  void RefitTrackAction::OnGood(PamLevel2 Line 106  void RefitTrackAction::OnGood(PamLevel2
106    trkTrack->FitReset();    trkTrack->FitReset();
107    int fail = 0;    int fail = 0;
108    trkTrack->Fit(0, fail, 0);    trkTrack->Fit(0, fail, 0);
109    
110      if (fail) {
111        // Set a flag for the badly-refitted tracks: chi2 < 0
112        if (trkTrack->chi2 >= 0.)
113          trkTrack->chi2 = -1.;
114      }
115  }  }

Legend:
Removed from v.1.1.2.2  
changed lines
  Added in v.1.1.2.7

  ViewVC Help
Powered by ViewVC 1.1.23