70 #include "TObjString.h" 84 #include <unordered_map> 106 void algoEndJob ()
override;
109 int statCollectionFromMode(
const char*
tag)
const;
110 void bookDQMHistos(
const char* dqm_dir,
const char* tag);
113 void swapBFieldMode(
void);
116 void algoAnalyzeTheTree();
117 void algoComputeMPVandGain();
120 void getPeakOfLandau(TH1* InputHisto,
double* FitResults,
double LowRange=50,
double HighRange=5400);
121 bool IsGoodLandauFit(
double* FitResults);
123 void qualityMonitor();
124 void MakeCalibrationMap();
125 bool produceTagFilter();
180 std::array< std::vector<APVGain::APVmon>,7 >
Charge_1;
181 std::array< std::vector<APVGain::APVmon>,7 >
Charge_2;
182 std::array< std::vector<APVGain::APVmon>,7 >
Charge_3;
183 std::array< std::vector<APVGain::APVmon>,7 >
Charge_4;
268 unsigned int eventnumber =0;
310 std::unordered_map<unsigned int, stAPVGain*>
APVsColl;
317 std::vector<string>::const_iterator it=dqm_tag_.begin();
318 while(it!=dqm_tag_.end()) {
319 if(*it==
std::string(tag))
return it-dqm_tag_.begin();
329 if(A->GetNbinsX() == B->GetNbinsX()){
332 for(
int x=0;x<=B->GetNbinsX()+1; x++){
333 for(
int y=0;y<=B->GetNbinsY()+1; y++){
334 A->SetBinContent(x,y,A->GetBinContent(x,y)+B->GetBinContent(x,y));
438 EventPrefix_ = evtinfo_pset.getUntrackedParameter<
string>(
"prefix");
439 EventSuffix_ = evtinfo_pset.getUntrackedParameter<
string>(
"suffix");
444 TrackPrefix_ = track_pset.getUntrackedParameter<
string>(
"prefix");
445 TrackSuffix_ = track_pset.getUntrackedParameter<
string>(
"suffix");
460 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Setting " << dqm_dir <<
"in DQM and booking histograms for tag " 465 dbe->setCurrentFolder(dqm_dir);
469 if(!stag.empty() && stag[0]!=
'_') stag.insert(0,1,
'_');
492 std::vector<float> binXarray;
495 binXarray.push_back( (
float)
a );
498 std::array<float,688> binYarray;
500 double p1 = 0.002113;
501 double p2 = 69.01576;
503 for(
int b=0;
b<687;
b++) {
505 if(y<=902.) y = y + 2.;
506 else y = ( p0 -
log(
exp(p0-p1*y) - p2*p1)) / p1;
508 binYarray[687] = 4000.;
523 for (
unsigned int i=0;
i<hnames.size();
i++){
533 for (
unsigned int i=0;
i<hnames.size();
i++){
543 for (
unsigned int i=0;
i<hnames.size();
i++){
553 for (
unsigned int i=0;
i<hnames.size();
i++){
568 MPV_Vs_EtaTIB =
dbe->book2DD(
"MPV_vs_EtaTIB" ,
"MPV vs Eta TIB" , 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
569 MPV_Vs_EtaTID =
dbe->book2DD(
"MPV_vs_EtaTID" ,
"MPV vs Eta TID" , 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
570 MPV_Vs_EtaTOB =
dbe->book2DD(
"MPV_vs_EtaTOB" ,
"MPV vs Eta TOB" , 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
571 MPV_Vs_EtaTEC =
dbe->book2DD(
"MPV_vs_EtaTEC" ,
"MPV vs Eta TEC" , 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
572 MPV_Vs_EtaTECthin =
dbe->book2DD(
"MPV_vs_EtaTEC1",
"MPV vs Eta TEC-thin" , 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
573 MPV_Vs_EtaTECthick =
dbe->book2DD(
"MPV_vs_EtaTEC2",
"MPV vs Eta TEC-thick", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
575 MPV_Vs_PhiTIB =
dbe->book2DD(
"MPV_vs_PhiTIB" ,
"MPV vs Phi TIB" , 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
576 MPV_Vs_PhiTID =
dbe->book2DD(
"MPV_vs_PhiTID" ,
"MPV vs Phi TID" , 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
577 MPV_Vs_PhiTOB =
dbe->book2DD(
"MPV_vs_PhiTOB" ,
"MPV vs Phi TOB" , 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
578 MPV_Vs_PhiTEC =
dbe->book2DD(
"MPV_vs_PhiTEC" ,
"MPV vs Phi TEC" , 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
579 MPV_Vs_PhiTECthin =
dbe->book2DD(
"MPV_vs_PhiTEC1",
"MPV vs Phi TEC-thin" , 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
580 MPV_Vs_PhiTECthick =
dbe->book2DD(
"MPV_vs_PhiTEC2",
"MPV vs Phi TEC-thick", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
582 NoMPVfit =
dbe->book2DD(
"NoMPVfit" ,
"Modules with bad Landau Fit",350, -350, 350, 240, 0, 120);
583 NoMPVmasked =
dbe->book2DD(
"NoMPVmasked" ,
"Masked Modules" ,350, -350, 350, 240, 0, 120);
585 Gains =
dbe->book1DD(
"Gains" ,
"Gains" , 300, 0, 2);
586 MPVs =
dbe->book1DD(
"MPVs" ,
"MPVs" , MPVbin, MPVmin, MPVmax);
587 MPVs320 =
dbe->book1DD(
"MPV_320" ,
"MPV 320 thickness" , MPVbin, MPVmin, MPVmax);
588 MPVs500 =
dbe->book1DD(
"MPV_500" ,
"MPV 500 thickness" , MPVbin, MPVmin, MPVmax);
589 MPVsTIB =
dbe->book1DD(
"MPV_TIB" ,
"MPV TIB" , MPVbin, MPVmin, MPVmax);
590 MPVsTID =
dbe->book1DD(
"MPV_TID" ,
"MPV TID" , MPVbin, MPVmin, MPVmax);
591 MPVsTIDP =
dbe->book1DD(
"MPV_TIDP" ,
"MPV TIDP" , MPVbin, MPVmin, MPVmax);
592 MPVsTIDM =
dbe->book1DD(
"MPV_TIDM" ,
"MPV TIDM" , MPVbin, MPVmin, MPVmax);
593 MPVsTOB =
dbe->book1DD(
"MPV_TOB" ,
"MPV TOB" , MPVbin, MPVmin, MPVmax);
594 MPVsTEC =
dbe->book1DD(
"MPV_TEC" ,
"MPV TEC" , MPVbin, MPVmin, MPVmax);
595 MPVsTECP =
dbe->book1DD(
"MPV_TECP" ,
"MPV TECP" , MPVbin, MPVmin, MPVmax);
596 MPVsTECM =
dbe->book1DD(
"MPV_TECM" ,
"MPV TECM" , MPVbin, MPVmin, MPVmax);
597 MPVsTECthin =
dbe->book1DD(
"MPV_TEC1" ,
"MPV TEC1" , MPVbin, MPVmin, MPVmax);
598 MPVsTECthick =
dbe->book1DD(
"MPV_TEC2" ,
"MPV TEC2" , MPVbin, MPVmin, MPVmax);
599 MPVsTECP1 =
dbe->book1DD(
"MPV_TECP1" ,
"MPV TECP1" , MPVbin, MPVmin, MPVmax);
600 MPVsTECP2 =
dbe->book1DD(
"MPV_TECP2" ,
"MPV TECP2" , MPVbin, MPVmin, MPVmax);
601 MPVsTECM1 =
dbe->book1DD(
"MPV_TECM1" ,
"MPV TECM1" , MPVbin, MPVmin, MPVmax);
602 MPVsTECM2 =
dbe->book1DD(
"MPV_TECM2" ,
"MPV TECM2" , MPVbin, MPVmin, MPVmax);
604 MPVError =
dbe->book1DD(
"MPVError" ,
"MPV Error" , 150, 0, 150);
605 MPVErrorVsMPV =
dbe->book2DD(
"MPVErrorVsMPV" ,
"MPV Error vs MPV" ,300, 0, 600, 150, 0, 150);
606 MPVErrorVsEta =
dbe->book2DD(
"MPVErrorVsEta" ,
"MPV Error vs Eta" , 50, -3.0, 3.0, 150, 0, 150);
607 MPVErrorVsPhi =
dbe->book2DD(
"MPVErrorVsPhi" ,
"MPV Error vs Phi" , 50, -3.4, 3.4, 150, 0, 150);
608 MPVErrorVsN =
dbe->book2DD(
"MPVErrorVsN" ,
"MPV Error vs N" ,500, 0,1000, 150, 0, 150);
615 GainVsPrevGainTIB =
dbe->book2DD(
"GainVsPrevGainTIB" ,
"Gain vs PrevGain TIB" , 100, 0,2, 100, 0,2);
616 GainVsPrevGainTID =
dbe->book2DD(
"GainVsPrevGainTID" ,
"Gain vs PrevGain TID" , 100, 0,2, 100, 0,2);
617 GainVsPrevGainTOB =
dbe->book2DD(
"GainVsPrevGainTOB" ,
"Gain vs PrevGain TOB" , 100, 0,2, 100, 0,2);
618 GainVsPrevGainTEC =
dbe->book2DD(
"GainVsPrevGainTEC" ,
"Gain vs PrevGain TEC" , 100, 0,2, 100, 0,2);
621 for (
unsigned int i=0;
i<hnames.size();
i++){
639 const char * dqm_dir =
"AlCaReco/SiStripGainsHarvesting/";
646 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Switching calibration mode for endorsing BField status: " 656 tTopo_ = TopoHandle.product();
660 auto const &
Det = tkGeom->
dets();
665 unsigned int Index=0;
666 for(
unsigned int i=0;
i<
Det.size();
i++){
674 if(!DetUnit)
continue;
677 unsigned int NAPV = Topo.
nstrips()/128;
679 for(
unsigned int j=0;j<NAPV;j++){
695 APV->
x = DetUnit->position().basicVector().x();
696 APV->
y = DetUnit->position().basicVector().y();
697 APV->
z = DetUnit->position().basicVector().z();
698 APV->
Eta = DetUnit->position().basicVector().eta();
699 APV->
Phi = DetUnit->position().basicVector().phi();
700 APV->
R = DetUnit->position().basicVector().transverse();
701 APV->
Thickness = DetUnit->surface().bounds().thickness();
713 for(
unsigned int i=0;
i<
Det.size();
i++){
718 if(!DetUnit)
continue;
721 unsigned int NROCRow = Topo.
nrows()/(80.);
722 unsigned int NROCCol = Topo.
ncolumns()/(52.);
724 for(
unsigned int j=0;j<NROCRow;j++){
725 for(
unsigned int i=0;
i<NROCCol;
i++){
741 APV->
x = DetUnit->position().basicVector().x();
742 APV->
y = DetUnit->position().basicVector().y();
743 APV->
z = DetUnit->position().basicVector().z();
744 APV->
Eta = DetUnit->position().basicVector().eta();
745 APV->
Phi = DetUnit->position().basicVector().phi();
746 APV->
R = DetUnit->position().basicVector().transverse();
747 APV->
Thickness = DetUnit->surface().bounds().thickness();
781 return ( (isOn && !is0T) || (!isOn && is0T) );
799 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Switching calibration mode for endorsing BField status: " 828 edm::LogWarning(
"SiStripGainFromCalibTree")<<
"WARNING: TickMarkGain in the global tag changed\n"<< std::endl
829 <<
" APV->SubDet: "<< APV->
SubDet <<
" APV->APVId:" << APV->
APVId << std::endl
830 <<
" APV->PreviousGainTick: "<<APV->
PreviousGainTick<<
" newPreviousGainTick: "<<newPreviousGainTick<<std::endl;
848 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Starting harvesting statistics" << std::endl;
856 if(!stag.empty() && stag[0]!=
'_') stag.insert(0,1,
'_');
890 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvi.c_str()
891 <<
", statistics will not be summed!" << std::endl;
894 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Harvesting " 895 << (
Charge_Vs_Index[elepos])->getTH2S()->GetEntries() <<
" more clusters" << std::endl;
904 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTIB.c_str()
905 <<
", statistics will not be summed!" << std::endl;
909 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTOB.c_str()
910 <<
", statistics will not be summed!" << std::endl;
914 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTIDP.c_str()
915 <<
", statistics will not be summed!" << std::endl;
919 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTIDM.c_str()
920 <<
", statistics will not be summed!" << std::endl;
924 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTECP1.c_str()
925 <<
", statistics will not be summed!" << std::endl;
929 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTECP2.c_str()
930 <<
", statistics will not be summed!" << std::endl;
934 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTECM1.c_str()
935 <<
", statistics will not be summed!" << std::endl;
939 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTECM2.c_str()
940 <<
", statistics will not be summed!" << std::endl;
946 for (
unsigned int i=0;
i<tags.size();
i++){
950 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << tag.c_str()
951 <<
", statistics will not be summed!" << std::endl;
952 }
else (
Charge_1[Harvest][i]).monitor->getTH1D()->Add((
Charge_1[elepos][i]).monitor->getTH1D());
956 for (
unsigned int i=0;
i<tags.size();
i++){
960 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << tag.c_str()
961 <<
", statistics will not be summed!" << std::endl;
962 }
else (
Charge_2[Harvest][i]).monitor->getTH1D()->Add((
Charge_2[elepos][i]).monitor->getTH1D());
967 for (
unsigned int i=0;
i<tags.size();
i++){
971 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << tag.c_str()
972 <<
", statistics will not be summed!" << std::endl;
973 }
else (
Charge_3[Harvest][i]).monitor->getTH1D()->Add((
Charge_3[elepos][i]).monitor->getTH1D());
978 for (
unsigned int i=0;
i<tags.size();
i++){
982 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << tag.c_str()
983 <<
", statistics will not be summed!" << std::endl;
984 }
else (
Charge_4[Harvest][i]).monitor->getTH1D()->Add((
Charge_4[elepos][i]).monitor->getTH1D());
996 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Analyzing calibration tree" << std::endl;
1015 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Saving summary into root file" << std::endl;
1041 FitResults[0] = -0.5;
1043 FitResults[2] = -0.5;
1045 FitResults[4] = -0.5;
1051 TF1* MyLandau =
new TF1(
"MyLandau",
"landau",LowRange, HighRange);
1052 MyLandau->SetParameter(1,300);
1053 InputHisto->Fit(MyLandau,
"0QR WW");
1056 FitResults[0] = MyLandau->GetParameter(1);
1057 FitResults[1] = MyLandau->GetParError(1);
1058 FitResults[2] = MyLandau->GetParameter(2);
1059 FitResults[3] = MyLandau->GetParError(2);
1060 FitResults[4] = MyLandau->GetChisquare() / MyLandau->GetNDF();
1061 FitResults[5] = MyLandau->GetParameter(0);
1067 if(FitResults[0] <= 0 )
return false;
1083 NTrack+=(*trackp).size();
1087 unsigned int FirstAmplitude=0;
1088 for(
unsigned int i=0;
i<(*chargeoverpath).size();
i++){
1089 FirstAmplitude+=(*nstrips)[
i];
1090 int TI = (*trackindex)[
i];
1124 bool Saturation =
false;
1125 for(
unsigned int s=0;
s<(*nstrips)[
i];
s++){
1126 int StripCharge = (*amplitude)[FirstAmplitude-(*nstrips)[
i]+
s];
1130 if(StripCharge>1024){
1133 }
else if(StripCharge>254){
1137 Charge += StripCharge;
1141 Charge = (*charge)[
i];
1143 Charge = (*charge)[
i]/265.0;
1148 double ClusterChargeOverPath = ( (double) Charge )/(*path)[
i] ;
1150 if(
Validation) {ClusterChargeOverPath/=(*gainused)[
i];}
1155 if(APV->
SubDet<=2)
continue;
1166 for(
unsigned int s=0;
s<(*nstrips)[
i];
s++){
1167 int StripCharge = (*amplitude)[FirstAmplitude-(*nstrips)[
i]+
s];
1168 if(StripCharge>1024) StripCharge = 255;
1169 else if(StripCharge>254) StripCharge = 254;
1170 mCharge1 += StripCharge;
1171 mCharge2 += StripCharge;
1172 mCharge3 += StripCharge;
1173 mCharge4 += StripCharge;
1176 mCharge2 *= (*gainused)[
i];
1177 mCharge3 *= (*gainusedTick)[
i];
1178 mCharge4 *= ( (*gainused)[
i] * (*gainusedTick)[
i]);
1180 std::vector<APVGain::APVmon>& v1 =
Charge_1[elepos];
1182 for(
unsigned int m=0;
m<cmon1.size();
m++) cmon1[
m]->
Fill(( (
double) mCharge1 )/(*path)[
i]);
1184 std::vector<APVGain::APVmon>& v2 =
Charge_2[elepos];
1186 for(
unsigned int m=0;
m<cmon2.size();
m++) cmon2[
m]->
Fill(( (
double) mCharge2 )/(*path)[
i]);
1188 std::vector<APVGain::APVmon>& v3 =
Charge_3[elepos];
1190 for(
unsigned int m=0;
m<cmon3.size();
m++) cmon3[
m]->
Fill(( (
double) mCharge3 )/(*path)[
i]);
1192 std::vector<APVGain::APVmon>& v4 =
Charge_4[elepos];
1194 for(
unsigned int m=0;
m<cmon4.size();
m++) cmon4[
m]->
Fill(( (
double) mCharge4 )/(*path)[
i]);
1213 }
else if(APV->
Eta>0){
1227 TString tree_path = TString::Format(
"gainCalibrationTree%s/tree",
m_calibrationMode.c_str());
1228 TTree*
tree =
dynamic_cast<TTree*
> (tfile->Get(tree_path.Data()));
1260 unsigned int nentries = tree->GetEntries();
1261 printf(
"Number of Events = %i + %i = %i\n",
NEvent,nentries,(
NEvent+nentries));
1262 printf(
"Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
1263 printf(
"Looping on the Tree :");
1264 int TreeStep = nentries/50;
if(TreeStep<=1)TreeStep=1;
1265 for (
unsigned int ientry = 0; ientry < tree->GetEntries(); ientry++) {
1266 if(ientry%TreeStep==0){printf(
".");fflush(
stdout);}
1267 tree->GetEntry(ientry);
1277 TH1F* Proj =
nullptr;
1278 double FitResults[6];
1279 double MPVmean = 300;
1284 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not execute algoComputeMPVandGain method because " 1286 <<
"Please check if input contains " 1294 printf(
"Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
1295 printf(
"Fitting Charge Distribution :");
1298 if(I%TreeStep==0){printf(
".");fflush(
stdout);}
1300 if(APV->
Bin<0) APV->
Bin = chvsidx->GetXaxis()->FindBin(APV->
Index);
1304 Proj = (TH1F*)(chvsidx->ProjectionY(
"",chvsidx->GetXaxis()->FindBin(APV->
Index),chvsidx->GetXaxis()->FindBin(APV->
Index),
"e"));
1309 int SecondAPVId = APV->
APVId;
1310 if(SecondAPVId%2==0){ SecondAPVId = SecondAPVId+1; }
else{ SecondAPVId = SecondAPVId-1; }
1312 if(APV2->
Bin<0) APV2->
Bin = chvsidx->GetXaxis()->FindBin(APV2->
Index);
1313 TH1F* Proj2 = (TH1F*)(chvsidx->ProjectionY(
"",APV2->
Bin,APV2->
Bin,
"e"));
1314 if(Proj2){Proj->Add(Proj2,1);
delete Proj2;}
1316 for(
unsigned int i=0;
i<16;
i++){
1321 if(APV2->
Bin<0) APV2->
Bin = chvsidx->GetXaxis()->FindBin(APV2->
Index);
1322 TH1F* Proj2 = (TH1F*)(chvsidx->ProjectionY(
"",APV2->
Bin,APV2->
Bin,
"e"));
1323 if(Proj2){Proj->Add(Proj2,1);
delete Proj2;}
1331 APV->
FitMPV = FitResults[0];
1337 APV->
NEntries = Proj->GetEntries();
1359 if(APV==
nullptr)
continue;
1361 unsigned int Index = APV->
Index;
1369 double FitMPV = APV->
FitMPV;
1375 if (SubDet<3)
continue;
1380 int bin = chvsidx->GetXaxis()->FindBin(Index);
1381 TH1D* Proj = chvsidx->ProjectionY(
"proj",bin,bin);
1382 for (
int binId=0; binId<Proj->GetXaxis()->GetNbins();binId++) {
1383 double new_charge = Proj->GetXaxis()->GetBinCenter(binId) /
Gain;
1384 if (Proj->GetBinContent(binId)!=0.) {
1385 for (
unsigned int h=0;
h<charge_histos.size();
h++) {
1386 TH1D* chisto = (charge_histos[
h])->getTH1D();
1387 for (
int e=0;
e<Proj->GetBinContent(binId);
e++) chisto->Fill(new_charge);
1416 }
else if(SubDet==4) {
1423 }
else if (SubDet==5) {
1428 }
else if (SubDet==6) {
1434 if(Thickness<0.04) {
1441 if(Thickness>0.04) {
1465 unsigned int tree_Index;
1466 unsigned int tree_Bin;
1467 unsigned int tree_DetId;
1468 unsigned char tree_APVId;
1469 unsigned char tree_SubDet;
1476 float tree_Thickness;
1478 float tree_FitMPVErr;
1479 float tree_FitWidth;
1480 float tree_FitWidthErr;
1481 float tree_FitChi2NDF;
1484 double tree_PrevGain;
1485 double tree_PrevGainTick;
1486 double tree_NEntries;
1490 MyTree = tfs->
make<TTree> (
"APVGain",
"APVGain");
1491 MyTree->Branch(
"Index" ,&tree_Index ,
"Index/i");
1492 MyTree->Branch(
"Bin" ,&tree_Bin ,
"Bin/i");
1493 MyTree->Branch(
"DetId" ,&tree_DetId ,
"DetId/i");
1494 MyTree->Branch(
"APVId" ,&tree_APVId ,
"APVId/b");
1495 MyTree->Branch(
"SubDet" ,&tree_SubDet ,
"SubDet/b");
1496 MyTree->Branch(
"x" ,&tree_x ,
"x/F");
1497 MyTree->Branch(
"y" ,&tree_y ,
"y/F");
1498 MyTree->Branch(
"z" ,&tree_z ,
"z/F");
1499 MyTree->Branch(
"Eta" ,&tree_Eta ,
"Eta/F");
1500 MyTree->Branch(
"R" ,&tree_R ,
"R/F");
1501 MyTree->Branch(
"Phi" ,&tree_Phi ,
"Phi/F");
1502 MyTree->Branch(
"Thickness" ,&tree_Thickness ,
"Thickness/F");
1503 MyTree->Branch(
"FitMPV" ,&tree_FitMPV ,
"FitMPV/F");
1504 MyTree->Branch(
"FitMPVErr" ,&tree_FitMPVErr ,
"FitMPVErr/F");
1505 MyTree->Branch(
"FitWidth" ,&tree_FitWidth ,
"FitWidth/F");
1506 MyTree->Branch(
"FitWidthErr" ,&tree_FitWidthErr,
"FitWidthErr/F");
1507 MyTree->Branch(
"FitChi2NDF" ,&tree_FitChi2NDF ,
"FitChi2NDF/F");
1508 MyTree->Branch(
"FitNorm" ,&tree_FitNorm ,
"FitNorm/F");
1509 MyTree->Branch(
"Gain" ,&tree_Gain ,
"Gain/D");
1510 MyTree->Branch(
"PrevGain" ,&tree_PrevGain ,
"PrevGain/D");
1511 MyTree->Branch(
"PrevGainTick" ,&tree_PrevGainTick,
"PrevGainTick/D");
1512 MyTree->Branch(
"NEntries" ,&tree_NEntries ,
"NEntries/D");
1513 MyTree->Branch(
"isMasked" ,&tree_isMasked ,
"isMasked/O");
1517 fprintf(Gains,
"NEvents = %i\n",
NEvent);
1518 fprintf(Gains,
"NTracks = %i\n",
NTrack);
1522 fprintf(Gains,
"Number of Strip APVs = %lu\n",static_cast<unsigned long>(
NStripAPVs));
1526 fprintf(Gains,
"NEvents = %i\n",
NEvent);
1527 fprintf(Gains,
"NTracks = %i\n",
NTrack);
1530 fprintf(Gains,
"Number of Strip APVs = %lu\n",static_cast<unsigned long>(
NStripAPVs));
1538 if(APV==
nullptr)
continue;
1542 tree_Index = APV->
Index;
1544 tree_DetId = APV->
DetId;
1545 tree_APVId = APV->
APVId;
1546 tree_SubDet = APV->
SubDet;
1550 tree_Eta = APV->
Eta;
1552 tree_Phi = APV->
Phi;
1554 tree_FitMPV = APV->
FitMPV;
1558 tree_FitChi2NDF = APV->
FitChi2;
1560 tree_Gain = APV->
Gain;
1567 if(tree_DetId==402673324){
1568 printf(
"%i | %i : %f --> %f (%f)\n", tree_DetId, tree_APVId, tree_PrevGain, tree_Gain, tree_NEntries);
1574 if(Gains)fclose(Gains);
1585 edm::LogError(
"SiStripGainFromCalibTree") <<
"produceTagFilter -> Return false: could not retrieve the " 1587 <<
"Please check if input contains " 1597 <<
"produceTagFilter -> Return false: Statistics is too low : " << integral << endl;
1603 <<
"produceTagFilter -> Return false: ratio of GOOD/TOTAL is too low: " << (1.0 *
GOOD) / (
GOOD+
BAD) << endl;
1615 edm::LogWarning(
"SiStripGainFromCalibTree")<<
"getNewObject -> will not produce a paylaod because produceTagFilter returned false " << endl;
1621 std::vector<float>* theSiStripVector =
nullptr;
1622 unsigned int PreviousDetId = 0;
1625 if(APV==
nullptr){ printf(
"Bug\n");
continue; }
1626 if(APV->
SubDet<=2)
continue;
1627 if(APV->
DetId != PreviousDetId){
1628 if(theSiStripVector!=
nullptr){
1630 if ( !obj->
put(PreviousDetId,range) ) printf(
"Bug to put detId = %i\n",PreviousDetId);
1632 theSiStripVector =
new std::vector<float>;
1633 PreviousDetId = APV->
DetId;
1635 theSiStripVector->push_back(APV->
Gain);
1637 if(theSiStripVector!=
nullptr){
1639 if ( !obj->
put(PreviousDetId,range) ) printf(
"Bug to put detId = %i\n",PreviousDetId);
1642 if (theSiStripVector!=
nullptr)
delete theSiStripVector;
1653 if(APV!=
nullptr)
delete APV;
1662 TChain* t1 =
new TChain(
"SiStripCalib/APVGain");
1665 unsigned int tree_DetId;
1666 unsigned char tree_APVId;
1669 t1->SetBranchAddress(
"DetId" ,&tree_DetId );
1670 t1->SetBranchAddress(
"APVId" ,&tree_APVId );
1671 t1->SetBranchAddress(
"Gain" ,&tree_Gain );
1673 for (
unsigned int ientry = 0; ientry < t1->GetEntries(); ientry++) {
1674 t1->GetEntry(ientry);
MonitorElement * MPVError
bool IsApvBad(const uint32_t &detid, const short &apvNb) const
edm::EDGetTokenT< std::vector< int > > trackindex_token_
std::vector< MonitorElement * > Charge_Vs_Index
T getParameter(std::string const &) const
EventNumber_t event() const
void swapBFieldMode(void)
T getUntrackedParameter(std::string const &, T const &) const
std::vector< string > dqm_tag_
MonitorElement * MPVsTECP2
virtual int nrows() const =0
const std::vector< float > * trackp
unsigned int MinTrackHits
edm::EDGetTokenT< std::vector< double > > tracketa_token_
edm::EDGetTokenT< std::vector< unsigned char > > amplitude_token_
std::vector< MonitorElement * > FetchMonitor(std::vector< APVmon >, uint32_t, const TrackerTopology *topo=nullptr)
std::vector< APVGain::APVmon > newCharge
const std::vector< double > * chargeoverpath
MonitorElement * DiffWRTPrevGainTEC
edm::EDGetTokenT< std::vector< unsigned int > > rawid_token_
const std::vector< unsigned char > * amplitude
bool isBFieldConsistentWithMode(const edm::EventSetup &iSetup) const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
~SiStripGainFromCalibTree() override
MonitorElement * MPV_Vs_PhiTEC
SiStripApvGain * getNewObject() override
MonitorElement * MPVsTIDP
const std::vector< double > * localdirz
size_t getNumberOfTags() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * MPVErrorVsN
const std::vector< double > * trackchi2ndof
void algoBeginRun(const edm::Run &run, const edm::EventSetup &iSetup) override
const std::vector< double > * localdirx
const std::vector< double > * gainusedTick
MonitorElement * MPV_Vs_PhiTID
dispatcher processEvent(e, inputTag, standby)
#define DEFINE_FWK_MODULE(type)
unsigned int NClusterPixel
void algoEndRun(const edm::Run &run, const edm::EventSetup &iSetup) override
MonitorElement * MPV_Vs_EtaTOB
const std::vector< unsigned int > * rawid
MonitorElement * MPV_Vs_PhiTIB
edm::EDGetTokenT< std::vector< bool > > overlapping_token_
double tagCondition_GoodFrac
SiStripGainFromCalibTree(const edm::ParameterSet &)
const TrackerTopology * tTopo_
edm::Handle< T > connect(const T *&ptr, edm::EDGetTokenT< T > token, const edm::Event &evt)
MonitorElement * MPVErrorVsPhi
int subdetectorPlane(uint32_t, const TrackerTopology *)
const std::vector< int > * trackalgo
std::vector< MonitorElement * > Charge_Vs_PathlengthTOB
MonitorElement * MPV_Vs_EtaTIB
void storeOnTree(TFileService *tfs)
T * make(const Args &...args) const
make new ROOT object
const std::vector< float > * trackpt
std::vector< MonitorElement * > Charge_Vs_PathlengthTECM1
const std::vector< unsigned int > * trackhitsvalid
MonitorElement * MPVsTECP
MonitorElement * MPVsTECM
void MakeCalibrationMap()
MonitorElement * MPVsTECM2
std::vector< MonitorElement * > Charge_Vs_PathlengthTECM2
MonitorElement * MPV_Vs_EtaTECthick
double MaxTrackChiOverNdf
static float getApvGain(const uint16_t &apv, const SiStripApvGain::Range &range)
MonitorElement * GainVsPrevGainTIB
edm::EDGetTokenT< std::vector< bool > > farfromedge_token_
bool put(const uint32_t &detID, Range input)
uint32_t rawId() const
get the raw id
U second(std::pair< T, U > const &p)
edm::EDGetTokenT< std::vector< unsigned int > > trackhitsvalid_token_
std::string m_calibrationMode
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
std::vector< stAPVGain * > APVsCollOrdered
edm::EDGetTokenT< std::vector< double > > path_token_
void algoComputeMPVandGain()
edm::EDGetTokenT< std::vector< int > > trackalgo_token_
MonitorElement * GainVsPrevGainTEC
MonitorElement * MPVErrorVsEta
edm::EDGetTokenT< std::vector< float > > trackp_token_
bool IsGoodLandauFit(double *FitResults)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::unordered_map< unsigned int, stAPVGain * > APVsColl
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
bool doChargeMonitorPerPlane
std::array< std::vector< APVGain::APVmon >, 7 > Charge_3
void algoBeginJob(const edm::EventSetup &iSetup) override
std::pair< ContainerIterator, ContainerIterator > Range
edm::EDGetTokenT< std::vector< bool > > TrigTech_token_
edm::EDGetTokenT< std::vector< double > > chargeoverpath_token_
const std::complex< double > I
edm::EDGetTokenT< std::vector< double > > gainusedTick_token_
const std::vector< double > * gainused
MonitorElement * MPV_Vs_EtaTID
MonitorElement * GainVsPrevGainTOB
MonitorElement * MPVsTECthick
std::vector< MonitorElement * > Charge_Vs_PathlengthTECP1
edm::EDGetTokenT< std::vector< double > > localdirz_token_
static const std::string B
const std::vector< unsigned short > * firststrip
std::vector< MonitorElement * > Charge_Vs_PathlengthTIDM
const std::vector< double > * localdiry
std::array< std::vector< APVGain::APVmon >, 7 > Charge_2
edm::EDGetTokenT< std::vector< unsigned int > > charge_token_
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
MonitorElement * MPV_Vs_PhiTECthick
MonitorElement * NoMPVmasked
MonitorElement * GainVsPrevGainTID
MonitorElement * MPV_Vs_PhiTOB
Integral< F, X >::type integral(const F &f)
def elem(elemtype, innerHTML='', html_class='', kwargs)
MonitorElement * DiffWRTPrevGainTIB
bin
set the eta bin as selection string.
vector< string > VInputFiles
void algoEndJob() override
edm::EDGetTokenT< std::vector< unsigned short > > nstrips_token_
std::vector< MonitorElement * > Charge_Vs_PathlengthTECP2
std::string m_calibrationPath
const std::vector< int > * trackindex
int statCollectionFromMode(const char *tag) const
MonitorElement * MPVsTECthin
std::vector< MonitorElement * > Charge_Vs_PathlengthTIB
edm::EDGetTokenT< std::vector< unsigned short > > firststrip_token_
void algoAnalyze(const edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< std::vector< float > > trackpt_token_
MonitorElement * DiffWRTPrevGainTOB
T const * product() const
const std::vector< bool > * overlapping
const std::vector< bool > * saturation
MonitorElement * MPVsTECP1
MonitorElement * MPV_Vs_EtaTECthin
virtual int nstrips() const =0
bool merge(LuminosityBlockRange &lh, LuminosityBlockRange &rh)
void getPeakOfLandau(TH1 *InputHisto, double *FitResults, double LowRange=50, double HighRange=5400)
int subdetectorSide(uint32_t, const TrackerTopology *)
void algoAnalyzeTheTree()
MonitorElement * MPVsTECM1
const std::vector< bool > * farfromedge
MonitorElement * MPV_Vs_PhiTECthin
MonitorElement * MPV_Vs_EtaTEC
const std::vector< bool > * TrigTech
void setDoStore(const bool doStore)
When set to false the payload will not be written to the db.
MonitorElement * NoMPVfit
virtual int ncolumns() const =0
MonitorElement * MPVErrorVsMPV
std::vector< std::string > VChargeHisto
double tagCondition_NClusters
edm::EDGetTokenT< std::vector< double > > localdirx_token_
edm::EDGetTokenT< std::vector< bool > > saturation_token_
edm::EDGetTokenT< std::vector< double > > trackchi2ndof_token_
std::vector< MonitorElement * > Charge_Vs_PathlengthTIDP
edm::EDGetTokenT< std::vector< double > > localdiry_token_
const std::vector< unsigned int > * charge
std::vector< std::pair< std::string, std::string > > monHnames(std::vector< std::string >, bool, const char *tag)
const std::vector< double > * path
const std::vector< double > * trackphi
std::array< std::vector< APVGain::APVmon >, 7 > Charge_4
const std::vector< unsigned short > * nstrips
T const * product() const
edm::EDGetTokenT< std::vector< double > > gainused_token_
int subdetectorId(uint32_t)
MonitorElement * DiffWRTPrevGainTID
void bookDQMHistos(const char *dqm_dir, const char *tag)
edm::EDGetTokenT< std::vector< double > > trackphi_token_
const std::vector< double > * tracketa
MonitorElement * MPVsTIDM
unsigned int NClusterStrip
void merge(TH2 *A, TH2 *B)
const SiStripApvGain::Range getRange(uint32_t detID) const
std::array< std::vector< APVGain::APVmon >, 7 > Charge_1