Ignore:
Timestamp:
03/03/05 22:18:05 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mjobs/MJPedestal.cc

    r6727 r6730  
    6262
    6363// Other basic classes
    64 #include "MExtractTimeAndChargeSlidingWindow.h"
     64#include "MExtractTimeAndCharge.h"
    6565
    6666// parameter containers
     
    7878#include "MReadMarsFile.h"
    7979#include "MRawFileRead.h"
     80#include "MRawEvtData.h"
    8081#include "MGeomApply.h"
    8182#include "MBadPixelsMerge.h"
     
    8384#include "MPedCalcPedRun.h"
    8485#include "MPedCalcFromLoGain.h"
     86#include "MFTriggerPattern.h"
    8587
    8688#include <fstream>
     
    978980
    979981    MFillH fillped(&hpedcam, "MPedestalCamIntermediate", "FillPedCam");
    980     MFillH fillpul("MHCalibrationPulseTimeCam",   "MExtractedSignalCam", "FillPulseTime");
     982    MFillH fillpul("MHCalibrationPulseTimeCam", "MRawEvtData", "FillPulseTime");
    981983    //    MFillH fillped(&fPedestalHist, "MPedestalCamIntermediate", "FillPedCam");
    982984    fillped.SetBit(MFillH::kDoNotDisplay);
     
    996998      }
    997999
    998     MExtractTimeAndChargeSlidingWindow exttest;
    999 
    1000     if (fPulsePosCheck && fExtractionType != kFundamental)
     1000    MFTriggerPattern fcalib("CalibFilter");
     1001    fcalib.RequireCalibration();
     1002    fcalib.SetInverted();
     1003
     1004    if (fPulsePosCheck)
    10011005      {
    1002         exttest.SetRange(0,25,0,0);
    1003         exttest.SetPedestals(&fPedestalCamIn);
    1004         tlist.AddToList(&exttest);
     1006        fillpul.SetFilter(&fcalib);
    10051007        tlist.AddToList(&fillpul);
    10061008      }
     
    11861188      }
    11871189   
    1188     if (fPulsePosCheck && fExtractionType != kFundamental)
     1190    if (fDisplayType!=kDisplayNone)
     1191        DisplayResult(plist);
     1192
     1193    if (!WriteResult())
     1194        return kFALSE;
     1195
     1196    if (fPulsePosCheck)
    11891197      {
     1198
     1199        MHCalibrationPulseTimeCam *hcam = (MHCalibrationPulseTimeCam*)plist.FindObject("MHCalibrationPulseTimeCam");
     1200        if (fPixelCheck)
     1201          {
     1202            hcam->DrawClone();
     1203            MHCalibrationPix &pix = (*hcam)[fCheckedPixId];
     1204            pix.DrawClone();
     1205          }
     1206       
    11901207        MCalibrationPulseTimeCam *cam = (MCalibrationPulseTimeCam*)plist.FindObject("MCalibrationPulseTimeCam");
     1208        MRawEvtData *data = (MRawEvtData*)plist.FindObject("MRawEvtData");
    11911209        if (cam)
    11921210          {
    11931211            const Float_t meanpulsetime = cam->GetAverageArea(0).GetHiGainMean();
    1194             const Float_t sigmapulsetime = cam->GetAverageArea(0).GetHiGainSigma();
    1195             *fLog << inf << "Mean pulse time (cosmics): " << meanpulsetime << "+-" << sigmapulsetime << endl;
     1212            const Float_t rmspulsetime = cam->GetAverageArea(0).GetHiGainRms();
     1213            *fLog << inf << "Mean pulse time (cosmics): " << meanpulsetime << "+-" << rmspulsetime << endl;
     1214            const Int_t newfirst = 1.5*rmspulsetime > 3.
     1215              ? (Int_t)(meanpulsetime-1.5*rmspulsetime)
     1216              : (Int_t)(meanpulsetime-3.);
     1217            const Int_t wshigain = fExtractor->InheritsFrom("MExtractTimeAndCharge")
     1218              ? ((MExtractTimeAndCharge*)fExtractor)->GetWindowSizeHiGain()
     1219              : 6;
     1220            const Int_t wslogain = fExtractor->InheritsFrom("MExtractTimeAndCharge")
     1221              ? ((MExtractTimeAndCharge*)fExtractor)->GetWindowSizeLoGain()
     1222              : 6;
     1223            const Int_t newlast  = 1.5*rmspulsetime > 3.
     1224              ? (Int_t)(meanpulsetime+1.5*rmspulsetime)
     1225              : (Int_t)(meanpulsetime+3.);
     1226            *fLog << inf << "Try to set new range limits: ("<<newfirst<<","<<newlast+wshigain<<")"<<endl;
     1227            if (newfirst < 0)
     1228              {
     1229                *fLog << err << "Pulse is too much to the left, cannot go below 0! " << endl;
     1230                return kFALSE;
     1231              }
     1232            if (newlast+wshigain > data->GetNumHiGainSamples())
     1233              {
     1234                *fLog << err << "Pulse is too much to the right, cannot go beyond higain limits! "
     1235                      << " Try to use a different extractor ... " << endl;
     1236                return kFALSE;
     1237              }
     1238            if (newlast+wslogain > data->GetNumLoGainSamples())
     1239              {
     1240                *fLog << err << "Pulse is too much to the right, cannot go beyond logain limits! "
     1241                      << " Try to use a different extractor ... " << endl;
     1242                return kFALSE;
     1243              }
     1244            fExtractor->SetRange(newfirst,newlast+wshigain,newfirst,data->GetNumLoGainSamples());
     1245          }
     1246        else
     1247          {
     1248            *fLog << err << "Could not determine mean pulse position, abort... " << endl;
     1249            return kFALSE;
    11961250          }
    11971251      }
    11981252   
    11991253
    1200     if (fDisplayType!=kDisplayNone)
    1201         DisplayResult(plist);
    1202 
    1203     if (!WriteResult())
    1204         return kFALSE;
    1205 
    12061254    *fLog << all << GetDescriptor() << ": Done." << endl;
    12071255    *fLog << endl << endl;
Note: See TracChangeset for help on using the changeset viewer.