/[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.1 by pam-fi, Tue May 11 15:16:17 2010 UTC revision 1.1.2.4 by pam-fi, Mon Jun 7 13:33:15 2010 UTC
# Line 9  Line 9 
9    
10  TRandom3* RefitTrackAction::_r3 = new TRandom3(0);  TRandom3* RefitTrackAction::_r3 = new TRandom3(0);
11  long int RefitTrackAction::_currEvent = -1;  long int RefitTrackAction::_currEvent = -1;
12    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    TrkParams::Set("/wizard/02/pamela_software/installed/pamela/calib/trk-param/align_param-080805-GL1from7/", 5); //DA USARE SOLO PER SIMULAZIONE ROTRASL!!!    // Do something only if at least one track exists
20      if (event->GetTrkLevel2()->GetNTracks() == 0)
21        return;
22    
23      // Reload the TRK 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) {
26        TrkParams::Set(_trkParamsFile, 5);
27        _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;
# Line 44  void RefitTrackAction::OnGood(PamLevel2 Line 59  void RefitTrackAction::OnGood(PamLevel2
59    }    }
60    
61    // Apply the gaussian spread    // Apply the gaussian spread
62    
63      cout << GetName() << "  " << trkTrack->xm[0];
64      cout.flush();
65    for (Int_t ip = 0; ip < 6; ip++) {    for (Int_t ip = 0; ip < 6; ip++) {
66      // gaussian distributed random number Gauss(mean,sigma) (in cm)      // gaussian distributed random number Gauss(mean,sigma) (in cm)
67      trkTrack->xm[ip] += _r3->Gaus(0., _spreadX);      trkTrack->xm[ip] += _r3->Gaus(0., _spreadX);
68      trkTrack->ym[ip] += _r3->Gaus(0., _spreadY);      trkTrack->ym[ip] += _r3->Gaus(0., _spreadY);
69    }    }
70      cout << GetName() << "  " << trkTrack->xm[0] << endl;
71    // Mask the layers    // Mask the layers
72    if (_maskedViews) {    if (_maskedViews) {
73      if ((_maskedViews & T1X) == T1X)      if ((_maskedViews & T1X) == T1X)
# Line 82  void RefitTrackAction::OnGood(PamLevel2 Line 100  void RefitTrackAction::OnGood(PamLevel2
100    trkTrack->FitReset();    trkTrack->FitReset();
101    int fail = 0;    int fail = 0;
102    trkTrack->Fit(0, fail, 0);    trkTrack->Fit(0, fail, 0);
103    
104      if (fail) {
105        // Set a flag for the badly-refitted tracks: chi2 < 0
106        if (trkTrack->chi2 >= 0.)
107          trkTrack->chi2 = -1.;
108      }
109  }  }

Legend:
Removed from v.1.1.2.1  
changed lines
  Added in v.1.1.2.4

  ViewVC Help
Powered by ViewVC 1.1.23