Changeset 3795 for trunk


Ignore:
Timestamp:
04/22/04 15:45:20 (21 years ago)
Author:
stamerra
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2.cc

    r2918 r3795  
    6868// Correspondence TABLE between pixel numbering in the trigger cells and
    6969// the standard spiral counting
    70 // (Note: Pixels start to count from 1 instead of 0)
     70// (*Note*: Pixels start to count ** from 1 ** instead of 0)
    7171//
    7272// This correspondence is valid only for MAGIC-like geometries!
     
    812812void MMcTriggerLvl2::GetEnergy(MMcEvt *fMcEvt)
    813813{
    814   const MMcEvt &h = *(MMcEvt *)fMcEvt;
    815   fEnergy = h.GetEnergy();
    816   return;
     814   const MMcEvt &h = *(MMcEvt *)fMcEvt;
     815   fEnergy = h.GetEnergy();
     816   return;
    817817}
    818818
     
    10071007}
    10081008
     1009//---------------------------------------------------------------------
     1010//  Check if a given pixel is in the trigger region
     1011//
     1012Bool_t MMcTriggerLvl2::IsPixelInTrigger(Int_t pixel) const
     1013{
     1014  for (int cell=0; cell<gsNCells; cell++)
     1015    for (int i=0; i<gsNPixInCell; i++)
     1016      if ((gsPixelsInCell[i][cell]-1) == pixel)
     1017        return kTRUE;
     1018 
     1019  return kFALSE;
     1020}
     1021
     1022// --------------------------------------------------------------------------
     1023//
     1024// Returns, depending on the type flag:
     1025//
     1026//  0: 1,0 if the pixel is triggered (1) or not (0)
     1027//
     1028//
     1029Bool_t MMcTriggerLvl2::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
     1030{
     1031  // Pixel in no-trigger region are set to 0
     1032  val = this->IsPixelInTrigger(idx) ?  fFiredPixel[idx]+fCompactPixel[idx] : 0;
     1033
     1034  return kTRUE;
     1035}
     1036
     1037void MMcTriggerLvl2::DrawPixelContent(Int_t num) const
     1038{
     1039    *fLog << "MMcTriggerLvl2::DrawPixelContent - not available." << endl;
     1040}
  • trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2.h

    r2919 r3795  
    11#ifndef MARS_MMcTriggerLvl2
    22#define MARS_MMcTriggerLvl2
     3
     4#ifndef MARS_MCamEvent
     5#include "MCamEvent.h"
     6#endif
    37
    48#ifndef MARS_MParContainer
     
    1216class MGeomPix;
    1317
    14 class MMcTriggerLvl2 : public MParContainer
     18class MMcTriggerLvl2 : public MParContainer, public MCamEvent
    1519{
    1620 private:
     
    8690  Int_t GetTriggerPattern() const {return fTriggerPattern;}   
    8791
    88   void GetEnergy(MMcEvt *fMcEvt = NULL);   
    89   Double_t GetEnergy() const    {return fEnergy;}     
     92  void GetEnergy(MMcEvt *fMcEvt = NULL);     
     93  Double_t GetEnergy() const    {return fEnergy;}      
    9094
    9195  Bool_t IsPixelInCell(Int_t pixel, Int_t cell);   
     96  Bool_t IsPixelInTrigger(Int_t pixel) const;   
     97
     98  Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
     99  void DrawPixelContent(Int_t num) const;
     100
    92101
    93102  ClassDef(MMcTriggerLvl2,0) // Container for 2nd Level Trigger selection parameters
  • trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2Calc.cc

    r2446 r3795  
    4343#include "MLogManip.h"
    4444
    45 #include "MMcEvt.hxx"
     45//#include "MMcEvt.hxx"
    4646#include "MMcTrig.hxx"
     47#include "MRawRunHeader.h"
    4748#include "MMcRunHeader.hxx"
    4849
     
    6162{
    6263  fName  = name  ? name  : "MMcTriggerLvl2Calc";
    63   fTitle = title ? title : "Task to Fill the MMcTriggerLvl2 object";
     64  fTitle = title ? title : "Task to Fill the MMcTriggerLvl2 object"; 
     65}
     66
     67 // --------------------------------------------------------------------------
     68//
     69// Check for the run type. Return kTRUE if it is a MC run or if there
     70// is no MC run header (old camera files) kFALSE in case of a different
     71// run type
     72//
     73Bool_t MMcTriggerLvl2Calc::CheckRunType(MParList *pList) const
     74{
     75  const MRawRunHeader *run = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
     76  if (!run)
     77    {
     78      *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl;
     79      return kTRUE;
     80    }
    6481 
    65 }
    66 
    67 
    68 // --------------------------------------------------------------------------
    69 //                                                                         
    70 //  PreProcess
    71 //
    72 //
    73 Int_t MMcTriggerLvl2Calc::PreProcess (MParList *pList)
    74 {
    75     // connect the raw data with this task
    76 
     82  return run->IsMonteCarloRun();
     83}
     84
     85// --------------------------------------------------------------------------
     86//
     87// Check for the runtype.
     88// Search for .
     89//
     90Bool_t MMcTriggerLvl2Calc::ReInit(MParList *pList)
     91{
     92    //
     93    // If it is no MC file skip this function...
     94    //
     95    if (!CheckRunType(pList))
     96    {
     97        *fLog << inf << "This is no MC file... skipping." << endl;
     98        return kTRUE;
     99    }
     100       
     101    //
     102    // Check all necessary containers
     103    //
    77104    fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
    78     if (!fMcEvt)
    79     {
    80         *fLog << err << dbginf << "MMcEvt not found... exit." << endl;
    81         return kFALSE;
    82     }
     105     if (!fMcEvt)
     106     {
     107         *fLog << err << dbginf << "MMcEvt not found... exit." << endl;
     108         return kFALSE;
     109     }
    83110
    84111    fMcTrig = (MMcTrig*)pList->FindObject("MMcTrig");
     
    102129        return kFALSE;
    103130      }
    104     fMMcTriggerLvl2 = (MMcTriggerLvl2*)pList->FindObject("MMcTriggerLvl2");
     131
     132    return kTRUE;
     133}
     134
     135
     136// --------------------------------------------------------------------------
     137//                                                                         
     138//  PreProcess
     139//  Check the exxistence of the MMcTriggerLvl2 containers and the correct
     140//    setting of the fCompactNN that defines a compact pixel
     141//
     142Int_t MMcTriggerLvl2Calc::PreProcess (MParList *pList)
     143{
     144
     145    //    fMMcTriggerLvl2 = (MMcTriggerLvl2*)pList->FindObject("MMcTriggerLvl2");
     146    fMMcTriggerLvl2 = (MMcTriggerLvl2*)pList->FindCreateObj("MMcTriggerLvl2");
    105147    if (!fMMcTriggerLvl2)
    106148    {
     
    138180Int_t MMcTriggerLvl2Calc::Process()
    139181{
    140   fMMcTriggerLvl2->GetEnergy(fMcEvt);
     182  //  fMMcTriggerLvl2->GetEnergy(fMcEvt);
    141183
    142184  fMMcTriggerLvl2->SetLv1(fMcTrig);
  • trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2Calc.h

    r2365 r3795  
    3232  Int_t PostProcess();
    3333
     34  Bool_t ReInit(MParList *pList);
     35  Bool_t CheckRunType(MParList *pList) const;
     36
    3437 public:
    3538    MMcTriggerLvl2Calc(const char *name=NULL, const char *title=NULL);   
  • trunk/MagicSoft/Mars/mhist/MHEvent.cc

    r3400 r3795  
    5353
    5454#include "MMcEvt.hxx"
     55#include "MMcTrig.hxx"
    5556
    5657#include "MHCamera.h"
     
    9596    fMcEvt       = (MMcEvt*)plist->FindObject("MMcEvt");
    9697
    97     fRawEvtData = (MRawEvtData*)plist->FindObject("MRawEvtData");
    98     if (!fRawEvtData)
     98     fRawEvtData = (MRawEvtData*)plist->FindObject("MRawEvtData");
     99     if (!fRawEvtData)
    99100        *fLog << warn << "MRawEvtData not found..." << endl;
    100101
     
    161162        fHist->SetPrettyPalette();
    162163        break;
     164     case kEvtTrigPix:
     165        fHist->SetName("Triggered pix");
     166        fHist->SetYTitle("ON/OFF");
     167        fHist->SetPrettyPalette();
     168        break;
    163169    }
    164170
     
    214220        break;
    215221    case kEvtArrTime:
     222        fHist->SetCamContent(*event, 0);
     223        break;
     224    case kEvtTrigPix:
    216225        fHist->SetCamContent(*event, 0);
    217226        break;
  • trunk/MagicSoft/Mars/mhist/MHEvent.h

    r3239 r3795  
    1212
    1313class MMcEvt;
     14class MMcTrig;
    1415class MCerPhotEvt;
    1516class MImgCleanStd;
     
    2223        kEvtSignalRaw, kEvtSignalDensity, kEvtPedestal,
    2324        kEvtPedestalRMS, kEvtRelativeSignal, kEvtCleaningLevels,
    24         kEvtIdxMax, kEvtArrTime
     25        kEvtIdxMax, kEvtArrTime, kEvtTrigPix
    2526    };
    2627
     
    3132
    3233    MMcEvt        *fMcEvt;         //!
     34    MMcTrig       *fMcTrig;        //!
    3335    MCerPhotEvt   *fCerPhotEvt;    //!
    3436    MImgCleanStd  *fImgCleanStd;   //!
  • trunk/MagicSoft/Mars/mhistmc/Makefile

    r2800 r3795  
    2323#
    2424INCLUDES = -I. -I../mbase -I../mhbase -I../mhist -I../mmc -I../manalysis \
    25            -I../mimage -I../mgeom
     25           -I../mimage -I../mgeom -I../mgui
    2626
    2727#------------------------------------------------------------------------------
  • trunk/MagicSoft/Mars/mmain/MEventDisplay.cc

    r3768 r3795  
    7575#include "MMcCalibrationUpdate.h" // MMcCalibrationUpdate
    7676#include "MCalibrate.h"           // MCalibrate
     77#include "MMcTriggerLvl2Calc.h"   // MMcTriggerLvl2Calc
    7778
    7879//
     
    9091#include "MPedPhotCam.h"           // MPedPhotCam
    9192#include "MCalibrationChargeCam.h" // MCalibrationChargeCam
     93#include "MMcTriggerLvl2.h"        // MMcTriggerLvl2
    9294
    9395ClassImp(MEventDisplay);
     
    221223    MHEvent *evt7 = new MHEvent(MHEvent::kEvtIdxMax);
    222224    MHEvent *evt8 = new MHEvent(MHEvent::kEvtArrTime);
     225    MHEvent *evt9 = new MHEvent(MHEvent::kEvtTrigPix);
    223226
    224227    evt1->SetName("Signal");
     
    230233    evt7->SetName("Max Slice Idx");
    231234    evt8->SetName("Arrival Time");
     235    evt9->SetName("Trigger");
    232236
    233237    // This makes sure, that the containers are deleted...
     
    240244    plist->AddToList(evt7);
    241245    plist->AddToList(evt8);
     246    plist->AddToList(evt9);
    242247
    243248    MCerPhotAnal2     *nanal = new MCerPhotAnal2;
     
    252257    MHillasCalc       *hcalc = new MHillasCalc;
    253258    MHillasSrcCalc    *scalc = new MHillasSrcCalc;
     259    MMcTriggerLvl2Calc *trcal = new MMcTriggerLvl2Calc;
     260    MFillH            *fill9 = new MFillH(evt9, "MMcTriggerLvl2", "MFillH9");
    254261
    255262    // If no pedestal or no calibration file is availble
     
    265272
    266273        MExtractSignal* extra = new MExtractSignal();
    267         extra->SetRange(5, 10, 5, 10);
     274        extra->SetRange(0, 6, 2, 7);
    268275        extra->SetSaturationLimit(240);
    269276
     
    278285        mcupd->SetFilter(f1);
    279286        mccal->SetFilter(f1);
     287        trcal->SetFilter(f1);
    280288
    281289        // Data
     
    292300        tlist->AddToList(mccal);
    293301
    294         tlist->AddToList(nanal);
     302 
     303        tlist->AddToList(nanal);
    295304    }
    296305    else
     
    310319    tlist->AddToList(hcalc);
    311320    tlist->AddToList(scalc);
     321
    312322    if (!pcam || !ccam)
    313323    {
     
    318328        tlist->AddToList(fill7);
    319329        tlist->AddToList(fill8);
     330
     331        tlist->AddToList(trcal);
     332        tlist->AddToList(fill9);
    320333    }
    321334
     
    518531    ((MHillasSrc*)  plist->FindObject("MHillasSrc"))->Print(*geom);
    519532    ((MNewImagePar*)plist->FindObject("MNewImagePar"))->Print(*geom);
    520 
     533   
    521534    //
    522535    // UpdateDisplay
Note: See TracChangeset for help on using the changeset viewer.