#define FIT_FUNC "gaus"
#define DRAW_FITS true
-#define DATAPATH "/d/salt/data_recovered/maps/DennisDoering/root/Analysedata/"
+#define DATAPATH "/d/salt/data_recovered/maps/Benny/Mimosa34_Analyse/"
struct laborbook
{
Int_t inputRun;
noiseHisto[lauf]=Noise(runList[lauf]);
arrayHisto[lauf]=GenerateHisto(runList[lauf]);
}
-
+
Double_t w = 600;
Double_t h = 600;
TCanvas * c1 = new TCanvas("c", "c", w, h);
// Read Laborbook, save it in the struct laborbookdata
struct laborbook laborbookdata;
laborbookdata=LaborBuchSQL(inputRun);
-
+// cout<<"TEST2 Run:"<<laborbookdata.inputRun<<endl;
Int_t maxBin;
if(laborbookdata.system=="USB")
{
printf("Error: cannot open %s\n", path.Data());
exit(0);
}
-
+
// get a pointer to the tree
- TNtuple* hitNtuple = (TNtuple*) f->Get("hit");
+// TNtuple* hitNtuple = (TNtuple*) f->Get("hit");
//TNtuple* hitsNtuple = (TNtuple*) f->Get("hits");
// one array element and one branch for each pixel
- Float_t pixel[NUMPIXELS];
- TBranch* pixelBranch[NUMPIXELS];
- for (Int_t cnt=0; cnt<NUMPIXELS; cnt++)
- {
- hitNtuple->SetBranchAddress(Form("p%i",cnt+1), &pixel[cnt], &pixelBranch[cnt]);
- }
- UInt_t frame;
- TBranch* frameBranch;
- hitNtuple->SetBranchAddress("frame", &frame, &frameBranch);
- UInt_t seedPixel;
- TBranch* seedPixelBranch;
- hitNtuple->SetBranchAddress("pixel", &seedPixel, &seedPixelBranch);
+// Float_t pixel[NUMPIXELS];
+
+
+
+
+// TBranch* pixelBranch[NUMPIXELS];
+// for (Int_t cnt=0; cnt<NUMPIXELS; cnt++)
+// {
+// hitNtuple->SetBranchAddress(Form("p%i",cnt+1), &pixel[cnt], &pixelBranch[cnt]);
+// }
+// UInt_t frame;
+// TBranch* frameBranch;
+// hitNtuple->SetBranchAddress("frame", &frame, &frameBranch);
+// UInt_t seedPixel;
+// TBranch* seedPixelBranch;
+// hitNtuple->SetBranchAddress("pixel", &seedPixel, &seedPixelBranch);
+
+ TTree* hitNtuple = (TTree*) f->Get("hit");
+
+ UInt_t frame;
+ UInt_t hits;
+ UInt_t seedPixel[10000];
+ Float_t pixel[25][10000];
+
+
+
+ hitNtuple->SetBranchAddress ("frame" , &frame);
+ hitNtuple->SetBranchAddress ("hits" , &hits);
+ hitNtuple->SetBranchAddress ("pixel" , seedPixel );
+// hitNtuple->SetBranchAddress ( "p13" , pixel );
+
+
+
+ for(int i=0;i<25;i++) { hitNtuple->SetBranchAddress( Form("p%i",i+1) , &pixel[i][0] ); }
+
+ // fHitTree = new TTree("hit", "hit");
+
+ // fHitTree->SetBranchAddress("frame" , &fFrameInfo.frame );
+ // fHitTree->SetBranchAddress("hits" , &fFrameInfo.hits );
+ // fHitTree->SetBranchAddress("pixel" , &fFrameInfo.pixel[0] );
+
// loop over all hits to fill histogram
Int_t nentries = hitNtuple->GetEntries();
-
+// cout<<"TEST4 Run:"<<laborbookdata.inputRun<<endl;
+ int tempsamirvar = laborbookdata.inputRun;
+// cout<<"nentries:"<<nentries<<endl;
for (Int_t cnt=0; cnt<nentries; cnt++)
- {
+ {
hitNtuple->GetEntry(cnt);
- // take only frames with a maximum of one hit
- // hitsNtuple->GetEntry((Int_t) frame);
- // if (frameCounts > 1)
- // continue;
+// cout << cnt << " " << laborbookdata.inputRun << " " << tempsamirvar << " " ;
+// cout<<frame<<" "<<hits<<" "<<endl;
-
- // histogram with the single pixel
- histNtuple->Fill(pixel[12]);
-
- // histogram with the summed pixels
- Double_t pixelSum = 0;
- for (Int_t i=0; i<NUMPIXELS; i++)
+ if (hits<10)
{
- pixelSum += pixel[i];
- }
- histNtupleSum->Fill(pixelSum);
-
- // histogram with the single pixel and with "veto trigger"
- // for the "histNtupleVeto" take only hits where only the seed pixel contains charge
- Double_t notSeedSum = 0;
- for (Int_t i=0; i<12; i++)
- notSeedSum += pixel[i];
- for (Int_t i=13; i<NUMPIXELS; i++)
- notSeedSum += pixel[i];
- if (TMath::Abs(notSeedSum) > VETO_THRESHOLD)
- continue;
- // meanNotSeedSum+=notSeedSum;
- // nhits++;
- histNtupleVeto->Fill(pixel[12]); // histogram with the single pixel
-
+ for(unsigned int i=0; i<hits;i++)
+ {
+// cout<<" ---> "<<i<<" "<<seedPixel[i]<<" "<<pixel[12][i]<<endl;
+
+
+ // take only frames with a maximum of one hit
+ // hitsNtuple->GetEntry((Int_t) frame);
+ // if (frameCounts > 1)
+ // continue;
+
+
+ // histogram with the single pixel
+ histNtuple->Fill(pixel[12][i]);
+
+ // histogram with the summed pixels
+// Double_t pixelSum = 0;
+// for (Int_t i=0; i<NUMPIXELS; i++)
+// {
+// pixelSum += pixel[12][i];
+// }
+// histNtupleSum->Fill(pixelSum);
+
+ // histogram with the single pixel and with "veto trigger"
+ // for the "histNtupleVeto" take only hits where only the seed pixel contains charge
+// Double_t notSeedSum = 0;
+// for (Int_t i=0; i<12; i++)
+// notSeedSum += pixel[i];
+// for (Int_t i=13; i<NUMPIXELS; i++)
+// notSeedSum += pixel[i];
+// if (TMath::Abs(notSeedSum) > VETO_THRESHOLD)
+// continue;
+ // meanNotSeedSum+=notSeedSum;
+ // nhits++;
+// histNtupleVeto->Fill(pixel[12]); // histogram with the single pixel
+ }}
}
TCanvas* c1 = new TCanvas();
c1->SetTitle(Form("Seed%i",inputRun));
histNtupleSumSame->SetLineColor(1);
histNtupleVetoSame->SetLineColor(2);
-
+
struct histogram arrayHisto;
arrayHisto.Seed=(TH1F*)histNtuple->Clone(Form("hist%i",inputRun));
arrayHisto.posSeed=posSeed;
arrayHisto.posSum=posSum;
arrayHisto.posVeto=posVeto;
+// cout<<"TEST1"<<endl;
+
arrayHisto.laborbookdata=laborbookdata;
+// cout<<"TEST2"<<endl;
return arrayHisto;
}
struct laborbook LaborBuch(Int_t inputRun)
{
std::string system;
- Float_t temperature; // desired temperature
- Float_t tempSens; // actual temperature
- std::string chip; // chip number (eg. 1-6)
- std::string source;
- std::string matrix;
- std::string radDose;
+ Float_t temperature = 0; // desired temperature
+ Float_t tempSens = 0; // actual temperature
+ std::string chip = ""; // chip number (eg. 1-6)
+ std::string source = "";
+ std::string matrix = "";
+ std::string radDose = "";
std::ifstream file("LaborbuchMi34.txt");
CSVRow row;
}
}
- cout<<"Run:"<<inputRun<<" System:"<<system<<" Chip:"<<chip<<" Temp:"<<temperature<<" TempSensor:"<<tempSens<<" Source:"<<source<<" RadDose:"<<radDose<<endl;
+// cout<<"Run:"<<inputRun<<" System:"<<system<<" Chip:"<<chip<<" Temp:"<<temperature<<" TempSensor:"<<tempSens<<" Source:"<<source<<" RadDose:"<<radDose<<endl;
struct laborbook laborbookdata;
laborbookdata.inputRun= inputRun;
std::string source;
std::string matrix;
std::string radDose;
-
+
TSQLServer *db = TSQLServer::Connect("mysql://jspc29.x-matter.uni-frankfurt.de","radhard", "mimosa88");
- // printf("Server info: %s\n", db->ServerInfo());
+// printf("Server info: %s\n", db->ServerInfo());
TSQLRow *rowsql;
TSQLResult *res;
try
{
- // query database and print results
- char sqlquery[200];
+// query database and print results
+ char sqlquery[400];
sprintf(sqlquery, "select System,TempCooling,COALESCE(TempChipStart,-10000) as TempChipStart,COALESCE(TempChipEnd,-10000) as TempChipEnd,ChipNum,RadiationSource,Matrix,ChipRadiation from radhard.labbook WHERE runnumber=%d", inputRun);
res = db->Query(sqlquery);
int nrows = res->GetRowCount();
- // printf("\nGot %d rows in result\n", nrows);
+// printf("\nGot %d rows in result\n", nrows);
if (nrows > 0)
{
cout << "Error while reading laboratory book (run number " << inputRun << ")!\n";
}
- // cout<<"Run:"<<inputRun<<" System:"<<system<<" Chip:"<<chip<<" Temp:"<<temperature<<" TempSensor:"<<tempSens<<" Source:"<<source<<" RadDose:"<<radDose << "matrix: " << matrix <<endl;
-
+ cout<<"Run:"<<inputRun<<" System:"<<system<<" Chip:"<<chip<<" Temp:"<<temperature<<" TempSensor:"<<tempSens<<" Source:"<<source<<" RadDose:"<<radDose << "matrix: " << matrix <<endl;
+
struct laborbook laborbookdata;
laborbookdata.inputRun= inputRun;
laborbookdata.system= system;
laborbookdata.source= source;
laborbookdata.matrix= matrix;
laborbookdata.radDose= radDose;
+
+// struct laborbook laborbookdata;
+// laborbookdata.inputRun= 341500;
+// laborbookdata.system= "PXI";
+// laborbookdata.temp= -20;
+// laborbookdata.tempSens= -13.4;
+// laborbookdata.chip= "3";
+// laborbookdata.source= "Fe55";
+// laborbookdata.matrix= "P1";
+// laborbookdata.radDose= "3";
+
return laborbookdata;
}