Changeset 2581


Ignore:
Timestamp:
12/01/03 18:58:01 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2580 r2581  
    44
    55                                                 -*-*- END OF LINE -*-*-
     6
     7 2003/12/01: Markus Gaug
     8 
     9   * macros/calibration.C:
     10     - adjusted some parameters
     11
     12   * manalysis/MCalibrationCalc.cc:
     13     - cosmics are now skipped from the fit
     14
     15   * manalysis/MCalibrationPix:
     16     - cosmics are now skipped from the fit
     17
     18   * mhist/MHCalibrationPixel:
     19     - cosmics are now skipped from the fit
     20
     21   * manalysis/Makefile
     22     - MPedCalcPedRun was not in Makefile
     23
     24   * manalysis/AnalysisLinkDef
     25     - MPedCalcPedRun was not in AnalysisLinkDef
     26
    627
    728 2003/12/01: Thomas Bretz
  • trunk/MagicSoft/Mars/macros/calibration.C

    r2570 r2581  
    2323\* ======================================================================== */
    2424
    25 void calibration(TString pedname="./20031102_02399_P_Unavailable_E.root",
    26                  TString calname="./20031102_02400_D_Flip500Hz_E.root")
     25void calibration(TString pedname="../../Mars-0.8.2/20031102_02399_P_Unavailable_E.root",
     26                 TString calname="../../Mars-0.8.2/20031102_02400_D_Flip500Hz_E.root")
    2727{
    2828
     
    4545
    4646    MGeomApply     geomapl;
     47    MPedCalcPedRun pedcalc;
    4748    MGeomCamMagic  geomcam;
    48     MGeomCam       geom;
    49     MPedCalcPedRun pedcalc;
    5049    MPedestalCam   pedcam;
    5150
     
    5756
    5857    MHCamEvent hist("Pedestal");
    59     hist.SetType(1);
     58    hist.SetType(0);
    6059    plist.AddToList(&hist);
    6160    MFillH fill(&hist, "MPedestalCam");
     
    6362    tlist.AddToList(&fill);
    6463
    65     //
    66     // Update frequency by default = 1Hz
    67     //
    68     MStatusDisplay *d = new MStatusDisplay;
     64    MStatusDisplay *d1 = new MStatusDisplay;
    6965 
    7066    // Set update time to 3s
    71     d->SetUpdateTime(3000);
     67    d1->SetUpdateTime(3000);
    7268 
    7369    //
     
    7672    MEvtLoop evtloop;
    7773    evtloop.SetParList(&plist);
    78     evtloop.SetDisplay(d);     
     74    evtloop.SetDisplay(d1);     
    7975
    8076    //
     
    8682    tlist.PrintStatistics();
    8783
     84    MPedestalCam *ped = plist.FindObject("MPedestalCam");
     85    ped.Print();
     86
    8887    //
    8988    // Create a empty Parameter List and an empty Task List
     
    9493    plist2.AddToList(&tlist2);
    9594
     95
    9696    plist2.AddToList((MPedestalCam*)plist.FindObject("MPedestalCam"));
    9797
    98     MGeomApply geomapl2;
     98//    MGeomApply geomapl2;
    9999    tlist2.AddToList(&geomapl);
    100100
     
    108108
    109109    MCalibrationCalc calcalc;
    110     calcalc.SetSkipTFits();
     110//    calcalc.SetSkipTFits();
    111111
    112112    plist2.AddToList(&geomcam);
     
    114114    //
    115115    // As long, as we don't have digital modules,
    116     // we have to set the color by hand
     116    // we have to set the color of the pulser LED by hand
    117117    //
    118118    calcalc.SetPulserColor(MCalibrationCalc::kEBlue);
     
    141141    tlist2.PrintStatistics();
    142142
    143  //   plist2.FindObject("MCalibrationCam")->Print();
    144 
    145143    //
    146144    // just one example how to get the plots of individual pixels
     
    148146    MCalibrationCam *cam = plist2.FindObject("MCalibrationCam");
    149147    MCalibrationPix *pix = cam->GetCalibrationPix(523);
    150     //pix->Draw();
    151 
     148    pix->Draw();
     149
     150    //
     151    // Here we are confronted to a serious bug in ROOT:
     152    // If we do not apply the next command, gPad will get
     153    // screwed up completely: (Thanks to tbretz for finding out
     154    // the reason during several hours!!!)
     155    //
    152156    gROOT->GetListOfCanvases()->Delete();
    153157
     
    193197    disp12.SetYTitle("\\Delta_{Q} [FADC counts]");
    194198
    195 //    TText text(0.1, 0.5, &fname[fname.Last('/')+1]);
    196 //    text.SetTextSize(0.015);
    197 //    text.DrawClone();
    198     TCanvas *c1 = &d->AddTab("Cal1");//MH::MakeDefCanvas("Calibration1","Plots of FADC Charges",700,900);
     199    MStatusDisplay *d2 = new MStatusDisplay;
     200 
     201    // Set update time to 1s
     202    d2->SetUpdateTime(1000);
     203
     204    TCanvas *c1 = &d2->AddTab("Fitted Charges");
    199205    c1->Divide(5, 2);
    200206
     
    241247    obj->Draw();
    242248
    243     TCanvas *c2 = &d->AddTab("Cal2");//MH::MakeDefCanvas("Calibration2","Plots of Arrival Times",700,900);
     249    TCanvas *c2 = &d2->AddTab("Fitted Times");
    244250    c2->Divide(3, 2);
    245251
     
    265271    obj->Draw();
    266272
    267     TCanvas *c3 = &d->AddTab("Cal3");//MH::MakeDefCanvas("Calibration3","Plots of Pedestals",700,900);
     273    TCanvas *c3 = &d2->AddTab("Pedestals");
    268274    c3->Divide(2, 2);
    269275
     
    282288    obj->Draw();
    283289
    284     TCanvas *c4 = &d->AddTab("Cal4");//MH::MakeDefCanvas("Calibration4","Plots of Reduced Charges",700,900);
     290    TCanvas *c4 = &d2->AddTab("Reduced Charges");
    285291    c4->Divide(2, 2);
    286292
     
    299305    obj->Draw();
    300306
    301 //    c->SaveAs(fname(0, fname.Last('.')+1) + "ps");
    302     //c->SaveAs(fname(0, fname.Last('.')+1) + "root");
     307#endif
    303308
    304309}
  • trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h

    r2565 r2581  
    2020#pragma link C++ class MPedestalPix+;
    2121#pragma link C++ class MPedestalCam+;
     22#pragma link C++ class MPedCalcPedRun+;
    2223#pragma link C++ class MMcPedestalCopy+;
    2324#pragma link C++ class MMcPedestalNSBAdd+;
  • trunk/MagicSoft/Mars/manalysis/MCalibrationCalc.cc

    r2540 r2581  
    136136{
    137137
    138     fOverFlow = 0;
    139     fNrEvents = 0;
     138    fHistOverFlow = 0;
     139    fEvents       = 0;
     140    fCosmics      = 0;
    140141
    141142    fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
     
    235236{
    236237
    237     fNrEvents++;
     238    fEvents++;
     239
     240    Bool_t cosmic = kFALSE;
    238241
    239242    MCalibrationBlindPix &blindpixel = *(fCalibrations->GetBlindPixel());
     
    267270            mid = pixel.GetIdxMaxLoGainSample();
    268271
    269             sum = (max == gkSaturationLimit          // overflow of LoGain ??? -> GimmeABreak!!!
    270                    ? fOverFlow++, gkLoGainOverFlow   // OUCH (Florian was maybe right)
    271                    : sum*gkConversionHiLo    );      // OUFF (Florian was wrong) !!
     272            sum = (max == gkSaturationLimit              // overflow of LoGain ??? -> GimmeABreak!!!
     273                   ? fHistOverFlow++, gkLoGainOverFlow   // OUCH (Florian was maybe right)
     274                   : sum*gkConversionHiLo    );          // OUFF (Florian was wrong) !!
    272275
    273276            //            *fLog << warn << "Warning: Saturation of HiGain reached in slice " << (int)mid << " !!! " << endl;
    274277            //            *fLog << warn << "Max = " << max << endl;
    275278
    276             if (fOverFlow)
     279            if (fHistOverFlow)
    277280              *fLog << err << dbginf << "Warning: Saturation of LoGain reached! "
    278281                    << err << dbginf << "sum = " << sum << endl;
    279282
    280283          }
    281        
    282         //
    283         // sanity check (old MC files sometimes have pixids>577)
    284         //
    285         if (fPedestals && !fPedestals->CheckBounds(pixid))
    286           {
    287             *fLog << inf << "Pixel ID larger than camera... skipping event." << endl;
    288             return kCONTINUE;
    289               }
    290        
     284       
     285
    291286        MPedestalPix    &ped = (*fPedestals)[pixid];
    292287        MCalibrationPix &pix = (*fCalibrations)[pixid];
    293288       
    294         Float_t pedes = ped.GetPedestal();
     289        Float_t pedes  = ped.GetPedestal();
     290        Float_t pedrms = ped.GetPedestalRms();
    295291       
    296292        //
     
    298294        // Assume pedestals per time slice ==> multiply with number of slices
    299295        //
    300         pedes *= (sat ? fNumLoGainSamples : fNumHiGainSamples );
     296        pedes  *= (sat ? fNumLoGainSamples : fNumHiGainSamples );
     297        pedrms *= (sat ? fNumLoGainSamples : fNumHiGainSamples );
     298
     299        //
     300        // This is a very primitive check for the number of cosmics
     301        // The cut will be applied in the fit, but for the blind pixel,
     302        // we need to remove this event
     303        //
     304        // FIXME: In the future need a much more sophisticated one!!!
     305        //
     306
     307        if ((float)sum < pedes+5.*pedrms)
     308           cosmic = kTRUE;
    301309
    302310        Float_t rsum      = (float)sum - pedes;
     
    306314           
    307315          case gkCalibrationBlindPixelId:
    308             if (!blindpixel.FillQ(sum))
    309               *fLog << warn <<
    310                 "Overflow or Underflow occurred filling Blind Pixel means = " << sum << endl;
     316            //
     317            // FIXME: This works only when the blind pixel ID is much larger than
     318            //        the rest of the pixels (which is the case right now)
     319            //
     320//          if (!cosmic)
     321               if (!blindpixel.FillQ(sum))
     322                  *fLog << warn <<
     323                  "Overflow or Underflow occurred filling Blind Pixel sum = " << sum << endl;
     324
    311325            if (!blindpixel.FillT((int)mid))
    312326              *fLog << warn <<
    313327                "Overflow or Underflow occurred filling Blind Pixel time = " << (int)mid << endl;
    314             if (!blindpixel.FillRQvsT(rsum,fNrEvents))
     328
     329            if (!blindpixel.FillRQvsT(rsum,fEvents))
    315330              *fLog << warn <<
    316                 "Overflow or Underflow occurred filling Blind Pixel eventnr = " << fNrEvents << endl;
     331                "Overflow or Underflow occurred filling Blind Pixel eventnr = " << fEvents << endl;
    317332
    318333          case gkCalibrationPINDiodeId:
     
    323338              *fLog << warn <<
    324339                "Overflow or Underflow occurred filling HT: time = " << (int)mid << endl;
    325             if (!pindiode.FillRQvsT(rsum,fNrEvents))
     340            if (!pindiode.FillRQvsT(rsum,fEvents))
    326341              *fLog << warn <<
    327                 "Overflow or Underflow occurred filling HQvsN: eventnr = " << fNrEvents << endl;
     342                "Overflow or Underflow occurred filling HQvsN: eventnr = " << fEvents << endl;
    328343
    329344          default:
     
    336351            // Fill the reduced charge into the control histo for better visibility
    337352            //
    338             if (!pix.FillRQvsT(rsum,fNrEvents))
     353            if (!pix.FillRQvsT(rsum,fEvents))
    339354              *fLog << warn << "Could not fill red. Q vs. EvtNr of pixel: " << pixid
    340                     << " signal = " << rsum  << " event Nr: " << fNrEvents << endl;
     355                    << " signal = " << rsum  << " event Nr: " << fEvents << endl;
    341356
    342357
     
    348363
    349364      } /* while (pixel.Next()) */
     365
     366    if (cosmic)
     367        fCosmics++;
    350368
    351369    fCalibrations->SetReadyToSave();
     
    398416          MCalibrationPix &pix = (*fCalibrations)[pixid];
    399417
     418          const Float_t ped    = (*fPedestals)[pixid].GetPedestal() * fNumHiGainSamples;
     419          const Float_t prms   = (*fPedestals)[pixid].GetPedestalRms() * fNumHiGainSamples;
     420
     421          pix.SetPedestal(ped,prms);
    400422
    401423          if (TESTBIT(fFlags,kUseTFits))
     
    405427             continue;
    406428
    407           const Float_t ped    = (*fPedestals)[pixid].GetPedestal();
    408           const Float_t prms   = (*fPedestals)[pixid].GetPedestalRms();
    409           pix.SetPedestal(ped,prms);
    410429        }
    411430    }
     
    413432  fCalibrations->SetReadyToSave();
    414433 
    415   if (GetNumExecutions()==0 || fOverFlow==0)
     434  if (GetNumExecutions()==0)
    416435    return kTRUE;
    417436 
    418   *fLog << inf << endl;
    419   *fLog << GetDescriptor() << " execution statistics:" << endl;
    420   *fLog << dec << setfill(' ');
    421   *fLog << " " << setw(7) << fOverFlow << " (" << setw(3) << (int)(fOverFlow*100/GetNumExecutions()) << "%) Evts skipped due to: lo gain saturated." << endl;
    422  
     437  *fLog << endl;
     438  *fLog << dec << setfill(' ') << fCosmics << " Events presumably cosmics" << endl;
     439
    423440  return kTRUE;
    424441}
  • trunk/MagicSoft/Mars/manalysis/MCalibrationCalc.h

    r2540 r2581  
    3535  MTime                    *fEvtTime;      // Time of the event
    3636
    37   Int_t fNrEvents;                         // Number of events 
    38   Int_t fOverFlow;                         // Number of events with saturated Low Gain
     37  Int_t fEvents;                           // Number of events 
     38  Int_t fHistOverFlow;                     // Number of events with saturated Low Gain
     39  Int_t fCosmics;                          // Number of events due to supposed cosmics
    3940
    4041  Byte_t fNumHiGainSamples;
  • trunk/MagicSoft/Mars/manalysis/MCalibrationPix.cc

    r2544 r2581  
    8383    return kTRUE;
    8484
     85  if (fPed && fPedRms)
     86    fHist->SetLowerFitRange(fPed + 3.5*fPedRms);
     87  else
     88    *fLog << warn << "Cannot set lower fit range to suppress cosmics: Pedestals not available" << endl;
     89
    8590  if(!fHist->FitQ())
    8691    {
  • trunk/MagicSoft/Mars/manalysis/Makefile

    r2565 r2581  
    3333SRCFILES = MPedestalPix.cc \
    3434           MPedestalCam.cc \
     35           MPedCalcPedRun.cc \
    3536           MMcPedestalCopy.cc \
    3637           MMcPedestalNSBAdd.cc \
  • trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.cc

    r2544 r2581  
    5555
    5656using namespace std;
     57
    5758// --------------------------------------------------------------------------
    5859//
     
    6061//
    6162MHCalibrationPixel::MHCalibrationPixel(Int_t pix, const char *name, const char *title)
    62     : fFitOK(kFALSE), fPixId(pix), fTGausFit(NULL), fQGausFit(NULL), fFitLegend(NULL)
    63 {
     63      : fPixId(pix),
     64        fQGausFit(NULL),
     65        fTGausFit(NULL),
     66        fFitLegend(NULL),
     67        fLowerFitRange(0.),
     68        fFitOK(kFALSE)
     69{
    6470
    6571    fName  = name  ? name  : "MHCalibrationPixel";
     
    328334}
    329335
    330 Bool_t MHCalibrationPixel::FitQ(Axis_t rmin, Axis_t rmax, Option_t *option)
     336Bool_t MHCalibrationPixel::FitQ(Option_t *option)
    331337{
    332338
     
    337343  // Get the fitting ranges
    338344  //
    339   rmin = (rmin != 0.) ? rmin : fQfirst;
    340   rmax = (rmax != 0.) ? rmax : fQlast;
     345  Axis_t rmin = (fLowerFitRange != 0.) ? fLowerFitRange : fQfirst;
    341346
    342347  //
     
    349354  const Double_t si_guess = mu_guess/500.;
    350355
    351   fQGausFit = new TF1("QGausFit","gaus",rmin,rmax);
     356  fQGausFit = new TF1("QGausFit","gaus",rmin,fQlast);
    352357
    353358  if (!fQGausFit)
     
    360365  fQGausFit->SetParNames("Area","#mu","#sigma");
    361366  fQGausFit->SetParLimits(0,0.,entries);
    362   fQGausFit->SetParLimits(1,rmin,rmax);
    363   fQGausFit->SetParLimits(2,0.,rmax-rmin);
     367  fQGausFit->SetParLimits(1,rmin,fQlast);
     368  fQGausFit->SetParLimits(2,0.,fQlast-rmin);
    364369
    365370  fHQ->Fit("QGausFit",option);
  • trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.h

    r2538 r2581  
    4141  TPaveText *fFitLegend; 
    4242 
     43  Axis_t  fLowerFitRange;
    4344  Axis_t  fQfirst;
    4445  Axis_t  fQlast;
     
    104105  const TH1I *GetHQvsN() const { return fHQvsN; }
    105106 
    106   Bool_t FitQ(Axis_t rmin=0, Axis_t rmax=0, Option_t *option="RQ0+"); 
     107  Bool_t FitQ(Option_t *option="RQ0+"); 
    107108  Bool_t FitT(Axis_t rmin=0, Axis_t rmax=0, Option_t *option="RQ0+");   
    108109
     
    110111  virtual void CutAllEdges();
    111112  virtual void Reset();
     113
     114  void SetLowerFitRange(Axis_t min)  { fLowerFitRange = min; }
    112115
    113116  void PrintQFitResult();
Note: See TracChangeset for help on using the changeset viewer.