Changeset 671


Ignore:
Timestamp:
03/05/01 10:36:52 (24 years ago)
Author:
blanch
Message:
A branch with information about the FADC simulation (MMcFadcHeader) is writen
in the McHeaders tree of the aoutput root file.
The NSB contribution is only applied if the the number of phe form the shower
are above a given number.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx

    r646 r671  
    2121//
    2222// $RCSfile: camera.cxx,v $
    23 // $Revision: 1.17 $
    24 // $Author: magicsol $
    25 // $Date: 2001-02-23 11:05:57 $
     23// $Revision: 1.18 $
     24// $Author: blanch $
     25// $Date: 2001-03-05 10:36:52 $
    2626//
    2727////////////////////////////////////////////////////////////////////////
     
    209209static int Write_McEvt  = TRUE;
    210210static int Write_McTrig = TRUE;
     211static int Write_McFADC = TRUE;
    211212static int Write_RawEvt = FALSE;
    212213
     
    234235static float Trigger_response_fwhm = 2.0;
    235236static float Trigger_overlaping_time= 0.25;
     237
     238//@: Properties of the FADC
     239static float FADC_response_ampl = MFADC_RESPONSE_AMPLITUDE;
     240static float FADC_response_fwhm = MFADC_RESPONSE_FWHM;
    236241
    237242//@: Trigger conditions for a single trigger mode
     
    422427
    423428  int simulateNSB;            //@< Will we simulate NSB?
     429  int nphe2NSB;               //@< From how many ohe will we simulate NSB?
    424430  float meanNSB;              //@< diffuse NSB mean value (phe per ns per central pixel)
    425   float diffnsb_phepns[iMAXNUMPIX];  //@< diffuse NSB values for each pixel derived
    426                                      //@< from meanNSB
     431  float diffnsb_phepns[iMAXNUMPIX];  //@< diffuse NSB values for each pixel
     432                                     //@< derived from meanNSB
    427433  float nsbrate_phepns[iMAXNUMPIX][iNUMWAVEBANDS];    //@< non-diffuse nsb
    428434                                                     //@< photoelectron rates
     
    435441  Byte_t trigger_map[((Int_t)(TRIGGER_PIXELS/8))+1];//@< Pixels on when the
    436442                                                    //@< camera triggers
     443  Float_t fadc_elecnoise[CAMERA_PIXELS];  //@< Electronic niose for each pixel
     444  UChar_t fadc_pedestals[CAMERA_PIXELS];  //@< array for fadc pedestals values
    437445
    438446  float ext[iNUMWAVEBANDS] = { //@< average atmospheric extinction in each waveband
     
    551559  Write_McEvt  = get_write_McEvt()  ;
    552560  Write_McTrig = get_write_McTrig() ;
     561  Write_McFADC = get_write_McFadc() ;
    553562  Write_RawEvt = get_write_RawEvt() ;
    554563
    555564  FADC_Scan = get_FADC_Scan();
    556565  Trigger_Scan = get_Trigger_Scan();
     566
     567  get_FADC_properties( &FADC_response_ampl, &FADC_response_fwhm);
    557568
    558569  get_Trigger_properties( &Trigger_gate_length, &Trigger_overlaping_time, &Trigger_response_ampl, &Trigger_response_fwhm);
     
    583594  qThreshold = get_threshold();
    584595  qTailCut = get_tail_cut();
    585   simulateNSB = get_nsb( &meanNSB );
     596  simulateNSB = get_nsb( &meanNSB, &nphe2NSB );
    586597  countIslands = get_islands_cut( &nIslandsCut );
    587598
     
    639650      "Write_McEvt",   ONoff(Write_McEvt), 
    640651      "Write_McTrig",  ONoff(Write_McTrig), 
     652      "Write_McFADC",  ONoff(Write_McFADC), 
    641653      "Write_RawEvt",  ONoff(Write_RawEvt));
    642654     
     
    716728  MMcTrig **McTrig;
    717729  MMcTrigHeader **HeaderTrig;
     730  MMcFadcHeader **HeaderFadc;
    718731
    719732  if (Write_McTrig){
     
    732745  }
    733746
    734   MFadc fadc ;                //@< A instance of the Class MFadc
     747  if (Write_McFADC){
     748
     749    HeaderFadc = new MMcFadcHeader * [icontrigger];
     750 
     751    for (i=0;i<icontrigger;i++) {
     752      HeaderFadc[i] = new MMcFadcHeader();
     753    }
     754  }
     755
     756  MFadc fadc(FADC_response_ampl,FADC_response_fwhm) ; //@< A instance of the Class MFadc
    735757
    736758  // Set the FADC pedestals for that run
     
    743765  // Prepare the raw data output
    744766
    745        // Header file
     767       // Header branch
    746768
    747769  MRawEvtHeader **EvtHeader;
     
    755777  }
    756778
    757        // Header file
     779       // Data branch
    758780
    759781  MRawEvtData **EvtData;    // Data branch
     
    801823  } 
    802824
    803   //  Fill branches
     825  if(!Trigger_Loop && Write_McFADC){
     826   
     827    HeaderTree.Branch("MMcFadcHeader","MMcFadcHeader",
     828                 &HeaderFadc[0], bsize, split);   
     829  }
     830  if (Trigger_Loop && Write_McFADC){
     831    for(char branchname[20],i=0;i<icontrigger;i++){
     832     
     833      sprintf(help,"%i",i+1);
     834      strcpy (branchname, "MMcFadcHeader");
     835      strcat (branchname, & help[0]);
     836      strcat (branchname, ".");
     837      HeaderTree.Branch(branchname,"MMcFadcHeader",
     838                     &HeaderFadc[i], bsize, split);
     839    }
     840  } 
     841
     842  //  Fill branches for MMcTrigHeader
    804843 
    805844  if(!Trigger_Loop && Write_McTrig){
     
    837876  }
    838877
     878  //  Fill branches for MMcFadcHeader
     879
     880  for(i=0;i<CAMERA_PIXELS;i++){
     881      fadc_elecnoise[i]=2.0;
     882  }
     883  fadc.GetPedestals(&fadc_pedestals[0]);
     884
     885  if(!Trigger_Loop && Write_McFADC){
     886
     887    HeaderFadc[0]->SetShape(0.0);
     888    HeaderFadc[0]->SetAmplitud(FADC_response_ampl);
     889    HeaderFadc[0]->SetFwhm(FADC_response_fwhm);
     890    HeaderFadc[0]->SetPedestal(&fadc_pedestals[0],anaPixels);
     891    HeaderFadc[0]->SetElecNoise(&fadc_elecnoise[0],anaPixels);
     892  }
     893  if(Trigger_Loop && Write_McTrig){
     894
     895    for (int iconcount=0,ithrescount=0;ithrescount<=Trigger_loop_uthres-Trigger_loop_lthres;ithrescount++){
     896      for (imulticount=0;imulticount<=Trigger_loop_umult-Trigger_loop_lmult;imulticount++){
     897        for(itopocount=0;itopocount<=Trigger_loop_utop-Trigger_loop_ltop;itopocount++){
     898          HeaderFadc[iconcount]->SetShape(0.0);
     899          HeaderFadc[iconcount]->SetAmplitud(Trigger_response_ampl);
     900          HeaderFadc[iconcount]->SetFwhm(Trigger_response_fwhm);
     901          HeaderFadc[iconcount]->SetPedestal(&fadc_pedestals[0],anaPixels);
     902          HeaderFadc[iconcount]->SetElecNoise(&fadc_elecnoise[0],anaPixels);
     903          iconcount++;
     904        }
     905      }   
     906    }
     907  }
     908
    839909  //  Fill the Header Tree with the current leaves of each branch
    840910  HeaderTree.Fill() ;
     
    9731043      for(j=0;j<iNUMWAVEBANDS;j++)
    9741044        nsb_phepns[i]=nsb_phepns[i]+ nsbrate_phepns[i][j];
    975       cout<<"Huschel "<<nsb_phepns[i]<<endl;
    9761045    }
    9771046  }
     
    11651234        inumphe=0;
    11661235
    1167         // NSB simulation
    1168 
    1169         if(simulateNSB){
    1170 
    1171           //  Fill trigger and fadc response in the trigger class from teh database
    1172           for(i=0;i<cam.inumpixels;i++)
    1173             if(nsb_phepns[i]>0.0){
    1174               k=lons.GetResponse(nsb_phepns[i],0.1,
    1175                                  & nsb_trigresp[0],& nsb_fadcresp[0]);
    1176               if(k==0){
    1177                 cout << "Exiting.\n";
    1178                 exit(1);
    1179               }
    1180               Trigger.SetNSB(i,nsb_trigresp);
    1181               fadc.Set(i,nsb_fadcresp);
    1182             }
    1183         }// end if(simulateNSB) ...
    1184 
    11851236        // read the photons and produce the photoelectrons
    11861237
     
    12021253          exit(1);
    12031254        }
     1255
     1256        // NSB simulation
     1257
     1258        if(simulateNSB && nphe2NSB<=inumphe){
     1259
     1260          //  Fill trigger and fadc response in the trigger class from the database
     1261          for(i=0;i<cam.inumpixels;i++)
     1262            if(nsb_phepns[i]>0.0){
     1263              k=lons.GetResponse(nsb_phepns[i],0.1,
     1264                                 & nsb_trigresp[0],& nsb_fadcresp[0]);
     1265              if(k==0){
     1266                cout << "Exiting.\n";
     1267                exit(1);
     1268              }
     1269              Trigger.AddNSB(i,nsb_trigresp);
     1270              fadc.AddSignal(i,nsb_fadcresp);
     1271            }
     1272        }// end if(simulateNSB && nphe2NSB<=inumphe) ...
    12041273 
    12051274        log(SIGNATURE, "End of this event: %d cphs(+%d). . .\n",
     
    31463215//
    31473216// $Log: not supported by cvs2svn $
     3217// Revision 1.17  2001/02/23 11:05:57  magicsol
     3218// Small changes due to slightly different output format and the introduction of
     3219// pedesals for teh FADC.
     3220//
    31483221// Revision 1.16  2001/01/18 18:44:40  magicsol
    31493222// *** empty log message ***
     
    31723245//
    31733246// $Log: not supported by cvs2svn $
     3247// Revision 1.17  2001/02/23 11:05:57  magicsol
     3248// Small changes due to slightly different output format and the introduction of
     3249// pedesals for teh FADC.
     3250//
    31743251// Revision 1.16  2001/01/18 18:44:40  magicsol
    31753252// *** empty log message ***
Note: See TracChangeset for help on using the changeset viewer.