Changeset 7069 for trunk


Ignore:
Timestamp:
05/20/05 11:59:31 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r7068 r7069  
    2121
    2222                                                 -*-*- END OF LINE -*-*-
     23 2005/05/20 Thomas Bretz
     24   
     25   * msignal/MExtractTimeAndChargeSlidingWindow.cc
     26     - increased log-gain window from 6 to 8 according to an
     27       UNDOCUMENTED change in the bcn cvs
     28
     29   * mhcalib/MHCalibrationChargePINDiode.cc:
     30     - removed a check in fill according to an UDOCUMENTED change
     31       in the bcn cvs
     32
     33   * mhcalib/MHCalibrationChargePINDiode.cc:
     34     - use a dynamic_cast for the Fill-argument
     35
     36   * mjobs/MJCalibration.cc:
     37     - shortened output line telling file name of hi-/lo-gain
     38       calibration
     39
     40   * mjobs/MJPedestal.[h,cc]:
     41     - moved code for PulsePosCheck into own function
     42     - put also code for pixel check into this function
     43     - added a sanity check for fExtractor at some places
     44
     45   * msignal/MExtractor.cc:
     46     - added output of pedestal container - if available - in Print()
     47
     48
     49
     50 2005/05/20 Markus Gaug (2005/05/19)
     51
     52   * mjobs/MJPedestal.cc:
     53    - fixed an important bug in the setting of the incoming pedestal
     54      pointer to the signal extractor. This bug caused the pedestals not
     55      to be subtracted correctly in the calibration afterwards. The
     56      effect was about 10% too high conversion factors for the digital
     57      filter and the spline and more than 40% for the sliding window.
     58      The bug existed since end of February! (Markus G.)
     59
     60
     61
     62 2005/05/20 Markus Gaug (2005/05/18)
     63
     64   * mcalib/MCalibrationChargeCalc.cc
     65     - issue a warning if no colour has been set until the PostProcess.
     66       (happens to old MC files).
     67
     68
     69
    2370 2005/05/19 Markus Meyer
    2471
  • trunk/MagicSoft/Mars/NEWS

    r7063 r7069  
    127127     hilocalib_sp1.root, hilocalib_df46_mc.root, hilocalib_df4.root,
    128128     hilocalib_df6.root
     129
     130   - callisto: The default lo-gain extraction window for the
     131     MExtractTimeAndChargeSlidingWindow extractor has been increased
     132     from 6 to 8 to take the stretch of the pusle into account
     133
     134   - callisto (!!!): fixed an important bug in the setting of the
     135     incoming pedestal pointer to the signal extractor extracting
     136     pedestals. This bug caused the pedestals not to be subtracted
     137     correctly in the calibration afterwards. The effect was about 10%
     138     too high conversion factors for the digital filter and the spline
     139     and more than 40% for the sliding window.
     140     The bug existed since end of February! (Markus G.)
    129141
    130142   - star: added muon support to star. A new tab "MHMuonPar" is
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc

    r7059 r7069  
    657657
    658658  if (fPulserColor == MCalibrationCam::kNONE)
    659     return kTRUE;
     659  {
     660      *fLog << warn << "WARNING - No Pulse colour has been set or used at all..." << endl;
     661      return kTRUE;
     662  }
    660663 
    661664  if (fNumProcessed == 0)
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargePINDiode.cc

    r7043 r7069  
    7171const TString MHCalibrationChargePINDiode::gsAbsHistXTitle     = "Time [FADC slices]";
    7272const TString MHCalibrationChargePINDiode::gsAbsHistYTitle     = "Nr. events";
     73
    7374// --------------------------------------------------------------------------
    7475//
     
    235236{
    236237
    237   MExtractedSignalPINDiode *extractor = (MExtractedSignalPINDiode*)par;
    238  
     238  const MExtractedSignalPINDiode *extractor = dynamic_cast<const MExtractedSignalPINDiode*>(par);
    239239  if (!extractor)
    240240    {
     
    243243    }
    244244 
    245   Float_t slices = (Float_t)extractor->GetNumFADCSamples();
    246  
    247   if (slices == 0.)
    248     {
    249       *fLog << err << "Number of used signal slices in MExtractedSignalPINDiode is zero  ... abort."
    250             << endl;
    251       return kFALSE;
    252     }
    253  
    254245  const Float_t signal = (float)extractor->GetExtractedSignal();
    255246  const Float_t time   = extractor->GetExtractedTime();
    256   const Float_t sigma    = extractor->GetExtractedSigma();
    257   const Float_t chi2    = extractor->GetExtractedChi2();
     247  const Float_t sigma  = extractor->GetExtractedSigma();
     248  const Float_t chi2   = extractor->GetExtractedChi2();
    258249
    259250  if (time < 3. || time > 24.)
  • trunk/MagicSoft/Mars/mjobs/MJCalibration.cc

    r7054 r7069  
    14851485
    14861486  MCalibrationHiLoCam hilocam;
    1487  
    1488   *fLog << all << "Initializing High gain vs. Low gain intercalibration from " << fHiLoCalibFile << endl;
    1489   *fLog << all << endl;
    1490 
    14911487  if (hilocam.Read()<=0)
    14921488  {
     
    15001496      return kFALSE;
    15011497  }
     1498
     1499  *fLog << all << "Hi-/Lo-Gain intercalibration constants read from " << fHiLoCalibFile << endl << endl;
    15021500
    15031501  if (fCalibrationCam.GetSize() < 1)
  • trunk/MagicSoft/Mars/mjobs/MJPedestal.cc

    r7043 r7069  
    822822}
    823823
     824Bool_t MJPedestal::PulsePosCheck(const MParList &plist) const
     825{
     826    if (fIsPixelCheck)
     827    {
     828        MHPedestalCam *hcam = (MHPedestalCam*)plist.FindObject("MHPedestalCam");
     829        if (hcam)
     830        {
     831            MHPedestalPix &pix1 = (MHPedestalPix&)(*hcam)[fCheckedPixId];
     832            pix1.DrawClone("");
     833        }
     834    }
     835
     836    if (!fIsPulsePosCheck)
     837        return kTRUE;
     838
     839    Int_t numhigainsamples = 0;
     840    Int_t numlogainsamples = 0;
     841
     842    Float_t meanpulsetime  = 0.;
     843    Float_t rmspulsetime   = 0.;
     844
     845    if (IsUseMC())
     846    {
     847        //
     848        // FIXME:
     849        // The MC cannot run over the first 2000 pedestal events since almost all
     850        // events are empty, therefore a pulse pos. check is not possible, either.
     851        // For the moment, have to fix the problem hardcoded...
     852        //
     853        //            MMcEvt *evt = (MMcEvt*)plist.FindObject("MMcEvt");
     854        //            const Float_t meanpulsetime = evt->GetFadcTimeJitter();
     855        meanpulsetime = 4.5;
     856        rmspulsetime  = 1.0;
     857
     858        numhigainsamples = 15;
     859        numlogainsamples = 15;
     860
     861    }
     862    else
     863    {
     864        if (fIsPixelCheck)
     865        {
     866            MHCalibrationPulseTimeCam *hcam = (MHCalibrationPulseTimeCam*)plist.FindObject("MHCalibrationPulseTimeCam");
     867            if (!hcam)
     868            {
     869                *fLog << err << "MHCalibrationPulseTimeCam not found... abort." << endl;
     870                return kFALSE;
     871            }
     872            hcam->DrawClone();
     873            gPad->SaveAs(Form("%s/PulsePosTest_all.root",fPathOut.Data()));
     874
     875            MHCalibrationPix &pix = (*hcam)[fCheckedPixId];
     876            pix.DrawClone();
     877            gPad->SaveAs(Form("%s/PulsePosTest_Pixel%04d.root",fPathOut.Data(),fCheckedPixId));
     878        }
     879
     880        MCalibrationPulseTimeCam *cam = (MCalibrationPulseTimeCam*)plist.FindObject("MCalibrationPulseTimeCam");
     881        if (!cam)
     882        {
     883            *fLog << err << "MCalibrationPulseTimeCam not found... abort." << endl;
     884            return kFALSE;
     885        }
     886
     887        meanpulsetime = cam->GetAverageArea(0).GetHiGainMean();
     888        rmspulsetime  = cam->GetAverageArea(0).GetHiGainRms();
     889
     890        MRawEvtData *data = (MRawEvtData*)plist.FindObject("MRawEvtData");
     891        if (!data)
     892        {
     893            *fLog << err << "MRawEvtData not found... abort." << endl;
     894            return kFALSE;
     895        }
     896
     897        numhigainsamples = data->GetNumHiGainSamples();
     898        numlogainsamples = data->GetNumLoGainSamples();
     899    }
     900
     901    *fLog << all << "Mean pulse time (" << (IsUseMC()?"MC":"cosmics") << "): ";
     902    *fLog << meanpulsetime << "+-" << rmspulsetime << endl;
     903
     904    const MExtractTimeAndCharge *ext = dynamic_cast<MExtractTimeAndCharge*>(fExtractor);
     905
     906    //
     907    // Get the ranges for the new extractor setting
     908    //
     909    const Int_t newfirst = TMath::Nint(meanpulsetime-fExtractWinLeft);
     910
     911    Int_t wshigain = ext ? ext->GetWindowSizeHiGain() : 6;
     912    if (wshigain > 6)
     913        wshigain = 6;
     914
     915    Int_t wslogain = ext ? ext->GetWindowSizeLoGain() : 4;
     916    if (wslogain > 4)
     917        wslogain = 4;
     918
     919    const Int_t newlast  = TMath::Nint(meanpulsetime+fExtractWinRight);
     920
     921    *fLog << underline;
     922    *fLog << "Try to set new range limits: (" << newfirst << "," << newlast;
     923    *fLog << "+" << wshigain << "," << newfirst-1 << "," << newlast << "+";
     924    *fLog << wslogain << ")" << endl;
     925
     926    //
     927    // Check the ranges for the new extractor setting
     928    //
     929    if (newfirst < 0)
     930    {
     931        *fLog << err << "Pulse is too much to the left, cannot go below 0!" << endl;
     932        return kFALSE;
     933
     934    }
     935    if (newlast+wshigain > numhigainsamples+numlogainsamples-1)
     936    {
     937        *fLog << err << "Pulse is too much to the right, cannot go beyond limits: ";
     938        *fLog << numhigainsamples << "+" << numlogainsamples << "-1" << endl;
     939        *fLog << " Cannot extract at all!" << endl;
     940        return kFALSE;
     941    }
     942    if (newlast+wslogain > numlogainsamples)
     943    {
     944        *fLog << err << "Pulse is too much to the right, cannot go beyond logain limits!" << endl;
     945        *fLog << endl;
     946        *fLog << "Try to use a different extractor (e.g. with a window size of only 4 sl.) or:" << endl;
     947        *fLog << "Set the limit to a lower value (callisto.rc):" << endl;
     948        *fLog << "    MJPedestalY2:ExtractWinRight: 4.5" << endl;
     949        *fLog << "(ATTENTION, you will lose late cosmics pulses!)" << endl;
     950        *fLog << endl;
     951        return kFALSE;
     952    }
     953
     954    //
     955    // Set and store the new ranges
     956    //
     957    const Int_t hi0 = newfirst;
     958    const Int_t hi1 = newlast+wshigain;
     959
     960    const Int_t lo0 = newfirst>0 ? newfirst-1 : newfirst;
     961    const Int_t lo1 = numlogainsamples-1;
     962
     963    fExtractor->SetRange(hi0, hi1, lo0, lo1);
     964    return kTRUE;
     965}
     966
    824967Bool_t MJPedestal::Process()
    825968{
     
    9891132    }
    9901133   
    991     if (fIsUseHists)
     1134    if (fIsUseHists && fExtractor)
    9921135      {
    9931136        if (fExtractor->InheritsFrom("MExtractTimeAndCharge"))
     
    10211164    if (fExtractor)
    10221165    {
     1166      fExtractor->SetPedestals(&fPedestalCamIn);
    10231167
    10241168      if (fExtractionType!=kFundamental)
     
    10651209        *fLog << "windows." << endl;
    10661210    }
    1067    
    1068     /*
    1069     switch (fExtractType)
    1070     {
    1071     case kUseData:
    1072         *fLog << all << "TYPE: USEDATA " << fExtractor << endl;
    1073         taskenv.SetDefault(&pedlogain);
    1074         tlist.AddToList(&taskenv);
    1075 
    1076         if (!SetupExtractor(plist, pedlogain))
    1077         {
    1078             *fLog << all <<  "SETTING TO: " << fExtractor << " " << fExtractor->GetNumHiGainSamples() << endl;
    1079             fExtractor->Print();
    1080             pedlogain.SetExtractWindow(15, (Int_t)TMath::Nint(fExtractor->GetNumHiGainSamples()));
    1081         }
    1082         break;
    1083 
    1084     case kUsePedRun:
    1085         *fLog << all <<  "TYPE: USEPEDRUN " << fExtractor << endl;
    1086         taskenv.SetDefault(&pedcalc);
    1087         tlist.AddToList(&taskenv);
    1088 
    1089         if (!SetupExtractor(plist, pedcalc))
    1090             pedcalc.SetExtractWindow(fExtractor->GetHiGainFirst(), TMath::Nint(fExtractor->GetNumHiGainSamples()));
    1091         break;
    1092 
    1093     case kUseHists:
    1094         if (!fExtractor)
    1095         {
    1096             *fLog << err << GetDescriptor() << " - ERROR: ";
    1097             *fLog << "Extraction Type is kUseHists, but no extractor was set" << endl;
    1098             return kFALSE;
    1099         }
    1100 
    1101         tlist.AddToList(fExtractor);
    1102         tlist.AddToList(&fillped);
    1103         break;
    1104     } */
    1105 
    1106     /*
    1107     if (!fPathIn.IsNull())
    1108     {
    1109         delete fExtractor;
    1110         fExtractor = 0;
    1111     }
    1112     */
    1113 
    11141211
    11151212    //
     
    11351232    tlist.PrintStatistics();
    11361233
    1137     if (fIsPixelCheck)
    1138       {
    1139         MHPedestalCam *hcam = (MHPedestalCam*)plist.FindObject("MHPedestalCam");
    1140         if (hcam)
    1141           {
    1142             MHPedestalPix &pix1 = (MHPedestalPix&)(*hcam)[fCheckedPixId];
    1143             pix1.DrawClone("");
    1144           }
    1145       }
    1146    
    11471234    if (fDisplayType!=kDisplayNone)
    11481235        DisplayResult(plist);
     
    11511238        return kFALSE;
    11521239
    1153     if (fIsPulsePosCheck)
    1154       {
    1155        
    1156         Int_t numhigainsamples = 0;
    1157         Int_t numlogainsamples = 0;
    1158         Float_t meanpulsetime  = 0.;
    1159         Float_t rmspulsetime   = 0.;
    1160 
    1161         if (IsUseMC())
    1162           {
    1163             //
    1164             // FIXME:
    1165             // The MC cannot run over the first 2000 pedestal events since almost all
    1166             // events are empty, therefore a pulse pos. check is not possible, either.
    1167             // For the moment, have to fix the problem hardcoded...
    1168             //
    1169             //            MMcEvt *evt = (MMcEvt*)plist.FindObject("MMcEvt");
    1170             //            const Float_t meanpulsetime = evt->GetFadcTimeJitter();
    1171             meanpulsetime = 4.5;
    1172             rmspulsetime  = 1.0;
    1173 
    1174             *fLog << all << "Mean pulse time (MC): " << meanpulsetime << "+-" << rmspulsetime << endl;
    1175 
    1176             numhigainsamples = 15;
    1177             numlogainsamples = 15;
    1178 
    1179           }
    1180         else
    1181           {
    1182             MHCalibrationPulseTimeCam *hcam = (MHCalibrationPulseTimeCam*)plist.FindObject("MHCalibrationPulseTimeCam");
    1183             if (fIsPixelCheck)
    1184               {
    1185                 hcam->DrawClone();
    1186                 gPad->SaveAs(Form("%s/PulsePosTest_all.root",fPathOut.Data()));
    1187                 MHCalibrationPix &pix = (*hcam)[fCheckedPixId];
    1188                 pix.DrawClone();
    1189                 gPad->SaveAs(Form("%s/PulsePosTest_Pixel%04d.root",fPathOut.Data(),fCheckedPixId));
    1190               }
    1191            
    1192             MCalibrationPulseTimeCam *cam = (MCalibrationPulseTimeCam*)plist.FindObject("MCalibrationPulseTimeCam");
    1193             if (!cam)
    1194               {
    1195                 *fLog << err << "Could not determine mean pulse position, abort... " << endl;
    1196                 return kFALSE;
    1197               }
    1198            
    1199             meanpulsetime = cam->GetAverageArea(0).GetHiGainMean();
    1200             rmspulsetime  = cam->GetAverageArea(0).GetHiGainRms();
    1201 
    1202             *fLog << all << "Mean pulse time (cosmics): " << meanpulsetime << "+-" << rmspulsetime << endl;
    1203 
    1204             MRawEvtData *data = (MRawEvtData*)plist.FindObject("MRawEvtData");
    1205 
    1206             numhigainsamples = data->GetNumHiGainSamples();
    1207             numlogainsamples = data->GetNumLoGainSamples();
    1208           }
    1209        
    1210         //
    1211         // Get the ranges for the new extractor setting
    1212         //
    1213         const Int_t newfirst = TMath::Nint(meanpulsetime-fExtractWinLeft);
    1214         Int_t wshigain = fExtractor->InheritsFrom("MExtractTimeAndCharge")
    1215           ?  ((MExtractTimeAndCharge*)fExtractor)->GetWindowSizeHiGain()
    1216           : 6;
    1217 
    1218         if (wshigain > 6)
    1219           wshigain = 6;
    1220 
    1221         Int_t wslogain = fExtractor->InheritsFrom("MExtractTimeAndCharge")
    1222           ? ((MExtractTimeAndCharge*)fExtractor)->GetWindowSizeLoGain()
    1223           : 6;
    1224         if (wslogain > 4)
    1225           wslogain = 4;
    1226 
    1227         const Int_t newlast  = TMath::Nint(meanpulsetime+fExtractWinRight);
    1228 
    1229         *fLog << all << underline
    1230               << "Try to set new range limits: ("<<newfirst<<","<<newlast<<"+"<<wshigain
    1231               <<","<<newfirst-1<<","<<newlast<<"+"<<wslogain<<")"<<endl;
    1232         //
    1233         // Check the ranges for the new extractor setting
    1234         //
    1235         if (newfirst < 0)
    1236           {
    1237             *fLog << err << "Pulse is too much to the left, cannot go below 0! " << endl;
    1238             return kFALSE;
    1239           }
    1240         if (newlast+wshigain > numhigainsamples+numlogainsamples-1)
    1241           {
    1242             *fLog << err << "Pulse is too much to the right, cannot go beyond limits: "
    1243                   << numhigainsamples << "+" << numlogainsamples << "-1" << endl;
    1244             *fLog << " Cannot extract at all! ... " << endl;
    1245             return kFALSE;
    1246           }
    1247         if (newlast+wslogain > numlogainsamples)
    1248           {
    1249             *fLog << err << "Pulse is too much to the right, cannot go beyond logain limits! " << endl;
    1250             *fLog << endl;
    1251             *fLog << "Try to use a different extractor (e.g. with a window size of only 4 sl.) or:" << endl;
    1252             *fLog << "Set the limit to a lower value (callisto.rc: line 329): " << endl;
    1253             *fLog << "    MJPedestalY2:ExtractWinRight: 4.5           " << endl;
    1254             *fLog << "(ATTENTION, you will lose late cosmics pulses!)" << endl;
    1255             *fLog << endl;
    1256             return kFALSE;
    1257           }
    1258         //
    1259         // Set and store the new ranges
    1260         //
    1261         fExtractor->SetRange(newfirst,newlast+wshigain,
    1262                              newfirst>0?newfirst-1:newfirst,numlogainsamples-1);
    1263       }
    1264    
     1240    if (!PulsePosCheck(plist))
     1241        return kFALSE;
    12651242
    12661243    *fLog << all << GetDescriptor() << ": Done." << endl;
  • trunk/MagicSoft/Mars/mjobs/MJPedestal.h

    r7043 r7069  
    2626{
    2727private:
    28 
    2928    static const TString  fgReferenceFile;    //! default for fReferenceFile ("pedestalref.rc")
    3029    static const TString  fgBadPixelsFile;    //! default for fBadPixelsFile ("badpixels_0_559.rc")
     
    8382    void   DisplayOutliers(TH1D *hist) const;
    8483    void   FixDataCheckHist(TH1D *hist) const;
     84    Bool_t PulsePosCheck(const MParList &plist) const;
    8585
    8686    Bool_t CheckEnvLocal();
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSlidingWindow.cc

    r7043 r7069  
    7575const Byte_t  MExtractTimeAndChargeSlidingWindow::fgLoGainLast   = 14;
    7676const Byte_t  MExtractTimeAndChargeSlidingWindow::fgHiGainWindowSize = 6;
    77 const Byte_t  MExtractTimeAndChargeSlidingWindow::fgLoGainWindowSize = 6;
     77const Byte_t  MExtractTimeAndChargeSlidingWindow::fgLoGainWindowSize = 8;
    7878
    7979// --------------------------------------------------------------------------
  • trunk/MagicSoft/Mars/msignal/MExtractor.cc

    r7043 r7069  
    434434    *fLog << " Saturation Lim:     " << (int)fSaturationLimit << endl;
    435435    *fLog << " Num Samples HiGain: " << fNumHiGainSamples << "  LoGain: " << fNumLoGainSamples << endl;
    436 }
     436    if (fPedestals)
     437        *fLog << " Pedestals:          " << fPedestals->GetName() << ", " << fPedestals << endl;
     438}
Note: See TracChangeset for help on using the changeset viewer.