source: fact/tools/rootmacros/PulseTemplates/FPulseOverlay_filelist.C@ 14805

Last change on this file since 14805 was 14782, checked in by Jens Buss, 12 years ago
initial
File size: 52.0 KB
Line 
1/********************** FPulseOverlay ***********************
2* read FACT raw data
3* remove spikes
4* calculate baseline
5* find peaks (CFD and normal discriminator)
6+ seagRCh for Peaks in data
7+ put peaks into different histos depending on Amplitude
8+ draw histos for single, double, tripple, ....Photonpulses
9+ draw Parameterdevelopment
10 so it can be used for detection of other peaks
11*************************************************************/
12//----------------------------------------------------------------------------
13// root libraries
14//----------------------------------------------------------------------------
15
16#include <TROOT.h>
17#include <TCanvas.h>
18#include <TProfile.h>
19#include <TTimer.h>
20#include <TH1F.h>
21#include <TH2F.h>
22#include <Getline.h>
23#include <TLine.h>
24#include <TBox.h>
25#include <TMath.h>
26#include <TFile.h>
27#include <TStyle.h>
28#include <TString.h>
29#include <TObjArray.h>
30#include <TF1.h>
31#include<TSystem.h>
32
33#include <stdio.h>
34#include <stdint.h>
35#include <cstdio>
36#include <iostream>
37#include <fstream>
38using namespace std;
39
40#define NPIX 1440
41#define FAD_MAX_SAMPLES 1024
42#define HAVE_ZLIB
43
44//----------------------------------------------------------------------------
45// rootmacros
46//----------------------------------------------------------------------------
47
48//#include "../fits.h"
49
50#include "../openFits.h"
51//#include "../openFits.c"
52
53#include "../discriminator.h"
54//#include "../discriminator.C"
55#include "../zerosearch.h"
56//#include "../zerosearch.h"
57# include "../factfir.h"
58//#include "../factfir.C"
59
60//#include "../DrsCalibration.C"
61#include "../DrsCalibration.h"
62
63#include "../SpikeRemoval.h"
64//#include "../SpikeRemoval.C"
65
66#include "rootfilehandler.h"
67//#include "rootfilehandler.C"
68
69#include "pixel.h"
70//#include "pixel.C"
71
72#include "configfile.h"
73
74
75//----------------------------------------------------------------------------
76// Decleration of global variables
77//----------------------------------------------------------------------------
78
79bool gBreakout=false;
80
81vector<int16_t> gAllPixelDataVector;
82vector<int16_t> gStartCellVector;
83unsigned int gCurrentEventID;
84size_t gPXLxROI;
85UInt_t gRegionOfInterest;
86UInt_t gNumberOfPixels;
87TString ghistotitle;
88
89size_t gTriggerOffsetROI;
90size_t gRC;
91size_t gDrs_n;
92vector<float> gDrsBaseMean;
93vector<float> gDrsGainMean;
94vector<float> gDrsTriggeroffsetMean;
95
96vector<float> gAmeas(FAD_MAX_SAMPLES); // copy of the data (measured amplitude
97vector<float> gVcorr(FAD_MAX_SAMPLES); // corrected Values
98vector<float> gVslide(FAD_MAX_SAMPLES); // sliding average result
99vector<float> gVcfd(FAD_MAX_SAMPLES); // CDF result
100vector<float> gVcfd2(FAD_MAX_SAMPLES); // CDF result + 2nd sliding average
101
102int gNEvents=0;
103float gGainMean = 9;
104float gBSLMean = 0;
105
106//typedef struct{
107// double maxAmpl;
108// int countOfMax;
109// } OverlayMaximum;
110
111//typedef struct{
112// TString name;
113// TString title;
114// TString xTitle;
115// TString yTitle;
116// float yMax;
117// float yMin;
118//} histAttrib_t;
119
120//histAttrib_t* gHistoAttrib[maxPulseOrder];
121//histAttrib_t* gProfileAttrib[maxPulseOrder];
122
123
124// histograms
125const int Number_Of_Debug_Histo_Types = 7;
126
127const unsigned int
128 gAmeas_ = 0,
129 N1mean_ = 1,
130 gVcorr_ = 2,
131 Vtest_ = 3,
132 gVslide_ = 4,
133 gVcfd_ = 5,
134 gVcfd2_ = 6;
135
136//const char* gHistoTypes[8] = {
137// "hMaxOverlay",
138// "hPixelMax",
139// "hEdgeOverlay",
140// "hMaxProfile",
141// "hAllPixelOverlay",
142// "hAllPixelMax",
143// "hAllPixelMaxGaus",
144// "hAllPixelProfile"
145//};
146
147//----------------------------------------------------------------------------
148// Initialisation of histograms
149//----------------------------------------------------------------------------
150
151 // Temporary Objects
152 TH1F* debugHistos = NULL;
153 //TH2F* hOverlayTemp = NULL;
154 //TH1D* hProjPeak = NULL;
155 TH1F* hTesthisto = NULL;
156 TH2F* hTesthisto2 = NULL;
157
158 //Histogram Parameters
159 Int_t gPixelOverlayXaxisLeft = 0;
160 Int_t gPixelOverlayXaxisRight = 0;
161
162 //Root-File Objects
163// TObjArray* hList[pixelSetSize] = {NULL};
164 TList* hRootList = NULL;
165
166 TCanvas** cgpPixelPulses = NULL;
167 TCanvas** cgpDistributions = NULL;
168 TCanvas* cFiltered = NULL;
169 TCanvas* cgpTestHistos = NULL;
170
171//----------------------------------------------------------------------------
172// Functions
173//----------------------------------------------------------------------------
174
175void BookDebugHistos(int );
176void BookTestHistos( int );
177
178//void DeletePixelHistos(int );
179//void SaveHistograms( const char*, const char*, TObjArray*, int );
180
181void FillHistograms(Pixel*, vector<Region>*, int, int, int , int );
182void DrawTestHistograms( int);
183bool ProduceDebugHistos( vector<Region> *pZXings);
184bool UseThisPulse( int, int, int, float, int, int);
185void UpdateCanvases( int, int, bool);
186void DeletePixelCanvases( int, int );
187
188int HandleFitsFile(
189 fits * datafile,
190 TString datafilename,
191 TString drsfilename,
192 int nevents,
193 int npixel,
194 int verbosityLevel
195 );
196
197void ReadSequenzFile(
198 TString fileName,
199 vector<TString> *fitsFiles,
200 vector<TString> *drsFiles
201 );
202
203TString gDataDirectory;
204TString gHomeDirectory;
205TString ghostname;
206
207//----------------------------------------------------------------------------
208//----------------------------------------------------------------------------
209// MAIN - Funtion
210//----------------------------------------------------------------------------
211//----------------------------------------------------------------------------
212int FPulseOverlay_filelist(
213 TString inputPath = "raw/2012/03/09/",
214 TString sequenzFileName = "/home/jbuss/macros/isdc_rootmacros/PulseTemplates/seq",
215// TString dataFileSuffix = ".fits.gz",
216// int firstRunId = 18,
217// int nRuns = 50,
218// TString drsfilename = "20120309_012.drs.fits.gz",
219 TString OutputPath = "analysis/FPulseTemplate/20120309_018/Overlay/",
220 TString OutRootFileName = "20120309_018.root",
221 int firstevent = 1, // Hast to be between 1 and infinity NOT 0!!!!
222 int nevents = 100,
223 int firstpixel = 0,
224 int npixel = 2,
225 int pixelSetSize = 150,
226 int maxPulseOrder = 1,
227 int verbosityLevel = 6, // different verbosity levels can be implemented here
228 TString histoOptions = "SRM",
229 int AmplWindowWidth = 14, //Width of Window for selection of pulses to histograms
230 float GainMean = 9,
231 float BSLMean = -1, //4 Histogramms will be drawn, decide how far pulsehights differ from eachother
232 int avg1 = 8,
233 int avg2 = 8,
234 int OverlayWindowLeft = 70,
235 int OverlayWindowRight = 230,
236 bool ProduceGraphic = true,
237 bool spikeDebug = false,
238 bool debugPixel = false,
239 bool stats = false,
240 bool saveResults = false,
241 bool testmode = false,
242 int refresh_rate = 500 //refresh rate for canvases
243 )
244{
245//-----------------------------------------------------------------------------
246// prepare datafiles
247//-----------------------------------------------------------------------------
248
249 inputPath = SetHostsPaths(false, inputPath );
250
251 // declare the data file
252 fits * datafile = NULL;
253
254 // Opens the raw data file and 'binds' the variables given as
255 // Parameters to the data file. So they are filled with
256 // raw data as soon as datafile->GetRow(int) is called.
257
258 //vector of fits files to read
259 vector<TString> fitsFileNames;
260 vector<TString> drsFileNames;
261
262 ReadSequenzFile(
263 sequenzFileName,
264 &fitsFileNames,
265 &drsFileNames
266 );
267
268 cout << "filelist\n" ;
269
270 //fill vector of fits files to read
271 cout << "generating file list:" << endl;
272 for (unsigned int fileNr = 0; fileNr < fitsFileNames.size(); fileNr++)
273 {
274 if ( fileNr >= drsFileNames.size() )
275 {
276 cout << "too less drs-files in vector, skipping rest" << endl;
277 break;
278
279 drsFileNames.resize(fileNr);
280 fitsFileNames.resize(fileNr);
281 }
282
283 cout << "...checking raw files";
284// cout << "\t fits:\t" << fitsFileNames.at(fileNr);
285// cout << "\n\t\t drs:\t" << drsFileNames.at(fileNr) << endl;
286
287 //filename/path construction
288 TString fits_filename = inputPath;
289 fits_filename.Append(fitsFileNames.at(fileNr));
290 TString drs_filename = inputPath;
291 drs_filename.Append(drsFileNames.at(fileNr));
292 cout << "\n\t fits:\t" << fits_filename;
293 cout << "\n\t drs:\t" << drs_filename << endl;
294
295 //check if files are readable
296 ifstream fitsFile(fits_filename);
297 ifstream drsFile(drs_filename);
298 if (fitsFile.good() && drsFile.good())
299 {
300 //fill vector
301 cout << "...added\n" << endl;
302 fitsFileNames.at(fileNr) = fits_filename;
303 drsFileNames.at(fileNr) = drs_filename;
304 }
305 else {
306 cout << "...FAILED:";
307 cout << "\t deleting line"
308// << fitsFileNames.at(fileNr)
309// << " and "
310// << drsFileNames.at(fileNr)
311 << " from list\n" << endl;
312
313 fitsFileNames.erase(fitsFileNames.begin()+fileNr);
314 drsFileNames.erase(drsFileNames.begin()+fileNr);
315 fileNr--;
316// continue;
317 }
318 }
319 cout << endl << "size of file vectors: fits: "
320 << fitsFileNames.size()
321 << " drs: "
322 << drsFileNames.size() << endl;
323
324//----------------------------------------------------------------------------
325// Save-Root-File Settings
326//----------------------------------------------------------------------------
327
328 OutputPath = SetHostsPaths(true, OutputPath );
329 OutRootFileName.Prepend(OutputPath);
330// drsfilename = SetHostsPaths(false, drsfilename );
331// OutRootFileName = SetHostsPaths(true, OutRootFileName );
332 cout << endl;
333// cout << "drs filename:\t" << drsfilename << endl;
334// cout << "data filename:\t" << datafilename << endl;
335 cout << "out filename:\t" << OutRootFileName << endl;
336
337
338 if (saveResults)
339 {
340 CreateRootFile( OutRootFileName, true, verbosityLevel );
341 }
342
343
344
345
346
347//----------------------------------------------------------------------------
348// root global Settings
349//----------------------------------------------------------------------------
350
351 gGainMean = GainMean;
352 gBSLMean = BSLMean;
353 gPixelOverlayXaxisLeft = OverlayWindowLeft;
354 gPixelOverlayXaxisRight = OverlayWindowRight;
355
356 gStyle->SetPalette(1,0);
357 gROOT->SetStyle("Plain");
358// gPad->SetGrid();
359
360//----------------------------------------------------------------------------
361// root Canvas Settings
362//----------------------------------------------------------------------------
363 //Canvas Pad numbering
364 int pulsesCanvasFrameNrs[4] = {
365 1, // Top left
366 2, // Top right
367 3, // bottom left
368 4 // bootom right
369 };
370
371 //Canvas Pad numbering
372 int distributionCanvasFrameNrs[4] = {
373 1, // Top left
374 2, // Top right
375 3, // bottom left
376 4 // bootom right
377 };
378
379 if (ProduceGraphic)
380 {
381
382 //Canvases
383 cgpPixelPulses = new TCanvas*[maxPulseOrder];
384 cgpDistributions = new TCanvas*[maxPulseOrder];
385
386 //TCanvas* gpcDevelopment = NULL;
387 TString cName = "";
388 TString cTitle = "";
389
390 //naming of pulse canvases
391 for (
392 int pulse_order = maxPulseOrder - 1;
393 pulse_order >= 0 ;
394 pulse_order--
395 )
396 {
397 cName ="cgpDistributions";
398 cName += pulse_order;
399 cTitle ="Distributions of Pulses with Order of: ";
400 cTitle += pulse_order;
401 cgpDistributions[pulse_order] = new TCanvas(cName,cTitle, 720,pulse_order*20,720,720);
402 cgpDistributions[pulse_order]->Divide(2, 2);
403 cName ="cgpPixelPulses";
404 cName += pulse_order;
405 cTitle ="Overlays of Pulses with Order of: ";
406 cTitle += pulse_order;
407 cgpPixelPulses[pulse_order] = new TCanvas(cName,cTitle, 0,pulse_order*20,720,720);
408 cgpPixelPulses[pulse_order]->Divide(2, 2);
409 }
410
411
412 // Create (pointer to) Canvases, which are used in every run,
413 // also in 'non-debug' runs
414 // Canvases only need if spike Debug, but I want to deklare
415 // the pointers anyway ...
416 if (spikeDebug)
417 {
418 cFiltered = new TCanvas("cFiltered","filtered DRS Waveforms", 1080,420,360,360);
419 cFiltered->Divide(1, 3);
420 }
421
422 if (testmode)
423 {
424 //additional Test histograms
425 cgpTestHistos = new TCanvas( "cgpTestHistos", "Test Histograms", 360, 420, 360, 360 );
426 cgpTestHistos->Divide(2,0);
427 }
428 }
429
430//-----------------------------------------------------------------------------
431// Filter-Settings
432//-----------------------------------------------------------------------------
433// CFD filter settings
434 int k_cfd = 10;
435 vector<double> a_cfd(k_cfd, 0);
436 double b_cfd = 1.;
437 a_cfd[0]=-0.75;
438 a_cfd[k_cfd-1]=1.;
439
440//-----------------------------------------------------------------------------
441// Book the histograms
442//-----------------------------------------------------------------------------
443
444
445
446 if (testmode)
447 {
448 BookTestHistos( verbosityLevel );
449 }
450//----------------------------------------------------------------------------
451// Initialize Pixel
452//----------------------------------------------------------------------------
453 Pixel** pixel = new Pixel*[NPIX];
454
455 for (int i = 0 ; i < NPIX; i++)
456 {
457 pixel[i] = NULL;
458 }
459
460
461//-----------------------------------------------------------------------------
462// Main Cycle
463//-----------------------------------------------------------------------------
464
465 if ( pixelSetSize == -1 )
466 {
467 pixelSetSize = firstpixel +npixel;
468 }
469 int lastPixelOfSet = 0;
470//-------------------------------------
471// Loop over Pixel Sets
472//-------------------------------------
473 for ( int firstPixelOfSet = firstpixel;
474 firstPixelOfSet < firstpixel + npixel;
475 firstPixelOfSet += pixelSetSize )
476 {
477 lastPixelOfSet = firstPixelOfSet + pixelSetSize-1;
478 if (lastPixelOfSet > firstpixel + npixel)
479 {
480 lastPixelOfSet = firstpixel + npixel;
481 }
482 if (lastPixelOfSet > 1439)
483 {
484 lastPixelOfSet = 1439;
485 }
486 if (verbosityLevel == 0)
487 {
488 cout << "------------------------------------------------" << endl
489 << "...processing Set from Pixel "
490 << firstPixelOfSet
491 << " to Pixel "
492 << lastPixelOfSet << endl;
493 }
494
495 //-------------------------------------
496 // Loop over Fits Files
497 //-------------------------------------
498
499 for( unsigned int fileId = 0; fileId < fitsFileNames.size(); fileId++ )
500 {
501 datafile = NULL;
502// int return_val = 0;
503// return_val = HandleFitsFile(
504// datafile,
505// datafiles.at(fileId),
506// drsfilename,
507// nevents,
508// npixel,
509// verbosityLevel
510// );
511// if (return_val)
512// {
513// cerr << "ERROR" << endl;
514// return return_val;
515// }
516//==================================================
517
518 // Opens the raw data file and 'binds' the variables given as
519 // Parameters to the data file. So they are filled with
520 // raw data as soon as datafile->GetRow(int) is called.
521 cout << "\nopening " << fitsFileNames.at(fileId) << endl;
522
523 gNEvents = openDataFits(
524 fitsFileNames.at(fileId),
525 &datafile,
526 gAllPixelDataVector,
527 gStartCellVector,
528 gCurrentEventID,
529 gRegionOfInterest,
530 gNumberOfPixels,
531 gPXLxROI,
532 verbosityLevel
533 );
534
535 if (gNEvents == 0)
536 {
537 cout << "return code of OpenDataFile:" << fitsFileNames.at(fileId)<< endl;
538 cout << "is zero -> aborting." << endl;
539 return 1;
540 }
541
542 if (verbosityLevel > 0)
543 {
544 cout << endl <<"number of events in file: "<< gNEvents << "\t";
545 }
546
547 if ( nevents == -1 || nevents > gNEvents ) nevents = gNEvents; // -1 means all!
548
549 if (verbosityLevel > 0)
550 {
551 cout <<"of, which "<< nevents << " will be processed"<< endl;
552 cout <<"Total # of Pixel: "<< gNumberOfPixels << "\t";
553 }
554
555 if ( npixel == -1 || npixel > (int)gNumberOfPixels ) npixel = (int)gNumberOfPixels; // -1 means all!
556
557 if (verbosityLevel > 0)
558 {
559 cout <<"of, which "<< npixel << " will be processed"<< endl;
560 }
561
562 //Get the DRS calibration
563 gRC = openCalibFits(
564 drsFileNames.at(fileId),
565 gDrsBaseMean,
566 gDrsGainMean,
567 gDrsTriggeroffsetMean,
568 gTriggerOffsetROI
569 );
570
571 if (gRC == 0)
572 {
573 cout << "return code of openCalibFits:" << drsFileNames.at(fileId) << endl;
574 cout << "is zero -> aborting." << endl;
575 return 1;
576 }
577
578 //==================================================================
579
580//--------------------------------------------------------------------
581// Loop over every Event of Pixel Set
582//--------------------------------------------------------------------
583 for ( int ev = firstevent ; ev < firstevent + nevents; ev++)
584 {
585 // Get an Event --> consists of 1440 Pixel ...erm....data
586 datafile->GetRow( ev - 1 );
587
588 if (verbosityLevel == 1)
589 {
590 cout << "-------------------------------------" << endl
591 << "...processing Set from Pixel "
592 << firstPixelOfSet
593 << " to Pixel "
594 << lastPixelOfSet
595 << "... Event: " << gCurrentEventID
596 << "/" << nevents << endl;
597 }
598
599 cout << "\t\t success!" << endl;
600 //--------------------------------------------------------------------
601 // Loops over every Pixel of a Set of Pixels
602 //--------------------------------------------------------------------
603 for ( int pixelID = firstPixelOfSet;
604 pixelID < lastPixelOfSet + 1
605 && pixelID < firstpixel + npixel;
606 pixelID++ )
607 {
608 if (verbosityLevel > 1)
609 {
610 cout << "-------------------------------------" << endl
611 << "...processing Set from Pixel "
612 << firstPixelOfSet
613 << " to Pixel "
614 << lastPixelOfSet
615 << "... Event: " << gCurrentEventID
616 << "/" << nevents << endl
617 << " Pixel: " << pixelID
618 << "/" << firstpixel + npixel -1 << endl;
619 }
620
621 //-------------------------------------
622 // Create individual Pixel
623 //-------------------------------------
624 if (ev == firstevent)
625 {
626 pixel[pixelID] = new Pixel(
627 pixelID,
628 maxPulseOrder,
629 verbosityLevel,
630 stats,
631 histoOptions,
632 gPixelOverlayXaxisLeft,
633 gPixelOverlayXaxisRight,
634 gBSLMean,
635 gGainMean
636 );
637 }
638
639 //-------------------------------------
640 // Apply Calibration
641 //-------------------------------------
642 if (verbosityLevel > 2) cout << "...applying DrsCalibration";
643 applyDrsCalibration(
644 gAmeas,
645 pixelID,
646 12,
647 12,
648 gDrsBaseMean,
649 gDrsGainMean,
650 gDrsTriggeroffsetMean,
651 gRegionOfInterest,
652 gAllPixelDataVector,
653 gStartCellVector
654 );
655 if (verbosityLevel > 2) cout << "...done " << endl;
656
657 //-------------------------------------
658 // Apply Filters
659 //-------------------------------------
660 // finds spikes in the raw data, and interpolates the value
661 // spikes are: 1 or 2 slice wide, positive non physical artifacts
662 if (verbosityLevel > 2) cout << "...removeing Spikes";
663 removeSpikes (gAmeas, gVcorr);
664 if (verbosityLevel > 2) cout << "...done " << endl;
665
666 // filter gVcorr with sliding average using FIR filter function
667 if (verbosityLevel > 2) cout << "...applying sliding average filter";
668 sliding_avg(gVcorr, gVslide, avg1);
669 if (verbosityLevel > 2) cout << "...done " << endl;
670
671 // filter gVslide with CFD using FIR filter function
672 if (verbosityLevel > 2) cout << "...apllying factfir filter";
673 factfir(b_cfd , a_cfd, k_cfd, gVslide, gVcfd);
674 if (verbosityLevel > 2) cout << "...done " << endl;
675
676 // filter gVcfd with sliding average using FIR filter function
677 if (verbosityLevel > 2) cout << "...applying 2nd sliding average filter";
678 sliding_avg(gVcfd, gVcfd2, avg2);
679 if (verbosityLevel > 2) cout << "...done " << endl;
680
681 //-------------------------------------
682 // SeagRCh vor Zero crossings
683 //-------------------------------------
684 if (verbosityLevel > 2) cout << endl << "...seagRChing zero crossings" ;
685 // peaks in gAmeas[] are found by seagRChing for zero crossings
686 // in gVcfd2
687 // first Argument 1 means ... *rising* edge
688 // second Argument 1 means ... seagRCh with stepsize 1 ... 10 is okay as well
689 vector<Region>* pZXings = zerosearch( gVcfd2 , 1 , 8);
690 // pZXings means "zero cross ings"
691 EnlargeRegion(*pZXings, 10, 10);
692 findAbsMaxInRegions(*pZXings, gVslide);
693 removeMaximaBelow( *pZXings, 3.0);
694 removeRegionWithMaxOnEdge( *pZXings, 2);
695 removeRegionOnFallingEdge( *pZXings, 100);
696 findTimeOfHalfMaxLeft(*pZXings, gVslide, gBSLMean, 5, 10, verbosityLevel );
697 removeRegionWithToFlatSlope(*pZXings, 0.5);
698 if (verbosityLevel > 2) cout << "...done" << endl;
699
700 //-----------------------------------------------------------------------------
701 // Fill Overlay Histos
702 //-----------------------------------------------------------------------------
703 if (verbosityLevel > 2)
704 {
705 cout << endl << "Filling Histograms of Pixel# [Set] " << pixelID
706 << " Pixel# [Got] " << pixel[pixelID]->mChid;
707 }
708 FillHistograms(
709 pixel[pixelID],
710 pZXings,
711 AmplWindowWidth,
712 ev,
713 // histoOptions,
714 maxPulseOrder,
715 verbosityLevel
716 );
717 //-----------------------------------------------------------------------------
718 // Spike Debug
719 //-----------------------------------------------------------------------------
720 if ( spikeDebug )
721 {
722 BookDebugHistos(verbosityLevel );
723 gBreakout = ProduceDebugHistos( pZXings );
724 }// end of if(spikeDebug)
725
726 delete pZXings;
727 if (gBreakout) break;
728 //-------------------------------------
729 // Draw 1. Set of Pixel Histograms
730 //-------------------------------------
731 if ((ev % refresh_rate) == 0)
732 {
733 if (ProduceGraphic)
734 {
735 if (debugPixel)
736 {
737 // for ( int order = 0;
738 // order < maxPulseOrder;
739 // order++
740 // )
741 // {
742 pixel[firstPixelOfSet]->DrawOverlayHistograms(
743 cgpPixelPulses,
744 pulsesCanvasFrameNrs
745 );
746
747 pixel[firstPixelOfSet]->DrawDistributionHistograms(
748 cgpDistributions,
749 distributionCanvasFrameNrs
750 );
751 // }
752 if (testmode)
753 {
754 DrawTestHistograms(
755 verbosityLevel
756 );
757 }
758
759 UpdateCanvases(
760 verbosityLevel,
761 maxPulseOrder,
762 testmode
763 );
764 }
765 }
766 }
767
768 if (gBreakout) break;
769
770 if (verbosityLevel > 1)
771 {
772 cout << endl << "...End of Pixel"
773 << endl << "-------------------------------------"<< endl;
774 }
775 }//End of Loop over Set
776 //-------------------------------------
777 // end of Loops over Set
778 //-------------------------------------
779
780 }//End of Loop over Events
781 //-------------------------------------
782 // end of Loops over Events
783 //-------------------------------------
784
785 }//End of Loop over Files
786 //-------------------------------------
787 // end of Loops over Files
788 //-------------------------------------
789
790
791//-------------------------------------
792// Draw Pixel Histogramms of Overlay Spectra
793//-------------------------------------
794
795 for ( int pixelID = firstPixelOfSet;
796 pixelID < firstPixelOfSet + pixelSetSize
797 && pixelID < firstpixel + npixel;
798 pixelID++ )
799 {
800 //here is what happends at the end of each loop over all Events
801
802 if (ProduceGraphic)
803 {
804 pixel[pixelID]->DrawOverlayHistograms(
805 cgpPixelPulses,
806 pulsesCanvasFrameNrs
807 );
808
809 pixel[pixelID]->DrawDistributionHistograms(
810 cgpDistributions,
811 distributionCanvasFrameNrs
812 );
813
814 UpdateCanvases(
815 verbosityLevel,
816 maxPulseOrder,
817 testmode
818 );
819 }
820
821 //Save Histograms of Pixels into Output rootfile
822 if (verbosityLevel > 2)
823 {
824 cout << endl << "Saving Pixel# [Set] " << pixelID
825 << " Pixel# [Got] " << pixel[pixelID]->mChid;
826 }
827 pixel[pixelID]->SavePixelHistograms( OutRootFileName, saveResults );
828
829
830 if (debugPixel)
831 {
832 //Process gui events asynchronously during input
833 cout << endl;
834 TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
835 timer.TurnOn();
836 TString input = Getline("Type 'q' to exit, <return> to go on: ");
837 timer.TurnOff();
838 if (input=="q\n") {
839 break;
840 }
841 }
842
843 if (verbosityLevel > 2)
844 {
845 cout << endl << "Deleting Pixel# [Set] " << pixelID
846 << " Pixel# [Got] " << pixel[pixelID]->mChid;
847 }
848 delete pixel[pixelID];
849
850 if (verbosityLevel > 2)
851 {
852 cout << endl << "...End of Pixel-Set"
853 << endl << "------------------------------------------------"
854 << endl;
855 }
856 }
857 }
858 // End of Loop over all Pixels
859
860//-------------------------------------
861// Draw Histograms
862//-------------------------------------
863 TString test = "root";
864 SaveHistograms( //save histograms of generell results into output root file
865 OutRootFileName,
866 test,
867 hRootList,
868 saveResults,
869 verbosityLevel
870 );
871
872 if (ProduceGraphic)
873 {
874 UpdateCanvases(
875 verbosityLevel,
876 maxPulseOrder,
877 testmode
878 );
879
880 //Process gui events asynchronously during input
881 cout << endl;
882 TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
883 timer.TurnOn();
884 Getline("Press <return> to go on");
885 timer.TurnOff();
886
887 DeletePixelCanvases(
888 maxPulseOrder,
889 verbosityLevel
890 );
891
892 if (testmode)
893 delete cgpTestHistos;
894
895 if (spikeDebug)
896 delete cFiltered;
897 }
898
899 delete datafile;
900 delete[] pixel;
901
902 return( 0 );
903}
904//----------------------------------------------------------------------------
905// end of main function
906//-----------------------------------------------------------------------------
907
908
909
910
911//-----------------------------------------------------------------------------
912// Funktions
913//-----------------------------------------------------------------------------
914
915/*
916ich erzeuge sowas wie 36 pixel mit ca 20 Histogrammen pro pixel
917wie viel speicher braucht das?
918Ich brauche eine möglichkeit jedes dieser histogramme zu identifizieren
919am besten ein array oder eine liste oder einen abstracten datentyp mit den histogrammen als attribute.
920ne klasse wäre super
921
922*/
923
924void BookTestHistos( int verbosityLevel )
925{
926 if (verbosityLevel > 2) cout << endl << "...book pixel histograms" << endl;
927
928 hTesthisto = new TH1F (
929 "hTesthisto",
930 "Deviation of rising edge and maximum",
931 600,
932 -10.1,
933 10.1
934 );
935 hTesthisto->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
936 hTesthisto->GetYaxis()->SetTitle( "counts" );
937
938 hTesthisto2 = new TH2F (
939 "hTesthisto2",
940 "Deviation of rising edge and maximum by event #",
941 gNEvents,
942 250,
943 800,
944 600,
945 -10.1,
946 10.1
947 );
948// hTesthisto2->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
949// hTesthisto2->GetYaxis()->SetTitle( "counts" );
950// hTesthisto2->SetMarkerStyle( 2 );
951
952 if (verbosityLevel > 2) cout << "...done" << endl;
953}
954//end of BookTestHistos
955//----------------------------------------------------------------------------
956
957
958void
959BookDebugHistos( int verbosityLevel )
960{
961 if (verbosityLevel > 2) cout << endl << "...book histograms" << endl;
962 hRootList = new TList();
963 debugHistos = new TH1F[ Number_Of_Debug_Histo_Types ];
964 for ( int type = 0; type < Number_Of_Debug_Histo_Types; type++){
965 debugHistos[ type ].SetBins(1024, 0, 1024);
966 debugHistos[ type ].SetLineColor(1);
967 debugHistos[ type ].SetLineWidth(2);
968 debugHistos[ type ].SetStats(false);
969
970 // set X axis paras
971 debugHistos[ type ].GetXaxis()->SetLabelSize(0.08);
972 debugHistos[ type ].GetXaxis()->SetTitleSize(0.08);
973 debugHistos[ type ].GetXaxis()->SetTitleOffset(1.0);
974 debugHistos[ type ].GetXaxis()->SetTitle(Form("Time slice [%.1f ns/slice]", 1./2.));
975
976 // set Y axis paras
977 debugHistos[ type ].GetYaxis()->SetLabelSize(0.08);
978 debugHistos[ type ].GetYaxis()->SetTitleSize(0.08);
979 debugHistos[ type ].GetYaxis()->SetTitleOffset(0.3);
980 debugHistos[ type ].GetYaxis()->SetTitle("Amplitude [mV]");
981// hRootList->Add( &debugHistos[ type ] );
982 }
983 if (verbosityLevel > 2) cout << "...done" << endl;
984}
985// end of BookDebugHistos
986//----------------------------------------------------------------------------
987
988
989void
990FillHistograms(
991 Pixel* CurrentPixel,
992 vector<Region>* pZXings,
993 int AmplWindowWidth,
994 int eventNumber,
995 int maxPulseOrder,
996 int verbosityLevel
997 )
998{
999 if (verbosityLevel > 2) cout << endl << "...filling pulse histograms" ;
1000 if (verbosityLevel > 3) cout << endl << "...EventNR " << eventNumber ;
1001 bool use_this_peak=false;
1002 int order_of_pulse=0;
1003 vector<Region>::iterator reg;
1004 //Loop over all found zerocrossings in Region
1005 for (reg = pZXings->begin() ; reg < pZXings->end() ; reg++)
1006 {
1007 //skip those who are at the Rim of the ROI
1008 if (reg->maxPos < 12 || (unsigned int) reg->maxPos > gRegionOfInterest-12)
1009 {
1010 if (verbosityLevel > 2) cout << endl << "\t...out of range" << endl;
1011 continue;
1012 }
1013
1014 // Define axis range of Histogram
1015 int Left = reg->maxPos - gPixelOverlayXaxisLeft;
1016 int Right = reg->maxPos + gPixelOverlayXaxisRight;
1017 int EdgeLeft = reg->halfRisingEdgePos - gPixelOverlayXaxisLeft;
1018 int EdgeRight = reg->halfRisingEdgePos + gPixelOverlayXaxisRight;
1019
1020 if (Left < 0) Left = 0;
1021 if (EdgeLeft < 0) EdgeLeft = 0;
1022 if (Right > (int)gAmeas.size() ) Right = gAmeas.size();
1023 if (EdgeRight > (int)gAmeas.size() ) EdgeRight = gAmeas.size();
1024
1025
1026 if (verbosityLevel > 2) cout << endl << "\t...choosing Histogram" ;
1027 //determine order of pulse and which histogram shall be filled
1028 for ( int order = 0; order < maxPulseOrder; order++)
1029 {
1030 use_this_peak = UseThisPulse(
1031 reg->maxPos,
1032 order,
1033 AmplWindowWidth,
1034 gGainMean,
1035 maxPulseOrder,
1036 verbosityLevel
1037 );
1038 if ( use_this_peak)
1039 {
1040 order_of_pulse = order;
1041 break;
1042 }
1043 }
1044 //Fill histograms
1045 if (use_this_peak)
1046 {
1047 //Histograms for Distributions
1048 if (CurrentPixel->mOptions.Contains("S") )
1049 {
1050 if (verbosityLevel > 2)
1051 cout << endl << "\t...filling Edge Histogram" ;
1052 CurrentPixel->hSlopeRisingEdge[order_of_pulse]->Fill( reg->slopeOfRisingEdge ) ;
1053 }
1054
1055 if (CurrentPixel->mOptions.Contains("R") )
1056 {
1057 if (verbosityLevel > 2)
1058 cout << endl << "\t...filling RisingEdgeToMax Histogram" ;
1059 CurrentPixel->hRisingEdgeToMax[order_of_pulse]->Fill( reg->distanceEdgeToMax ) ;
1060 }
1061
1062 if (CurrentPixel->mOptions.Contains("M") )
1063 {
1064 if (verbosityLevel > 2)
1065 cout << endl << "\t...filling PosOfMax Histogram" ;
1066 CurrentPixel->hPosOfMax[order_of_pulse]->Fill( reg->maxPos ) ;
1067 }
1068
1069 //Histograms for Maximum Overlay
1070 for ( int pos = Left; pos < Right; pos++)
1071 {
1072 CurrentPixel->hMaxOverlay[order_of_pulse]->Fill( pos - (reg->maxPos), gAmeas[pos]) ;
1073 CurrentPixel->hMaxProfile[order_of_pulse]->Fill( pos - (reg->maxPos), gAmeas[pos]) ;
1074 }
1075 //Histograms for Edge Overlay
1076 for ( int pos = EdgeLeft; pos < EdgeRight; pos++)
1077 {
1078 CurrentPixel->hEdgeOverlay[order_of_pulse]->Fill( pos - (reg->halfRisingEdgePos), gAmeas[pos]) ;
1079 CurrentPixel->hEdgeProfile[order_of_pulse]->Fill( pos - (reg->halfRisingEdgePos), gAmeas[pos]) ;
1080 }
1081
1082 if (verbosityLevel > 2) cout << "...done" << endl;
1083 }
1084
1085 //gBreakout option
1086 if (gBreakout)
1087 {
1088 break;
1089 }
1090 }
1091 if (verbosityLevel > 2) cout << "...done" << endl;
1092}
1093// end of FillHistograms
1094//----------------------------------------------------------------------------
1095
1096bool UseThisPulse(
1097 int maxPos,
1098 int order,
1099 int AmplWindowWidth,
1100 float gainMean,
1101 int maxPulseOrder,
1102 int verbosityLevel
1103 )
1104{
1105 //determine if pulse is of given order
1106bool use_this_peak = false;
1107 if (gAmeas[maxPos] >= ((gainMean*(order+1)) - (AmplWindowWidth/2))
1108 && gAmeas[maxPos] < ((gainMean*(order+1)) + AmplWindowWidth/2))
1109 {
1110 if (verbosityLevel > 3) cout << "...#" << order ;
1111 use_this_peak = true;
1112 }
1113 else
1114 {
1115 if (verbosityLevel > 3)
1116 {
1117 if (order >= (maxPulseOrder - 1))
1118 {
1119 cout << "...NONE" << endl ;
1120 }
1121 }
1122 use_this_peak = false;
1123 }
1124
1125return use_this_peak;
1126}
1127
1128
1129void
1130DrawTestHistograms(
1131 int verbosityLevel
1132 )
1133{
1134 if (verbosityLevel > 2) cout << endl << "...drawing pulse histograms TODO CANVAS" ;
1135
1136// cgpTestHistos->cd(1);
1137// hTesthisto->Draw();
1138// cgpTestHistos->cd(2);
1139// hTesthisto2->Draw("BOX");
1140}
1141// end of DrawTestHistograms
1142//----------------------------------------------------------------------------
1143
1144void
1145UpdateCanvases(
1146 int verbosityLevel,
1147 int max_pulse_order,
1148 bool testmode
1149 )
1150{
1151 if (verbosityLevel > 3) cout << endl << "...updating canvases" ;
1152 for (int pulse_order = 0; pulse_order < max_pulse_order; pulse_order++)
1153 {
1154 cgpPixelPulses[pulse_order]->Modified();
1155 cgpPixelPulses[pulse_order]->Update();
1156 cgpDistributions[pulse_order]->Modified();
1157 cgpDistributions[pulse_order]->Update();
1158 if ( testmode )
1159 {
1160 cgpTestHistos->Modified();
1161 cgpTestHistos->Update();
1162 }
1163 }
1164}
1165// end of UpdateCanvases
1166//----------------------------------------------------------------------------
1167
1168void
1169DeletePixelCanvases(
1170 int maxPulseOrder,
1171 int verbosityLevel
1172 )
1173{
1174 if (verbosityLevel > 2) cout << endl << "...delete pixel Canvases" ;
1175 for (int pulse_order = 0; pulse_order < maxPulseOrder; pulse_order++ )
1176 {
1177 delete cgpPixelPulses[pulse_order];
1178 delete cgpDistributions[pulse_order];
1179 }
1180 delete[] cgpPixelPulses;
1181 delete[] cgpDistributions;
1182}
1183
1184//----------------------------------------------------------------------------
1185//----------------------------------------------------------------------------
1186
1187bool
1188ProduceDebugHistos(
1189 vector<Region>* pZXings
1190 )
1191{
1192 // TODO do this correct. The vectors should be the rigt ones... this is just luck
1193 debugHistos[gAmeas_].GetXaxis()->Set(gAmeas.size() , -0.5 , gAmeas.size()-0.5);
1194 debugHistos[gVcorr_].GetXaxis()->Set(gAmeas.size() , -0.5 , gAmeas.size()-0.5);
1195 debugHistos[gVslide_].GetXaxis()->Set(gAmeas.size() , -0.5 , gAmeas.size()-0.5);
1196 debugHistos[gVcfd_].GetXaxis()->Set(gAmeas.size() , -0.5 , gAmeas.size()-0.5);
1197 debugHistos[gVcfd2_].GetXaxis()->Set(gAmeas.size() , -0.5 , gAmeas.size()-0.5);
1198
1199 for ( unsigned int sl = 0; sl < gRegionOfInterest; sl++)
1200 {
1201 debugHistos[gAmeas_].SetBinContent(sl, gAmeas[sl]);
1202 debugHistos[gVcorr_].SetBinContent(sl, gVcorr[sl]);
1203 debugHistos[gVslide_].SetBinContent( sl, gVslide[sl] );
1204 debugHistos[gVcfd_].SetBinContent( sl, gVcfd[sl] );
1205 debugHistos[gVcfd2_].SetBinContent( sl, gVcfd2[sl] );
1206 }
1207
1208 bool has_negative_slope = false;
1209 cFiltered->cd(1);
1210 gPad->SetGrid();
1211 debugHistos[gAmeas_].Draw();
1212
1213 TF1 *OneEdge;
1214 TLine *OneLine;
1215 TBox *OneBox;
1216 vector<TF1*> MyEdges;
1217 vector<TBox*> MyBoxes;
1218 vector<TBox*> MyLines;
1219
1220 int left = debugHistos[gAmeas_].GetXaxis()->GetFirst();
1221 int right = debugHistos[gAmeas_].GetXaxis()->GetLast();
1222 vector<Region>::iterator region;
1223 for (region = pZXings->begin() ; region < pZXings->end() ; region++)
1224 {
1225 if (region->slopeOfRisingEdge < 0)
1226 {
1227 has_negative_slope = true;
1228 }
1229 }
1230
1231 if (has_negative_slope)
1232 {
1233 for (unsigned int i=0; i<pZXings->size(); i++){
1234 Region* reg = &pZXings->at(i);
1235 cout << "Slope is: " << reg->slopeOfRisingEdge << endl;
1236
1237// xBegin = (reg->halfRisingEdgePos - reg->distanceEdgeToMax);
1238// yBegin = reg->integRCeptRisingEdge + reg->slopeOfRisingEdge * (xBegin)
1239
1240 OneEdge = new TF1(
1241 "OneEdge",
1242 "[0]*x+[1]",
1243 left,
1244 right
1245 );
1246
1247 OneEdge->SetParameters(
1248 reg->slopeOfRisingEdge,
1249 reg->interceptRisingEdge
1250 );
1251
1252 OneEdge->SetLineColor(kRed);
1253 OneEdge->SetLineWidth(1);
1254 MyEdges.push_back(OneEdge);
1255
1256 OneEdge->Draw("SAME");
1257// delete OneEdge;
1258
1259 OneBox = new TBox(
1260 pZXings->at(i).maxPos -10 ,
1261 pZXings->at(i).maxVal -0.5,
1262 pZXings->at(i).maxPos +10 ,
1263 pZXings->at(i).maxVal +0.5);
1264 OneBox->SetLineColor(kBlue);
1265 OneBox->SetLineWidth(1);
1266 OneBox->SetFillStyle(0);
1267 OneBox->SetFillColor(kRed);
1268 MyBoxes.push_back(OneBox);
1269 OneBox->Draw();
1270
1271 OneLine = new TLine(
1272 pZXings->at(i).halfRisingEdgePos,
1273 gAmeas[pZXings->at(i).halfRisingEdgePos],
1274 pZXings->at(i).halfRisingEdgePos,
1275 pZXings->at(i).halfRisingEdgePos * pZXings->at(i).slopeOfRisingEdge + pZXings->at(i).interceptRisingEdge
1276 );
1277 OneLine->SetLineColor(kBlue);
1278 OneLine->SetLineWidth(3);
1279 MyLines.push_back(OneBox);
1280 OneLine->Draw();
1281 }
1282
1283 cFiltered->cd(2);
1284 gPad->SetGrid();
1285 debugHistos[gVslide_].Draw();
1286 debugHistos[gVcorr_].Draw("SAME");
1287
1288 for (unsigned int i=0; i<MyEdges.size(); i++){
1289 MyEdges.at(i)->Draw("SAME");
1290 }
1291 for (unsigned int i=0; i<MyBoxes.size(); i++){
1292 MyBoxes.at(i)->Draw();
1293 }
1294 for (unsigned int i=0; i<MyLines.size(); i++){
1295 MyLines.at(i)->Draw();
1296 }
1297
1298 cFiltered->cd(3);
1299 gPad->SetGrid();
1300 debugHistos[gVcorr_].SetLineColor(kBlue);
1301 debugHistos[gVcorr_].Draw();
1302 debugHistos[gAmeas_].Draw("SAME");
1303 debugHistos[gVslide_].SetLineColor(kRed);
1304 debugHistos[gVslide_].Draw("SAME");
1305 debugHistos[gVcfd_].SetLineColor(kGreen);
1306 debugHistos[gVcfd_].Draw("SAME");
1307 debugHistos[gVcfd2_].SetLineColor(kViolet);
1308 debugHistos[gVcfd2_].Draw("SAME");
1309 for (unsigned int i=0; i<MyEdges.size(); i++){
1310 MyEdges.at(i)->Draw("SAME");
1311 }
1312 for (unsigned int i=0; i<MyBoxes.size(); i++){
1313 MyBoxes.at(i)->Draw();
1314 }
1315 for (unsigned int i=0; i<MyLines.size(); i++){
1316 MyLines.at(i)->Draw();
1317 }
1318
1319
1320// cFiltered->cd(3);
1321// gPad->SetGrid();
1322// debugHistos[gVcfd2_].Draw();
1323// TLine *zeroline = new TLine(0, 0, 1024, 0);
1324// zeroline->SetLineColor(kBlue);
1325// zeroline->Draw();
1326
1327 cFiltered->Update();
1328
1329
1330 //Process gui events asynchronously during input
1331 TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
1332 timer.TurnOn();
1333 TString input = Getline("Type 'q' to exit, <return> to go on: ");
1334 timer.TurnOff();
1335 if (input=="q\n") {
1336 return true;
1337 }
1338
1339 MyLines.clear();
1340 MyBoxes.clear();
1341 MyEdges.clear();
1342
1343// for (unsigned int i=0; i<pZXings->size(); i++)
1344// {
1345// delete MyEdges.at(i)
1346// delete MyBoxes.at(i);
1347// }
1348// delete OneBox;
1349// delete OneEdge;
1350// delete OneLine;
1351
1352// MyEdges.erase();
1353// MyBoxes.erase();
1354 }
1355
1356 //TODO!!!!!!!!!
1357 // do some Garbage collection ...
1358 // all the Objects on the heap should be deleted here.
1359return false;
1360}// end of if(spikeDebug)
1361
1362int HandleFitsFile(
1363 fits * datafile,
1364 TString datafilename,
1365 TString drsfilename,
1366 int nevents,
1367 int npixel,
1368 int verbosityLevel
1369 )
1370{
1371 // Opens the raw data file and 'binds' the variables given as
1372 // Parameters to the data file. So they are filled with
1373 // raw data as soon as datafile->GetRow(int) is called.
1374 cout << "\nopening " << datafilename << endl;
1375
1376 gNEvents = openDataFits(
1377 datafilename,
1378 &datafile,
1379 gAllPixelDataVector,
1380 gStartCellVector,
1381 gCurrentEventID,
1382 gRegionOfInterest,
1383 gNumberOfPixels,
1384 gPXLxROI,
1385 verbosityLevel
1386 );
1387
1388 if (gNEvents == 0)
1389 {
1390 cout << "return code of OpenDataFile:" << datafilename<< endl;
1391 cout << "is zero -> aborting." << endl;
1392 return 1;
1393 }
1394
1395 if (verbosityLevel > 0)
1396 {
1397 cout << endl <<"number of events in file: "<< gNEvents << "\t";
1398 }
1399
1400 if ( nevents == -1 || nevents > gNEvents ) nevents = gNEvents; // -1 means all!
1401
1402 if (verbosityLevel > 0)
1403 {
1404 cout <<"of, which "<< nevents << " will be processed"<< endl;
1405 cout <<"Total # of Pixel: "<< gNumberOfPixels << "\t";
1406 }
1407
1408 if ( npixel == -1 || npixel > (int)gNumberOfPixels ) npixel = (int)gNumberOfPixels; // -1 means all!
1409
1410 if (verbosityLevel > 0)
1411 {
1412 cout <<"of, which "<< npixel << " will be processed"<< endl;
1413 }
1414
1415 //Get the DRS calibration
1416 gRC = openCalibFits(
1417 drsfilename,
1418 gDrsBaseMean,
1419 gDrsGainMean,
1420 gDrsTriggeroffsetMean,
1421 gTriggerOffsetROI
1422 );
1423
1424 if (gRC == 0)
1425 {
1426 cout << "return code of openCalibFits:" << drsfilename << endl;
1427 cout << "is zero -> aborting." << endl;
1428 return 1;
1429 }
1430 return 0;
1431}
1432
1433void ReadSequenzFile(TString fileName, vector<TString> *fitsFiles, vector<TString> *drsFiles)
1434{
1435 ifstream seqFile;
1436 seqFile.open(fileName,ios::in);
1437
1438 TString fitsName, drsName;
1439
1440 if(!seqFile)
1441 {
1442 cerr << "***** no config-file in the user defined directory.\n"
1443 << "Check the path .\n" << endl;
1444 return;
1445 }
1446
1447 if(!seqFile.good()) {
1448 cerr << "***** not able to read config-file." << endl;
1449 return;
1450 }
1451
1452 while(!seqFile.eof())
1453 {
1454 seqFile >> fitsName >> drsName;
1455
1456 if (!fitsName.IsWhitespace() && !fitsName.IsNull())
1457 {
1458 fitsFiles->push_back(fitsName);
1459
1460 if (!drsName.IsWhitespace() && !drsName.IsNull())
1461 {
1462 drsFiles->push_back(drsName);
1463 }
1464 else drsFiles->push_back("0");
1465 }
1466 }
1467
1468 seqFile.close();
1469
1470 return;
1471}
1472
1473
1474//int main(int argc,char *argv[])
1475//{
1476
1477// TString test;
1478// TString gRCFileName;
1479// TString processType = "overlay";
1480// bool gRCFileNameCmdSet = false;
1481// int verbLevel = 0; // different verbosity levels can be implemented here
1482// bool verbLevelCmdSet = false;
1483// bool save = false;
1484// bool produceGraphic = false;
1485
1486// // decode arguments
1487// if(argc < 2)
1488// {
1489// printf("no arguements given, using standard arguments\n");
1490// }
1491
1492// // set conditions for functions arguments
1493// for (int i=1;i<argc;i++)
1494// {
1495// test = argv[i];
1496
1497// if (test.Contains("--config_file") || test.Contains("-c"))
1498// {
1499// cout << "gRC-File: \"" << argv[i + 1] << "\"" << endl;
1500// gRCFileName = argv[i + 1];
1501// gRCFileNameCmdSet = true;
1502// continue;
1503// }
1504
1505// if (test.Contains("--verbosity") || test.Contains("-v"))
1506// {
1507// cout << "Verbosity Level: \"" << argv[i + 1] << "\"" << endl;
1508// verbLevel = atoi(argv[i + 1]);
1509// continue;
1510// }
1511
1512// if (test.Contains("--save") || test.Contains("-s"))
1513// {
1514// cout << "will save results" << endl;
1515// save = true;
1516// continue;
1517// }
1518
1519// if (test.Contains("--graphics") || test.Contains("-g"))
1520// {
1521// cout << "will produce graphics" << endl;
1522// produceGraphic = true;
1523// continue;
1524// }
1525// }
1526
1527// // reading gRC-File:
1528// configfile gRCfile( gRCFileName, processType );
1529
1530// if (save)
1531// {
1532// gRCfile.mSave = save;
1533// }
1534
1535// if (verbLevelCmdSet)
1536// {
1537// gRCfile.mVerbLevel = verbLevel;
1538// }
1539
1540// if (produceGraphic)
1541// {
1542// gRCfile.mProduceGraphic = produceGraphic;
1543// }
1544
1545// FPulseOverlay(
1546// gRCfile.mInputPath,
1547// gRCfile.mDataFileName,
1548// gRCfile.mDrsFileName,
1549// gRCfile.mOutputPath,
1550// gRCfile.mOutputFile,
1551// gRCfile.mFirstEvent,
1552// gRCfile.mNumEvents,
1553// gRCfile.mFirstPixel,
1554// gRCfile.mNumPixel,
1555// gRCfile.mPixelSetSize,
1556// gRCfile.mMaxOrder,
1557// gRCfile.mVerbLevel,
1558// gRCfile.mHistoOptions,
1559// gRCfile.mAmplWindowWidth,
1560// gRCfile.mGainMean,
1561// gRCfile.mBSLMean,
1562// gRCfile.mAvg1,
1563// gRCfile.mAvg2,
1564// gRCfile.mOverlayWindowLeft,
1565// gRCfile.mOverlayWindowRight,
1566// gRCfile.mProduceGraphic,
1567// gRCfile.mSpikeDebug,
1568// gRCfile.mDbgPixel,
1569// gRCfile.mPrintStats,
1570// gRCfile.mSave,
1571// gRCfile.mTestMode,
1572// gRCfile.mRefreshRate
1573// );
1574// return 0;
1575
1576//}
Note: See TracBrowser for help on using the repository browser.