Changeset 3832 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
04/26/04 16:44:20 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3831 r3832  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20
     21 2004/04/26: Markus Gaug
     22
     23   * mjobs/MJCalibration.[h,cc]
     24     - moved colour finder from the macros into this class with the
     25       function FindColor()
     26
     27   * macros/calibration.C
     28   * macros/calibrate_data.C
     29   * macros/pedphotcalc.C
     30   * macros/bootcampstandardanalysis.C
     31     - removed function FindColor()
     32
    2033
    2134 2004/04/26: Abelardo Moralejo
  • trunk/MagicSoft/Mars/macros/bootcampstandardanalysis.C

    r3796 r3832  
    7171    cruns.AddRuns(crun1,crun2,inpath);
    7272
    73   MCalibrationCam::PulserColor_t color;
    74 
    75   if (crun1 < 20000)
    76     color = MCalibrationCam::kCT1;
    77   else
    78     color = FindColor((MDirIter*)&cruns);
    79 
    80   if (color == MCalibrationCam::kNONE)
    81     {
    82       TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
    83      
    84       while (1)
    85         {
    86           timer.TurnOn();
    87           TString input = Getline("Could not find the correct colour: Type 'q' to exit, "
    88                                   "green, blue, uv or ct1 to go on: ");
    89           timer.TurnOff();
    90          
    91           if (input=="q\n")
    92             return ;
    93          
    94           if (input=="green")
    95             color = MCalibrationCam::kGREEN;
    96           if (input=="blue")
    97             color = MCalibrationCam::kBLUE;
    98           if (input=="uv")
    99             color = MCalibrationCam::kUV;
    100           if (input=="ct1")
    101             color = MCalibrationCam::kCT1;
    102         }
    103     }
    104  
    10573  if (drun2==0)
    10674    druns.AddRun(drun1,inpath);
     
    149117  MCalibrationQECam qecam;
    150118  MJCalibration     calloop;
    151   calloop.SetColor(color);
    152119  calloop.SetInput(&cruns);
    153120  //
     
    364331}
    365332
    366 MCalibrationCam::PulserColor_t FindColor(MDirIter* run)
    367 {
    368  
    369   MCalibrationCam::PulserColor_t col = MCalibrationCam::kNONE;
    370 
    371   TString filenames;
    372 
    373   while (!(filenames=run->Next()).IsNull())
    374     {
    375 
    376       filenames.ToLower();
    377 
    378       if (filenames.Contains("green"))
    379         if (col == MCalibrationCam::kNONE)
    380           {
    381             cout << "Found colour: Green  in " << filenames << endl;
    382             col = MCalibrationCam::kGREEN;
    383           }
    384         else if (col != MCalibrationCam::kGREEN)
    385           {
    386             cout << "Different colour found in " << filenames << "... abort" << endl;
    387             return MCalibrationCam::kNONE;
    388           }
    389 
    390       if (filenames.Contains("blue"))
    391         if (col == MCalibrationCam::kNONE)
    392           {
    393             cout << "Found colour: Blue  in " << filenames << endl;
    394             col = MCalibrationCam::kBLUE;
    395           }
    396         else if (col != MCalibrationCam::kBLUE)
    397           {
    398             cout << "Different colour found in " << filenames << "... abort" << endl;
    399             return MCalibrationCam::kNONE;
    400           }
    401 
    402       if (filenames.Contains("uv"))
    403         if (col == MCalibrationCam::kNONE)
    404           {
    405             cout << "Found colour: Uv  in " << filenames << endl;
    406             col = MCalibrationCam::kUV;
    407           }
    408         else if (col != MCalibrationCam::kUV)
    409           {
    410             cout << "Different colour found in " << filenames << "... abort" << endl;
    411             return MCalibrationCam::kNONE;
    412           }
    413 
    414       if (filenames.Contains("ct1"))
    415         if (col == MCalibrationCam::kNONE)
    416           {
    417             cout << "Found colour: Ct1  in " << filenames << endl;
    418             col = MCalibrationCam::kCT1;
    419           }
    420         else if (col != MCalibrationCam::kCT1)
    421           {
    422             cout << "Different colour found in " << filenames << "... abort" << endl;
    423             return MCalibrationCam::kNONE;
    424           }
    425      
    426     }
    427  
    428 
    429      
    430   if (col == MCalibrationCam::kNONE)
    431     cout <<  "No colour found in filenames of runs: " << ((MRunIter*)run)->GetRunsAsString()
    432          << "... abort" << endl;
    433  
    434   return col;     
    435 }
  • trunk/MagicSoft/Mars/macros/calibrate_data.C

    r3762 r3832  
    5656  }
    5757
    58   MCalibrationCam::PulserColor_t color;
    59 
    60   if (calruns[0] < 20000)
    61     color = MCalibrationCam::kCT1;
    62   else
    63     color = FindColor((MDirIter*)&cruns);
    64 
    65   if (color == MCalibrationCam::kNONE)
    66     {
    67       TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
    68      
    69       while (1)
    70         {
    71           timer.TurnOn();
    72           TString input = Getline("Could not find the correct colour: Type 'q' to exit, "
    73                                   "green, blue, uv or ct1 to go on: ");
    74           timer.TurnOff();
    75          
    76           if (input=="q\n")
    77             return ;
    78          
    79           if (input=="green")
    80             color = MCalibrationCam::kGREEN;
    81           if (input=="blue")
    82             color = MCalibrationCam::kBLUE;
    83           if (input=="uv")
    84             color = MCalibrationCam::kUV;
    85           if (input=="ct1")
    86             color = MCalibrationCam::kCT1;
    87         }
    88     }
    8958
    9059  MStatusDisplay *display = new MStatusDisplay;
     
    11079  //
    11180  // badcam.AsciiRead("badpixels.dat");
     81
    11282
    11383  plist1.AddToList(&pedcam);
     
    150120  MCalibrationQECam qecam;
    151121  MJCalibration     calloop;
    152   calloop.SetColor(color);
    153122  calloop.SetInput(&cruns);
    154123  //  calloop.SetFullDisplay();
     
    185154  if (!calloop.Process(pedcam))
    186155    return;
     156
     157  badcam.Print();
    187158 
    188159  MBadPixelsCam          &badbad  = calloop.GetBadPixels();
    189160  MCalibrationChargeCam  &calcam  = calloop.GetCalibrationCam();
    190161  MCalibrationRelTimeCam &timecam = calloop.GetRelTimeCam();
     162
     163  badbad.Print();
    191164
    192165  /************************************************************************/
     
    414387
    415388
    416 MCalibrationCam::PulserColor_t FindColor(MDirIter* run)
    417 {
    418  
    419   MCalibrationCam::PulserColor_t col = MCalibrationCam::kNONE;
    420 
    421   TString filenames;
    422 
    423   while (!(filenames=run->Next()).IsNull())
    424     {
    425 
    426       filenames.ToLower();
    427 
    428       if (filenames.Contains("green"))
    429         if (col == MCalibrationCam::kNONE)
    430           {
    431             cout << "Found colour: Green  in " << filenames << endl;
    432             col = MCalibrationCam::kGREEN;
    433           }
    434         else if (col != MCalibrationCam::kGREEN)
    435           {
    436             cout << "Different colour found in " << filenames << "... abort" << endl;
    437             return MCalibrationCam::kNONE;
    438           }
    439 
    440       if (filenames.Contains("blue"))
    441         if (col == MCalibrationCam::kNONE)
    442           {
    443             cout << "Found colour: Blue  in " << filenames << endl;
    444             col = MCalibrationCam::kBLUE;
    445           }
    446         else if (col != MCalibrationCam::kBLUE)
    447           {
    448             cout << "Different colour found in " << filenames << "... abort" << endl;
    449             return MCalibrationCam::kNONE;
    450           }
    451 
    452       if (filenames.Contains("uv"))
    453         if (col == MCalibrationCam::kNONE)
    454           {
    455             cout << "Found colour: Uv  in " << filenames << endl;
    456             col = MCalibrationCam::kUV;
    457           }
    458         else if (col != MCalibrationCam::kUV)
    459           {
    460             cout << "Different colour found in " << filenames << "... abort" << endl;
    461             return MCalibrationCam::kNONE;
    462           }
    463 
    464       if (filenames.Contains("ct1"))
    465         if (col == MCalibrationCam::kNONE)
    466           {
    467             cout << "Found colour: Ct1  in " << filenames << endl;
    468             col = MCalibrationCam::kCT1;
    469           }
    470         else if (col != MCalibrationCam::kCT1)
    471           {
    472             cout << "Different colour found in " << filenames << "... abort" << endl;
    473             return MCalibrationCam::kNONE;
    474           }
    475      
    476     }
    477  
    478 
    479      
    480   if (col == MCalibrationCam::kNONE)
    481     cout <<  "No colour found in filenames of runs: " << ((MRunIter*)run)->GetRunsAsString()
    482          << "... abort" << endl;
    483  
    484   return col;     
    485 }
  • trunk/MagicSoft/Mars/macros/calibration.C

    r3796 r3832  
    5252//
    5353/////////////////////////////////////////////////////////////////////////////
    54 const TString inpath = "/home/rootdata/BlindPixel/";
    55 const Int_t pedrun  = 20491;
    56 const Int_t calrun1 = 20494;
    57 const Int_t calrun2 = 20496;
     54const TString inpath = "/home/rootdata/Calib/2004_04_16/";
     55const Int_t pedrun  = 22265;
     56const Int_t calrun1 = 22299;
     57const Int_t calrun2 = 22300;
    5858
    5959void calibration(const Int_t prun=pedrun, const Int_t crun1=calrun1, const Int_t crun2=calrun2)
     
    7070    cruns.AddRuns(crun1,crun2,inpath);
    7171
    72   MCalibrationCam::PulserColor_t color;
    73 
    74   if (crun1 < 20000)
    75     color = MCalibrationCam::kCT1;
    76   else
    77     color = FindColor((MDirIter*)&cruns);
    78 
    79   if (color == MCalibrationCam::kNONE)
    80     return;
    81 
    8272  MCalibrationQECam qecam;
    8373  MBadPixelsCam     badcam;
     
    8878  //
    8979  //  badcam.AsciiRead("badpixels.dat");
    90 
    91   for (Int_t i=0;i<badcam.GetSize();i++)
    92     if (badcam[i].IsBad())
    93       cout << "Bad Pixel: " << i << endl;
    9480
    9581  MStatusDisplay *display = new MStatusDisplay;
     
    114100  //
    115101  MJCalibration calloop;
    116   calloop.SetColor(color);
     102  //  calloop.SetColor(color);
    117103
    118104  //
     
    136122}
    137123
    138 MCalibrationCam::PulserColor_t FindColor(MDirIter* run)
    139 {
    140  
    141   MCalibrationCam::PulserColor_t col = MCalibrationCam::kNONE;
    142 
    143   TString filenames;
    144 
    145   while (!(filenames=run->Next()).IsNull())
    146     {
    147 
    148       filenames.ToLower();
    149 
    150       if (filenames.Contains("green"))
    151         if (col == MCalibrationCam::kNONE)
    152           {
    153             cout << "Found colour: Green  in " << filenames << endl;
    154             col = MCalibrationCam::kGREEN;
    155           }
    156         else if (col != MCalibrationCam::kGREEN)
    157           {
    158             cout << "Different colour found in " << filenames << "... abort" << endl;
    159             return MCalibrationCam::kNONE;
    160           }
    161 
    162       if (filenames.Contains("blue"))
    163         if (col == MCalibrationCam::kNONE)
    164           {
    165             cout << "Found colour: Blue  in " << filenames << endl;
    166             col = MCalibrationCam::kBLUE;
    167           }
    168         else if (col != MCalibrationCam::kBLUE)
    169           {
    170             cout << "Different colour found in " << filenames << "... abort" << endl;
    171             return MCalibrationCam::kNONE;
    172           }
    173 
    174       if (filenames.Contains("uv"))
    175         if (col == MCalibrationCam::kNONE)
    176           {
    177             cout << "Found colour: Uv  in " << filenames << endl;
    178             col = MCalibrationCam::kUV;
    179           }
    180         else if (col != MCalibrationCam::kUV)
    181           {
    182             cout << "Different colour found in " << filenames << "... abort" << endl;
    183             return MCalibrationCam::kNONE;
    184           }
    185 
    186       if (filenames.Contains("ct1"))
    187         if (col == MCalibrationCam::kNONE)
    188           {
    189             cout << "Found colour: Ct1  in " << filenames << endl;
    190             col = MCalibrationCam::kCT1;
    191           }
    192         else if (col != MCalibrationCam::kCT1)
    193           {
    194             cout << "Different colour found in " << filenames << "... abort" << endl;
    195             return MCalibrationCam::kNONE;
    196           }
    197      
    198     }
    199  
    200 
    201      
    202   if (col == MCalibrationCam::kNONE)
    203     cout <<  "No colour found in filenames of runs: " << ((MRunIter*)run)->GetRunsAsString()
    204          << "... abort" << endl;
    205  
    206   return col;     
    207 }
  • trunk/MagicSoft/Mars/macros/pedphotcalc.C

    r3760 r3832  
    9393const Bool_t usedisplay = kTRUE;
    9494
    95 static MCalibrationCam::PulserColor_t FindColor(MDirIter* run)
    96 {
    97  
    98   MCalibrationCam::PulserColor_t col = MCalibrationCam::kNONE;
    99 
    100   TString filenames;
    101 
    102   while (!(filenames=run->Next()).IsNull())
    103     {
    104 
    105       filenames.ToLower();
    106 
    107       if (filenames.Contains("green"))
    108         if (col == MCalibrationCam::kNONE)
    109           {
    110             cout << "Found colour: Green  in " << filenames << endl;
    111             col = MCalibrationCam::kGREEN;
    112           }
    113         else if (col != MCalibrationCam::kGREEN)
    114           {
    115             cout << "Different colour found in " << filenames << "... abort" << endl;
    116             return MCalibrationCam::kNONE;
    117           }
    118 
    119       if (filenames.Contains("blue"))
    120         if (col == MCalibrationCam::kNONE)
    121           {
    122             cout << "Found colour: Blue  in " << filenames << endl;
    123             col = MCalibrationCam::kBLUE;
    124           }
    125         else if (col != MCalibrationCam::kBLUE)
    126           {
    127             cout << "Different colour found in " << filenames << "... abort" << endl;
    128             return MCalibrationCam::kNONE;
    129           }
    130 
    131       if (filenames.Contains("uv"))
    132         if (col == MCalibrationCam::kNONE)
    133           {
    134             cout << "Found colour: Uv  in " << filenames << endl;
    135             col = MCalibrationCam::kUV;
    136           }
    137         else if (col != MCalibrationCam::kUV)
    138           {
    139             cout << "Different colour found in " << filenames << "... abort" << endl;
    140             return MCalibrationCam::kNONE;
    141           }
    142 
    143       if (filenames.Contains("ct1"))
    144         if (col == MCalibrationCam::kNONE)
    145           {
    146             cout << "Found colour: Ct1  in " << filenames << endl;
    147             col = MCalibrationCam::kCT1;
    148           }
    149         else if (col != MCalibrationCam::kCT1)
    150           {
    151             cout << "Different colour found in " << filenames << "... abort" << endl;
    152             return MCalibrationCam::kNONE;
    153           }
    154      
    155     }
    156  
    157 
    158      
    159   if (col == MCalibrationCam::kNONE)
    160     cout <<  "No colour found in filenames of runs: " << ((MRunIter*)run)->GetRunsAsString()
    161          << "... abort" << endl;
    162  
    163   return col;     
    164 }
    165 
    16695
    16796
     
    292221    cruns.AddRuns(crun1,crun2,inpath);
    293222
    294   MCalibrationCam::PulserColor_t color;
    295 
    296   if (crun1 < 20000)
    297     color = MCalibrationCam::kCT1;
    298   else
    299     color = FindColor((MDirIter*)&cruns);
    300 
    301   if (color == MCalibrationCam::kNONE)
    302     {
    303       TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
    304      
    305       while (1)
    306         {
    307           timer.TurnOn();
    308           TString input = Getline("Could not find the correct colour: Type 'q' to exit, "
    309                                   "green, blue, uv or ct1 to go on: ");
    310           timer.TurnOff();
    311          
    312           if (input=="q\n")
    313             return ;
    314          
    315           if (input=="green")
    316             color = MCalibrationCam::kGREEN;
    317           if (input=="blue")
    318             color = MCalibrationCam::kBLUE;
    319           if (input=="uv")
    320             color = MCalibrationCam::kUV;
    321           if (input=="ct1")
    322             color = MCalibrationCam::kCT1;
    323         }
    324     }
    325 
    326223  //
    327224  // Now setup the tasks and tasklist for the pedestals:
     
    365262  //
    366263  MJCalibration     calloop;
    367   calloop.SetColor(color);
    368264  calloop.SetInput(&cruns);
    369265  //
  • trunk/MagicSoft/Mars/mjobs/MJCalibration.cc

    r3797 r3832  
    141141using namespace std;
    142142
     143const Int_t MJCalibration::gkIFAEBoxInaugurationRun = 20113;
    143144// --------------------------------------------------------------------------
    144145//
     
    863864// --------------------------------------------------------------------------
    864865//
     866// Find the colour of the pulsing LED:
     867// - If the run number is smaller than gkIFAEBoxInaugurationRun, take MCalibrationCam::kCT1
     868// - Otherwise find the colour out of the run name
     869// - If no colour is found, return kFALSE
     870//
     871Bool_t MJCalibration::FindColor()
     872{
     873
     874  const UInt_t nruns = fRuns->GetNumRuns();
     875
     876  if (nruns == 0)
     877    return kFALSE;
     878 
     879  TArrayI arr = fRuns->GetRuns();
     880
     881  if (arr[nruns-1] < gkIFAEBoxInaugurationRun)
     882    {
     883      *fLog << "Found colour kCT1 in runs: " << fRuns->GetRunsAsString() << endl;
     884      fColor = MCalibrationCam::kCT1;
     885      return kTRUE;
     886    }
     887 
     888  TString filenames;
     889
     890  while (!(filenames=((MDirIter*)fRuns)->Next()).IsNull())
     891    {
     892
     893      filenames.ToLower();
     894
     895      if (filenames.Contains("green"))
     896        if (fColor == MCalibrationCam::kNONE)
     897          {
     898            *fLog << "Found colour: kGREEN  in " << filenames << endl;
     899            fColor = MCalibrationCam::kGREEN;
     900          }
     901        else if (fColor != MCalibrationCam::kGREEN)
     902          {
     903            *fLog << err << "Different colour found in " << filenames << "... abort" << endl;
     904            return kFALSE;
     905          }
     906
     907      if (filenames.Contains("blue"))
     908        if (fColor == MCalibrationCam::kNONE)
     909          {
     910            *fLog << "Found colour: kBLUE  in " << filenames << endl;
     911            fColor = MCalibrationCam::kBLUE;
     912          }
     913        else if (fColor != MCalibrationCam::kBLUE)
     914          {
     915            *fLog << err << "Different colour found in " << filenames << "... abort" << endl;
     916            return kFALSE;
     917          }
     918
     919      if (filenames.Contains("uv"))
     920        if (fColor == MCalibrationCam::kNONE)
     921          {
     922            *fLog << "Found colour: kUV in " << filenames << endl;
     923            fColor = MCalibrationCam::kUV;
     924          }
     925        else if (fColor != MCalibrationCam::kUV)
     926          {
     927            *fLog << err << "Different colour found in " << filenames << "... abort" << endl;
     928            return kFALSE;
     929          }
     930
     931      if (filenames.Contains("ct1"))
     932        if (fColor == MCalibrationCam::kNONE)
     933          {
     934            *fLog << "Found colour: kCT1  in " << filenames << endl;
     935            fColor = MCalibrationCam::kCT1;
     936          }
     937        else if (fColor != MCalibrationCam::kCT1)
     938          {
     939            *fLog << err << "Different colour found in " << filenames << "... abort" << endl;
     940            return kFALSE;
     941          }
     942     
     943    }
     944 
     945  if (fColor == MCalibrationCam::kNONE)
     946    {
     947      *fLog <<  "No colour found in filenames of runs: " << fRuns->GetRunsAsString()
     948           << "... abort" << endl;
     949      return kFALSE;     
     950    }
     951
     952  return kTRUE;
     953}
     954
     955
     956
     957
     958// --------------------------------------------------------------------------
     959//
    865960// Retrieve the output file written by WriteResult()
    866961//
     
    891986//
    892987// - Check if there are fRuns, otherwise return
     988// - Check the colour of the files in fRuns (FindColor()), otherwise return
    893989// - Check for consistency between run numbers and number of files
    894990// - Add fRuns to MReadMarsFile
     
    9301026  if (fRuns->GetNumRuns() != fRuns->GetNumEntries())
    9311027    {
    932       *fLog << err << "Number of files found doesn't match number of runs... abort." << endl;
     1028      *fLog << err << "Number of files found doesn't match number of runs... abort."
     1029            << fRuns->GetNumRuns() << " vs. " << fRuns->GetNumEntries() << endl;
    9331030      return kFALSE;
    9341031    }
    935  
     1032
    9361033  *fLog << inf;
    9371034  fLog->Separator(GetDescriptor());
     1035
     1036  if (!FindColor())
     1037    return kFALSE;
     1038 
    9381039  *fLog << "Calculate MCalibrationCam from Runs " << fRuns->GetRunsAsString() << endl;
    9391040  *fLog << endl;
  • trunk/MagicSoft/Mars/mjobs/MJCalibration.h

    r3797 r3832  
    2424{
    2525private:
     26
     27  static const Int_t gkIFAEBoxInaugurationRun;              // Run number of first IFAE box calibration
    2628
    2729  TString fOutputPath;                                     // Path to the output files
     
    5254  void   DisplayResult(MParList &plist);
    5355  Bool_t WriteResult();
    54 
     56  Bool_t FindColor();
     57 
    5558public:
    5659
Note: See TracChangeset for help on using the changeset viewer.