Jpp  pmt_effective_area_update
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JDarkroomNB.cc File Reference
#include <string>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include "Jeep/JParser.hh"
#include "km3net-dataformat/online/JDAQ.hh"
#include "km3net-dataformat/online/JDAQTimeslice.hh"
#include "JDAQ/JDAQEventIO.hh"
#include "JDAQ/JDAQTriggeredHitIO.hh"
#include "JDAQ/JDAQTimesliceIO.hh"
#include "JDAQ/JDAQSummarysliceIO.hh"
#include "JROOT/JManager.hh"
#include "JSupport/JMultipleFileScanner.hh"
#include "JSupport/JSupport.hh"
#include "JDetector/JDetector.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JDetector/JModuleRouter.hh"
#include "JTrigger/JSuperFrame2D.hh"
#include "JTrigger/JHitR0.hh"
#include "JTrigger/JHitL0.hh"
#include "JTrigger/JHitToolkit.hh"
#include "JTrigger/JTriggerParameters.hh"
#include "JTrigger/JTimesliceRouter.hh"
#include "TH1D.h"
#include "TH2D.h"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 43 of file JDarkroomNB.cc.

43  {
44 
46  string detectorFile;
48  string outFile;
49  double frequency;
50  int PMTSelector;
51  int Stagger;
52 
53  try {
54  JParser<> zap;
55 
56  zap['f'] = make_field(inputFiles );
57  zap['a'] = make_field(detectorFile );
58  zap['o'] = make_field(outFile ); //outfile
59  zap['H'] = make_field(frequency ); //flashing frequency in kHz
60  zap['P'] = make_field(PMTSelector ) = 0; //Select a PMT to analyze
61  zap['S'] = make_field(Stagger ) = 3520; //Currently this is the stagger offset used
62 
63  zap(argc,argv);
64  }
65  catch(const exception &error) {
66  ERROR(error.what() << endl);
67  }
68 
69  load(detectorFile, detector);
70  JModuleRouter moduleRouter(detector);
71 
73 
74  int pulse_period = 1e9/(frequency*1e3); //pulse period in ns and frequency in kHz
75 
76  JManager < string, TH2F >* Pulses; //time on x-axis and ToT on y axis
77  Pulses = new JManager < string, TH2F > ( new TH2F("%", "", Stagger, -0.5, Stagger-0.5, 256, -0.5, 255.5) );
78 
79  while( inputFiles.hasNext() ) {
80 
81  JDAQTimesliceL0 slice = *(inputFiles.next());
82  JTimesliceRouter timesliceRouter(triggerParameters.numberOfBins);
83 
84  timesliceRouter.configure(slice);
85 
86  for(JDetector::iterator module = detector.begin(); module != detector.end(); ++module){
87 
88  int String = module->getString();
89  int Floor = module->getFloor();
90 
91  if(timesliceRouter.hasSuperFrame( module->getID() )){
92  JDAQSuperFrame SuperFrame = timesliceRouter.getSuperFrame( module->getID() );
93  for(JDAQSuperFrame::const_iterator hit = SuperFrame.begin(); hit != SuperFrame.end(); ++hit){
94  int PMT = static_cast<int>(hit->getPMT());
95  if(PMT == PMTSelector){
96  double raw_time = hit->getT();
97  double time = raw_time - pulse_period * int(raw_time/pulse_period) - Stagger*(Floor - 1);
98  double ToT = hit->getToT();
99  (*Pulses)[ MAKE_STRING( "S"+to_string(String)+"F"+to_string(Floor) ).c_str() ]->Fill(time,ToT);
100  }
101  }
102  }
103  }
104  }
105 
106  cout << " Writing histograms to output" << endl;
107  TFile output(outFile.c_str() , "recreate") ;
108  Pulses -> Write(output);
109 
110 }
Utility class to parse command line options.
Definition: JParser.hh:1500
Router for fast addressing of hits in KM3NETDAQ::JDAQTimeslice data structure as a function of the op...
static const JPBS_t PMT(3, 4, 2, 3)
PBS of photo-multiplier tube (PMT)
Detector data structure.
Definition: JDetector.hh:81
Router for direct addressing of module data in detector data structure.
#define MAKE_STRING(A)
Make string.
Definition: JPrint.hh:142
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
Definition: JManager.hh:43
virtual bool hasNext() override
Check availability of next element.
Hit data structure.
Definition: JDAQHit.hh:34
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
const_iterator begin() const
Definition: JDAQFrame.hh:136
#define ERROR(A)
Definition: JMessage.hh:66
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
General purpose class for object reading from a list of file names.
General purpose string class.
Definition: JHead.hh:122
std::string to_string(const T &value)
Convert value to string.
virtual const pointer_type & next() override
Get next element.
do set_variable DETECTOR_TXT $WORKDIR detector
triggerParameters
Data frame of one optical module.
Timeslice data structure for L0 data.
const_iterator end() const
Definition: JDAQFrame.hh:137