Ignore:
Timestamp:
05/18/04 10:16:45 (21 years ago)
Author:
rico
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mtemp/mifae/programs
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mtemp/mifae/programs/falseSource.cc

    r4045 r4094  
    1616
    1717#include "TString.h"
    18 #include "TH1F.h"
     18#include "TH2F.h"
    1919#include "TFile.h"
    2020
    2121#include "MHillasSrcCalc.h"
    2222#include "MSrcPosCam.h"
     23#include "MSrcTranslate.h"
    2324#include "MHillasSrc.h"
    2425#include "MSrcRotate.h"
     
    4344TString offFile;
    4445TString outputFile;
    45 Bool_t kRotate=1;
     46Bool_t  kRotate=1;
     47Bool_t  kSrcPolicy=kFALSE;
    4648Double_t fRA= -1.;
    4749Double_t fDEC= -1.;
     
    7375const Float_t alphamax = 90.;      // maximum value in alpha (degrees)
    7476const Float_t conver   = 189./0.6; // conversion factor degrees to mm
     77const Float_t srclimit = field*conver;
     78const Float_t srcstep  = 3.;
     79const Int_t   nsrcbin  = (Int_t) (srclimit/srcstep);
    7580
    7681//-----------------------------------------------------------------------------
     
    131136 
    132137  // create the histograms (empty)
    133   TH1F *hOnAlpha[binning][binning];
    134   TH1F *hOffAlpha[binning][binning];
     138  TH1F* hOnAlpha[binning][binning];
     139  TH1F* hOffAlpha[binning][binning];
     140  TH2F* hOnSrcPos[binning];
     141  TH2F* hOffSrcPos[binning];
     142
    135143  for(Int_t i = -ival; i <= ival ; i++){ 
    136144    for(Int_t j = -ival; j <= ival ; j++){
     
    144152      hOffAlpha[i+ival][j+ival] = new TH1F(name, title, nbin, alphamin, alphamax);
    145153
     154      if(j==0)
     155        {
     156          sprintf(name,"hOnSrcPos[%d]", i);
     157          sprintf(title,"Source position (On data) (%d)", i);
     158          hOnSrcPos[i+ival] = new TH2F(name, title, nsrcbin, -srclimit, srclimit, nsrcbin, -srclimit, srclimit);
     159         
     160          sprintf(name,"hOffSrcPos[%d]", i);
     161          sprintf(title,"Source position (Off data) (%d)", i);
     162          hOffSrcPos[i+ival] = new TH2F(name, title, nsrcbin, -srclimit, srclimit, nsrcbin, -srclimit, srclimit);
     163        }
    146164    }
    147165  }
     
    154172 
    155173  // source dependent hillas containers/tasks
    156   MHillasSrcCalc* csrc1[binning][binning];
    157174  MSrcPosCam*     source[binning][binning];
    158175  MHillasSrc*     hillasSrc[binning][binning];
     176  MSrcTranslate*  srctranslate[binning][binning];
    159177  MSrcRotate*     srcrotate[binning][binning];
     178  MHillasSrcCalc* csrc1[binning][binning];
    160179
    161180  // normal containers/classes
     
    171190  tlist.AddToList(&read);
    172191   
    173   Int_t k,l; 
    174192  char sourceName[100]; 
    175193  char hillasSrcName[100];
     194  char translateName[100]; 
     195  char rotateName[100];
    176196
    177197  // create the tasks/containers for the different source positions
     
    186206          if (i<0 && j<0)
    187207            {
    188               k = -i;
    189               l = -j;
     208              Int_t k = -i;
     209              Int_t l = -j;
    190210              sprintf(sourceName,    "MSrcPosCam_Min%dMin%d", k, l);
    191211              sprintf(hillasSrcName, "MHillasSrc_Min%dMin%d", k, l);
     212              sprintf(translateName, "MSrcTranslate_Min%dMin%d", k, l);
     213              sprintf(rotateName,    "MSrcRotate_Min%dMin%d", k, l);
    192214            }
    193215         
    194216          if (i<0 && j>=0)
    195217            {
    196               k = -i;
     218              Int_t k = -i;
    197219              sprintf(sourceName,    "MSrcPosCam_Min%d%d", k, j);
    198220              sprintf(hillasSrcName, "MHillasSrc_Min%d%d", k, j);
     221              sprintf(translateName, "MSrcTranslate_Min%d%d", k, j);
     222              sprintf(rotateName,    "MSrcRotate_Min%d%d", k, j);
    199223            }
    200224         
    201225          if (i>=0 && j<0)
    202226            {
    203               l = -j;
     227              Int_t l = -j;
    204228              sprintf(sourceName,    "MSrcPosCam_%dMin%d", i, l);
    205229              sprintf(hillasSrcName, "MHillasSrc_%dMin%d", i, l);
     230              sprintf(translateName, "MSrcTranslate_%dMin%d", i, l);
     231              sprintf(rotateName,    "MSrcRotate_%dMin%d", i, l);
    206232            }
    207233         
     
    210236              sprintf(sourceName,    "MSrcPosCam_%d%d", i, j);
    211237              sprintf(hillasSrcName, "MHillasSrc_%d%d", i, j);
     238              sprintf(translateName, "MSrcTranslate_%d%d", i, j);
     239              sprintf(rotateName,    "MSrcRotate_%d%d", i, j);
    212240            }
    213241
    214242          // include containers in parameter list
    215243          source[i+ival][j+ival] = new MSrcPosCam(sourceName);
    216           source[i+ival][j+ival]->SetXY(xpos, ypos);     
    217244          plist.AddToList(source[i+ival][j+ival]);
    218           source[i+ival][j+ival]->Print();
    219245                 
    220246          hillasSrc[i+ival][j+ival] = new MHillasSrc(hillasSrcName);     
     
    222248         
    223249          // define the different tasks and include them in the task list
    224           if(kRotate)
     250          srctranslate[i+ival][j+ival] = new MSrcTranslate("MSrcPosCam",sourceName,"MDCA",translateName);         
     251          srctranslate[i+ival][j+ival]->SetTranslation(xpos,ypos);       
     252          srctranslate[i+ival][j+ival]->SetRelativeTranslation(kSrcPolicy);
     253          srctranslate[i+ival][j+ival]->SetInternalHistoBinSize(5.);
     254          srctranslate[i+ival][j+ival]->SetMode(MSrcPlace::kOn);
     255     
     256          tlist.AddToList(srctranslate[i+ival][j+ival]); 
     257
     258          if(kRotate && !kSrcPolicy)
    225259            {
    226               srcrotate[i+ival][j+ival] = new MSrcRotate(sourceName);
     260              srcrotate[i+ival][j+ival] = new MSrcRotate(sourceName,sourceName,"MDCA",rotateName);
    227261              srcrotate[i+ival][j+ival]->SetRAandDEC(fRA,fDEC);   
     262
     263              srctranslate[i+ival][j+ival]->SetCreateHisto(kFALSE);
     264              srcrotate[i+ival][j+ival]->SetMode(MSrcPlace::kOn);             
     265              srcrotate[i+ival][j+ival]->SetInternalHistoBinSize(5.);
     266
    228267              tlist.AddToList(srcrotate[i+ival][j+ival]); 
    229268            }
     269          else
     270            srcrotate[i+ival][j+ival] = NULL;
     271
    230272
    231273          TString HilName = "MHillas";   
     
    266308                hOnAlpha[i+ival][j+ival]->Fill(TMath::Abs(alpha));
    267309              }
     310
     311            // fill source position histo
     312            if(j==0)
     313              hOnSrcPos[i+ival]->Fill(source[i+ival][j+ival]->GetX(),source[i+ival][j+ival]->GetY());
    268314          }
    269315      if(++nread>nmaxevents) break;
     
    278324                        FILL OFF-DATA HISTOS
    279325  *******************************************************************/
     326 for(Int_t i=-ival;i<=ival;i++)
     327   for(Int_t j=-ival;j<=ival;j++)
     328     {
     329       if(srcrotate[i+ival][j+ival])
     330         srcrotate[i+ival][j+ival]->SetMode(MSrcPlace::kOff);
     331       srctranslate[i+ival][j+ival]->SetMode(MSrcPlace::kOff);
     332     }
     333
    280334 
    281335  MReadTree read2("Parameters", offFile);
     
    306360                hOffAlpha[i+ival][j+ival]->Fill(TMath::Abs(alpha));           
    307361              }         
     362
     363            // fill source position histo
     364            if(j==0)
     365              hOffSrcPos[i+ival]->Fill(source[i+ival][j+ival]->GetX(),source[i+ival][j+ival]->GetY());
    308366          }
    309367      if(++nread>nmaxevents) break;
     
    319377      hOnAlpha[i+ival][j+ival]->Write();
    320378      hOffAlpha[i+ival][j+ival]->Write();
     379      if(j==0)
     380        {
     381          hOnSrcPos[i+ival]->Write();
     382          hOffSrcPos[i+ival]->Write();
     383        }
    321384    }
    322385  }
     
    324387  f->Close();
    325388
     389 for(Int_t i=-ival;i<=ival;i++)
     390   for(Int_t j=-ival;j<=ival;j++)
     391     {
     392       if(srcrotate[i+ival][j+ival])
     393         delete srcrotate[i+ival][j+ival];
     394       delete srctranslate[i+ival][j+ival];
     395       delete source[i+ival][j+ival];
     396       delete hillasSrc[i+ival][j+ival];
     397       delete csrc1[i+ival][j+ival];
     398     }
    326399}
    327400//-----------------------------------------------------------------------
     
    379452        ifun >> kRotate;
    380453
     454      // source movement policy flag
     455      if(strcmp(word.Data(),"SRCABS")==0)
     456        ifun >> kSrcPolicy;       
     457
     458
    381459      // source celestial coordinates
    382460      if(strcmp(word.Data(),"SRCCOORDS")==0)
     
    394472        ifun >> binning;
    395473
    396 
    397474      // Number of bins in alpha plots
    398475      if(strcmp(word.Data(),"NBIN")==0)
    399476        ifun >> nbin;
    400 
    401      
    402 
    403477
    404478      // size cut
     
    461535  cout << "Off-data file name(s): " << offFile << endl;
    462536  cout << "Output file name: " << outputFile << endl;
    463   cout << "De-rotation flag " << kRotate << endl;
    464   cout << "Source celestial coordiantes (rad): RA = " << fRA << ", DEC = " << fDEC << endl;
     537  if(kSrcPolicy)
     538    cout << "Source position displaced with respect to the original existing one (no rotation applied)" << endl;
     539  else
     540    {
     541      cout << "De-rotation flag " << kRotate << endl;
     542      cout << "Source celestial coordiantes (rad): RA = " << fRA << ", DEC = " << fDEC << endl;
     543    }
    465544  cout << "Field width (degrees): " << field << endl;
    466545  cout << "Field binning: " << binning << endl;
  • trunk/MagicSoft/Mars/mtemp/mifae/programs/falsesource.datacard

    r3973 r4094  
    44
    55// On-data file name pattern
    6 ONFILES  /mnt/users/jrico/magic/mars/Mars_Standard01/hillasCrab/crab20040215On*.root
     6ONFILES  ./srcPosPrueba.root
    77
    88// Off-data file name pattern
    9 OFFFILES /mnt/users/jrico/magic/mars/Mars_Standard01/hillasCrab/crab20040215Off*.root
     9OFFFILES ./srcPosOffPrueba.root
    1010
    1111// output file name
    12 OUTFILE  ./rotateprueba.root
     12OUTFILE  ./rotateprueba2.root
    1313
    1414// rotation flag:
     
    1919// source coordinates (RA DEC in rads)
    2020SRCCOORDS 1.46 0.384
     21
     22// Flag to determine whether source position is absolute (0) or relative to previous position (1)
     23// In case SRCABS=1, no rotation is carried out
     24SRCABS 1
    2125
    2226// Width of examined field (degrees)
  • trunk/MagicSoft/Mars/mtemp/mifae/programs/srcPos.cc

    r4084 r4094  
    128128      srctranslate.SetTranslation(xpos,ypos);
    129129      srctranslate.SetRelativeTranslation(kSrcPolicy);
     130      srctranslate.SetCreateHisto(kFALSE);
    130131      srcrotate.SetRAandDECandRefMJD(fRA,fDEC,mjdpos);
    131132      srcrotate.SetMode(MSrcPlace::kOn);
     
    164165 
    165166  tlist.PrintStatistics();
    166 
    167167 
    168168  // do off-data if input file was specified
     
    196196
    197197  tlist.PrintStatistics();
    198 
    199198}
    200199//-----------------------------------------------------------------------
  • trunk/MagicSoft/Mars/mtemp/mifae/programs/srcpos.datacard

    r4087 r4094  
    11
    22// Maximun number of on and off events to be processed)
    3 NEVENTS 20000
     3NEVENTS 9999999
    44
    5 // Input file name pattern
     5// Input file name pattern (wildcards allowed)
    66INPUTFILES /mnt/users/jrico/magic/mars/Mars_Standard02/mtemp/mifae/hillas/mrk20040215OnNoCalB.root
    77
Note: See TracChangeset for help on using the changeset viewer.