Ignore:
Timestamp:
05/17/04 09:35:10 (20 years ago)
Author:
rico
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mtemp/mifae
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mtemp/mifae/Changelog

    r4074 r4084  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20       
     21 2004/05/17  Javier Rico
     22   * library/MSrcPlace.[cc,h], library/MSrcRotate.cc,
     23     library/MSrcTranslate.cc
     24     - Assign the internal histogram a class-dependent name
     25
     26   * library/MSrcPosFromFile.[cc,h]
     27     - Correct behaviour for not found runs.
     28     - Initialize pointers to NULL
     29
    2030       
    2131 2004/05/14  Javier Rico
  • trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcPlace.cc

    r4072 r4084  
    6262// -------------------------------------------------------------------------
    6363//
    64 // Default constructor. The first (second) argument is the name of a container
     64// Default constructor. The first argument is the name of the internal histo,
     65// the second (third) argument is the name of a container
    6566// containing the source position in the camera plain, MScrPosCam (MDCA).
    6667// The default is "MSrcPosCam" ("MDCA").
    6768//
    68 MSrcPlace::MSrcPlace(const char* srcPos, const char* dca, const char *name, const char *title)
     69MSrcPlace::MSrcPlace(const char* histname, const char* srcPos, const char* dca, const char *name, const char *title)
    6970  : fSrcPos(NULL), fDCA(NULL)
    7071{
     
    7677
    7778    const Float_t cameraSize   = 600; //[mm]
    78     const Float_t binPrecision =   1; //[mm] ~ 0.0033 deg
    79 
     79    const Float_t binPrecision =   1; //[mm] ~ 0.0033 deg 
    8080    const UInt_t nbins =  (UInt_t)(cameraSize*2/binPrecision);
    81     fHistSrcPos = new TH2F("HistSrcPos","",nbins,-cameraSize,cameraSize,nbins,-cameraSize,cameraSize);
     81   
     82    fHistPos = new TH2F(histname,"",nbins,-cameraSize,cameraSize,nbins,-cameraSize,cameraSize);
    8283
    8384    fMode=kOn;
     
    8990MSrcPlace::~MSrcPlace()
    9091{
    91   delete fHistSrcPos;
     92  if(fHistPos)
     93    delete fHistPos;
    9294}
    9395// -------------------------------------------------------------------------
     
    127129void MSrcPlace::SavePosIntoHisto()
    128130
    129   fHistSrcPos->Fill(fSrcPos->GetX(),fSrcPos->GetY());
     131  fHistPos->Fill(fSrcPos->GetX(),fSrcPos->GetY());
    130132}
    131133// -------------------------------------------------------------------------
     
    138140  Axis_t y;
    139141 
    140   fHistSrcPos->GetRandom2(x,y);
     142  fHistPos->GetRandom2(x,y);
    141143  fSrcPos->SetXY(x,y);
    142144  fDCA->SetRefPoint(x,y);
     
    147149//
    148150Int_t MSrcPlace::PreProcess(MParList* plist)
    149 {  
     151{
    150152  return SearchForSrcPos(plist);
    151153}
     
    183185  *fLog << inf << endl;
    184186  *fLog << inf << "MSrcPlace::PostProcess Message: Created internal histogram with: ";
    185   *fLog << inf << "Entries: " << fHistSrcPos->GetEntries() << endl;
    186   *fLog << inf << "X projection mean: " << fHistSrcPos->ProjectionX()->GetMean() << endl;
    187   *fLog << inf << "X projection rms:  " << fHistSrcPos->ProjectionX()->GetRMS() << endl;
    188   *fLog << inf << "Y projection mean: " << fHistSrcPos->ProjectionY()->GetMean() << endl;
    189   *fLog << inf << "Y projection rms:  " << fHistSrcPos->ProjectionY()->GetRMS() << endl;
     187  *fLog << inf << "Entries: " << fHistPos->GetEntries() << endl;
     188  *fLog << inf << "X projection mean: " << fHistPos->ProjectionX()->GetMean() << endl;
     189  *fLog << inf << "X projection rms:  " << fHistPos->ProjectionX()->GetRMS() << endl;
     190  *fLog << inf << "Y projection mean: " << fHistPos->ProjectionY()->GetMean() << endl;
     191  *fLog << inf << "Y projection rms:  " << fHistPos->ProjectionY()->GetRMS() << endl;
    190192 
    191193  return kTRUE;
  • trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcPlace.h

    r4072 r4084  
    2222  TString      fDCAName;     //  Name of the MDCA object
    2323 
    24   TH2F*        fHistSrcPos;  //  histogram of the used source positions
     24  TH2F*        fHistPos;  //  histogram of the used source positions
    2525  OnOffMode_t  fMode;        //  On/Off data mode (write/read to/from the histogram)
    2626
     
    3434
    3535 public:
    36   MSrcPlace(const char* src="MSrcPosCam", const char* dca="MDCA",
     36  MSrcPlace(const char* histname="HistSrcPos",
     37            const char* src="MSrcPosCam", const char* dca="MDCA",
    3738            const char* name=NULL, const char* title=NULL);
    3839
     
    4344  void SetDCAName(TString name)    {fDCAName=name;}
    4445
    45   OnOffMode_t GetMode()            {return fMode;}
    46   TH2F*       GetPositionHisto()   {return fHistSrcPos;}
    47   MSrcPosCam* GetSrcPosCam()       {return fSrcPos;}
    48   MDCA*       GetDCA()             {return fDCA;}
    49 
    50 
     46  OnOffMode_t   GetMode()            {return fMode;}
     47  TH2F*         GetPositionHisto()   {return fHistPos;}
     48  MSrcPosCam*   GetSrcPosCam()       {return fSrcPos;}
     49  MDCA*         GetDCA()             {return fDCA;}
     50 
    5151  Int_t SearchForSrcPos(MParList *plist);
    5252  virtual Int_t ComputeNewSrcPosition() {return kTRUE;}
  • trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcPosFromFile.cc

    r4074 r4084  
    6060//
    6161MSrcPosFromFile::MSrcPosFromFile(TString cardpath, OnOffMode_t mode, const char *name, const char *title)
    62   : fRawRunHeader(NULL), fSourcePositionFilePath(cardpath)
     62  : MSrcPlace(TString(gsDefName+"Hist").Data()), fRawRunHeader(NULL), fSourcePositionFilePath(cardpath)
    6363{
    6464  fName  = name  ? name  : gsDefName.Data();
     
    6666  SetMode(mode);
    6767
     68  fRunList=0x0;
     69  fRunSrcPos=0x0;
     70  fRunMap=0x0;
     71
    6872  fLastRun = 0;
    69  
     73  fLastValidSrcPosCam=0x0;
     74}
     75// -------------------------------------------------------------------------
     76//
     77// Destructor
     78//
     79MSrcPosFromFile::~MSrcPosFromFile()
     80{
     81  if(fRunList)
     82    delete [] fRunList;
     83  if(fRunSrcPos)
     84    delete [] fRunSrcPos;
     85  if(fRunMap)
     86    delete fRunMap;
     87}
     88
     89// -------------------------------------------------------------------------
     90//
     91// Open and read the input file.
     92Int_t MSrcPosFromFile::PreProcess(MParList *pList)
     93{
    7094  // Count the number of runs in the card with the source poistions
    7195  ReadSourcePositionsFile(kCount);
    7296 
    73   fRunList = new Int_t[fNumRuns];
    74   fRunSrcPos = new MSrcPosCam[fNumRuns];
    75   fRunMap = new TExMap(fNumRuns);
     97  if(!fRunList)
     98    fRunList = new Int_t[fNumRuns];
     99  if(!fRunSrcPos)
     100    fRunSrcPos = new MSrcPosCam[fNumRuns];
     101  if(!fRunMap)
     102    fRunMap = new TExMap(fNumRuns);
    76103 
    77104  // Read card with the source poistions
    78105  ReadSourcePositionsFile(kRead);
    79 }
    80 
    81 MSrcPosFromFile::~MSrcPosFromFile()
    82 {
    83   delete [] fRunList;
    84   delete [] fRunSrcPos;
    85   delete fRunMap;
    86 }
    87 
    88 // -------------------------------------------------------------------------
    89 //
    90 Int_t MSrcPosFromFile::PreProcess(MParList *pList)
    91 {
     106
     107
    92108  if(!SearchForSrcPos(pList))
    93109    return kFALSE;
     
    119135      Float_t y;
    120136       
     137      *fLog << inf << "Source position for run " << run;
    121138      if (srcpos)
    122139        {
     140          fLastValidSrcPosCam = srcpos;
    123141          x = srcpos->GetX();
    124142          y = srcpos->GetY();
     143        }           
     144      else if(fLastValidSrcPosCam)
     145        {
     146          x = fLastValidSrcPosCam->GetX();
     147          y = fLastValidSrcPosCam->GetY();
    125148         
    126           GetSrcPosCam()->SetXY(x,y);
    127                
    128           *fLog << inf << "Source position for run " << run;
    129           *fLog << inf << "\tX\t" << setprecision(3) << x;
    130           *fLog << inf << "\tY\t" << setprecision(3) << y << endl;
    131         }           
     149          *fLog << inf << " not found in file. Taking previous position: ";
     150        }
    132151      else
    133152        {
    134           *fLog << inf << "Source position for run " << run << " not found in file. ";
    135           *fLog << inf << "Taking previous position: ";
    136           *fLog << inf << "\tX\t" << setprecision(3) << x;
    137           *fLog << inf << "\tY\t" << setprecision(3) << y << endl;       
     153          *fLog << err << "MSrcPosFromFile::ComputeNewSrcPosition error: no value for the first run. Don't know what values to take" << endl;
     154          return kFALSE;
    138155        }
     156
     157      GetSrcPosCam()->SetXY(x,y);
     158     
     159      *fLog << inf << "\tX\t" << setprecision(3) << x;
     160      *fLog << inf << "\tY\t" << setprecision(3) << y << endl;     
    139161    }
    140162 
  • trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcPosFromFile.h

    r4074 r4084  
    2424    Int_t      *fRunList;
    2525    MSrcPosCam *fRunSrcPos;
     26    MSrcPosCam *fLastValidSrcPosCam;
    2627    TExMap     *fRunMap;   // list of run numbers positions
    2728
  • trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcRotate.cc

    r4072 r4084  
    6767//
    6868MSrcRotate::MSrcRotate(const char* srcPos, const char* dca, const char *name, const char *title)
    69   : fRA(0), fDEC(0), fRefMJD(0), fRunNumber(0)
     69  : MSrcPlace(TString(gsDefName+"Hist").Data()), fRA(0), fDEC(0), fRefMJD(0), fRunNumber(0)
    7070{
    7171    fName  = name  ? name  : gsDefName.Data();
  • trunk/MagicSoft/Mars/mtemp/mifae/library/MSrcTranslate.cc

    r4074 r4084  
    6666//
    6767MSrcTranslate::MSrcTranslate(const char* srcPos, const char* dca, const char *name, const char *title)
    68   : fShiftX(0.), fShiftY(0.), fTranslationIsRelative(kTRUE)
     68  : MSrcPlace(TString(gsDefName+"Hist").Data()), fShiftX(0.), fShiftY(0.), fTranslationIsRelative(kTRUE)
    6969{
    7070    fName  = name  ? name  : gsDefName.Data();
  • trunk/MagicSoft/Mars/mtemp/mifae/programs/srcPos.cc

    r4074 r4084  
    9393      return -1;
    9494    }
     95
    9596  srcPos();
    9697}
  • trunk/MagicSoft/Mars/mtemp/mifae/programs/srcpos.datacard

    r4074 r4084  
    3232
    3333// File containing source position as a function of run number (invalidates SRCPOS, SRCABS, ROTFLAG and SRCCOORDS values)
    34 SRCFILE ./20040215_Mrk421.B.pos
     34SRCFILE /mnt/users/jrico/magic/mars/Mars_Standard02/mtemp/mifae/programs/20040215_Mrk421.B.pos
    3535
    3636
Note: See TracChangeset for help on using the changeset viewer.